@shopify/cli 3.91.1 → 3.92.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 (106) hide show
  1. package/bin/run.js +2 -2
  2. package/dist/assets/dev-console/extensions/dev-console/assets/{index-0hw3R_TS.css → index-DISeE29z.css} +1 -1
  3. package/dist/assets/dev-console/extensions/dev-console/assets/{index-C12jKScn.js → index-WDo4Zf8i.js} +10 -10
  4. package/dist/assets/dev-console/index.html +2 -2
  5. package/dist/{chunk-5JYQJQ2E.js → chunk-42GAT4OC.js} +2 -2
  6. package/dist/{chunk-FKP67FZI.js → chunk-67BH5NUT.js} +3 -3
  7. package/dist/{chunk-RKFRXKFE.js → chunk-6FKKSH4P.js} +3 -3
  8. package/dist/{chunk-E4GUDBAR.js → chunk-6O2ILC2V.js} +17171 -13653
  9. package/dist/{chunk-OIUDJFV2.js → chunk-7H2O5J4R.js} +12 -5
  10. package/dist/{chunk-VUYVHHZY.js → chunk-7QAT7P3M.js} +4 -4
  11. package/dist/{chunk-Z5FK5H2M.js → chunk-AVEWTIFC.js} +7 -7
  12. package/dist/{chunk-VRUH5BDH.js → chunk-C74PXA4B.js} +4 -4
  13. package/dist/{chunk-E44JKFB6.js → chunk-CLJTWTB3.js} +2 -2
  14. package/dist/{chunk-K52ORY26.js → chunk-DM56XRBC.js} +7 -7
  15. package/dist/{chunk-77BDQRQW.js → chunk-E7IWFBAC.js} +6 -6
  16. package/dist/{chunk-TY5YKCUW.js → chunk-ESKZOJHR.js} +5 -5
  17. package/dist/{chunk-HTGTTXQL.js → chunk-EURIZXCA.js} +7 -17
  18. package/dist/{chunk-CEUL3KX5.js → chunk-EZZRDRCA.js} +7757 -6910
  19. package/dist/{chunk-SUFC4ISB.js → chunk-FESVG7HJ.js} +6 -6
  20. package/dist/{chunk-ZLV2A27J.js → chunk-FNFU6QXG.js} +2 -2
  21. package/dist/{chunk-PCNR4TMY.js → chunk-GUCQ3JUX.js} +5 -5
  22. package/dist/{chunk-EG6MBBEN.js → chunk-H4D3T5OG.js} +14 -1
  23. package/dist/{chunk-SJXHR42U.js → chunk-HG2B3F2E.js} +2 -2
  24. package/dist/{chunk-5ZDTGPNX.js → chunk-HOCBMVPF.js} +3 -3
  25. package/dist/{chunk-DUNGALP3.js → chunk-IJLB2OZD.js} +3 -3
  26. package/dist/{chunk-WDYPK6VH.js → chunk-JOUJHIPW.js} +5 -5
  27. package/dist/{chunk-QFO7QSBW.js → chunk-JW4Y5WPI.js} +4 -4
  28. package/dist/{chunk-I23GZAC4.js → chunk-KQU2IAXJ.js} +6 -7
  29. package/dist/{chunk-SVV4RJVX.js → chunk-LM5QFSME.js} +4 -4
  30. package/dist/{chunk-ATQVKUJC.js → chunk-M7TUKQMY.js} +4 -4
  31. package/dist/{chunk-RLJICWO6.js → chunk-NE5FI6FS.js} +4 -4
  32. package/dist/{chunk-LFMBIRVC.js → chunk-NG44KZZS.js} +3 -3
  33. package/dist/{chunk-HOIU6WRE.js → chunk-NK4SILXH.js} +3 -3
  34. package/dist/{chunk-IUKBWIQY.js → chunk-NQTUC6ZO.js} +3 -3
  35. package/dist/{chunk-HAG3HJ2V.js → chunk-O3GDENDY.js} +35 -47
  36. package/dist/{chunk-54FE2FGU.js → chunk-Q7FGFF32.js} +2 -2
  37. package/dist/{chunk-ITTNM7I4.js → chunk-QJQS7BBK.js} +2 -2
  38. package/dist/{chunk-DR5R5UTE.js → chunk-SMO4IV7V.js} +6 -6
  39. package/dist/{chunk-NYP3N62G.js → chunk-T5M3A5TW.js} +2 -2
  40. package/dist/{chunk-2YAGQHB2.js → chunk-TC5DUCXE.js} +3 -3
  41. package/dist/{chunk-XDCBS7SY.js → chunk-UL2FJ5NI.js} +3 -3
  42. package/dist/{chunk-KV3364EL.js → chunk-USGISM5H.js} +1 -1
  43. package/dist/{chunk-R622IPZN.js → chunk-WXB4MZ4Q.js} +3 -3
  44. package/dist/{chunk-K45ALTZ7.js → chunk-YDQVL7CP.js} +3 -3
  45. package/dist/{chunk-463KYFYO.js → chunk-YUJEBN2A.js} +2 -2
  46. package/dist/{chunk-TH7ZYYDZ.js → chunk-ZN7BY463.js} +1144 -79
  47. package/dist/{chunk-A2CZGTAP.js → chunk-ZVE6VSBX.js} +109 -165
  48. package/dist/cli/commands/auth/login.js +10 -10
  49. package/dist/cli/commands/auth/login.test.js +12 -12
  50. package/dist/cli/commands/auth/logout.js +10 -10
  51. package/dist/cli/commands/auth/logout.test.js +12 -12
  52. package/dist/cli/commands/cache/clear.js +11 -11
  53. package/dist/cli/commands/debug/command-flags.js +10 -10
  54. package/dist/cli/commands/docs/generate.js +10 -10
  55. package/dist/cli/commands/docs/generate.test.js +11 -11
  56. package/dist/cli/commands/doctor-release/doctor-release.js +10 -10
  57. package/dist/cli/commands/doctor-release/theme/index.js +16 -16
  58. package/dist/cli/commands/help.js +10 -10
  59. package/dist/cli/commands/kitchen-sink/async.js +11 -11
  60. package/dist/cli/commands/kitchen-sink/async.test.js +12 -12
  61. package/dist/cli/commands/kitchen-sink/index.js +13 -13
  62. package/dist/cli/commands/kitchen-sink/index.test.js +14 -14
  63. package/dist/cli/commands/kitchen-sink/prompts.js +11 -11
  64. package/dist/cli/commands/kitchen-sink/prompts.test.js +12 -12
  65. package/dist/cli/commands/kitchen-sink/static.js +11 -11
  66. package/dist/cli/commands/kitchen-sink/static.test.js +12 -12
  67. package/dist/cli/commands/notifications/generate.js +11 -11
  68. package/dist/cli/commands/notifications/list.js +11 -11
  69. package/dist/cli/commands/search.js +11 -11
  70. package/dist/cli/commands/upgrade.js +11 -11
  71. package/dist/cli/commands/upgrade.test.js +1 -1
  72. package/dist/cli/commands/version.js +11 -11
  73. package/dist/cli/commands/version.test.js +12 -12
  74. package/dist/cli/services/commands/notifications.js +9 -9
  75. package/dist/cli/services/commands/search.js +5 -5
  76. package/dist/cli/services/commands/search.test.js +6 -6
  77. package/dist/cli/services/commands/version.js +6 -6
  78. package/dist/cli/services/commands/version.test.js +8 -8
  79. package/dist/cli/services/doctor-release/context.js +2 -2
  80. package/dist/cli/services/doctor-release/theme/runner.js +9 -9
  81. package/dist/cli/services/doctor-release/theme/tests/init.js +6 -6
  82. package/dist/cli/services/doctor-release/theme/tests/push.js +6 -6
  83. package/dist/cli/services/kitchen-sink/async.js +5 -5
  84. package/dist/cli/services/kitchen-sink/prompts.js +5 -5
  85. package/dist/cli/services/kitchen-sink/static.js +5 -5
  86. package/dist/{custom-oclif-loader-AAJZ7WBW.js → custom-oclif-loader-MKZUUH3S.js} +5 -5
  87. package/dist/{devtools-BAOTGU3O.js → devtools-PI7DMKVT.js} +4 -4
  88. package/dist/{error-handler-GSQRFK57.js → error-handler-STUDJHBV.js} +8 -8
  89. package/dist/hooks/postrun.js +8 -8
  90. package/dist/hooks/prerun.js +9 -9
  91. package/dist/index.js +68763 -58537
  92. package/dist/{lib-HAW436ZI.js → lib-R4TQWF6K.js} +3 -3
  93. package/dist/{local-GOP2BHNI.js → local-SJCC5BYA.js} +5 -5
  94. package/dist/{morph-7WAMUK6I.js → morph-32Y5BUJM.js} +9 -9
  95. package/dist/{node-package-manager-W4R4DUTE.js → node-package-manager-2L2NJGLS.js} +6 -6
  96. package/dist/{path-GB4VIEM6.js → path-H3TILUQU.js} +4 -2
  97. package/dist/{prettier-5ODD6NHV.js → prettier-4RCJTIXY.js} +2 -2
  98. package/dist/tsconfig.tsbuildinfo +1 -1
  99. package/dist/{ui-VRLRLHWH.js → ui-ER5WOAGG.js} +5 -5
  100. package/dist/{workerd-AO3T6IIJ.js → workerd-KQSXBLVM.js} +13 -13
  101. package/oclif.manifest.json +6 -6
  102. package/package.json +7 -59
  103. package/dist/chunk-2EQNSO7C.js +0 -142
  104. package/dist/cli/services/upgrade.d.ts +0 -5
  105. package/dist/cli/services/upgrade.js +0 -21
  106. package/dist/cli/services/upgrade.test.js +0 -171
