@shopify/cli-kit 3.60.0 → 3.61.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 (70) hide show
  1. package/assets/cli-ruby/lib/project_types/extension/messages/messages.rb +1 -1
  2. package/assets/cli-ruby/lib/project_types/extension/models/specifications.rb +3 -1
  3. package/assets/cli-ruby/lib/shopify_cli/constants.rb +1 -1
  4. package/assets/cli-ruby/lib/shopify_cli/exception_reporter.rb +1 -0
  5. package/dist/private/node/api.d.ts +1 -1
  6. package/dist/private/node/api.js +1 -1
  7. package/dist/private/node/api.js.map +1 -1
  8. package/dist/private/node/constants.d.ts +1 -0
  9. package/dist/private/node/constants.js +3 -0
  10. package/dist/private/node/constants.js.map +1 -1
  11. package/dist/private/node/session/exchange.d.ts +1 -0
  12. package/dist/private/node/session/exchange.js +6 -2
  13. package/dist/private/node/session/exchange.js.map +1 -1
  14. package/dist/private/node/session/identity-token-validation.js +4 -0
  15. package/dist/private/node/session/identity-token-validation.js.map +1 -1
  16. package/dist/private/node/session/identity.js +9 -0
  17. package/dist/private/node/session/identity.js.map +1 -1
  18. package/dist/private/node/session/scopes.js +4 -0
  19. package/dist/private/node/session/scopes.js.map +1 -1
  20. package/dist/private/node/session/validate.js +5 -0
  21. package/dist/private/node/session/validate.js.map +1 -1
  22. package/dist/private/node/session.d.ts +10 -0
  23. package/dist/private/node/session.js +11 -3
  24. package/dist/private/node/session.js.map +1 -1
  25. package/dist/private/node/ui/components/ConcurrentOutput.d.ts +6 -1
  26. package/dist/private/node/ui/components/ConcurrentOutput.js +54 -25
  27. package/dist/private/node/ui/components/ConcurrentOutput.js.map +1 -1
  28. package/dist/private/node/ui/components/ConcurrentOutput.test.js +124 -15
  29. package/dist/private/node/ui/components/ConcurrentOutput.test.js.map +1 -1
  30. package/dist/private/node/ui/components/TextPrompt.d.ts +1 -0
  31. package/dist/private/node/ui/components/TextPrompt.js +2 -2
  32. package/dist/private/node/ui/components/TextPrompt.js.map +1 -1
  33. package/dist/private/node/ui/utilities.js +3 -1
  34. package/dist/private/node/ui/utilities.js.map +1 -1
  35. package/dist/public/common/version.d.ts +1 -1
  36. package/dist/public/common/version.js +1 -1
  37. package/dist/public/common/version.js.map +1 -1
  38. package/dist/public/node/api/{shopify-developers.d.ts → app-management.d.ts} +2 -2
  39. package/dist/public/node/api/{shopify-developers.js → app-management.js} +6 -6
  40. package/dist/public/node/api/app-management.js.map +1 -0
  41. package/dist/public/node/context/fqdn.d.ts +3 -3
  42. package/dist/public/node/context/fqdn.js +3 -3
  43. package/dist/public/node/context/fqdn.js.map +1 -1
  44. package/dist/public/node/custom-oclif-loader.d.ts +6 -0
  45. package/dist/public/node/custom-oclif-loader.js +6 -3
  46. package/dist/public/node/custom-oclif-loader.js.map +1 -1
  47. package/dist/public/node/fs.d.ts +1 -1
  48. package/dist/public/node/fs.js +3 -2
  49. package/dist/public/node/fs.js.map +1 -1
  50. package/dist/public/node/http.d.ts +1 -1
  51. package/dist/public/node/http.js +1 -1
  52. package/dist/public/node/http.js.map +1 -1
  53. package/dist/public/node/logs.d.ts +3 -0
  54. package/dist/public/node/logs.js +11 -0
  55. package/dist/public/node/logs.js.map +1 -0
  56. package/dist/public/node/schema.d.ts +2 -2
  57. package/dist/public/node/schema.js.map +1 -1
  58. package/dist/public/node/session.d.ts +9 -0
  59. package/dist/public/node/session.js +18 -0
  60. package/dist/public/node/session.js.map +1 -1
  61. package/dist/public/node/themes/types.d.ts +21 -0
  62. package/dist/public/node/themes/types.js.map +1 -1
  63. package/dist/public/node/toml.d.ts +1 -1
  64. package/dist/public/node/toml.js.map +1 -1
  65. package/dist/public/node/ui/components.d.ts +1 -1
  66. package/dist/public/node/ui/components.js +1 -1
  67. package/dist/public/node/ui/components.js.map +1 -1
  68. package/dist/tsconfig.tsbuildinfo +1 -1
  69. package/package.json +1 -1
  70. package/dist/public/node/api/shopify-developers.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"TextPrompt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Q,EAAE,CAAC;oBACd,oBAAC,SAAS,IACR,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE;4BACnB,SAAS,CAAC,MAAM,CAAC,CAAA;4BACjB,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;wBAClC,CAAC,EACD,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,GAClB,CACE,CACF;YACN,oBAAC,GAAG,IAAC,UAAU,EAAE,CAAC;gBAChB,oBAAC,IAAI,IAAC,KAAK,EAAE,KAAK,IAAG,SAAS,CAAQ,CAClC;YACL,WAAW,KAAK,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CACnC,oBAAC,GAAG,IAAC,UAAU,EAAE,CAAC;gBAChB,oBAAC,IAAI,IAAC,KAAK,EAAE,KAAK,IAAG,KAAK,CAAQ,CAC9B,CACP,CAAC,CAAC,CAAC,IAAI;YACP,WAAW,KAAK,WAAW,CAAC,KAAK,IAAI,OAAO,CAAC,CAAC,CAAC,CAC9C,oBAAC,GAAG,IAAC,UAAU,EAAE,CAAC;gBAChB,oBAAC,aAAa,IAAC,IAAI,EAAE,OAAO,CAAC,eAAe,CAAC,GAAI,CAC7C,CACP,CAAC,CAAC,CAAC,IAAI,CACJ,CACP,CACG,CACP,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAC,UAAU,EAAC,CAAA","sourcesContent":["import {TextInput} from './TextInput.js'\nimport {InlineToken, TokenItem, TokenizedText} from './TokenizedText.js'\nimport {handleCtrlC} from '../../ui.js'\nimport useLayout from '../hooks/use-layout.js'\nimport {messageWithPunctuation} from '../utilities.js'\nimport {AbortSignal} from '../../../../public/node/abort.js'\nimport useAbortSignal from '../hooks/use-abort-signal.js'\nimport usePrompt, {PromptState} from '../hooks/use-prompt.js'\nimport React, {FunctionComponent, useCallback, useEffect, useState} from 'react'\nimport {Box, useApp, useInput, Text} from 'ink'\nimport figures from 'figures'\n\nexport interface TextPromptProps {\n message: string\n onSubmit: (value: string) => void\n defaultValue?: string\n password?: boolean\n validate?: (value: string) => string | undefined\n allowEmpty?: boolean\n emptyDisplayedValue?: string\n abortSignal?: AbortSignal\n preview?: (value: string) => TokenItem<InlineToken>\n}\n\nconst TextPrompt: FunctionComponent<TextPromptProps> = ({\n message,\n onSubmit,\n validate,\n defaultValue = '',\n password = false,\n allowEmpty = false,\n emptyDisplayedValue = '(empty)',\n abortSignal,\n preview,\n}) => {\n if (password && defaultValue) {\n throw new Error(\"Can't use defaultValue with password\")\n }\n\n const validateAnswer = useCallback(\n (value: string): string | undefined => {\n if (validate) {\n return validate(value)\n }\n\n if (value.length === 0 && !allowEmpty) return 'Type an answer to the prompt.'\n\n return undefined\n },\n [allowEmpty, validate],\n )\n\n const {oneThird} = useLayout()\n const {promptState, setPromptState, answer, setAnswer} = usePrompt<string>({\n initialAnswer: '',\n })\n const answerOrDefault = answer.length > 0 ? answer : defaultValue\n const displayEmptyValue = answerOrDefault === ''\n const displayedAnswer = displayEmptyValue ? emptyDisplayedValue : answerOrDefault\n const {exit: unmountInk} = useApp()\n const [error, setError] = useState<string | undefined>(undefined)\n const color = promptState === PromptState.Error ? 'red' : 'cyan'\n const underline = new Array(oneThird - 3).fill('▔')\n const {isAborted} = useAbortSignal(abortSignal)\n\n useInput((input, key) => {\n handleCtrlC(input, key)\n\n if (key.return) {\n const error = validateAnswer(answerOrDefault)\n\n if (error) {\n setPromptState(PromptState.Error)\n setError(error)\n } else {\n setPromptState(PromptState.Submitted)\n }\n }\n })\n\n useEffect(() => {\n if (promptState === PromptState.Submitted) {\n onSubmit(answerOrDefault)\n unmountInk()\n }\n }, [answerOrDefault, onSubmit, promptState, unmountInk])\n\n return isAborted ? null : (\n <Box flexDirection=\"column\" marginBottom={1} width={oneThird}>\n <Box>\n <Box marginRight={2}>\n <Text>?</Text>\n </Box>\n <TokenizedText item={messageWithPunctuation(message)} />\n </Box>\n {promptState === PromptState.Submitted ? (\n <Box>\n <Box marginRight={2}>\n <Text color=\"cyan\">{figures.tick}</Text>\n </Box>\n\n <Box flexGrow={1}>\n <Text color=\"cyan\" dimColor={displayEmptyValue}>\n {password ? '*'.repeat(answer.length) : displayedAnswer}\n </Text>\n </Box>\n </Box>\n ) : (\n <Box flexDirection=\"column\">\n <Box>\n <Box marginRight={2}>\n <Text color={color}>{`>`}</Text>\n </Box>\n <Box flexGrow={1}>\n <TextInput\n value={answer}\n onChange={(answer) => {\n setAnswer(answer)\n setPromptState(PromptState.Idle)\n }}\n defaultValue={defaultValue}\n color={color}\n password={password}\n />\n </Box>\n </Box>\n <Box marginLeft={3}>\n <Text color={color}>{underline}</Text>\n </Box>\n {promptState === PromptState.Error ? (\n <Box marginLeft={3}>\n <Text color={color}>{error}</Text>\n </Box>\n ) : null}\n {promptState !== PromptState.Error && preview ? (\n <Box marginLeft={3}>\n <TokenizedText item={preview(answerOrDefault)} />\n </Box>\n ) : null}\n </Box>\n )}\n </Box>\n )\n}\n\nexport {TextPrompt}\n"]}
