@shopify/cli-kit 2.0.9 → 2.0.14

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.
@@ -12317,7 +12317,7 @@ var path$w = /*#__PURE__*/Object.freeze({
12317
12317
  });
12318
12318
 
12319
12319
  var name = "@shopify/cli-kit";
12320
- var version$4 = "2.0.9";
12320
+ var version$4 = "2.0.14";
12321
12321
  var description$1 = "A set of utilities, interfaces, and models that are common across all the platform features";
12322
12322
  var keywords = [
12323
12323
  "shopify",
@@ -12366,11 +12366,11 @@ var os$7 = [
12366
12366
  ];
12367
12367
  var dependencies$1 = {
12368
12368
  "@oclif/core": "1.7.0",
12369
+ envfile: "^6.17.0",
12369
12370
  keytar: "^7.9.0",
12370
12371
  open: "^8.4.0",
12371
12372
  "source-map-support": "^0.5.21",
12372
- stacktracey: "^2.1.8",
12373
- envfile: "^6.17.0"
12373
+ stacktracey: "^2.1.8"
12374
12374
  };
12375
12375
  var devDependencies = {
12376
12376
  "@iarna/toml": "^2.2.5",
@@ -12408,7 +12408,7 @@ var devDependencies = {
12408
12408
  "term-size": "^3.0.1",
12409
12409
  "terminal-link": "^3.0.0",
12410
12410
  vitest: "0.10.0",
12411
- zod: "^3.14.3"
12411
+ zod: "^3.17.3"
12412
12412
  };
12413
12413
  var cliKitPackageJson = {
12414
12414
  name: name,
@@ -12432,11 +12432,11 @@ var cliKitPackageJson = {
12432
12432
  devDependencies: devDependencies
12433
12433
  };
12434
12434
 
12435
- var version$3 = "2.0.9";
12435
+ var version$3 = "2.0.14";
12436
12436
 
12437
- var version$2 = "2.0.9";
12437
+ var version$2 = "2.0.14";
12438
12438
 
12439
- var version$1 = "2.0.9";
12439
+ var version$1 = "2.0.14";
12440
12440
 
12441
12441
  const homedir$1 = os$8.homedir();
12442
12442
  const tmpdir$1 = os$8.tmpdir();
@@ -14674,13 +14674,22 @@ const exec$2 = (command, args, options) => {
14674
14674
  cwd: options?.cwd,
14675
14675
  input: options?.stdin
14676
14676
  });
14677
+ debug$5(`
14678
+ Running system process:
14679
+ \xB7 Command: ${command} ${args.join(" ")}
14680
+ \xB7 Working directory: ${options?.cwd ?? process.cwd()}
14681
+ `);
14677
14682
  if (options?.stderr) {
14678
14683
  commandProcess.stderr?.pipe(options.stderr);
14679
14684
  }
14680
14685
  if (options?.stdout) {
14681
14686
  commandProcess.stdout?.pipe(options.stdout);
14682
14687
  }
14683
- return commandProcess;
14688
+ return commandProcess.catch((processError) => {
14689
+ const abortError = new Abort(processError.message);
14690
+ abortError.stack = processError.stack;
14691
+ throw abortError;
14692
+ });
14684
14693
  };
14685
14694
  const concurrentExec = async (commands) => {
14686
14695
  await concurrent(commands.map((command) => {
@@ -19306,7 +19315,9 @@ del$2.exports = async (patterns, {force, dryRun, cwd = process.cwd(), onProgress
19306
19315
  });
19307
19316
  }
19308
19317
 
19309
- const mapper = async (file, fileIndex) => {
19318
+ let deletedCount = 0;
19319
+
19320
+ const mapper = async file => {
19310
19321
  file = path$a.resolve(cwd, file);
19311
19322
 
19312
19323
  if (!force) {
@@ -19317,10 +19328,12 @@ del$2.exports = async (patterns, {force, dryRun, cwd = process.cwd(), onProgress
19317
19328
  await rimrafP(file, rimrafOptions);
19318
19329
  }
19319
19330
 
19331
+ deletedCount += 1;
19332
+
19320
19333
  onProgress({
19321
19334
  totalCount: files.length,
19322
- deletedCount: fileIndex,
19323
- percent: fileIndex / files.length
19335
+ deletedCount,
19336
+ percent: deletedCount / files.length
19324
19337
  });
19325
19338
 
19326
19339
  return file;
@@ -19328,12 +19341,6 @@ del$2.exports = async (patterns, {force, dryRun, cwd = process.cwd(), onProgress
19328
19341
 
19329
19342
  const removedFiles = await pMap(files, mapper, options);
19330
19343
 
19331
- onProgress({
19332
- totalCount: files.length,
19333
- deletedCount: files.length,
19334
- percent: 1
19335
- });
19336
-
19337
19344
  removedFiles.sort((a, b) => a.localeCompare(b));
19338
19345
 
19339
19346
  return removedFiles;
@@ -21101,7 +21108,7 @@ class ContentToken {
21101
21108
  }
21102
21109
  }
21103
21110
  const token = {
21104
- command: (value) => {
21111
+ genericShellCommand: (value) => {
21105
21112
  return new ContentToken(value, {}, 0 /* Command */);
21106
21113
  },
21107
21114
  path: (value) => {
@@ -21130,8 +21137,28 @@ const token = {
21130
21137
  },
21131
21138
  green: (value) => {
21132
21139
  return new ContentToken(value, {}, 9 /* Green */);
21140
+ },
21141
+ command: (dependencyManager, scriptName, ...scriptArgs) => {
21142
+ return new ContentToken(formatPackageManagerCommand(dependencyManager, scriptName, scriptArgs), {}, 0 /* Command */);
21133
21143
  }
21134
21144
  };
21145
+ function formatPackageManagerCommand(dependencyManager, scriptName, scriptArgs) {
21146
+ switch (dependencyManager) {
21147
+ case "yarn": {
21148
+ const pieces = ["yarn", scriptName, ...scriptArgs];
21149
+ return pieces.join(" ");
21150
+ }
21151
+ case "pnpm":
21152
+ case "npm": {
21153
+ const pieces = [dependencyManager, "run", scriptName];
21154
+ if (scriptArgs.length > 0) {
21155
+ pieces.push("--");
21156
+ pieces.push(...scriptArgs);
21157
+ }
21158
+ return pieces.join(" ");
21159
+ }
21160
+ }
21161
+ }
21135
21162
  class TokenizedString {
21136
21163
  constructor(value) {
21137
21164
  this.value = value;
@@ -21401,7 +21428,13 @@ class AbortSilent extends Fatal {
21401
21428
  class Bug extends Fatal {
21402
21429
  }
21403
21430
  async function handler(error) {
21404
- const fatal = error instanceof Fatal ? error : new Abort(error.message);
21431
+ let fatal;
21432
+ if (error instanceof Fatal) {
21433
+ fatal = error;
21434
+ } else {
21435
+ fatal = new Bug(error.message);
21436
+ fatal.stack = error.stack;
21437
+ }
21405
21438
  await error$k(fatal);
21406
21439
  return Promise.resolve(error);
21407
21440
  }
@@ -21422,7 +21455,8 @@ var error$j = /*#__PURE__*/Object.freeze({
21422
21455
  AbortSilent: AbortSilent,
21423
21456
  Bug: Bug,
21424
21457
  handler: handler,
21425
- mapper: mapper$1
21458
+ mapper: mapper$1,
21459
+ AbortSignal: AbortSignal
21426
21460
  });
21427
21461
 
21428
21462
  /******************************************************************************
@@ -40631,7 +40665,7 @@ class Body$1 {
40631
40665
  return formData;
40632
40666
  }
40633
40667
 
40634
- const {toFormData} = await import('./multipart-parser-9b6af1e6.js');
40668
+ const {toFormData} = await import('./multipart-parser-e0ecbeb6.js');
40635
40669
  return toFormData(this.body, ct);
40636
40670
  }
40637
40671
 
@@ -54594,15 +54628,22 @@ async function install(directory, dependencyManager2, stdout, stderr, signal) {
54594
54628
  const options = { cwd: directory, stdout, stderr, signal };
54595
54629
  await exec$2(dependencyManager2, ["install"], options);
54596
54630
  }
54631
+ async function getPackageName(packageJsonPath) {
54632
+ const packageJsonContent = await packageJSONContents(packageJsonPath);
54633
+ return packageJsonContent.name;
54634
+ }
54597
54635
  async function getDependencies(packageJsonPath) {
54598
- if (!await exists$1(packageJsonPath)) {
54599
- throw PackageJsonNotFoundError(dirname$1(packageJsonPath));
54600
- }
54601
- const packageJsonContent = JSON.parse(await read$1(packageJsonPath));
54636
+ const packageJsonContent = await packageJSONContents(packageJsonPath);
54602
54637
  const dependencies = packageJsonContent.dependencies ?? {};
54603
54638
  const devDependencies = packageJsonContent.devDependencies ?? {};
54604
54639
  return { ...dependencies, ...devDependencies };
54605
54640
  }
54641
+ async function packageJSONContents(packageJsonPath) {
54642
+ if (!await exists$1(packageJsonPath)) {
54643
+ throw PackageJsonNotFoundError(dirname$1(packageJsonPath));
54644
+ }
54645
+ return JSON.parse(await read$1(packageJsonPath));
54646
+ }
54606
54647
  async function addNPMDependenciesIfNeeded(dependencies, options) {
54607
54648
  const packageJsonPath = join$3(options.directory, "package.json");
54608
54649
  if (!await exists$1(packageJsonPath)) {
@@ -54690,6 +54731,7 @@ var dependency = /*#__PURE__*/Object.freeze({
54690
54731
  dependencyManagerUsedForCreating: dependencyManagerUsedForCreating,
54691
54732
  installNPMDependenciesRecursively: installNPMDependenciesRecursively,
54692
54733
  install: install,
54734
+ getPackageName: getPackageName,
54693
54735
  getDependencies: getDependencies,
54694
54736
  addNPMDependenciesIfNeeded: addNPMDependenciesIfNeeded
54695
54737
  });
@@ -66608,8 +66650,8 @@ const EmptyUrlError = new Abort("We received the authentication redirect but the
66608
66650
  const AuthenticationError = (message) => {
66609
66651
  return new Abort(message);
66610
66652
  };
66611
- const MissingCodeError = new Bug(`The authentication cannot continue because the redirect doesn't include the code.`);
66612
- const MissingStateError = new Bug(`The authentication cannot continue because the redirect doesn't include the state.`);
66653
+ const MissingCodeError = new Bug(`The authentication can't continue because the redirect doesn't include the code.`);
66654
+ const MissingStateError = new Bug(`The authentication can't continue because the redirect doesn't include the state.`);
66613
66655
  const redirectResponseBody = `You're logged in on the Shopify CLI in your terminal`;
66614
66656
  const ResponseTimeoutSeconds = 10;
66615
66657
  class RedirectListener {
@@ -66777,6 +66819,70 @@ var util$2;
66777
66819
  }
66778
66820
  util.joinValues = joinValues;
66779
66821
  })(util$2 || (util$2 = {}));
66822
+ const ZodParsedType = util$2.arrayToEnum([
66823
+ "string",
66824
+ "nan",
66825
+ "number",
66826
+ "integer",
66827
+ "float",
66828
+ "boolean",
66829
+ "date",
66830
+ "bigint",
66831
+ "symbol",
66832
+ "function",
66833
+ "undefined",
66834
+ "null",
66835
+ "array",
66836
+ "object",
66837
+ "unknown",
66838
+ "promise",
66839
+ "void",
66840
+ "never",
66841
+ "map",
66842
+ "set",
66843
+ ]);
66844
+ const getParsedType = (data) => {
66845
+ const t = typeof data;
66846
+ switch (t) {
66847
+ case "undefined":
66848
+ return ZodParsedType.undefined;
66849
+ case "string":
66850
+ return ZodParsedType.string;
66851
+ case "number":
66852
+ return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
66853
+ case "boolean":
66854
+ return ZodParsedType.boolean;
66855
+ case "function":
66856
+ return ZodParsedType.function;
66857
+ case "bigint":
66858
+ return ZodParsedType.bigint;
66859
+ case "object":
66860
+ if (Array.isArray(data)) {
66861
+ return ZodParsedType.array;
66862
+ }
66863
+ if (data === null) {
66864
+ return ZodParsedType.null;
66865
+ }
66866
+ if (data.then &&
66867
+ typeof data.then === "function" &&
66868
+ data.catch &&
66869
+ typeof data.catch === "function") {
66870
+ return ZodParsedType.promise;
66871
+ }
66872
+ if (typeof Map !== "undefined" && data instanceof Map) {
66873
+ return ZodParsedType.map;
66874
+ }
66875
+ if (typeof Set !== "undefined" && data instanceof Set) {
66876
+ return ZodParsedType.set;
66877
+ }
66878
+ if (typeof Date !== "undefined" && data instanceof Date) {
66879
+ return ZodParsedType.date;
66880
+ }
66881
+ return ZodParsedType.object;
66882
+ default:
66883
+ return ZodParsedType.unknown;
66884
+ }
66885
+ };
66780
66886
 
66781
66887
  const ZodIssueCode = util$2.arrayToEnum([
66782
66888
  "invalid_type",
@@ -66984,70 +67090,6 @@ const setErrorMap = (map) => {
66984
67090
  overrideErrorMap = map;
66985
67091
  };
66986
67092
 
66987
- const ZodParsedType = util$2.arrayToEnum([
66988
- "string",
66989
- "nan",
66990
- "number",
66991
- "integer",
66992
- "float",
66993
- "boolean",
66994
- "date",
66995
- "bigint",
66996
- "symbol",
66997
- "function",
66998
- "undefined",
66999
- "null",
67000
- "array",
67001
- "object",
67002
- "unknown",
67003
- "promise",
67004
- "void",
67005
- "never",
67006
- "map",
67007
- "set",
67008
- ]);
67009
- const getParsedType = (data) => {
67010
- const t = typeof data;
67011
- switch (t) {
67012
- case "undefined":
67013
- return ZodParsedType.undefined;
67014
- case "string":
67015
- return ZodParsedType.string;
67016
- case "number":
67017
- return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
67018
- case "boolean":
67019
- return ZodParsedType.boolean;
67020
- case "function":
67021
- return ZodParsedType.function;
67022
- case "bigint":
67023
- return ZodParsedType.bigint;
67024
- case "object":
67025
- if (Array.isArray(data)) {
67026
- return ZodParsedType.array;
67027
- }
67028
- if (data === null) {
67029
- return ZodParsedType.null;
67030
- }
67031
- if (data.then &&
67032
- typeof data.then === "function" &&
67033
- data.catch &&
67034
- typeof data.catch === "function") {
67035
- return ZodParsedType.promise;
67036
- }
67037
- if (typeof Map !== "undefined" && data instanceof Map) {
67038
- return ZodParsedType.map;
67039
- }
67040
- if (typeof Set !== "undefined" && data instanceof Set) {
67041
- return ZodParsedType.set;
67042
- }
67043
- if (typeof Date !== "undefined" && data instanceof Date) {
67044
- return ZodParsedType.date;
67045
- }
67046
- return ZodParsedType.object;
67047
- default:
67048
- return ZodParsedType.unknown;
67049
- }
67050
- };
67051
67093
  const makeIssue = (params) => {
67052
67094
  const { data, path, errorMaps, issueData } = params;
67053
67095
  const fullPath = [...path, ...(issueData.path || [])];
@@ -67079,7 +67121,7 @@ function addIssueToContext(ctx, issueData) {
67079
67121
  ctx.common.contextualErrorMap,
67080
67122
  ctx.schemaErrorMap,
67081
67123
  overrideErrorMap,
67082
- defaultErrorMap, // then global default map
67124
+ defaultErrorMap,
67083
67125
  ].filter((x) => !!x),
67084
67126
  });
67085
67127
  ctx.common.issues.push(issue);
@@ -67434,10 +67476,14 @@ class ZodString extends ZodType {
67434
67476
  ...errorUtil.errToObj(message),
67435
67477
  });
67436
67478
  /**
67437
- * Deprecated.
67438
- * Use z.string().min(1) instead.
67479
+ * @deprecated Use z.string().min(1) instead.
67480
+ * @see {@link ZodString.min}
67439
67481
  */
67440
67482
  this.nonempty = (message) => this.min(1, errorUtil.errToObj(message));
67483
+ this.trim = () => new ZodString({
67484
+ ...this._def,
67485
+ checks: [...this._def.checks, { kind: "trim" }],
67486
+ });
67441
67487
  }
67442
67488
  _parse(input) {
67443
67489
  const parsedType = this._getType(input);
@@ -67541,6 +67587,12 @@ class ZodString extends ZodType {
67541
67587
  status.dirty();
67542
67588
  }
67543
67589
  }
67590
+ else if (check.kind === "trim") {
67591
+ input.data = input.data.trim();
67592
+ }
67593
+ else {
67594
+ util$2.assertNever(check);
67595
+ }
67544
67596
  }
67545
67597
  return { status: status.value, value: input.data };
67546
67598
  }
@@ -68103,7 +68155,7 @@ var objectUtil;
68103
68155
  objectUtil.mergeShapes = (first, second) => {
68104
68156
  return {
68105
68157
  ...first,
68106
- ...second, // second overwrites first
68158
+ ...second,
68107
68159
  };
68108
68160
  };
68109
68161
  })(objectUtil || (objectUtil = {}));
@@ -68318,7 +68370,9 @@ class ZodObject extends ZodType {
68318
68370
  pick(mask) {
68319
68371
  const shape = {};
68320
68372
  util$2.objectKeys(mask).map((key) => {
68321
- shape[key] = this.shape[key];
68373
+ // only add to shape if key corresponds to an element of the current shape
68374
+ if (this.shape[key])
68375
+ shape[key] = this.shape[key];
68322
68376
  });
68323
68377
  return new ZodObject({
68324
68378
  ...this._def,
@@ -69107,10 +69161,11 @@ ZodLiteral.create = (value, params) => {
69107
69161
  ...processCreateParams(params),
69108
69162
  });
69109
69163
  };
69110
- function createZodEnum(values) {
69164
+ function createZodEnum(values, params) {
69111
69165
  return new ZodEnum({
69112
69166
  values: values,
69113
69167
  typeName: ZodFirstPartyTypeKind.ZodEnum,
69168
+ ...processCreateParams(params),
69114
69169
  });
69115
69170
  }
69116
69171
  class ZodEnum extends ZodType {
@@ -69446,9 +69501,15 @@ ZodNaN.create = (params) => {
69446
69501
  ...processCreateParams(params),
69447
69502
  });
69448
69503
  };
69449
- const custom = (check, params) => {
69504
+ const custom = (check, params = {}, fatal) => {
69450
69505
  if (check)
69451
- return ZodAny.create().refine(check, params);
69506
+ return ZodAny.create().superRefine((data, ctx) => {
69507
+ if (!check(data)) {
69508
+ const p = typeof params === "function" ? params(data) : params;
69509
+ const p2 = typeof p === "string" ? { message: p } : p;
69510
+ ctx.addIssue({ code: "custom", ...p2, fatal });
69511
+ }
69512
+ });
69452
69513
  return ZodAny.create();
69453
69514
  };
69454
69515
  const late = {
@@ -69490,7 +69551,7 @@ var ZodFirstPartyTypeKind;
69490
69551
  })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
69491
69552
  const instanceOfType = (cls, params = {
69492
69553
  message: `Input not instance of ${cls.name}`,
69493
- }) => custom((data) => data instanceof cls, params);
69554
+ }) => custom((data) => data instanceof cls, params, true);
69494
69555
  const stringType = ZodString.create;
69495
69556
  const numberType = ZodNumber.create;
69496
69557
  const nanType = ZodNaN.create;
@@ -69529,8 +69590,8 @@ const oboolean = () => booleanType().optional();
69529
69590
 
69530
69591
  var mod = /*#__PURE__*/Object.freeze({
69531
69592
  __proto__: null,
69532
- ZodParsedType: ZodParsedType,
69533
69593
  getParsedType: getParsedType,
69594
+ ZodParsedType: ZodParsedType,
69534
69595
  makeIssue: makeIssue,
69535
69596
  EMPTY_PATH: EMPTY_PATH,
69536
69597
  addIssueToContext: addIssueToContext,
@@ -75713,26 +75774,6 @@ var yaml = /*#__PURE__*/Object.freeze({
75713
75774
  encode: encode
75714
75775
  });
75715
75776
 
75716
- const schema = {
75717
- appInfo: {
75718
- type: "array",
75719
- items: {
75720
- type: "object",
75721
- properties: {
75722
- appId: {
75723
- type: "string"
75724
- },
75725
- orgId: {
75726
- type: "string"
75727
- },
75728
- storeFqdn: {
75729
- type: "string"
75730
- }
75731
- }
75732
- }
75733
- }
75734
- };
75735
-
75736
75777
  var source = {exports: {}};
75737
75778
 
75738
75779
  var isObj$1 = value => {
@@ -84753,31 +84794,54 @@ module.exports.default = Conf;
84753
84794
  var Conf = /*@__PURE__*/getDefaultExportFromCjs(source.exports);
84754
84795
 
84755
84796
  const migrations = {};
84797
+ const schema = {
84798
+ appInfo: {
84799
+ type: "array",
84800
+ items: {
84801
+ type: "object",
84802
+ properties: {
84803
+ appId: {
84804
+ type: "string"
84805
+ },
84806
+ orgId: {
84807
+ type: "string"
84808
+ },
84809
+ storeFqdn: {
84810
+ type: "string"
84811
+ }
84812
+ }
84813
+ }
84814
+ }
84815
+ };
84756
84816
  const cliKit = new Conf({
84757
84817
  schema,
84758
84818
  migrations,
84759
84819
  projectName: "shopify-cli-kit",
84760
84820
  projectVersion: cliKitPackageJson.version
84761
84821
  });
84762
- function getAppInfo(appId) {
84822
+ function getAppInfo(directory) {
84763
84823
  const apps = cliKit.get("appInfo") ?? [];
84764
- return apps.find((app) => app.appId === appId);
84824
+ return apps.find((app) => app.directory === directory);
84765
84825
  }
84766
- function setAppInfo(appId, data) {
84826
+ function setAppInfo(options) {
84767
84827
  const apps = cliKit.get("appInfo") ?? [];
84768
- const index = apps.findIndex((saved) => saved.appId === appId);
84828
+ const index = apps.findIndex((saved) => saved.directory === options.directory);
84769
84829
  if (index === -1) {
84770
- apps.push({ appId, storeFqdn: data.storeFqdn, orgId: data.orgId });
84771
- completed("Updated your project name to match your Shopify app name");
84830
+ apps.push(options);
84772
84831
  } else {
84773
84832
  const app = apps[index];
84774
- apps[index] = { appId, storeFqdn: data.storeFqdn ?? app.storeFqdn, orgId: data.orgId ?? app.orgId };
84833
+ apps[index] = {
84834
+ appId: options.appId,
84835
+ directory: options.directory,
84836
+ storeFqdn: options.storeFqdn ?? app.storeFqdn,
84837
+ orgId: options.orgId ?? app.orgId
84838
+ };
84775
84839
  }
84776
84840
  cliKit.set("appInfo", apps);
84777
84841
  }
84778
- function clearAppInfo(appId) {
84842
+ function clearAppInfo(directory) {
84779
84843
  const apps = cliKit.get("appInfo") ?? [];
84780
- const index = apps.findIndex((saved) => saved.appId === appId);
84844
+ const index = apps.findIndex((saved) => saved.directory === directory);
84781
84845
  if (index !== -1) {
84782
84846
  apps.splice(index, 1);
84783
84847
  }
@@ -84813,6 +84877,18 @@ async function buildHeaders(token) {
84813
84877
  };
84814
84878
  return headers;
84815
84879
  }
84880
+ function sanitizedHeadersOutput(headers) {
84881
+ const sanitized = {};
84882
+ const keywords = ["token", "authorization"];
84883
+ Object.keys(headers).forEach((header) => {
84884
+ if (keywords.find((keyword) => header.toLocaleLowerCase().includes(keyword)) === void 0) {
84885
+ sanitized[header] = headers[header];
84886
+ }
84887
+ });
84888
+ return Object.keys(sanitized).map((header) => {
84889
+ return ` - ${header}: ${sanitized[header]}`;
84890
+ }).join("\n");
84891
+ }
84816
84892
 
84817
84893
  var dist$1 = {};
84818
84894
 
@@ -171843,17 +171919,28 @@ function HeadersInstanceToPlainObject(headers) {
171843
171919
 
171844
171920
  }(dist$1));
171845
171921
 
171922
+ const UnauthorizedAccessError = () => {
171923
+ return new Bug(`You can't use Shopify CLI with development stores if you only have Partner staff member access.
171924
+ If you want to use Shopify CLI to work on a development store, then you should be the store owner or create a staff account on the store`, `If you're the store owner, then you need to log in to the store directly using the store URL at least once (for example, using %s.myshopify.com/admin) before you log in using Shopify CLI.
171925
+ Logging in to the Shopify admin directly connects the development store with your Shopify login.`);
171926
+ };
171927
+ const UnknownError = () => {
171928
+ return new Bug(`Unknown error connecting to your store`);
171929
+ };
171846
171930
  async function request$1(query, session, variables) {
171847
- debug$5(`
171848
- Sending Admin GraphQL request:
171849
- ${query}
171850
-
171851
- With variables:
171852
- ${variables ? JSON.stringify(variables, null, 2) : ""}
171853
- `);
171854
171931
  const version = await fetchApiVersion(session);
171855
171932
  const url = adminUrl(session.storeFqdn, version);
171856
171933
  const headers = await buildHeaders(session.token);
171934
+ debug$5(`
171935
+ Sending Admin GraphQL request:
171936
+ ${query}
171937
+
171938
+ With variables:
171939
+ ${variables ? JSON.stringify(variables, null, 2) : ""}
171940
+
171941
+ And headers:
171942
+ ${sanitizedHeadersOutput(headers)}
171943
+ `);
171857
171944
  return dist$1.request(url, query, variables, headers);
171858
171945
  }
171859
171946
  async function fetchApiVersion(session) {
@@ -171864,7 +171951,9 @@ async function fetchApiVersion(session) {
171864
171951
  Sending Admin GraphQL request to URL ${url} with query:
171865
171952
  ${query}
171866
171953
  `);
171867
- const data = await dist$1.request(url, query, {}, headers);
171954
+ const data = await dist$1.request(url, query, {}, headers).catch((err) => {
171955
+ throw err.response.status === 403 ? UnauthorizedAccessError() : UnknownError();
171956
+ });
171868
171957
  return data.publicApiVersions.filter((item) => item.supported).map((item) => item.handle).sort().reverse()[0];
171869
171958
  }
171870
171959
  function adminUrl(store, version) {
@@ -171897,6 +171986,9 @@ ${query}
171897
171986
 
171898
171987
  With variables:
171899
171988
  ${variables ? JSON.stringify(variables, null, 2) : ""}
171989
+
171990
+ And headers:
171991
+ ${sanitizedHeadersOutput(headers)}
171900
171992
  `);
171901
171993
  return dist$1.request(url, query, variables, headers);
171902
171994
  }
@@ -172096,6 +172188,25 @@ const ExtensionCreateQuery = dist$1.gql`
172096
172188
  }
172097
172189
  `;
172098
172190
 
172191
+ const FindProductVariantQuery = dist$1.gql`
172192
+ query {
172193
+ products(first: 1) {
172194
+ edges {
172195
+ node {
172196
+ id
172197
+ variants(first: 1) {
172198
+ edges {
172199
+ node {
172200
+ id
172201
+ }
172202
+ }
172203
+ }
172204
+ }
172205
+ }
172206
+ }
172207
+ }
172208
+ `;
172209
+
172099
172210
  var index = /*#__PURE__*/Object.freeze({
172100
172211
  __proto__: null,
172101
172212
  FindOrganizationQuery: FindOrganizationQuery,
@@ -172108,7 +172219,8 @@ var index = /*#__PURE__*/Object.freeze({
172108
172219
  CreateDeployment: CreateDeployment,
172109
172220
  AllStoresByOrganizationQuery: AllStoresByOrganizationQuery,
172110
172221
  ConvertDevToTestStoreQuery: ConvertDevToTestStoreQuery,
172111
- ExtensionCreateQuery: ExtensionCreateQuery
172222
+ ExtensionCreateQuery: ExtensionCreateQuery,
172223
+ FindProductVariantQuery: FindProductVariantQuery
172112
172224
  });
172113
172225
 
172114
172226
  var api = /*#__PURE__*/Object.freeze({
@@ -172683,10 +172795,20 @@ var cli = /*#__PURE__*/Object.freeze({
172683
172795
  const generateRandomUUID = () => {
172684
172796
  return randomUUID();
172685
172797
  };
172798
+ const generateShortId = () => {
172799
+ let result = "";
172800
+ const characters = "abcdefghijklmnopqrstuvwxyz0123456789";
172801
+ const charactersLength = characters.length;
172802
+ for (let i = 0; i < 7; i++) {
172803
+ result += characters.charAt(Math.floor(Math.random() * charactersLength));
172804
+ }
172805
+ return result;
172806
+ };
172686
172807
 
172687
172808
  var id = /*#__PURE__*/Object.freeze({
172688
172809
  __proto__: null,
172689
- generateRandomUUID: generateRandomUUID
172810
+ generateRandomUUID: generateRandomUUID,
172811
+ generateShortId: generateShortId
172690
172812
  });
172691
172813
 
172692
172814
  async function directory(callback) {
@@ -172738,4 +172860,4 @@ var plugins = /*#__PURE__*/Object.freeze({
172738
172860
  });
172739
172861
 
172740
172862
  export { npm as A, port as B, cli as C, id as D, temporary as E, FormData$3 as F, dotEnv as G, constants$2 as H, plugins as I, File$1 as a, string as b, github as c, dependency as d, error$j as e, file$1 as f, git as g, os$2 as h, environment as i, session as j, schema$2 as k, toml as l, store as m, api as n, output as o, path$w as p, http$2 as q, archiver as r, system as s, template as t, ui as u, version as v, checksum as w, ruby as x, yaml as y, semver as z };
172741
- //# sourceMappingURL=index-9ce018b5.js.map
172863
+ //# sourceMappingURL=index-cf216492.js.map