@shopify/create-app 3.71.3 → 3.71.5

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.
package/dist/index.js CHANGED
@@ -8,15 +8,15 @@ import {
8
8
  errorHandler,
9
9
  registerCleanBugsnagErrorsFromWithinPlugins,
10
10
  require_end_of_stream
11
- } from "./chunk-COSXHB3B.js";
11
+ } from "./chunk-PBF4R2FY.js";
12
12
  import {
13
13
  fanoutHooks,
14
14
  getListOfTunnelPlugins,
15
15
  reportAnalyticsEvent
16
- } from "./chunk-5VVJMD3Z.js";
16
+ } from "./chunk-VPK5R6CK.js";
17
17
  import {
18
18
  getOutputUpdateCLIReminder
19
- } from "./chunk-KN3JU4UN.js";
19
+ } from "./chunk-WAC2A2NP.js";
20
20
  import {
21
21
  CLI_KIT_VERSION,
22
22
  ClientError,
@@ -61,7 +61,7 @@ import {
61
61
  setNextDeprecationDate,
62
62
  username,
63
63
  z
64
- } from "./chunk-WYLLWFET.js";
64
+ } from "./chunk-DKPXW2UF.js";
65
65
  import "./chunk-VSLR7ET4.js";
66
66
  import {
67
67
  LocalStorage,
@@ -86,7 +86,7 @@ import {
86
86
  usesWorkspaces,
87
87
  versionSatisfies,
88
88
  writePackageJSON
89
- } from "./chunk-QGDWNBQX.js";
89
+ } from "./chunk-XY5EMAOX.js";
90
90
  import {
91
91
  AbortController as AbortController2,
92
92
  AbortError,
@@ -260,7 +260,7 @@ import {
260
260
  use_stdin_default,
261
261
  writeFile,
262
262
  writeFileSync
263
- } from "./chunk-FMHMRW3B.js";
263
+ } from "./chunk-SWJYETLD.js";
264
264
  import {
265
265
  require_brace_expansion,
266
266
  require_lib
@@ -142338,7 +142338,7 @@ async function performActionWithRetryAfterRecovery(performAction, recoveryProced
142338
142338
  import stream from "node:stream/promises";
142339
142339
  import * as gzip from "node:zlib";
142340
142340
  import { fileURLToPath } from "node:url";
142341
- var FUNCTION_RUNNER_VERSION = "v6.3.0", JAVY_VERSION = "v4.0.0", JAVY_PLUGIN_VERSION = "v3.2.0", Executable = class {
142341
+ var FUNCTION_RUNNER_VERSION = "v6.4.0", JAVY_VERSION = "v4.0.0", JAVY_PLUGIN_VERSION = "v3.2.0", Executable = class {
142342
142342
  constructor(name, version, gitHubRepo) {
142343
142343
  this.name = name, this.version = version;
142344
142344
  let filename = process.platform === "win32" ? `${name}.exe` : name;
@@ -142592,8 +142592,8 @@ async function runJavy(fun, options, extra = []) {
142592
142592
  }
142593
142593
  async function installJavy(app) {
142594
142594
  if (app.allExtensions.some((ext) => ext.features.includes("function") && ext.isJavaScript)) {
142595
- let javy = javyBinary();
142596
- await downloadBinary(javy);
142595
+ let javy = javyBinary(), plugin = javyPluginBinary();
142596
+ await Promise.all([downloadBinary(javy), downloadBinary(plugin)]);
142597
142597
  }
142598
142598
  }
142599
142599
  var DefaultJavyBuilder = {
@@ -142813,7 +142813,7 @@ async function showNotificationsIfNeeded(currentSurfaces, environment = process.
142813
142813
  throw new AbortSilentError();
142814
142814
  let errorMessage2 = `Error retrieving notifications: ${error.message}`;
142815
142815
  outputDebug(errorMessage2);
142816
- let { sendErrorToBugsnag } = await import("./error-handler-ARHZ7CDV.js");
142816
+ let { sendErrorToBugsnag } = await import("./error-handler-2DRGGEE3.js");
142817
142817
  await sendErrorToBugsnag(errorMessage2, "unexpected_error");
142818
142818
  }
142819
142819
  }
@@ -147996,11 +147996,19 @@ var PartnersClient = class {
147996
147996
  async currentAccountInfo() {
147997
147997
  return this.request(CurrentAccountInfoQuery);
147998
147998
  }
147999
- async targetSchemaDefinition(input) {
148000
- return (await this.request(TargetSchemaDefinitionQuery, input)).definition;
147999
+ async targetSchemaDefinition(input, apiKey, _organizationId, _appId) {
148000
+ let transformedInput = {
148001
+ target: input.handle,
148002
+ version: input.version,
148003
+ apiKey
148004
+ };
148005
+ return (await this.request(TargetSchemaDefinitionQuery, transformedInput)).definition;
148001
148006
  }
148002
- async apiSchemaDefinition(input) {
148003
- return (await this.request(ApiSchemaDefinitionQuery, input)).definition;
148007
+ async apiSchemaDefinition(input, apiKey, _organizationId, _appId) {
148008
+ return (await this.request(ApiSchemaDefinitionQuery, {
148009
+ ...input,
148010
+ apiKey
148011
+ })).definition;
148004
148012
  }
148005
148013
  async migrateToUiExtension(input) {
148006
148014
  return this.request(MigrateToUiExtensionQuery, input);
@@ -149615,6 +149623,146 @@ var PublicApiVersions2 = {
149615
149623
  ]
149616
149624
  };
149617
149625
 
149626
+ // ../app/dist/cli/api/graphql/functions/generated/schema-definition-by-target.js
149627
+ init_cjs_shims();
149628
+ var SchemaDefinitionByTarget = {
149629
+ kind: "Document",
149630
+ definitions: [
149631
+ {
149632
+ kind: "OperationDefinition",
149633
+ operation: "query",
149634
+ name: { kind: "Name", value: "SchemaDefinitionByTarget" },
149635
+ variableDefinitions: [
149636
+ {
149637
+ kind: "VariableDefinition",
149638
+ variable: { kind: "Variable", name: { kind: "Name", value: "handle" } },
149639
+ type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }
149640
+ },
149641
+ {
149642
+ kind: "VariableDefinition",
149643
+ variable: { kind: "Variable", name: { kind: "Name", value: "version" } },
149644
+ type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }
149645
+ }
149646
+ ],
149647
+ selectionSet: {
149648
+ kind: "SelectionSet",
149649
+ selections: [
149650
+ {
149651
+ kind: "Field",
149652
+ name: { kind: "Name", value: "target" },
149653
+ arguments: [
149654
+ {
149655
+ kind: "Argument",
149656
+ name: { kind: "Name", value: "handle" },
149657
+ value: { kind: "Variable", name: { kind: "Name", value: "handle" } }
149658
+ }
149659
+ ],
149660
+ selectionSet: {
149661
+ kind: "SelectionSet",
149662
+ selections: [
149663
+ {
149664
+ kind: "Field",
149665
+ name: { kind: "Name", value: "api" },
149666
+ selectionSet: {
149667
+ kind: "SelectionSet",
149668
+ selections: [
149669
+ {
149670
+ kind: "Field",
149671
+ name: { kind: "Name", value: "schema" },
149672
+ arguments: [
149673
+ {
149674
+ kind: "Argument",
149675
+ name: { kind: "Name", value: "version" },
149676
+ value: { kind: "Variable", name: { kind: "Name", value: "version" } }
149677
+ }
149678
+ ],
149679
+ selectionSet: {
149680
+ kind: "SelectionSet",
149681
+ selections: [
149682
+ { kind: "Field", name: { kind: "Name", value: "definition" } },
149683
+ { kind: "Field", name: { kind: "Name", value: "__typename" } }
149684
+ ]
149685
+ }
149686
+ },
149687
+ { kind: "Field", name: { kind: "Name", value: "__typename" } }
149688
+ ]
149689
+ }
149690
+ },
149691
+ { kind: "Field", name: { kind: "Name", value: "__typename" } }
149692
+ ]
149693
+ }
149694
+ }
149695
+ ]
149696
+ }
149697
+ }
149698
+ ]
149699
+ };
149700
+
149701
+ // ../app/dist/cli/api/graphql/functions/generated/schema-definition-by-api-type.js
149702
+ init_cjs_shims();
149703
+ var SchemaDefinitionByApiType = {
149704
+ kind: "Document",
149705
+ definitions: [
149706
+ {
149707
+ kind: "OperationDefinition",
149708
+ operation: "query",
149709
+ name: { kind: "Name", value: "SchemaDefinitionByApiType" },
149710
+ variableDefinitions: [
149711
+ {
149712
+ kind: "VariableDefinition",
149713
+ variable: { kind: "Variable", name: { kind: "Name", value: "type" } },
149714
+ type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }
149715
+ },
149716
+ {
149717
+ kind: "VariableDefinition",
149718
+ variable: { kind: "Variable", name: { kind: "Name", value: "version" } },
149719
+ type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }
149720
+ }
149721
+ ],
149722
+ selectionSet: {
149723
+ kind: "SelectionSet",
149724
+ selections: [
149725
+ {
149726
+ kind: "Field",
149727
+ name: { kind: "Name", value: "api" },
149728
+ arguments: [
149729
+ {
149730
+ kind: "Argument",
149731
+ name: { kind: "Name", value: "type" },
149732
+ value: { kind: "Variable", name: { kind: "Name", value: "type" } }
149733
+ }
149734
+ ],
149735
+ selectionSet: {
149736
+ kind: "SelectionSet",
149737
+ selections: [
149738
+ {
149739
+ kind: "Field",
149740
+ name: { kind: "Name", value: "schema" },
149741
+ arguments: [
149742
+ {
149743
+ kind: "Argument",
149744
+ name: { kind: "Name", value: "version" },
149745
+ value: { kind: "Variable", name: { kind: "Name", value: "version" } }
149746
+ }
149747
+ ],
149748
+ selectionSet: {
149749
+ kind: "SelectionSet",
149750
+ selections: [
149751
+ { kind: "Field", name: { kind: "Name", value: "definition" } },
149752
+ { kind: "Field", name: { kind: "Name", value: "__typename" } }
149753
+ ]
149754
+ }
149755
+ },
149756
+ { kind: "Field", name: { kind: "Name", value: "__typename" } }
149757
+ ]
149758
+ }
149759
+ }
149760
+ ]
149761
+ }
149762
+ }
149763
+ ]
149764
+ };
149765
+
149618
149766
  // ../cli-kit/dist/public/node/api/app-management.js
149619
149767
  init_cjs_shims();
149620
149768
  var import_bottleneck = __toESM(require_lib3()), limiter = new import_bottleneck.default({
@@ -149722,6 +149870,29 @@ async function webhooksRequest(organizationId, query, token, variables) {
149722
149870
  }));
149723
149871
  }
149724
149872
 
149873
+ // ../cli-kit/dist/public/node/api/functions.js
149874
+ init_cjs_shims();
149875
+ var import_bottleneck4 = __toESM(require_lib3()), limiter4 = new import_bottleneck4.default({
149876
+ minTime: 150,
149877
+ maxConcurrent: 10
149878
+ });
149879
+ async function setupRequest3(orgId, token, appId) {
149880
+ let api = "Functions", url2 = `https://${await appManagementFqdn()}/functions/unstable/organizations/${orgId}/${appId}/graphql`;
149881
+ return {
149882
+ token,
149883
+ api,
149884
+ url: url2,
149885
+ responseOptions: { onResponse: handleDeprecations2 }
149886
+ };
149887
+ }
149888
+ async function functionsRequestDoc(orgId, query, token, appId, variables) {
149889
+ return await limiter4.schedule(async () => graphqlRequestDoc({
149890
+ ...await setupRequest3(orgId, token, appId),
149891
+ query,
149892
+ variables
149893
+ }));
149894
+ }
149895
+
149725
149896
  // ../app/dist/cli/utilities/developer-platform-client/app-management-client.js
149726
149897
  var TEMPLATE_JSON_URL = "https://cdn.shopify.com/static/cli/extensions/templates.json", AppManagementClient = class {
149727
149898
  constructor(session) {
@@ -150128,11 +150299,24 @@ var TEMPLATE_JSON_URL = "https://cdn.shopify.com/static/cli/extensions/templates
150128
150299
  async currentAccountInfo() {
150129
150300
  throw new BugError("Not implemented: currentAccountInfo");
150130
150301
  }
150131
- async targetSchemaDefinition(_input) {
150132
- throw new BugError("Not implemented: targetSchemaDefinition");
150302
+ async targetSchemaDefinition(input, _apiKey, organizationId, appId) {
150303
+ try {
150304
+ let appIdNumber = String(numberFromGid(appId)), token = await this.token();
150305
+ return (await functionsRequestDoc(organizationId, SchemaDefinitionByTarget, token, appIdNumber, {
150306
+ handle: input.handle,
150307
+ version: input.version
150308
+ }))?.target?.api?.schema?.definition ?? null;
150309
+ } catch (error) {
150310
+ throw new AbortError(`Failed to fetch schema definition: ${error}`);
150311
+ }
150133
150312
  }
150134
- async apiSchemaDefinition(_input) {
150135
- throw new BugError("Not implemented: apiSchemaDefinition");
150313
+ async apiSchemaDefinition(input, _apiKey, organizationId, appId) {
150314
+ try {
150315
+ let appIdNumber = String(numberFromGid(appId)), token = await this.token();
150316
+ return (await functionsRequestDoc(organizationId, SchemaDefinitionByApiType, token, appIdNumber, input))?.api?.schema?.definition ?? null;
150317
+ } catch (error) {
150318
+ throw new AbortError(`Failed to fetch schema definition: ${error}`);
150319
+ }
150136
150320
  }
150137
150321
  async migrateToUiExtension(_input) {
150138
150322
  throw new BugError("Not implemented: migrateToUiExtension");
@@ -151836,11 +152020,27 @@ var import_core4 = __toESM(require_lib(), 1);
151836
152020
 
151837
152021
  // ../cli-kit/dist/public/node/cli.js
151838
152022
  init_cjs_shims();
152023
+
152024
+ // ../cli-kit/dist/public/node/cli-launcher.js
152025
+ init_cjs_shims();
152026
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
152027
+ async function launchCLI(options) {
152028
+ let { errorHandler: errorHandler2 } = await import("./error-handler-2DRGGEE3.js"), { isDevelopment: isDevelopment2 } = await import("./local-BWALDEYA.js"), oclif = await import("./lib-EGJUAXU5.js"), { ShopifyConfig } = await import("./custom-oclif-loader-PUXRZWOJ.js");
152029
+ isDevelopment2() && (oclif.default.settings.debug = !0);
152030
+ try {
152031
+ let config2 = new ShopifyConfig({ root: fileURLToPath2(options.moduleURL) });
152032
+ await config2.load(), await oclif.default.run(options.argv, config2), await oclif.default.flush();
152033
+ } catch (error) {
152034
+ return await errorHandler2(error), oclif.default.Errors.handle(error);
152035
+ }
152036
+ }
152037
+
152038
+ // ../cli-kit/dist/public/node/cli.js
151839
152039
  var import_core3 = __toESM(require_lib());
151840
152040
  async function warnIfOldNodeVersion(versions2 = process.versions) {
151841
152041
  let nodeVersion = versions2.node, nodeMajorVersion = Number(nodeVersion.split(".")[0]);
151842
152042
  if (nodeMajorVersion < 18) {
151843
- let { renderWarning: renderWarning2 } = await import("./ui-CMIQC3Y3.js");
152043
+ let { renderWarning: renderWarning2 } = await import("./ui-US5TTZHC.js");
151844
152044
  renderWarning2({
151845
152045
  headline: "Upgrade to a supported Node version now.",
151846
152046
  body: [
@@ -151863,17 +152063,17 @@ function setupEnvironmentVariables(options, argv = process.argv, env = process.e
151863
152063
  function forceNoColor(argv = process.argv, env = process.env) {
151864
152064
  (argv.includes("--no-color") || isTruthy(env.NO_COLOR) || isTruthy(env.SHOPIFY_FLAG_NO_COLOR) || env.TERM === "dumb") && (env.FORCE_COLOR = "0");
151865
152065
  }
151866
- async function runCLI(options, launchCLI2, argv = process.argv, env = process.env, versions2 = process.versions) {
152066
+ async function runCLI(options, launchCLI2 = launchCLI, argv = process.argv, env = process.env, versions2 = process.versions) {
151867
152067
  return setupEnvironmentVariables(options, argv, env), options.runInCreateMode && await addInitToArgvWhenRunningCreateCLI(options, argv), forceNoColor(argv, env), await warnIfOldNodeVersion(versions2), launchCLI2({ moduleURL: options.moduleURL });
151868
152068
  }
151869
152069
  async function addInitToArgvWhenRunningCreateCLI(options, argv = process.argv) {
151870
- let { findUpAndReadPackageJson: findUpAndReadPackageJson2 } = await import("./node-package-manager-DCMI5QSN.js"), { moduleDirectory: moduleDirectory2 } = await import("./path-3RNJ32DF.js"), name = (await findUpAndReadPackageJson2(moduleDirectory2(options.moduleURL))).content.name.replace("@shopify/create-", "");
152070
+ let { findUpAndReadPackageJson: findUpAndReadPackageJson2 } = await import("./node-package-manager-UWKPZZ3A.js"), { moduleDirectory: moduleDirectory2 } = await import("./path-3RNJ32DF.js"), name = (await findUpAndReadPackageJson2(moduleDirectory2(options.moduleURL))).content.name.replace("@shopify/create-", "");
151871
152071
  if (argv.findIndex((arg) => arg.includes("init")) === -1) {
151872
152072
  let initIndex2 = argv.findIndex((arg) => arg.match(new RegExp(`bin(\\/|\\\\)+(create-${name}|dev|run)`))) + 1;
151873
152073
  argv.splice(initIndex2, 0, "init");
151874
152074
  }
151875
152075
  }
151876
- async function runCreateCLI(options, launchCLI2, argv = process.argv, env = process.env, versions2 = process.versions) {
152076
+ async function runCreateCLI(options, launchCLI2 = launchCLI, argv = process.argv, env = process.env, versions2 = process.versions) {
151877
152077
  return runCLI({ ...options, runInCreateMode: !0 }, launchCLI2, argv, env, versions2);
151878
152078
  }
151879
152079
  var globalFlags = {
@@ -153920,24 +154120,18 @@ async function bulkUploadThemeAssets(id, assets, session) {
153920
154120
  return results;
153921
154121
  }
153922
154122
  function prepareFilesForUpload(assets) {
153923
- return assets.map((asset) => {
153924
- if (asset.value)
153925
- return {
153926
- filename: asset.key,
153927
- body: {
153928
- type: "TEXT",
153929
- value: asset.value
153930
- }
153931
- };
153932
- if (asset.attachment)
153933
- return {
153934
- filename: asset.key,
153935
- body: {
153936
- type: "BASE64",
153937
- value: asset.attachment
153938
- }
153939
- };
153940
- unexpectedGraphQLError("Asset must have a value or attachment");
154123
+ return assets.map((asset) => asset.attachment ? {
154124
+ filename: asset.key,
154125
+ body: {
154126
+ type: "BASE64",
154127
+ value: asset.attachment
154128
+ }
154129
+ } : {
154130
+ filename: asset.key,
154131
+ body: {
154132
+ type: "TEXT",
154133
+ value: asset.value ?? ""
154134
+ }
153941
154135
  });
153942
154136
  }
153943
154137
  async function uploadFiles(themeId, files, session) {
@@ -157082,7 +157276,7 @@ var THEME_DIRECTORY_PATTERNS = [
157082
157276
  "templates/customers/**/*.{liquid,json}"
157083
157277
  ], THEME_PARTITION_REGEX = {
157084
157278
  sectionLiquidRegex: /^sections\/.+\.liquid$/,
157085
- liquidRegex: /\.liquid$/,
157279
+ blockLiquidRegex: /^blocks\/.+\.liquid$/,
157086
157280
  configRegex: /^config\/(settings_schema|settings_data)\.json$/,
157087
157281
  sectionJsonRegex: /^sections\/.+\.json$/,
157088
157282
  templateJsonRegex: /^templates\/.+\.json$/,
@@ -157236,10 +157430,10 @@ async function removeThemeFile(root, path) {
157236
157430
  await removeFile(absolutePath);
157237
157431
  }
157238
157432
  function partitionThemeFiles(files) {
157239
- let sectionLiquidFiles = [], otherLiquidFiles = [], sectionJsonFiles = [], templateJsonFiles = [], otherJsonFiles = [], contextualizedJsonFiles = [], configFiles = [], staticAssetFiles = [];
157433
+ let sectionLiquidFiles = [], otherLiquidFiles = [], sectionJsonFiles = [], templateJsonFiles = [], otherJsonFiles = [], contextualizedJsonFiles = [], configFiles = [], staticAssetFiles = [], blockLiquidFiles = [];
157240
157434
  return files.forEach((file) => {
157241
157435
  let fileKey = file.key;
157242
- fileKey.endsWith(".liquid") ? THEME_PARTITION_REGEX.sectionLiquidRegex.test(fileKey) ? sectionLiquidFiles.push(file) : otherLiquidFiles.push(file) : THEME_PARTITION_REGEX.configRegex.test(fileKey) ? configFiles.push(file) : THEME_PARTITION_REGEX.jsonRegex.test(fileKey) ? THEME_PARTITION_REGEX.contextualizedJsonRegex.test(fileKey) ? contextualizedJsonFiles.push(file) : THEME_PARTITION_REGEX.sectionJsonRegex.test(fileKey) ? sectionJsonFiles.push(file) : THEME_PARTITION_REGEX.templateJsonRegex.test(fileKey) ? templateJsonFiles.push(file) : otherJsonFiles.push(file) : THEME_PARTITION_REGEX.staticAssetRegex.test(fileKey) && staticAssetFiles.push(file);
157436
+ fileKey.endsWith(".liquid") ? THEME_PARTITION_REGEX.sectionLiquidRegex.test(fileKey) ? sectionLiquidFiles.push(file) : THEME_PARTITION_REGEX.blockLiquidRegex.test(fileKey) ? blockLiquidFiles.push(file) : otherLiquidFiles.push(file) : THEME_PARTITION_REGEX.configRegex.test(fileKey) ? configFiles.push(file) : THEME_PARTITION_REGEX.jsonRegex.test(fileKey) ? THEME_PARTITION_REGEX.contextualizedJsonRegex.test(fileKey) ? contextualizedJsonFiles.push(file) : THEME_PARTITION_REGEX.sectionJsonRegex.test(fileKey) ? sectionJsonFiles.push(file) : THEME_PARTITION_REGEX.templateJsonRegex.test(fileKey) ? templateJsonFiles.push(file) : otherJsonFiles.push(file) : THEME_PARTITION_REGEX.staticAssetRegex.test(fileKey) && staticAssetFiles.push(file);
157243
157437
  }), {
157244
157438
  sectionLiquidFiles,
157245
157439
  otherLiquidFiles,
@@ -157248,7 +157442,8 @@ function partitionThemeFiles(files) {
157248
157442
  contextualizedJsonFiles,
157249
157443
  otherJsonFiles,
157250
157444
  configFiles,
157251
- staticAssetFiles
157445
+ staticAssetFiles,
157446
+ blockLiquidFiles
157252
157447
  };
157253
157448
  }
157254
157449
  function isTextFile(path) {
@@ -158217,6 +158412,7 @@ function orderFilesToBeDeleted(files) {
158217
158412
  ...fileSets.sectionJsonFiles,
158218
158413
  ...fileSets.otherJsonFiles,
158219
158414
  ...fileSets.sectionLiquidFiles,
158415
+ ...fileSets.blockLiquidFiles,
158220
158416
  ...fileSets.otherLiquidFiles,
158221
158417
  ...fileSets.configFiles,
158222
158418
  ...fileSets.staticAssetFiles
@@ -158265,6 +158461,7 @@ function orderFilesToBeUploaded(files) {
158265
158461
  independentFiles: [fileSets.otherLiquidFiles, fileSets.otherJsonFiles, fileSets.staticAssetFiles],
158266
158462
  // Follow order of dependencies:
158267
158463
  dependentFiles: [
158464
+ fileSets.blockLiquidFiles,
158268
158465
  fileSets.sectionLiquidFiles,
158269
158466
  fileSets.sectionJsonFiles,
158270
158467
  fileSets.templateJsonFiles,
@@ -167034,43 +167231,45 @@ init_cjs_shims();
167034
167231
  // ../app/dist/cli/services/generate-schema.js
167035
167232
  init_cjs_shims();
167036
167233
  async function generateSchemaService(options) {
167037
- let { extension, stdout, developerPlatformClient, app } = options, apiKey = app.configuration.client_id, { api_version: version, type, targeting } = extension.configuration, definition = await (!!targeting?.length ? generateSchemaFromTarget({
167234
+ let { extension, stdout, developerPlatformClient, app, orgId } = options, apiKey = app.configuration.client_id, appId = app.configuration.app_id, { api_version: version, type, targeting } = extension.configuration, definition = await (!!targeting?.length ? generateSchemaFromTarget({
167038
167235
  localIdentifier: extension.localIdentifier,
167039
167236
  developerPlatformClient,
167040
167237
  apiKey,
167238
+ appId,
167041
167239
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
167042
167240
  target: targeting[0].target,
167043
- version
167044
- }) : generateSchemaFromType({
167241
+ version,
167242
+ orgId
167243
+ }) : generateSchemaFromApiType({
167045
167244
  localIdentifier: extension.localIdentifier,
167046
167245
  developerPlatformClient,
167047
167246
  apiKey,
167247
+ appId,
167048
167248
  type,
167049
- version
167249
+ version,
167250
+ orgId
167050
167251
  }));
167051
167252
  if (stdout)
167052
167253
  outputInfo(definition);
167053
167254
  else {
167054
- let outputPath = joinPath(options.path, "schema.graphql");
167255
+ let outputPath = joinPath(extension.directory, "schema.graphql");
167055
167256
  await writeFile(outputPath, definition), outputInfo(`GraphQL Schema for ${extension.localIdentifier} written to ${outputPath}`);
167056
167257
  }
167057
167258
  }
167058
- async function generateSchemaFromTarget({ localIdentifier, developerPlatformClient, apiKey, target, version }) {
167259
+ async function generateSchemaFromTarget({ localIdentifier, developerPlatformClient, appId, apiKey, target, version, orgId }) {
167059
167260
  let variables = {
167060
- apiKey,
167061
- target,
167261
+ handle: target,
167062
167262
  version
167063
- }, definition = await developerPlatformClient.targetSchemaDefinition(variables);
167263
+ }, definition = await developerPlatformClient.targetSchemaDefinition(variables, apiKey, orgId, appId);
167064
167264
  if (!definition)
167065
167265
  throw new AbortError(outputContent`A schema could not be generated for ${localIdentifier}`, outputContent`Check that the Function targets and version are valid.`);
167066
167266
  return definition;
167067
167267
  }
167068
- async function generateSchemaFromType({ localIdentifier, developerPlatformClient, apiKey, version, type }) {
167268
+ async function generateSchemaFromApiType({ localIdentifier, developerPlatformClient, apiKey, appId, version, type, orgId }) {
167069
167269
  let variables = {
167070
- apiKey,
167071
167270
  version,
167072
167271
  type
167073
- }, definition = await developerPlatformClient.apiSchemaDefinition(variables);
167272
+ }, definition = await developerPlatformClient.apiSchemaDefinition(variables, apiKey, orgId, appId);
167074
167273
  if (!definition)
167075
167274
  throw new AbortError(outputContent`A schema could not be generated for ${localIdentifier}`, outputContent`Check that the Function API type and version are valid.`);
167076
167275
  return definition;
@@ -167089,31 +167288,32 @@ var functionFlags = {
167089
167288
  })
167090
167289
  };
167091
167290
  async function inFunctionContext({ path, userProvidedConfigName, apiKey, callback, reset }) {
167092
- let { app, developerPlatformClient } = await linkedAppContext({
167291
+ let { app, developerPlatformClient, organization } = await linkedAppContext({
167093
167292
  directory: path,
167094
167293
  clientId: apiKey,
167095
167294
  forceRelink: reset ?? !1,
167096
167295
  userProvidedConfigName
167097
167296
  }), allFunctions = app.allExtensions.filter((ext) => ext.isFunctionExtension), ourFunction = allFunctions.find((fun) => fun.directory === path);
167098
167297
  if (ourFunction)
167099
- return callback(app, developerPlatformClient, ourFunction);
167298
+ return callback(app, developerPlatformClient, ourFunction, organization.id);
167100
167299
  if (isTerminalInteractive()) {
167101
167300
  let selectedFunction = await renderAutocompletePrompt({
167102
167301
  message: "Which function?",
167103
167302
  choices: allFunctions.map((shopifyFunction) => ({ label: shopifyFunction.handle, value: shopifyFunction }))
167104
167303
  });
167105
- return callback(app, developerPlatformClient, selectedFunction);
167304
+ return callback(app, developerPlatformClient, selectedFunction, organization.id);
167106
167305
  } else
167107
167306
  throw new AbortError("Run this command from a function directory or use `--path` to specify a function directory.");
167108
167307
  }
167109
- async function getOrGenerateSchemaPath(extension, app, developerPlatformClient) {
167308
+ async function getOrGenerateSchemaPath(extension, app, developerPlatformClient, orgId) {
167110
167309
  let path = joinPath(extension.directory, "schema.graphql");
167111
167310
  return await fileExists(path) ? path : (await generateSchemaService({
167112
167311
  app,
167113
167312
  developerPlatformClient,
167114
167313
  extension,
167115
167314
  stdout: !1,
167116
- path: extension.directory
167315
+ path: extension.directory,
167316
+ orgId
167117
167317
  }), await fileExists(path) ? path : void 0);
167118
167318
  }
167119
167319
 
@@ -167564,7 +167764,7 @@ var _a26, DEFAULT_FUNCTION_EXPORT = "_start", FunctionRun = class extends AppCom
167564
167764
  userProvidedConfigName: flags.config,
167565
167765
  apiKey: flags["client-id"],
167566
167766
  reset: flags.reset,
167567
- callback: async (app2, developerPlatformClient, ourFunction) => {
167767
+ callback: async (app2, developerPlatformClient, ourFunction, orgId) => {
167568
167768
  let functionExport = DEFAULT_FUNCTION_EXPORT;
167569
167769
  if (flags.export !== void 0)
167570
167770
  outputDebug(`Using export ${flags.export} from the --export flag.`), functionExport = flags.export;
@@ -167583,7 +167783,7 @@ var _a26, DEFAULT_FUNCTION_EXPORT = "_start", FunctionRun = class extends AppCom
167583
167783
  functionExport = targeting?.[0]?.export || DEFAULT_FUNCTION_EXPORT, outputDebug(`Using export '${functionExport}'. Use the --export flag or an interactive terminal to select a different export.`);
167584
167784
  } else
167585
167785
  outputDebug(`No targeting information found. Using the default export '${functionExport}'. Use the --export flag or an interactive terminal to select a different export.`);
167586
- let inputQueryPath = ourFunction?.configuration.targeting?.[0]?.input_query, queryPath = inputQueryPath && `${ourFunction?.directory}/${inputQueryPath}`, schemaPath = await getOrGenerateSchemaPath(ourFunction, app2, developerPlatformClient);
167786
+ let inputQueryPath = ourFunction?.configuration.targeting?.[0]?.input_query, queryPath = inputQueryPath && `${ourFunction?.directory}/${inputQueryPath}`, schemaPath = await getOrGenerateSchemaPath(ourFunction, app2, developerPlatformClient, orgId);
167587
167787
  return await runFunction({
167588
167788
  functionExtension: ourFunction,
167589
167789
  json: flags.json,
@@ -167633,12 +167833,13 @@ var _a27, FetchSchema = class extends AppCommand {
167633
167833
  apiKey,
167634
167834
  reset: flags.reset,
167635
167835
  userProvidedConfigName: flags.config,
167636
- callback: async (app2, developerPlatformClient, ourFunction) => (await generateSchemaService({
167836
+ callback: async (app2, developerPlatformClient, ourFunction, orgId) => (await generateSchemaService({
167637
167837
  app: app2,
167638
167838
  extension: ourFunction,
167639
167839
  developerPlatformClient,
167640
167840
  stdout: flags.stdout,
167641
- path: flags.path
167841
+ path: flags.path,
167842
+ orgId
167642
167843
  }), app2)
167643
167844
  }) };
167644
167845
  }
@@ -168292,11 +168493,10 @@ function buildTomlObject3(extension, _2, appConfiguration) {
168292
168493
  extensions: [
168293
168494
  {
168294
168495
  type: "admin_link",
168295
- name: extension.title,
168496
+ name: config2.text,
168296
168497
  handle: slugify(extension.title.substring(0, MAX_EXTENSION_HANDLE_LENGTH)),
168297
168498
  targeting: [
168298
168499
  {
168299
- text: config2.text,
168300
168500
  url: config2.url,
168301
168501
  target: contextToTarget(context)
168302
168502
  }
@@ -169627,29 +169827,12 @@ var commands = {
169627
169827
  "demo:watcher": watcher_default
169628
169828
  };
169629
169829
 
169630
- // ../cli-kit/dist/public/node/cli-launcher.js
169631
- init_cjs_shims();
169632
- import { fileURLToPath as fileURLToPath2 } from "node:url";
169633
- async function launchCLI(options) {
169634
- let { errorHandler: errorHandler2 } = await import("./error-handler-ARHZ7CDV.js"), { isDevelopment: isDevelopment2 } = await import("./local-4NUYW4RN.js"), oclif = await import("./lib-EGJUAXU5.js"), { ShopifyConfig } = await import("./custom-oclif-loader-2OF3BNBW.js");
169635
- isDevelopment2() && (oclif.default.settings.debug = !0);
169636
- try {
169637
- let config2 = new ShopifyConfig({ root: fileURLToPath2(options.moduleURL) });
169638
- await config2.load(), await oclif.default.run(options.argv, config2), await oclif.default.flush();
169639
- } catch (error) {
169640
- return await errorHandler2(error), oclif.default.Errors.handle(error);
169641
- }
169642
- }
169643
-
169644
169830
  // src/index.ts
169645
169831
  async function runCreateAppCLI(development) {
169646
- await runCreateCLI(
169647
- {
169648
- moduleURL: import.meta.url,
169649
- development
169650
- },
169651
- launchCLI
169652
- );
169832
+ await runCreateCLI({
169833
+ moduleURL: import.meta.url,
169834
+ development
169835
+ });
169653
169836
  }
169654
169837
  var COMMANDS = {
169655
169838
  init: commands["app:init"]
@@ -22,7 +22,7 @@ import {
22
22
  themeToken,
23
23
  useEmbeddedThemeCLI,
24
24
  useThemebundling
25
- } from "./chunk-FMHMRW3B.js";
25
+ } from "./chunk-SWJYETLD.js";
26
26
  import "./chunk-CQGOPQQH.js";
27
27
  import "./chunk-SNOECVP4.js";
28
28
  import "./chunk-522OB3EU.js";
@@ -58,4 +58,4 @@ export {
58
58
  useEmbeddedThemeCLI,
59
59
  useThemebundling
60
60
  };
61
- //# sourceMappingURL=local-4NUYW4RN.js.map
61
+ //# sourceMappingURL=local-BWALDEYA.js.map
@@ -28,8 +28,8 @@ import {
28
28
  versionSatisfies,
29
29
  writePackageJSON,
30
30
  yarnLockfile
31
- } from "./chunk-QGDWNBQX.js";
32
- import "./chunk-FMHMRW3B.js";
31
+ } from "./chunk-XY5EMAOX.js";
32
+ import "./chunk-SWJYETLD.js";
33
33
  import "./chunk-CQGOPQQH.js";
34
34
  import "./chunk-SNOECVP4.js";
35
35
  import "./chunk-522OB3EU.js";
@@ -71,4 +71,4 @@ export {
71
71
  writePackageJSON,
72
72
  yarnLockfile
73
73
  };
74
- //# sourceMappingURL=node-package-manager-DCMI5QSN.js.map
74
+ //# sourceMappingURL=node-package-manager-UWKPZZ3A.js.map