Skip to content

Commit

Permalink
Merge branch 'main' into liz/add-abort-signal
Browse files Browse the repository at this point in the history
  • Loading branch information
lizkenyon authored Jan 21, 2025
2 parents 89d803e + f905b0f commit a7bb130
Show file tree
Hide file tree
Showing 20 changed files with 1,179 additions and 1,212 deletions.
6 changes: 6 additions & 0 deletions .changeset/dependabot-1947.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@shopify/shopify-api': patch
'@shopify/shopify-app-remix': patch
---

Updated `isbot` dependencies
5 changes: 5 additions & 0 deletions .changeset/dependabot-1953.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/shopify-api': patch
---

Updated `uuid` dependencies
5 changes: 5 additions & 0 deletions .changeset/dependabot-1985.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/shopify-app-session-storage-dynamodb': patch
---

Updated `@aws-sdk/client-dynamodb`, ` @aws-sdk/util-dynamodb` dependencies
5 changes: 5 additions & 0 deletions .changeset/tiny-jeans-boil.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/shopify-app-express': patch
---

Change common logs from info level to debug
23 changes: 20 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
version: 2
updates:
# Enable version updates for npm
- package-ecosystem: "npm"
- package-ecosystem: 'npm'
# Look for `package.json` and `lock` files in the `root` directory
directory: "/"
directory: '/'
# Check the npm registry for updates every day (weekdays)
schedule:
interval: "daily"
interval: 'daily'
# Dependabot defaults to 5 open pull requests at a time
open-pull-requests-limit: 100

