@shopify/cli-kit 3.6.0 → 3.7.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 (116) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/analytics.d.ts +2 -1
  3. package/dist/analytics.js +32 -16
  4. package/dist/analytics.js.map +1 -1
  5. package/dist/api/common.d.ts +1 -1
  6. package/dist/api/common.js +1 -1
  7. package/dist/api/common.js.map +1 -1
  8. package/dist/api/graphql/extension_specifications.js.map +1 -1
  9. package/dist/api/graphql/functions/app_function_set.d.ts +9 -23
  10. package/dist/api/graphql/functions/app_function_set.js +18 -27
  11. package/dist/api/graphql/functions/app_function_set.js.map +1 -1
  12. package/dist/api/graphql/functions/upload_url_generate.d.ts +12 -0
  13. package/dist/api/graphql/functions/upload_url_generate.js +11 -0
  14. package/dist/api/graphql/functions/upload_url_generate.js.map +1 -0
  15. package/dist/api/graphql/index.d.ts +1 -1
  16. package/dist/api/graphql/index.js +1 -1
  17. package/dist/api/graphql/index.js.map +1 -1
  18. package/dist/constants.d.ts +3 -1
  19. package/dist/constants.js +3 -1
  20. package/dist/constants.js.map +1 -1
  21. package/dist/environment/local.d.ts +19 -2
  22. package/dist/environment/local.js +45 -5
  23. package/dist/environment/local.js.map +1 -1
  24. package/dist/environment/utilities.d.ts +4 -0
  25. package/dist/environment/utilities.js +9 -0
  26. package/dist/environment/utilities.js.map +1 -1
  27. package/dist/error.d.ts +2 -2
  28. package/dist/error.js +7 -1
  29. package/dist/error.js.map +1 -1
  30. package/dist/file.d.ts +2 -1
  31. package/dist/file.js +6 -2
  32. package/dist/file.js.map +1 -1
  33. package/dist/github.js.map +1 -1
  34. package/dist/index.d.ts +1 -0
  35. package/dist/index.js +1 -0
  36. package/dist/index.js.map +1 -1
  37. package/dist/metadata.d.ts +180 -12
  38. package/dist/metadata.js +39 -6
  39. package/dist/metadata.js.map +1 -1
  40. package/dist/monorail.d.ts +48 -1
  41. package/dist/monorail.js +2 -1
  42. package/dist/monorail.js.map +1 -1
  43. package/dist/node/archiver.js +1 -0
  44. package/dist/node/archiver.js.map +1 -1
  45. package/dist/node/base-command.d.ts +11 -1
  46. package/dist/node/base-command.js +19 -4
  47. package/dist/node/base-command.js.map +1 -1
  48. package/dist/node/cli.js +2 -2
  49. package/dist/node/cli.js.map +1 -1
  50. package/dist/node/error-handler.d.ts +9 -0
  51. package/dist/node/error-handler.js +13 -3
  52. package/dist/node/error-handler.js.map +1 -1
  53. package/dist/node/hooks/prerun.js +1 -1
  54. package/dist/node/hooks/prerun.js.map +1 -1
  55. package/dist/node/node-package-manager.d.ts +3 -7
  56. package/dist/node/node-package-manager.js +2 -1
  57. package/dist/node/node-package-manager.js.map +1 -1
  58. package/dist/node/ruby.js +12 -6
  59. package/dist/node/ruby.js.map +1 -1
  60. package/dist/path.d.ts +1 -0
  61. package/dist/plugins/tunnel.d.ts +40 -0
  62. package/dist/plugins/tunnel.js +11 -0
  63. package/dist/plugins/tunnel.js.map +1 -0
  64. package/dist/plugins.d.ts +11 -13
  65. package/dist/plugins.js +0 -1
  66. package/dist/plugins.js.map +1 -1
  67. package/dist/session/authorize.js +1 -1
  68. package/dist/session/authorize.js.map +1 -1
  69. package/dist/session/exchange.js +1 -2
  70. package/dist/session/exchange.js.map +1 -1
  71. package/dist/session/redirect-listener.js +6 -5
  72. package/dist/session/redirect-listener.js.map +1 -1
  73. package/dist/session.js +1 -1
  74. package/dist/session.js.map +1 -1
  75. package/dist/string.d.ts +1 -0
  76. package/dist/string.js +3 -0
  77. package/dist/string.js.map +1 -1
  78. package/dist/tsconfig.tsbuildinfo +1 -1
  79. package/dist/typing/deep-required.d.ts +12 -0
  80. package/dist/typing/deep-required.js +2 -0
  81. package/dist/typing/deep-required.js.map +1 -0
  82. package/dist/typing/pick-by-prefix.d.ts +12 -0
  83. package/dist/typing/pick-by-prefix.js +2 -0
  84. package/dist/typing/pick-by-prefix.js.map +1 -0
  85. package/dist/ui/executor.d.ts +7 -0
  86. package/dist/ui/executor.js +60 -0
  87. package/dist/ui/executor.js.map +1 -0
  88. package/dist/ui/inquirer/autocomplete.d.ts +11 -0
  89. package/dist/ui/inquirer/autocomplete.js +95 -0
  90. package/dist/ui/inquirer/autocomplete.js.map +1 -0
  91. package/dist/ui/inquirer/input.d.ts +16 -0
  92. package/dist/ui/inquirer/input.js +46 -0
  93. package/dist/ui/inquirer/input.js.map +1 -0
  94. package/dist/ui/inquirer/password.d.ts +7 -0
  95. package/dist/ui/inquirer/password.js +8 -0
  96. package/dist/ui/inquirer/password.js.map +1 -0
  97. package/dist/ui/inquirer/select.d.ts +14 -0
  98. package/dist/ui/inquirer/select.js +27 -0
  99. package/dist/ui/inquirer/select.js.map +1 -0
  100. package/dist/ui.d.ts +7 -23
  101. package/dist/ui.js +13 -60
  102. package/dist/ui.js.map +1 -1
  103. package/dist/version.d.ts +1 -0
  104. package/package.json +14 -5
  105. package/dist/api/graphql/functions/module_upload_url_generate.d.ts +0 -18
  106. package/dist/api/graphql/functions/module_upload_url_generate.js +0 -17
  107. package/dist/api/graphql/functions/module_upload_url_generate.js.map +0 -1
  108. package/dist/ui/autocomplete.d.ts +0 -7
  109. package/dist/ui/autocomplete.js +0 -43
  110. package/dist/ui/autocomplete.js.map +0 -1
  111. package/dist/ui/input.d.ts +0 -7
  112. package/dist/ui/input.js +0 -48
  113. package/dist/ui/input.js.map +0 -1
  114. package/dist/ui/select.d.ts +0 -6
  115. package/dist/ui/select.js +0 -30
  116. package/dist/ui/select.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @shopify/cli-kit
2
2
 
3
+ ## 3.7.1
4
+
5
+ ### Minor Changes
6
+
7
+ - 18717ad5: Rename the environment variable SHOPIFY_CONFIG to SHOPIFY_ENV because it's more representative of its usage
8
+ - 29f46e8f: Make inquirer default for inputs
9
+ - bba213f9: Shopify Functions identifiers have been changed to ULIDs. Existing projects will be updated during the next deploy.
10
+
11
+ ## 3.6.2
12
+
13
+ ### Patch Changes
14
+
15
+ - 59d56a40: Only show errors from CLI 2 once
16
+
17
+ ## 3.6.1
18
+
3
19
  ## 3.6.0
4
20
 
5
21
  ### Patch Changes
@@ -3,8 +3,9 @@ interface StartOptions {
3
3
  command: string;
4
4
  args: string[];
5
5
  currentTime?: number;
6
+ commandClass?: Interfaces.Command.Class;
6
7
  }
