@shopify/cli-kit 3.16.3 → 3.17.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.
Files changed (154) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/dist/analytics.d.ts +5 -5
  4. package/dist/analytics.js +5 -5
  5. package/dist/analytics.js.map +1 -1
  6. package/dist/api/common.d.ts +2 -2
  7. package/dist/api/common.js +2 -2
  8. package/dist/api/common.js.map +1 -1
  9. package/dist/api/graphql/index.d.ts +0 -2
  10. package/dist/api/graphql/index.js +0 -2
  11. package/dist/api/graphql/index.js.map +1 -1
  12. package/dist/api/oxygen.d.ts +5 -0
  13. package/dist/api/oxygen.js +30 -0
  14. package/dist/api/oxygen.js.map +1 -0
  15. package/dist/api/partners.d.ts +7 -7
  16. package/dist/api/partners.js +7 -7
  17. package/dist/api/partners.js.map +1 -1
  18. package/dist/api.d.ts +2 -2
  19. package/dist/api.js +2 -2
  20. package/dist/api.js.map +1 -1
  21. package/dist/common/object.d.ts +3 -3
  22. package/dist/common/object.js +3 -3
  23. package/dist/common/object.js.map +1 -1
  24. package/dist/environment/fqdn.d.ts +3 -3
  25. package/dist/environment/fqdn.js +3 -3
  26. package/dist/environment/fqdn.js.map +1 -1
  27. package/dist/environment/local.d.ts +13 -13
  28. package/dist/environment/local.js +16 -16
  29. package/dist/environment/local.js.map +1 -1
  30. package/dist/environment/spin.d.ts +12 -12
  31. package/dist/environment/spin.js +12 -12
  32. package/dist/environment/spin.js.map +1 -1
  33. package/dist/environment/utilities.d.ts +0 -2
  34. package/dist/environment/utilities.js +0 -2
  35. package/dist/environment/utilities.js.map +1 -1
  36. package/dist/error.d.ts +1 -1
  37. package/dist/error.js +1 -1
  38. package/dist/error.js.map +1 -1
  39. package/dist/file.d.ts +17 -18
  40. package/dist/file.js +17 -18
  41. package/dist/file.js.map +1 -1
  42. package/dist/git.d.ts +1 -1
  43. package/dist/git.js +2 -2
  44. package/dist/git.js.map +1 -1
  45. package/dist/http/fetch.d.ts +2 -2
  46. package/dist/http/fetch.js +2 -2
  47. package/dist/http/fetch.js.map +1 -1
  48. package/dist/http.d.ts +1 -1
  49. package/dist/http.js +1 -1
  50. package/dist/http.js.map +1 -1
  51. package/dist/id.d.ts +1 -1
  52. package/dist/id.js +1 -1
  53. package/dist/id.js.map +1 -1
  54. package/dist/network/service.d.ts +0 -2
  55. package/dist/network/service.js +0 -1
  56. package/dist/network/service.js.map +1 -1
  57. package/dist/node/archiver.d.ts +2 -2
  58. package/dist/node/archiver.js +2 -2
  59. package/dist/node/archiver.js.map +1 -1
  60. package/dist/node/checksum.d.ts +2 -2
  61. package/dist/node/checksum.js +2 -2
  62. package/dist/node/checksum.js.map +1 -1
  63. package/dist/node/cli.d.ts +1 -2
  64. package/dist/node/cli.js +1 -7
  65. package/dist/node/cli.js.map +1 -1
  66. package/dist/node/dot-env.d.ts +7 -7
  67. package/dist/node/dot-env.js +7 -7
  68. package/dist/node/dot-env.js.map +1 -1
  69. package/dist/node/framework.d.ts +2 -2
  70. package/dist/node/framework.js +2 -2
  71. package/dist/node/framework.js.map +1 -1
  72. package/dist/node/hooks/prerun.js +6 -6
  73. package/dist/node/hooks/prerun.js.map +1 -1
  74. package/dist/node/node-package-manager.d.ts +32 -28
  75. package/dist/node/node-package-manager.js +29 -29
  76. package/dist/node/node-package-manager.js.map +1 -1
  77. package/dist/node/ruby.d.ts +4 -4
  78. package/dist/node/ruby.js +5 -5
  79. package/dist/node/ruby.js.map +1 -1
  80. package/dist/os.d.ts +1 -1
  81. package/dist/os.js +1 -1
  82. package/dist/os.js.map +1 -1
  83. package/dist/output.d.ts +18 -20
  84. package/dist/output.js +23 -25
  85. package/dist/output.js.map +1 -1
  86. package/dist/path.d.ts +4 -4
  87. package/dist/path.js +4 -4
  88. package/dist/path.js.map +1 -1
  89. package/dist/plugins.d.ts +4 -4
  90. package/dist/plugins.js +4 -4
  91. package/dist/plugins.js.map +1 -1
  92. package/dist/port.d.ts +1 -1
  93. package/dist/port.js +1 -1
  94. package/dist/port.js.map +1 -1
  95. package/dist/public/common/array.d.ts +4 -4
  96. package/dist/public/common/array.js +4 -4
  97. package/dist/public/common/array.js.map +1 -1
  98. package/dist/secure-store.d.ts +4 -4
  99. package/dist/secure-store.js +4 -4
  100. package/dist/secure-store.js.map +1 -1
  101. package/dist/session/device-authorization.d.ts +5 -5
  102. package/dist/session/device-authorization.js +5 -5
  103. package/dist/session/device-authorization.js.map +1 -1
  104. package/dist/session/exchange.d.ts +10 -16
  105. package/dist/session/exchange.js +10 -16
  106. package/dist/session/exchange.js.map +1 -1
  107. package/dist/session/post-auth.js +2 -2
  108. package/dist/session/post-auth.js.map +1 -1
  109. package/dist/session/redirect-listener.js +1 -1
  110. package/dist/session/redirect-listener.js.map +1 -1
  111. package/dist/session/schema.d.ts +3 -2
  112. package/dist/session/schema.js +3 -2
  113. package/dist/session/schema.js.map +1 -1
  114. package/dist/session/scopes.d.ts +3 -3
  115. package/dist/session/scopes.js +3 -3
  116. package/dist/session/scopes.js.map +1 -1
  117. package/dist/session/store.d.ts +2 -2
  118. package/dist/session/store.js +2 -2
  119. package/dist/session/store.js.map +1 -1
  120. package/dist/session/token.d.ts +1 -1
  121. package/dist/session/token.js +1 -1
  122. package/dist/session/token.js.map +1 -1
  123. package/dist/session/validate.d.ts +4 -4
  124. package/dist/session/validate.js +4 -7
  125. package/dist/session/validate.js.map +1 -1
  126. package/dist/session.d.ts +10 -10
  127. package/dist/session.js +10 -10
  128. package/dist/session.js.map +1 -1
  129. package/dist/string.d.ts +2 -2
  130. package/dist/string.js +2 -2
  131. package/dist/string.js.map +1 -1
  132. package/dist/system.d.ts +4 -4
  133. package/dist/system.js +4 -4
  134. package/dist/system.js.map +1 -1
  135. package/dist/template.d.ts +3 -3
  136. package/dist/template.js +3 -3
  137. package/dist/template.js.map +1 -1
  138. package/dist/testing/store.d.ts +2 -2
  139. package/dist/testing/store.js +2 -2
  140. package/dist/testing/store.js.map +1 -1
  141. package/dist/tsconfig.tsbuildinfo +1 -1
  142. package/dist/ui.d.ts +1 -1
  143. package/dist/ui.js +17 -8
  144. package/dist/ui.js.map +1 -1
  145. package/dist/version.d.ts +3 -3
  146. package/dist/version.js +3 -3
  147. package/dist/version.js.map +1 -1
  148. package/package.json +1 -1
  149. package/dist/api/graphql/functions/compile_module.d.ts +0 -15
  150. package/dist/api/graphql/functions/compile_module.js +0 -13
  151. package/dist/api/graphql/functions/compile_module.js.map +0 -1
  152. package/dist/api/graphql/functions/module_compilation_status.d.ts +0 -15
  153. package/dist/api/graphql/functions/module_compilation_status.js +0 -13
  154. package/dist/api/graphql/functions/module_compilation_status.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @shopify/cli-kit
