From b147bd54c643dcd51b6ddfee94056db5fb952cd1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 24 Jan 2024 15:26:02 +0000 Subject: [PATCH 1/3] Bump @types/node from 16.18.61 to 20.11.6 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 16.18.61 to 20.11.6. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- packages/shopify-api/package.json | 2 +- yarn.lock | 13 ++++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/packages/shopify-api/package.json b/packages/shopify-api/package.json index e4d9b1eb8..fcedfe616 100644 --- a/packages/shopify-api/package.json +++ b/packages/shopify-api/package.json @@ -84,7 +84,7 @@ "@cloudflare/workers-types": "^4.20230404.0", "@swc/core": "^1.3.100", "@types/express": "^4.17.13", - "@types/node": "^16.0.0", + "@types/node": "^20.11.6", "@types/node-fetch": "^2.5.7", "@types/supertest": "^2.0.10", "@types/uuid": "^9.0.0", diff --git a/yarn.lock b/yarn.lock index 7204bd392..e9730e779 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3106,10 +3106,10 @@ dependencies: "@types/node" "*" -"@types/node@*": - version "20.9.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.9.0.tgz#bfcdc230583aeb891cf51e73cfdaacdd8deae298" - integrity sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw== +"@types/node@*", "@types/node@^20.11.6": + version "20.11.6" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.11.6.tgz#6adf4241460e28be53836529c033a41985f85b6e" + integrity sha512-+EOokTnksGVgip2PbYbr3xnR7kZigh4LbybAfBAw5BpnQ+FqBYUsvCEjYd70IXKlbohQ64mzEYmMtlWUY8q//Q== dependencies: undici-types "~5.26.4" @@ -3118,11 +3118,6 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.55.tgz#c329cbd434c42164f846b909bd6f85b5537f6240" integrity sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ== -"@types/node@^16.0.0": - version "16.18.61" - resolved "https://registry.yarnpkg.com/@types/node/-/node-16.18.61.tgz#5ea47e3018348bf3bbbe646b396ba5e720310be1" - integrity sha512-k0N7BqGhJoJzdh6MuQg1V1ragJiXTh8VUBAZTWjJ9cUq23SG0F0xavOwZbhiP4J3y20xd6jxKx+xNUhkMAi76Q== - "@types/normalize-package-data@^2.4.0": version "2.4.4" resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz#56e2cc26c397c038fab0e3a917a12d5c5909e901" From 0c2914620d6def7a6b01868c4e884856256f2dcb Mon Sep 17 00:00:00 2001 From: Paulo Margarido <64600052+paulomarg@users.noreply.github.com> Date: Wed, 24 Jan 2024 11:26:19 -0500 Subject: [PATCH 2/3] Removing lib-dom types from tsconfig We don't need to include those, since we're relying on native fetch APIs / node-fetch --- package.json | 2 +- packages/admin-api-client/tsconfig.json | 2 +- packages/graphql-client/tsconfig.json | 2 +- packages/shopify-api/lib/auth/oauth/oauth.ts | 3 +- .../lib/auth/oauth/token-exchange.ts | 3 +- packages/shopify-api/lib/clients/common.ts | 3 +- packages/shopify-api/package.json | 2 +- packages/shopify-api/runtime/http/types.ts | 4 +- packages/shopify-api/tsconfig.json | 1 - packages/storefront-api-client/tsconfig.json | 2 +- yarn.lock | 62 +++++++++++++++++-- 11 files changed, 69 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index 45e85c046..d52e8fe86 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "@babel/plugin-transform-async-to-generator": "^7.20.7", "@babel/plugin-transform-runtime": "^7.21.0", "@babel/preset-env": "^7.23.8", - "@babel/preset-typescript": "^7.21.0", + "@babel/preset-typescript": "^7.23.3", "@changesets/changelog-github": "^0.5.0", "@changesets/cli": "^2.22.0", "@rollup/plugin-babel": "^6.0.3", diff --git a/packages/admin-api-client/tsconfig.json b/packages/admin-api-client/tsconfig.json index 5e4a73bed..0bebf95a0 100644 --- a/packages/admin-api-client/tsconfig.json +++ b/packages/admin-api-client/tsconfig.json @@ -5,7 +5,7 @@ "declaration": true, "declarationMap": true, "target": "ES2022", - "lib": ["ESNext", "DOM"], + "lib": ["ESNext"], "rootDir": "src", "baseUrl": "src", "strict": true, diff --git a/packages/graphql-client/tsconfig.json b/packages/graphql-client/tsconfig.json index e9739c2a8..bcaf457c2 100644 --- a/packages/graphql-client/tsconfig.json +++ b/packages/graphql-client/tsconfig.json @@ -5,7 +5,7 @@ "declaration": true, "declarationMap": true, "target": "ES2022", - "lib": ["ESNext", "DOM"], + "lib": ["ESNext"], "rootDir": "src", "baseUrl": "src", "strict": true, diff --git a/packages/shopify-api/lib/auth/oauth/oauth.ts b/packages/shopify-api/lib/auth/oauth/oauth.ts index 1191d5ce6..0acf02192 100644 --- a/packages/shopify-api/lib/auth/oauth/oauth.ts +++ b/packages/shopify-api/lib/auth/oauth/oauth.ts @@ -28,6 +28,7 @@ import { BeginParams, CallbackParams, AuthQuery, + AccessTokenResponse, } from './types'; import {nonce} from './nonce'; import {safeCompare} from './safe-compare'; @@ -206,7 +207,7 @@ export function callback(config: ConfigInterface): OAuthCallback { } const session: Session = createSession({ - accessTokenResponse: await postResponse.json(), + accessTokenResponse: await postResponse.json(), shop: cleanShop, state: stateFromCookie, config, diff --git a/packages/shopify-api/lib/auth/oauth/token-exchange.ts b/packages/shopify-api/lib/auth/oauth/token-exchange.ts index c1d19d4d0..19628f416 100644 --- a/packages/shopify-api/lib/auth/oauth/token-exchange.ts +++ b/packages/shopify-api/lib/auth/oauth/token-exchange.ts @@ -7,6 +7,7 @@ import {abstractFetch} from '../../../runtime'; import {DataType} from '../../clients/types'; import {createSession} from './create-session'; +import {AccessTokenResponse} from './types'; export enum RequestedTokenType { OnlineAccessToken = 'urn:shopify:params:oauth:token-type:online-access-token', @@ -64,7 +65,7 @@ export function tokenExchange(config: ConfigInterface): TokenExchange { return { session: createSession({ - accessTokenResponse: await postResponse.json(), + accessTokenResponse: await postResponse.json(), shop: cleanShop, // We need to keep this as an empty string as our template DB schemas have this required state: '', diff --git a/packages/shopify-api/lib/clients/common.ts b/packages/shopify-api/lib/clients/common.ts index f75007477..cb3fc5c3c 100644 --- a/packages/shopify-api/lib/clients/common.ts +++ b/packages/shopify-api/lib/clients/common.ts @@ -10,7 +10,6 @@ import {LIBRARY_NAME} from '../types'; import {ConfigInterface} from '../base-types'; import {SHOPIFY_API_LIBRARY_VERSION} from '../version'; import { - AbstractFetchFunc, abstractRuntimeString, canonicalizeHeaders, getHeader, @@ -59,7 +58,7 @@ export function clientLoggerFactory(config: ConfigInterface) { export function throwFailedRequest( body: any, - response: Awaited>, + response: Response, atMaxRetries: boolean, ): never { const responseHeaders = canonicalizeHeaders( diff --git a/packages/shopify-api/package.json b/packages/shopify-api/package.json index fcedfe616..e967776e1 100644 --- a/packages/shopify-api/package.json +++ b/packages/shopify-api/package.json @@ -85,7 +85,7 @@ "@swc/core": "^1.3.100", "@types/express": "^4.17.13", "@types/node": "^20.11.6", - "@types/node-fetch": "^2.5.7", + "@types/node-fetch": "^2.6.11", "@types/supertest": "^2.0.10", "@types/uuid": "^9.0.0", "express": "^4.17.13", diff --git a/packages/shopify-api/runtime/http/types.ts b/packages/shopify-api/runtime/http/types.ts index c1df02b4a..6f8ba13cb 100644 --- a/packages/shopify-api/runtime/http/types.ts +++ b/packages/shopify-api/runtime/http/types.ts @@ -22,7 +22,9 @@ export interface AdapterArgs { rawResponse?: AdapterResponse; } -export type AbstractFetchFunc = typeof fetch; +export type AbstractFetchFunc = ( + ...params: Parameters +) => Promise; export type AbstractConvertRequestFunc = ( adapterArgs: AdapterArgs, diff --git a/packages/shopify-api/tsconfig.json b/packages/shopify-api/tsconfig.json index 1d6a7dab1..7b00a625d 100644 --- a/packages/shopify-api/tsconfig.json +++ b/packages/shopify-api/tsconfig.json @@ -5,7 +5,6 @@ "baseUrl": ".", "rootDir": ".", "lib": [ - "dom", "dom.iterable", "es2015", "es2016", diff --git a/packages/storefront-api-client/tsconfig.json b/packages/storefront-api-client/tsconfig.json index e9739c2a8..bcaf457c2 100644 --- a/packages/storefront-api-client/tsconfig.json +++ b/packages/storefront-api-client/tsconfig.json @@ -5,7 +5,7 @@ "declaration": true, "declarationMap": true, "target": "ES2022", - "lib": ["ESNext", "DOM"], + "lib": ["ESNext"], "rootDir": "src", "baseUrl": "src", "strict": true, diff --git a/yarn.lock b/yarn.lock index e9730e779..bc283c6cc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -145,6 +145,21 @@ "@babel/helper-split-export-declaration" "^7.22.6" semver "^6.3.1" +"@babel/helper-create-class-features-plugin@^7.23.6": + version "7.23.7" + resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.23.7.tgz#b2e6826e0e20d337143655198b79d58fdc9bd43d" + integrity sha512-xCoqR/8+BoNnXOY7RVSgv6X+o7pmT5q1d+gGcRlXYkI+9B31glE4jeejhKVpA04O1AtzOt7OSQ6VYKP5FcRl9g== + dependencies: + "@babel/helper-annotate-as-pure" "^7.22.5" + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-function-name" "^7.23.0" + "@babel/helper-member-expression-to-functions" "^7.23.0" + "@babel/helper-optimise-call-expression" "^7.22.5" + "@babel/helper-replace-supers" "^7.22.20" + "@babel/helper-skip-transparent-expression-wrappers" "^7.22.5" + "@babel/helper-split-export-declaration" "^7.22.6" + semver "^6.3.1" + "@babel/helper-create-regexp-features-plugin@^7.18.6", "@babel/helper-create-regexp-features-plugin@^7.22.15", "@babel/helper-create-regexp-features-plugin@^7.22.5": version "7.22.15" resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.22.15.tgz#5ee90093914ea09639b01c711db0d6775e558be1" @@ -185,7 +200,7 @@ dependencies: "@babel/types" "^7.22.5" -"@babel/helper-member-expression-to-functions@^7.22.15": +"@babel/helper-member-expression-to-functions@^7.22.15", "@babel/helper-member-expression-to-functions@^7.23.0": version "7.23.0" resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.23.0.tgz#9263e88cc5e41d39ec18c9a3e0eced59a3e7d366" integrity sha512-6gfrPwh7OuT6gZyJZvd6WbTfrqAo7vm4xCzAXOusKqq/vWdKXphTpj5klHKNmRUU6/QRGlBsyU9mAIPaWHlqJA== @@ -499,6 +514,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.22.5" +"@babel/plugin-syntax-jsx@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.23.3.tgz#8f2e4f8a9b5f9aa16067e142c1ac9cd9f810f473" + integrity sha512-EB2MELswq55OHUoRZLGg/zC7QWUKfNLpE57m/S2yr1uEneIgsTgrSzXP3NXEsMkVn76OlaVVnzN+ugObuYGwhg== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/plugin-syntax-logical-assignment-operators@^7.10.4", "@babel/plugin-syntax-logical-assignment-operators@^7.8.3": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz#ca91ef46303530448b906652bac2e9fe9941f699" @@ -562,6 +584,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.22.5" +"@babel/plugin-syntax-typescript@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.23.3.tgz#24f460c85dbbc983cd2b9c4994178bcc01df958f" + integrity sha512-9EiNjVJOMwCO+43TqoTrgQ8jMwcAd0sWyXi9RPfIsLTj4R2MADDDQXELhffaUx/uJv2AYcxBgPwH6j4TIA4ytQ== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/plugin-syntax-unicode-sets-regex@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-unicode-sets-regex/-/plugin-syntax-unicode-sets-regex-7.18.6.tgz#d49a3b3e6b52e5be6740022317580234a6a47357" @@ -997,6 +1026,16 @@ "@babel/helper-plugin-utils" "^7.22.5" "@babel/plugin-syntax-typescript" "^7.22.5" +"@babel/plugin-transform-typescript@^7.23.3": + version "7.23.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.23.6.tgz#aa36a94e5da8d94339ae3a4e22d40ed287feb34c" + integrity sha512-6cBG5mBvUu4VUD04OHKnYzbuHNP8huDsD3EDqqpIpsswTDoqHCjLoHb6+QgsV1WsT2nipRqCPgxD3LXnEO7XfA== + dependencies: + "@babel/helper-annotate-as-pure" "^7.22.5" + "@babel/helper-create-class-features-plugin" "^7.23.6" + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/plugin-syntax-typescript" "^7.23.3" + "@babel/plugin-transform-unicode-escapes@^7.23.3": version "7.23.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.23.3.tgz#1f66d16cab01fab98d784867d24f70c1ca65b925" @@ -1135,7 +1174,7 @@ "@babel/plugin-transform-react-jsx-development" "^7.22.5" "@babel/plugin-transform-react-pure-annotations" "^7.22.5" -"@babel/preset-typescript@^7.16.0", "@babel/preset-typescript@^7.21.0": +"@babel/preset-typescript@^7.16.0": version "7.23.2" resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.23.2.tgz#c8de488130b7081f7e1482936ad3de5b018beef4" integrity sha512-u4UJc1XsS1GhIGteM8rnGiIvf9rJpiVgMEeCnwlLA7WJPC+jcXWJAGxYmeqs5hOZD8BbAfnV5ezBOxQbb4OUxA== @@ -1146,6 +1185,17 @@ "@babel/plugin-transform-modules-commonjs" "^7.23.0" "@babel/plugin-transform-typescript" "^7.22.15" +"@babel/preset-typescript@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.23.3.tgz#14534b34ed5b6d435aa05f1ae1c5e7adcc01d913" + integrity sha512-17oIGVlqz6CchO9RFYn5U6ZpWRZIngayYCtrPRSgANSwC2V1Jb+iP74nVxzzXJte8b8BYxrL1yY96xfhTBrNNQ== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/helper-validator-option" "^7.22.15" + "@babel/plugin-syntax-jsx" "^7.23.3" + "@babel/plugin-transform-modules-commonjs" "^7.23.3" + "@babel/plugin-transform-typescript" "^7.23.3" + "@babel/regjsgen@^0.8.0": version "0.8.0" resolved "https://registry.yarnpkg.com/@babel/regjsgen/-/regjsgen-0.8.0.tgz#f0ba69b075e1f05fb2825b7fad991e7adbb18310" @@ -3091,10 +3141,10 @@ resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.5.tgz#ec10755e871497bcd83efe927e43ec46e8c0747e" integrity sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag== -"@types/node-fetch@^2.5.7": - version "2.6.9" - resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.9.tgz#15f529d247f1ede1824f7e7acdaa192d5f28071e" - integrity sha512-bQVlnMLFJ2d35DkPNjEPmd9ueO/rh5EiaZt2bhqiSarPjZIuIV6bPQVqcrEyvNo+AfTrRGVazle1tl597w3gfA== +"@types/node-fetch@^2.6.11": + version "2.6.11" + resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.11.tgz#9b39b78665dae0e82a08f02f4967d62c66f95d24" + integrity sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g== dependencies: "@types/node" "*" form-data "^4.0.0" From 0f0ffb8af8d3eb0cbf46a5a1bfa95a2051c49d9c Mon Sep 17 00:00:00 2001 From: Paulo Margarido <64600052+paulomarg@users.noreply.github.com> Date: Wed, 24 Jan 2024 14:16:58 -0500 Subject: [PATCH 3/3] Adding changeset --- .changeset/hungry-humans-lie.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .changeset/hungry-humans-lie.md diff --git a/.changeset/hungry-humans-lie.md b/.changeset/hungry-humans-lie.md new file mode 100644 index 000000000..a77b3317f --- /dev/null +++ b/.changeset/hungry-humans-lie.md @@ -0,0 +1,8 @@ +--- +"@shopify/storefront-api-client": patch +"@shopify/admin-api-client": patch +"@shopify/graphql-client": patch +"@shopify/shopify-api": patch +--- + +Updated global fetch types to more closely match reality