1
+ {"version":3,"file":"TextPrompt.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/TextPrompt.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAyB,aAAa,EAAC,MAAM,oBAAoB,CAAA;AACxE,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAA;AACvC,OAAO,SAAS,MAAM,wBAAwB,CAAA;AAC9C,OAAO,EAAC,sBAAsB,EAAC,MAAM,iBAAiB,CAAA;AAEtD,OAAO,cAAc,MAAM,8BAA8B,CAAA;AACzD,OAAO,SAAS,EAAE,EAAC,WAAW,EAAC,MAAM,wBAAwB,CAAA;AAC7D,OAAO,KAAK,EAAE,EAAoB,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAA;AAChF,OAAO,EAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAC,MA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Q,CAC9B,CACP,CAAC,CAAC,CAAC,IAAI;YACP,WAAW,KAAK,WAAW,CAAC,KAAK,IAAI,OAAO,CAAC,CAAC,CAAC,CAC9C,oBAAC,GAAG,IAAC,UAAU,EAAE,CAAC;gBAChB,oBAAC,aAAa,IAAC,IAAI,EAAE,OAAO,CAAC,eAAe,CAAC,GAAI,CAC7C,CACP,CAAC,CAAC,CAAC,IAAI,CACJ,CACP,CACG,CACP,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAC,UAAU,EAAC,CAAA","sourcesContent":["import {TextInput} from './TextInput.js'\nimport {InlineToken, TokenItem, TokenizedText} from './TokenizedText.js'\nimport {handleCtrlC} from '../../ui.js'\nimport useLayout from '../hooks/use-layout.js'\nimport {messageWithPunctuation} from '../utilities.js'\nimport {AbortSignal} from '../../../../public/node/abort.js'\nimport useAbortSignal from '../hooks/use-abort-signal.js'\nimport usePrompt, {PromptState} from '../hooks/use-prompt.js'\nimport React, {FunctionComponent, useCallback, useEffect, useState} from 'react'\nimport {Box, useApp, useInput, Text} from 'ink'\nimport figures from 'figures'\n\nexport interface TextPromptProps {\n message: string\n onSubmit: (value: string) => void\n defaultValue?: string\n password?: boolean\n validate?: (value: string) => string | undefined\n allowEmpty?: boolean\n emptyDisplayedValue?: string\n abortSignal?: AbortSignal\n preview?: (value: string) => TokenItem<InlineToken>\n initialAnswer?: string\n}\n\nconst TextPrompt: FunctionComponent<TextPromptProps> = ({\n message,\n onSubmit,\n validate,\n defaultValue = '',\n password = false,\n allowEmpty = false,\n emptyDisplayedValue = '(empty)',\n abortSignal,\n preview,\n initialAnswer = '',\n}) => {\n if (password && defaultValue) {\n throw new Error(\"Can't use defaultValue with password\")\n }\n\n const validateAnswer = useCallback(\n (value: string): string | undefined => {\n if (validate) {\n return validate(value)\n }\n\n if (value.length === 0 && !allowEmpty) return 'Type an answer to the prompt.'\n\n return undefined\n },\n [allowEmpty, validate],\n )\n\n const {oneThird} = useLayout()\n const {promptState, setPromptState, answer, setAnswer} = usePrompt<string>({\n initialAnswer,\n })\n const answerOrDefault = answer.length > 0 ? answer : defaultValue\n const displayEmptyValue = answerOrDefault === ''\n const displayedAnswer = displayEmptyValue ? emptyDisplayedValue : answerOrDefault\n const {exit: unmountInk} = useApp()\n const [error, setError] = useState<string | undefined>(undefined)\n const color = promptState === PromptState.Error ? 'red' : 'cyan'\n const underline = new Array(oneThird - 3).fill('▔')\n const {isAborted} = useAbortSignal(abortSignal)\n\n useInput((input, key) => {\n handleCtrlC(input, key)\n\n if (key.return) {\n const error = validateAnswer(answerOrDefault)\n\n if (error) {\n setPromptState(PromptState.Error)\n setError(error)\n } else {\n setPromptState(PromptState.Submitted)\n }\n }\n })\n\n useEffect(() => {\n if (promptState === PromptState.Submitted) {\n onSubmit(answerOrDefault)\n unmountInk()\n }\n }, [answerOrDefault, onSubmit, promptState, unmountInk])\n\n return isAborted ? null : (\n <Box flexDirection=\"column\" marginBottom={1} width={oneThird}>\n <Box>\n <Box marginRight={2}>\n <Text>?</Text>\n </Box>\n <TokenizedText item={messageWithPunctuation(message)} />\n </Box>\n {promptState === PromptState.Submitted ? (\n <Box>\n <Box marginRight={2}>\n <Text color=\"cyan\">{figures.tick}</Text>\n </Box>\n\n <Box flexGrow={1}>\n <Text color=\"cyan\" dimColor={displayEmptyValue}>\n {password ? '*'.repeat(answer.length) : displayedAnswer}\n </Text>\n </Box>\n </Box>\n ) : (\n <Box flexDirection=\"column\">\n <Box>\n <Box marginRight={2}>\n <Text color={color}>{`>`}</Text>\n </Box>\n <Box flexGrow={1}>\n <TextInput\n value={answer}\n onChange={(answer) => {\n setAnswer(answer)\n setPromptState(PromptState.Idle)\n }}\n defaultValue={defaultValue}\n color={color}\n password={password}\n />\n </Box>\n </Box>\n <Box marginLeft={3}>\n <Text color={color}>{underline}</Text>\n </Box>\n {promptState === PromptState.Error ? (\n <Box marginLeft={3}>\n <Text color={color}>{error}</Text>\n </Box>\n ) : null}\n {promptState !== PromptState.Error && preview ? (\n <Box marginLeft={3}>\n <TokenizedText item={preview(answerOrDefault)} />\n </Box>\n ) : null}\n </Box>\n )}\n </Box>\n )\n}\n\nexport {TextPrompt}\n"]}
@@ -1,6 +1,8 @@
1
1
  import { appendToTokenItem, tokenItemToString } from './components/TokenizedText.js';
2
2
  export function messageWithPunctuation(message) {
3
3
  const messageToString = tokenItemToString(message);
4
- return messageToString.endsWith('?') || messageToString.endsWith(':') ? message : appendToTokenItem(message, ':');
4
+ return messageToString.endsWith('?') || messageToString.endsWith(':') || messageToString.endsWith('.')
5
+ ? message
6
+ : appendToTokenItem(message, ':');
5
7
  }
6
8
  //# sourceMappingURL=utilities.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utilities.js","sourceRoot":"","sources":["../../../../src/private/node/ui/utilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAa,iBAAiB,EAAC,MAAM,+BAA+B,CAAA;AAE7F,MAAM,UAAU,sBAAsB,CAAC,OAAkB;IACvD,MAAM,eAAe,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAA;IAClD,OAAO,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,iBAAiB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;AACnH,CAAC","sourcesContent":["import {appendToTokenItem, TokenItem, tokenItemToString} from './components/TokenizedText.js'\n\nexport function messageWithPunctuation(message: TokenItem) {\n const messageToString = tokenItemToString(message)\n return messageToString.endsWith('?') || messageToString.endsWith(':') ? message : appendToTokenItem(message, ':')\n}\n"]}