2
2
 
3
+ ## 3.17.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 483318aa: Create a new Oxygen service for interacting with Oxygen related services.
8
+
9
+ ### Patch Changes
10
+
11
+ - dac186b2: Removing unnecessary calls to enqueue and check compilation status
12
+ - 5617050a: initializeRepository now defaults to 'main' as initial branch.
13
+ - 5703ce9b: Cloud environment checking was not working properly so wrong authentication method was used
14
+
3
15
  ## 3.16.3
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -52,7 +52,7 @@ If you encounter issues using the CLI or have feedback you'd like to share with
52
52
 
53
53
  ## Contribute 👩🏽‍💻
54
54
 
55
- If you'd like to contribute to the project, check out the [contributors docs](/docs) and the [steps to get started](/docs/get-started).
55
+ If you'd like to contribute to the project, check out the [contributors docs](/docs) and the [steps to get started](/docs/get-started.md).
56
56
 
57
57
  <p>&nbsp;</p>
58
58
 
@@ -21,12 +21,12 @@ interface ReportEventOptions {
21
21
  export declare function reportEvent(options: ReportEventOptions): Promise<void>;
22
22
  /**
23
23
  * Return the name of the tunnel provider used to send analytics. Returns 'localhost' or provider name if any of those
24
- * strings are included in the {@link tunnelUrl} param. Resturns 'custom' otherwise
24
+ * strings are included in the {@link tunnelUrl} param. Returns 'custom' otherwise
25
25
  *
26
- * @param {Config} options - Oclif configuration. Needed to call the hook for retrieving the list of tunner providers
27
- * @param {string} tunnelUrl - Tunnel url. Used as pattern to match provider name
28
- * @returns {Promise<string | undefined>} - Returns 'localhost' or provider name if any of those strings are included in
29
- * the tunnelUrl. Resturns 'custom' other wise
26
+ * @param options - Oclif configuration. Needed to call the hook for retrieving the list of tunner providers
27
+ * @param tunnelUrl - Tunnel url. Used as pattern to match provider name
28
+ * @returns 'localhost' or provider name if any of those strings are included in
29
+ * the tunnelUrl or 'custom' otherwise
30
30
  */
31
31
  export declare function getAnalyticsTunnelType(options: Config, tunnelUrl: string): Promise<string | undefined>;
32
32
  export declare function getEnvironmentData(config: Interfaces.Config): Promise<{
package/dist/analytics.js CHANGED
@@ -62,12 +62,12 @@ export async function reportEvent(options) {
62
62
  }
63
63
  /**
64
64
  * Return the name of the tunnel provider used to send analytics. Returns 'localhost' or provider name if any of those
65
- * strings are included in the {@link tunnelUrl} param. Resturns 'custom' otherwise
65
+ * strings are included in the {@link tunnelUrl} param. Returns 'custom' otherwise
66
66
  *
67
- * @param {Config} options - Oclif configuration. Needed to call the hook for retrieving the list of tunner providers
68
- * @param {string} tunnelUrl - Tunnel url. Used as pattern to match provider name
69
- * @returns {Promise<string | undefined>} - Returns 'localhost' or provider name if any of those strings are included in
70
- * the tunnelUrl. Resturns 'custom' other wise
67
+ * @param options - Oclif configuration. Needed to call the hook for retrieving the list of tunner providers
68
+ * @param tunnelUrl - Tunnel url. Used as pattern to match provider name
69
+ * @returns 'localhost' or provider name if any of those strings are included in
70
+ * the tunnelUrl or 'custom' otherwise
71
71
  */
72
72
  export async function getAnalyticsTunnelType(options, tunnelUrl) {
73
73
  if (!tunnelUrl) {
@@ -1 +1 @@
1
- {"version":3,"file":"analytics.js","sourceRoot":"","sources":["../src/analytics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EA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AAW,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,gBAAgB,EAAE,CAAC,MAAM;YACtD,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC,QAAQ;YAC/C,CAAC,CAAC,SAAS;QACb,aAAa,EAAE,UAAU,CAAC,MAAM,UAAU,EAAE,CAAC;QAC7C,SAAS,EAAE,WAAW,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC,QAAQ;QACxD,mBAAmB,EAAE,CAAC,MAAM,eAAe,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,iBAAiB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS;KACpG,CAAA;AACH,CAAC;AAED,KAAK,UAAU,2BAA2B,CAAC,MAAyB;IAClE,OAAO;QACL,wBAAwB,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;KACjE,CAAA;AACH,CAAC;AAED,SAAS,cAAc,CAAC,MAAyB;IAC/C,OAAO,MAAM,CAAC,OAAO;SAClB,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;AACtD,CAAC","sourcesContent":["import * as environment from './environment.js'\nimport {platformAndArch} from './os.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, getListOfTunnelPlugins} from './plugins.js'\nimport {getPackageManager, packageManagerUsedForCreating} from './node/node-package-manager.js'\nimport BaseCommand from './node/base-command.js'\nimport {CommandContent} from './node/hooks/prerun.js'\nimport {hashString} from './string.js'\nimport {macAddress} from './environment/local.js'\nimport {localCliPackage} from './node/cli.js'\nimport {Config, Interfaces} from '@oclif/core'\n\ninterface StartOptions {\n commandContent: CommandContent\n args: string[]\n currentTime?: number\n commandClass?: Interfaces.Command.Class | typeof BaseCommand\n}\n\nexport const start = async ({commandContent, args, currentTime = new Date().getTime(), commandClass}: StartOptions) => {\n let startCommand: string = commandContent.command\n if (commandClass && Object.prototype.hasOwnProperty.call(commandClass, 'analyticsNameOverride')) {\n startCommand = (commandClass as typeof BaseCommand).analyticsNameOverride() ?? commandContent.command\n }\n\n await metadata.addSensitive(() => ({\n commandStartOptions: {\n startTime: currentTime,\n startCommand,\n startArgs: args,\n },\n }))\n\n await metadata.addPublic(() => ({\n cmd_all_launcher: packageManagerUsedForCreating(),\n cmd_all_alias_used: commandContent.alias,\n cmd_all_topic: commandContent.topic,\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\n/**\n * Return the name of the tunnel provider used to send analytics. Returns 'localhost' or provider name if any of those\n * strings are included in the {@link tunnelUrl} param. Resturns 'custom' otherwise\n *\n * @param {Config} options - Oclif configuration. Needed to call the hook for retrieving the list of tunner providers\n * @param {string} tunnelUrl - Tunnel url. Used as pattern to match provider name\n * @returns {Promise<string | undefined>} - Returns 'localhost' or provider name if any of those strings are included in\n * the tunnelUrl. Resturns 'custom' other wise\n */\nexport async function getAnalyticsTunnelType(options: Config, tunnelUrl: string): Promise<string | undefined> {\n if (!tunnelUrl) {\n return\n }\n\n if (tunnelUrl.includes('localhost')) {\n return 'localhost'\n }\n\n const provider = (await getListOfTunnelPlugins(options)).plugins.find((plugin) => tunnelUrl?.includes(plugin))\n return provider ?? 'custom'\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 const {'@shopify/app': appPublic, ...otherPluginsPublic} = await fanoutHooks(config, 'public_command_metadata', {})\n const {'@shopify/app': appSensitive, ...otherPluginsSensitive} = await fanoutHooks(\n config,\n 'sensitive_command_metadata',\n {},\n )\n\n const environmentData = await getEnvironmentData(config)\n const sensitiveEnvironmentData = await getSensitiveEnvironmentData(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 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 ...appSensitive,\n ...sensitiveEnvironmentData,\n metadata: JSON.stringify({\n ...sensitiveMetadata,\n extraPublic: {\n ...otherPluginsPublic,\n },\n extraSensitive: {...otherPluginsSensitive},\n }),\n },\n }\n}\n\nexport async function getEnvironmentData(config: Interfaces.Config) {\n const ciPlatform = environment.local.ciPlatform()\n\n const pluginNames = getPluginNames(config)\n const shopifyPlugins = pluginNames.filter((plugin) => plugin.startsWith('@shopify/'))\n\n const {platform, arch} = platformAndArch()\n\n return {\n uname: `${platform} ${arch}`,\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.cloudEnvironment().editor\n ? environment.local.cloudEnvironment().platform\n : undefined,\n env_device_id: hashString(await macAddress()),\n env_cloud: environment.local.cloudEnvironment().platform,\n env_package_manager: (await localCliPackage()) ? await getPackageManager(process.cwd()) : undefined,\n }\n}\n\nasync function getSensitiveEnvironmentData(config: Interfaces.Config) {\n return {\n env_plugin_installed_all: JSON.stringify(getPluginNames(config)),\n }\n}\n\nfunction getPluginNames(config: Interfaces.Config) {\n return config.plugins\n .map((plugin) => plugin.name)\n .sort()\n .filter((plugin) => !plugin.startsWith('@oclif/'))\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,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,EAAE,sBAAsB,EAAC,MAAM,eAAe,CAAA;AAClE,OAAO,EAAC,WAAW,EAAE,sBAAsB,EAAC,MAAM,cAAc,CAAA;AAChE,OAAO,EA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CAAC,gBAAgB,EAAE,CAAC,QAAQ;QACxD,mBAAmB,EAAE,CAAC,MAAM,eAAe,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,iBAAiB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS;KACpG,CAAA;AACH,CAAC;AAED,KAAK,UAAU,2BAA2B,CAAC,MAAyB;IAClE,OAAO;QACL,wBAAwB,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;KACjE,CAAA;AACH,CAAC;AAED,SAAS,cAAc,CAAC,MAAyB;IAC/C,OAAO,MAAM,CAAC,OAAO;SAClB,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;AACtD,CAAC","sourcesContent":["import * as environment from './environment.js'\nimport {platformAndArch} from './os.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, getListOfTunnelPlugins} from './plugins.js'\nimport {getPackageManager, packageManagerUsedForCreating} from './node/node-package-manager.js'\nimport BaseCommand from './node/base-command.js'\nimport {CommandContent} from './node/hooks/prerun.js'\nimport {hashString} from './string.js'\nimport {macAddress} from './environment/local.js'\nimport {localCliPackage} from './node/cli.js'\nimport {Config, Interfaces} from '@oclif/core'\n\ninterface StartOptions {\n commandContent: CommandContent\n args: string[]\n currentTime?: number\n commandClass?: Interfaces.Command.Class | typeof BaseCommand\n}\n\nexport const start = async ({commandContent, args, currentTime = new Date().getTime(), commandClass}: StartOptions) => {\n let startCommand: string = commandContent.command\n if (commandClass && Object.prototype.hasOwnProperty.call(commandClass, 'analyticsNameOverride')) {\n startCommand = (commandClass as typeof BaseCommand).analyticsNameOverride() ?? commandContent.command\n }\n\n await metadata.addSensitive(() => ({\n commandStartOptions: {\n startTime: currentTime,\n startCommand,\n startArgs: args,\n },\n }))\n\n await metadata.addPublic(() => ({\n cmd_all_launcher: packageManagerUsedForCreating(),\n cmd_all_alias_used: commandContent.alias,\n cmd_all_topic: commandContent.topic,\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\n/**\n * Return the name of the tunnel provider used to send analytics. Returns 'localhost' or provider name if any of those\n * strings are included in the {@link tunnelUrl} param. Returns 'custom' otherwise\n *\n * @param options - Oclif configuration. Needed to call the hook for retrieving the list of tunner providers\n * @param tunnelUrl - Tunnel url. Used as pattern to match provider name\n * @returns 'localhost' or provider name if any of those strings are included in\n * the tunnelUrl or 'custom' otherwise\n */\nexport async function getAnalyticsTunnelType(options: Config, tunnelUrl: string): Promise<string | undefined> {\n if (!tunnelUrl) {\n return\n }\n\n if (tunnelUrl.includes('localhost')) {\n return 'localhost'\n }\n\n const provider = (await getListOfTunnelPlugins(options)).plugins.find((plugin) => tunnelUrl?.includes(plugin))\n return provider ?? 'custom'\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 const {'@shopify/app': appPublic, ...otherPluginsPublic} = await fanoutHooks(config, 'public_command_metadata', {})\n const {'@shopify/app': appSensitive, ...otherPluginsSensitive} = await fanoutHooks(\n config,\n 'sensitive_command_metadata',\n {},\n )\n\n const environmentData = await getEnvironmentData(config)\n const sensitiveEnvironmentData = await getSensitiveEnvironmentData(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 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 ...appSensitive,\n ...sensitiveEnvironmentData,\n metadata: JSON.stringify({\n ...sensitiveMetadata,\n extraPublic: {\n ...otherPluginsPublic,\n },\n extraSensitive: {...otherPluginsSensitive},\n }),\n },\n }\n}\n\nexport async function getEnvironmentData(config: Interfaces.Config) {\n const ciPlatform = environment.local.ciPlatform()\n\n const pluginNames = getPluginNames(config)\n const shopifyPlugins = pluginNames.filter((plugin) => plugin.startsWith('@shopify/'))\n\n const {platform, arch} = platformAndArch()\n\n return {\n uname: `${platform} ${arch}`,\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.cloudEnvironment().editor\n ? environment.local.cloudEnvironment().platform\n : undefined,\n env_device_id: hashString(await macAddress()),\n env_cloud: environment.local.cloudEnvironment().platform,\n env_package_manager: (await localCliPackage()) ? await getPackageManager(process.cwd()) : undefined,\n }\n}\n\nasync function getSensitiveEnvironmentData(config: Interfaces.Config) {\n return {\n env_plugin_installed_all: JSON.stringify(getPluginNames(config)),\n }\n}\n\nfunction getPluginNames(config: Interfaces.Config) {\n return config.plugins\n .map((plugin) => plugin.name)\n .sort()\n .filter((plugin) => !plugin.startsWith('@oclif/'))\n}\n"]}
@@ -9,8 +9,8 @@ export declare function buildHeaders(token: string): Promise<{
9
9
  }>;
10
10
  /**
11
11
  * Removes the sensitive data from the headers and outputs them as a string.
12
- * @param headers {{[key: string]: string}} HTTP headers.
13
- * @returns {string} A sanitized version of the headers as a string.
12
+ * @param headers - HTTP headers.
13
+ * @returns A sanitized version of the headers as a string.
14
14
  */
15
15
  export declare function sanitizedHeadersOutput(headers: {
16
16
  [key: string]: string;
@@ -26,8 +26,8 @@ export async function buildHeaders(token) {
26
26
  }
27
27
  /**
28
28
  * Removes the sensitive data from the headers and outputs them as a string.
29
- * @param headers {{[key: string]: string}} HTTP headers.
30
- * @returns {string} A sanitized version of the headers as a string.
29
+ * @param headers - HTTP headers.
30
+ * @returns A sanitized version of the headers as a string.
31
31
  */
32
32
  export function sanitizedHeadersOutput(headers) {
33
33
  const sanitized = {};
@@ -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,OAAO,EAAC,KAAK,EAAE,eAAe,EAAC,MAAM,aAAa,CAAA;AAClD,OAAO,EAAC,WAAW,EAA6B,MAAM,iBAAiB,CAAA;AACvE,OAAO,EAAC,UAA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AA;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.json(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,OAAO,GAAG;QACd,YAAY,EAAE,SAAS;QACvB,0DAA0D;QAC1D,oBAAoB,EAAE,OAAO,CAAC,QAAQ;QACtC,cAAc,EAAE,UAAU,EAAE;QAC5B,aAAa,EAAE,U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ACF,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 - HTTP headers.\n * @returns 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.json(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"]}
@@ -11,10 +11,8 @@ export * from './find_org_basic.js';
11
11
  export * from './find_org.js';
12
12
  export * from './find_store_by_domain.js';
13
13
  export * from './functions/app_function_set.js';
14
- export * from './functions/compile_module.js';
15
14
  export * from './functions/api_schema_definition.js';
16
15
  export * from './functions/function_service_proxy.js';
17
- export * from './functions/module_compilation_status.js';
18
16
  export * from './functions/upload_url_generate.js';
19
17
  export * from './generate_signed_upload_url.js';
20
18
  export * from './get_urls.js';
@@ -11,10 +11,8 @@ export * from './find_org_basic.js';
11
11
  export * from './find_org.js';
12
12
  export * from './find_store_by_domain.js';
13
13
  export * from './functions/app_function_set.js';
14
- export * from './functions/compile_module.js';
15
14
  export * from './functions/api_schema_definition.js';
16
15
  export * from './functions/function_service_proxy.js';
17
- export * from './functions/module_compilation_status.js';
18
16
  export * from './functions/upload_url_generate.js';
19
17
  export * from './generate_signed_upload_url.js';
20
18
  export * from './get_urls.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/graphql/index.ts"],"names":[],"mappings":"AAAA,cAAc,sCAAsC,CAAA;AACpD,cAAc,eAAe,CAAA;AAC7B,cAAc,wBAAwB,CAAA;AACtC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AACrC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,eAAe,CAAA;AAC7B,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,2BAA2B,CAAA;AACzC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,sCAAsC,CAAA;AACpD,cAAc,uCAAuC,CAAA;AACrD,cAAc,0CAA0C,CAAA;AACxD,cAAc,oCAAoC,CAAA;AAClD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,eAAe,CAAA;AAC7B,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,kBAAkB,CAAA","sourcesContent":["export * from './all_app_extension_registrations.js'\nexport * from './all_orgs.js'\nexport * from './all_stores_by_org.js'\nexport * from './convert_dev_to_test_store.js'\nexport * from './create_app.js'\nexport * from './create_deployment.js'\nexport * from './extension_create.js'\nexport * from './extension_specifications.js'\nexport * from './find_app.js'\nexport * from './find_org_basic.js'\nexport * from './find_org.js'\nexport * from './find_store_by_domain.js'\nexport * from './functions/app_function_set.js'\nexport * from './functions/compile_module.js'\nexport * from './functions/api_schema_definition.js'\nexport * from './functions/function_service_proxy.js'\nexport * from './functions/module_compilation_status.js'\nexport * from './functions/upload_url_generate.js'\nexport * from './generate_signed_upload_url.js'\nexport * from './get_urls.js'\nexport * from './get_variant_id.js'\nexport * from './update_draft.js'\nexport * from './update_urls.js'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/graphql/index.ts"],"names":[],"mappings":"AAAA,cAAc,sCAAsC,CAAA;AACpD,cAAc,eAAe,CAAA;AAC7B,cAAc,wBAAwB,CAAA;AACtC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AACrC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,eAAe,CAAA;AAC7B,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,2BAA2B,CAAA;AACzC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,sCAAsC,CAAA;AACpD,cAAc,uCAAuC,CAAA;AACrD,cAAc,oCAAoC,CAAA;AAClD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,eAAe,CAAA;AAC7B,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,kBAAkB,CAAA","sourcesContent":["export * from './all_app_extension_registrations.js'\nexport * from './all_orgs.js'\nexport * from './all_stores_by_org.js'\nexport * from './convert_dev_to_test_store.js'\nexport * from './create_app.js'\nexport * from './create_deployment.js'\nexport * from './extension_create.js'\nexport * from './extension_specifications.js'\nexport * from './find_app.js'\nexport * from './find_org_basic.js'\nexport * from './find_org.js'\nexport * from './find_store_by_domain.js'\nexport * from './functions/app_function_set.js'\nexport * from './functions/api_schema_definition.js'\nexport * from './functions/function_service_proxy.js'\nexport * from './functions/upload_url_generate.js'\nexport * from './generate_signed_upload_url.js'\nexport * from './get_urls.js'\nexport * from './get_variant_id.js'\nexport * from './update_draft.js'\nexport * from './update_urls.js'\n"]}
@@ -0,0 +1,5 @@
1
+ import { Variables, RequestDocument } from 'graphql-request';
2
+ import FormData from 'form-data';
3
+ import { Response } from 'node-fetch';
4
+ export declare function request<T>(oxygenAddress: string, query: RequestDocument, token: string, variables?: Variables): Promise<T>;
5
+ export declare function uploadDeploymentFile(oxygenAddress: string, token: string, data: FormData): Promise<Response>;
@@ -0,0 +1,30 @@
1
+ import { buildHeaders, debugLogRequest } from './common.js';
2
+ import { graphqlClient } from '../http/graphql.js';
3
+ import { shopifyFetch } from '../http.js';
4
+ export async function request(oxygenAddress, query, token, variables) {
5
+ const headers = await buildHeaders(token);
6
+ debugLogRequest('Oxygen', query, variables, headers);
7
+ const client = await graphqlClient({
8
+ headers,
9
+ url: getOxygenAddress(oxygenAddress),
10
+ });
11
+ const response = await client.request(query, variables);
12
+ return response;
13
+ }
14
+ export async function uploadDeploymentFile(oxygenAddress, token, data) {
15
+ const headers = await buildHeaders(token);
16
+ delete headers['Content-Type'];
17
+ const response = await shopifyFetch(getOxygenAddress(oxygenAddress), {
18
+ method: 'POST',
19
+ body: data,
20
+ headers: {
21
+ ...headers,
22
+ ...data.getHeaders(),
23
+ },
24
+ });
25
+ return response;
26
+ }
27
+ const getOxygenAddress = (oxygenHost) => {
28
+ return `https://${oxygenHost}/api/graphql/deploy/v1`;
29
+ };
30
+ //# sourceMappingURL=oxygen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oxygen.js","sourceRoot":"","sources":["../../src/api/oxygen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,eAAe,EAAC,MAAM,aAAa,CAAA;AACzD,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAA;AAKvC,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,aAAqB,EACrB,KAAsB,EACtB,KAAa,EACb,SAAqB;IAErB,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,KAAK,CAAC,CAAA;IACzC,eAAe,CAAC,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;IACpD,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC;QACjC,OAAO;QACP,GAAG,EAAE,gBAAgB,CAAC,aAAa,CAAC;KACrC,CAAC,CAAA;IAEF,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAI,KAAK,EAAE,SAAS,CAAC,CAAA;IAC1D,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,aAAqB,EAAE,KAAa,EAAE,IAAc;IAC7F,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,KAAK,CAAC,CAAA;IACzC,OAAO,OAAO,CAAC,cAAc,CAAC,CAAA;IAE9B,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,gBAAgB,CAAC,aAAa,CAAC,EAAE;QACnE,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,IAAI;QACV,OAAO,EAAE;YACP,GAAG,OAAO;YACV,GAAG,IAAI,CAAC,UAAU,EAAE;SACrB;KACF,CAAC,CAAA;IAEF,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED,MAAM,gBAAgB,GAAG,CAAC,UAAkB,EAAU,EAAE;IACtD,OAAO,WAAW,UAAU,wBAAwB,CAAA;AACtD,CAAC,CAAA","sourcesContent":["import {buildHeaders, debugLogRequest} from './common.js'\nimport {graphqlClient} from '../http/graphql.js'\nimport {shopifyFetch} from '../http.js'\nimport {Variables, RequestDocument} from 'graphql-request'\nimport FormData from 'form-data'\nimport {Response} from 'node-fetch'\n\nexport async function request<T>(\n oxygenAddress: string,\n query: RequestDocument,\n token: string,\n variables?: Variables,\n): Promise<T> {\n const headers = await buildHeaders(token)\n debugLogRequest('Oxygen', query, variables, headers)\n const client = await graphqlClient({\n headers,\n url: getOxygenAddress(oxygenAddress),\n })\n\n const response = await client.request<T>(query, variables)\n return response\n}\n\nexport async function uploadDeploymentFile(oxygenAddress: string, token: string, data: FormData): Promise<Response> {\n const headers = await buildHeaders(token)\n delete headers['Content-Type']\n\n const response = await shopifyFetch(getOxygenAddress(oxygenAddress), {\n method: 'POST',\n body: data,\n headers: {\n ...headers,\n ...data.getHeaders(),\n },\n })\n\n return response\n}\n\nconst getOxygenAddress = (oxygenHost: string): string => {\n return `https://${oxygenHost}/api/graphql/deploy/v1`\n}\n"]}
@@ -2,8 +2,8 @@ import { Variables, RequestDocument } from 'graphql-request';
2
2
  export declare function request<T>(query: RequestDocument, token: string, variables?: Variables): Promise<T>;
3
3
  /**
4
4
  * Check if the given token is revoked and no longer valid to interact with the Partners API.
5
- * @param token {string} - The token to check
6
- * @returns {Promise<boolean>} - True if the token is revoked, false otherwise
5
+ * @param token - The token to check
6
+ * @returns True if the token is revoked, false otherwise
7
7
  */
8
8
  export declare function checkIfTokenIsRevoked(token: string): Promise<boolean>;
9
9
  /**
@@ -11,10 +11,10 @@ export declare function checkIfTokenIsRevoked(token: string): Promise<boolean>;
11
11
  * To execute a query, we encapsulate it inside another query (including the variables)
12
12
  * This is done automatically, you just need to provide the query and the variables.
13
13
  *
14
- * @param apiKey {string} APIKey of the app where the query will be executed.
15
- * @param query {any} GraphQL query to execute.
16
- * @param token {string} Partners token
17
- * @param variables {any} GraphQL variables to pass to the query.
18
- * @returns {Promise<T>} The response of the query.
14
+ * @param apiKey - APIKey of the app where the query will be executed.
15
+ * @param query - GraphQL query to execute.
16
+ * @param token - Partners token
17
+ * @param variables - GraphQL variables to pass to the query.
18
+ * @returns The response of the query.
19
19
  */
20
20
  export declare function functionProxyRequest<T>(apiKey: string, query: unknown, token: string, variables?: unknown): Promise<T>;
@@ -17,8 +17,8 @@ export async function request(query, token, variables) {
17
17
  }
18
18
  /**
19
19
  * Check if the given token is revoked and no longer valid to interact with the Partners API.
20
- * @param token {string} - The token to check
21
- * @returns {Promise<boolean>} - True if the token is revoked, false otherwise
20
+ * @param token - The token to check
21
+ * @returns True if the token is revoked, false otherwise
22
22
  */
23
23
  export async function checkIfTokenIsRevoked(token) {
24
24
  const query = gql `
@@ -51,11 +51,11 @@ export async function checkIfTokenIsRevoked(token) {
51
51
  * To execute a query, we encapsulate it inside another query (including the variables)
52
52
  * This is done automatically, you just need to provide the query and the variables.
53
53
  *
54
- * @param apiKey {string} APIKey of the app where the query will be executed.
55
- * @param query {any} GraphQL query to execute.
56
- * @param token {string} Partners token
57
- * @param variables {any} GraphQL variables to pass to the query.
58
- * @returns {Promise<T>} The response of the query.
54
+ * @param apiKey - APIKey of the app where the query will be executed.
55
+ * @param query - GraphQL query to execute.
56
+ * @param token - Partners token
57
+ * @param variables - GraphQL variables to pass to the query.
58
+ * @returns The response of the query.
59
59
  */
60
60
  export async function functionProxyRequest(apiKey, query, token, variables) {
61
61
  const proxyVariables = {
@@ -1 +1 @@
1
- {"version":3,"file":"partners.js","sourceRoot":"","sources":["../../src/api/partners.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,eAAe,EAAE,cAAc,EAAC,MAAM,aAAa,CAAA;AACzE,OAAO,EAAC,uBAAuB,EAAC,MAAM,oBAAoB,CAAA;AAC1D,OAAO,EAAC,QAAQ,IAAI,YAAY,EAAC,MAAM,wBAAwB,CAAA;AAC/D,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAY,WAAW,EAAE,GAAG,EAAkB,MAAM,iBAAiB,CAAA;AAE5E,MAAM,CAAC,KAAK,UAAU,OAAO,CAAI,KAAsB,EAAE,KAAa,EAAE,SAAqB;IAC3F,MAAM,GAAG,GAAG,UAAU,CAAA;IACtB,OAAO,cAAc,CAAC,GAAG,EAAE,KAAK,I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B;IAEnB,MAAM,cAAc,GAAG;QACrB,OAAO,EAAE,MAAM;QACf,KAAK;QACL,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,IAAI;KAC7C,CAAA;IACD,MAAM,UAAU,GAAG,uBAAuB,CAAA;IAC1C,MAAM,GAAG,GAAkB,MAAM,OAAO,CAAC,UAAU,EAAE,KAAK,EAAE,cAAc,CAAC,CAAA;IAC3E,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;IAC/C,OAAO,IAAS,CAAA;AAClB,CAAC","sourcesContent":["import {buildHeaders, debugLogRequest, handlingErrors} from './common.js'\nimport {ScriptServiceProxyQuery} from './graphql/index.js'\nimport {partners as partnersFqdn} from '../environment/fqdn.js'\nimport {graphqlClient} from '../http/graphql.js'\nimport {Variables, ClientError, gql, RequestDocument} from 'graphql-request'\n\nexport async function request<T>(query: RequestDocument, token: string, variables?: Variables): Promise<T> {\n const api = 'Partners'\n return handlingErrors(api, async () => {\n const fqdn = await partnersFqdn()\n const url = `https://${fqdn}/api/cli/graphql`\n const headers = await buildHeaders(token)\n debugLogRequest(api, query, variables, headers)\n const client = await graphqlClient({headers, url})\n const response = await client.request<T>(query, variables)\n return response\n })\n}\n\n/**\n * Check if the given token is revoked and no longer valid to interact with the Partners API.\n * @param token {string} - The token to check\n * @returns {Promise<boolean>} - True if the token is revoked, false otherwise\n */\nexport async function checkIfTokenIsRevoked(token: string): Promise<boolean> {\n const query = gql`\n {\n organizations(first: 1) {\n nodes {\n id\n }\n }\n }\n `\n const fqdn = await partnersFqdn()\n const url = `https://${fqdn}/api/cli/graphql`\n const headers = await buildHeaders(token)\n const client = await graphqlClient({headers, url})\n try {\n await client.request(query, {})\n return false\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch (error) {\n if (error instanceof ClientError) {\n return error.response.status === 401\n }\n return false\n }\n}\n\ninterface ProxyResponse {\n scriptServiceProxy: string\n}\n\n/**\n * Function queries are proxied through the script service proxy.\n * To execute a query, we encapsulate it inside another query (including the variables)\n * This is done automatically, you just need to provide the query and the variables.\n *\n * @param apiKey {string} APIKey of the app where the query will be executed.\n * @param query {any} GraphQL query to execute.\n * @param token {string} Partners token\n * @param variables {any} GraphQL variables to pass to the query.\n * @returns {Promise<T>} The response of the query.\n */\nexport async function functionProxyRequest<T>(\n apiKey: string,\n query: unknown,\n token: string,\n variables?: unknown,\n): Promise<T> {\n const proxyVariables = {\n api_key: apiKey,\n query,\n variables: JSON.stringify(variables) || '{}',\n }\n const proxyQuery = ScriptServiceProxyQuery\n const res: ProxyResponse = await request(proxyQuery, token, proxyVariables)\n const json = JSON.parse(res.scriptServiceProxy)\n return json as T\n}\n"]}
1
+ {"version":3,"file":"partners.js","sourceRoot":"","sources":["../../src/api/partners.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,eAAe,EAAE,cAAc,EAAC,MAAM,aAAa,CAAA;AACzE,OAAO,EAAC,uBAAuB,EAAC,MAAM,oBAAoB,CAAA;AAC1D,OAAO,EAAC,QAAQ,IAAI,YAAY,EAAC,MAAM,wBAAwB,CAAA;AAC/D,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAY,WAAW,EAAE,GAAG,EAAkB,MAAM,iBAAiB,CAAA;AAE5E,MAAM,CAAC,KAAK,UAAU,OAAO,CAAI,KAAsB,EAAE,KAAa,EAAE,SAAqB;IAC3F,MAAM,GAAG,GAAG,UAAU,CAAA;IACtB,OAAO,cAAc,CAAC,GAAG,EAAE,KAAK,IAAI,EAAE;QACpC,MAAM,IAAI,GAAG,MAAM,YAAY,EAAE,CAAA;QACjC,MAAM,GAAG,GAAG,WAAW,IAAI,kBAAkB,CAAA;QAC7C,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,KAAK,CAAC,CAAA;QACzC,eAAe,CAAC,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,CA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,EAAE,cAAc,CAAC,CAAA;IAC3E,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;IAC/C,OAAO,IAAS,CAAA;AAClB,CAAC","sourcesContent":["import {buildHeaders, debugLogRequest, handlingErrors} from './common.js'\nimport {ScriptServiceProxyQuery} from './graphql/index.js'\nimport {partners as partnersFqdn} from '../environment/fqdn.js'\nimport {graphqlClient} from '../http/graphql.js'\nimport {Variables, ClientError, gql, RequestDocument} from 'graphql-request'\n\nexport async function request<T>(query: RequestDocument, token: string, variables?: Variables): Promise<T> {\n const api = 'Partners'\n return handlingErrors(api, async () => {\n const fqdn = await partnersFqdn()\n const url = `https://${fqdn}/api/cli/graphql`\n const headers = await buildHeaders(token)\n debugLogRequest(api, query, variables, headers)\n const client = await graphqlClient({headers, url})\n const response = await client.request<T>(query, variables)\n return response\n })\n}\n\n/**\n * Check if the given token is revoked and no longer valid to interact with the Partners API.\n * @param token - The token to check\n * @returns True if the token is revoked, false otherwise\n */\nexport async function checkIfTokenIsRevoked(token: string): Promise<boolean> {\n const query = gql`\n {\n organizations(first: 1) {\n nodes {\n id\n }\n }\n }\n `\n const fqdn = await partnersFqdn()\n const url = `https://${fqdn}/api/cli/graphql`\n const headers = await buildHeaders(token)\n const client = await graphqlClient({headers, url})\n try {\n await client.request(query, {})\n return false\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch (error) {\n if (error instanceof ClientError) {\n return error.response.status === 401\n }\n return false\n }\n}\n\ninterface ProxyResponse {\n scriptServiceProxy: string\n}\n\n/**\n * Function queries are proxied through the script service proxy.\n * To execute a query, we encapsulate it inside another query (including the variables)\n * This is done automatically, you just need to provide the query and the variables.\n *\n * @param apiKey - APIKey of the app where the query will be executed.\n * @param query - GraphQL query to execute.\n * @param token - Partners token\n * @param variables - GraphQL variables to pass to the query.\n * @returns The response of the query.\n */\nexport async function functionProxyRequest<T>(\n apiKey: string,\n query: unknown,\n token: string,\n variables?: unknown,\n): Promise<T> {\n const proxyVariables = {\n api_key: apiKey,\n query,\n variables: JSON.stringify(variables) || '{}',\n }\n const proxyQuery = ScriptServiceProxyQuery\n const res: ProxyResponse = await request(proxyQuery, token, proxyVariables)\n const json = JSON.parse(res.scriptServiceProxy)\n return json as T\n}\n"]}
package/dist/api.d.ts CHANGED
@@ -2,5 +2,5 @@ import * as admin from './api/admin.js';
2
2
  import * as partners from './api/partners.js';
3
3
  import * as graphql from './api/graphql/index.js';
4
4
  import * as identity from './api/identity.js';
5
- import { buildHeaders } from './api/common.js';
6
- export { admin, partners, graphql, identity, buildHeaders };
5
+ import * as oxygen from './api/oxygen.js';
6
+ export { admin, partners, graphql, identity, oxygen };
package/dist/api.js CHANGED
@@ -2,6 +2,6 @@ import * as admin from './api/admin.js';
2
2
  import * as partners from './api/partners.js';
3
3
  import * as graphql from './api/graphql/index.js';
4
4
  import * as identity from './api/identity.js';
5
- import { buildHeaders } from './api/common.js';
6
- export { admin, partners, graphql, identity, buildHeaders };
5
+ import * as oxygen from './api/oxygen.js';
6
+ export { admin, partners, graphql, identity, oxygen };
7
7
  //# sourceMappingURL=api.js.map
package/dist/api.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAA;AACvC,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAA;AACjD,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAA;AAE5C,OAAO,EAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAC,CAAA","sourcesContent":["import * as admin from './api/admin.js'\nimport * as partners from './api/partners.js'\nimport * as graphql from './api/graphql/index.js'\nimport * as identity from './api/identity.js'\nimport {buildHeaders} from './api/common.js'\n\nexport {admin, partners, graphql, identity, buildHeaders}\n"]}
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAA;AACvC,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAA;AACjD,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AAEzC,OAAO,EAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAC,CAAA","sourcesContent":["import * as admin from './api/admin.js'\nimport * as partners from './api/partners.js'\nimport * as graphql from './api/graphql/index.js'\nimport * as identity from './api/identity.js'\nimport * as oxygen from './api/oxygen.js'\n\nexport {admin, partners, graphql, identity, oxygen}\n"]}
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Deep merges the two objects and returns a new object
3
3
  * with the merge result.
4
- * @param lhs {any} One of the objects to be merged.
5
- * @param rhs {any} Another object to be merged.
6
- * @returns {any} A Javascrip tobject with th emerged objects.
4
+ * @param lhs - One of the objects to be merged.
5
+ * @param rhs - Another object to be merged.
6
+ * @returns A Javascrip tobject with th emerged objects.
7
7
  */
8
8
  export declare function deepMergeObjects<T1, T2>(lhs: Partial<T1>, rhs: Partial<T2>): T1 & T2;
@@ -2,9 +2,9 @@ import deepMerge from 'deepmerge';
2
2
  /**
3
3
  * Deep merges the two objects and returns a new object
4
4
  * with the merge result.
5
- * @param lhs {any} One of the objects to be merged.
6
- * @param rhs {any} Another object to be merged.
7
- * @returns {any} A Javascrip tobject with th emerged objects.
5
+ * @param lhs - One of the objects to be merged.
6
+ * @param rhs - Another object to be merged.
7
+ * @returns A Javascrip tobject with th emerged objects.
8
8
  */
9
9
  export function deepMergeObjects(lhs, rhs) {
10
10
  return deepMerge(lhs, rhs);
@@ -1 +1 @@
1
- {"version":3,"file":"object.js","sourceRoot":"","sources":["../../src/common/object.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAA;AAEjC;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAS,GAAgB,EAAE,GAAgB;IACzE,OAAO,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;AAC5B,CAAC","sourcesContent":["import deepMerge from 'deepmerge'\n\n/**\n * Deep merges the two objects and returns a new object\n * with the merge result.\n * @param lhs {any} One of the objects to be merged.\n * @param rhs {any} Another object to be merged.\n * @returns {any} A Javascrip tobject with th emerged objects.\n */\nexport function deepMergeObjects<T1, T2>(lhs: Partial<T1>, rhs: Partial<T2>): T1 & T2 {\n return deepMerge(lhs, rhs)\n}\n"]}
1
+ {"version":3,"file":"object.js","sourceRoot":"","sources":["../../src/common/object.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAA;AAEjC;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAS,GAAgB,EAAE,GAAgB;IACzE,OAAO,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;AAC5B,CAAC","sourcesContent":["import deepMerge from 'deepmerge'\n\n/**\n * Deep merges the two objects and returns a new object\n * with the merge result.\n * @param lhs - One of the objects to be merged.\n * @param rhs - Another object to be merged.\n * @returns A Javascrip tobject with th emerged objects.\n */\nexport function deepMergeObjects<T1, T2>(lhs: Partial<T1>, rhs: Partial<T2>): T1 & T2 {\n return deepMerge(lhs, rhs)\n}\n"]}
@@ -5,18 +5,18 @@ export declare const CouldntObtainShopifySpinFQDNError: Abort;
5
5
  export declare const NotProvidedStoreFQDNError: Abort;
6
6
  /**
7
7
  * It returns the Partners' API service we should interact with.
8
- * @returns {string} Fully-qualified domain of the partners service we should interact with.
8
+ * @returns Fully-qualified domain of the partners service we should interact with.
9
9
  */
10
10
  export declare function partners(): Promise<string>;
11
11
  /**
12
12
  * It returns the Identity service we should interact with.
13
- * @returns {string} Fully-qualified domain of the Identity service we should interact with.
13
+ * @returns Fully-qualified domain of the Identity service we should interact with.
14
14
  */
15
15
  export declare function identity(): Promise<string>;
16
16
  /**
17
17
  * It returns the Shopify service we should interact with.
18
18
  * Note the same fqdn is sued for the Admin and the Storefront Renderer APIs.
19
- * @returns {string} Fully-qualified domain of the Shopify service we should interact with.
19
+ * @returns Fully-qualified domain of the Shopify service we should interact with.
20
20
  */
21
21
  export declare function shopify(options?: {
22
22
  storeFqdn?: string;
@@ -7,7 +7,7 @@ export const CouldntObtainShopifySpinFQDNError = new Abort("Couldn't obtain the
7
7
  export const NotProvidedStoreFQDNError = new Abort("Couldn't obtain the Shopify FQDN because the store FQDN was not provided.");
8
8
  /**
9
9
  * It returns the Partners' API service we should interact with.
10
- * @returns {string} Fully-qualified domain of the partners service we should interact with.
10
+ * @returns Fully-qualified domain of the partners service we should interact with.
11
11
  */
12
12
  export async function partners() {
13
13
  const environment = serviceEnvironment();
@@ -23,7 +23,7 @@ export async function partners() {
23
23
  }
24
24
  /**
25
25
  * It returns the Identity service we should interact with.
26
- * @returns {string} Fully-qualified domain of the Identity service we should interact with.
26
+ * @returns Fully-qualified domain of the Identity service we should interact with.
27
27
  */
28
28
  export async function identity() {
29
29
  const environment = serviceEnvironment();
@@ -40,7 +40,7 @@ export async function identity() {
40
40
  /**
41
41
  * It returns the Shopify service we should interact with.
42
42
  * Note the same fqdn is sued for the Admin and the Storefront Renderer APIs.
43
- * @returns {string} Fully-qualified domain of the Shopify service we should interact with.
43
+ * @returns Fully-qualified domain of the Shopify service we should interact with.
44
44
  */
45
45
  export async function shopify(options = {}) {
46
46
  const environment = serviceEnvironment();
@@ -1 +1 @@
1
- {"version":3,"file":"fqdn.js","sourceRoot":"","sources":["../../src/environment/fqdn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,IAAI,QAAQ,EAAC,MAAM,WAAW,CAAA;AAC1C,OAAO,EAAC,kBAAkB,EAAC,MAAM,cAAc,CAA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,CAAA;QACvC;YACE,IAAI,OAAO,CAAC,SAAS,EAAE;gBACrB,OAAO,OAAO,CAAC,SAAS,CAAA;aACzB;iBAAM;gBACL,MAAM,yBAAyB,CAAA;aAChC;KACJ;AACH,CAAC","sourcesContent":["import {fqdn as spinFqdn} from './spin.js'\nimport {serviceEnvironment} from './service.js'\nimport {Abort} from '../error.js'\n\nexport const CouldntObtainPartnersSpinFQDNError = new Abort(\n \"Couldn't obtain the Spin FQDN for Partners when the CLI is not running from a Spin environment.\",\n)\nexport const CouldntObtainIdentitySpinFQDNError = new Abort(\n \"Couldn't obtain the Spin FQDN for Identity when the CLI is not running from a Spin environment.\",\n)\nexport const CouldntObtainShopifySpinFQDNError = new Abort(\n \"Couldn't obtain the Spin FQDN for Shopify when the CLI is not running from a Spin environment.\",\n)\nexport const NotProvidedStoreFQDNError = new Abort(\n \"Couldn't obtain the Shopify FQDN because the store FQDN was not provided.\",\n)\n\n/**\n * It returns the Partners' API service we should interact with.\n * @returns {string} Fully-qualified domain of the partners service we should interact with.\n */\nexport async function partners(): Promise<string> {\n const environment = serviceEnvironment()\n const productionFqdn = 'partners.shopify.com'\n switch (environment) {\n case 'local':\n return 'partners.myshopify.io'\n case 'spin':\n return `partners.${await spinFqdn()}`\n default:\n return productionFqdn\n }\n}\n\n/**\n * It returns the Identity service we should interact with.\n * @returns {string} Fully-qualified domain of the Identity service we should interact with.\n */\nexport async function identity(): Promise<string> {\n const environment = serviceEnvironment()\n const productionFqdn = 'accounts.shopify.com'\n switch (environment) {\n case 'local':\n return 'identity.myshopify.io'\n case 'spin':\n return `identity.${await spinFqdn()}`\n default:\n return productionFqdn\n }\n}\n\n/**\n * It returns the Shopify service we should interact with.\n * Note the same fqdn is sued for the Admin and the Storefront Renderer APIs.\n * @returns {string} Fully-qualified domain of the Shopify service we should interact with.\n */\nexport async function shopify(options: {storeFqdn?: string} = {}): Promise<string> {\n const environment = serviceEnvironment()\n switch (environment) {\n case 'local':\n return 'shopify.myshopify.io'\n case 'spin':\n return `identity.${await spinFqdn()}`\n default:\n if (options.storeFqdn) {\n return options.storeFqdn\n } else {\n throw NotProvidedStoreFQDNError\n }\n }\n}\n"]}
1
+ {"version":3,"file":"fqdn.js","sourceRoot":"","sources":["../../src/environment/fqdn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,IAAI,QAAQ,EAAC,MAAM,WAAW,CAAA;AAC1C,OAAO,EAAC,kBAAkB,EAAC,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAA;AAEjC,MAAM,CAAC,MAAM,kCAAkC,GAAG,IAAI,KAAK,CACzD,iGAAiG,CAClG,CAAA;AACD,MAAM,CAAC,MAAM,kCAAkC,GAAG,IAAI,KAAK,CACzD,iGAAiG,CAClG,CAAA;AACD,MAAM,CAAC,MAAM,iCAAiC,GAAG,IAAI,KAAK,CACxD,gGAAgG,CACjG,CAAA;AACD,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,KAAK,CAChD,2EAA2E,CAC5E,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ;IAC5B,MAAM,WAAW,GAAG,kBAAkB,EAAE,CAAA;IACxC,MAAM,cAAc,GAAG,sBAAsB,CAAA;IAC7C,QAAQ,WAAW,EAAE;QACnB,KAAK,OAAO;YACV,OAAO,uBAAuB,CAAA;QAChC,KAAK,MAAM;YACT,OAAO,YAAY,MAAM,QAAQ,EAAE,EAAE,CAAA;QACvC;YACE,OAAO,cAAc,CAAA;KACxB;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ;IAC5B,MAAM,WAAW,GAAG,kBAAkB,EAAE,CAAA;IACxC,MAAM,cAAc,GAAG,sBAAsB,CAAA;IAC7C,QAAQ,WAAW,EAAE;QACnB,KAAK,OAAO;YACV,OAAO,uBAAuB,CAAA;QAChC,KAAK,MAAM;YACT,OAAO,YAAY,MAAM,QAAQ,EAAE,EAAE,CAAA;QACvC;YACE,OAAO,cAAc,CAAA;KACxB;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,UAAgC,EAAE;IAC9D,MAAM,WAAW,GAAG,kBAAkB,EAAE,CAAA;IACxC,QAAQ,WAAW,EAAE;QACnB,KAAK,OAAO;YACV,OAAO,sBAAsB,CAAA;QAC/B,KAAK,MAAM;YACT,OAAO,YAAY,MAAM,QAAQ,EAAE,EAAE,CAAA;QACvC;YACE,IAAI,OAAO,CAAC,SAAS,EAAE;gBACrB,OAAO,OAAO,CAAC,SAAS,CAAA;aACzB;iBAAM;gBACL,MAAM,yBAAyB,CAAA;aAChC;KACJ;AACH,CAAC","sourcesContent":["import {fqdn as spinFqdn} from './spin.js'\nimport {serviceEnvironment} from './service.js'\nimport {Abort} from '../error.js'\n\nexport const CouldntObtainPartnersSpinFQDNError = new Abort(\n \"Couldn't obtain the Spin FQDN for Partners when the CLI is not running from a Spin environment.\",\n)\nexport const CouldntObtainIdentitySpinFQDNError = new Abort(\n \"Couldn't obtain the Spin FQDN for Identity when the CLI is not running from a Spin environment.\",\n)\nexport const CouldntObtainShopifySpinFQDNError = new Abort(\n \"Couldn't obtain the Spin FQDN for Shopify when the CLI is not running from a Spin environment.\",\n)\nexport const NotProvidedStoreFQDNError = new Abort(\n \"Couldn't obtain the Shopify FQDN because the store FQDN was not provided.\",\n)\n\n/**\n * It returns the Partners' API service we should interact with.\n * @returns Fully-qualified domain of the partners service we should interact with.\n */\nexport async function partners(): Promise<string> {\n const environment = serviceEnvironment()\n const productionFqdn = 'partners.shopify.com'\n switch (environment) {\n case 'local':\n return 'partners.myshopify.io'\n case 'spin':\n return `partners.${await spinFqdn()}`\n default:\n return productionFqdn\n }\n}\n\n/**\n * It returns the Identity service we should interact with.\n * @returns Fully-qualified domain of the Identity service we should interact with.\n */\nexport async function identity(): Promise<string> {\n const environment = serviceEnvironment()\n const productionFqdn = 'accounts.shopify.com'\n switch (environment) {\n case 'local':\n return 'identity.myshopify.io'\n case 'spin':\n return `identity.${await spinFqdn()}`\n default:\n return productionFqdn\n }\n}\n\n/**\n * It returns the Shopify service we should interact with.\n * Note the same fqdn is sued for the Admin and the Storefront Renderer APIs.\n * @returns Fully-qualified domain of the Shopify service we should interact with.\n */\nexport async function shopify(options: {storeFqdn?: string} = {}): Promise<string> {\n const environment = serviceEnvironment()\n switch (environment) {\n case 'local':\n return 'shopify.myshopify.io'\n case 'spin':\n return `identity.${await spinFqdn()}`\n default:\n if (options.storeFqdn) {\n return options.storeFqdn\n } else {\n throw NotProvidedStoreFQDNError\n }\n }\n}\n"]}
@@ -1,43 +1,43 @@
1
1
  /// <reference types="node" />
2
2
  /**
3
3
  * It returns true if the terminal is interactive.
4
- * @returns {boolean} True if the terminal is interactive.
4
+ * @returns True if the terminal is interactive.
5
5
  */
6
6
  export declare function isTerminalInteractive(): boolean;
7
7
  /**
8
8
  * Returns the path to the user's home directory.
9
- * @returns {string} The path to the user's home directory.
9
+ * @returns The path to the user's home directory.
10
10
  */
11
11
  export declare function homeDirectory(): string;
12
12
  /**
13
13
  * Returns true if the CLI is running in debug mode.
14
- * @param env The environment variables from the environment of the current process.
14
+ * @param env - The environment variables from the environment of the current process.
15
15
  * @returns true if SHOPIFY_ENV is development
16
16
  */
17
17
  export declare function isDevelopment(env?: NodeJS.ProcessEnv): boolean;
18
18
  /**
19
19
  * Returns true if the CLI is running in verbose mode.
20
- * @param env The environment variables from the environment of the current process.
20
+ * @param env - The environment variables from the environment of the current process.
21
21
  * @returns true if SHOPIFY_FLAG_VERBOSE is truthy or the flag --verbose has been passed
22
22
  */
23
23
  export declare function isVerbose(env?: NodeJS.ProcessEnv): boolean;
24
24
  /**
25
25
  * Returns true if the environment in which the CLI is running is either
26
26
  * a local environment (where dev is present) or a cloud environment (spin).
27
- * @returns {boolean} True if the CLI is used in a Shopify environment.
27
+ * @returns True if the CLI is used in a Shopify environment.
28
28
  */
29
29
  export declare function isShopify(env?: NodeJS.ProcessEnv): Promise<boolean>;
30
30
  /**
31
31
  * This variable is used when running unit tests to indicate that the CLI's business logic
32
32
  * is run as a subject of a unit test. We can use this variable to disable output through
33
33
  * the standard streams.
34
- * @param env The environment variables from the environment of the current process.
34
+ * @param env - The environment variables from the environment of the current process.
35
35
  * @returns True if the SHOPIFY_UNIT_TEST environment variable is truthy.
36
36
  */
37
37
  export declare function isUnitTest(env?: NodeJS.ProcessEnv): boolean;
38
38
  /**
39
39
  * Returns true if reporting analytics is enabled.
40
- * @param env The environment variables from the environment of the current process.
40
+ * @param env - The environment variables from the environment of the current process.
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;
@@ -51,18 +51,18 @@ export declare function codespaceURL(env?: NodeJS.ProcessEnv): string | undefine
51
51
  /**
52
52
  * Checks if the CLI is run from a cloud environment
53
53
  *
54
- * @param {NodeJS.ProcessEnv} env - Environment variables used when the cli is launched
54
+ * @param env - Environment variables used when the cli is launched
55
55
  *
56
- * @returns {boolean} True in case the CLI is run from a cloud environment
56
+ * @returns True in case the CLI is run from a cloud environment
57
57
  */
58
58
  export declare function isCloudEnvironment(env?: NodeJS.ProcessEnv): boolean;
59
59
  /**
60
60
  * Returns the cloud environment platform name and if the platform support online IDE in case the CLI is run from one of
61
61
  * them. Platform name 'localhost' is returned otherwise
62
62
  *
63
- * @param {NodeJS.ProcessEnv} env - Environment variables used when the cli is launched
63
+ * @param env - Environment variables used when the cli is launched
64
64
  *
65
- * @returns {{platform: 'spin' | 'codespaces' | 'gitpod' | 'localhost', editor: boolean}} - Cloud platform information
65
+ * @returns Cloud platform information
66
66
  */
67
67
  export declare function cloudEnvironment(env?: NodeJS.ProcessEnv): {
68
68
  platform: 'spin' | 'codespaces' | 'gitpod' | 'localhost';
@@ -70,7 +70,7 @@ export declare function cloudEnvironment(env?: NodeJS.ProcessEnv): {
70
70
  };
71
71
  /**
72
72
  * Returns whether the environment has Git available.
73
- * @returns {Promise<boolean>} A promise that resolves with the value.
73
+ * @returns A promise that resolves with the value.
74
74
  */
75
75
  export declare function hasGit(): Promise<boolean>;
76
76
  /**
@@ -86,6 +86,6 @@ export declare function ciPlatform(env?: NodeJS.ProcessEnv): {
86
86
  /**
87
87
  * Returns the first mac address found
88
88
  *
89
- * @returns {Promise<string>} Mac address
89
+ * @returns Mac address
90
90
  */
91
91
  export declare function macAddress(): Promise<string>;