# Group together PRs of interdependant packages
groups:
aws-sdk:
patterns:
- '@aws-sdk/client-dynamodb'
- '@aws-sdk/util-dynamodb'
remix-run:
patterns:
- '@remix-run/node'
- '@remix-run/react'
- '@remix-run/testing'
- '@remix-run/server-runtime'
prisma:
patterns:
- 'prisma'
- '@prisma/client'
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@babel/plugin-transform-runtime": "^7.25.9",
"@babel/preset-env": "^7.26.0",
"@changesets/cli": "^2.27.11",
"@cloudflare/workers-types": "^4.20241230.0",
"@cloudflare/workers-types": "^4.20250109.0",
"@jest/types": "^29.6.3",
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-commonjs": "^28.0.2",
Expand All @@ -34,26 +34,26 @@
"@shopify/prettier-config": "^1.1.2",
"@shopify/typescript-configs": "^5.1.0",
"@types/jest": "^29.5.14",
"@types/node": "^22.10.5",
"@types/node": "^22.10.7",
"@types/supertest": "^6.0.2",
"eslint": "^8.57.1",
"eslint-plugin-jest": "^28.10.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-jest": "^28.11.0",
"eslint-plugin-prettier": "^5.2.3",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-fetch-mock": "^3.0.3",
"jest-runner-eslint": "^2.2.1",
"prettier": "^3.4.1",
"rimraf": "^5.0.7",
"rollup": "^4.30.1",
"rollup": "^4.31.0",
"rollup-plugin-dts": "^6.1.1",
"rollup-plugin-exclude-dependencies-from-bundle": "^1.1.23",
"supertest": "^7.0.0",
"ts-jest": "^29.1.3",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"tslib": "^2.8.1",
"turbo": "^2.3.3",
"typescript": "5.7.2"
"typescript": "5.7.3"
},
"dependencies": {},
"resolutions": {
Expand Down
93 changes: 93 additions & 0 deletions packages/api-clients/api-codegen-preset/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,84 @@ export default {
};
```

#### Example `.graphqlrc.ts` file with to generate types for UI extensions
You can specify multiple APIs in your `.graphqlrc.ts` file by adding multiple projects.

```js
import { LATEST_API_VERSION } from "@shopify/shopify-api";
import { shopifyApiProject, ApiType } from "@shopify/api-codegen-preset";
import type { IGraphQLConfig } from "graphql-config";

function getConfig() {
const config: IGraphQLConfig = {
projects: {
default: shopifyApiProject({
apiType: ApiType.Storefront,
apiVersion: LATEST_API_VERSION,
documents: ["./extensions/**/*.{js,ts,jsx,tsx}", "./extensions/.server/**/*.{js,ts,jsx,tsx}"],
outputDir: "./extensions/types",
}),
UIExtensions: shopifyApiProject({
apiType: ApiType.Admin,
apiVersion: LATEST_API_VERSION,
documents: ["./app/**/*.{js,ts,jsx,tsx}", "./app/.server/**/*.{js,ts,jsx,tsx}" ],
outputDir: "./app/types",
}),
},
};

const config = getConfig();
export default config;
```
### Example `graphqlrc.ts` file for autocompletion for Shopify Function Extensions
```ts
import fs from "fs";
import { LATEST_API_VERSION } from "@shopify/shopify-api";
import { shopifyApiProject, ApiType } from "@shopify/api-codegen-preset";
import type { IGraphQLConfig } from "graphql-config";

function getConfig() {
const config: IGraphQLConfig = {
projects: {
default: shopifyApiProject({
apiType: ApiType.Storefront,
apiVersion: LATEST_API_VERSION,
documents: ["./extensions/**/*.{js,ts,jsx,tsx}", "./extensions/.server/**/*.{js,ts,jsx,tsx}"],
outputDir: "./extensions/types",
}),
};

let extensions: string[] = [];
try {
extensions = fs.readdirSync("./extensions");
console.log(extensions, "extensions");
} catch {
// ignore if no extensions
}

for (const entry of extensions) {
console.log(entry, "entry");
const extensionPath = `./extensions/${entry}`;
const schema = `${extensionPath}/schema.graphql`;
if (!fs.existsSync(schema)) {
continue;
}
config.projects[entry] = {
schema,
documents: [`${extensionPath}/**/*.graphql`],
};
}


return config;
}

const config = getConfig();
export default config;
```
## Generating types
Once you configure your app, you can run `graphql-codegen` to start parsing your queries for types.
Expand Down Expand Up @@ -198,6 +276,21 @@ npm run graphql-codegen
pnpm graphql-codegen
```
### Generating types for more than one API
If you have specified more than one API in your `.graphqlrc.ts` file, you can run the script for each API by passing the `--project` [flag](https://the-guild.dev/graphql/codegen/docs/config-reference/multiproject-config#command-to-generate-files).
```sh
npm run graphql-codegen --project=UIExtensions
```
```sh
yarn graphql-codegen --project=UIExtensions
```
```sh
pnpm graphql-codegen --project=UIExtensions
```
> [!NOTE]
> Codegen will fail if it can't find any documents to parse.
> To fix that, either create a query or set the [`ignoreNoDocuments` option](https://the-guild.dev/graphql/codegen/docs/config-reference/codegen-config#configuration-options) to `true`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
"@shopify/shopify-app-session-storage-test-utils": "^3.0.10",
"@types/better-sqlite3": "^7.6.12",
"@types/pg": "^8.11.6",
"better-sqlite3": "^11.7.2",
"drizzle-kit": "^0.30.1",
"drizzle-orm": "^0.38.3",
"better-sqlite3": "^11.8.1",
"drizzle-kit": "^0.30.2",
"drizzle-orm": "^0.38.4",
"mysql2": "^3.12.0",
"pg": "^8.12.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
"AWS"
],
"dependencies": {
"@aws-sdk/client-dynamodb": "^3.724.0",
"@aws-sdk/util-dynamodb": "^3.724.0"
"@aws-sdk/client-dynamodb": "^3.731.1",
"@aws-sdk/util-dynamodb": "^3.731.1"
},
"peerDependencies": {
"@shopify/shopify-api": "^11.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
"@shopify/shopify-app-session-storage": "^3.0.0"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20241230.0",
"@cloudflare/workers-types": "^4.20250109.0",
"@shopify/shopify-app-session-storage-test-utils": "^3.0.10",
"miniflare": "^3.20241230.0"
"miniflare": "^3.20241230.2"
},
"files": [
"dist/*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,21 @@ Session storage for prisma requires a `schema.prisma` with a Session table with

```prisma
model Session {
id String @id
shop String
state String
isOnline Boolean @default(false)
scope String?
expires DateTime?
accessToken String
userId BigInt?
id String @id
shop String
state String
isOnline Boolean @default(false)
scope String?
expires DateTime?
accessToken String
userId BigInt?
firstName String?
lastName String?
email String?
accountOwner Boolean?
locale String?
collaborator Boolean?
emailVerified Boolean?
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@
],
"dependencies": {},
"peerDependencies": {
"@prisma/client": "^6.2.0",
"@prisma/client": "^6.2.1",
"@shopify/shopify-api": "^11.0.0",
"@shopify/shopify-app-session-storage": "^3.0.0",
"prisma": "^5.22.0"
"prisma": "^6.2.1"
},
"devDependencies": {
"@prisma/client": "^6.2.0",
"@prisma/client": "^6.2.1",
"@shopify/shopify-app-session-storage-test-utils": "^3.0.10",
"prisma": "^5.22.0"
"prisma": "^6.2.1"
},
"files": [
"dist/*",
Expand Down
14 changes: 7 additions & 7 deletions packages/apps/shopify-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,27 +83,27 @@
"@shopify/network": "^3.3.0",
"@shopify/storefront-api-client": "^1.0.3",
"compare-versions": "^6.1.1",
"isbot": "^5.1.20",
"isbot": "^5.1.21",
"jose": "^5.9.6",
"jsonwebtoken": "^9.0.2",
"node-fetch": "^2.6.1",
"tslib": "^2.8.1",
"uuid": "^11.0.4"
"uuid": "^11.0.5"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20241230.0",
"@swc/core": "^1.10.6",
"@cloudflare/workers-types": "^4.20250109.0",
"@swc/core": "^1.10.8",
"@types/express": "^4.17.13",
"@types/jsonwebtoken": "^9.0.7",
"@types/node-fetch": "^2.6.11",
"@types/uuid": "^10.0.0",
"expect": "^29.7.0",
"express": "^4.21.2",
"jest-environment-miniflare": "^2.14.4",
"miniflare": "^3.20241230.0",
"rollup": "^4.30.1",
"miniflare": "^3.20241230.2",
"rollup": "^4.31.0",
"rollup-plugin-swc": "^0.2.1",
"wrangler": "^3.100.0"
"wrangler": "^3.103.2"
},
"files": [
"dist/*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function ensureInstalled({
}: EnsureInstalledParams): EnsureInstalledMiddleware {
return function ensureInstalledOnShop() {
return async (req: Request, res: Response, next: NextFunction) => {
config.logger.info('Running ensureInstalledOnShop');
config.logger.debug('Running ensureInstalledOnShop');

if (!api.config.isEmbeddedApp) {
config.logger.warning(
Expand Down Expand Up @@ -65,7 +65,7 @@ export function ensureInstalled({

addCSPHeader(api, req, res);

config.logger.info('App is installed and ready to load', {shop});
config.logger.debug('App is installed and ready to load', {shop});

return next();
};
Expand Down
Loading

0 comments on commit a7bb130

Please sign in to comment.