@shopify/cli-kit 2.0.10 → 3.0.0

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.10";
12320
+ var version$4 = "3.0.0";
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.10";
12435
+ var version$3 = "3.0.0";
12436
12436
 
12437
- var version$2 = "2.0.10";
12437
+ var version$2 = "3.0.0";
12438
12438
 
12439
- var version$1 = "2.0.10";
12439
+ var version$1 = "3.0.0";
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) => {
@@ -21116,22 +21123,45 @@ const token = {
21116
21123
  subheading: (value) => {
21117
21124
  return new ContentToken(value, {}, 4 /* SubHeading */);
21118
21125
  },
21126
+ italic: (value) => {
21127
+ return new ContentToken(value, {}, 5 /* Italic */);
21128
+ },
21119
21129
  errorText: (value) => {
21120
- return new ContentToken(value, {}, 5 /* ErrorText */);
21130
+ return new ContentToken(value, {}, 6 /* ErrorText */);
21121
21131
  },
21122
21132
  cyan: (value) => {
21123
- return new ContentToken(value, {}, 7 /* Cyan */);
21133
+ return new ContentToken(value, {}, 8 /* Cyan */);
21124
21134
  },
21125
21135
  yellow: (value) => {
21126
- return new ContentToken(value, {}, 6 /* Yellow */);
21136
+ return new ContentToken(value, {}, 7 /* Yellow */);
21127
21137
  },
21128
21138
  magenta: (value) => {
21129
- return new ContentToken(value, {}, 8 /* Magenta */);
21139
+ return new ContentToken(value, {}, 9 /* Magenta */);
21130
21140
  },
21131
21141
  green: (value) => {
21132
- return new ContentToken(value, {}, 9 /* Green */);
21142
+ return new ContentToken(value, {}, 10 /* Green */);
21143
+ },
21144
+ command: (dependencyManager, scriptName, ...scriptArgs) => {
21145
+ return new ContentToken(formatPackageManagerCommand(dependencyManager, scriptName, scriptArgs), {}, 0 /* Command */);
21133
21146
  }
21134
21147
  };
21148
+ function formatPackageManagerCommand(dependencyManager, scriptName, scriptArgs) {
21149
+ switch (dependencyManager) {
21150
+ case "yarn": {
21151
+ const pieces = ["yarn", scriptName, ...scriptArgs];
21152
+ return pieces.join(" ");
21153
+ }
21154
+ case "pnpm":
21155
+ case "npm": {
21156
+ const pieces = [dependencyManager, "run", scriptName];
21157
+ if (scriptArgs.length > 0) {
21158
+ pieces.push("--");
21159
+ pieces.push(...scriptArgs);
21160
+ }
21161
+ return pieces.join(" ");
21162
+ }
21163
+ }
21164
+ }
21135
21165
  class TokenizedString {
21136
21166
  constructor(value) {
21137
21167
  this.value = value;
@@ -21165,19 +21195,22 @@ function content(strings, ...keys) {
21165
21195
  case 4 /* SubHeading */:
21166
21196
  output += colors$9.underline(enumToken.value);
21167
21197
  break;
21168
- case 5 /* ErrorText */:
21198
+ case 5 /* Italic */:
21199
+ output += colors$9.italic(enumToken.value);
21200
+ break;
21201
+ case 6 /* ErrorText */:
21169
21202
  output += colors$9.bold.redBright(enumToken.value);
21170
21203
  break;
21171
- case 6 /* Yellow */:
21204
+ case 7 /* Yellow */:
21172
21205
  output += colors$9.yellow(enumToken.value);
21173
21206
  break;
21174
- case 7 /* Cyan */:
21207
+ case 8 /* Cyan */:
21175
21208
  output += colors$9.cyan(enumToken.value);
21176
21209
  break;
21177
- case 8 /* Magenta */:
21210
+ case 9 /* Magenta */:
21178
21211
  output += colors$9.magenta(enumToken.value);
21179
21212
  break;
21180
- case 9 /* Green */:
21213
+ case 10 /* Green */:
21181
21214
  output += colors$9.green(enumToken.value);
21182
21215
  break;
21183
21216
  }
@@ -21401,7 +21434,13 @@ class AbortSilent extends Fatal {
21401
21434
  class Bug extends Fatal {
21402
21435
  }
21403
21436
  async function handler(error) {
21404
- const fatal = error instanceof Fatal ? error : new Abort(error.message);
21437
+ let fatal;
21438
+ if (error instanceof Fatal) {
21439
+ fatal = error;
21440
+ } else {
21441
+ fatal = new Bug(error.message);
21442
+ fatal.stack = error.stack;
21443
+ }
21405
21444
  await error$k(fatal);
21406
21445
  return Promise.resolve(error);
21407
21446
  }
@@ -21422,7 +21461,8 @@ var error$j = /*#__PURE__*/Object.freeze({
21422
21461
  AbortSilent: AbortSilent,
21423
21462
  Bug: Bug,
21424
21463
  handler: handler,
21425
- mapper: mapper$1
21464
+ mapper: mapper$1,
21465
+ AbortSignal: AbortSignal
21426
21466
  });
21427
21467
 
21428
21468
  /******************************************************************************
@@ -26300,14 +26340,14 @@ const prompt = async (questions) => {
26300
26340
  async function nonEmptyDirectoryPrompt(directory) {
26301
26341
  if (await exists$1(directory)) {
26302
26342
  const options = [
26303
- { name: "Yes, remove the files", value: "overwrite" },
26304
- { name: "No, abort the command", value: "abort" }
26343
+ { name: "No, don\u2019t delete the files", value: "abort" },
26344
+ { name: "Yes, delete the files", value: "overwrite" }
26305
26345
  ];
26306
26346
  const relativeDirectory = relative(process.cwd(), directory);
26307
26347
  const questions = {
26308
26348
  type: "select",
26309
26349
  name: "value",
26310
- message: `${relativeDirectory} is not an empty directory. Do you want to remove the existing files and continue?`,
26350
+ message: `${relativeDirectory} is not an empty directory. Do you want to delete the existing files and continue?`,
26311
26351
  choices: options
26312
26352
  };
26313
26353
  const choice = await prompt([questions]);
@@ -40631,7 +40671,7 @@ class Body$1 {
40631
40671
  return formData;
40632
40672
  }
40633
40673
 
40634
- const {toFormData} = await import('./multipart-parser-d7cd777b.js');
40674
+ const {toFormData} = await import('./multipart-parser-e253e1bc.js');
40635
40675
  return toFormData(this.body, ct);
40636
40676
  }
40637
40677
 
@@ -54550,7 +54590,8 @@ function parseRepoUrl(src) {
54550
54590
  const subDirectory = match[6]?.slice(1);
54551
54591
  const ref = match[7] || "HEAD";
54552
54592
  const ssh = `git@${normalizedSite}:${user}/${name}`;
54553
- return { site: normalizedSite, user, name, ref, subDirectory, ssh };
54593
+ const http = `https://${normalizedSite}/${user}/${name}`;
54594
+ return { site: normalizedSite, user, name, ref, subDirectory, ssh, http };
54554
54595
  }
54555
54596
 
54556
54597
  var github = /*#__PURE__*/Object.freeze({
@@ -66785,6 +66826,70 @@ var util$2;
66785
66826
  }
66786
66827
  util.joinValues = joinValues;
66787
66828
  })(util$2 || (util$2 = {}));
66829
+ const ZodParsedType = util$2.arrayToEnum([
66830
+ "string",
66831
+ "nan",
66832
+ "number",
66833
+ "integer",
66834
+ "float",
66835
+ "boolean",
66836
+ "date",
66837
+ "bigint",
66838
+ "symbol",
66839
+ "function",
66840
+ "undefined",
66841
+ "null",
66842
+ "array",
66843
+ "object",
66844
+ "unknown",
66845
+ "promise",
66846
+ "void",
66847
+ "never",
66848
+ "map",
66849
+ "set",
66850
+ ]);
66851
+ const getParsedType = (data) => {
66852
+ const t = typeof data;
66853
+ switch (t) {
66854
+ case "undefined":
66855
+ return ZodParsedType.undefined;
66856
+ case "string":
66857
+ return ZodParsedType.string;
66858
+ case "number":
66859
+ return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
66860
+ case "boolean":
66861
+ return ZodParsedType.boolean;
66862
+ case "function":
66863
+ return ZodParsedType.function;
66864
+ case "bigint":
66865
+ return ZodParsedType.bigint;
66866
+ case "object":
66867
+ if (Array.isArray(data)) {
66868
+ return ZodParsedType.array;
66869
+ }
66870
+ if (data === null) {
66871
+ return ZodParsedType.null;
66872
+ }
66873
+ if (data.then &&
66874
+ typeof data.then === "function" &&
66875
+ data.catch &&
66876
+ typeof data.catch === "function") {
66877
+ return ZodParsedType.promise;
66878
+ }
66879
+ if (typeof Map !== "undefined" && data instanceof Map) {
66880
+ return ZodParsedType.map;
66881
+ }
66882
+ if (typeof Set !== "undefined" && data instanceof Set) {
66883
+ return ZodParsedType.set;
66884
+ }
66885
+ if (typeof Date !== "undefined" && data instanceof Date) {
66886
+ return ZodParsedType.date;
66887
+ }
66888
+ return ZodParsedType.object;
66889
+ default:
66890
+ return ZodParsedType.unknown;
66891
+ }
66892
+ };
66788
66893
 
66789
66894
  const ZodIssueCode = util$2.arrayToEnum([
66790
66895
  "invalid_type",
@@ -66992,70 +67097,6 @@ const setErrorMap = (map) => {
66992
67097
  overrideErrorMap = map;
66993
67098
  };
66994
67099
 
66995
- const ZodParsedType = util$2.arrayToEnum([
66996
- "string",
66997
- "nan",
66998
- "number",
66999
- "integer",
67000
- "float",
67001
- "boolean",
67002
- "date",
67003
- "bigint",
67004
- "symbol",
67005
- "function",
67006
- "undefined",
67007
- "null",
67008
- "array",
67009
- "object",
67010
- "unknown",
67011
- "promise",
67012
- "void",
67013
- "never",
67014
- "map",
67015
- "set",
67016
- ]);
67017
- const getParsedType = (data) => {
67018
- const t = typeof data;
67019
- switch (t) {
67020
- case "undefined":
67021
- return ZodParsedType.undefined;
67022
- case "string":
67023
- return ZodParsedType.string;
67024
- case "number":
67025
- return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
67026
- case "boolean":
67027
- return ZodParsedType.boolean;
67028
- case "function":
67029
- return ZodParsedType.function;
67030
- case "bigint":
67031
- return ZodParsedType.bigint;
67032
- case "object":
67033
- if (Array.isArray(data)) {
67034
- return ZodParsedType.array;
67035
- }
67036
- if (data === null) {
67037
- return ZodParsedType.null;
67038
- }
67039
- if (data.then &&
67040
- typeof data.then === "function" &&
67041
- data.catch &&
67042
- typeof data.catch === "function") {
67043
- return ZodParsedType.promise;
67044
- }
67045
- if (typeof Map !== "undefined" && data instanceof Map) {
67046
- return ZodParsedType.map;
67047
- }
67048
- if (typeof Set !== "undefined" && data instanceof Set) {
67049
- return ZodParsedType.set;
67050
- }
67051
- if (typeof Date !== "undefined" && data instanceof Date) {
67052
- return ZodParsedType.date;
67053
- }
67054
- return ZodParsedType.object;
67055
- default:
67056
- return ZodParsedType.unknown;
67057
- }
67058
- };
67059
67100
  const makeIssue = (params) => {
67060
67101
  const { data, path, errorMaps, issueData } = params;
67061
67102
  const fullPath = [...path, ...(issueData.path || [])];
@@ -67087,7 +67128,7 @@ function addIssueToContext(ctx, issueData) {
67087
67128
  ctx.common.contextualErrorMap,
67088
67129
  ctx.schemaErrorMap,
67089
67130
  overrideErrorMap,
67090
- defaultErrorMap, // then global default map
67131
+ defaultErrorMap,
67091
67132
  ].filter((x) => !!x),
67092
67133
  });
67093
67134
  ctx.common.issues.push(issue);
@@ -67442,10 +67483,14 @@ class ZodString extends ZodType {
67442
67483
  ...errorUtil.errToObj(message),
67443
67484
  });
67444
67485
  /**
67445
- * Deprecated.
67446
- * Use z.string().min(1) instead.
67486
+ * @deprecated Use z.string().min(1) instead.
67487
+ * @see {@link ZodString.min}
67447
67488
  */
67448
67489
  this.nonempty = (message) => this.min(1, errorUtil.errToObj(message));
67490
+ this.trim = () => new ZodString({
67491
+ ...this._def,
67492
+ checks: [...this._def.checks, { kind: "trim" }],
67493
+ });
67449
67494
  }
67450
67495
  _parse(input) {
67451
67496
  const parsedType = this._getType(input);
@@ -67549,6 +67594,12 @@ class ZodString extends ZodType {
67549
67594
  status.dirty();
67550
67595
  }
67551
67596
  }
67597
+ else if (check.kind === "trim") {
67598
+ input.data = input.data.trim();
67599
+ }
67600
+ else {
67601
+ util$2.assertNever(check);
67602
+ }
67552
67603
  }
67553
67604
  return { status: status.value, value: input.data };
67554
67605
  }
