@shopify/cli-kit 3.75.4 → 3.76.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/cli/api/graphql/admin/generated/theme_create.d.ts +21 -0
  2. package/dist/cli/api/graphql/admin/generated/theme_create.js +85 -0
  3. package/dist/cli/api/graphql/admin/generated/theme_create.js.map +1 -0
  4. package/dist/private/node/api/graphql.d.ts +1 -0
  5. package/dist/private/node/api/graphql.js +34 -4
  6. package/dist/private/node/api/graphql.js.map +1 -1
  7. package/dist/private/node/conf-store.d.ts +6 -5
  8. package/dist/private/node/conf-store.js +1 -1
  9. package/dist/private/node/conf-store.js.map +1 -1
  10. package/dist/private/node/session/device-authorization.js +11 -3
  11. package/dist/private/node/session/device-authorization.js.map +1 -1
  12. package/dist/private/node/session/validate.js +0 -5
  13. package/dist/private/node/session/validate.js.map +1 -1
  14. package/dist/public/common/version.d.ts +1 -1
  15. package/dist/public/common/version.js +1 -1
  16. package/dist/public/common/version.js.map +1 -1
  17. package/dist/public/node/api/admin.js +3 -3
  18. package/dist/public/node/api/admin.js.map +1 -1
  19. package/dist/public/node/api/app-management.d.ts +3 -2
  20. package/dist/public/node/api/app-management.js +6 -1
  21. package/dist/public/node/api/app-management.js.map +1 -1
  22. package/dist/public/node/api/business-platform.d.ts +5 -3
  23. package/dist/public/node/api/business-platform.js +6 -2
  24. package/dist/public/node/api/business-platform.js.map +1 -1
  25. package/dist/public/node/api/graphql.d.ts +8 -0
  26. package/dist/public/node/api/graphql.js +19 -2
  27. package/dist/public/node/api/graphql.js.map +1 -1
  28. package/dist/public/node/api/partners.d.ts +3 -2
  29. package/dist/public/node/api/partners.js +3 -1
  30. package/dist/public/node/api/partners.js.map +1 -1
  31. package/dist/public/node/base-command.js +8 -5
  32. package/dist/public/node/base-command.js.map +1 -1
  33. package/dist/public/node/cli.js +5 -4
  34. package/dist/public/node/cli.js.map +1 -1
  35. package/dist/public/node/hooks/postrun.js +2 -1
  36. package/dist/public/node/hooks/postrun.js.map +1 -1
  37. package/dist/public/node/hooks/prerun.js +3 -0
  38. package/dist/public/node/hooks/prerun.js.map +1 -1
  39. package/dist/public/node/notifications-system.d.ts +15 -1
  40. package/dist/public/node/notifications-system.js +55 -11
  41. package/dist/public/node/notifications-system.js.map +1 -1
  42. package/dist/public/node/system.d.ts +3 -1
  43. package/dist/public/node/system.js +22 -3
  44. package/dist/public/node/system.js.map +1 -1
  45. package/dist/public/node/themes/api.d.ts +16 -1
  46. package/dist/public/node/themes/api.js +34 -114
  47. package/dist/public/node/themes/api.js.map +1 -1
  48. package/dist/public/node/themes/theme-manager.js +4 -4
  49. package/dist/public/node/themes/theme-manager.js.map +1 -1
  50. package/dist/tsconfig.tsbuildinfo +1 -1
  51. package/package.json +1 -2
  52. package/dist/private/node/session/identity-token-validation.d.ts +0 -1
  53. package/dist/private/node/session/identity-token-validation.js +0 -70
  54. package/dist/private/node/session/identity-token-validation.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopify/cli-kit",
3
- "version": "3.75.4",
3
+ "version": "3.76.1",
4
4
  "packageManager": "pnpm@8.15.7",
5
5
  "private": false,
6
6
  "description": "A set of utilities, interfaces, and models that are common across all the platform features",
@@ -184,7 +184,6 @@
184
184
  "lint": "nx lint",
185
185
  "lint:fix": "nx lint:fix",
186
186
  "test": "nx test",
187
- "test:js": "nx test:js",
188
187
  "test:coverage": "nx test:coverage",
189
188
  "test:watch": "nx test:watch",
190
189
  "type-check": "nx type-check",