@@ -7,21 +7,24 @@ import {
7
7
  formDataToBlob
8
8
  } from "./chunk-VBBBCVMH.js";
9
9
  import {
10
+ Environment,
10
11
  cacheRetrieveOrRepopulate,
11
12
  getCurrentSessionId,
12
13
  getPackageManager,
13
14
  getSessions,
15
+ isLocalEnvironment,
14
16
  packageManagerFromUserAgent,
15
17
  removeCurrentSessionId,
16
18
  removeSessions,
17
19
  runWithRateLimit,
20
+ serviceEnvironment,
18
21
  setCurrentSessionId,
19
22
  setSessions,
20
23
  timeIntervalToMilliseconds
21
- } from "./chunk-HAG3HJ2V.js";
24
+ } from "./chunk-O3GDENDY.js";
22
25
  import {
23
26
  CLI_KIT_VERSION
24
- } from "./chunk-NYP3N62G.js";
27
+ } from "./chunk-T5M3A5TW.js";
25
28
  import {
26
29
  AbortError,
27
30
  AbortSilentError,
@@ -106,10 +109,10 @@ import {
106
109
  stringifyMessage,
107
110
  systemEnvironmentVariables,
108
111
  themeToken
109
- } from "./chunk-E4GUDBAR.js";
112
+ } from "./chunk-6O2ILC2V.js";
110
113
  import {
111
114
  require_lib
112
- } from "./chunk-CEUL3KX5.js";
115
+ } from "./chunk-EZZRDRCA.js";
113
116
  import {
114
117
  cwd,
115
118
  isAbsolutePath,
@@ -117,7 +120,7 @@ import {
117
120
  normalizePath,
118
121
  relativePath,
119
122
  sniffForJson
120
- } from "./chunk-EG6MBBEN.js";
123
+ } from "./chunk-H4D3T5OG.js";
121
124
  import {
122
125
  __commonJS,
123
126
  __esm,
@@ -48074,6 +48077,13 @@ function maxRequestTimeForNetworkCallsMs(environment = getEnvironmentVariables()
48074
48077
  return maxRequestTime && !isNaN(Number(maxRequestTime)) ? Number(maxRequestTime) : 30 * 1e3;
48075
48078
  }
48076
48079
 
48080
+ // ../cli-kit/dist/private/node/api/urls.js
48081
+ init_cjs_shims();
48082
+ function sanitizeURL(url4) {
48083
+ let parsedUrl = new URL(url4);
48084
+ return parsedUrl.searchParams.has("subject_token") && parsedUrl.searchParams.set("subject_token", "****"), parsedUrl.searchParams.has("token") && parsedUrl.searchParams.set("token", "****"), parsedUrl.toString();
48085
+ }
48086
+
48077
48087
  // ../cli-kit/dist/private/node/api/headers.js
48078
48088
  init_cjs_shims();
48079
48089
  import https from "https";
@@ -48117,13 +48127,6 @@ async function httpsAgent() {
48117
48127
  });
