Skip to content

Commit

Permalink
Merge changes from main and fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
zzooeeyy committed Jan 10, 2024
2 parents d2a7613 + f40f492 commit d5d2b5b
Show file tree
Hide file tree
Showing 70 changed files with 1,839 additions and 1,111 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/publish-experimental-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,27 @@ jobs:
with:
ref: experimental

# Setup .npmrc file to publish to npm
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'yarn'
registry-url: 'https://registry.npmjs.org'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Install dependencies
run: yarn --frozen-lockfile

- name: Build
run: yarn build

- name: Version
run: yarn changeset version --snapshot experimental

- name: Publish to NPM
id: changesets
uses: changesets/action@v1
with:
version: yarn changeset version --snapshot experimental
publish: yarn changeset publish --tag experimental
setupGitUser: false
createGithubReleases: false
run: yarn changeset publish --tag experimental
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@shopify/loom-plugin-prettier": "^2.0.1",
"@shopify/prettier-config": "^1.1.2",
"@shopify/typescript-configs": "^5.1.0",
"eslint": "^8.40.0",
"eslint": "^8.55.0",
"jest": "^29.1.0",
"jest-fetch-mock": "^3.0.3",
"jest-runner-eslint": "^2.0.0",
Expand Down
12 changes: 12 additions & 0 deletions packages/shopify-app-express/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## 4.0.0

### Major Changes

- d3e4b5e: Updated `@shopify/shopify-api` to the latest major version. Please follow [the v9 migration guide](https://github.com/Shopify/shopify-api-js/blob/main/packages/shopify-api/docs/migrating-to-v9.md) to update your app.

### Patch Changes

- Updated dependencies [d3e4b5e]
- @shopify/shopify-app-session-storage-memory@2.0.3
- @shopify/shopify-app-session-storage@2.0.3

## 3.0.2

### Patch Changes
Expand Down
18 changes: 9 additions & 9 deletions packages/shopify-app-express/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shopify/shopify-app-express",
"version": "3.0.2",
"version": "4.0.0",
"description": "Shopify Express Middleware - to simplify the building of Shopify Apps with Express",
"repository": {
"type": "git",
Expand Down Expand Up @@ -30,24 +30,24 @@
"Storefront API"
],
"dependencies": {
"@shopify/shopify-api": "^8.1.1",
"@shopify/shopify-app-session-storage": "^2.0.2",
"@shopify/shopify-app-session-storage-memory": "^2.0.2",
"@shopify/shopify-api": "^9.0.1",
"@shopify/shopify-app-session-storage": "^2.0.3",
"@shopify/shopify-app-session-storage-memory": "^2.0.3",
"cookie-parser": "^1.4.6",
"express": "^4.18.1",
"semver": "^7.5.1",
"tslib": "^2.4.0"
"semver": "^7.5.4",
"tslib": "^2.6.2"
},
"devDependencies": {
"@shopify/eslint-plugin": "^42.1.0",
"@shopify/prettier-config": "^1.1.2",
"@types/compression": "^1.7.2",
"@types/cookie-parser": "^1.4.3",
"@types/express": "^4.17.16",
"@types/jsonwebtoken": "^9.0.2",
"eslint": "^8.40.0",
"@types/jsonwebtoken": "^9.0.5",
"eslint": "^8.55.0",
"eslint-plugin-prettier": "^4.2.1",
"jsonwebtoken": "^9.0.0",
"jsonwebtoken": "^9.0.2",
"prettier": "^2.8.8",
"supertest": "^6.3.3",
"typescript": "^4.9.5"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ function assertOAuthRequests(
expect({
method: 'POST',
url: `https://${TEST_SHOP}/admin/api/${LATEST_API_VERSION}/graphql.json`,
body: expect.stringContaining(query),
body: expect.objectContaining({query: expect.stringContaining(query)}),
}).toMatchMadeHttpRequest(),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ describe('webhook integration', () => {
expect({
method: 'POST',
url: `https://${TEST_SHOP}/admin/api/${LATEST_API_VERSION}/graphql.json`,
body: expect.stringContaining(query),
body: expect.objectContaining({
query: expect.stringContaining(query),
}),
}).toMatchMadeHttpRequest(),
);

Expand Down
13 changes: 11 additions & 2 deletions packages/shopify-app-express/src/__tests__/test-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ interface AssertHttpRequestParams {
export function mockShopifyResponse(body: MockBody, init?: MockParams) {
fetchMock.mockResponse(
typeof body === 'string' ? body : JSON.stringify(body),
init,
mockResponseInit(init),
);
}

Expand All @@ -84,13 +84,22 @@ export function mockShopifyResponses(
([body, init]) => {
const bodyString = typeof body === 'string' ? body : JSON.stringify(body);

return init ? [bodyString, init] : [bodyString, {}];
return [bodyString, mockResponseInit(init)];
},
);

fetchMock.mockResponses(...parsedResponses);
}

function mockResponseInit(init?: MockParams): MockParams {
const initObj = init ?? {};

return {
...initObj,
headers: {'Content-Type': 'application/json', ...initObj.headers},
};
}

declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace jest {
Expand Down
4 changes: 2 additions & 2 deletions packages/shopify-app-express/src/auth/auth-callback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {Request, Response} from 'express';
import {
BotActivityDetected,
CookieNotFound,
gdprTopics,
privacyTopics,
InvalidOAuthError,
Session,
Shopify,
Expand Down Expand Up @@ -83,7 +83,7 @@ async function registerWebhooks(
}

for (const response of responsesByTopic[topic]) {
if (!response.success && !gdprTopics.includes(topic)) {
if (!response.success && !privacyTopics.includes(topic)) {
const result: any = response.result;

if (result.errors) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,10 @@ describe('ensureInstalledOnShop', () => {
)}`,
];

mockShopifyResponse({});
mockShopifyResponse({
data: {},
extensions: {},
});
await shopify.config.sessionStorage.storeSession(session);

await request(app)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,10 @@ describe('validateAuthenticatedSession', () => {
});

it('finds a session with the right cookie', async () => {
mockShopifyResponse({});
mockShopifyResponse({
data: {},
extensions: {},
});

const response = await request(app)
.get('/test/shop?shop=my-shop.myshopify.io')
Expand Down
2 changes: 1 addition & 1 deletion packages/shopify-app-express/src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const SHOPIFY_EXPRESS_LIBRARY_VERSION = '3.0.2';
export const SHOPIFY_EXPRESS_LIBRARY_VERSION = '4.0.0';
13 changes: 13 additions & 0 deletions packages/shopify-app-remix/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# @shopify/shopify-app-remix

## 2.3.0

### Minor Changes

- a9c7836: Adding support for the new clients from `@shopify/admin-api-client` and `@shopify/storefront-api-client` that can leverage `@shopify/api-codegen-preset` to automatically type GraphQL operations using Codegen.

For more information on how to add types to your queries, see [the `@shopify/api-codegen-preset` documentation](https://github.com/Shopify/shopify-api-js/tree/main/packages/api-codegen-preset).

### Patch Changes

- Updated dependencies [d3e4b5e]
- @shopify/shopify-app-session-storage@2.0.3

## 2.2.0

### Minor Changes
Expand Down
147 changes: 66 additions & 81 deletions packages/shopify-app-remix/docs/generated/generated_docs_data.json

Large diffs are not rendered by default.

Loading

0 comments on commit d5d2b5b

Please sign in to comment.