@@ -1 +0,0 @@
1
- export declare function validateIdentityToken(token: string): Promise<boolean>;
@@ -1,70 +0,0 @@
1
- import { identityFqdn } from '../../../public/node/context/fqdn.js';
2
- import { outputDebug } from '../../../public/node/output.js';
3
- import { shopifyFetch } from '../../../public/node/http.js';
4
- import { cacheRetrieveOrRepopulate } from '../conf-store.js';
5
- import { err, ok } from '../../../public/node/result.js';
6
- import { AbortError } from '../../../public/node/error.js';
7
- import { firstPartyDev } from '@shopify/cli-kit/node/context/local';
8
- import { isSpin } from '@shopify/cli-kit/node/context/spin';
9
- export async function validateIdentityToken(token) {
10
- if (isSpin() && firstPartyDev())
11
- return true;
12
- try {
13
- return withIntrospectionURL(async (introspectionURL) => {
14
- const options = {
15
- method: 'POST',
16
- headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
17
- body: JSON.stringify({ token }),
18
- };
19
- outputDebug(`Sending Identity Introspection request to URL: ${introspectionURL}`);
20
- const response = await shopifyFetch(introspectionURL, options);
21
- if (response.ok && response.headers.get('content-type')?.includes('json')) {
22
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
23
- const json = await response.json();
24
- outputDebug(`The identity token is valid: ${json.valid}`);
25
- return ok(json.valid);
26
- }
27
- else if (response.status === 404 || response.status > 500) {
28
- // If the status is 404 or 5xx, most likely the introspection endpoint
29
- // has changed. We should invalidate the cache and try again.
30
- return err(new AbortError(`The introspection endpoint returned a ${response.status}: ${introspectionURL}`));
31
- }
32
- else {
33
- const text = await response.text();
34
- outputDebug(`The Introspection request failed with:
35
- - status: ${response.status}
36
- - www-authenticate header: ${JSON.stringify(response.headers.get('www-authenticate'))}
37
- - body: ${JSON.stringify(text)}`);
38
- return ok(false);
39
- }
40
- });
41
- // eslint-disable-next-line no-catch-all/no-catch-all
42
- }
43
- catch (error) {
44
- outputDebug(`The identity token is invalid: ${error}`);
45
- return false;
46
- }
47
- }
48
- async function withIntrospectionURL(fn) {
49
- const week = 7 * 24 * 60 * 60 * 1000;
50
- const cacheKey = `identity-introspection-url-${await identityFqdn()}`;
51
- let introspectionURL = await cacheRetrieveOrRepopulate(cacheKey, getIntrospectionURL, week);
52
- let result = await fn(introspectionURL);
53
- if (result.isErr()) {
54
- introspectionURL = await cacheRetrieveOrRepopulate(cacheKey, getIntrospectionURL, 0);
55
- result = await fn(introspectionURL);
56
- }
57
- if (result.isErr()) {
58
- throw result.error;
59
- }
60
- else {
61
- return result.value;
62
- }
63
- }
64
- async function getIntrospectionURL() {
65
- const response = await shopifyFetch(`https://${await identityFqdn()}/.well-known/openid-configuration.json`);
66
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
67
- const json = await response.json();
68
- return json.introspection_endpoint;
69
- }
70
- //# sourceMappingURL=identity-token-validation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"identity-token-validation.js","sourceRoot":"","sources":["../../../../src/private/node/session/identity-token-validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,sCAAsC,CAAA;AACjE,OAAO,EAAC,WAAW,EAAC,MAAM,gCAAgC,CAAA;AAC1D,OAAO,EAAC,YAAY,EAAC,MAAM,8BAA8B,CAAA;AACzD,OAAO,EAAC,yBAAyB,EAAsB,MAAM,kBAAkB,CAAA;AAC/E,OAAO,EAAC,GAAG,EAAE,EAAE,EAAS,MAAM,gCAAgC,CAAA;AAC9D,OAAO,EAAC,UAAU,EAAC,MAAM,+BAA+B,CAAA;AACxD,OAAO,EAAC,aAAa,EAAC,MAAM,qCAAqC,CAAA;AACjE,OAAO,EAAC,MAAM,EAAC,MAAM,oCAAoC,CAAA;AAEzD,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,KAAa;IACvD,IAAI,MAAM,EAAE,IAAI,aAAa,EAAE;QAAE,OAAO,IAAI,CAAA;IAE5C,IAAI,CAAC;QACH,OAAO,oBAAoB,CAAU,KAAK,EAAE,gBAAwB,EAAE,EAAE;YACtE,MAAM,OAAO,GAAG;gBACd,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE,EAAC,aAAa,EAAE,UAAU,KAAK,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAC;gBAC/E,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAC,KAAK,EAAC,CAAC;aAC9B,CAAA;YACD,WAAW,CAAC,kDAAkD,gBAAgB,EAAE,CAAC,CAAA;YAEjF,MAAM,QAAQ,GAAG,MAAM,YAAY,CAA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AAG,IAAI,CAAA;IACpC,MAAM,QAAQ,GAAwB,8BAA8B,MAAM,YAAY,EAAE,EAAE,CAAA;IAC1F,IAAI,gBAAgB,GAAG,MAAM,yBAAyB,CAAC,QAAQ,EAAE,mBAAmB,EAAE,IAAI,CAAC,CAAA;IAC3F,IAAI,MAAM,GAA0B,MAAM,EAAE,CAAC,gBAAgB,CAAC,CAAA;IAC9D,IAAI,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC;QACnB,gBAAgB,GAAG,MAAM,yBAAyB,CAAC,QAAQ,EAAE,mBAAmB,EAAE,CAAC,CAAC,CAAA;QACpF,MAAM,GAAG,MAAM,EAAE,CAAC,gBAAgB,CAAC,CAAA;IACrC,CAAC;IACD,IAAI,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC;QACnB,MAAM,MAAM,CAAC,KAAK,CAAA;IACpB,CAAC;SAAM,CAAC;QACN,OAAO,MAAM,CAAC,KAAK,CAAA;IACrB,CAAC;AACH,CAAC;AAED,KAAK,UAAU,mBAAmB;IAChC,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,WAAW,MAAM,YAAY,EAAE,wCAAwC,CAAC,CAAA;IAC5G,8DAA8D;IAC9D,MAAM,IAAI,GAAQ,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;IACvC,OAAO,IAAI,CAAC,sBAAsB,CAAA;AACpC,CAAC","sourcesContent":["import {identityFqdn} from '../../../public/node/context/fqdn.js'\nimport {outputDebug} from '../../../public/node/output.js'\nimport {shopifyFetch} from '../../../public/node/http.js'\nimport {cacheRetrieveOrRepopulate, IntrospectionUrlKey} from '../conf-store.js'\nimport {err, ok, Result} from '../../../public/node/result.js'\nimport {AbortError} from '../../../public/node/error.js'\nimport {firstPartyDev} from '@shopify/cli-kit/node/context/local'\nimport {isSpin} from '@shopify/cli-kit/node/context/spin'\n\nexport async function validateIdentityToken(token: string): Promise<boolean> {\n if (isSpin() && firstPartyDev()) return true\n\n try {\n return withIntrospectionURL<boolean>(async (introspectionURL: string) => {\n const options = {\n method: 'POST',\n headers: {Authorization: `Bearer ${token}`, 'Content-Type': 'application/json'},\n body: JSON.stringify({token}),\n }\n outputDebug(`Sending Identity Introspection request to URL: ${introspectionURL}`)\n\n const response = await shopifyFetch(introspectionURL, options)\n\n if (response.ok && response.headers.get('content-type')?.includes('json')) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const json: any = await response.json()\n outputDebug(`The identity token is valid: ${json.valid}`)\n return ok(json.valid)\n } else if (response.status === 404 || response.status > 500) {\n // If the status is 404 or 5xx, most likely the introspection endpoint\n // has changed. We should invalidate the cache and try again.\n return err(new AbortError(`The introspection endpoint returned a ${response.status}: ${introspectionURL}`))\n } else {\n const text = await response.text()\n outputDebug(`The Introspection request failed with:\n - status: ${response.status}\n - www-authenticate header: ${JSON.stringify(response.headers.get('www-authenticate'))}\n - body: ${JSON.stringify(text)}`)\n return ok(false)\n }\n })\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch (error) {\n outputDebug(`The identity token is invalid: ${error}`)\n return false\n }\n}\n\nasync function withIntrospectionURL<T>(fn: (introspectionUrl: string) => Promise<Result<T, AbortError>>): Promise<T> {\n const week = 7 * 24 * 60 * 60 * 1000\n const cacheKey: IntrospectionUrlKey = `identity-introspection-url-${await identityFqdn()}`\n let introspectionURL = await cacheRetrieveOrRepopulate(cacheKey, getIntrospectionURL, week)\n let result: Result<T, AbortError> = await fn(introspectionURL)\n if (result.isErr()) {\n introspectionURL = await cacheRetrieveOrRepopulate(cacheKey, getIntrospectionURL, 0)\n result = await fn(introspectionURL)\n }\n if (result.isErr()) {\n throw result.error\n } else {\n return result.value\n }\n}\n\nasync function getIntrospectionURL(): Promise<string> {\n const response = await shopifyFetch(`https://${await identityFqdn()}/.well-known/openid-configuration.json`)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const json: any = await response.json()\n return json.introspection_endpoint\n}\n"]}