48118
48128
  }
48119
48129
 
48120
- // ../cli-kit/dist/private/node/api/urls.js
48121
- init_cjs_shims();
48122
- function sanitizeURL(url4) {
48123
- let parsedUrl = new URL(url4);
48124
- return parsedUrl.searchParams.has("subject_token") && parsedUrl.searchParams.set("subject_token", "****"), parsedUrl.searchParams.has("token") && parsedUrl.searchParams.set("token", "****"), parsedUrl.toString();
48125
- }
48126
-
48127
48130
  // ../cli-kit/dist/private/node/api.js
48128
48131
  init_cjs_shims();
48129
48132
 
@@ -49836,52 +49839,6 @@ init_cjs_shims();
49836
49839
  // ../cli-kit/dist/private/node/session.js
49837
49840
  init_cjs_shims();
49838
49841
 
49839
- // ../cli-kit/dist/private/node/session/identity.js
49840
- init_cjs_shims();
49841
-
49842
- // ../cli-kit/dist/private/node/context/service.js
49843
- init_cjs_shims();
49844
- var Environment;
49845
- (function(Environment2) {
49846
- Environment2.Local = "local", Environment2.Production = "production";
49847
- })(Environment || (Environment = {}));
49848
- function serviceEnvironment(env = process.env) {
49849
- return env[environmentVariables.serviceEnv] === "local" ? Environment.Local : Environment.Production;
49850
- }
49851
- function isLocalEnvironment(env = process.env) {
49852
- return serviceEnvironment(env) === Environment.Local;
49853
- }
49854
-
49855
- // ../cli-kit/dist/private/node/session/identity.js
49856
- function clientId() {
49857
- let environment = serviceEnvironment();
49858
- return environment === Environment.Local ? "e5380e02-312a-7408-5718-e07017e9cf52" : environment === Environment.Production ? "fbdb2649-e327-4907-8f67-908d24cfd7e3" : "e5380e02-312a-7408-5718-e07017e9cf52";
49859
- }
49860
- function applicationId(api) {
49861
- switch (api) {
49862
- case "admin": {
49863
- let environment = serviceEnvironment();
49864
- return environment === Environment.Local ? "e92482cebb9bfb9fb5a0199cc770fde3de6c8d16b798ee73e36c9d815e070e52" : environment === Environment.Production ? "7ee65a63608843c577db8b23c4d7316ea0a01bd2f7594f8a9c06ea668c1b775c" : "e92482cebb9bfb9fb5a0199cc770fde3de6c8d16b798ee73e36c9d815e070e52";
49865
- }
49866
- case "partners": {
49867
- let environment = serviceEnvironment();
49868
- return environment === Environment.Local ? "df89d73339ac3c6c5f0a98d9ca93260763e384d51d6038da129889c308973978" : environment === Environment.Production ? "271e16d403dfa18082ffb3d197bd2b5f4479c3fc32736d69296829cbb28d41a6" : "df89d73339ac3c6c5f0a98d9ca93260763e384d51d6038da129889c308973978";
49869
- }
49870
- case "storefront-renderer": {
49871
- let environment = serviceEnvironment();
49872
- return environment === Environment.Local ? "46f603de-894f-488d-9471-5b721280ff49" : environment === Environment.Production ? "ee139b3d-5861-4d45-b387-1bc3ada7811c" : "46f603de-894f-488d-9471-5b721280ff49";
49873
- }
49874
- case "business-platform": {
49875
- let environment = serviceEnvironment();
49876
- return environment === Environment.Local ? "ace6dc89-b526-456d-a942-4b8ef6acda4b" : environment === Environment.Production ? "32ff8ee5-82b8-4d93-9f8a-c6997cefb7dc" : "ace6dc89-b526-456d-a942-4b8ef6acda4b";
49877
- }
49878
- case "app-management":
49879
- return serviceEnvironment() === Environment.Production ? "7ee65a63608843c577db8b23c4d7316ea0a01bd2f7594f8a9c06ea668c1b775c" : "e92482cebb9bfb9fb5a0199cc770fde3de6c8d16b798ee73e36c9d815e070e52";
49880
- default:
49881
- throw new BugError(`Application id for API of type: ${api}`);
49882
- }
49883
- }
49884
-
49885
49842
  // ../cli-kit/dist/private/node/session/validate.js
49886
49843
  init_cjs_shims();
49887
49844
 
@@ -52855,30 +52812,11 @@ function validateScopes(requestedScopes, identity) {
52855
52812
  let currentScopes = identity.scopes;
52856
52813
  return firstPartyDev() !== currentScopes.includes("employee") ? !1 : requestedScopes.every((scope) => currentScopes.includes(scope));
52857
52814
  }