@@ -68111,7 +68162,7 @@ var objectUtil;
68111
68162
  objectUtil.mergeShapes = (first, second) => {
68112
68163
  return {
68113
68164
  ...first,
68114
- ...second, // second overwrites first
68165
+ ...second,
68115
68166
  };
68116
68167
  };
68117
68168
  })(objectUtil || (objectUtil = {}));
@@ -68326,7 +68377,9 @@ class ZodObject extends ZodType {
68326
68377
  pick(mask) {
68327
68378
  const shape = {};
68328
68379
  util$2.objectKeys(mask).map((key) => {
68329
- shape[key] = this.shape[key];
68380
+ // only add to shape if key corresponds to an element of the current shape
68381
+ if (this.shape[key])
68382
+ shape[key] = this.shape[key];
68330
68383
  });
68331
68384
  return new ZodObject({
68332
68385
  ...this._def,
@@ -69115,10 +69168,11 @@ ZodLiteral.create = (value, params) => {
69115
69168
  ...processCreateParams(params),
69116
69169
  });
69117
69170
  };
69118
- function createZodEnum(values) {
69171
+ function createZodEnum(values, params) {
69119
69172
  return new ZodEnum({
69120
69173
  values: values,
69121
69174
  typeName: ZodFirstPartyTypeKind.ZodEnum,
69175
+ ...processCreateParams(params),
69122
69176
  });
69123
69177
  }
69124
69178
  class ZodEnum extends ZodType {
@@ -69454,9 +69508,15 @@ ZodNaN.create = (params) => {
69454
69508
  ...processCreateParams(params),
69455
69509
  });
69456
69510
  };
69457
- const custom = (check, params) => {
69511
+ const custom = (check, params = {}, fatal) => {
69458
69512
  if (check)
69459
- return ZodAny.create().refine(check, params);
69513
+ return ZodAny.create().superRefine((data, ctx) => {
69514
+ if (!check(data)) {
69515
+ const p = typeof params === "function" ? params(data) : params;
69516
+ const p2 = typeof p === "string" ? { message: p } : p;
69517
+ ctx.addIssue({ code: "custom", ...p2, fatal });
69518
+ }
69519
+ });
69460
69520
  return ZodAny.create();
69461
69521
  };
69462
69522
  const late = {
@@ -69498,7 +69558,7 @@ var ZodFirstPartyTypeKind;
69498
69558
  })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
69499
69559
  const instanceOfType = (cls, params = {
69500
69560
  message: `Input not instance of ${cls.name}`,
69501
- }) => custom((data) => data instanceof cls, params);
69561
+ }) => custom((data) => data instanceof cls, params, true);
69502
69562
  const stringType = ZodString.create;