7
- export declare const start: ({ command, args, currentTime }: StartOptions) => void;
8
+ export declare const start: ({ command, args, currentTime, commandClass }: StartOptions) => Promise<void>;
8
9
  interface ReportEventOptions {
9
10
  config: Interfaces.Config;
10
11
  errorMessage?: string;
package/dist/analytics.js CHANGED
@@ -1,4 +1,3 @@
1
- /* eslint-disable @typescript-eslint/naming-convention */
2
1
  import * as environment from './environment.js';
3
2
  import { platformAndArch } from './os.js';
4
3
  import { resolve } from './path.js';
@@ -6,16 +5,21 @@ import { version as rubyVersion } from './node/ruby.js';
6
5
  import { content, debug, token } from './output.js';
7
6
  import constants from './constants.js';
8
7
  import * as metadata from './metadata.js';
9
- import { publishEvent } from './monorail.js';
8
+ import { publishEvent, MONORAIL_COMMAND_TOPIC } from './monorail.js';
10
9
  import { fanoutHooks } from './plugins.js';
11
- export const start = ({ command, args, currentTime = new Date().getTime() }) => {
12
- metadata.addSensitive({
10
+ import { packageManagerUsedForCreating } from './node/node-package-manager.js';
11
+ export const start = async ({ command, args, currentTime = new Date().getTime(), commandClass }) => {
12
+ await metadata.addSensitive(() => ({
13
13
  commandStartOptions: {
14
14
  startTime: currentTime,
15
15
  startCommand: command,
16
16
  startArgs: args,
17
17
  },
18
- });
18
+ }));
19
+ await metadata.addPublic(() => ({
20
+ cmd_all_launcher: packageManagerUsedForCreating(),
21
+ cmd_all_plugin: commandClass?.plugin?.name,
22
+ }));
19
23
  };
20
24
  /**
21
25
  * Report an analytics event, sending it off to Monorail -- Shopify's internal analytics service.
@@ -30,11 +34,11 @@ export async function reportEvent(options) {
30
34
  // Nothing to log
31
35
  return;
32
36
  }
33
- if (environment.local.analyticsDisabled()) {
37
+ if (!environment.local.alwaysLogAnalytics() && environment.local.analyticsDisabled()) {
34
38
  debug(content `Skipping command analytics, payload: ${token.json(payload)}`);
35
39
  return;
36
40
  }
37
- const response = await publishEvent('app_cli3_command/1.0', payload.public, payload.sensitive);
41
+ const response = await publishEvent(MONORAIL_COMMAND_TOPIC, payload.public, payload.sensitive);
38
42
  if (response.type === 'error') {
39
43
  debug(response.message);
40
44
  }
@@ -61,15 +65,9 @@ const buildPayload = async ({ config, errorMessage }) => {
61
65
  if (pathFlagIndex >= 0) {
62
66
  directory = resolve(startArgs[pathFlagIndex + 1]);
63
67
  }
64
- const { platform, arch } = platformAndArch();
65
68
  const { '@shopify/app': appPublic, ...otherPluginsPublic } = await fanoutHooks(config, 'public_command_metadata', {});
66
- const { partner_id, project_type, api_key, ...otherShopifyAppPublic } = appPublic ?? {};
67
69
  const sensitivePluginData = await fanoutHooks(config, 'sensitive_command_metadata', {});
68
- const appSpecific = {
69
- partner_id,
70
- api_key,
71
- project_type,
72
- };
70
+ const { platform, arch, ...environmentData } = getEnvironmentData(config);
73
71
  return {
74
72
  public: {
75
73
  command: startCommand,
@@ -82,7 +80,9 @@ const buildPayload = async ({ config, errorMessage }) => {
82
80
  ruby_version: (await rubyVersion()) || '',
83
81
  node_version: process.version.replace('v', ''),
84
82
  is_employee: await environment.local.isShopify(),
85
- ...appSpecific,
83
+ ...environmentData,
84
+ ...appPublic,
85
+ ...metadata.getAllPublic(),
86
86
  },
87
87
  sensitive: {
88
88
  args: startArgs.join(' '),
@@ -90,7 +90,6 @@ const buildPayload = async ({ config, errorMessage }) => {
90
90
  metadata: JSON.stringify({
91
91
  ...sensitiveMetadata,
92
92
  extraPublic: {
93
- '@shopify/app': otherShopifyAppPublic,
94
93
  ...otherPluginsPublic,
95
94
  },
96
95
  extraSensitive: sensitivePluginData,
@@ -98,4 +97,21 @@ const buildPayload = async ({ config, errorMessage }) => {
98
97
  },
99
98
  };
100
99
  };
100
+ function getEnvironmentData(config) {
101
+ const ciPlatform = environment.local.ciPlatform();
102
+ const pluginNames = config.plugins
103
+ .map((plugin) => plugin.name)
104
+ .sort()
105
+ .filter((plugin) => !plugin.startsWith('@oclif/'));
106
+ const shopifyPlugins = pluginNames.filter((plugin) => plugin.startsWith('@shopify/'));
107
+ return {
108
+ ...platformAndArch(),
109
+ env_ci: ciPlatform.isCI,
110
+ env_ci_platform: ciPlatform.name,
111
+ env_plugin_installed_any_custom: pluginNames.length !== shopifyPlugins.length,
112
+ env_plugin_installed_shopify: JSON.stringify(shopifyPlugins),
113
+ env_shell: config.shell,
114
+ env_web_ide: environment.local.webIDEPlatform(),
115
+ };
116
+ }
101
117
  //# sourceMappingURL=analytics.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"analytics.js","sourceRoot":"","sources":["../src/analytics.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAC,eAAe,EAAC,MAAM,SAAS,CAAA;AACvC,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AACjC,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,gBAAgB,CAAA;AACrD,OAAO,EAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AACjD,OAAO,SAAS,MAAM,gBAAgB,CAAA;AACtC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,EAAC,YAAY,EAAC,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAC,WAAW,EAAC,MAAM,cAAc,CAAA;AASxC,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,EAAC,OAAO,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,EAAe,EAAE,EAAE;IACzF,QAAQ,CAAC,YAAY,CAAC;QACpB,mBAAmB,EAAE;YACnB,SAAS,EAAE,WAAW;YACtB,YAAY,EAAE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AW,EAAE,MAAM,WAAW,CAAC,KAAK,CAAC,SAAS,EAAE;YAChD,GAAG,WAAW;SACf;QACD,SAAS,EAAE;YACT,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC;YACzB,aAAa,EAAE,YAAY;YAC3B,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC;gBACvB,GAAG,iBAAiB;gBACpB,WAAW,EAAE;oBACX,cAAc,EAAE,qBAAqB;oBACrC,GAAG,kBAAkB;iBACtB;gBACD,cAAc,EAAE,mBAAmB;aACpC,CAAC;SACH;KACF,CAAA;AACH,CAAC,CAAA","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport * as environment from './environment.js'\nimport {platformAndArch} from './os.js'\nimport {resolve} from './path.js'\nimport {version as rubyVersion} from './node/ruby.js'\nimport {content, debug, token} from './output.js'\nimport constants from './constants.js'\nimport * as metadata from './metadata.js'\nimport {publishEvent} from './monorail.js'\nimport {fanoutHooks} from './plugins.js'\nimport {Interfaces} from '@oclif/core'\n\ninterface StartOptions {\n command: string\n args: string[]\n currentTime?: number\n}\n\nexport const start = ({command, args, currentTime = new Date().getTime()}: StartOptions) => {\n metadata.addSensitive({\n commandStartOptions: {\n startTime: currentTime,\n startCommand: command,\n startArgs: args,\n },\n })\n}\n\ninterface ReportEventOptions {\n config: Interfaces.Config\n errorMessage?: string\n}\n\n/**\n * Report an analytics event, sending it off to Monorail -- Shopify's internal analytics service.\n *\n * The payload for an event includes both generic data, and data gathered from installed plug-ins.\n *\n */\nexport async function reportEvent(options: ReportEventOptions) {\n try {\n const payload = await buildPayload(options)\n if (payload === undefined) {\n // Nothing to log\n return\n }\n if (environment.local.analyticsDisabled()) {\n debug(content`Skipping command analytics, payload: ${token.json(payload)}`)\n return\n }\n const response = await publishEvent('app_cli3_command/1.0', payload.public, payload.sensitive)\n if (response.type === 'error') {\n debug(response.message)\n }\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch (error) {\n let message = 'Failed to report usage analytics'\n if (error instanceof Error) {\n message = message.concat(`: ${error.message}`)\n }\n debug(message)\n }\n}\n\nconst buildPayload = async ({config, errorMessage}: ReportEventOptions) => {\n const {commandStartOptions, ...sensitiveMetadata} = metadata.getAllSensitive()\n if (commandStartOptions === undefined) {\n debug('Unable to log analytics event - no information on executed command')\n return\n }\n const {startCommand, startArgs, startTime} = commandStartOptions\n const currentTime = new Date().getTime()\n\n let directory = process.cwd()\n const pathFlagIndex = startArgs.indexOf('--path')\n if (pathFlagIndex >= 0) {\n directory = resolve(startArgs[pathFlagIndex + 1])\n }\n\n const {platform, arch} = platformAndArch()\n\n const {'@shopify/app': appPublic, ...otherPluginsPublic} = await fanoutHooks(config, 'public_command_metadata', {})\n const {partner_id, project_type, api_key, ...otherShopifyAppPublic} = appPublic ?? {}\n\n const sensitivePluginData = await fanoutHooks(config, 'sensitive_command_metadata', {})\n\n const appSpecific = {\n partner_id,\n api_key,\n project_type,\n }\n\n return {\n public: {\n command: startCommand,\n time_start: startTime,\n time_end: currentTime,\n total_time: currentTime - startTime,\n success: errorMessage === undefined,\n uname: `${platform} ${arch}`,\n cli_version: await constants.versions.cliKit(),\n ruby_version: (await rubyVersion()) || '',\n node_version: process.version.replace('v', ''),\n is_employee: await environment.local.isShopify(),\n ...appSpecific,\n },\n sensitive: {\n args: startArgs.join(' '),\n error_message: errorMessage,\n metadata: JSON.stringify({\n ...sensitiveMetadata,\n extraPublic: {\n '@shopify/app': otherShopifyAppPublic,\n ...otherPluginsPublic,\n },\n extraSensitive: sensitivePluginData,\n }),\n },\n }\n}\n"]}
1
+ {"version":3,"file":"analytics.js","sourceRoot":"","sources":["../src/analytics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAC,eAAe,EAAC,MAAM,SAAS,CAAA;AACvC,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AACjC,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,gB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MAAM,CAAC,OAAO;SAC/B,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC;SAC5B,IAAI,EAAE;SACN,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAA;IACpD,MAAM,cAAc,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAA;IAErF,OAAO;QACL,GAAG,eAAe,EAAE;QACpB,MAAM,EAAE,UAAU,CAAC,IAAI;QACvB,eAAe,EAAE,UAAU,CAAC,IAAI;QAChC,+BAA+B,EAAE,WAAW,CAAC,MAAM,KAAK,cAAc,CAAC,MAAM;QAC7E,4BAA4B,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC;QAC5D,SAAS,EAAE,MAAM,CAAC,KAAK;QACvB,WAAW,EAAE,WAAW,CAAC,KAAK,CAAC,cAAc,EAAE;KAChD,CAAA;AACH,CAAC","sourcesContent":["import * as environment from './environment.js'\nimport {platformAndArch} from './os.js'\nimport {resolve} from './path.js'\nimport {version as rubyVersion} from './node/ruby.js'\nimport {content, debug, token} from './output.js'\nimport constants from './constants.js'\nimport * as metadata from './metadata.js'\nimport {publishEvent, MONORAIL_COMMAND_TOPIC} from './monorail.js'\nimport {fanoutHooks} from './plugins.js'\nimport {packageManagerUsedForCreating} from './node/node-package-manager.js'\nimport {Interfaces} from '@oclif/core'\n\ninterface StartOptions {\n command: string\n args: string[]\n currentTime?: number\n commandClass?: Interfaces.Command.Class\n}\n\nexport const start = async ({command, args, currentTime = new Date().getTime(), commandClass}: StartOptions) => {\n await metadata.addSensitive(() => ({\n commandStartOptions: {\n startTime: currentTime,\n startCommand: command,\n startArgs: args,\n },\n }))\n\n await metadata.addPublic(() => ({\n cmd_all_launcher: packageManagerUsedForCreating(),\n cmd_all_plugin: commandClass?.plugin?.name,\n }))\n}\n\ninterface ReportEventOptions {\n config: Interfaces.Config\n errorMessage?: string\n}\n\n/**\n * Report an analytics event, sending it off to Monorail -- Shopify's internal analytics service.\n *\n * The payload for an event includes both generic data, and data gathered from installed plug-ins.\n *\n */\nexport async function reportEvent(options: ReportEventOptions) {\n try {\n const payload = await buildPayload(options)\n if (payload === undefined) {\n // Nothing to log\n return\n }\n if (!environment.local.alwaysLogAnalytics() && environment.local.analyticsDisabled()) {\n debug(content`Skipping command analytics, payload: ${token.json(payload)}`)\n return\n }\n const response = await publishEvent(MONORAIL_COMMAND_TOPIC, payload.public, payload.sensitive)\n if (response.type === 'error') {\n debug(response.message)\n }\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch (error) {\n let message = 'Failed to report usage analytics'\n if (error instanceof Error) {\n message = message.concat(`: ${error.message}`)\n }\n debug(message)\n }\n}\n\nconst buildPayload = async ({config, errorMessage}: ReportEventOptions) => {\n const {commandStartOptions, ...sensitiveMetadata} = metadata.getAllSensitive()\n if (commandStartOptions === undefined) {\n debug('Unable to log analytics event - no information on executed command')\n return\n }\n const {startCommand, startArgs, startTime} = commandStartOptions\n const currentTime = new Date().getTime()\n\n let directory = process.cwd()\n const pathFlagIndex = startArgs.indexOf('--path')\n if (pathFlagIndex >= 0) {\n directory = resolve(startArgs[pathFlagIndex + 1])\n }\n\n const {'@shopify/app': appPublic, ...otherPluginsPublic} = await fanoutHooks(config, 'public_command_metadata', {})\n const sensitivePluginData = await fanoutHooks(config, 'sensitive_command_metadata', {})\n\n const {platform, arch, ...environmentData} = getEnvironmentData(config)\n\n return {\n public: {\n command: startCommand,\n time_start: startTime,\n time_end: currentTime,\n total_time: currentTime - startTime,\n success: errorMessage === undefined,\n uname: `${platform} ${arch}`,\n cli_version: await constants.versions.cliKit(),\n ruby_version: (await rubyVersion()) || '',\n node_version: process.version.replace('v', ''),\n is_employee: await environment.local.isShopify(),\n ...environmentData,\n ...appPublic,\n ...metadata.getAllPublic(),\n },\n sensitive: {\n args: startArgs.join(' '),\n error_message: errorMessage,\n metadata: JSON.stringify({\n ...sensitiveMetadata,\n extraPublic: {\n ...otherPluginsPublic,\n },\n extraSensitive: sensitivePluginData,\n }),\n },\n }\n}\n\nfunction getEnvironmentData(config: Interfaces.Config) {\n const ciPlatform = environment.local.ciPlatform()\n\n const pluginNames = config.plugins\n .map((plugin) => plugin.name)\n .sort()\n .filter((plugin) => !plugin.startsWith('@oclif/'))\n const shopifyPlugins = pluginNames.filter((plugin) => plugin.startsWith('@shopify/'))\n\n return {\n ...platformAndArch(),\n env_ci: ciPlatform.isCI,\n env_ci_platform: ciPlatform.name,\n env_plugin_installed_any_custom: pluginNames.length !== shopifyPlugins.length,\n env_plugin_installed_shopify: JSON.stringify(shopifyPlugins),\n env_shell: config.shell,\n env_web_ide: environment.local.webIDEPlatform(),\n }\n}\n"]}
@@ -17,5 +17,5 @@ export declare function sanitizedHeadersOutput(headers: {
17
17
  }): string;
18
18
  export declare function debugLogRequest<T>(api: string, query: RequestDocument, variables?: Variables, headers?: {
19
19
  [key: string]: string;
20
- }): Promise<void>;
20
+ }): void;
21
21
  export declare function handlingErrors<T>(api: string, action: () => Promise<T>): Promise<T>;
@@ -43,7 +43,7 @@ export function sanitizedHeadersOutput(headers) {
43
43
  })
44
44
  .join('\n');
45
45
  }
46
- export async function debugLogRequest(api, query, variables, headers = {}) {
46
+ export function debugLogRequest(api, query, variables, headers = {}) {
47
47
  debug(`
48
48
  Sending ${token.raw(api)} GraphQL request:
49
49
  ${query}
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/api/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,yBAAyB,CAAA;AACrD,OAAO,SAAS,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAC,gBAAgB,EAAE,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,cAAc,CAAA;AAC1F,O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M;gBACL,WAAW,GAAG,IAAI,KAAK,CAAC,YAAY,CAAC,CAAA;aACtC;YACD,WAAW,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAA;YAC/B,MAAM,WAAW,CAAA;SAClB;aAAM;YACL,MAAM,KAAK,CAAA;SACZ;KACF;AACH,CAAC","sourcesContent":["import {firstPartyDev} from '../environment/local.js'\nimport constants from '../constants.js'\nimport {stringifyMessage, content, token as outputToken, token, debug} from '../output.js'\nimport {Abort, ExtendableError} from '../error.js'\nimport {ClientError, RequestDocument, Variables} from 'graphql-request'\nimport {randomUUID} from 'crypto'\n\nexport class RequestClientError extends ExtendableError {\n statusCode: number\n public constructor(message: string, statusCode: number) {\n super(message)\n this.statusCode = statusCode\n }\n}\n\nexport async function buildHeaders(token: string): Promise<{[key: string]: string}> {\n const userAgent = `Shopify CLI; v=${await constants.versions.cliKit()}`\n\n const headers = {\n 'User-Agent': userAgent,\n // 'Sec-CH-UA': secCHUA, This header requires the Git sha.\n 'Sec-CH-UA-PLATFORM': process.platform,\n 'X-Request-Id': randomUUID(),\n authorization: `Bearer ${token}`,\n 'X-Shopify-Access-Token': `Bearer ${token}`,\n 'Content-Type': 'application/json',\n ...(firstPartyDev() && {'X-Shopify-Cli-Employee': '1'}),\n }\n\n return headers\n}\n\n/**\n * Removes the sensitive data from the headers and outputs them as a string.\n * @param headers {{[key: string]: string}} HTTP headers.\n * @returns {string} A sanitized version of the headers as a string.\n */\nexport function sanitizedHeadersOutput(headers: {[key: string]: string}): string {\n const sanitized: {[key: string]: string} = {}\n const keywords = ['token', 'authorization']\n Object.keys(headers).forEach((header) => {\n if (keywords.find((keyword) => header.toLocaleLowerCase().includes(keyword)) === undefined) {\n sanitized[header] = headers[header]\n }\n })\n return Object.keys(sanitized)\n .map((header) => {\n return ` - ${header}: ${sanitized[header]}`\n })\n .join('\\n')\n}\n\nexport async function debugLogRequest<T>(\n api: string,\n query: RequestDocument,\n variables?: Variables,\n headers: {[key: string]: string} = {},\n) {\n debug(`\nSending ${token.raw(api)} GraphQL request:\n${query}\n\nWith variables:\n${variables ? JSON.stringify(variables, null, 2) : ''}\n\nAnd headers:\n${sanitizedHeadersOutput(headers)}\n`)\n}\n\nexport async function handlingErrors<T>(api: string, action: () => Promise<T>): Promise<T> {\n try {\n return await action()\n } catch (error) {\n if (error instanceof ClientError) {\n const errorMessage = stringifyMessage(content`\n The ${token.raw(\n api,\n )} GraphQL API responded unsuccessfully with the HTTP status ${`${error.response.status}`} and errors:\n\n ${outputToken.json(error.response.errors)}\n `)\n let mappedError: Error\n if (error.response.status < 500) {\n mappedError = new RequestClientError(errorMessage, error.response.status)\n } else {\n mappedError = new Abort(errorMessage)\n }\n mappedError.stack = error.stack\n throw mappedError\n } else {\n throw error\n }\n }\n}\n"]}
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/api/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,yBAAyB,CAAA;AACrD,OAAO,SAAS,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAC,gBAAgB,EAAE,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,cAAc,CAAA;AAC1F,OAAO,EAAC,KAAK,EAAE,eAAe,EAAC,MAAM,aAAa,CAAA;AAClD,OAAO,EAAC,WAAW,EAA6B,MAAM,iBAAiB,CAAA;AACvE,OAAO,EAAC,UAAU,EAAC,MAAM,QAAQ,CAAA;AAEjC,MAAM,OAAO,kBAAmB,SAAQ,eAAe;IAErD,YAAmB,OAAe,EAAE,UAAkB;QACpD,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;IAC9B,CAAC;CACF;AAED,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,KAAa;IAC9C,MAAM,SAAS,GAAG,kBAAkB,MAAM,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAA;IAEvE,MAAM,OA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AAI,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;;;EAGnD,sBAAsB,CAAC,OAAO,CAAC;CAChC,CAAC,CAAA;AACF,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAAI,GAAW,EAAE,MAAwB;IAC3E,IAAI;QACF,OAAO,MAAM,MAAM,EAAE,CAAA;KACtB;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,KAAK,YAAY,WAAW,EAAE;YAChC,MAAM,YAAY,GAAG,gBAAgB,CAAC,OAAO,CAAA;QAC3C,KAAK,CAAC,GAAG,CACb,GAAG,CACJ,8DAA8D,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE;;IAEvF,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;OACpC,CAAC,CAAA;YACF,IAAI,WAAkB,CAAA;YACtB,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAG,GAAG,EAAE;gBAC/B,WAAW,GAAG,IAAI,kBAAkB,CAAC,YAAY,EAAE,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;aAC1E;iBAAM;gBACL,WAAW,GAAG,IAAI,KAAK,CAAC,YAAY,CAAC,CAAA;aACtC;YACD,WAAW,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAA;YAC/B,MAAM,WAAW,CAAA;SAClB;aAAM;YACL,MAAM,KAAK,CAAA;SACZ;KACF;AACH,CAAC","sourcesContent":["import {firstPartyDev} from '../environment/local.js'\nimport constants from '../constants.js'\nimport {stringifyMessage, content, token as outputToken, token, debug} from '../output.js'\nimport {Abort, ExtendableError} from '../error.js'\nimport {ClientError, RequestDocument, Variables} from 'graphql-request'\nimport {randomUUID} from 'crypto'\n\nexport class RequestClientError extends ExtendableError {\n statusCode: number\n public constructor(message: string, statusCode: number) {\n super(message)\n this.statusCode = statusCode\n }\n}\n\nexport async function buildHeaders(token: string): Promise<{[key: string]: string}> {\n const userAgent = `Shopify CLI; v=${await constants.versions.cliKit()}`\n\n const headers = {\n 'User-Agent': userAgent,\n // 'Sec-CH-UA': secCHUA, This header requires the Git sha.\n 'Sec-CH-UA-PLATFORM': process.platform,\n 'X-Request-Id': randomUUID(),\n authorization: `Bearer ${token}`,\n 'X-Shopify-Access-Token': `Bearer ${token}`,\n 'Content-Type': 'application/json',\n ...(firstPartyDev() && {'X-Shopify-Cli-Employee': '1'}),\n }\n\n return headers\n}\n\n/**\n * Removes the sensitive data from the headers and outputs them as a string.\n * @param headers {{[key: string]: string}} HTTP headers.\n * @returns {string} A sanitized version of the headers as a string.\n */\nexport function sanitizedHeadersOutput(headers: {[key: string]: string}): string {\n const sanitized: {[key: string]: string} = {}\n const keywords = ['token', 'authorization']\n Object.keys(headers).forEach((header) => {\n if (keywords.find((keyword) => header.toLocaleLowerCase().includes(keyword)) === undefined) {\n sanitized[header] = headers[header]\n }\n })\n return Object.keys(sanitized)\n .map((header) => {\n return ` - ${header}: ${sanitized[header]}`\n })\n .join('\\n')\n}\n\nexport function debugLogRequest<T>(\n api: string,\n query: RequestDocument,\n variables?: Variables,\n headers: {[key: string]: string} = {},\n) {\n debug(`\nSending ${token.raw(api)} GraphQL request:\n${query}\n\nWith variables:\n${variables ? JSON.stringify(variables, null, 2) : ''}\n\nAnd headers:\n${sanitizedHeadersOutput(headers)}\n`)\n}\n\nexport async function handlingErrors<T>(api: string, action: () => Promise<T>): Promise<T> {\n try {\n return await action()\n } catch (error) {\n if (error instanceof ClientError) {\n const errorMessage = stringifyMessage(content`\n The ${token.raw(\n api,\n )} GraphQL API responded unsuccessfully with the HTTP status ${`${error.response.status}`} and errors:\n\n ${outputToken.json(error.response.errors)}\n `)\n let mappedError: Error\n if (error.response.status < 500) {\n mappedError = new RequestClientError(errorMessage, error.response.status)\n } else {\n mappedError = new Abort(errorMessage)\n }\n mappedError.stack = error.stack\n throw mappedError\n } else {\n throw error\n }\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"extension_specifications.js","sourceRoot":"","sources":["../../../src/api/graphql/extension_specifications.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,iBAAiB,CAAA;AAEnC,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;CAe9C,CAAA","sourcesContent":["import {gql} from 'graphql-request'\n\nexport const ExtensionSpecificationsQuery = gql`\n query fetchSpecifications($api_key: String!) {\n extensionSpecifications(apiKey: $api_key) {\n name\n identifier\n options {\n managementExperience\n }\n features {\n argo {\n surface\n }\n }\n }\n }\n`\n\nexport interface ExtensionSpecificationsQueryVariables {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n api_key: string\n}\n\nexport interface ExtensionSpecificationsQuerySchema {\n extensionSpecifications: {\n name: string\n identifier: string\n options: {\n managementExperience: 'cli' | 'custom' | 'dashboard'\n }[]\n features?: {\n argo?: {\n surface: string\n }\n }\n }[]\n}\n"]}
1
+ {"version":3,"file":"extension_specifications.js","sourceRoot":"","sources":["../../../src/api/graphql/extension_specifications.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,iBAAiB,CAAA;AAEnC,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;CAe9C,CAAA","sourcesContent":["import {gql} from 'graphql-request'\n\nexport const ExtensionSpecificationsQuery = gql`\n query fetchSpecifications($api_key: String!) {\n extensionSpecifications(apiKey: $api_key) {\n name\n identifier\n options {\n managementExperience\n }\n features {\n argo {\n surface\n }\n }\n }\n }\n`\n\nexport interface ExtensionSpecificationsQueryVariables {\n api_key: string\n}\n\nexport interface ExtensionSpecificationsQuerySchema {\n extensionSpecifications: {\n name: string\n identifier: string\n options: {\n managementExperience: 'cli' | 'custom' | 'dashboard'\n }[]\n features?: {\n argo?: {\n surface: string\n }\n }\n }[]\n}\n"]}
@@ -1,43 +1,29 @@
1
1
  export declare const AppFunctionSetMutation: string;
2
2
  export interface AppFunctionSetMutationSchema {
3
3
  data: {
4
- appScriptSet: {
4
+ functionSet: {
5
5
  userErrors: {
6
6
  field: string;
7
7
  message: string;
8
8
  tag: string;
9
9
  }[];
10
- appScript?: {
11
- uuid: string;
12
- appKey: string;
13
- configSchema: unknown;
14
- extensionPointName: string;
15
- title: string;
10
+ function?: {
11
+ id: string;
16
12
  };
17
13
  };
18
14
  };
19
15
  }
20
16
  export interface AppFunctionSetVariables {
21
- uuid?: string;
22
- extensionPointName: string;
17
+ id?: string;
18
+ legacyUuid?: string;
23
19
  title: string;
24
20
  description?: string;
25
- force?: boolean;
26
- schemaMajorVersion?: string;
27
- schemaMinorVersion?: string;
28
- scriptConfigVersion?: string;
29
- configurationUi: boolean;
30
- configurationDefinition?: string;
31
- moduleUploadUrl: string;
32
- library?: {
33
- language: string;
34
- version: string;
35
- };
21
+ apiType: string;
22
+ apiVersion?: string;
23
+ inputQuery?: string;
36
24
  appBridge?: {
37
25
  createPath?: string;
38
26
  detailsPath?: string;
39
27
  };
40
- inputQuery?: string;
41
- apiVersion?: string;
42
- skipCompilationJob: boolean;
28
+ moduleUploadUrl: string;
43
29
  }
@@ -1,49 +1,40 @@
1
1
  import { gql } from 'graphql-request';
2
2
  export const AppFunctionSetMutation = gql `
3
- mutation AppScriptSet(
4
- $uuid: String
5
- $extensionPointName: ExtensionPointName!
3
+ mutation FunctionSet(
4
+ $id: FunctionId
5
+ $legacyUuid: String
6
6
  $title: String!
7
7
  $description: String
8
- $force: Boolean
9
- $schemaMajorVersion: String
10
- $schemaMinorVersion: String
11
- $scriptConfigVersion: String
12
- $configurationUi: Boolean!
13
- $configurationDefinition: String
14
- $moduleUploadUrl: String!
15
- $library: LibraryInput
8
+ $apiType: String!
9
+ $apiVersion: String!
16
10
  $inputQuery: String
17
11
  $appBridge: AppBridgeInput
18
- $apiVersion: String
12
+ $moduleUploadUrl: String!
19
13
  ) {
20
- appScriptSet(
21
- uuid: $uuid
22
- extensionPointName: $extensionPointName
14
+ functionSet(
15
+ id: $id
16
+ legacyUuid: $legacyUuid
23
17
  title: $title
24
18
  description: $description
25
- force: $force
26
- schemaMajorVersion: $schemaMajorVersion
27
- schemaMinorVersion: $schemaMinorVersion
28
- scriptConfigVersion: $scriptConfigVersion
29
- configurationUi: $configurationUi
30
- configurationDefinition: $configurationDefinition
31
- moduleUploadUrl: $moduleUploadUrl
32
- library: $library
19
+ apiType: $apiType
20
+ apiVersion: $apiVersion
33
21
  inputQuery: $inputQuery
34
22
  appBridge: $appBridge
35
- apiVersion: $apiVersion
23
+ moduleUploadUrl: $moduleUploadUrl
36
24
  ) {
37
25
  userErrors {
38
26
  field
39
27
  message
40
28
  tag
41
29
  }
42
- appScript {
30
+ function {
31
+ id
43
32
  uuid
44
33
  appKey
45
- configSchema
46
- extensionPointName
34
+ configuration {
35
+ schema
36
+ }
37
+ apiType
47
38
  title
48
39
  }
49
40
  }
@@ -1 +1 @@
1
- {"version":3,"file":"app_function_set.js","sourceRoot":"","sources":["../../../../src/api/graphql/functions/app_function_set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,iBAAiB,CAAA;AAEnC,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiDxC,CAAA","sourcesContent":["import {gql} from 'graphql-request'\n\nexport const AppFunctionSetMutation = gql`\n mutation AppScriptSet(\n $uuid: String\n $extensionPointName: ExtensionPointName!\n $title: String!\n $description: String\n $force: Boolean\n $schemaMajorVersion: String\n $schemaMinorVersion: String\n $scriptConfigVersion: String\n $configurationUi: Boolean!\n $configurationDefinition: String\n $moduleUploadUrl: String!\n $library: LibraryInput\n $inputQuery: String\n $appBridge: AppBridgeInput\n $apiVersion: String\n ) {\n appScriptSet(\n uuid: $uuid\n extensionPointName: $extensionPointName\n title: $title\n description: $description\n force: $force\n schemaMajorVersion: $schemaMajorVersion\n schemaMinorVersion: $schemaMinorVersion\n scriptConfigVersion: $scriptConfigVersion\n configurationUi: $configurationUi\n configurationDefinition: $configurationDefinition\n moduleUploadUrl: $moduleUploadUrl\n library: $library\n inputQuery: $inputQuery\n appBridge: $appBridge\n apiVersion: $apiVersion\n ) {\n userErrors {\n field\n message\n tag\n }\n appScript {\n uuid\n appKey\n configSchema\n extensionPointName\n title\n }\n }\n }\n`\n\nexport interface AppFunctionSetMutationSchema {\n data: {\n appScriptSet: {\n userErrors: {\n field: string\n message: string\n tag: string\n }[]\n appScript?: {\n uuid: string\n appKey: string\n configSchema: unknown\n extensionPointName: string\n title: string\n }\n }\n }\n}\n\nexport interface AppFunctionSetVariables {\n uuid?: string\n extensionPointName: string\n title: string\n description?: string\n force?: boolean\n schemaMajorVersion?: string\n schemaMinorVersion?: string\n scriptConfigVersion?: string\n configurationUi: boolean\n configurationDefinition?: string\n moduleUploadUrl: string\n library?: {\n language: string\n version: string\n }\n appBridge?: {\n createPath?: string\n detailsPath?: string\n }\n inputQuery?: string\n apiVersion?: string\n skipCompilationJob: boolean\n}\n"]}
1
+ {"version":3,"file":"app_function_set.js","sourceRoot":"","sources":["../../../../src/api/graphql/functions/app_function_set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,iBAAiB,CAAA;AAEnC,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCxC,CAAA","sourcesContent":["import {gql} from 'graphql-request'\n\nexport const AppFunctionSetMutation = gql`\n mutation FunctionSet(\n $id: FunctionId\n $legacyUuid: String\n $title: String!\n $description: String\n $apiType: String!\n $apiVersion: String!\n $inputQuery: String\n $appBridge: AppBridgeInput\n $moduleUploadUrl: String!\n ) {\n functionSet(\n id: $id\n legacyUuid: $legacyUuid\n title: $title\n description: $description\n apiType: $apiType\n apiVersion: $apiVersion\n inputQuery: $inputQuery\n appBridge: $appBridge\n moduleUploadUrl: $moduleUploadUrl\n ) {\n userErrors {\n field\n message\n tag\n }\n function {\n id\n uuid\n appKey\n configuration {\n schema\n }\n apiType\n title\n }\n }\n }\n`\n\nexport interface AppFunctionSetMutationSchema {\n data: {\n functionSet: {\n userErrors: {\n field: string\n message: string\n tag: string\n }[]\n function?: {\n id: string\n }\n }\n }\n}\n\nexport interface AppFunctionSetVariables {\n id?: string\n legacyUuid?: string\n title: string\n description?: string\n apiType: string\n apiVersion?: string\n inputQuery?: string\n appBridge?: {\n createPath?: string\n detailsPath?: string\n }\n moduleUploadUrl: string\n}\n"]}
@@ -0,0 +1,12 @@
1
+ export declare const UploadUrlGenerateMutation: string;
2
+ export interface UploadUrlGenerateMutationSchema {
3
+ data: {
4
+ uploadUrlGenerate: {
5
+ url: string;
6
+ headers: {
7
+ [key: string]: string;
8
+ };
9
+ maxSize: string;
10
+ };
11
+ };
12
+ }
@@ -0,0 +1,11 @@
1
+ import { gql } from 'graphql-request';
2
+ export const UploadUrlGenerateMutation = gql `
3
+ mutation uploadUrlGenerate {
4
+ uploadUrlGenerate {
5
+ url
6
+ headers
7
+ maxSize
8
+ }
9
+ }
10
+ `;
11
+ //# sourceMappingURL=upload_url_generate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload_url_generate.js","sourceRoot":"","sources":["../../../../src/api/graphql/functions/upload_url_generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,iBAAiB,CAAA;AAEnC,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,CAAA;;;;;;;;CAQ3C,CAAA","sourcesContent":["import {gql} from 'graphql-request'\n\nexport const UploadUrlGenerateMutation = gql`\n mutation uploadUrlGenerate {\n uploadUrlGenerate {\n url\n headers\n maxSize\n }\n }\n`\n\nexport interface UploadUrlGenerateMutationSchema {\n data: {\n uploadUrlGenerate: {\n url: string\n headers: {[key: string]: string}\n maxSize: string\n }\n }\n}\n"]}
@@ -14,7 +14,7 @@ export * from './all_app_extension_registrations.js';
14
14
  export * from './get_variant_id.js';
15
15
  export * from './functions/function_service_proxy.js';
16
16
  export * from './functions/get_app_functions.js';
17
- export * from './functions/module_upload_url_generate.js';
17
+ export * from './functions/upload_url_generate.js';
18
18
  export * from './functions/app_function_set.js';
19
19
  export * from './functions/compile_module.js';
20
20
  export * from './functions/module_compilation_status.js';
@@ -14,7 +14,7 @@ export * from './all_app_extension_registrations.js';
14
14
  export * from './get_variant_id.js';
15
15
  export * from './functions/function_service_proxy.js';
16
16
  export * from './functions/get_app_functions.js';
17
- export * from './functions/module_upload_url_generate.js';
17
+ export * from './functions/upload_url_generate.js';
18
18
  export * from './functions/app_function_set.js';
19
19
  export * from './functions/compile_module.js';
20
20
  export * from './functions/module_compilation_status.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/graphql/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,wBAAwB,CAAA;AACtC,cAAc,wBAAwB,CAAA;AACtC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,uBAAuB,CAAA;AACrC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,sCAAsC,CAAA;AACpD,cAAc,qBAAqB,CAAA;AACnC,cAAc,uCAAuC,CAAA;AACrD,cAAc,kCAAkC,CAAA;AAChD,cAAc,2CAA2C,CAAA;AACzD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,0CAA0C,CAAA;AACxD,cAAc,qBAAqB,CAAA;AACnC,cAAc,2BAA2B,CAAA","sourcesContent":["export * from './find_org.js'\nexport * from './all_orgs.js'\nexport * from './create_app.js'\nexport * from './update_urls.js'\nexport * from './find_app.js'\nexport * from './update_draft.js'\nexport * from './generate_signed_upload_url.js'\nexport * from './create_deployment.js'\nexport * from './all_stores_by_org.js'\nexport * from './convert_dev_to_test_store.js'\nexport * from './extension_create.js'\nexport * from './extension_specifications.js'\nexport * from './all_app_extension_registrations.js'\nexport * from './get_variant_id.js'\nexport * from './functions/function_service_proxy.js'\nexport * from './functions/get_app_functions.js'\nexport * from './functions/module_upload_url_generate.js'\nexport * from './functions/app_function_set.js'\nexport * from './functions/compile_module.js'\nexport * from './functions/module_compilation_status.js'\nexport * from './find_org_basic.js'\nexport * from './find_store_by_domain.js'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/graphql/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,wBAAwB,CAAA;AACtC,cAAc,wBAAwB,CAAA;AACtC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,uBAAuB,CAAA;AACrC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,sCAAsC,CAAA;AACpD,cAAc,qBAAqB,CAAA;AACnC,cAAc,uCAAuC,CAAA;AACrD,cAAc,kCAAkC,CAAA;AAChD,cAAc,oCAAoC,CAAA;AAClD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,0CAA0C,CAAA;AACxD,cAAc,qBAAqB,CAAA;AACnC,cAAc,2BAA2B,CAAA","sourcesContent":["export * from './find_org.js'\nexport * from './all_orgs.js'\nexport * from './create_app.js'\nexport * from './update_urls.js'\nexport * from './find_app.js'\nexport * from './update_draft.js'\nexport * from './generate_signed_upload_url.js'\nexport * from './create_deployment.js'\nexport * from './all_stores_by_org.js'\nexport * from './convert_dev_to_test_store.js'\nexport * from './extension_create.js'\nexport * from './extension_specifications.js'\nexport * from './all_app_extension_registrations.js'\nexport * from './get_variant_id.js'\nexport * from './functions/function_service_proxy.js'\nexport * from './functions/get_app_functions.js'\nexport * from './functions/upload_url_generate.js'\nexport * from './functions/app_function_set.js'\nexport * from './functions/compile_module.js'\nexport * from './functions/module_compilation_status.js'\nexport * from './find_org_basic.js'\nexport * from './find_store_by_domain.js'\n"]}
@@ -1,7 +1,7 @@
1
1
  declare const constants: {
2
2
  environmentVariables: {
3
3
  unitTest: string;
4
- shopifyConfig: string;
4
+ env: string;
5
5
  runAsUser: string;
6
6
  partnersEnv: string;
7
7
  shopifyEnv: string;
@@ -14,7 +14,9 @@ declare const constants: {
14
14
  partnersToken: string;
15
15
  verbose: string;
16
16
  noAnalytics: string;
17
+ alwaysLogAnalytics: string;
17
18
  firstPartyDev: string;
19
+ debugGoBinary: string;
18
20
  };
19
21
  paths: {
20
22
  executables: {
package/dist/constants.js CHANGED
@@ -10,7 +10,7 @@ const cacheFolder = () => {
10
10
  const constants = {
11
11
  environmentVariables: {
12
12
  unitTest: 'SHOPIFY_UNIT_TEST',
13
- shopifyConfig: 'SHOPIFY_CONFIG',
13
+ env: 'SHOPIFY_ENV',
14
14
  runAsUser: 'SHOPIFY_RUN_AS_USER',
15
15
  partnersEnv: 'SHOPIFY_PARTNERS_ENV',
16
16
  shopifyEnv: 'SHOPIFY_SHOPIFY_ENV',
@@ -23,7 +23,9 @@ const constants = {
23
23
  partnersToken: 'SHOPIFY_CLI_PARTNERS_TOKEN',
24
24
  verbose: 'SHOPIFY_FLAG_VERBOSE',
25
25
  noAnalytics: 'SHOPIFY_CLI_NO_ANALYTICS',
26
+ alwaysLogAnalytics: 'SHOPIFY_CLI_ALWAYS_LOG_ANALYTICS',
26
27
  firstPartyDev: 'SHOPIFY_CLI_1P_DEV',
28
+ debugGoBinary: 'SHOPIFY_DEBUG_GO_BINARY',
27
29
  },
28
30
  paths: {
29
31
  executables: {
@@ -1 +1 @@
1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b,OAAO,QAAQ,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAA;oBACtD,CAAC;iBACF;aACF;SACF;KACF;IACD,QAAQ,EAAE;QACR,MAAM,EAAE,KAAK,IAAI,EAAE;YACjB,OAAO,oBAAoB,CAAC,EAAC,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,EAAC,CAAC,CAAA;QAC/D,CAAC;KACF;IACD,QAAQ,EAAE;QACR,OAAO,EAAE,aAAa;KACvB;IACD,OAAO,EAAE;QACP,6BAA6B,EAAE,CAAC;KACjC;CACF,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,kCAAkC,CAAA;AAE/D,eAAe,SAAS,CAAA","sourcesContent":["import {join as pathJoin} from './path.js'\nimport {findPackageVersionUp} from './version.js'\nimport envPaths from 'env-paths'\n\nconst identifier = 'shopify-cli'\n\nconst cacheFolder = () => {\n if (process.env.XDG_CACHE_HOME) return process.env.XDG_CACHE_HOME\n return envPaths(identifier).cache\n}\n\nconst constants = {\n environmentVariables: {\n unitTest: 'SHOPIFY_UNIT_TEST',\n shopifyConfig: 'SHOPIFY_CONFIG',\n runAsUser: 'SHOPIFY_RUN_AS_USER',\n partnersEnv: 'SHOPIFY_PARTNERS_ENV',\n shopifyEnv: 'SHOPIFY_SHOPIFY_ENV',\n identityEnv: 'SHOPIFY_IDENTITY_ENV',\n spin: 'SPIN',\n spinInstance: 'SPIN_INSTANCE',\n spinWorkspace: 'SPIN_WORKSPACE',\n spinNamespace: 'SPIN_NAMESPACE',\n spinHost: 'SPIN_HOST',\n partnersToken: 'SHOPIFY_CLI_PARTNERS_TOKEN',\n verbose: 'SHOPIFY_FLAG_VERBOSE',\n noAnalytics: 'SHOPIFY_CLI_NO_ANALYTICS',\n firstPartyDev: 'SHOPIFY_CLI_1P_DEV',\n },\n paths: {\n executables: {\n dev: '/opt/dev/bin/dev',\n },\n directories: {\n cache: {\n path: () => {\n return cacheFolder()\n },\n vendor: {\n path: () => {\n return pathJoin(cacheFolder(), 'vendor')\n },\n binaries: () => {\n return pathJoin(cacheFolder(), 'vendor', 'binaries')\n },\n },\n },\n },\n },\n versions: {\n cliKit: async () => {\n return findPackageVersionUp({fromModuleURL: import.meta.url})\n },\n },\n keychain: {\n service: 'shopify-cli',\n },\n session: {\n expirationTimeMarginInMinutes: 4,\n },\n}\n\nexport const bugsnagApiKey = '9e1e6889176fd0c795d5c659225e0fae'\n\nexport default constants\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,IAAI,QAAQ,EAAC,MAAM,WAAW,CAAA;AAC1C,OAAO,EAAC,oBAAoB,EAAC,MAAM,cAAc,CAAA;AACjD,OAAO,QAAQ,MAAM,WAAW,CAAA;AAEhC,MAAM,UAAU,GAAG,aAAa,CAAA;AAEhC,MAAM,WAAW,GAAG,GAAG,EAAE;IACvB,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc;QAAE,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,CAAA;IACjE,OAAO,QAAQ,CAAC,UAAU,CAAC,CAAC,KAAK,CAAA;AACnC,CAAC,CAAA;AAED,MAAM,SAAS,GAAG;IAChB,oBAAoB,EAAE;QACpB,QAAQ,EAAE,mBAAmB;QAC7B,GAAG,EAAE,aAAa;QAClB,SAAS,EAAE,qBAAqB;QAChC,WAAW,EAAE,sBAAsB;QACnC,UAAU,EAAE,qBAAqB;QACjC,WAAW,EAAE,sBAAsB;QACnC,IAAI,EAAE,MAAM;QACZ,YAAY,EAAE,eAAe;QAC7B,aAAa,EAAE,gBAAgB;QAC/B,aAAa,EAAE,gBAAgB;QAC/B,QAAQ,EAAE,WAAW;QACrB,aAAa,EAAE,4BAA4B;QAC3C,OAAO,EAAE,sBAAsB;QAC/B,WAAW,EAAE,0BAA0B;QACvC,kBAAkB,EAAE,kCAAkC;QACtD,aAAa,EAAE,oBAAoB;QACnC,aAAa,EAAE,yBAAyB;KACzC;IACD,KAAK,EAAE;QACL,WAAW,EAAE;YACX,GAAG,EAAE,kBAAkB;SACxB;QACD,WAAW,EAAE;YACX,KAAK,EAAE;gBACL,IAAI,EAAE,GAAG,EAAE;oBACT,OAAO,WAAW,EAAE,CAAA;gBACtB,CAAC;gBACD,MAAM,EAAE;oBACN,IAAI,EAAE,GAAG,EAAE;wBACT,OAAO,QAAQ,CAAC,WAAW,EAAE,EAAE,QAAQ,CAAC,CAAA;oBAC1C,CAAC;oBACD,QAAQ,EAAE,GAAG,EAAE;wBACb,OAAO,QAAQ,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAA;oBACtD,CAAC;iBACF;aACF;SACF;KACF;IACD,QAAQ,EAAE;QACR,MAAM,EAAE,KAAK,IAAI,EAAE;YACjB,OAAO,oBAAoB,CAAC,EAAC,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,EAAC,CAAC,CAAA;QAC/D,CAAC;KACF;IACD,QAAQ,EAAE;QACR,OAAO,EAAE,aAAa;KACvB;IACD,OAAO,EAAE;QACP,6BAA6B,EAAE,CAAC;KACjC;CACF,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,kCAAkC,CAAA;AAE/D,eAAe,SAAS,CAAA","sourcesContent":["import {join as pathJoin} from './path.js'\nimport {findPackageVersionUp} from './version.js'\nimport envPaths from 'env-paths'\n\nconst identifier = 'shopify-cli'\n\nconst cacheFolder = () => {\n if (process.env.XDG_CACHE_HOME) return process.env.XDG_CACHE_HOME\n return envPaths(identifier).cache\n}\n\nconst constants = {\n environmentVariables: {\n unitTest: 'SHOPIFY_UNIT_TEST',\n env: 'SHOPIFY_ENV',\n runAsUser: 'SHOPIFY_RUN_AS_USER',\n partnersEnv: 'SHOPIFY_PARTNERS_ENV',\n shopifyEnv: 'SHOPIFY_SHOPIFY_ENV',\n identityEnv: 'SHOPIFY_IDENTITY_ENV',\n spin: 'SPIN',\n spinInstance: 'SPIN_INSTANCE',\n spinWorkspace: 'SPIN_WORKSPACE',\n spinNamespace: 'SPIN_NAMESPACE',\n spinHost: 'SPIN_HOST',\n partnersToken: 'SHOPIFY_CLI_PARTNERS_TOKEN',\n verbose: 'SHOPIFY_FLAG_VERBOSE',\n noAnalytics: 'SHOPIFY_CLI_NO_ANALYTICS',\n alwaysLogAnalytics: 'SHOPIFY_CLI_ALWAYS_LOG_ANALYTICS',\n firstPartyDev: 'SHOPIFY_CLI_1P_DEV',\n debugGoBinary: 'SHOPIFY_DEBUG_GO_BINARY',\n },\n paths: {\n executables: {\n dev: '/opt/dev/bin/dev',\n },\n directories: {\n cache: {\n path: () => {\n return cacheFolder()\n },\n vendor: {\n path: () => {\n return pathJoin(cacheFolder(), 'vendor')\n },\n binaries: () => {\n return pathJoin(cacheFolder(), 'vendor', 'binaries')\n },\n },\n },\n },\n },\n versions: {\n cliKit: async () => {\n return findPackageVersionUp({fromModuleURL: import.meta.url})\n },\n },\n keychain: {\n service: 'shopify-cli',\n },\n session: {\n expirationTimeMarginInMinutes: 4,\n },\n}\n\nexport const bugsnagApiKey = '9e1e6889176fd0c795d5c659225e0fae'\n\nexport default constants\n"]}
@@ -12,9 +12,9 @@ export declare function homeDirectory(): string;
12
12
  /**
13
13
  * Returns true if the CLI is running in debug mode.
14
14
  * @param env The environment variables from the environment of the current process.
15
- * @returns true if SHOPIFY_CONFIG is debug
15
+ * @returns true if SHOPIFY_ENV is development
16
16
  */
17
- export declare function isDebug(env?: NodeJS.ProcessEnv): boolean;
17
+ export declare function isDevelopment(env?: NodeJS.ProcessEnv): boolean;
18
18
  /**
19
19
  * Returns true if the CLI is running in verbose mode.
20
20
  * @param env The environment variables from the environment of the current process.
@@ -41,9 +41,26 @@ export declare function isUnitTest(env?: NodeJS.ProcessEnv): boolean;
41
41
  * @returns true unless SHOPIFY_CLI_NO_ANALYTICS is truthy or debug mode is enabled.
42
42
  */
43
43
  export declare function analyticsDisabled(env?: NodeJS.ProcessEnv): boolean;
44
+ /** Returns true if reporting analytics should always happen, regardless of DEBUG mode etc. */
45
+ export declare function alwaysLogAnalytics(env?: NodeJS.ProcessEnv): boolean;
44
46
  export declare function firstPartyDev(env?: NodeJS.ProcessEnv): boolean;
47
+ export declare function isDebugGoBinary(env?: NodeJS.ProcessEnv): boolean;
45
48
  /**
46
49
  * Returns whether the environment has Git available.
47
50
  * @returns {Promise<boolean>} A promise that resolves with the value.
48
51
  */
49
52
  export declare function hasGit(): Promise<boolean>;
53
+ /**
54
+ * Gets info on the CI platform the CLI is running on, if applicable
55
+ */
56
+ export declare function ciPlatform(env?: NodeJS.ProcessEnv): {
57
+ isCI: true;
58
+ name: string;
59
+ } | {
60
+ isCI: false;
61
+ name?: undefined;
62
+ };
63
+ /**
64
+ * Gets info on the Web IDE platform the CLI is running on, if applicable
65
+ */
66
+ export declare function webIDEPlatform(env?: NodeJS.ProcessEnv): "codespaces" | undefined;
@@ -1,4 +1,4 @@
1
- import { isTruthy } from './utilities.js';
1
+ import { isTruthy, isSet } from './utilities.js';
2
2
  import { isSpin } from './spin.js';
3
3
  import constants from '../constants.js';
4
4
  import { exists as fileExists } from '../file.js';
@@ -22,10 +22,10 @@ export function homeDirectory() {
22
22
  /**
23
23
  * Returns true if the CLI is running in debug mode.
24
24
  * @param env The environment variables from the environment of the current process.
25
- * @returns true if SHOPIFY_CONFIG is debug
25
+ * @returns true if SHOPIFY_ENV is development
26
26
  */
27
- export function isDebug(env = process.env) {
28
- return env[constants.environmentVariables.shopifyConfig] === 'debug';
27
+ export function isDevelopment(env = process.env) {
28
+ return env[constants.environmentVariables.env] === 'development';
29
29
  }
30
30
  /**
31
31
  * Returns true if the CLI is running in verbose mode.
@@ -63,11 +63,18 @@ export function isUnitTest(env = process.env) {
63
63
  * @returns true unless SHOPIFY_CLI_NO_ANALYTICS is truthy or debug mode is enabled.
64
64
  */
65
65
  export function analyticsDisabled(env = process.env) {
66
- return isTruthy(env[constants.environmentVariables.noAnalytics]) || isDebug(env);
66
+ return isTruthy(env[constants.environmentVariables.noAnalytics]) || isDevelopment(env);
67
+ }
68
+ /** Returns true if reporting analytics should always happen, regardless of DEBUG mode etc. */
69
+ export function alwaysLogAnalytics(env = process.env) {
70
+ return isTruthy(env[constants.environmentVariables.alwaysLogAnalytics]);
67
71
  }
68
72
  export function firstPartyDev(env = process.env) {
69
73
  return isTruthy(env[constants.environmentVariables.firstPartyDev]);
70
74
  }
75
+ export function isDebugGoBinary(env = process.env) {
76
+ return isTruthy(env[constants.environmentVariables.debugGoBinary]);
77
+ }
71
78
  /**
72
79
  * Returns whether the environment has Git available.
73
80
  * @returns {Promise<boolean>} A promise that resolves with the value.
@@ -82,4 +89,37 @@ export async function hasGit() {
82
89
  return false;
83
90
  }
84
91
  }
92
+ /**
93
+ * Gets info on the CI platform the CLI is running on, if applicable
94
+ */
95
+ export function ciPlatform(env = process.env) {
96
+ if (isTruthy(env.CI)) {
97
+ let name = 'unknown';
98
+ if (isTruthy(env.CIRCLECI)) {
99
+ name = 'circleci';
100
+ }
101
+ else if (isSet(env.GITHUB_ACTION)) {
102
+ name = 'github';
103
+ }
104
+ else if (isTruthy(env.GITLAB_CI)) {
105
+ name = 'gitlab';
106
+ }
107
+ return {
108
+ isCI: true,
109
+ name,
110
+ };
111
+ }
112
+ return {
113
+ isCI: false,
114
+ };
115
+ }
116
+ /**
117
+ * Gets info on the Web IDE platform the CLI is running on, if applicable
118
+ */
119
+ export function webIDEPlatform(env = process.env) {
120
+ if (isTruthy(env.CODESPACES)) {
121
+ return 'codespaces';
122
+ }
123
+ return undefined;
124
+ }
85
125
  //# sourceMappingURL=local.js.map