52858
- async function validateSession(scopes, applications, session) {
52859
- if (!session || !validateScopes(scopes, session.identity))
52815
+ async function validateSession(scopes, session) {
52816
+ if (!session || !validateScopes(scopes, session.identity) || !validateCachedIdentityTokenStructure(session.identity))
52860
52817
  return "needs_full_auth";
52861
- let tokensAreExpired = isTokenExpired(session.identity);
52862
- if (applications.partnersApi) {
52863
- let appId = applicationId("partners"), token = session.applications[appId];
52864
- tokensAreExpired = tokensAreExpired || isTokenExpired(token);
52865
- }
52866
- if (applications.appManagementApi) {
52867
- let appId = applicationId("app-management"), token = session.applications[appId];
52868
- tokensAreExpired = tokensAreExpired || isTokenExpired(token);
52869
- }
52870
- if (applications.storefrontRendererApi) {
52871
- let appId = applicationId("storefront-renderer"), token = session.applications[appId];
52872
- tokensAreExpired = tokensAreExpired || isTokenExpired(token);
52873
- }
52874
- if (applications.adminApi) {
52875
- let appId = applicationId("admin"), realAppId = `${applications.adminApi.storeFqdn}-${appId}`, token = session.applications[realAppId];
52876
- tokensAreExpired = tokensAreExpired || isTokenExpired(token);
52877
- }
52878
- return outputDebug(`- Token validation -> It's expired: ${tokensAreExpired}`), validateCachedIdentityTokenStructure(session.identity) ? tokensAreExpired ? "needs_refresh" : "ok" : "needs_full_auth";
52879
- }
52880
- function isTokenExpired(token) {
52881
- return token ? token.expiresAt < expireThreshold() : !0;
52818
+ let expired = session.identity.expiresAt < expireThreshold();
52819
+ return outputDebug(`- Token validation -> It's expired: ${expired}`), expired ? "needs_refresh" : "ok";
52882
52820
  }
52883
52821
  function expireThreshold() {
52884
52822
  return new Date(Date.now() + sessionConstants.expirationTimeMarginInMinutes * 60 * 1e3);
@@ -52890,10 +52828,6 @@ function allDefaultScopes(extraScopes = []) {
52890
52828
  let scopes = allAPIs.map((api) => defaultApiScopes(api)).flat();
52891
52829
  return scopes = ["openid", ...scopes, ...extraScopes].map(scopeTransform), Array.from(new Set(scopes));
52892
52830
  }
52893
- function apiScopes(api, extraScopes = []) {
52894
- let scopes = [...defaultApiScopes(api), ...extraScopes.map(scopeTransform)].map(scopeTransform);
52895
- return Array.from(new Set(scopes));
52896
- }
52897
52831
  function tokenExchangeScopes(api) {
52898
52832
  switch (api) {
52899
52833
  case "partners":
@@ -52950,6 +52884,37 @@ function scopeTransform(scope) {
52950
52884
  // ../cli-kit/dist/private/node/session/exchange.js
52951
52885
  init_cjs_shims();
52952
52886
 
52887
+ // ../cli-kit/dist/private/node/session/identity.js
52888
+ init_cjs_shims();
52889
+ function clientId() {
52890
+ let environment = serviceEnvironment();
52891
+ return environment === Environment.Local ? "e5380e02-312a-7408-5718-e07017e9cf52" : environment === Environment.Production ? "fbdb2649-e327-4907-8f67-908d24cfd7e3" : "e5380e02-312a-7408-5718-e07017e9cf52";
52892
+ }
52893
+ function applicationId(api) {
52894
+ switch (api) {
52895
+ case "admin": {
52896
+ let environment = serviceEnvironment();
52897
+ return environment === Environment.Local ? "e92482cebb9bfb9fb5a0199cc770fde3de6c8d16b798ee73e36c9d815e070e52" : environment === Environment.Production ? "7ee65a63608843c577db8b23c4d7316ea0a01bd2f7594f8a9c06ea668c1b775c" : "e92482cebb9bfb9fb5a0199cc770fde3de6c8d16b798ee73e36c9d815e070e52";
52898
+ }
52899
+ case "partners": {
52900
+ let environment = serviceEnvironment();
52901
+ return environment === Environment.Local ? "df89d73339ac3c6c5f0a98d9ca93260763e384d51d6038da129889c308973978" : environment === Environment.Production ? "271e16d403dfa18082ffb3d197bd2b5f4479c3fc32736d69296829cbb28d41a6" : "df89d73339ac3c6c5f0a98d9ca93260763e384d51d6038da129889c308973978";
52902
+ }
52903
+ case "storefront-renderer": {
52904
+ let environment = serviceEnvironment();
52905
+ return environment === Environment.Local ? "46f603de-894f-488d-9471-5b721280ff49" : environment === Environment.Production ? "ee139b3d-5861-4d45-b387-1bc3ada7811c" : "46f603de-894f-488d-9471-5b721280ff49";
52906
+ }
52907
+ case "business-platform": {
52908
+ let environment = serviceEnvironment();
52909
+ return environment === Environment.Local ? "ace6dc89-b526-456d-a942-4b8ef6acda4b" : environment === Environment.Production ? "32ff8ee5-82b8-4d93-9f8a-c6997cefb7dc" : "ace6dc89-b526-456d-a942-4b8ef6acda4b";
52910
+ }
52911
+ case "app-management":
52912
+ return serviceEnvironment() === Environment.Production ? "7ee65a63608843c577db8b23c4d7316ea0a01bd2f7594f8a9c06ea668c1b775c" : "e92482cebb9bfb9fb5a0199cc770fde3de6c8d16b798ee73e36c9d815e070e52";
52913
+ default:
52914
+ throw new BugError(`Application id for API of type: ${api}`);
52915
+ }
52916
+ }
52917
+
52953
52918
  // ../cli-kit/dist/public/node/context/fqdn.js
52954
52919
  init_cjs_shims();
52955
52920
 
@@ -52966,12 +52931,9 @@ function assertCompatibleEnvironment() {
52966
52931
 
52967
52932
  // ../cli-kit/dist/public/node/vendor/dev_server/dev-server.js
52968
52933
  init_cjs_shims();
52969
- import fs4 from "node:fs";
52970
52934
 
52971
52935
  // ../cli-kit/dist/public/node/vendor/dev_server/dev-server-2024.js
52972
52936
  init_cjs_shims();
52973
- var ni = __toESM(require_network_interfaces(), 1);
52974
- import fs2 from "node:fs";
52975
52937
 
52976
52938
  // ../cli-kit/dist/public/node/vendor/dev_server/network/index.js
52977
52939
  init_cjs_shims();
@@ -53033,6 +52995,8 @@ function fallbackCheckPort(address, port, timeout) {
53033
52995
  }
53034
52996
 
53035
52997
  // ../cli-kit/dist/public/node/vendor/dev_server/dev-server-2024.js
52998
+ var ni = __toESM(require_network_interfaces(), 1);
52999
+ import fs2 from "node:fs";
53036
53000
  var NON_SHOP_PREFIXES = ["app", "dev", "shopify"], BACKEND_PORT = 8080;
53037
53001
  function createServer(projectName) {
53038
53002
  return {
@@ -53086,8 +53050,8 @@ var assertRunningOverride;
53086
53050
 
53087
53051
  // ../cli-kit/dist/public/node/vendor/dev_server/dev-server-2016.js
53088
53052
  init_cjs_shims();
53089
- import fs3 from "fs";
53090
53053
  import * as os from "node:os";
53054
+ import fs3 from "fs";
53091
53055
  function createServer2(projectName) {
53092
53056
  return {
53093
53057
  host: (options2 = {}) => host2(projectName, options2),
@@ -53115,6 +53079,7 @@ function getAddrPort(name) {
53115
53079
  var assertRunningOverride2;
53116
53080
 
53117
53081
  // ../cli-kit/dist/public/node/vendor/dev_server/dev-server.js
53082
+ import fs4 from "node:fs";
53118
53083
  var DevServer = class {
53119
53084
  constructor(projectName) {
53120
53085
  if (this.projectName = projectName, projectName === "shopify")
@@ -53246,7 +53211,7 @@ var ok = (value) => new Ok(value), err = (err2) => new Err(err2), Ok = class {
53246
53211
  return ok(this.value);
53247
53212
  }
53248
53213
  }, Err = class {
53249
- // eslint-disable-next-line node/handle-callback-err
53214
+ // eslint-disable-next-line n/handle-callback-err
53250
53215
  constructor(error) {
53251
53216
  this.error = error;
53252
53217
  }
@@ -53391,22 +53356,6 @@ var InvalidGrantError = class extends import_ts_error.ExtendableError {
53391
53356
  }, InvalidRequestError = class extends import_ts_error.ExtendableError {
53392
53357
  }, InvalidTargetError = class extends AbortError {
53393
53358
  };
53394
- async function exchangeAccessForApplicationTokens(identityToken, scopes, store2) {
53395
- let token = identityToken.accessToken, [partners, storefront, businessPlatform, admin, appManagement] = await Promise.all([
53396
- requestAppToken("partners", token, scopes.partners),
53397
- requestAppToken("storefront-renderer", token, scopes.storefront),
53398
- requestAppToken("business-platform", token, scopes.businessPlatform),
53399
- store2 ? requestAppToken("admin", token, scopes.admin, store2) : {},
53400
- requestAppToken("app-management", token, scopes.appManagement)
53401
- ]);
53402
- return {
53403
- ...partners,
53404
- ...storefront,
53405
- ...businessPlatform,
53406
- ...admin,
53407
- ...appManagement
53408
- };
53409
- }
53410
53359
  async function refreshAccessToken(currentToken) {
53411
53360
  let clientId2 = clientId(), params = {
53412
53361
  grant_type: "refresh_token",
@@ -53472,8 +53421,13 @@ function tokenRequestErrorHandler({ error, store: store2 }) {
53472
53421
  async function tokenRequest(params) {
53473
53422
  let fqdn = await identityFqdn(), url4 = new URL(`https://${fqdn}/oauth/token`);
53474
53423
  url4.search = new URLSearchParams(Object.entries(params)).toString();
53475
- let res = await shopifyFetch(url4.href, { method: "POST" }), payload = await res.json();
53476
- return res.ok ? ok(payload) : err({ error: payload.error, store: params.store });
53424
+ let res = await shopifyFetch(url4.href, { method: "POST" });
53425
+ try {
53426
+ let responseText = await res.text(), payload = JSON.parse(responseText);
53427
+ return res.ok ? ok(payload) : err({ error: payload.error, store: params.store });
53428
+ } catch (error) {
53429
+ throw error instanceof SyntaxError ? new AbortError(`Received invalid response from authentication service (HTTP ${res.status}).`, "The response could not be parsed as JSON. The service may be temporarily unavailable. Please try again.") : error;
53430
+ }
53477
53431
  }
53478
53432
  function buildIdentityToken(result, existingUserId, existingAlias) {
53479
53433
  let userId2 = existingUserId ?? (result.id_token ? decodeJwt(result.id_token).sub : void 0);
@@ -53529,7 +53483,7 @@ async function findSessionByAlias(alias) {
53529
53483
  let fqdn = await identityFqdn(), fqdnSessions = sessions[fqdn];
53530
53484
  if (fqdnSessions) {
53531
53485
  for (let [userId2, session] of Object.entries(fqdnSessions))
53532
- if (session.identity.alias === alias)
53486
+ if (session.identity.alias === alias || userId2 === alias)
53533
53487
  return userId2;
53534
53488
  }
53535
53489
  }
@@ -53732,10 +53686,14 @@ async function ensureAuthenticatedAdminAsApp(storeFqdn, clientId2, clientSecret)
53732
53686
  "Content-Type": "application/json"
53733
53687
  },
53734
53688
  body: JSON.stringify(bodyData)
53735
- }, "slow-request");
53689
+ }, "slow-request"), body = await tokenResponse.text();
53736
53690
  if (tokenResponse.status === 400)
53737
- throw (await tokenResponse.text()).includes("app_not_installed") ? new AbortError(outputContent`App is not installed on ${outputToken.green(storeFqdn)}. Try running ${outputToken.genericShellCommand("shopify app dev")} to connect your app to the shop.`) : new AbortError(`Failed to get access token for app ${clientId2} on store ${storeFqdn}: ${tokenResponse.statusText}`);
53738
- return { token: (await tokenResponse.json()).access_token, storeFqdn };
53691
+ throw body.includes("app_not_installed") ? new AbortError(outputContent`App is not installed on ${outputToken.green(storeFqdn)}. Try running ${outputToken.genericShellCommand("shopify app dev")} to connect your app to the shop.`) : new AbortError(`Failed to get access token for app ${clientId2} on store ${storeFqdn}: ${tokenResponse.statusText}`);
53692
+ try {
53693
+ return { token: JSON.parse(body).access_token, storeFqdn };
53694
+ } catch (error) {
53695
+ throw error instanceof SyntaxError ? new AbortError(`Received invalid response from admin authentication service (HTTP ${tokenResponse.status}).`, "The response could not be parsed as JSON. The service may be temporarily unavailable. Please try again.") : error;
53696
+ }
53739
53697
  }
53740
53698
 
53741
53699
  // ../cli-kit/dist/public/common/object.js
@@ -54166,7 +54124,7 @@ ${outputToken.json(scopes)}
54166
54124
  For applications:
54167
54125
  ${outputToken.json(applications)}
54168
54126
  `);
54169
- let validationResult = await validateSession(scopes, applications, currentSession), newSession = {};
54127
+ let validationResult = await validateSession(scopes, currentSession), newSession = {};
54170
54128
  if (validationResult === "needs_full_auth")
54171
54129
  await throwOnNoPrompt(noPrompt), outputDebug(outputContent`Initiating the full authentication flow...`), newSession = await executeCompleteFlow(applications);
54172
54130
  else if (validationResult === "needs_refresh" || forceRefresh) {
@@ -54195,7 +54153,7 @@ async function throwOnNoPrompt(noPrompt) {
54195
54153
  The CLI is currently unable to prompt for reauthentication.`, "Restart the CLI process you were running. If in an interactive terminal, you will be prompted to reauthenticate. If in a non-interactive terminal, ensure the correct credentials are available in the program environment.");
54196
54154
  }
54197
54155
  async function executeCompleteFlow(applications) {
54198
- let scopes = getFlattenScopes(applications), exchangeScopes = getExchangeScopes(applications), store2 = applications.adminApi?.storeFqdn;
54156
+ let scopes = getFlattenScopes(applications);
54199
54157
  firstPartyDev() && (outputDebug(outputContent`Authenticating as Shopify Employee...`), scopes.push("employee"));
54200
54158
  let identityToken, identityTokenInformation = getIdentityTokenInformation();
54201
54159
  if (identityTokenInformation)
@@ -54205,63 +54163,37 @@ async function executeCompleteFlow(applications) {
54205
54163
  let deviceAuth = await requestDeviceAuthorization(scopes);
54206
54164
  outputDebug(outputContent`Starting polling for the identity token...`), identityToken = await pollForDeviceAuthorization(deviceAuth.deviceCode, deviceAuth.interval);
54207
54165
  }
54208
- outputDebug(outputContent`CLI token received. Exchanging it for application tokens...`);
54209
- let result = await exchangeAccessForApplicationTokens(identityToken, exchangeScopes, store2), businessPlatformToken = result[applicationId("business-platform")]?.accessToken, alias = await fetchEmail(businessPlatformToken) ?? identityToken.userId, session = {
54166
+ outputDebug(outputContent`CLI token received (PCAT). Using it directly for API access...`);
54167
+ let alias = await fetchEmail(identityToken.accessToken) ?? identityToken.userId, session = {
54210
54168
  identity: {
54211
54169
  ...identityToken,
54212
54170
  alias
54213
54171
  },
54214
- applications: result
54172
+ applications: {}
54215
54173
  };
54216
54174
  return outputCompleted("Logged in."), session;
54217
54175
  }
54218
- async function refreshTokens(session, applications) {
54219
- let identityToken = await refreshAccessToken(session.identity), exchangeScopes = getExchangeScopes(applications), applicationTokens = await exchangeAccessForApplicationTokens(identityToken, exchangeScopes, applications.adminApi?.storeFqdn);
54176
+ async function refreshTokens(session, _applications) {
54220
54177
  return {
54221
- identity: identityToken,
54222
- applications: applicationTokens
54178
+ identity: await refreshAccessToken(session.identity),
54179
+ applications: {}
54223
54180
  };
54224
54181
  }
54225
54182
  async function tokensFor(applications, session) {
54226
- let tokens = {
54227
- userId: session.identity.userId
54183
+ let token = session.identity.accessToken;
54184
+ return {
54185
+ userId: session.identity.userId,
54186
+ admin: applications.adminApi ? { token, storeFqdn: applications.adminApi.storeFqdn } : void 0,
54187
+ partners: applications.partnersApi ? token : void 0,
54188
+ storefront: applications.storefrontRendererApi ? token : void 0,
54189
+ businessPlatform: applications.businessPlatformApi ? token : void 0,
54190
+ appManagement: applications.appManagementApi ? token : void 0
54228
54191
  };
54229
- if (applications.adminApi) {
54230
- let appId = applicationId("admin"), realAppId = `${applications.adminApi.storeFqdn}-${appId}`, token = session.applications[realAppId]?.accessToken;
54231
- token && (tokens.admin = { token, storeFqdn: applications.adminApi.storeFqdn });
54232
- }
54233
- if (applications.partnersApi) {
54234
- let appId = applicationId("partners");
54235
- tokens.partners = session.applications[appId]?.accessToken;
54236
- }
54237
- if (applications.storefrontRendererApi) {
54238
- let appId = applicationId("storefront-renderer");
54239
- tokens.storefront = session.applications[appId]?.accessToken;
54240
- }
54241
- if (applications.businessPlatformApi) {
54242
- let appId = applicationId("business-platform");
54243
- tokens.businessPlatform = session.applications[appId]?.accessToken;
54244
- }
54245
- if (applications.appManagementApi) {
54246
- let appId = applicationId("app-management");
54247
- tokens.appManagement = session.applications[appId]?.accessToken;
54248
- }
54249
- return tokens;
54250
54192
  }
54251
54193
  function getFlattenScopes(apps) {
54252
54194
  let admin = apps.adminApi?.scopes ?? [], partner = apps.partnersApi?.scopes ?? [], storefront = apps.storefrontRendererApi?.scopes ?? [], businessPlatform = apps.businessPlatformApi?.scopes ?? [], appManagement = apps.appManagementApi?.scopes ?? [], requestedScopes = [...admin, ...partner, ...storefront, ...businessPlatform, ...appManagement];
54253
54195
  return allDefaultScopes(requestedScopes);
54254
54196
  }
54255
- function getExchangeScopes(apps) {
54256
- let adminScope = apps.adminApi?.scopes ?? [], partnerScope = apps.partnersApi?.scopes ?? [], storefrontScopes = apps.storefrontRendererApi?.scopes ?? [], businessPlatformScopes = apps.businessPlatformApi?.scopes ?? [], appManagementScopes = apps.appManagementApi?.scopes ?? [];
54257
- return {
54258
- admin: apiScopes("admin", adminScope),
54259
- partners: apiScopes("partners", partnerScope),
54260
- storefront: apiScopes("storefront-renderer", storefrontScopes),
54261
- businessPlatform: apiScopes("business-platform", businessPlatformScopes),
54262
- appManagement: apiScopes("app-management", appManagementScopes)
54263
- };
54264
- }
54265
54197
  function buildIdentityTokenFromEnv(scopes, identityTokenInformation) {
54266
54198
  return {
54267
54199
  ...identityTokenInformation,
@@ -54346,8 +54278,6 @@ init_cjs_shims();
54346
54278
 
54347
54279
  // ../cli-kit/dist/public/node/vendor/otel-js/export/InstantaneousMetricReader.js
54348
54280
  init_cjs_shims();
54349
- var import_sdk_metrics = __toESM(require_src3(), 1), import_core = __toESM(require_src(), 1);
54350
- init_esm();
54351
54281
 
54352
54282
  // ../cli-kit/dist/public/node/vendor/otel-js/utils/throttle.js
54353
54283
  init_cjs_shims();
@@ -54366,16 +54296,14 @@ function throttle(func, wait, { leading = !0, trailing = !0 } = {}) {
54366
54296
  }
54367
54297
 
54368
54298
  // ../cli-kit/dist/public/node/vendor/otel-js/export/InstantaneousMetricReader.js
54299
+ var import_sdk_metrics = __toESM(require_src3(), 1), import_core = __toESM(require_src(), 1);
54300
+ init_esm();
54369
54301
  var InstantaneousMetricReader = class extends import_sdk_metrics.MetricReader {
54370
54302
  constructor({ exporter, throttleLimit }) {
54371
54303
  super({
54372
54304
  aggregationSelector: exporter.selectAggregation?.bind(exporter),
54373
54305
  aggregationTemporalitySelector: exporter.selectAggregationTemporality?.bind(exporter)
54374
- }), this._exporter = exporter, this.onForceFlush = throttle(
54375
- // eslint-disable-next-line @typescript-eslint/unbound-method
54376
- this.onForceFlush,
54377
- throttleLimit
54378
- );
54306
+ }), this._exporter = exporter, this.onForceFlush = throttle(this.onForceFlush, throttleLimit);
54379
54307
  }
54380
54308
  async onForceFlush() {
54381
54309
  let { resourceMetrics, errors } = await this.collect({});
@@ -54420,7 +54348,6 @@ var DefaultMeterProvider = class extends import_sdk_metrics2.MeterProvider {
54420
54348
 
54421
54349
  // ../cli-kit/dist/public/node/vendor/otel-js/service/BaseOtelService/BaseOtelService.js
54422
54350
  init_cjs_shims();
54423
- var import_sdk_metrics3 = __toESM(require_src3(), 1);
54424
54351
 
54425
54352
  // ../cli-kit/dist/public/node/vendor/otel-js/utils/validators.js
54426
54353
  init_cjs_shims();
@@ -54432,9 +54359,16 @@ function isValidMetricName(value) {
54432
54359
  }
54433
54360
 
54434
54361
  // ../cli-kit/dist/public/node/vendor/otel-js/service/BaseOtelService/BaseOtelService.js
54435
- var instrumentationScope = "opentelemetry-js-shopify-web", BaseOtelService = class {
54362
+ var import_sdk_metrics3 = __toESM(require_src3(), 1), instrumentationScope = "opentelemetry-js-shopify-web", BaseOtelService = class {
54436
54363
  /**
54437
54364
  * Bootstraps an Otel exporter which can send Otel metrics to a dedicated Shopify supported collector endpoint.
54365
+ *
54366
+ * @param root0
54367
+ * @param root0.serviceName
54368
+ * @param root0.prefixMetric
54369
+ * @param root0.metrics
54370
+ * @param root0.onRecord
54371
+ * @param root0.meterProvider
54438
54372
  */
54439
54373
  constructor({ serviceName, prefixMetric = !1, metrics: metrics2 = {}, onRecord, meterProvider }) {
54440
54374
  if (this.metrics = /* @__PURE__ */ new Map(), this.recordListeners = /* @__PURE__ */ new Set(), !serviceName)
@@ -54514,6 +54448,17 @@ init_esm();
54514
54448
  var DefaultOtelService = class extends BaseOtelService {
54515
54449
  /**
54516
54450
  * Bootstraps an Otel exporter which can send Otel metrics to a dedicated Shopify supported collector endpoint.
54451
+ *
54452
+ * @param root0
54453
+ * @param root0.throttleLimit
54454
+ * @param root0.env
54455
+ * @param root0.serviceName
54456
+ * @param root0.prefixMetric
54457
+ * @param root0.metrics
54458
+ * @param root0.onRecord
54459
+ * @param root0.meterProvider
54460
+ * @param root0.useXhr
54461
+ * @param root0.otelEndpoint
54517
54462
  */
54518
54463
  constructor({
54519
54464
  throttleLimit = 5e3,
@@ -54906,7 +54851,6 @@ export {
54906
54851
  shopifyFetch,
54907
54852
  fanoutHooks,
54908
54853
  getListOfTunnelPlugins,
54909
- serviceEnvironment,
54910
54854
  z,
54911
54855
  DevServerCore,
54912
54856
  partnersFqdn,
@@ -54995,4 +54939,4 @@ mime-types/index.js:
54995
54939
  * MIT Licensed
54996
54940
  *)
54997
54941
  */
54998
- //# sourceMappingURL=chunk-A2CZGTAP.js.map
54942
+ //# sourceMappingURL=chunk-ZVE6VSBX.js.map
@@ -1,25 +1,25 @@
1
1
  import {
2
2
  Login
3
- } from "../../../chunk-DR5R5UTE.js";
4
- import "../../../chunk-I23GZAC4.js";
5
- import "../../../chunk-SUFC4ISB.js";
6
- import "../../../chunk-A2CZGTAP.js";
3
+ } from "../../../chunk-SMO4IV7V.js";
4
+ import "../../../chunk-KQU2IAXJ.js";
5
+ import "../../../chunk-FESVG7HJ.js";
6
+ import "../../../chunk-ZVE6VSBX.js";
7
7
  import "../../../chunk-SHWOPMLQ.js";
8
8
  import "../../../chunk-VBBBCVMH.js";
9
- import "../../../chunk-HAG3HJ2V.js";
10
- import "../../../chunk-NYP3N62G.js";
11
- import "../../../chunk-E4GUDBAR.js";
9
+ import "../../../chunk-O3GDENDY.js";
10
+ import "../../../chunk-T5M3A5TW.js";
11
+ import "../../../chunk-6O2ILC2V.js";
12
12
  import "../../../chunk-6NVYATES.js";
13
13
  import "../../../chunk-CTFDRWUN.js";
14
14
  import "../../../chunk-7IK72W75.js";
15
- import "../../../chunk-CEUL3KX5.js";
15
+ import "../../../chunk-EZZRDRCA.js";
16
16
  import "../../../chunk-KUJQ4AB6.js";
17
17
  import "../../../chunk-UMUTXITN.js";
18
- import "../../../chunk-G2ZZKGSV.js";
19
18
  import "../../../chunk-UV5N2VL7.js";
20
19
  import "../../../chunk-XE5EOEBL.js";
21
20
  import "../../../chunk-Q2H6D2MH.js";
22
- import "../../../chunk-EG6MBBEN.js";
21
+ import "../../../chunk-G2ZZKGSV.js";
22
+ import "../../../chunk-H4D3T5OG.js";
23
23
  import "../../../chunk-PKR7KJ6P.js";
24
24
  export {
25
25
  Login as default
@@ -1,35 +1,35 @@
1
1
  import {
2
2
  Login,
3
3
  promptSessionSelect
4
- } from "../../../chunk-DR5R5UTE.js";
4
+ } from "../../../chunk-SMO4IV7V.js";
5
5
  import {
6
6
  mockAndCaptureOutput
7
- } from "../../../chunk-E44JKFB6.js";
7
+ } from "../../../chunk-CLJTWTB3.js";
8
8
  import {
9
9
  describe,
10
10
  globalExpect,
11
11
  test,
12
12
  vi
13
- } from "../../../chunk-HTGTTXQL.js";
14
- import "../../../chunk-I23GZAC4.js";
15
- import "../../../chunk-SUFC4ISB.js";
16
- import "../../../chunk-A2CZGTAP.js";
13
+ } from "../../../chunk-EURIZXCA.js";
14
+ import "../../../chunk-KQU2IAXJ.js";
15
+ import "../../../chunk-FESVG7HJ.js";
16
+ import "../../../chunk-ZVE6VSBX.js";
17
17
  import "../../../chunk-SHWOPMLQ.js";
18
18
  import "../../../chunk-VBBBCVMH.js";
19
- import "../../../chunk-HAG3HJ2V.js";
20
- import "../../../chunk-NYP3N62G.js";
21
- import "../../../chunk-E4GUDBAR.js";
19
+ import "../../../chunk-O3GDENDY.js";
20
+ import "../../../chunk-T5M3A5TW.js";
21
+ import "../../../chunk-6O2ILC2V.js";
22
22
  import "../../../chunk-6NVYATES.js";
23
23
  import "../../../chunk-CTFDRWUN.js";
24
24
  import "../../../chunk-7IK72W75.js";
25
- import "../../../chunk-CEUL3KX5.js";
25
+ import "../../../chunk-EZZRDRCA.js";
26
26
  import "../../../chunk-KUJQ4AB6.js";
27
27
  import "../../../chunk-UMUTXITN.js";
28
- import "../../../chunk-G2ZZKGSV.js";
29
28
  import "../../../chunk-UV5N2VL7.js";
30
29
  import "../../../chunk-XE5EOEBL.js";
31
30
  import "../../../chunk-Q2H6D2MH.js";
32
- import "../../../chunk-EG6MBBEN.js";
31
+ import "../../../chunk-G2ZZKGSV.js";
32
+ import "../../../chunk-H4D3T5OG.js";
33
33
  import {
34
34
  init_cjs_shims
35
35
  } from "../../../chunk-PKR7KJ6P.js";
@@ -1,25 +1,25 @@
1
1
  import {
2
2
  Logout
3
- } from "../../../chunk-ATQVKUJC.js";
4
- import "../../../chunk-I23GZAC4.js";
5
- import "../../../chunk-SUFC4ISB.js";
6
- import "../../../chunk-A2CZGTAP.js";
3
+ } from "../../../chunk-M7TUKQMY.js";
4
+ import "../../../chunk-KQU2IAXJ.js";
5
+ import "../../../chunk-FESVG7HJ.js";
6
+ import "../../../chunk-ZVE6VSBX.js";
7
7
  import "../../../chunk-SHWOPMLQ.js";
8
8
  import "../../../chunk-VBBBCVMH.js";
9
- import "../../../chunk-HAG3HJ2V.js";
10
- import "../../../chunk-NYP3N62G.js";
11
- import "../../../chunk-E4GUDBAR.js";
9
+ import "../../../chunk-O3GDENDY.js";
10
+ import "../../../chunk-T5M3A5TW.js";
11
+ import "../../../chunk-6O2ILC2V.js";
12
12
  import "../../../chunk-6NVYATES.js";
13
13
  import "../../../chunk-CTFDRWUN.js";
14
14
  import "../../../chunk-7IK72W75.js";
15
- import "../../../chunk-CEUL3KX5.js";
15
+ import "../../../chunk-EZZRDRCA.js";
16
16
  import "../../../chunk-KUJQ4AB6.js";
17
17
  import "../../../chunk-UMUTXITN.js";
18
- import "../../../chunk-G2ZZKGSV.js";
19
18
  import "../../../chunk-UV5N2VL7.js";
20
19
  import "../../../chunk-XE5EOEBL.js";
21
20
  import "../../../chunk-Q2H6D2MH.js";
22
- import "../../../chunk-EG6MBBEN.js";
21
+ import "../../../chunk-G2ZZKGSV.js";
22
+ import "../../../chunk-H4D3T5OG.js";
23
23
  import "../../../chunk-PKR7KJ6P.js";
24
24
  export {
25
25
  Logout as default