69503
69563
  const numberType = ZodNumber.create;
69504
69564
  const nanType = ZodNaN.create;
@@ -69537,8 +69597,8 @@ const oboolean = () => booleanType().optional();
69537
69597
 
69538
69598
  var mod = /*#__PURE__*/Object.freeze({
69539
69599
  __proto__: null,
69540
- ZodParsedType: ZodParsedType,
69541
69600
  getParsedType: getParsedType,
69601
+ ZodParsedType: ZodParsedType,
69542
69602
  makeIssue: makeIssue,
69543
69603
  EMPTY_PATH: EMPTY_PATH,
69544
69604
  addIssueToContext: addIssueToContext,
@@ -75721,26 +75781,6 @@ var yaml = /*#__PURE__*/Object.freeze({
75721
75781
  encode: encode
75722
75782
  });
75723
75783
 
75724
- const schema = {
75725
- appInfo: {
75726
- type: "array",
75727
- items: {
75728
- type: "object",
75729
- properties: {
75730
- appId: {
75731
- type: "string"
75732
- },
75733
- orgId: {
75734
- type: "string"
75735
- },
75736
- storeFqdn: {
75737
- type: "string"
75738
- }
75739
- }
75740
- }
75741
- }
75742
- };
75743
-
75744
75784
  var source = {exports: {}};
75745
75785
 
75746
75786
  var isObj$1 = value => {
@@ -84761,31 +84801,55 @@ module.exports.default = Conf;
84761
84801
  var Conf = /*@__PURE__*/getDefaultExportFromCjs(source.exports);
84762
84802
 
84763
84803
  const migrations = {};
84804
+ const schema = {
84805
+ appInfo: {
84806
+ type: "array",
84807
+ items: {
84808
+ type: "object",
84809
+ properties: {
84810
+ appId: {
84811
+ type: "string"
84812
+ },
84813
+ orgId: {
84814
+ type: "string"
84815
+ },
84816
+ storeFqdn: {
84817
+ type: "string"
84818
+ }
84819
+ }
84820
+ }
84821
+ }
84822
+ };
84764
84823
  const cliKit = new Conf({
84765
84824
  schema,
84766
84825
  migrations,
84767
84826
  projectName: "shopify-cli-kit",
84768
84827
  projectVersion: cliKitPackageJson.version
84769
84828
  });
84770
- function getAppInfo(appId) {
84829
+ function getAppInfo(directory) {
84771
84830
  const apps = cliKit.get("appInfo") ?? [];
84772
- return apps.find((app) => app.appId === appId);
84831
+ return apps.find((app) => app.directory === directory);
84773
84832
  }
84774
- function setAppInfo(appId, data) {
84833
+ function setAppInfo(options) {
84775
84834
  const apps = cliKit.get("appInfo") ?? [];
84776
- const index = apps.findIndex((saved) => saved.appId === appId);
84835
+ const index = apps.findIndex((saved) => saved.directory === options.directory);
84777
84836
  if (index === -1) {
84778
- apps.push({ appId, storeFqdn: data.storeFqdn, orgId: data.orgId });
84779
- completed("Updated your project name to match your Shopify app name");
84837
+ apps.push(options);
84780
84838
  } else {
84781
84839
  const app = apps[index];
84782
- apps[index] = { appId, storeFqdn: data.storeFqdn ?? app.storeFqdn, orgId: data.orgId ?? app.orgId };
84840
+ apps[index] = {
84841
+ appId: options.appId,
84842
+ directory: options.directory,
84843
+ title: options.title ?? app.title,
84844
+ storeFqdn: options.storeFqdn ?? app.storeFqdn,
84845
+ orgId: options.orgId ?? app.orgId
84846
+ };
84783
84847
  }
84784
84848
  cliKit.set("appInfo", apps);
84785
84849
  }
84786
- function clearAppInfo(appId) {
84850
+ function clearAppInfo(directory) {
84787
84851
  const apps = cliKit.get("appInfo") ?? [];
84788
- const index = apps.findIndex((saved) => saved.appId === appId);
84852
+ const index = apps.findIndex((saved) => saved.directory === directory);
84789
84853
  if (index !== -1) {
84790
84854
  apps.splice(index, 1);
84791
84855
  }
@@ -84821,6 +84885,18 @@ async function buildHeaders(token) {
84821
84885
  };
84822
84886
  return headers;
84823
84887
  }
84888
+ function sanitizedHeadersOutput(headers) {
84889
+ const sanitized = {};
84890
+ const keywords = ["token", "authorization"];
84891
+ Object.keys(headers).forEach((header) => {
84892
+ if (keywords.find((keyword) => header.toLocaleLowerCase().includes(keyword)) === void 0) {
84893
+ sanitized[header] = headers[header];
84894
+ }
84895
+ });
84896
+ return Object.keys(sanitized).map((header) => {
84897
+ return ` - ${header}: ${sanitized[header]}`;
84898
+ }).join("\n");
84899
+ }
84824
84900
 
84825
84901
  var dist$1 = {};
84826
84902
 
@@ -171851,17 +171927,28 @@ function HeadersInstanceToPlainObject(headers) {
171851
171927
 
171852
171928
  }(dist$1));
171853
171929
 
171930
+ const UnauthorizedAccessError = () => {
171931
+ return new Bug(`You can't use Shopify CLI with development stores if you only have Partner staff member access.
171932
+ 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.
171933
+ Logging in to the Shopify admin directly connects the development store with your Shopify login.`);
171934
+ };
171935
+ const UnknownError = () => {
171936
+ return new Bug(`Unknown error connecting to your store`);
171937
+ };
171854
171938
  async function request$1(query, session, variables) {
171855
- debug$5(`
171856
- Sending Admin GraphQL request:
171857
- ${query}
171858
-
171859
- With variables:
171860
- ${variables ? JSON.stringify(variables, null, 2) : ""}
171861
- `);
171862
171939
  const version = await fetchApiVersion(session);
171863
171940
  const url = adminUrl(session.storeFqdn, version);
171864
171941
  const headers = await buildHeaders(session.token);
171942
+ debug$5(`
171943
+ Sending Admin GraphQL request:
171944
+ ${query}
171945
+
171946
+ With variables:
171947
+ ${variables ? JSON.stringify(variables, null, 2) : ""}
171948
+
171949
+ And headers:
171950
+ ${sanitizedHeadersOutput(headers)}
171951
+ `);
171865
171952
  return dist$1.request(url, query, variables, headers);
171866
171953
  }
171867
171954
  async function fetchApiVersion(session) {
@@ -171872,7 +171959,9 @@ async function fetchApiVersion(session) {
171872
171959
  Sending Admin GraphQL request to URL ${url} with query:
171873
171960
  ${query}
171874
171961
  `);
171875
- const data = await dist$1.request(url, query, {}, headers);
171962
+ const data = await dist$1.request(url, query, {}, headers).catch((err) => {
171963
+ throw err.response.status === 403 ? UnauthorizedAccessError() : UnknownError();
171964
+ });
171876
171965
  return data.publicApiVersions.filter((item) => item.supported).map((item) => item.handle).sort().reverse()[0];
171877
171966
  }
171878
171967
  function adminUrl(store, version) {
@@ -171905,6 +171994,9 @@ ${query}
171905
171994
 
171906
171995
  With variables:
171907
171996
  ${variables ? JSON.stringify(variables, null, 2) : ""}
171997
+
171998
+ And headers:
171999
+ ${sanitizedHeadersOutput(headers)}
171908
172000
  `);
171909
172001
  return dist$1.request(url, query, variables, headers);
171910
172002
  }
@@ -172104,6 +172196,55 @@ const ExtensionCreateQuery = dist$1.gql`
172104
172196
  }
172105
172197
  `;
172106
172198
 
172199
+ const ExtensionSpecificationsQuery = dist$1.gql`
172200
+ query fetchSpecifications($api_key: String!) {
172201
+ extensionSpecifications(apiKey: $api_key) {
172202
+ name
172203
+ identifier
172204
+ options {
172205
+ managementExperience
172206
+ }
172207
+ features {
172208
+ argo {
172209
+ surface
172210
+ }
172211
+ }
172212
+ }
172213
+ }
172214
+ `;
172215
+
172216
+ const AllAppExtensionRegistrationsQuery = dist$1.gql`
172217
+ query allAppExtensionRegistrations($apiKey: String!) {
172218
+ app(apiKey: $apiKey) {
172219
+ extensionRegistrations {
172220
+ id
172221
+ uuid
172222
+ title
172223
+ type
172224
+ }
172225
+ }
172226
+ }
172227
+ `;
172228
+
172229
+ const FindProductVariantQuery = dist$1.gql`
172230
+ query {
172231
+ products(first: 1) {
172232
+ edges {
172233
+ node {
172234
+ id
172235
+ variants(first: 1) {
172236
+ edges {
172237
+ node {
172238
+ id
172239
+ }
172240
+ }
172241
+ }
172242
+ }
172243
+ }
172244
+ }
172245
+ }
172246
+ `;
172247
+
172107
172248
  var index = /*#__PURE__*/Object.freeze({
172108
172249
  __proto__: null,
172109
172250
  FindOrganizationQuery: FindOrganizationQuery,
@@ -172116,7 +172257,10 @@ var index = /*#__PURE__*/Object.freeze({
172116
172257
  CreateDeployment: CreateDeployment,
172117
172258
  AllStoresByOrganizationQuery: AllStoresByOrganizationQuery,
172118
172259
  ConvertDevToTestStoreQuery: ConvertDevToTestStoreQuery,
172119
- ExtensionCreateQuery: ExtensionCreateQuery
172260
+ ExtensionCreateQuery: ExtensionCreateQuery,
172261
+ ExtensionSpecificationsQuery: ExtensionSpecificationsQuery,
172262
+ AllAppExtensionRegistrationsQuery: AllAppExtensionRegistrationsQuery,
172263
+ FindProductVariantQuery: FindProductVariantQuery
172120
172264
  });
172121
172265
 
172122
172266
  var api = /*#__PURE__*/Object.freeze({
@@ -172691,10 +172835,20 @@ var cli = /*#__PURE__*/Object.freeze({
172691
172835
  const generateRandomUUID = () => {
172692
172836
  return randomUUID();
172693
172837
  };
172838
+ const generateShortId = () => {
172839
+ let result = "";
172840
+ const characters = "abcdefghijklmnopqrstuvwxyz0123456789";
172841
+ const charactersLength = characters.length;
172842
+ for (let i = 0; i < 7; i++) {
172843
+ result += characters.charAt(Math.floor(Math.random() * charactersLength));
172844
+ }
172845
+ return result;
172846
+ };
172694
172847
 
172695
172848
  var id = /*#__PURE__*/Object.freeze({
172696
172849
  __proto__: null,
172697
- generateRandomUUID: generateRandomUUID
172850
+ generateRandomUUID: generateRandomUUID,
172851
+ generateShortId: generateShortId
172698
172852
  });
172699
172853
 
172700
172854
  async function directory(callback) {
@@ -172746,4 +172900,4 @@ var plugins = /*#__PURE__*/Object.freeze({
172746
172900
  });
172747
172901
 
172748
172902
  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 };
172749
- //# sourceMappingURL=index-8ab5821f.js.map
172903
+ //# sourceMappingURL=index-117ce1ba.js.map