1
+ {"version":3,"file":"utilities.js","sourceRoot":"","sources":["../../../../src/private/node/ui/utilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAa,iBAAiB,EAAC,MAAM,+BAA+B,CAAA;AAE7F,MAAM,UAAU,sBAAsB,CAAC,OAAkB;IACvD,MAAM,eAAe,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAA;IAClD,OAAO,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC;QACpG,CAAC,CAAC,OAAO;QACT,CAAC,CAAC,iBAAiB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;AACrC,CAAC","sourcesContent":["import {appendToTokenItem, TokenItem, tokenItemToString} from './components/TokenizedText.js'\n\nexport function messageWithPunctuation(message: TokenItem) {\n const messageToString = tokenItemToString(message)\n return messageToString.endsWith('?') || messageToString.endsWith(':') || messageToString.endsWith('.')\n ? message\n : appendToTokenItem(message, ':')\n}\n"]}
@@ -1 +1 @@
1
- export declare const CLI_KIT_VERSION = "3.60.0";
1
+ export declare const CLI_KIT_VERSION = "3.61.0";
@@ -1,2 +1,2 @@
1
- export const CLI_KIT_VERSION = '3.60.0';
1
+ export const CLI_KIT_VERSION = '3.61.0';
2
2
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/public/common/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAA","sourcesContent":["export const CLI_KIT_VERSION = '3.60.0'\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/public/common/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAA","sourcesContent":["export const CLI_KIT_VERSION = '3.61.0'\n"]}
@@ -1,6 +1,6 @@
1
1
  import { GraphQLVariables, GraphQLResponse } from './graphql.js';
2
2
  /**
3
- * Executes an org-scoped GraphQL query against the Developers API.
3
+ * Executes an org-scoped GraphQL query against the App Management API.
4
4
  *
5
5
  * @param orgId - The organization ID.
6
6
  * @param query - GraphQL query to execute.
@@ -8,7 +8,7 @@ import { GraphQLVariables, GraphQLResponse } from './graphql.js';
8
8
  * @param variables - GraphQL variables to pass to the query.
9
9
  * @returns The response of the query of generic type <T>.
10
10
  */
11
- export declare function orgScopedShopifyDevelopersRequest<T>(orgId: string, query: string, token: string, variables?: GraphQLVariables): Promise<T>;
11
+ export declare function appManagementRequest<T>(orgId: string, query: string, token: string, variables?: GraphQLVariables): Promise<T>;
12
12
  /**
13
13
  * Sets the next deprecation date from [GraphQL response extensions](https://www.apollographql.com/docs/resources/graphql-glossary/#extensions)
14
14
  * if `response.extensions.deprecations` objects contain a `supportedUntilDate` (ISO 8601-formatted string).
@@ -1,5 +1,5 @@
1
1
  import { graphqlRequest } from './graphql.js';
2
- import { shopifyDevelopersFqdn } from '../context/fqdn.js';
2
+ import { appManagementFqdn } from '../context/fqdn.js';
3
3
  import { setNextDeprecationDate } from '../../../private/node/context/deprecations-store.js';
4
4
  import Bottleneck from 'bottleneck';
5
5
  // API Rate limiter for partners API (Limit is 10 requests per second)
@@ -10,7 +10,7 @@ const limiter = new Bottleneck({
10
10
  maxConcurrent: 10,
11
11
  });
12
12
  /**
13
- * Executes an org-scoped GraphQL query against the Developers API.
13
+ * Executes an org-scoped GraphQL query against the App Management API.
14
14
  *
15
15
  * @param orgId - The organization ID.
16
16
  * @param query - GraphQL query to execute.
@@ -18,9 +18,9 @@ const limiter = new Bottleneck({
18
18
  * @param variables - GraphQL variables to pass to the query.
19
19
  * @returns The response of the query of generic type <T>.
20
20
  */
21
- export async function orgScopedShopifyDevelopersRequest(orgId, query, token, variables) {
22
- const api = 'Shopify Developers';
23
- const fqdn = await shopifyDevelopersFqdn();
21
+ export async function appManagementRequest(orgId, query, token, variables) {
22
+ const api = 'App Management';
23
+ const fqdn = await appManagementFqdn();
24
24
  const url = `https://${fqdn}/organization/${orgId}/graphql`;
25
25
  const result = limiter.schedule(() => graphqlRequest({
26
26
  query,
@@ -49,4 +49,4 @@ export function handleDeprecations(response) {
49
49
  }
50
50
  setNextDeprecationDate(deprecationDates);
51
51
  }
52
- //# sourceMappingURL=shopify-developers.js.map
52
+ //# sourceMappingURL=app-management.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-management.js","sourceRoot":"","sources":["../../../../src/public/node/api/app-management.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAoC,MAAM,cAAc,CAAA;AAC9E,OAAO,EAAC,iBAAiB,EAAC,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAC,sBAAsB,EAAC,MAAM,qDAAqD,CAAA;AAC1F,OAAO,UAAU,MAAM,YAAY,CAAA;AAEnC,sEAAsE;AACtE,yEAAyE;AACzE,iDAAiD;AACjD,MAAM,OAAO,GAAG,IAAI,UAAU,CAAC;IAC7B,OAAO,EAAE,GAAG;IACZ,aAAa,EAAE,EAAE;CAClB,CAAC,CAAA;AAEF;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,KAAa,EACb,KAAa,EACb,KAAa,EACb,SAA4B;IAE5B,MAAM,GAAG,GAAG,gBAAgB,CAAA;IAC5B,MAAM,IAAI,GAAG,MAAM,iBAAiB,EAAE,CAAA;IACtC,MAAM,GAAG,GAAG,WAAW,IAAI,iBAAiB,KAAK,UAAU,CAAA;IAC3D,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAI,GAAG,EAAE,CACtC,cAAc,CAAC;QACb,KAAK;QACL,GAAG;QACH,GAAG;QACH,KAAK;QACL,SAAS;QACT,eAAe,EAAE,EAAC,UAAU,EAAE,kBAAkB,EAAC;KAClD,CAAC,CACH,CAAA;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AAUD;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAI,QAA4B;IAChE,IAAI,CAAC,QAAQ,CAAC,UAAU;QAAE,OAAM;IAEhC,MAAM,gBAAgB,GAAW,EAAE,CAAA;IACnC,KAAK,MAAM,WAAW,IAAK,QAAQ,CAAC,UAA+B,CAAC,YAAY,EAAE;QAChF,IAAI,WAAW,CAAC,kBAAkB,EAAE;YAClC,gBAAgB,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAA;SAChE;KACF;IAED,sBAAsB,CAAC,gBAAgB,CAAC,CAAA;AAC1C,CAAC","sourcesContent":["import {graphqlRequest, GraphQLVariables, GraphQLResponse} from './graphql.js'\nimport {appManagementFqdn} from '../context/fqdn.js'\nimport {setNextDeprecationDate} from '../../../private/node/context/deprecations-store.js'\nimport Bottleneck from 'bottleneck'\n\n// API Rate limiter for partners API (Limit is 10 requests per second)\n// Jobs are launched every 150ms to add an extra 50ms margin per request.\n// Only 10 requests can be executed concurrently.\nconst limiter = new Bottleneck({\n minTime: 150,\n maxConcurrent: 10,\n})\n\n/**\n * Executes an org-scoped GraphQL query against the App Management API.\n *\n * @param orgId - The organization ID.\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 of generic type <T>.\n */\nexport async function appManagementRequest<T>(\n orgId: string,\n query: string,\n token: string,\n variables?: GraphQLVariables,\n): Promise<T> {\n const api = 'App Management'\n const fqdn = await appManagementFqdn()\n const url = `https://${fqdn}/organization/${orgId}/graphql`\n const result = limiter.schedule<T>(() =>\n graphqlRequest({\n query,\n api,\n url,\n token,\n variables,\n responseOptions: {onResponse: handleDeprecations},\n }),\n )\n\n return result\n}\n\ninterface Deprecation {\n supportedUntilDate?: string\n}\n\ninterface WithDeprecations {\n deprecations: Deprecation[]\n}\n\n/**\n * Sets the next deprecation date from [GraphQL response extensions](https://www.apollographql.com/docs/resources/graphql-glossary/#extensions)\n * if `response.extensions.deprecations` objects contain a `supportedUntilDate` (ISO 8601-formatted string).\n *\n * @param response - The response of the query.\n */\nexport function handleDeprecations<T>(response: GraphQLResponse<T>): void {\n if (!response.extensions) return\n\n const deprecationDates: Date[] = []\n for (const deprecation of (response.extensions as WithDeprecations).deprecations) {\n if (deprecation.supportedUntilDate) {\n deprecationDates.push(new Date(deprecation.supportedUntilDate))\n }\n }\n\n setNextDeprecationDate(deprecationDates)\n}\n"]}
@@ -10,11 +10,11 @@ export declare const NotProvidedStoreFQDNError: AbortError;
10
10
  */
11
11
  export declare function partnersFqdn(): Promise<string>;
12
12
  /**
13
- * It returns the Shopify Developers' API service we should interact with.
13
+ * It returns the App Management API service we should interact with.
14
14
  *
15
- * @returns Fully-qualified domain of the Shopify Developers service we should interact with.
15
+ * @returns Fully-qualified domain of the App Management service we should interact with.
16
16
  */
17
- export declare function shopifyDevelopersFqdn(): Promise<string>;
17
+ export declare function appManagementFqdn(): Promise<string>;
18
18
  /**
19
19
  * It returns the BusinessPlatform' API service we should interact with.
20
20
  *
@@ -23,11 +23,11 @@ export async function partnersFqdn() {
23
23
  }
24
24
  }
25
25
  /**
26
- * It returns the Shopify Developers' API service we should interact with.
26
+ * It returns the App Management API service we should interact with.
27
27
  *
28
- * @returns Fully-qualified domain of the Shopify Developers service we should interact with.
28
+ * @returns Fully-qualified domain of the App Management service we should interact with.
29
29
  */
30
- export async function shopifyDevelopersFqdn() {
30
+ export async function appManagementFqdn() {
31
31
  const environment = serviceEnvironment();
32
32
  const productionFqdn = 'shopify.com';
33
33
  switch (environment) {
@@ -1 +1 @@
1
- {"version":3,"file":"fqdn.js","sourceRoot":"","sources":["../../../../src/public/node/context/fqdn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAA;AACrD,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAA;AACtC,OAAO,EAAC,kBAAkB,EAAC,MAAM,0CAA0C,CAAA;AAE3E,MAAM,CAAC,MAAM,kCAAkC,GAAG,IAAI,UAAU,CAC9D,iGAAiG,CAClG,CAAA;AACD,MAAM,CAAC,MAAM,kCAAkC,GAAG,IAAI,UAAU,CAC9D,iGAAiG,CAClG,CAAA;AACD,MAAM,CAAC,MAAM,iCAAiC,GAAG,IAAI,UAAU,CAC7D,gGAAgG,CACjG,CAAA;AAC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K,MAAM;YACT,OAAO,YAAY,MAAM,QAAQ,EAAE,EAAE,CAAA;QACvC;YACE,OAAO,cAAc,CAAA;KACxB;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,KAAa;IACpD,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;IACtE,MAAM,SAAS,GAAG,KAAK,EAAE,SAAiB,EAAE,EAAE,CAC5C,iBAAiB,EAAE,CAAC,CAAC,CAAC,GAAG,SAAS,YAAY,MAAM,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,SAAS,gBAAgB,CAAA;IACjG,MAAM,aAAa,GAAG,CAAC,SAAiB,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;IACnH,OAAO,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAA;AACpE,CAAC","sourcesContent":["import {isSpinEnvironment, spinFqdn} from './spin.js'\nimport {AbortError} from '../error.js'\nimport {serviceEnvironment} from '../../../private/node/context/service.js'\n\nexport const CouldntObtainPartnersSpinFQDNError = new AbortError(\n \"Couldn't obtain the Spin FQDN for Partners when the CLI is not running from a Spin environment.\",\n)\nexport const CouldntObtainIdentitySpinFQDNError = new AbortError(\n \"Couldn't obtain the Spin FQDN for Identity when the CLI is not running from a Spin environment.\",\n)\nexport const CouldntObtainShopifySpinFQDNError = new AbortError(\n \"Couldn't obtain the Spin FQDN for Shopify when the CLI is not running from a Spin environment.\",\n)\nexport const NotProvidedStoreFQDNError = new AbortError(\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 *\n * @returns Fully-qualified domain of the partners service we should interact with.\n */\nexport async function partnersFqdn(): 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 Shopify Developers' API service we should interact with.\n *\n * @returns Fully-qualified domain of the Shopify Developers service we should interact with.\n */\nexport async function shopifyDevelopersFqdn(): Promise<string> {\n const environment = serviceEnvironment()\n const productionFqdn = 'shopify.com'\n switch (environment) {\n case 'local':\n return 'app.shopify.myshopify.io'\n case 'spin':\n return `app.shopify.${await spinFqdn()}`\n default:\n return productionFqdn\n }\n}\n\n/**\n * It returns the BusinessPlatform' API service we should interact with.\n *\n * @returns Fully-qualified domain of the partners service we should interact with.\n */\nexport async function businessPlatformFqdn(): Promise<string> {\n const environment = serviceEnvironment()\n const productionFqdn = 'destinations.shopifysvc.com'\n switch (environment) {\n case 'local':\n return 'business-platform.myshopify.io'\n case 'spin':\n return `business-platform.${await spinFqdn()}`\n default:\n return productionFqdn\n }\n}\n\n/**\n * It returns the Identity service we should interact with.\n *\n * @returns Fully-qualified domain of the Identity service we should interact with.\n */\nexport async function identityFqdn(): 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 * Normalize the store name to be used in the CLI.\n * It will add the .myshopify.com domain if it's not present.\n * It will add the spin domain if it's not present and we're in a Spin environment.\n *\n * @param store - Store name.\n * @returns Normalized store name.\n */\nexport async function normalizeStoreFqdn(store: string): Promise<string> {\n const storeFqdn = store.replace(/^https?:\\/\\//, '').replace(/\\/$/, '')\n const addDomain = async (storeFqdn: string) =>\n isSpinEnvironment() ? `${storeFqdn}.shopify.${await spinFqdn()}` : `${storeFqdn}.myshopify.com`\n const containDomain = (storeFqdn: string) => storeFqdn.includes('.myshopify.com') || storeFqdn.includes('spin.dev')\n return containDomain(storeFqdn) ? storeFqdn : addDomain(storeFqdn)\n}\n"]}
1
+ {"version":3,"file":"fqdn.js","sourceRoot":"","sources":["../../../../src/public/node/context/fqdn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAA;AACrD,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAA;AACtC,OAAO,EAAC,kBAAkB,EAAC,MAAM,0CAA0C,CAAA;AAE3E,MAAM,CAAC,MAAM,kCAAkC,GAAG,IAAI,UAAU,CAC9D,iGAAiG,CAClG,CAAA;AACD,MAAM,CAAC,MAAM,kCAAkC,GAAG,IAAI,UAAU,CAC9D,iGAAiG,CAClG,CAAA;AACD,MAAM,CAAC,MAAM,iCAAiC,GAAG,IAAI,UAAU,CAC7D,gGAAgG,CACjG,CAAA;AACD,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,UAAU,CACrD,2EAA2E,CAC5E,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY;IAChC,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,iBAAiB;IACrC,MAAM,WAAW,GAAG,kBAAkB,EAAE,CAAA;IACxC,MAAM,cAAc,GAAG,aAAa,CAAA;IACpC,QAAQ,WAAW,EAAE;QACnB,KAAK,OAAO;YACV,OAAO,0BAA0B,CAAA;QACnC,KAAK,MAAM;YACT,OAAO,eAAe,MAAM,QAAQ,EAAE,EAA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CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAA;AACpE,CAAC","sourcesContent":["import {isSpinEnvironment, spinFqdn} from './spin.js'\nimport {AbortError} from '../error.js'\nimport {serviceEnvironment} from '../../../private/node/context/service.js'\n\nexport const CouldntObtainPartnersSpinFQDNError = new AbortError(\n \"Couldn't obtain the Spin FQDN for Partners when the CLI is not running from a Spin environment.\",\n)\nexport const CouldntObtainIdentitySpinFQDNError = new AbortError(\n \"Couldn't obtain the Spin FQDN for Identity when the CLI is not running from a Spin environment.\",\n)\nexport const CouldntObtainShopifySpinFQDNError = new AbortError(\n \"Couldn't obtain the Spin FQDN for Shopify when the CLI is not running from a Spin environment.\",\n)\nexport const NotProvidedStoreFQDNError = new AbortError(\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 *\n * @returns Fully-qualified domain of the partners service we should interact with.\n */\nexport async function partnersFqdn(): 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 App Management API service we should interact with.\n *\n * @returns Fully-qualified domain of the App Management service we should interact with.\n */\nexport async function appManagementFqdn(): Promise<string> {\n const environment = serviceEnvironment()\n const productionFqdn = 'shopify.com'\n switch (environment) {\n case 'local':\n return 'app.shopify.myshopify.io'\n case 'spin':\n return `app.shopify.${await spinFqdn()}`\n default:\n return productionFqdn\n }\n}\n\n/**\n * It returns the BusinessPlatform' API service we should interact with.\n *\n * @returns Fully-qualified domain of the partners service we should interact with.\n */\nexport async function businessPlatformFqdn(): Promise<string> {\n const environment = serviceEnvironment()\n const productionFqdn = 'destinations.shopifysvc.com'\n switch (environment) {\n case 'local':\n return 'business-platform.myshopify.io'\n case 'spin':\n return `business-platform.${await spinFqdn()}`\n default:\n return productionFqdn\n }\n}\n\n/**\n * It returns the Identity service we should interact with.\n *\n * @returns Fully-qualified domain of the Identity service we should interact with.\n */\nexport async function identityFqdn(): 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 * Normalize the store name to be used in the CLI.\n * It will add the .myshopify.com domain if it's not present.\n * It will add the spin domain if it's not present and we're in a Spin environment.\n *\n * @param store - Store name.\n * @returns Normalized store name.\n */\nexport async function normalizeStoreFqdn(store: string): Promise<string> {\n const storeFqdn = store.replace(/^https?:\\/\\//, '').replace(/\\/$/, '')\n const addDomain = async (storeFqdn: string) =>\n isSpinEnvironment() ? `${storeFqdn}.shopify.${await spinFqdn()}` : `${storeFqdn}.myshopify.com`\n const containDomain = (storeFqdn: string) => storeFqdn.includes('.myshopify.com') || storeFqdn.includes('spin.dev')\n return containDomain(storeFqdn) ? storeFqdn : addDomain(storeFqdn)\n}\n"]}
@@ -4,3 +4,9 @@ export declare class ShopifyConfig extends Config {
4
4
  constructor(options: Options);
5
5
  customPriority(commands: Command.Loadable[]): Command.Loadable | undefined;
6
6
  }
7
+ /**
8
+ * Tries to get the value of the `--path` argument, if provided.
9
+ *
10
+ * @returns The value of the `--path` argument, if provided.
11
+ */
12
+ export declare function sniffForPath(): string | undefined;
@@ -1,10 +1,13 @@
1
- import { cwd, joinPath } from './path.js';
2
1
  import { fileExistsSync } from './fs.js';
2
+ import { cwd, joinPath } from './path.js';
3
3
  import { Config } from '@oclif/core';
4
4
  export class ShopifyConfig extends Config {
5
5
  constructor(options) {
6
6
  const path = sniffForPath() ?? cwd();
7
7
  if (fileExistsSync(joinPath(`${path}`, 'package.json'))) {
8
+ // Hydrogen is bundled, but we still want to support loading it as an external plugin for two reasons:
9
+ // 1. To allow users to use an older version of Hydrogen. (to not force upgrades)
10
+ // 2. To allow the Hydrogen team to load a local version for testing.
8
11
  options.pluginAdditions = {
9
12
  core: ['@shopify/cli-hydrogen'],
10
13
  path,
@@ -23,7 +26,7 @@ export class ShopifyConfig extends Config {
23
26
  const pluginAliasB = bCommand.pluginAlias ?? 'B-Cannot-Find-This';
24
27
  const aIndex = oclifPlugins.indexOf(pluginAliasA);
25
28
  const bIndex = oclifPlugins.indexOf(pluginAliasB);
26
- // Hydrogen has higher priority than core plugins to override the custom init method.
29
+ // If there is an external cli-hydrogen plugin, its commands should take priority over bundled ('core') commands
27
30
  if (aCommand.pluginType === 'core' && bCommand.pluginAlias === '@shopify/cli-hydrogen') {
28
31
  // If b is hydrogen and a is core sort b first
29
32
  return 1;
@@ -65,7 +68,7 @@ export class ShopifyConfig extends Config {
65
68
  *
66
69
  * @returns The value of the `--path` argument, if provided.
67
70
  */
68
- function sniffForPath() {
71
+ export function sniffForPath() {
69
72
  const pathFlagIndex = process.argv.indexOf('--path');
70
73
  if (pathFlagIndex === -1)
71
74
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"custom-oclif-loader.js","sourceRoot":"","sources":["../../../src/public/node/custom-oclif-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAA;AACvC,OAAO,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;AACtC,OAAO,EAAU,MAAM,EAAC,MAAM,aAAa,CAAA;AAG3C,MAAM,OAAO,aAAc,SAAQ,MAAM;IACvC,YAAY,OAAgB;QAC1B,MAAM,IAAI,GAAG,YAAY,EAAE,IAAI,GAAG,EAAE,CAAA;QACpC,IAAI,cAAc,CAAC,QAAQ,CAAC,GAAG,IAAI,EAAE,EAAE,cAAc,CAAC,CAAC,EAAE;YACvD,OAAO,CAAC,eAAe,GAAG;gBACxB,IAAI,EAAE,CAAC,uBAAuB,CAAC;gBAC/B,IAAI;aACL,CAAA;SACF;QACD,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,wCAAwC;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,UAAU,KAAK,MAAM,EAAE;gBACpE,OAAO,CAAC,CAAC,CAAA;aACV;YAED,iDAAiD;YACjD,IAAI,QAAQ,CAAC,UAAU,KAAK,KAAK,IAAI,QAAQ,CAAC,UAAU,KAAK,KAAK,EAAE;gBAClE,OAAO,CAAC,CAAA;aACT;YAED,iDAAiD;YACjD,IAAI,QAAQ,CAAC,UAAU,KAAK,KAAK,IAAI,QAAQ,CAAC,UAAU,KAAK,KAAK,EAAE;gBAClE,OAAO,CAAC,CAAC,CAAA;aACV;YAED,qDAAqD;YACrD,OAAO,CAAC,CAAA;QACV,CAAC,CAAC,CAAA;QACF,OAAO,cAAc,CAAC,CAAC,CAAC,CAAA;IAC1B,CAAC;CACF;AAED;;;;GAIG;AACH,SAAS,YAAY;IACnB,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;IACpD,IAAI,aAAa,KAAK,CAAC,CAAC;QAAE,OAAM;IAChC,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC,CAAA;IAChD,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAM;IACjD,OAAO,QAAQ,CAAA;AACjB,CAAC","sourcesContent":["import {cwd, joinPath} from './path.js'\nimport {fileExistsSync} from './fs.js'\nimport {Command, Config} from '@oclif/core'\nimport {Options} from '@oclif/core/lib/interfaces/plugin.js'\n\nexport class ShopifyConfig extends Config {\n constructor(options: Options) {\n const path = sniffForPath() ?? cwd()\n if (fileExistsSync(joinPath(`${path}`, 'package.json'))) {\n options.pluginAdditions = {\n core: ['@shopify/cli-hydrogen'],\n path,\n }\n }\n super(options)\n // eslint-disable-next-line dot-notation\n this['determinePriority'] = this.customPriority\n }\n\n customPriority(commands: Command.Loadable[]): Command.Loadable | undefined {\n const oclifPlugins = this.pjson.oclif?.plugins ?? []\n const commandPlugins = commands.sort((aCommand, bCommand) => {\n // eslint-disable-next-line no-restricted-syntax\n const pluginAliasA = aCommand.pluginAlias ?? 'A-Cannot-Find-This'\n // eslint-disable-next-line no-restricted-syntax\n const pluginAliasB = bCommand.pluginAlias ?? 'B-Cannot-Find-This'\n const aIndex = oclifPlugins.indexOf(pluginAliasA)\n const bIndex = oclifPlugins.indexOf(pluginAliasB)\n\n // Hydrogen has higher priority than core plugins to override the custom init method.\n if (aCommand.pluginType === 'core' && bCommand.pluginAlias === '@shopify/cli-hydrogen') {\n // If b is hydrogen and a is core sort b first\n return 1\n }\n\n if (aCommand.pluginAlias === '@shopify/cli-hydrogen' && bCommand.pluginType === 'core') {\n // If a is hydrogen and b is core sort a first\n return -1\n }\n\n // All other cases are the default implementation from the private `determinePriority` method\n // When both plugin types are 'core' plugins sort based on index\n if (aCommand.pluginType === 'core' && bCommand.pluginType === 'core') {\n // If b appears first in the pjson.plugins sort it first\n return aIndex - bIndex\n }\n\n // if b is a core plugin and a is not sort b first\n if (bCommand.pluginType === 'core' && aCommand.pluginType !== 'core') {\n return 1\n }\n\n // if a is a core plugin and b is not sort a first\n if (aCommand.pluginType === 'core' && bCommand.pluginType !== 'core') {\n return -1\n }\n\n // if a is a jit plugin and b is not sort b first\n if (aCommand.pluginType === 'jit' && bCommand.pluginType !== 'jit') {\n return 1\n }\n\n // if b is a jit plugin and a is not sort a first\n if (bCommand.pluginType === 'jit' && aCommand.pluginType !== 'jit') {\n return -1\n }\n\n // neither plugin is core, so do not change the order\n return 0\n })\n return commandPlugins[0]\n }\n}\n\n/**\n * Tries to get the value of the `--path` argument, if provided.\n *\n * @returns The value of the `--path` argument, if provided.\n */\nfunction sniffForPath(): string | undefined {\n const pathFlagIndex = process.argv.indexOf('--path')\n if (pathFlagIndex === -1) return\n const pathFlag = process.argv[pathFlagIndex + 1]\n if (!pathFlag || pathFlag.startsWith('-')) return\n return pathFlag\n}\n"]}
1
+ {"version":3,"file":"custom-oclif-loader.js","sourceRoot":"","sources":["../../../src/public/node/custom-o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AI,CAAC,aAAa,GAAG,CAAC,CAAC,CAAA;IAChD,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAM;IACjD,OAAO,QAAQ,CAAA;AACjB,CAAC","sourcesContent":["import {fileExistsSync} from './fs.js'\nimport {cwd, joinPath} from './path.js'\nimport {Command, Config} from '@oclif/core'\nimport {Options} from '@oclif/core/lib/interfaces/plugin.js'\n\nexport class ShopifyConfig extends Config {\n constructor(options: Options) {\n const path = sniffForPath() ?? cwd()\n if (fileExistsSync(joinPath(`${path}`, 'package.json'))) {\n // Hydrogen is bundled, but we still want to support loading it as an external plugin for two reasons:\n // 1. To allow users to use an older version of Hydrogen. (to not force upgrades)\n // 2. To allow the Hydrogen team to load a local version for testing.\n options.pluginAdditions = {\n core: ['@shopify/cli-hydrogen'],\n path,\n }\n }\n super(options)\n\n // eslint-disable-next-line dot-notation\n this['determinePriority'] = this.customPriority\n }\n\n customPriority(commands: Command.Loadable[]): Command.Loadable | undefined {\n const oclifPlugins = this.pjson.oclif?.plugins ?? []\n const commandPlugins = commands.sort((aCommand, bCommand) => {\n // eslint-disable-next-line no-restricted-syntax\n const pluginAliasA = aCommand.pluginAlias ?? 'A-Cannot-Find-This'\n // eslint-disable-next-line no-restricted-syntax\n const pluginAliasB = bCommand.pluginAlias ?? 'B-Cannot-Find-This'\n const aIndex = oclifPlugins.indexOf(pluginAliasA)\n const bIndex = oclifPlugins.indexOf(pluginAliasB)\n\n // If there is an external cli-hydrogen plugin, its commands should take priority over bundled ('core') commands\n if (aCommand.pluginType === 'core' && bCommand.pluginAlias === '@shopify/cli-hydrogen') {\n // If b is hydrogen and a is core sort b first\n return 1\n }\n\n if (aCommand.pluginAlias === '@shopify/cli-hydrogen' && bCommand.pluginType === 'core') {\n // If a is hydrogen and b is core sort a first\n return -1\n }\n\n // All other cases are the default implementation from the private `determinePriority` method\n // When both plugin types are 'core' plugins sort based on index\n if (aCommand.pluginType === 'core' && bCommand.pluginType === 'core') {\n // If b appears first in the pjson.plugins sort it first\n return aIndex - bIndex\n }\n\n // if b is a core plugin and a is not sort b first\n if (bCommand.pluginType === 'core' && aCommand.pluginType !== 'core') {\n return 1\n }\n\n // if a is a core plugin and b is not sort a first\n if (aCommand.pluginType === 'core' && bCommand.pluginType !== 'core') {\n return -1\n }\n\n // if a is a jit plugin and b is not sort b first\n if (aCommand.pluginType === 'jit' && bCommand.pluginType !== 'jit') {\n return 1\n }\n\n // if b is a jit plugin and a is not sort a first\n if (bCommand.pluginType === 'jit' && aCommand.pluginType !== 'jit') {\n return -1\n }\n\n // neither plugin is core, so do not change the order\n return 0\n })\n return commandPlugins[0]\n }\n}\n\n/**\n * Tries to get the value of the `--path` argument, if provided.\n *\n * @returns The value of the `--path` argument, if provided.\n */\nexport function sniffForPath(): string | undefined {\n const pathFlagIndex = process.argv.indexOf('--path')\n if (pathFlagIndex === -1) return\n const pathFlag = process.argv[pathFlagIndex + 1]\n if (!pathFlag || pathFlag.startsWith('-')) return\n return pathFlag\n}\n"]}
@@ -141,7 +141,7 @@ interface RmDirOptions {
141
141
  */
142
142
  export declare function rmdir(path: string, options?: RmDirOptions): Promise<void>;
143
143
  /**
144
- * Create a temporary directory.
144
+ * Create a temporary directory within the OS provided location for temp directories
145
145
  *
146
146
  * @returns Path to the temporary directory.
147
147
  */
@@ -12,6 +12,7 @@ import { minimatch } from 'minimatch';
12
12
  import { mkdirSync as fsMkdirSync, readFileSync as fsReadFileSync, writeFileSync as fsWriteFileSync, appendFileSync as fsAppendFileSync, statSync as fsStatSync, createReadStream as fsCreateReadStream, createWriteStream as fsCreateWriteStream, constants as fsConstants, existsSync as fsFileExistsSync, unlinkSync as fsUnlinkSync, } from 'fs';
13
13
  import { mkdir as fsMkdir, writeFile as fsWriteFile, readFile as fsReadFile, realpath as fsRealPath, appendFile as fsAppendFile, mkdtemp as fsMkdtemp, stat as fsStat, lstat as fsLstat, chmod as fsChmod, access as fsAccess, rename as fsRename, } from 'fs/promises';
14
14
  import { pathToFileURL as pathToFile } from 'url';
15
+ import * as os from 'os';
15
16
  /**
16
17
  * Strip the first `strip` parts of the path.
17
18
  *
@@ -194,13 +195,13 @@ export async function rmdir(path, options = {}) {
194
195
  await del(path, { force: options.force });
195
196
  }
196
197
  /**
197
- * Create a temporary directory.
198
+ * Create a temporary directory within the OS provided location for temp directories
198
199
  *
199
200
  * @returns Path to the temporary directory.
200
201
  */
201
202
  export async function mkTmpDir() {
202
203
  outputDebug(outputContent `Creating a temporary directory...`);
203
- const directory = await fsMkdtemp('tmp-');
204
+ const directory = await fsMkdtemp(joinPath(os.tmpdir(), 'tmp-'));
204
205
  return directory;
205
206
  }
206
207
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"fs.js","sourceRoot":"","sources":["../../../src/public/node/fs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,WAAW,CAAA;AACjD,OAAO,EAAC,aAAa,EAAE,WAAW,EAAE,WAAW,EAAC,MAAM,6BAA6B,CAAA;AACnF,OAAO,EAAC,aAAa,EAAmB,MAAM,qBAAqB,CAAA;AAEnE,OAAO,EACL,IAAI,IAAI,MAAM,EACd,UAAU,IAAI,YAAY,EAC1B,cAAc,IAAI,gBAAgB,EAClC,MAAM,IAAI,QAAQ,EAClB,UAAU,IAAI,YAAY,EAC1B,IAAI,IAAI,MAAM;AACd,6DAA6D;AAC7D,aAAa;EACd,MAAM,cAAc,CAAA;AAErB,OAAO,EAAC,sBAAsB,EAAC,MAAM,OAAO,CAAA;AAC5C,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAC,MAAM,IAAI,cAAc,EAAC,MAAM,SAAS,CAAA;AAChD,OAAO,EAAC,SAAS,EAAC,MAAM,WAAW,CAAA;AACnC,OAAO,EACL,SAAS,IAAI,WAAW,EACxB,YAAY,IAAI,cAAc,EAC9B,aAAa,IAAI,eAAe,EAChC,cAAc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AU,SAAS,CAAC,GAAW,EAAE,OAAe,EAAE,UAA4B,EAAC,SAAS,EAAE,IAAI,EAAC;IACnG,OAAO,SAAS,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;AACzC,CAAC","sourcesContent":["import {joinPath, normalizePath} from './path.js'\nimport {outputContent, outputToken, outputDebug} from '../../public/node/output.js'\nimport {getRandomName, RandomNameFamily} from '../common/string.js'\nimport {OverloadParameters} from '../../private/common/ts/overloaded-parameters.js'\nimport {\n copy as fsCopy,\n ensureFile as fsEnsureFile,\n ensureFileSync as fsEnsureFileSync,\n remove as fsRemove,\n removeSync as fsRemoveSync,\n move as fsMove,\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n} from 'fs-extra/esm'\n\nimport {temporaryDirectoryTask} from 'tempy'\nimport {sep, join} from 'pathe'\nimport {findUp as internalFindUp} from 'find-up'\nimport {minimatch} from 'minimatch'\nimport {\n mkdirSync as fsMkdirSync,\n readFileSync as fsReadFileSync,\n writeFileSync as fsWriteFileSync,\n appendFileSync as fsAppendFileSync,\n statSync as fsStatSync,\n createReadStream as fsCreateReadStream,\n createWriteStream as fsCreateWriteStream,\n constants as fsConstants,\n existsSync as fsFileExistsSync,\n unlinkSync as fsUnlinkSync,\n ReadStream,\n WriteStream,\n} from 'fs'\nimport {\n mkdir as fsMkdir,\n writeFile as fsWriteFile,\n readFile as fsReadFile,\n realpath as fsRealPath,\n appendFile as fsAppendFile,\n mkdtemp as fsMkdtemp,\n stat as fsStat,\n lstat as fsLstat,\n chmod as fsChmod,\n access as fsAccess,\n rename as fsRename,\n} from 'fs/promises'\nimport {pathToFileURL as pathToFile} from 'url'\nimport type {Pattern, Options as GlobOptions} from 'fast-glob'\n\n/**\n * Strip the first `strip` parts of the path.\n *\n * @param path - Path to strip.\n * @param strip - Number of parts to strip.\n * @returns The stripped path.\n */\nexport function stripUpPath(path: string, strip: number): string {\n const parts = path.split(sep)\n return join(...parts.slice(strip))\n}\n\n/**\n * Creates a temporary directory and ties its lifecycle to the lifecycle of the callback.\n *\n * @param callback - The callback that receives the temporary directory.\n */\nexport async function inTemporaryDirectory<T>(callback: (tmpDir: string) => T | Promise<T>): Promise<T> {\n return temporaryDirectoryTask(callback)\n}\n\n/**\n * It reads a file and returns its content as a string using the\n * utf-8 encoding.\n *\n * @param path - Path to the file to read.\n * @returns A promise that resolves with the content of the file.\n */\n\nexport type ReadOptions =\n | undefined\n | {flag?: string | undefined}\n | {\n encoding: BufferEncoding | string\n flag?: string | undefined\n }\nexport async function readFile(path: string, options?: ReadOptions): Promise<string>\nexport async function readFile(path: string, options?: ReadOptions): Promise<Buffer>\n\n/**\n * It reads a file and returns its content as a string.\n * Uses utf-8 encoding by default.\n *\n * @param path - Path to the file to read.\n * @param options - Options to read the file with (defaults to utf-8 encoding).\n * @returns A promise that resolves with the content of the file.\n */\nexport async function readFile(path: string, options: ReadOptions = {encoding: 'utf8'}): Promise<string | Buffer> {\n outputDebug(outputContent`Reading the content of file at ${outputToken.path(path)}...`)\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return fsReadFile(path, options)\n}\n\n/**\n * Synchronously reads a file and returns its content as a buffer.\n *\n * @param path - Path to the file to read.\n * @returns The content of the file.\n */\nexport function readFileSync(path: string): Buffer {\n outputDebug(outputContent`Sync-reading the content of file at ${outputToken.path(path)}...`)\n return fsReadFileSync(path)\n}\n\n/**\n * Given a path, it determines the actual path. This is useful when working\n * with paths that represent symlinks.\n *\n * @param path - Path whose real path will be returned.\n */\nexport async function fileRealPath(path: string): Promise<string> {\n return fsRealPath(path)\n}\n\n/**\n * Copies a file.\n *\n * @param from - Path to the directory or file to be copied.\n * @param to - Destination path.\n */\nexport async function copyFile(from: string, to: string): Promise<void> {\n outputDebug(outputContent`Copying file from ${outputToken.path(from)} to ${outputToken.path(to)}...`)\n await fsCopy(from, to)\n}\n\n/**\n * Creates a file at the given path.\n *\n * @param path - Path to the file to be created.\n */\nexport async function touchFile(path: string): Promise<void> {\n outputDebug(outputContent`Creating an empty file at ${outputToken.path(path)}...`)\n await fsEnsureFile(path)\n}\n\n/**\n * Synchronously creates a file at the given path.\n *\n * @param path - Path to the file to be created.\n */\nexport function touchFileSync(path: string): void {\n outputDebug(outputContent`Creating an empty file at ${outputToken.path(path)}...`)\n fsEnsureFileSync(path)\n}\n\n/**\n * Appnds content to file at path.\n *\n * @param path - Path to the file to be appended.\n * @param content - Content to be appended.\n */\nexport async function appendFile(path: string, content: string): Promise<void> {\n outputDebug(outputContent`Appending the following content to ${outputToken.path(path)}:\n ${content\n .split('\\n')\n .map((line) => ` ${line}`)\n .join('\\n')}\n `)\n await fsAppendFile(path, content)\n}\n\n/**\n * Synchronously appends content to file at path.\n *\n * @param path - Path to the file to be appended.\n * @param data - Content to be appended.\n */\nexport function appendFileSync(path: string, data: string): void {\n fsAppendFileSync(path, data)\n}\n\nexport interface WriteOptions {\n encoding: BufferEncoding\n}\n\n/**\n * Writes content to file at path.\n *\n * @param path - Path to the file to be written.\n * @param data - Content to be written.\n * @param options - Options to write the file with (defaults to utf-8 encoding).\n */\nexport async function writeFile(\n path: string,\n data: string | Buffer,\n options: WriteOptions = {encoding: 'utf8'},\n): Promise<void> {\n outputDebug(outputContent`Writing some content to file at ${outputToken.path(path)}...`)\n await fsWriteFile(path, data, options)\n}\n\n/**\n * Synchronously writes content to file at path.\n *\n * @param path - Path to the file to be written.\n * @param data - Content to be written.\n */\nexport function writeFileSync(path: string, data: string): void {\n outputDebug(outputContent`File-writing some content to file at ${outputToken.path(path)}...`)\n fsWriteFileSync(path, data)\n}\n\n/**\n * Creates a directory at the given path.\n *\n * @param path - Path to the directory to be created.\n */\nexport async function mkdir(path: string): Promise<void> {\n outputDebug(outputContent`Creating directory at ${outputToken.path(path)}...`)\n await fsMkdir(path, {recursive: true})\n}\n\n/**\n * Synchronously creates a directory at the given path.\n *\n * @param path - Path to the directory to be created.\n */\nexport function mkdirSync(path: string): void {\n outputDebug(outputContent`Sync-creating directory at ${outputToken.path(path)}...`)\n fsMkdirSync(path, {recursive: true})\n}\n\n/**\n * Removes a file at the given path.\n *\n * @param path - Path to the file to be removed.\n */\nexport async function removeFile(path: string): Promise<void> {\n outputDebug(outputContent`Removing file at ${outputToken.path(path)}...`)\n await fsRemove(path)\n}\n\n/**\n * Renames a file.\n * @param from - Path to the file to be renamed.\n * @param to - New path for the file.\n */\nexport async function renameFile(from: string, to: string): Promise<void> {\n outputDebug(outputContent`Renaming file from ${outputToken.path(from)} to ${outputToken.path(to)}...`)\n await fsRename(from, to)\n}\n\n/**\n * Synchronously removes a file at the given path.\n *\n * @param path - Path to the file to be removed.\n */\nexport function removeFileSync(path: string): void {\n outputDebug(outputContent`Sync-removing file at ${outputToken.path(path)}...`)\n fsRemoveSync(path)\n}\n\ninterface RmDirOptions {\n force?: boolean\n}\n/**\n * Removes a directory at the given path.\n *\n * @param path - Path to the directory to be removed.\n * @param options - Options to remove the directory with.\n */\nexport async function rmdir(path: string, options: RmDirOptions = {}): Promise<void> {\n const {default: del} = await import('del')\n outputDebug(outputContent`Removing directory at ${outputToken.path(path)}...`)\n await del(path, {force: options.force})\n}\n\n/**\n * Create a temporary directory.\n *\n * @returns Path to the temporary directory.\n */\nexport async function mkTmpDir(): Promise<string> {\n outputDebug(outputContent`Creating a temporary directory...`)\n const directory = await fsMkdtemp('tmp-')\n return directory\n}\n\n/**\n * Check whether a path is a directory.\n *\n * @param path - Path to check.\n * @returns True if the path is a directory, false otherwise.\n */\nexport async function isDirectory(path: string): Promise<boolean> {\n outputDebug(outputContent`Checking if ${outputToken.path(path)} is a directory...`)\n return (await fsLstat(path)).isDirectory()\n}\n\n/**\n * Get the size of a file.\n *\n * @param path - Path to the file.\n * @returns The size of the file in bytes.\n */\nexport async function fileSize(path: string): Promise<number> {\n outputDebug(outputContent`Getting the size of file file at ${outputToken.path(path)}...`)\n return (await fsStat(path)).size\n}\n\n/**\n * Synchronously get the size of a file.\n *\n * @param path - Path to the file.\n * @returns The size of the file in bytes.\n */\nexport function fileSizeSync(path: string): number {\n outputDebug(outputContent`Sync-getting the size of file file at ${outputToken.path(path)}...`)\n return fsStatSync(path).size\n}\n\n/**\n * Unlink a file at the given path.\n * @param path - Path to the file.\n * @returns A promise that resolves when the file is unlinked.\n */\nexport function unlinkFileSync(path: string): void {\n return fsUnlinkSync(path)\n}\n\n/**\n * Create a read stream for a file with optional options.\n *\n * @param path - Path to the file.\n * @param options - Options for the read stream.\n * @returns A read stream for the file.\n */\nexport function createFileReadStream(\n path: string,\n options?: {encoding?: BufferEncoding; start?: number; end?: number},\n): ReadStream {\n return fsCreateReadStream(path, options)\n}\n\n/**\n * Create a write stream for a file.\n *\n * @param path - Path to the file.\n * @returns A write stream for the file.\n */\nexport function createFileWriteStream(path: string): WriteStream {\n return fsCreateWriteStream(path)\n}\n\n/**\n * Returns the Date object for the last modification of a file.\n *\n * @param path - Path to the directory or file.\n * @returns A unix timestamp.\n */\nexport async function fileLastUpdated(path: string): Promise<Date> {\n outputDebug(outputContent`Getting last updated timestamp for file at ${outputToken.path(path)}...`)\n return (await fsStat(path)).ctime\n}\n\n/**\n * Returns the unix timestamp of the last modification of a file.\n *\n * @param path - Path to the directory or file.\n * @returns A unix timestamp.\n */\nexport async function fileLastUpdatedTimestamp(path: string): Promise<number | undefined> {\n try {\n const lastUpdatedDateTime = await fileLastUpdated(path)\n return lastUpdatedDateTime.getTime()\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return undefined\n }\n}\n\ninterface MoveFileOptions {\n overwrite?: boolean\n}\n\n/**\n * Moves a file.\n *\n * @param src - File to be moved.\n * @param dest - Path to be moved to.\n * @param options - Moving options.\n */\nexport async function moveFile(src: string, dest: string, options: MoveFileOptions = {}): Promise<void> {\n await fsMove(src, dest, options)\n}\n\n/**\n * Changes the permissions of a directory or file.\n *\n * @param path - Path to the file or directory whose permissions will be modified.\n * @param mode - Permissions to set to the file or directory.\n */\nexport async function chmod(path: string, mode: number | string): Promise<void> {\n await fsChmod(path, mode)\n}\n\n/**\n * Checks if a file has executable permissions.\n *\n * @param path - Path to the file whose permissions will be checked.\n */\nexport async function fileHasExecutablePermissions(path: string): Promise<boolean> {\n try {\n await fsAccess(path, fsConstants.X_OK)\n return true\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return false\n }\n}\n\n/**\n * Returns true if a file or directory exists.\n *\n * @param path - Path to the directory or file.\n * @returns True if it exists.\n */\nexport async function fileExists(path: string): Promise<boolean> {\n try {\n await fsAccess(path)\n return true\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return false\n }\n}\n\nexport function fileExistsSync(path: string): boolean {\n return fsFileExistsSync(path)\n}\n\ninterface GenerateRandomDirectoryOptions {\n /** Suffix to include in the randomly generated directory name. */\n suffix: string\n\n /** Absolute path to the directory where the random directory will be created. */\n directory: string\n\n /** Type of word to use for random name. */\n family?: RandomNameFamily\n}\n\n/**\n * It generates a random directory directory name for a sub-directory.\n * It ensures that the returned directory name doesn't exist.\n *\n * @param options - Options to generate the random directory name.\n * @returns It returns the name of the directory.\n */\nexport async function generateRandomNameForSubdirectory(options: GenerateRandomDirectoryOptions): Promise<string> {\n const generated = `${getRandomName(options.family ?? 'business')}-${options.suffix}`\n const randomDirectoryPath = joinPath(options.directory, generated)\n const isAppDirectoryTaken = await fileExists(randomDirectoryPath)\n\n if (isAppDirectoryTaken) {\n return generateRandomNameForSubdirectory(options)\n } else {\n return generated\n }\n}\n\n/**\n * Traverse the file system and return pathnames that match the given pattern.\n *\n * @param pattern - A glob pattern or an array of glob patterns.\n * @param options - Options for the glob.\n * @returns A promise that resolves to an array of pathnames that match the given pattern.\n */\nexport async function glob(pattern: Pattern | Pattern[], options?: GlobOptions): Promise<string[]> {\n const {default: fastGlob} = await import('fast-glob')\n let overridenOptions = options\n if (options?.dot == null) {\n overridenOptions = {...options, dot: true}\n }\n return fastGlob(pattern, overridenOptions)\n}\n\n/**\n * Convert a path to a File URL.\n *\n * @param path - Path to convert.\n * @returns The File URL.\n */\nexport function pathToFileURL(path: string): URL {\n return pathToFile(path)\n}\n/**\n * Find a file by walking parent directories.\n *\n * @param matcher - A pattern or an array of patterns to match a file name.\n * @param options - Options for the search.\n * @returns The first path found that matches or `undefined` if none could be found.\n */\nexport async function findPathUp(\n matcher: OverloadParameters<typeof internalFindUp>[0],\n options: OverloadParameters<typeof internalFindUp>[1],\n): ReturnType<typeof internalFindUp> {\n // findUp has odd typing\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const got = await internalFindUp(matcher as any, options)\n return got ? normalizePath(got) : undefined\n}\n\nexport interface MatchGlobOptions {\n matchBase: boolean\n}\n\n/**\n * Matches a key against a glob pattern.\n * @param key - The key to match.\n * @param pattern - The glob pattern to match against.\n * @param options - The options to refine the matching approach.\n * @returns true if the key matches the pattern, false otherwise.\n */\nexport function matchGlob(key: string, pattern: string, options: MatchGlobOptions = {matchBase: true}): boolean {\n return minimatch(key, pattern, options)\n}\n"]}
1
+ {"version":3,"file":"fs.js","sourceRoot":"","sources":["../../../src/public/node/fs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,WAAW,CAAA;AACjD,OAAO,EAAC,aAAa,EAAE,WAAW,EAAE,WAAW,EAAC,MAAM,6BAA6B,CAAA;AACnF,OAAO,EAAC,aAAa,EAAmB,MAAM,qBAAqB,CAAA;AAEnE,OAAO,EACL,IAAI,IAAI,MAAM,EACd,UAAU,IAAI,YAAY,EAC1B,cAAc,IAAI,gBAAgB,EAClC,MAAM,IAAI,QAAQ,EAClB,UAAU,IAAI,YAAY,EAC1B,IAAI,IAAI,MAAM;AACd,6DAA6D;AAC7D,aAAa;EACd,MAAM,cAAc,CAAA;AAErB,OAAO,EAAC,sBAAsB,EAAC,MAAM,OAAO,CAAA;AAC5C,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAC,MAAM,IAAI,cAAc,EAAC,MAAM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ACrD,OAAqD;IAErD,wBAAwB;IACxB,8DAA8D;IAC9D,MAAM,GAAG,GAAG,MAAM,cAAc,CAAC,OAAc,EAAE,OAAO,CAAC,CAAA;IACzD,OAAO,GAAG,CAAC,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AAC7C,CAAC;AAMD;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,GAAW,EAAE,OAAe,EAAE,UAA4B,EAAC,SAAS,EAAE,IAAI,EAAC;IACnG,OAAO,SAAS,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;AACzC,CAAC","sourcesContent":["import {joinPath, normalizePath} from './path.js'\nimport {outputContent, outputToken, outputDebug} from '../../public/node/output.js'\nimport {getRandomName, RandomNameFamily} from '../common/string.js'\nimport {OverloadParameters} from '../../private/common/ts/overloaded-parameters.js'\nimport {\n copy as fsCopy,\n ensureFile as fsEnsureFile,\n ensureFileSync as fsEnsureFileSync,\n remove as fsRemove,\n removeSync as fsRemoveSync,\n move as fsMove,\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n} from 'fs-extra/esm'\n\nimport {temporaryDirectoryTask} from 'tempy'\nimport {sep, join} from 'pathe'\nimport {findUp as internalFindUp} from 'find-up'\nimport {minimatch} from 'minimatch'\nimport {\n mkdirSync as fsMkdirSync,\n readFileSync as fsReadFileSync,\n writeFileSync as fsWriteFileSync,\n appendFileSync as fsAppendFileSync,\n statSync as fsStatSync,\n createReadStream as fsCreateReadStream,\n createWriteStream as fsCreateWriteStream,\n constants as fsConstants,\n existsSync as fsFileExistsSync,\n unlinkSync as fsUnlinkSync,\n ReadStream,\n WriteStream,\n} from 'fs'\nimport {\n mkdir as fsMkdir,\n writeFile as fsWriteFile,\n readFile as fsReadFile,\n realpath as fsRealPath,\n appendFile as fsAppendFile,\n mkdtemp as fsMkdtemp,\n stat as fsStat,\n lstat as fsLstat,\n chmod as fsChmod,\n access as fsAccess,\n rename as fsRename,\n} from 'fs/promises'\nimport {pathToFileURL as pathToFile} from 'url'\nimport * as os from 'os'\nimport type {Pattern, Options as GlobOptions} from 'fast-glob'\n\n/**\n * Strip the first `strip` parts of the path.\n *\n * @param path - Path to strip.\n * @param strip - Number of parts to strip.\n * @returns The stripped path.\n */\nexport function stripUpPath(path: string, strip: number): string {\n const parts = path.split(sep)\n return join(...parts.slice(strip))\n}\n\n/**\n * Creates a temporary directory and ties its lifecycle to the lifecycle of the callback.\n *\n * @param callback - The callback that receives the temporary directory.\n */\nexport async function inTemporaryDirectory<T>(callback: (tmpDir: string) => T | Promise<T>): Promise<T> {\n return temporaryDirectoryTask(callback)\n}\n\n/**\n * It reads a file and returns its content as a string using the\n * utf-8 encoding.\n *\n * @param path - Path to the file to read.\n * @returns A promise that resolves with the content of the file.\n */\n\nexport type ReadOptions =\n | undefined\n | {flag?: string | undefined}\n | {\n encoding: BufferEncoding | string\n flag?: string | undefined\n }\nexport async function readFile(path: string, options?: ReadOptions): Promise<string>\nexport async function readFile(path: string, options?: ReadOptions): Promise<Buffer>\n\n/**\n * It reads a file and returns its content as a string.\n * Uses utf-8 encoding by default.\n *\n * @param path - Path to the file to read.\n * @param options - Options to read the file with (defaults to utf-8 encoding).\n * @returns A promise that resolves with the content of the file.\n */\nexport async function readFile(path: string, options: ReadOptions = {encoding: 'utf8'}): Promise<string | Buffer> {\n outputDebug(outputContent`Reading the content of file at ${outputToken.path(path)}...`)\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return fsReadFile(path, options)\n}\n\n/**\n * Synchronously reads a file and returns its content as a buffer.\n *\n * @param path - Path to the file to read.\n * @returns The content of the file.\n */\nexport function readFileSync(path: string): Buffer {\n outputDebug(outputContent`Sync-reading the content of file at ${outputToken.path(path)}...`)\n return fsReadFileSync(path)\n}\n\n/**\n * Given a path, it determines the actual path. This is useful when working\n * with paths that represent symlinks.\n *\n * @param path - Path whose real path will be returned.\n */\nexport async function fileRealPath(path: string): Promise<string> {\n return fsRealPath(path)\n}\n\n/**\n * Copies a file.\n *\n * @param from - Path to the directory or file to be copied.\n * @param to - Destination path.\n */\nexport async function copyFile(from: string, to: string): Promise<void> {\n outputDebug(outputContent`Copying file from ${outputToken.path(from)} to ${outputToken.path(to)}...`)\n await fsCopy(from, to)\n}\n\n/**\n * Creates a file at the given path.\n *\n * @param path - Path to the file to be created.\n */\nexport async function touchFile(path: string): Promise<void> {\n outputDebug(outputContent`Creating an empty file at ${outputToken.path(path)}...`)\n await fsEnsureFile(path)\n}\n\n/**\n * Synchronously creates a file at the given path.\n *\n * @param path - Path to the file to be created.\n */\nexport function touchFileSync(path: string): void {\n outputDebug(outputContent`Creating an empty file at ${outputToken.path(path)}...`)\n fsEnsureFileSync(path)\n}\n\n/**\n * Appnds content to file at path.\n *\n * @param path - Path to the file to be appended.\n * @param content - Content to be appended.\n */\nexport async function appendFile(path: string, content: string): Promise<void> {\n outputDebug(outputContent`Appending the following content to ${outputToken.path(path)}:\n ${content\n .split('\\n')\n .map((line) => ` ${line}`)\n .join('\\n')}\n `)\n await fsAppendFile(path, content)\n}\n\n/**\n * Synchronously appends content to file at path.\n *\n * @param path - Path to the file to be appended.\n * @param data - Content to be appended.\n */\nexport function appendFileSync(path: string, data: string): void {\n fsAppendFileSync(path, data)\n}\n\nexport interface WriteOptions {\n encoding: BufferEncoding\n}\n\n/**\n * Writes content to file at path.\n *\n * @param path - Path to the file to be written.\n * @param data - Content to be written.\n * @param options - Options to write the file with (defaults to utf-8 encoding).\n */\nexport async function writeFile(\n path: string,\n data: string | Buffer,\n options: WriteOptions = {encoding: 'utf8'},\n): Promise<void> {\n outputDebug(outputContent`Writing some content to file at ${outputToken.path(path)}...`)\n await fsWriteFile(path, data, options)\n}\n\n/**\n * Synchronously writes content to file at path.\n *\n * @param path - Path to the file to be written.\n * @param data - Content to be written.\n */\nexport function writeFileSync(path: string, data: string): void {\n outputDebug(outputContent`File-writing some content to file at ${outputToken.path(path)}...`)\n fsWriteFileSync(path, data)\n}\n\n/**\n * Creates a directory at the given path.\n *\n * @param path - Path to the directory to be created.\n */\nexport async function mkdir(path: string): Promise<void> {\n outputDebug(outputContent`Creating directory at ${outputToken.path(path)}...`)\n await fsMkdir(path, {recursive: true})\n}\n\n/**\n * Synchronously creates a directory at the given path.\n *\n * @param path - Path to the directory to be created.\n */\nexport function mkdirSync(path: string): void {\n outputDebug(outputContent`Sync-creating directory at ${outputToken.path(path)}...`)\n fsMkdirSync(path, {recursive: true})\n}\n\n/**\n * Removes a file at the given path.\n *\n * @param path - Path to the file to be removed.\n */\nexport async function removeFile(path: string): Promise<void> {\n outputDebug(outputContent`Removing file at ${outputToken.path(path)}...`)\n await fsRemove(path)\n}\n\n/**\n * Renames a file.\n * @param from - Path to the file to be renamed.\n * @param to - New path for the file.\n */\nexport async function renameFile(from: string, to: string): Promise<void> {\n outputDebug(outputContent`Renaming file from ${outputToken.path(from)} to ${outputToken.path(to)}...`)\n await fsRename(from, to)\n}\n\n/**\n * Synchronously removes a file at the given path.\n *\n * @param path - Path to the file to be removed.\n */\nexport function removeFileSync(path: string): void {\n outputDebug(outputContent`Sync-removing file at ${outputToken.path(path)}...`)\n fsRemoveSync(path)\n}\n\ninterface RmDirOptions {\n force?: boolean\n}\n/**\n * Removes a directory at the given path.\n *\n * @param path - Path to the directory to be removed.\n * @param options - Options to remove the directory with.\n */\nexport async function rmdir(path: string, options: RmDirOptions = {}): Promise<void> {\n const {default: del} = await import('del')\n outputDebug(outputContent`Removing directory at ${outputToken.path(path)}...`)\n await del(path, {force: options.force})\n}\n\n/**\n * Create a temporary directory within the OS provided location for temp directories\n *\n * @returns Path to the temporary directory.\n */\nexport async function mkTmpDir(): Promise<string> {\n outputDebug(outputContent`Creating a temporary directory...`)\n const directory = await fsMkdtemp(joinPath(os.tmpdir(), 'tmp-'))\n return directory\n}\n\n/**\n * Check whether a path is a directory.\n *\n * @param path - Path to check.\n * @returns True if the path is a directory, false otherwise.\n */\nexport async function isDirectory(path: string): Promise<boolean> {\n outputDebug(outputContent`Checking if ${outputToken.path(path)} is a directory...`)\n return (await fsLstat(path)).isDirectory()\n}\n\n/**\n * Get the size of a file.\n *\n * @param path - Path to the file.\n * @returns The size of the file in bytes.\n */\nexport async function fileSize(path: string): Promise<number> {\n outputDebug(outputContent`Getting the size of file file at ${outputToken.path(path)}...`)\n return (await fsStat(path)).size\n}\n\n/**\n * Synchronously get the size of a file.\n *\n * @param path - Path to the file.\n * @returns The size of the file in bytes.\n */\nexport function fileSizeSync(path: string): number {\n outputDebug(outputContent`Sync-getting the size of file file at ${outputToken.path(path)}...`)\n return fsStatSync(path).size\n}\n\n/**\n * Unlink a file at the given path.\n * @param path - Path to the file.\n * @returns A promise that resolves when the file is unlinked.\n */\nexport function unlinkFileSync(path: string): void {\n return fsUnlinkSync(path)\n}\n\n/**\n * Create a read stream for a file with optional options.\n *\n * @param path - Path to the file.\n * @param options - Options for the read stream.\n * @returns A read stream for the file.\n */\nexport function createFileReadStream(\n path: string,\n options?: {encoding?: BufferEncoding; start?: number; end?: number},\n): ReadStream {\n return fsCreateReadStream(path, options)\n}\n\n/**\n * Create a write stream for a file.\n *\n * @param path - Path to the file.\n * @returns A write stream for the file.\n */\nexport function createFileWriteStream(path: string): WriteStream {\n return fsCreateWriteStream(path)\n}\n\n/**\n * Returns the Date object for the last modification of a file.\n *\n * @param path - Path to the directory or file.\n * @returns A unix timestamp.\n */\nexport async function fileLastUpdated(path: string): Promise<Date> {\n outputDebug(outputContent`Getting last updated timestamp for file at ${outputToken.path(path)}...`)\n return (await fsStat(path)).ctime\n}\n\n/**\n * Returns the unix timestamp of the last modification of a file.\n *\n * @param path - Path to the directory or file.\n * @returns A unix timestamp.\n */\nexport async function fileLastUpdatedTimestamp(path: string): Promise<number | undefined> {\n try {\n const lastUpdatedDateTime = await fileLastUpdated(path)\n return lastUpdatedDateTime.getTime()\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return undefined\n }\n}\n\ninterface MoveFileOptions {\n overwrite?: boolean\n}\n\n/**\n * Moves a file.\n *\n * @param src - File to be moved.\n * @param dest - Path to be moved to.\n * @param options - Moving options.\n */\nexport async function moveFile(src: string, dest: string, options: MoveFileOptions = {}): Promise<void> {\n await fsMove(src, dest, options)\n}\n\n/**\n * Changes the permissions of a directory or file.\n *\n * @param path - Path to the file or directory whose permissions will be modified.\n * @param mode - Permissions to set to the file or directory.\n */\nexport async function chmod(path: string, mode: number | string): Promise<void> {\n await fsChmod(path, mode)\n}\n\n/**\n * Checks if a file has executable permissions.\n *\n * @param path - Path to the file whose permissions will be checked.\n */\nexport async function fileHasExecutablePermissions(path: string): Promise<boolean> {\n try {\n await fsAccess(path, fsConstants.X_OK)\n return true\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return false\n }\n}\n\n/**\n * Returns true if a file or directory exists.\n *\n * @param path - Path to the directory or file.\n * @returns True if it exists.\n */\nexport async function fileExists(path: string): Promise<boolean> {\n try {\n await fsAccess(path)\n return true\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return false\n }\n}\n\nexport function fileExistsSync(path: string): boolean {\n return fsFileExistsSync(path)\n}\n\ninterface GenerateRandomDirectoryOptions {\n /** Suffix to include in the randomly generated directory name. */\n suffix: string\n\n /** Absolute path to the directory where the random directory will be created. */\n directory: string\n\n /** Type of word to use for random name. */\n family?: RandomNameFamily\n}\n\n/**\n * It generates a random directory directory name for a sub-directory.\n * It ensures that the returned directory name doesn't exist.\n *\n * @param options - Options to generate the random directory name.\n * @returns It returns the name of the directory.\n */\nexport async function generateRandomNameForSubdirectory(options: GenerateRandomDirectoryOptions): Promise<string> {\n const generated = `${getRandomName(options.family ?? 'business')}-${options.suffix}`\n const randomDirectoryPath = joinPath(options.directory, generated)\n const isAppDirectoryTaken = await fileExists(randomDirectoryPath)\n\n if (isAppDirectoryTaken) {\n return generateRandomNameForSubdirectory(options)\n } else {\n return generated\n }\n}\n\n/**\n * Traverse the file system and return pathnames that match the given pattern.\n *\n * @param pattern - A glob pattern or an array of glob patterns.\n * @param options - Options for the glob.\n * @returns A promise that resolves to an array of pathnames that match the given pattern.\n */\nexport async function glob(pattern: Pattern | Pattern[], options?: GlobOptions): Promise<string[]> {\n const {default: fastGlob} = await import('fast-glob')\n let overridenOptions = options\n if (options?.dot == null) {\n overridenOptions = {...options, dot: true}\n }\n return fastGlob(pattern, overridenOptions)\n}\n\n/**\n * Convert a path to a File URL.\n *\n * @param path - Path to convert.\n * @returns The File URL.\n */\nexport function pathToFileURL(path: string): URL {\n return pathToFile(path)\n}\n/**\n * Find a file by walking parent directories.\n *\n * @param matcher - A pattern or an array of patterns to match a file name.\n * @param options - Options for the search.\n * @returns The first path found that matches or `undefined` if none could be found.\n */\nexport async function findPathUp(\n matcher: OverloadParameters<typeof internalFindUp>[0],\n options: OverloadParameters<typeof internalFindUp>[1],\n): ReturnType<typeof internalFindUp> {\n // findUp has odd typing\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const got = await internalFindUp(matcher as any, options)\n return got ? normalizePath(got) : undefined\n}\n\nexport interface MatchGlobOptions {\n matchBase: boolean\n}\n\n/**\n * Matches a key against a glob pattern.\n * @param key - The key to match.\n * @param pattern - The glob pattern to match against.\n * @param options - The options to refine the matching approach.\n * @returns true if the key matches the pattern, false otherwise.\n */\nexport function matchGlob(key: string, pattern: string, options: MatchGlobOptions = {matchBase: true}): boolean {\n return minimatch(key, pattern, options)\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import FormData from 'form-data';
2
2
  import nodeFetch, { RequestInfo, RequestInit } from 'node-fetch';
3
- export { FetchError } from 'node-fetch';
3
+ export { FetchError, Request } from 'node-fetch';
4
4
  /**
5
5
  * Create a new FormData object.
6
6
  *
@@ -7,7 +7,7 @@ import { outputContent, outputDebug } from '../../public/node/output.js';
7
7
  import { debugLogResponseInfo } from '../../private/node/api.js';
8
8
  import FormData from 'form-data';
9
9
  import nodeFetch from 'node-fetch';
10
- export { FetchError } from 'node-fetch';
10
+ export { FetchError, Request } from 'node-fetch';
11
11
  /**
12
12
  * Create a new FormData object.
13
13
  *
@@ -1 +1 @@
1
- {"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/public/node/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AACjC,OAAO,EAAC,qBAAqB,EAAE,cAAc,EAAE,SAAS,EAAE,cAAc,EAAC,MAAM,SAAS,CAAA;AACxF,OAAO,EAAC,YAAY,EAAC,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAC,YAAY,EAAE,UAAU,EAAE,sBAAsB,EAAC,MAAM,mCAAmC,CAAA;AAClG,OAAO,EAAC,WAAW,EAAC,MAAM,gCAAgC,CAAA;AAC1D,OAAO,EAAC,aAAa,EAAE,WAAW,EAAC,MAAM,6BAA6B,CAAA;AACtE,OAAO,EAAC,oBAAoB,EAAC,MAAM,2BAA2B,CAAA;AAC9D,OAAO,QAAQ,MAAM,WAAW,CAAA;AAChC,OAAO,SAAqC,MAAM,YAAY,CAAA;AAE9D,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAA;AAErC;;;;GAIG;AACH,MAAM,UAAU,QAAQ;IACtB,OAAO,IAAI,QAAQ,EAAE,CAAA;AACvB,CAAC;AAID;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,GAAgB,EAAE,IAAkB;IAC9D,OAAO,YAAY,CAAC,2BAA2B,CAAC,CAAC,GAAG,EAAE,CACpD,oBAAoB,CAAC,EAAC,GAAG,EAAE,GAAG,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,EAAC,CAAC,CAC3E,CAAA;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,GAAgB,EAAE,IAAkB;IACrE,MAAM,YAAY,GAAG,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE,CA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C,KAAK,EAAE,CAAA;gBACZ,OAAO,CAAC,EAAE,CAAC,CAAA;YACb,CAAC,CAAC,CAAA;YAEF,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;gBACvB,cAAc,CAAC,EAAE,CAAC,CAAA;gBAClB,MAAM,CAAC,GAAG,CAAC,CAAA;YACb,CAAC,CAAC,CAAA;YAEF,SAAS,CAAC,GAAG,EAAE,EAAC,QAAQ,EAAE,QAAQ,EAAC,CAAC;iBACjC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;gBACZ,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;YACtB,CAAC,CAAC;iBACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;gBACb,cAAc,CAAC,EAAE,CAAC,CAAA;gBAClB,MAAM,CAAC,GAAG,CAAC,CAAA;YACb,CAAC,CAAC,CAAA;QACN,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {dirname} from './path.js'\nimport {createFileWriteStream, fileExistsSync, mkdirSync, unlinkFileSync} from './fs.js'\nimport {runWithTimer} from './metadata.js'\nimport {buildHeaders, httpsAgent, sanitizedHeadersOutput} from '../../private/node/api/headers.js'\nimport {sanitizeURL} from '../../private/node/api/urls.js'\nimport {outputContent, outputDebug} from '../../public/node/output.js'\nimport {debugLogResponseInfo} from '../../private/node/api.js'\nimport FormData from 'form-data'\nimport nodeFetch, {RequestInfo, RequestInit} from 'node-fetch'\n\nexport {FetchError} from 'node-fetch'\n\n/**\n * Create a new FormData object.\n *\n * @returns A FormData object.\n */\nexport function formData(): FormData {\n return new FormData()\n}\n\nexport type Response = ReturnType<typeof nodeFetch>\n\n/**\n * An interface that abstracts way node-fetch. When Node has built-in\n * support for \"fetch\" in the standard library, we can drop the node-fetch\n * dependency from here.\n * Note that we are exposing types from \"node-fetch\". The reason being is that\n * they are consistent with the Web API so if we drop node-fetch in the future\n * it won't require changes from the callers.\n *\n * @param url - This defines the resource that you wish to fetch.\n * @param init - An object containing any custom settings that you want to apply to the request.\n * @returns A promise that resolves with the response.\n */\nexport async function fetch(url: RequestInfo, init?: RequestInit): Response {\n return runWithTimer('cmd_all_timing_network_ms')(() =>\n debugLogResponseInfo({url: url.toString(), request: nodeFetch(url, init)}),\n )\n}\n\n/**\n * A fetch function to use with Shopify services. The function ensures the right\n * TLS configuragion is used based on the environment in which the service is running\n * (e.g. Spin).\n *\n * @param url - This defines the resource that you wish to fetch.\n * @param init - An object containing any custom settings that you want to apply to the request.\n * @returns A promise that resolves with the response.\n */\nexport async function shopifyFetch(url: RequestInfo, init?: RequestInit): Response {\n const sanitizedUrl = sanitizeURL(url.toString())\n const options: RequestInit = {\n ...(init ?? {}),\n headers: {\n ...(await buildHeaders()),\n ...(init?.headers ?? {}),\n },\n }\n\n outputDebug(outputContent`Sending ${options.method ?? 'GET'} request to URL ${sanitizedUrl}\nWith request headers:\n${sanitizedHeadersOutput((options?.headers ?? {}) as {[header: string]: string})}\n`)\n return runWithTimer('cmd_all_timing_network_ms')(async () => {\n return debugLogResponseInfo({url: url.toString(), request: nodeFetch(url, {...init, agent: await httpsAgent()})})\n })\n}\n\n/**\n * Download a file from a URL to a local path.\n *\n * @param url - The URL to download from.\n * @param to - The local path to download to.\n * @returns - A promise that resolves with the local path.\n */\nexport function downloadFile(url: string, to: string): Promise<string> {\n const sanitizedUrl = sanitizeURL(url)\n outputDebug(`Downloading ${sanitizedUrl} to ${to}`)\n\n return runWithTimer('cmd_all_timing_network_ms')(() => {\n return new Promise<string>((resolve, reject) => {\n if (!fileExistsSync(dirname(to))) {\n mkdirSync(dirname(to))\n }\n\n const file = createFileWriteStream(to)\n\n file.on('finish', () => {\n file.close()\n resolve(to)\n })\n\n file.on('error', (err) => {\n unlinkFileSync(to)\n reject(err)\n })\n\n nodeFetch(url, {redirect: 'follow'})\n .then((res) => {\n res.body?.pipe(file)\n })\n .catch((err) => {\n unlinkFileSync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CAAC,EAAE,CAAC,CAAA;YACb,CAAC,CAAC,CAAA;YAEF,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;gBACvB,cAAc,CAAC,EAAE,CAAC,CAAA;gBAClB,MAAM,CAAC,GAAG,CAAC,CAAA;YACb,CAAC,CAAC,CAAA;YAEF,SAAS,CAAC,GAAG,EAAE,EAAC,QAAQ,EAAE,QAAQ,EAAC,CAAC;iBACjC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;gBACZ,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;YACtB,CAAC,CAAC;iBACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;gBACb,cAAc,CAAC,EAAE,CAAC,CAAA;gBAClB,MAAM,CAAC,GAAG,CAAC,CAAA;YACb,CAAC,CAAC,CAAA;QACN,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {dirname} from './path.js'\nimport {createFileWriteStream, fileExistsSync, mkdirSync, unlinkFileSync} from './fs.js'\nimport {runWithTimer} from './metadata.js'\nimport {buildHeaders, httpsAgent, sanitizedHeadersOutput} from '../../private/node/api/headers.js'\nimport {sanitizeURL} from '../../private/node/api/urls.js'\nimport {outputContent, outputDebug} from '../../public/node/output.js'\nimport {debugLogResponseInfo} from '../../private/node/api.js'\nimport FormData from 'form-data'\nimport nodeFetch, {RequestInfo, RequestInit} from 'node-fetch'\n\nexport {FetchError, Request} from 'node-fetch'\n\n/**\n * Create a new FormData object.\n *\n * @returns A FormData object.\n */\nexport function formData(): FormData {\n return new FormData()\n}\n\nexport type Response = ReturnType<typeof nodeFetch>\n\n/**\n * An interface that abstracts way node-fetch. When Node has built-in\n * support for \"fetch\" in the standard library, we can drop the node-fetch\n * dependency from here.\n * Note that we are exposing types from \"node-fetch\". The reason being is that\n * they are consistent with the Web API so if we drop node-fetch in the future\n * it won't require changes from the callers.\n *\n * @param url - This defines the resource that you wish to fetch.\n * @param init - An object containing any custom settings that you want to apply to the request.\n * @returns A promise that resolves with the response.\n */\nexport async function fetch(url: RequestInfo, init?: RequestInit): Response {\n return runWithTimer('cmd_all_timing_network_ms')(() =>\n debugLogResponseInfo({url: url.toString(), request: nodeFetch(url, init)}),\n )\n}\n\n/**\n * A fetch function to use with Shopify services. The function ensures the right\n * TLS configuragion is used based on the environment in which the service is running\n * (e.g. Spin).\n *\n * @param url - This defines the resource that you wish to fetch.\n * @param init - An object containing any custom settings that you want to apply to the request.\n * @returns A promise that resolves with the response.\n */\nexport async function shopifyFetch(url: RequestInfo, init?: RequestInit): Response {\n const sanitizedUrl = sanitizeURL(url.toString())\n const options: RequestInit = {\n ...(init ?? {}),\n headers: {\n ...(await buildHeaders()),\n ...(init?.headers ?? {}),\n },\n }\n\n outputDebug(outputContent`Sending ${options.method ?? 'GET'} request to URL ${sanitizedUrl}\nWith request headers:\n${sanitizedHeadersOutput((options?.headers ?? {}) as {[header: string]: string})}\n`)\n return runWithTimer('cmd_all_timing_network_ms')(async () => {\n return debugLogResponseInfo({url: url.toString(), request: nodeFetch(url, {...init, agent: await httpsAgent()})})\n })\n}\n\n/**\n * Download a file from a URL to a local path.\n *\n * @param url - The URL to download from.\n * @param to - The local path to download to.\n * @returns - A promise that resolves with the local path.\n */\nexport function downloadFile(url: string, to: string): Promise<string> {\n const sanitizedUrl = sanitizeURL(url)\n outputDebug(`Downloading ${sanitizedUrl} to ${to}`)\n\n return runWithTimer('cmd_all_timing_network_ms')(() => {\n return new Promise<string>((resolve, reject) => {\n if (!fileExistsSync(dirname(to))) {\n mkdirSync(dirname(to))\n }\n\n const file = createFileWriteStream(to)\n\n file.on('finish', () => {\n file.close()\n resolve(to)\n })\n\n file.on('error', (err) => {\n unlinkFileSync(to)\n reject(err)\n })\n\n nodeFetch(url, {redirect: 'follow'})\n .then((res) => {\n res.body?.pipe(file)\n })\n .catch((err) => {\n unlinkFileSync(to)\n reject(err)\n })\n })\n })\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export declare const getLogsDir: string;
2
+ export declare const createLogsDir: (path: string) => Promise<void>;
3
+ export declare const writeLog: (path: string, logData: string) => Promise<void>;
@@ -0,0 +1,11 @@
1
+ import { logsFolder } from '../../private/node/constants.js';
2
+ import { joinPath } from '@shopify/cli-kit/node/path';
3
+ import { mkdir, writeFile } from '@shopify/cli-kit/node/fs';
4
+ export const getLogsDir = logsFolder();
5
+ export const createLogsDir = async (path) => {
6
+ await mkdir(joinPath(logsFolder(), path));
7
+ };
8
+ export const writeLog = async (path, logData) => {
9
+ await writeFile(joinPath(logsFolder(), path), logData);
10
+ };
11
+ //# sourceMappingURL=logs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logs.js","sourceRoot":"","sources":["../../../src/public/node/logs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,iCAAiC,CAAA;AAC1D,OAAO,EAAC,QAAQ,EAAC,MAAM,4BAA4B,CAAA;AACnD,OAAO,EAAC,KAAK,EAAE,SAAS,EAAC,MAAM,0BAA0B,CAAA;AAEzD,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,EAAE,CAAA;AAEtC,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAAE,IAAY,EAAiB,EAAE;IACjE,MAAM,KAAK,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,IAAI,CAAC,CAAC,CAAA;AAC3C,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,EAAE,IAAY,EAAE,OAAe,EAAiB,EAAE;IAC7E,MAAM,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,CAAA;AACxD,CAAC,CAAA","sourcesContent":["import {logsFolder} from '../../private/node/constants.js'\nimport {joinPath} from '@shopify/cli-kit/node/path'\nimport {mkdir, writeFile} from '@shopify/cli-kit/node/fs'\n\nexport const getLogsDir = logsFolder()\n\nexport const createLogsDir = async (path: string): Promise<void> => {\n await mkdir(joinPath(logsFolder(), path))\n}\n\nexport const writeLog = async (path: string, logData: string): Promise<void> => {\n await writeFile(joinPath(logsFolder(), path), logData)\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { ZodTypeAny, z } from 'zod';
1
+ import { z } from 'zod';
2
2
  export { z as zod } from 'zod';
3
3
  /**
4
4
  * Returns a new schema that is the same as the input schema, but with all nested schemas set to strict.
@@ -6,7 +6,7 @@ export { z as zod } from 'zod';
6
6
  * @param schema - The schema to make strict.
7
7
  * @returns The result strict schema.
8
8
  */
9
- export declare function deepStrict(schema: ZodTypeAny): ZodTypeAny;
9
+ export declare function deepStrict<T>(schema: T): T;
10
10
  /**
11
11
  * Returns a human-readable string of the list of zod errors.
12
12
  *
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/public/node/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,WAAW,EAAc,CAAC,EAAC,MAAM,KAAK,CAAA;AAEzD,OAAO,EAAC,CAAC,IAAI,GAAG,EAAC,MAAM,KAAK,CAAA;AAE5B;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,MAAkB;IAC3C,IAAI,MAAM,YAAY,SAAS,EAAE;QAC/B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;QAC1B,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CACpC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,UAAU,CAAC,KAAmB,CAAC,CAAC,CAAC,CACpF,CAAA;QACD,OAAO,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,MAAM,EAAE,CAAA;KACtC;SAAM,IAAI,MAAM,YAAY,WAAW,EAAE;QACxC,OAAO,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,CAAA;KACpD;SAAM;QACL,OAAO,MAAM,CAAA;KACd;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,MAAwB;IACrD,OAAO,MAAM;SACV,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CACb,KAAK,CAAC,IAAI;SACP,IAAI,CAAC,GAAG,CAAC;SACT,MAAM,CAAC,IAAI,CAAC;SACZ,MAAM,CAAC,KAAK,CAAC,OAAO,IAAI,cAAc,CAAC,CAC3C;SACA,IAAI,CAAC,IAAI,CAAC,CAAA;AACf,CAAC","sourcesContent":["import {ZodObject, ZodOptional, ZodTypeAny, z} from 'zod'\n\nexport {z as zod} from 'zod'\n\n/**\n * Returns a new schema that is the same as the input schema, but with all nested schemas set to strict.\n *\n * @param schema - The schema to make strict.\n * @returns The result strict schema.\n */\nexport function deepStrict(schema: ZodTypeAny): ZodTypeAny {\n if (schema instanceof ZodObject) {\n const shape = schema.shape\n const strictShape = Object.fromEntries(\n Object.entries(shape).map(([key, value]) => [key, deepStrict(value as ZodTypeAny)]),\n )\n return z.object(strictShape).strict()\n } else if (schema instanceof ZodOptional) {\n return deepStrict(schema._def.innerType).optional()\n } else {\n return schema\n }\n}\n\n/**\n * Returns a human-readable string of the list of zod errors.\n *\n * @param errors - The list of zod errors.\n * @returns The human-readable string.\n */\nexport function errorsToString(errors: z.ZodIssueBase[]): string {\n return errors\n .map((error) =>\n error.path\n .join('.')\n .concat(': ')\n .concat(error.message ?? 'Unknow error'),\n )\n .join('\\n')\n}\n"]}
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/public/node/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,WAAW,EAAc,CAAC,EAAC,MAAM,KAAK,CAAA;AAEzD,OAAO,EAAC,CAAC,IAAI,GAAG,EAAC,MAAM,KAAK,CAAA;AAE5B;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAI,MAAS;IACrC,IAAI,MAAM,YAAY,SAAS,EAAE;QAC/B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;QAC1B,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CACpC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,UAAU,CAAC,KAAmB,CAAC,CAAC,CAAC,CACpF,CAAA;QACD,OAAO,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,MAAM,EAAO,CAAA;KAC3C;SAAM,IAAI,MAAM,YAAY,WAAW,EAAE;QACxC,OAAO,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,CAAA;KACpD;SAAM;QACL,OAAO,MAAM,CAAA;KACd;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,MAAwB;IACrD,OAAO,MAAM;SACV,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CACb,KAAK,CAAC,IAAI;SACP,IAAI,CAAC,GAAG,CAAC;SACT,MAAM,CAAC,IAAI,CAAC;SACZ,MAAM,CAAC,KAAK,CAAC,OAAO,IAAI,cAAc,CAAC,CAC3C;SACA,IAAI,CAAC,IAAI,CAAC,CAAA;AACf,CAAC","sourcesContent":["import {ZodObject, ZodOptional, ZodTypeAny, z} from 'zod'\n\nexport {z as zod} from 'zod'\n\n/**\n * Returns a new schema that is the same as the input schema, but with all nested schemas set to strict.\n *\n * @param schema - The schema to make strict.\n * @returns The result strict schema.\n */\nexport function deepStrict<T>(schema: T): T {\n if (schema instanceof ZodObject) {\n const shape = schema.shape\n const strictShape = Object.fromEntries(\n Object.entries(shape).map(([key, value]) => [key, deepStrict(value as ZodTypeAny)]),\n )\n return z.object(strictShape).strict() as T\n } else if (schema instanceof ZodOptional) {\n return deepStrict(schema._def.innerType).optional()\n } else {\n return schema\n }\n}\n\n/**\n * Returns a human-readable string of the list of zod errors.\n *\n * @param errors - The list of zod errors.\n * @returns The human-readable string.\n */\nexport function errorsToString(errors: z.ZodIssueBase[]): string {\n return errors\n .map((error) =>\n error.path\n .join('.')\n .concat(': ')\n .concat(error.message ?? 'Unknow error'),\n )\n .join('\\n')\n}\n"]}
@@ -20,6 +20,15 @@ interface EnsureAuthenticatedAdditionalOptions {
20
20
  * @returns The access token for the Partners API.
21
21
  */
22
22
  export declare function ensureAuthenticatedPartners(scopes?: string[], env?: NodeJS.ProcessEnv, options?: EnsureAuthenticatedAdditionalOptions): Promise<string>;
23
+ /**
24
+ * Ensure that we have a valid session to access the App Management API.
25
+ *
26
+ * @param scopes - Optional array of extra scopes to authenticate with.
27
+ * @param env - Optional environment variables to use.
28
+ * @param options - Optional extra options to use.
29
+ * @returns The access token for the App Management API.
30
+ */
31
+ export declare function ensureAuthenticatedAppManagement(scopes?: string[], env?: NodeJS.ProcessEnv, options?: EnsureAuthenticatedAdditionalOptions): Promise<string>;
23
32
  /**
24
33
  * Ensure that we have a valid session to access the Storefront API.
25
34
  *
@@ -29,6 +29,24 @@ ${outputToken.json(scopes)}
29
29
  }
30
30
  return tokens.partners;
31
31
  }
32
+ /**
33
+ * Ensure that we have a valid session to access the App Management API.
34
+ *
35
+ * @param scopes - Optional array of extra scopes to authenticate with.
36
+ * @param env - Optional environment variables to use.
37
+ * @param options - Optional extra options to use.
38
+ * @returns The access token for the App Management API.
39
+ */
40
+ export async function ensureAuthenticatedAppManagement(scopes = [], env = process.env, options = {}) {
41
+ outputDebug(outputContent `Ensuring that the user is authenticated with the App Management API with the following scopes:
42
+ ${outputToken.json(scopes)}
43
+ `);
44
+ const tokens = await ensureAuthenticated({ appManagementApi: { scopes } }, env, options);
45
+ if (!tokens) {
46
+ throw new BugError('No App Management token found after ensuring authenticated');
47
+ }
48
+ return tokens.appManagement;
49
+ }
32
50
  /**
33
51
  * Ensure that we have a valid session to access the Storefront API.
34
52
  *