@shopify/cli-kit 4.8.4 → 4.9.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.
- package/dist/private/node/analytics.js +5 -3
- package/dist/private/node/analytics.js.map +1 -1
- package/dist/private/node/api/status-checks.d.ts +7 -0
- package/dist/private/node/api/status-checks.js +11 -0
- package/dist/private/node/api/status-checks.js.map +1 -0
- package/dist/private/node/api.d.ts +15 -0
- package/dist/private/node/api.js +28 -0
- package/dist/private/node/api.js.map +1 -1
- package/dist/private/node/command-event-context.d.ts +29 -0
- package/dist/private/node/command-event-context.js +43 -0
- package/dist/private/node/command-event-context.js.map +1 -0
- package/dist/private/node/command-event-output.d.ts +7 -0
- package/dist/private/node/command-event-output.js +16 -0
- package/dist/private/node/command-event-output.js.map +1 -0
- package/dist/private/node/command-json-schema.d.ts +10 -0
- package/dist/private/node/command-json-schema.js +38 -0
- package/dist/private/node/command-json-schema.js.map +1 -0
- package/dist/private/node/context/agent.d.ts +1 -0
- package/dist/private/node/context/agent.js +44 -0
- package/dist/private/node/context/agent.js.map +1 -0
- package/dist/private/node/json-error.d.ts +23 -0
- package/dist/private/node/json-error.js +123 -0
- package/dist/private/node/json-error.js.map +1 -0
- package/dist/private/node/output.js +3 -1
- package/dist/private/node/output.js.map +1 -1
- package/dist/private/node/output.test.d.ts +1 -0
- package/dist/private/node/output.test.js +74 -0
- package/dist/private/node/output.test.js.map +1 -0
- package/dist/private/node/session/device-authorization.js +49 -15
- package/dist/private/node/session/device-authorization.js.map +1 -1
- package/dist/private/node/session/validate.js +9 -22
- package/dist/private/node/session/validate.js.map +1 -1
- package/dist/private/node/ui/alert.d.ts +1 -1
- package/dist/private/node/ui/alert.js +29 -3
- package/dist/private/node/ui/alert.js.map +1 -1
- package/dist/private/node/ui/components/ConcurrentOutput.d.ts +8 -1
- package/dist/private/node/ui/components/ConcurrentOutput.js +54 -0
- package/dist/private/node/ui/components/ConcurrentOutput.js.map +1 -1
- package/dist/private/node/ui/components/DangerousConfirmationPrompt.js +3 -3
- package/dist/private/node/ui/components/DangerousConfirmationPrompt.js.map +1 -1
- package/dist/private/node/ui/components/DangerousConfirmationPrompt.test.js +16 -1
- package/dist/private/node/ui/components/DangerousConfirmationPrompt.test.js.map +1 -1
- package/dist/private/node/ui/components/Prompts/PromptLayout.js +3 -2
- package/dist/private/node/ui/components/Prompts/PromptLayout.js.map +1 -1
- package/dist/private/node/ui/components/Prompts/PromptLayout.test.js +20 -1
- package/dist/private/node/ui/components/Prompts/PromptLayout.test.js.map +1 -1
- package/dist/private/node/ui/components/Tasks.d.ts +2 -9
- package/dist/private/node/ui/components/Tasks.js +5 -44
- package/dist/private/node/ui/components/Tasks.js.map +1 -1
- package/dist/private/node/ui/components/TextPrompt.js +3 -3
- package/dist/private/node/ui/components/TextPrompt.js.map +1 -1
- package/dist/private/node/ui/components/TextPrompt.test.js +15 -1
- package/dist/private/node/ui/components/TextPrompt.test.js.map +1 -1
- package/dist/private/node/ui/components/token-item.d.ts +2 -0
- package/dist/private/node/ui/components/token-item.js +26 -0
- package/dist/private/node/ui/components/token-item.js.map +1 -1
- package/dist/private/node/ui/hooks/use-async-and-unmount.d.ts +3 -3
- package/dist/private/node/ui/hooks/use-async-and-unmount.js +2 -2
- package/dist/private/node/ui/hooks/use-async-and-unmount.js.map +1 -1
- package/dist/private/node/ui/tasks.d.ts +10 -0
- package/dist/private/node/ui/tasks.js +68 -0
- package/dist/private/node/ui/tasks.js.map +1 -0
- package/dist/public/common/command-events.d.ts +125 -0
- package/dist/public/common/command-events.js +54 -0
- package/dist/public/common/command-events.js.map +1 -0
- package/dist/public/common/json-output-schema.d.ts +10 -0
- package/dist/public/common/json-output-schema.js +17 -0
- package/dist/public/common/json-output-schema.js.map +1 -0
- package/dist/public/common/version.d.ts +1 -1
- package/dist/public/common/version.js +1 -1
- package/dist/public/common/version.js.map +1 -1
- package/dist/public/node/api/admin.js +18 -1
- package/dist/public/node/api/admin.js.map +1 -1
- package/dist/public/node/api/app-management.d.ts +1 -0
- package/dist/public/node/api/app-management.js +4 -0
- package/dist/public/node/api/app-management.js.map +1 -1
- package/dist/public/node/api/bulk-operations/download-bulk-operation-results.d.ts +3 -3
- package/dist/public/node/api/bulk-operations/download-bulk-operation-results.js +5 -3
- package/dist/public/node/api/bulk-operations/download-bulk-operation-results.js.map +1 -1
- package/dist/public/node/base-command.d.ts +6 -0
- package/dist/public/node/base-command.js +34 -5
- package/dist/public/node/base-command.js.map +1 -1
- package/dist/public/node/cli-launcher.js +20 -2
- package/dist/public/node/cli-launcher.js.map +1 -1
- package/dist/public/node/cli.d.ts +1 -0
- package/dist/public/node/cli.js +2 -0
- package/dist/public/node/cli.js.map +1 -1
- package/dist/public/node/command-events.d.ts +65 -0
- package/dist/public/node/command-events.js +71 -0
- package/dist/public/node/command-events.js.map +1 -0
- package/dist/public/node/context/local.d.ts +6 -0
- package/dist/public/node/context/local.js +10 -1
- package/dist/public/node/context/local.js.map +1 -1
- package/dist/public/node/custom-oclif-loader.d.ts +6 -0
- package/dist/public/node/custom-oclif-loader.js +45 -19
- package/dist/public/node/custom-oclif-loader.js.map +1 -1
- package/dist/public/node/environment.d.ts +2 -1
- package/dist/public/node/environment.js +3 -2
- package/dist/public/node/environment.js.map +1 -1
- package/dist/public/node/error/index.d.ts +91 -0
- package/dist/public/node/error/index.js +266 -0
- package/dist/public/node/error/index.js.map +1 -0
- package/dist/public/node/error/schema.d.ts +472 -0
- package/dist/public/node/error/schema.js +54 -0
- package/dist/public/node/error/schema.js.map +1 -0
- package/dist/public/node/error/types.d.ts +9 -0
- package/dist/public/node/error/types.js +2 -0
- package/dist/public/node/error/types.js.map +1 -0
- package/dist/public/node/error.d.ts +1 -87
- package/dist/public/node/error.js +1 -252
- package/dist/public/node/error.js.map +1 -1
- package/dist/public/node/fs.d.ts +17 -3
- package/dist/public/node/fs.js +7 -5
- package/dist/public/node/fs.js.map +1 -1
- package/dist/public/node/json-output-schema.d.ts +26 -0
- package/dist/public/node/json-output-schema.js +30 -0
- package/dist/public/node/json-output-schema.js.map +1 -0
- package/dist/public/node/local-storage.d.ts +1 -0
- package/dist/public/node/local-storage.js +54 -21
- package/dist/public/node/local-storage.js.map +1 -1
- package/dist/public/node/monorail.d.ts +3 -1
- package/dist/public/node/monorail.js +1 -1
- package/dist/public/node/monorail.js.map +1 -1
- package/dist/public/node/multiple-installation-warning.d.ts +1 -1
- package/dist/public/node/multiple-installation-warning.js +2 -3
- package/dist/public/node/multiple-installation-warning.js.map +1 -1
- package/dist/public/node/no-input.d.ts +11 -0
- package/dist/public/node/no-input.js +19 -0
- package/dist/public/node/no-input.js.map +1 -0
- package/dist/public/node/output.d.ts +6 -0
- package/dist/public/node/output.js +40 -0
- package/dist/public/node/output.js.map +1 -1
- package/dist/public/node/path.js +3 -1
- package/dist/public/node/path.js.map +1 -1
- package/dist/public/node/system.d.ts +2 -2
- package/dist/public/node/system.js +8 -4
- package/dist/public/node/system.js.map +1 -1
- package/dist/public/node/testing/output.d.ts +30 -0
- package/dist/public/node/testing/output.js +83 -0
- package/dist/public/node/testing/output.js.map +1 -1
- package/dist/public/node/ui.d.ts +5 -1
- package/dist/public/node/ui.js +89 -5
- package/dist/public/node/ui.js.map +1 -1
- package/dist/public/node/upgrade.js +17 -2
- package/dist/public/node/upgrade.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -2
|
@@ -2,7 +2,7 @@ import { graphqlRequest, graphqlRequestDoc, } from './graphql.js';
|
|
|
2
2
|
import { outputContent, outputToken } from '../output.js';
|
|
3
3
|
import { AbortError, BugError } from '../error.js';
|
|
4
4
|
import { restRequestBody, restRequestHeaders, restRequestUrl, isThemeAccessSession, } from '../../../private/node/api/rest.js';
|
|
5
|
-
import { isNetworkError } from '../../../private/node/api.js';
|
|
5
|
+
import { isAbortedFetchError, isNetworkError } from '../../../private/node/api.js';
|
|
6
6
|
import { shopifyFetch } from '../http.js';
|
|
7
7
|
import { PublicApiVersions } from '../../../cli/api/graphql/admin/generated/public_api_versions.js';
|
|
8
8
|
import { themeKitAccessDomain } from '../../../private/node/constants.js';
|
|
@@ -126,6 +126,23 @@ export async function fetchApiVersions(session, preferredBehaviour) {
|
|
|
126
126
|
if (error instanceof ClientError && (error.response.status === 401 || error.response.status === 404)) {
|
|
127
127
|
throw new AbortError(`Error connecting to your store ${session.storeFqdn}: ${error.message} ${error.response.status} ${error.response.data}`);
|
|
128
128
|
}
|
|
129
|
+
// HTTP 402 means the shop is frozen, paused, or closed. That is a store state the user can
|
|
130
|
+
// fix, not a CLI bug, so it must not reach the BugError below.
|
|
131
|
+
if (error instanceof ClientError && error.response.status === 402) {
|
|
132
|
+
throw new AbortError(`The store ${session.storeFqdn} is currently unavailable.`, 'This usually means the store is frozen, paused, or closed. Check the store in the Shopify admin and try again once it is reactivated.');
|
|
133
|
+
}
|
|
134
|
+
// HTTP 5xx is a Shopify-side failure. This query takes no user input, so the user's command
|
|
135
|
+
// cannot have caused it. `isExpectedApiError` covers 502/503/504, but only for raw errors, so
|
|
136
|
+
// it never sees one we have already wrapped in a BugError.
|
|
137
|
+
if (error instanceof ClientError && error.response.status >= 500) {
|
|
138
|
+
throw new AbortError(`The Admin API for ${session.storeFqdn} returned a server error (HTTP ${error.response.status}).`, 'This is a problem on the Shopify side, not with your command. Wait a moment and try again.');
|
|
139
|
+
}
|
|
140
|
+
// A cancelled request is neither a store-state failure nor a CLI bug. Checked before
|
|
141
|
+
// `isNetworkError` so the message says the request was aborted instead of blaming the
|
|
142
|
+
// user's connection.
|
|
143
|
+
if (isAbortedFetchError(error)) {
|
|
144
|
+
throw new AbortError(`Request to ${session.storeFqdn} was aborted before it completed.`, 'The request was cancelled or timed out before the store responded. Try running the command again.');
|
|
145
|
+
}
|
|
129
146
|
// Check for network-level errors (connection issues, timeouts, DNS failures, TLS/certificate errors, etc.)
|
|
130
147
|
// All network errors should be treated as user-facing errors, not CLI bugs
|
|
131
148
|
// Note: Some of these may have been retried already by lower-level retry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,CAAC,MAAM;QACvB,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE;KAChC,CAAA;AACH,CAAC","sourcesContent":["import {\n graphqlRequest,\n graphqlRequestDoc,\n GraphQLResponseOptions,\n GraphQLVariables,\n UnauthorizedHandler,\n} from './graphql.js'\nimport {AdminSession} from '../session.js'\nimport {outputContent, outputToken} from '../output.js'\nimport {AbortError, BugError} from '../error.js'\nimport {\n restRequestBody,\n restRequestHeaders,\n restRequestUrl,\n isThemeAccessSession,\n} from '../../../private/node/api/rest.js'\nimport {isNetworkError} from '../../../private/node/api.js'\nimport {RequestModeInput, shopifyFetch} from '../http.js'\nimport {PublicApiVersions} from '../../../cli/api/graphql/admin/generated/public_api_versions.js'\nimport {themeKitAccessDomain} from '../../../private/node/constants.js'\nimport {serviceEnvironment} from '../../../private/node/context/service.js'\nimport {DevServerCore} from '../vendor/dev_server/index.js'\nimport {ClientError, Variables} from 'graphql-request'\n\nimport {TypedDocumentNode} from '@graphql-typed-document-node/core'\n\nconst LatestApiVersionByFQDN = new Map<string, string>()\n\n/**\n * Executes a GraphQL query against the Admin API.\n *\n * @param query - GraphQL query to execute.\n * @param session - Shopify admin session including token and Store FQDN.\n * @param variables - GraphQL variables to pass to the query.\n * @param version - API version.\n * @returns The response of the query of generic type <T>.\n */\nexport async function adminRequest<T>(\n query: string,\n session: AdminSession,\n variables?: GraphQLVariables,\n version?: string,\n): Promise<T> {\n const api = 'Admin'\n const apiVersion = version ?? (await fetchLatestSupportedApiVersion(session))\n let storeDomain = session.storeFqdn\n const addedHeaders = themeAccessHeaders(session)\n\n if (serviceEnvironment() === 'local') {\n addedHeaders['x-forwarded-host'] = storeDomain\n storeDomain = new DevServerCore().host('app')\n }\n\n const url = adminUrl(storeDomain, apiVersion, session)\n return graphqlRequest({query, api, addedHeaders, url, token: session.token, variables})\n}\n\nexport interface AdminRequestOptions<TResult, TVariables extends Variables> {\n /** GraphQL query to execute. */\n query: TypedDocumentNode<TResult, TVariables>\n /** Shopify admin session including token and Store FQDN. */\n session: AdminSession\n /** GraphQL variables to pass to the query. */\n variables?: TVariables\n /** API version. */\n version?: string\n /** Control how API responses will be handled. */\n responseOptions?: GraphQLResponseOptions<TResult>\n /** Custom request behaviour for retries and timeouts. */\n preferredBehaviour?: RequestModeInput\n}\n\n/**\n * Executes a GraphQL query against the Admin API. Uses typed documents.\n *\n * @param options - Admin request options.\n * @returns The response of the query of generic type <TResult>.\n */\nexport async function adminRequestDoc<TResult, TVariables extends Variables>(\n options: AdminRequestOptions<TResult, TVariables>,\n): Promise<TResult> {\n const {query, session, variables, version, responseOptions, preferredBehaviour} = options\n\n let apiVersion = version ?? LatestApiVersionByFQDN.get(session.storeFqdn)\n apiVersion ??= await fetchLatestSupportedApiVersion(session, preferredBehaviour)\n let storeDomain = session.storeFqdn\n const addedHeaders = themeAccessHeaders(session)\n\n if (serviceEnvironment() === 'local') {\n addedHeaders['x-forwarded-host'] = storeDomain\n storeDomain = new DevServerCore().host('app')\n }\n\n const opts = {\n url: adminUrl(storeDomain, apiVersion, session),\n api: 'Admin',\n token: session.token,\n addedHeaders,\n }\n let unauthorizedHandler: UnauthorizedHandler | undefined\n if ('refresh' in session) {\n unauthorizedHandler = {type: 'token_refresh', handler: session.refresh as () => Promise<{token: string}>}\n }\n const result = graphqlRequestDoc<TResult, TVariables>({\n ...opts,\n query,\n variables,\n responseOptions,\n unauthorizedHandler,\n preferredBehaviour,\n })\n return result\n}\n\nfunction themeAccessHeaders(session: AdminSession): Record<string, string> {\n return isThemeAccessSession(session)\n ? {'X-Shopify-Shop': session.storeFqdn, 'X-Shopify-Access-Token': session.token}\n : {}\n}\n\n/**\n * GraphQL query to retrieve the latest supported API version.\n *\n * @param session - Shopify admin session including token and Store FQDN.\n * @param preferredBehaviour - Custom request behaviour for retries and timeouts.\n * @returns - The latest supported API version.\n */\nasync function fetchLatestSupportedApiVersion(\n session: AdminSession,\n preferredBehaviour?: RequestModeInput,\n): Promise<string> {\n const apiVersions = await supportedApiVersions(session, preferredBehaviour)\n\n const latest = apiVersions.reverse()[0]!\n LatestApiVersionByFQDN.set(session.storeFqdn, latest)\n return latest\n}\n\n/**\n * GraphQL query to retrieve all supported API versions.\n *\n * @param session - Shopify admin session including token and Store FQDN.\n * @param preferredBehaviour - Custom request behaviour for retries and timeouts.\n * @returns - An array of supported API versions.\n */\nexport async function supportedApiVersions(\n session: AdminSession,\n preferredBehaviour?: RequestModeInput,\n): Promise<string[]> {\n const apiVersions = await fetchApiVersions(session, preferredBehaviour)\n return apiVersions\n .filter((item) => item.supported)\n .map((item) => item.handle)\n .sort()\n}\n\n/**\n * GraphQL query to retrieve all API versions.\n *\n * @param session - Shopify admin session including token and Store FQDN.\n * @param preferredBehaviour - Custom request behaviour for retries and timeouts.\n * @returns - An array of supported and unsupported API versions.\n */\nexport async function fetchApiVersions(\n session: AdminSession,\n preferredBehaviour?: RequestModeInput,\n): Promise<ApiVersion[]> {\n try {\n const response = await adminRequestDoc({\n query: PublicApiVersions,\n session,\n variables: {},\n version: 'unstable',\n responseOptions: {handleErrors: false},\n preferredBehaviour,\n })\n return response.publicApiVersions\n } catch (error) {\n if (error instanceof ClientError && error.response.status === 403) {\n const storeName = session.storeFqdn.replace('.myshopify.com', '')\n throw new AbortError(\n outputContent`Looks like you don't have access to this dev store: (${outputToken.link(\n storeName,\n `https://${session.storeFqdn}`,\n )})`,\n outputContent`If you're not the owner, create a dev store staff account for yourself`,\n )\n }\n if (error instanceof ClientError && (error.response.status === 401 || error.response.status === 404)) {\n throw new AbortError(\n `Error connecting to your store ${session.storeFqdn}: ${error.message} ${error.response.status} ${error.response.data}`,\n )\n }\n\n // Check for network-level errors (connection issues, timeouts, DNS failures, TLS/certificate errors, etc.)\n // All network errors should be treated as user-facing errors, not CLI bugs\n // Note: Some of these may have been retried already by lower-level retry logic\n if (isNetworkError(error)) {\n throw new AbortError(\n `Network error connecting to your store ${session.storeFqdn}: ${\n error instanceof Error ? error.message : String(error)\n }`,\n 'Check your internet connection and try again.',\n )\n }\n\n // Unknown errors are likely bugs in the CLI\n throw new BugError(\n `Unknown error connecting to your store ${session.storeFqdn}: ${\n error instanceof Error ? error.message : String(error)\n }`,\n )\n }\n}\n\n/**\n * Returns the Admin API URL for the given store and version.\n *\n * @param store - Store FQDN.\n * @param version - API version.\n * @param session - User session.\n * @returns - Admin API URL.\n */\nexport function adminUrl(store: string, version: string | undefined, session?: AdminSession): string {\n const realVersion = version ?? 'unstable'\n\n const url =\n session && isThemeAccessSession(session)\n ? `https://${themeKitAccessDomain}/cli/admin/api/${realVersion}/graphql.json`\n : `https://${store}/admin/api/${realVersion}/graphql.json`\n return url\n}\n\ninterface ApiVersion {\n handle: string\n supported: boolean\n}\n\n/**\n * Executes a REST request against the Admin API.\n *\n * @param method - Request's HTTP method.\n * @param path - Path of the REST resource.\n * @param session - Shopify Admin session including token and Store FQDN.\n * @param requestBody - Request body of including REST resource specific parameters.\n * @param searchParams - Search params, appended to the URL.\n * @param apiVersion - Admin API version.\n * @returns - The {@link RestResponse}.\n */\nexport async function restRequest<T>(\n method: string,\n path: string,\n session: AdminSession,\n requestBody?: T,\n searchParams: Record<string, string> = {},\n apiVersion = 'unstable',\n): Promise<RestResponse> {\n const url = restRequestUrl(session, apiVersion, path, searchParams)\n const body = restRequestBody<T>(requestBody)\n\n const headers = restRequestHeaders(session)\n const response = await shopifyFetch(url, {\n headers,\n method,\n body,\n })\n\n const json = await response.json().catch(() => ({}))\n\n return {\n json,\n status: response.status,\n headers: response.headers.raw(),\n }\n}\n\n/**\n * Respose of a REST request.\n */\nexport interface RestResponse {\n /**\n * REST JSON respose.\n */\n // Using `any` to avoid introducing extra DTO layers.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n json: any\n\n /**\n * HTTP response status.\n */\n status: number\n\n /**\n * HTTP response headers.\n */\n headers: Record<string, string[]>\n}\n"]}
|
|
1
|
+
{"version":3,"file":"admin.js","sourceRoot":"","sources":["../../../../src/public/node/api/admin.ts"],"names":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AUG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,MAAc,EACd,IAAY,EACZ,OAAqB,EACrB,WAAe,EACf,eAAuC,EAAE,EACzC,UAAU,GAAG,UAAU;IAEvB,MAAM,GAAG,GAAG,cAAc,CAAC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,CAAC,CAAA;IACnE,MAAM,IAAI,GAAG,eAAe,CAAI,WAAW,CAAC,CAAA;IAE5C,MAAM,OAAO,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAA;IAC3C,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,GAAG,EAAE;QACvC,OAAO;QACP,MAAM;QACN,IAAI;KACL,CAAC,CAAA;IAEF,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IAEpD,OAAO;QACL,IAAI;QACJ,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE;KAChC,CAAA;AACH,CAAC","sourcesContent":["import {\n graphqlRequest,\n graphqlRequestDoc,\n GraphQLResponseOptions,\n GraphQLVariables,\n UnauthorizedHandler,\n} from './graphql.js'\nimport {AdminSession} from '../session.js'\nimport {outputContent, outputToken} from '../output.js'\nimport {AbortError, BugError} from '../error.js'\nimport {\n restRequestBody,\n restRequestHeaders,\n restRequestUrl,\n isThemeAccessSession,\n} from '../../../private/node/api/rest.js'\nimport {isAbortedFetchError, isNetworkError} from '../../../private/node/api.js'\nimport {RequestModeInput, shopifyFetch} from '../http.js'\nimport {PublicApiVersions} from '../../../cli/api/graphql/admin/generated/public_api_versions.js'\nimport {themeKitAccessDomain} from '../../../private/node/constants.js'\nimport {serviceEnvironment} from '../../../private/node/context/service.js'\nimport {DevServerCore} from '../vendor/dev_server/index.js'\nimport {ClientError, Variables} from 'graphql-request'\n\nimport {TypedDocumentNode} from '@graphql-typed-document-node/core'\n\nconst LatestApiVersionByFQDN = new Map<string, string>()\n\n/**\n * Executes a GraphQL query against the Admin API.\n *\n * @param query - GraphQL query to execute.\n * @param session - Shopify admin session including token and Store FQDN.\n * @param variables - GraphQL variables to pass to the query.\n * @param version - API version.\n * @returns The response of the query of generic type <T>.\n */\nexport async function adminRequest<T>(\n query: string,\n session: AdminSession,\n variables?: GraphQLVariables,\n version?: string,\n): Promise<T> {\n const api = 'Admin'\n const apiVersion = version ?? (await fetchLatestSupportedApiVersion(session))\n let storeDomain = session.storeFqdn\n const addedHeaders = themeAccessHeaders(session)\n\n if (serviceEnvironment() === 'local') {\n addedHeaders['x-forwarded-host'] = storeDomain\n storeDomain = new DevServerCore().host('app')\n }\n\n const url = adminUrl(storeDomain, apiVersion, session)\n return graphqlRequest({query, api, addedHeaders, url, token: session.token, variables})\n}\n\nexport interface AdminRequestOptions<TResult, TVariables extends Variables> {\n /** GraphQL query to execute. */\n query: TypedDocumentNode<TResult, TVariables>\n /** Shopify admin session including token and Store FQDN. */\n session: AdminSession\n /** GraphQL variables to pass to the query. */\n variables?: TVariables\n /** API version. */\n version?: string\n /** Control how API responses will be handled. */\n responseOptions?: GraphQLResponseOptions<TResult>\n /** Custom request behaviour for retries and timeouts. */\n preferredBehaviour?: RequestModeInput\n}\n\n/**\n * Executes a GraphQL query against the Admin API. Uses typed documents.\n *\n * @param options - Admin request options.\n * @returns The response of the query of generic type <TResult>.\n */\nexport async function adminRequestDoc<TResult, TVariables extends Variables>(\n options: AdminRequestOptions<TResult, TVariables>,\n): Promise<TResult> {\n const {query, session, variables, version, responseOptions, preferredBehaviour} = options\n\n let apiVersion = version ?? LatestApiVersionByFQDN.get(session.storeFqdn)\n apiVersion ??= await fetchLatestSupportedApiVersion(session, preferredBehaviour)\n let storeDomain = session.storeFqdn\n const addedHeaders = themeAccessHeaders(session)\n\n if (serviceEnvironment() === 'local') {\n addedHeaders['x-forwarded-host'] = storeDomain\n storeDomain = new DevServerCore().host('app')\n }\n\n const opts = {\n url: adminUrl(storeDomain, apiVersion, session),\n api: 'Admin',\n token: session.token,\n addedHeaders,\n }\n let unauthorizedHandler: UnauthorizedHandler | undefined\n if ('refresh' in session) {\n unauthorizedHandler = {type: 'token_refresh', handler: session.refresh as () => Promise<{token: string}>}\n }\n const result = graphqlRequestDoc<TResult, TVariables>({\n ...opts,\n query,\n variables,\n responseOptions,\n unauthorizedHandler,\n preferredBehaviour,\n })\n return result\n}\n\nfunction themeAccessHeaders(session: AdminSession): Record<string, string> {\n return isThemeAccessSession(session)\n ? {'X-Shopify-Shop': session.storeFqdn, 'X-Shopify-Access-Token': session.token}\n : {}\n}\n\n/**\n * GraphQL query to retrieve the latest supported API version.\n *\n * @param session - Shopify admin session including token and Store FQDN.\n * @param preferredBehaviour - Custom request behaviour for retries and timeouts.\n * @returns - The latest supported API version.\n */\nasync function fetchLatestSupportedApiVersion(\n session: AdminSession,\n preferredBehaviour?: RequestModeInput,\n): Promise<string> {\n const apiVersions = await supportedApiVersions(session, preferredBehaviour)\n\n const latest = apiVersions.reverse()[0]!\n LatestApiVersionByFQDN.set(session.storeFqdn, latest)\n return latest\n}\n\n/**\n * GraphQL query to retrieve all supported API versions.\n *\n * @param session - Shopify admin session including token and Store FQDN.\n * @param preferredBehaviour - Custom request behaviour for retries and timeouts.\n * @returns - An array of supported API versions.\n */\nexport async function supportedApiVersions(\n session: AdminSession,\n preferredBehaviour?: RequestModeInput,\n): Promise<string[]> {\n const apiVersions = await fetchApiVersions(session, preferredBehaviour)\n return apiVersions\n .filter((item) => item.supported)\n .map((item) => item.handle)\n .sort()\n}\n\n/**\n * GraphQL query to retrieve all API versions.\n *\n * @param session - Shopify admin session including token and Store FQDN.\n * @param preferredBehaviour - Custom request behaviour for retries and timeouts.\n * @returns - An array of supported and unsupported API versions.\n */\nexport async function fetchApiVersions(\n session: AdminSession,\n preferredBehaviour?: RequestModeInput,\n): Promise<ApiVersion[]> {\n try {\n const response = await adminRequestDoc({\n query: PublicApiVersions,\n session,\n variables: {},\n version: 'unstable',\n responseOptions: {handleErrors: false},\n preferredBehaviour,\n })\n return response.publicApiVersions\n } catch (error) {\n if (error instanceof ClientError && error.response.status === 403) {\n const storeName = session.storeFqdn.replace('.myshopify.com', '')\n throw new AbortError(\n outputContent`Looks like you don't have access to this dev store: (${outputToken.link(\n storeName,\n `https://${session.storeFqdn}`,\n )})`,\n outputContent`If you're not the owner, create a dev store staff account for yourself`,\n )\n }\n if (error instanceof ClientError && (error.response.status === 401 || error.response.status === 404)) {\n throw new AbortError(\n `Error connecting to your store ${session.storeFqdn}: ${error.message} ${error.response.status} ${error.response.data}`,\n )\n }\n\n // HTTP 402 means the shop is frozen, paused, or closed. That is a store state the user can\n // fix, not a CLI bug, so it must not reach the BugError below.\n if (error instanceof ClientError && error.response.status === 402) {\n throw new AbortError(\n `The store ${session.storeFqdn} is currently unavailable.`,\n 'This usually means the store is frozen, paused, or closed. Check the store in the Shopify admin and try again once it is reactivated.',\n )\n }\n\n // HTTP 5xx is a Shopify-side failure. This query takes no user input, so the user's command\n // cannot have caused it. `isExpectedApiError` covers 502/503/504, but only for raw errors, so\n // it never sees one we have already wrapped in a BugError.\n if (error instanceof ClientError && error.response.status >= 500) {\n throw new AbortError(\n `The Admin API for ${session.storeFqdn} returned a server error (HTTP ${error.response.status}).`,\n 'This is a problem on the Shopify side, not with your command. Wait a moment and try again.',\n )\n }\n\n // A cancelled request is neither a store-state failure nor a CLI bug. Checked before\n // `isNetworkError` so the message says the request was aborted instead of blaming the\n // user's connection.\n if (isAbortedFetchError(error)) {\n throw new AbortError(\n `Request to ${session.storeFqdn} was aborted before it completed.`,\n 'The request was cancelled or timed out before the store responded. Try running the command again.',\n )\n }\n\n // Check for network-level errors (connection issues, timeouts, DNS failures, TLS/certificate errors, etc.)\n // All network errors should be treated as user-facing errors, not CLI bugs\n // Note: Some of these may have been retried already by lower-level retry logic\n if (isNetworkError(error)) {\n throw new AbortError(\n `Network error connecting to your store ${session.storeFqdn}: ${\n error instanceof Error ? error.message : String(error)\n }`,\n 'Check your internet connection and try again.',\n )\n }\n\n // Unknown errors are likely bugs in the CLI\n throw new BugError(\n `Unknown error connecting to your store ${session.storeFqdn}: ${\n error instanceof Error ? error.message : String(error)\n }`,\n )\n }\n}\n\n/**\n * Returns the Admin API URL for the given store and version.\n *\n * @param store - Store FQDN.\n * @param version - API version.\n * @param session - User session.\n * @returns - Admin API URL.\n */\nexport function adminUrl(store: string, version: string | undefined, session?: AdminSession): string {\n const realVersion = version ?? 'unstable'\n\n const url =\n session && isThemeAccessSession(session)\n ? `https://${themeKitAccessDomain}/cli/admin/api/${realVersion}/graphql.json`\n : `https://${store}/admin/api/${realVersion}/graphql.json`\n return url\n}\n\ninterface ApiVersion {\n handle: string\n supported: boolean\n}\n\n/**\n * Executes a REST request against the Admin API.\n *\n * @param method - Request's HTTP method.\n * @param path - Path of the REST resource.\n * @param session - Shopify Admin session including token and Store FQDN.\n * @param requestBody - Request body of including REST resource specific parameters.\n * @param searchParams - Search params, appended to the URL.\n * @param apiVersion - Admin API version.\n * @returns - The {@link RestResponse}.\n */\nexport async function restRequest<T>(\n method: string,\n path: string,\n session: AdminSession,\n requestBody?: T,\n searchParams: Record<string, string> = {},\n apiVersion = 'unstable',\n): Promise<RestResponse> {\n const url = restRequestUrl(session, apiVersion, path, searchParams)\n const body = restRequestBody<T>(requestBody)\n\n const headers = restRequestHeaders(session)\n const response = await shopifyFetch(url, {\n headers,\n method,\n body,\n })\n\n const json = await response.json().catch(() => ({}))\n\n return {\n json,\n status: response.status,\n headers: response.headers.raw(),\n }\n}\n\n/**\n * Respose of a REST request.\n */\nexport interface RestResponse {\n /**\n * REST JSON respose.\n */\n // Using `any` to avoid introducing extra DTO layers.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n json: any\n\n /**\n * HTTP response status.\n */\n status: number\n\n /**\n * HTTP response headers.\n */\n headers: Record<string, string[]>\n}\n"]}
|
|
@@ -7,6 +7,7 @@ export declare const appManagementAppLogsUrl: (organizationId: string, cursor?:
|
|
|
7
7
|
status?: string;
|
|
8
8
|
source?: string;
|
|
9
9
|
}) => Promise<string>;
|
|
10
|
+
export declare const appManagementChannelSpecExportUrl: (organizationId: string, appId: string) => Promise<string>;
|
|
10
11
|
export interface RequestOptions {
|
|
11
12
|
requestMode: RequestModeInput;
|
|
12
13
|
}
|
|
@@ -30,6 +30,10 @@ export const appManagementAppLogsUrl = async (organizationId, cursor, filters) =
|
|
|
30
30
|
const url = `https://${fqdn}/app_management/unstable/organizations/${organizationId}/app_logs/poll`;
|
|
31
31
|
return addCursorAndFiltersToAppLogsUrl(url, cursor, filters);
|
|
32
32
|
};
|
|
33
|
+
export const appManagementChannelSpecExportUrl = async (organizationId, appId) => {
|
|
34
|
+
const fqdn = await appManagementFqdn();
|
|
35
|
+
return `https://${fqdn}/app_management/unstable/organizations/${encodeURIComponent(organizationId)}/apps/${encodeURIComponent(appId)}/channel_spec_export.json`;
|
|
36
|
+
};
|
|
33
37
|
/**
|
|
34
38
|
* Executes an org-scoped GraphQL query against the App Management API. Uses typed documents.
|
|
35
39
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-management.js","sourceRoot":"","sources":["../../../../src/public/node/api/app-management.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,+BAA+B,EAAC,MAAM,gBAAgB,CAAA;AAC9D,OAAO,EAAqD,iBAAiB,EAAC,MAAM,cAAc,CAAA;AAClG,OAAO,EAAC,iBAAiB,EAAC,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAC,sBAAsB,EAAC,MAAM,qDAAqD,CAAA;AAC1F,OAAO,EAAC,YAAY,EAAC,MAAM,sCAAsC,CAAA;AAEjE,OAAO,UAAU,MAAM,YAAY,CAAA;AAKnC,sEAAsE;AACtE,yEAAyE;AACzE,iDAAiD;AACjD,MAAM,OAAO,GAAG,IAAI,UAAU,CAAC;IAC7B,OAAO,EAAE,GAAG;IACZ,aAAa,EAAE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,OAAO,CAAC,SAAS;QAC5B,YAAY,EAAE,eAAe;QAC7B,kBAAkB,EAAE,OAAO,CAAC,cAAc,EAAE,WAAW;QACvD,mBAAmB,EAAE,OAAO,CAAC,mBAAmB;KACjD,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,CAAC;QACjF,IAAI,WAAW,CAAC,kBAAkB,EAAE,CAAC;YACnC,gBAAgB,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAA;QACjE,CAAC;IACH,CAAC;IAED,sBAAsB,CAAC,gBAAgB,CAAC,CAAA;AAC1C,CAAC","sourcesContent":["import {addCursorAndFiltersToAppLogsUrl} from './utilities.js'\nimport {CacheOptions, GraphQLResponse, UnauthorizedHandler, graphqlRequestDoc} from './graphql.js'\nimport {appManagementFqdn} from '../context/fqdn.js'\nimport {setNextDeprecationDate} from '../../../private/node/context/deprecations-store.js'\nimport {buildHeaders} from '../../../private/node/api/headers.js'\nimport {RequestModeInput} from '../http.js'\nimport Bottleneck from 'bottleneck'\n\nimport {TypedDocumentNode} from '@graphql-typed-document-node/core'\nimport {Variables} from 'graphql-request'\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\nasync function setupRequest(token: string) {\n const api = 'App Management'\n const fqdn = await appManagementFqdn()\n const url = `https://${fqdn}/app_management/unstable/graphql.json`\n return {\n token,\n api,\n url,\n responseOptions: {onResponse: handleDeprecations},\n }\n}\n\nexport const appManagementHeaders = (token: string): Record<string, string> => {\n return buildHeaders(token)\n}\n\nexport const appManagementAppLogsUrl = async (\n organizationId: string,\n cursor?: string,\n filters?: {\n status?: string\n source?: string\n },\n): Promise<string> => {\n const fqdn = await appManagementFqdn()\n const url = `https://${fqdn}/app_management/unstable/organizations/${organizationId}/app_logs/poll`\n return addCursorAndFiltersToAppLogsUrl(url, cursor, filters)\n}\n\nexport interface RequestOptions {\n requestMode: RequestModeInput\n}\n\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 * @param cacheOptions - Cache options for the request. If not present, the request will not be cached.\n * @param requestOptions - Preferred behaviour for the request.\n * @param unauthorizedHandler - Optional handler for unauthorized requests.\n */\nexport interface AppManagementRequestOptions<TResult, TVariables extends Variables> {\n query: TypedDocumentNode<TResult, TVariables>\n token: string\n variables?: TVariables\n cacheOptions?: CacheOptions\n requestOptions?: RequestOptions\n unauthorizedHandler: UnauthorizedHandler\n}\n\n/**\n * Executes an org-scoped GraphQL query against the App Management API. Uses typed documents.\n *\n * @param options - The options for the request.\n * @returns The response of the query of generic type <T>.\n */\nexport async function appManagementRequestDoc<TResult, TVariables extends Variables>(\n options: AppManagementRequestOptions<TResult, TVariables>,\n): Promise<TResult> {\n const cacheExtraKey = options.cacheOptions?.cacheExtraKey ?? ''\n const newCacheOptions = options.cacheOptions ? {...options.cacheOptions, cacheExtraKey} : undefined\n\n const result = limiter.schedule<TResult>(async () =>\n graphqlRequestDoc<TResult, TVariables>({\n ...(await setupRequest(options.token)),\n query: options.query,\n variables: options.variables,\n cacheOptions: newCacheOptions,\n preferredBehaviour: options.requestOptions?.requestMode,\n unauthorizedHandler: options.unauthorizedHandler,\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"]}
|
|
1
|
+
{"version":3,"file":"app-management.js","sourceRoot":"","sources":["../../../../src/public/node/api/app-management.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,+BAA+B,EAAC,MAAM,gBAAgB,CAAA;AAC9D,OAAO,EAAqD,iBAAiB,EAAC,MAAM,cAAc,CAAA;AAClG,OAAO,EAAC,iBAAiB,EAAC,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAC,sBAAsB,EAAC,MAAM,qDAAqD,CAAA;AAC1F,OAAO,EAAC,YAAY,EAAC,MAAM,sCAAsC,CAAA;AAEjE,OAAO,UAAU,MAAM,YAAY,CAAA;AAKnC,sEAAsE;AACtE,yEAAyE;AACzE,iDAAiD;AACjD,MAAM,OAAO,GAAG,IAAI,UAAU,CAAC;IAC7B,OAAO,EAAE,GAAG;IACZ,aAAa,EAAE,EAAE;CAClB,CAAC,CAAA;AAEF,KAAK,UAAU,YAAY,CAAC,KAAa;IACvC,MAAM,GAAG,GAAG,gBAAgB,CAAA;IAC5B,MAAM,IAAI,GAAG,MAAM,iBAAiB,EAAE,CAAA;IACtC,MAAM,GAAG,GAAG,WAAW,IAAI,uCAAuC,CAAA;IAClE,OAAO;QACL,KAAK;QACL,GAAG;QACH,GAAG;QACH,eAAe,EAAE,EAAC,UAAU,EAAE,kBAAkB,EAAC;KAClD,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAa,EAA0B,EAAE;IAC5E,OAAO,YAAY,CAA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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,CAAC;QACjF,IAAI,WAAW,CAAC,kBAAkB,EAAE,CAAC;YACnC,gBAAgB,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAA;QACjE,CAAC;IACH,CAAC;IAED,sBAAsB,CAAC,gBAAgB,CAAC,CAAA;AAC1C,CAAC","sourcesContent":["import {addCursorAndFiltersToAppLogsUrl} from './utilities.js'\nimport {CacheOptions, GraphQLResponse, UnauthorizedHandler, graphqlRequestDoc} from './graphql.js'\nimport {appManagementFqdn} from '../context/fqdn.js'\nimport {setNextDeprecationDate} from '../../../private/node/context/deprecations-store.js'\nimport {buildHeaders} from '../../../private/node/api/headers.js'\nimport {RequestModeInput} from '../http.js'\nimport Bottleneck from 'bottleneck'\n\nimport {TypedDocumentNode} from '@graphql-typed-document-node/core'\nimport {Variables} from 'graphql-request'\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\nasync function setupRequest(token: string) {\n const api = 'App Management'\n const fqdn = await appManagementFqdn()\n const url = `https://${fqdn}/app_management/unstable/graphql.json`\n return {\n token,\n api,\n url,\n responseOptions: {onResponse: handleDeprecations},\n }\n}\n\nexport const appManagementHeaders = (token: string): Record<string, string> => {\n return buildHeaders(token)\n}\n\nexport const appManagementAppLogsUrl = async (\n organizationId: string,\n cursor?: string,\n filters?: {\n status?: string\n source?: string\n },\n): Promise<string> => {\n const fqdn = await appManagementFqdn()\n const url = `https://${fqdn}/app_management/unstable/organizations/${organizationId}/app_logs/poll`\n return addCursorAndFiltersToAppLogsUrl(url, cursor, filters)\n}\n\nexport const appManagementChannelSpecExportUrl = async (organizationId: string, appId: string): Promise<string> => {\n const fqdn = await appManagementFqdn()\n return `https://${fqdn}/app_management/unstable/organizations/${encodeURIComponent(\n organizationId,\n )}/apps/${encodeURIComponent(appId)}/channel_spec_export.json`\n}\n\nexport interface RequestOptions {\n requestMode: RequestModeInput\n}\n\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 * @param cacheOptions - Cache options for the request. If not present, the request will not be cached.\n * @param requestOptions - Preferred behaviour for the request.\n * @param unauthorizedHandler - Optional handler for unauthorized requests.\n */\nexport interface AppManagementRequestOptions<TResult, TVariables extends Variables> {\n query: TypedDocumentNode<TResult, TVariables>\n token: string\n variables?: TVariables\n cacheOptions?: CacheOptions\n requestOptions?: RequestOptions\n unauthorizedHandler: UnauthorizedHandler\n}\n\n/**\n * Executes an org-scoped GraphQL query against the App Management API. Uses typed documents.\n *\n * @param options - The options for the request.\n * @returns The response of the query of generic type <T>.\n */\nexport async function appManagementRequestDoc<TResult, TVariables extends Variables>(\n options: AppManagementRequestOptions<TResult, TVariables>,\n): Promise<TResult> {\n const cacheExtraKey = options.cacheOptions?.cacheExtraKey ?? ''\n const newCacheOptions = options.cacheOptions ? {...options.cacheOptions, cacheExtraKey} : undefined\n\n const result = limiter.schedule<TResult>(async () =>\n graphqlRequestDoc<TResult, TVariables>({\n ...(await setupRequest(options.token)),\n query: options.query,\n variables: options.variables,\n cacheOptions: newCacheOptions,\n preferredBehaviour: options.requestOptions?.requestMode,\n unauthorizedHandler: options.unauthorizedHandler,\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"]}
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function downloadBulkOperationResults(url: string): Promise<string>;
|
|
8
8
|
/**
|
|
9
|
-
* Checks whether any line of a JSONL bulk operation result reports GraphQL user errors.
|
|
9
|
+
* Checks whether any line of a JSONL bulk operation result reports top-level GraphQL errors or nested user errors.
|
|
10
10
|
*
|
|
11
11
|
* Blank result files, such as a completed operation that matched nothing, are treated as having
|
|
12
|
-
* no
|
|
12
|
+
* no errors instead of crashing the JSON parser.
|
|
13
13
|
*
|
|
14
14
|
* @param results - The raw JSONL results string.
|
|
15
|
-
* @returns True if any result line reports
|
|
15
|
+
* @returns True if any result line reports errors.
|
|
16
16
|
*/
|
|
17
17
|
export declare function resultsContainUserErrors(results: string): boolean;
|
|
@@ -14,13 +14,13 @@ export async function downloadBulkOperationResults(url) {
|
|
|
14
14
|
return response.text();
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
* Checks whether any line of a JSONL bulk operation result reports GraphQL user errors.
|
|
17
|
+
* Checks whether any line of a JSONL bulk operation result reports top-level GraphQL errors or nested user errors.
|
|
18
18
|
*
|
|
19
19
|
* Blank result files, such as a completed operation that matched nothing, are treated as having
|
|
20
|
-
* no
|
|
20
|
+
* no errors instead of crashing the JSON parser.
|
|
21
21
|
*
|
|
22
22
|
* @param results - The raw JSONL results string.
|
|
23
|
-
* @returns True if any result line reports
|
|
23
|
+
* @returns True if any result line reports errors.
|
|
24
24
|
*/
|
|
25
25
|
export function resultsContainUserErrors(results) {
|
|
26
26
|
const lines = results
|
|
@@ -39,6 +39,8 @@ export function resultsContainUserErrors(results) {
|
|
|
39
39
|
return false;
|
|
40
40
|
throw error;
|
|
41
41
|
}
|
|
42
|
+
if (Array.isArray(parsed.errors) && parsed.errors.length > 0)
|
|
43
|
+
return true;
|
|
42
44
|
if (!parsed.data)
|
|
43
45
|
return false;
|
|
44
46
|
const result = Object.values(parsed.data)[0];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"download-bulk-operation-results.js","sourceRoot":"","sources":["../../../../../src/public/node/api/bulk-operations/download-bulk-operation-results.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,eAAe,CAAA;AACnC,OAAO,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAA;AAEzC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,GAAW;IAC5D,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAA;IAEjC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,UAAU,CAAC,8CAA8C,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAA;IAC3F,CAAC;IAED,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAA;AACxB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAe;IACtD,MAAM,KAAK,GAAG,OAAO;SAClB,IAAI,EAAE;SACN,KAAK,CAAC,IAAI,CAAC;SACX,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IAE3C,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;QACzB,IAAI,MAAM,CAAA;QACV,IAAI,CAAC;YACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC3B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,0FAA0F;YAC1F,gFAAgF;YAChF,IAAI,KAAK,YAAY,WAAW;gBAAE,OAAO,KAAK,CAAA;YAC9C,MAAM,KAAK,CAAA;QACb,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,IAAI;YAAE,OAAO,KAAK,CAAA;QAC9B,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAyC,CAAA;QACpF,OAAO,MAAM,EAAE,UAAU,KAAK,SAAS,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAA;IACzE,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {fetch} from '../../http.js'\nimport {AbortError} from '../../error.js'\n\n/**\n * Downloads the results of a completed bulk operation.\n *\n * @param url - The results URL returned by the Admin API.\n * @returns The raw JSONL results as a string.\n */\nexport async function downloadBulkOperationResults(url: string): Promise<string> {\n const response = await fetch(url)\n\n if (!response.ok) {\n throw new AbortError(`Failed to download bulk operation results: ${response.statusText}`)\n }\n\n return response.text()\n}\n\n/**\n * Checks whether any line of a JSONL bulk operation result reports GraphQL user errors.\n *\n * Blank result files, such as a completed operation that matched nothing, are treated as having\n * no
|
|
1
|
+
{"version":3,"file":"download-bulk-operation-results.js","sourceRoot":"","sources":["../../../../../src/public/node/api/bulk-operations/download-bulk-operation-results.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,eAAe,CAAA;AACnC,OAAO,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAA;AAEzC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,GAAW;IAC5D,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAA;IAEjC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,UAAU,CAAC,8CAA8C,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAA;IAC3F,CAAC;IAED,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAA;AACxB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAe;IACtD,MAAM,KAAK,GAAG,OAAO;SAClB,IAAI,EAAE;SACN,KAAK,CAAC,IAAI,CAAC;SACX,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IAE3C,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;QACzB,IAAI,MAAM,CAAA;QACV,IAAI,CAAC;YACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC3B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,0FAA0F;YAC1F,gFAAgF;YAChF,IAAI,KAAK,YAAY,WAAW;gBAAE,OAAO,KAAK,CAAA;YAC9C,MAAM,KAAK,CAAA;QACb,CAAC;QACD,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,IAAI,CAAA;QACzE,IAAI,CAAC,MAAM,CAAC,IAAI;YAAE,OAAO,KAAK,CAAA;QAC9B,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAyC,CAAA;QACpF,OAAO,MAAM,EAAE,UAAU,KAAK,SAAS,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAA;IACzE,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {fetch} from '../../http.js'\nimport {AbortError} from '../../error.js'\n\n/**\n * Downloads the results of a completed bulk operation.\n *\n * @param url - The results URL returned by the Admin API.\n * @returns The raw JSONL results as a string.\n */\nexport async function downloadBulkOperationResults(url: string): Promise<string> {\n const response = await fetch(url)\n\n if (!response.ok) {\n throw new AbortError(`Failed to download bulk operation results: ${response.statusText}`)\n }\n\n return response.text()\n}\n\n/**\n * Checks whether any line of a JSONL bulk operation result reports top-level GraphQL errors or nested user errors.\n *\n * Blank result files, such as a completed operation that matched nothing, are treated as having\n * no errors instead of crashing the JSON parser.\n *\n * @param results - The raw JSONL results string.\n * @returns True if any result line reports errors.\n */\nexport function resultsContainUserErrors(results: string): boolean {\n const lines = results\n .trim()\n .split('\\n')\n .filter((line) => line.trim().length > 0)\n\n return lines.some((line) => {\n let parsed\n try {\n parsed = JSON.parse(line)\n } catch (error) {\n // A single malformed line (truncated download, partial flush, etc.) shouldn't dictate the\n // overall result; skip it rather than throwing an uncontextualized SyntaxError.\n if (error instanceof SyntaxError) return false\n throw error\n }\n if (Array.isArray(parsed.errors) && parsed.errors.length > 0) return true\n if (!parsed.data) return false\n const result = Object.values(parsed.data)[0] as {userErrors?: unknown[]} | undefined\n return result?.userErrors !== undefined && result.userErrors.length > 0\n })\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type JsonOutputSchema } from './json-output-schema.js';
|
|
1
2
|
import { Command } from '@oclif/core';
|
|
2
3
|
import { OutputFlags, Input, ParserOutput, FlagInput, OutputArgs } from '@oclif/core/parser';
|
|
3
4
|
export type ArgOutput = OutputArgs<any>;
|
|
@@ -10,14 +11,19 @@ export interface NonTTYFlagRequirement {
|
|
|
10
11
|
}
|
|
11
12
|
declare abstract class BaseCommand extends Command {
|
|
12
13
|
static baseFlags: FlagInput<{}>;
|
|
14
|
+
static descriptionWithMarkdown?: string;
|
|
15
|
+
static get jsonOutputSchema(): JsonOutputSchema | undefined;
|
|
13
16
|
static get requiresSyncAnalytics(): boolean;
|
|
14
17
|
static nonTTYFlagRequirements(_flags: FlagOutput): NonTTYFlagRequirement[];
|
|
18
|
+
static descriptionForHelp(): string | undefined;
|
|
19
|
+
/** @deprecated Use descriptionForHelp instead. */
|
|
15
20
|
static descriptionWithoutMarkdown(): string | undefined;
|
|
16
21
|
static analyticsNameOverride(): string | undefined;
|
|
17
22
|
static analyticsStopCommand(): string | undefined;
|
|
18
23
|
catch(error: Error & {
|
|
19
24
|
skipOclifErrorHandling: boolean;
|
|
20
25
|
}): Promise<void>;
|
|
26
|
+
protected _run<T>(): Promise<T>;
|
|
21
27
|
protected init(): Promise<unknown>;
|
|
22
28
|
protected showNpmFlagWarning(): void;
|
|
23
29
|
protected exitWithTimestampWhenEnvVariablePresent(): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isDevelopment } from './context/local.js';
|
|
2
2
|
import { addPublicMetadata } from './metadata.js';
|
|
3
3
|
import { AbortError } from './error.js';
|
|
4
|
+
import { runWithCommandEventsForCommand } from './command-events.js';
|
|
4
5
|
import { outputContent, outputResult, outputToken } from './output.js';
|
|
5
6
|
import { setCurrentSessionAlias } from './session.js';
|
|
6
7
|
import { terminalSupportsPrompting } from './system.js';
|
|
@@ -8,19 +9,32 @@ import { hashString } from './crypto.js';
|
|
|
8
9
|
import { isTruthy } from './context/utilities.js';
|
|
9
10
|
import { setCurrentCommandId } from './global-context.js';
|
|
10
11
|
import { underscore } from '../common/string.js';
|
|
11
|
-
import { Command, Errors } from '@oclif/core';
|
|
12
|
+
import { Command, Errors, Flags } from '@oclif/core';
|
|
12
13
|
class BaseCommand extends Command {
|
|
13
|
-
static baseFlags = {
|
|
14
|
+
static baseFlags = {
|
|
15
|
+
'json-schema': Flags.boolean({
|
|
16
|
+
description: "Print the command's JSON schemas.",
|
|
17
|
+
env: 'SHOPIFY_FLAG_JSON_SCHEMA',
|
|
18
|
+
}),
|
|
19
|
+
};
|
|
20
|
+
static descriptionWithMarkdown;
|
|
21
|
+
static get jsonOutputSchema() {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
14
24
|
static get requiresSyncAnalytics() {
|
|
15
25
|
return false;
|
|
16
26
|
}
|
|
17
27
|
static nonTTYFlagRequirements(_flags) {
|
|
18
28
|
return [];
|
|
19
29
|
}
|
|
20
|
-
//
|
|
30
|
+
// Include the JSON result schema and convert Markdown links to plain text for command help.
|
|
31
|
+
static descriptionForHelp() {
|
|
32
|
+
const description = (this.descriptionWithMarkdown ?? '').replace(/(\[)(.*?)(])(\()(.*?)(\))/gm, '"$2" ($5)');
|
|
33
|
+
return appendJsonOutputSchema(description, this.jsonOutputSchema);
|
|
34
|
+
}
|
|
35
|
+
/** @deprecated Use descriptionForHelp instead. */
|
|
21
36
|
static descriptionWithoutMarkdown() {
|
|
22
|
-
|
|
23
|
-
return (this.descriptionWithMarkdown ?? '').replace(/(\[)(.*?)(])(\()(.*?)(\))/gm, '"$2" ($5)');
|
|
37
|
+
return this.descriptionForHelp();
|
|
24
38
|
}
|
|
25
39
|
static analyticsNameOverride() {
|
|
26
40
|
return undefined;
|
|
@@ -34,6 +48,9 @@ class BaseCommand extends Command {
|
|
|
34
48
|
await errorHandler(error, this.config);
|
|
35
49
|
return Errors.handle(error);
|
|
36
50
|
}
|
|
51
|
+
async _run() {
|
|
52
|
+
return runWithCommandEventsForCommand(this.argv, () => super._run());
|
|
53
|
+
}
|
|
37
54
|
async init() {
|
|
38
55
|
this.exitWithTimestampWhenEnvVariablePresent();
|
|
39
56
|
setCurrentCommandId(this.id ?? '');
|
|
@@ -278,6 +295,18 @@ function argsFromEnvironment(environment, options, noDefaultsResult) {
|
|
|
278
295
|
function commandSupportsFlag(flags, flagName) {
|
|
279
296
|
return Boolean(flags) && Object.prototype.hasOwnProperty.call(flags, flagName);
|
|
280
297
|
}
|
|
298
|
+
function appendJsonOutputSchema(description, outputSchema) {
|
|
299
|
+
if (!outputSchema)
|
|
300
|
+
return description;
|
|
301
|
+
const jsonOutputDescription = `Use \`--json-schema\` to print the result, error, and event schemas.
|
|
302
|
+
|
|
303
|
+
Output from \`--json\` conforms to the \`${outputSchema.name}\` schema.
|
|
304
|
+
|
|
305
|
+
\`\`\`json
|
|
306
|
+
${JSON.stringify(outputSchema.jsonSchema, null, 2)}
|
|
307
|
+
\`\`\``;
|
|
308
|
+
return [description, jsonOutputDescription].filter(Boolean).join('\n\n');
|
|
309
|
+
}
|
|
281
310
|
async function removeDuplicatedPlugins(config) {
|
|
282
311
|
const plugins = Array.from(config.plugins.values());
|
|
283
312
|
const bundlePlugins = ['@shopify/app', '@shopify/plugin-cloudflare'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-command.js","sourceRoot":"","sources":["../../../src/public/node/base-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAA;AACrC,OAAO,EAAC,aAAa,EAAE,YAAY,EAAE,WAAW,EAAC,MAAM,aAAa,CAAA;AACpE,OAAO,EAAC,sBAAsB,EAAC,MAAM,cAAc,CAAA;AACnD,OAAO,EAAC,yBAAyB,EAAC,MAAM,aAAa,CAAA;AACrD,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAA;AACtC,OAAO,EAAC,QAAQ,EAAC,MAAM,wBAAwB,CAAA;AAC/C,OAAO,EAAC,mBAAmB,EAAC,MAAM,qBAAqB,CAAA;AAEvD,OAAO,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAC,OAAO,EAAU,MAAM,EAAC,MAAM,aAAa,CAAA;AAqBnD,MAAe,WAAY,SAAQ,OAAO;IACxC,MAAM,CAAC,SAAS,GAAkB,EAAE,CAAA;IAE7B,MAAM,KAAK,qBAAqB;QACrC,OAAO,KAAK,CAAA;IACd,CAAC;IAEM,MAAM,CAAC,sBAAsB,CAAC,MAAkB;QACrD,OAAO,EAAE,CAAA;IACX,CAAC;IAED,gEAAgE;IACzD,MAAM,CAAC,0BAA0B;QACtC,8DAA8D;Q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AA;IACnD,MAAM,aAAa,GAAG,CAAC,cAAc,EAAE,4BAA4B,CAAC,CAAA;IACpE,MAAM,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA;IACvF,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/B,MAAM,aAAa,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,8BAA8B,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC7G,MAAM,EAAC,aAAa,EAAC,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,CAAA;QAC/C,aAAa,CAAC;YACZ,QAAQ,EAAE,iCAAiC,eAAe,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YACpG,IAAI,EAAE;gBACJ,iGAAiG;gBACjG,+BAA+B,aAAa,EAAE;aAC/C;SACF,CAAC,CAAA;IACJ,CAAC;IACD,MAAM,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA;IACxF,6GAA6G;IAC7G,MAAM,CAAC,OAAO,GAAG,IAAI,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAA;AAClF,CAAC;AAED,eAAe,WAAW,CAAA","sourcesContent":["import {isDevelopment} from './context/local.js'\nimport {addPublicMetadata} from './metadata.js'\nimport {AbortError} from './error.js'\nimport {outputContent, outputResult, outputToken} from './output.js'\nimport {setCurrentSessionAlias} from './session.js'\nimport {terminalSupportsPrompting} from './system.js'\nimport {hashString} from './crypto.js'\nimport {isTruthy} from './context/utilities.js'\nimport {setCurrentCommandId} from './global-context.js'\nimport {JsonMap} from '../../private/common/json.js'\nimport {underscore} from '../common/string.js'\nimport {Command, Config, Errors} from '@oclif/core'\nimport {OutputFlags, Input, ParserOutput, FlagInput, OutputArgs} from '@oclif/core/parser'\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ArgOutput = OutputArgs<any>\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type FlagOutput = OutputFlags<any>\n\nexport interface NonTTYFlagRequirement {\n /** At least one of these flags must be present when the requirement applies. */\n flags: string[]\n /** Determines whether the requirement applies to the parsed flags. */\n when?: (flags: FlagOutput) => boolean\n}\n\ninterface EnvironmentFlags {\n 'auth-alias'?: string\n environment?: string[]\n path?: string\n}\n\nabstract class BaseCommand extends Command {\n static baseFlags: FlagInput<{}> = {}\n\n public static get requiresSyncAnalytics(): boolean {\n return false\n }\n\n public static nonTTYFlagRequirements(_flags: FlagOutput): NonTTYFlagRequirement[] {\n return []\n }\n\n // Replace markdown links to plain text like: \"link label\" (url)\n public static descriptionWithoutMarkdown(): string | undefined {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return ((this as any).descriptionWithMarkdown ?? '').replace(/(\\[)(.*?)(])(\\()(.*?)(\\))/gm, '\"$2\" ($5)')\n }\n\n public static analyticsNameOverride(): string | undefined {\n return undefined\n }\n\n public static analyticsStopCommand(): string | undefined {\n return undefined\n }\n\n async catch(error: Error & {skipOclifErrorHandling: boolean}): Promise<void> {\n error.skipOclifErrorHandling = true\n const {errorHandler} = await import('./error-handler.js')\n await errorHandler(error, this.config)\n return Errors.handle(error)\n }\n\n protected async init(): Promise<unknown> {\n this.exitWithTimestampWhenEnvVariablePresent()\n setCurrentCommandId(this.id ?? '')\n if (!isDevelopment()) {\n // This function runs just prior to `run`\n const {registerCleanBugsnagErrorsFromWithinPlugins} = await import('./error-handler.js')\n await registerCleanBugsnagErrorsFromWithinPlugins(this.config)\n }\n await removeDuplicatedPlugins(this.config)\n this.showNpmFlagWarning()\n const {showNotificationsIfNeeded} = await import('./notifications-system.js')\n await showNotificationsIfNeeded()\n return super.init()\n }\n\n // NPM creates an environment variable for every flag passed to a script.\n // This function checks for the presence of any of the available CLI flags\n // and warns the user to use the `--` separator.\n protected showNpmFlagWarning(): void {\n const commandVariables = this.constructor as unknown as {flags: JsonMap}\n const commandFlags = Object.keys(commandVariables.flags || {})\n const possibleNpmEnvVars = commandFlags.map((key) => `npm_config_${underscore(key).replace(/^no_/, '')}`)\n\n if (possibleNpmEnvVars.some((flag) => process.env[flag] !== undefined)) {\n // eslint-disable-next-line no-void\n void import('./ui.js').then(({renderWarning}) => {\n renderWarning({\n body: [\n 'NPM scripts require an extra',\n {command: '--'},\n 'separator to pass the flags. Example:',\n {command: 'npm run dev -- --reset'},\n ],\n })\n })\n }\n }\n\n protected exitWithTimestampWhenEnvVariablePresent() {\n if (isTruthy(process.env.SHOPIFY_CLI_ENV_STARTUP_PERFORMANCE_RUN)) {\n outputResult(`\n SHOPIFY_CLI_TIMESTAMP_START\n { \"timestamp\": ${Date.now()} }\n SHOPIFY_CLI_TIMESTAMP_END\n `)\n process.exit(0)\n }\n }\n\n protected async parse<\n TFlags extends FlagOutput & {path?: string; verbose?: boolean; 'auth-alias'?: string},\n TGlobalFlags extends FlagOutput,\n TArgs extends ArgOutput,\n >(\n options?: Input<TFlags, TGlobalFlags, TArgs>,\n argv?: string[],\n ): Promise<ParserOutput<TFlags, TGlobalFlags, TArgs> & {argv: string[]}> {\n let result = await super.parse<TFlags, TGlobalFlags, TArgs>(options, argv)\n result = await this.resultWithEnvironment<TFlags, TGlobalFlags, TArgs>(result, options, argv)\n await setCurrentSessionAlias(result.flags['auth-alias'])\n await addFromParsedFlags(result.flags)\n this.failMissingNonTTYFlagRequirements(result.flags, this.applicableNonTTYFlagRequirements(result.flags))\n return {...result, ...{argv: result.argv as string[]}}\n }\n\n protected environmentsFilename(): string | undefined {\n // To be re-implemented if needed\n return undefined\n }\n\n protected failMissingNonTTYFlags(flags: FlagOutput, requiredFlags: string[]): void {\n this.failMissingNonTTYFlagRequirements(\n flags,\n requiredFlags.map((flag) => ({flags: [flag]})),\n )\n }\n\n private failMissingNonTTYFlagRequirements(flags: FlagOutput, requirements: NonTTYFlagRequirement[]): void {\n if (terminalSupportsPrompting()) return\n\n const missingRequirements = requirements.filter((requirement) =>\n requirement.flags.every((flag) => flags[flag] === undefined || flags[flag] === false),\n )\n if (missingRequirements.length === 0) return\n\n const heading = missingRequirements.length === 1 ? 'Flag not specified' : 'Flags not specified'\n const formattedRequirements = missingRequirements\n .map((requirement) => requirement.flags.map((flag) => `--${flag}`).join(' or '))\n .join('\\n')\n const explanation = missingRequirements.length === 1 ? 'This flag is required' : 'These flags are required'\n\n throw new AbortError(\n outputContent`${heading}:\n\n${outputToken.cyan(formattedRequirements)}\n\n${explanation} in non-interactive terminal environments, such as a CI environment, or when piping input from another process.`,\n 'To resolve this, specify the options in the command, or run the command in an interactive environment such as your local terminal.',\n )\n }\n\n private applicableNonTTYFlagRequirements(flags: FlagOutput): NonTTYFlagRequirement[] {\n const command = this.constructor as unknown as {\n flags?: FlagInput\n baseFlags?: FlagInput\n nonTTYFlagRequirements?: (flags: FlagOutput) => NonTTYFlagRequirement[]\n }\n const allFlags = {...command.baseFlags, ...command.flags}\n const requirementsFromFlags = Object.entries(allFlags)\n .filter(([, flag]) => Boolean((flag as {requiredIfNonInteractive?: boolean}).requiredIfNonInteractive))\n .map(([name]) => ({flags: [name]}))\n const commandRequirements = (command.nonTTYFlagRequirements?.(flags) ?? []).filter(\n (requirement) => requirement.when?.(flags) ?? true,\n )\n\n return [...requirementsFromFlags, ...commandRequirements]\n }\n\n private async resultWithEnvironment<\n TFlags extends FlagOutput & {path?: string; verbose?: boolean},\n TGlobalFlags extends FlagOutput,\n TArgs extends ArgOutput,\n >(\n originalResult: ParserOutput<TFlags, TGlobalFlags, TArgs>,\n options?: Input<TFlags, TGlobalFlags, TArgs>,\n argv?: string[],\n ): Promise<ParserOutput<TFlags, TGlobalFlags, TArgs>> {\n const flags = originalResult.flags as EnvironmentFlags\n const environmentsFileName = this.environmentsFilename()\n\n if (!environmentsFileName) return originalResult\n\n const {environmentFilePath} = await import('./environments.js')\n const environmentFileExists = await environmentFilePath(environmentsFileName, {from: flags.path})\n\n // Handle both string and array cases for environment flag\n let environments: string[] = []\n if (flags.environment) {\n environments = Array.isArray(flags.environment) ? flags.environment : [flags.environment]\n }\n\n const environmentSpecified = environments.length > 0\n\n // Noop if no environment file exists and none was specified\n if (!environmentFileExists && !environmentSpecified) return originalResult\n\n // Noop if multiple environments were specified (let commands handle this)\n if (environmentSpecified && environments.length > 1) return originalResult\n\n const {environment, isDefaultEnvironment} = await this.loadEnvironmentForCommand(\n flags.path,\n environmentsFileName,\n environments[0],\n )\n\n if (!environment) return originalResult\n if (isDefaultEnvironment && !commandSupportsFlag(options?.flags, 'environment')) return originalResult\n\n // Parse using noDefaultsOptions to derive a list of flags specified as\n // command-line arguments.\n const noDefaultsResult = await super.parse<TFlags, TGlobalFlags, TArgs>(noDefaultsOptions(options), argv)\n\n // Add the environment's settings to argv and pass them to `super.parse`. This\n // invokes oclif's validation system without breaking the oclif black box.\n // Replace the original result with this one.\n const result = await super.parse<TFlags, TGlobalFlags, TArgs>(options, [\n // Need to specify argv default because we're merging with argsFromEnvironment.\n ...(argv ?? this.argv),\n ...argsFromEnvironment<TFlags, TGlobalFlags, TArgs>(environment, options, noDefaultsResult),\n ...(isDefaultEnvironment ? ['--environment', 'default'] : []),\n ])\n\n // Report successful application of the environment.\n reportEnvironmentApplication<TFlags, TGlobalFlags, TArgs>(\n noDefaultsResult.flags,\n result.flags,\n isDefaultEnvironment ? 'default' : (environments[0] as string),\n environment,\n )\n\n return result\n }\n\n /**\n * Tries to load an environment to forward to the command. If no environment\n * is specified it will try to load a default environment.\n */\n private async loadEnvironmentForCommand(\n path: string | undefined,\n environmentsFileName: string,\n specifiedEnvironment: string | undefined,\n ): Promise<{environment: JsonMap | undefined; isDefaultEnvironment: boolean}> {\n const {loadEnvironment} = await import('./environments.js')\n if (specifiedEnvironment) {\n const environment = await loadEnvironment(specifiedEnvironment, environmentsFileName, {from: path})\n return {environment, isDefaultEnvironment: false}\n }\n\n const environment = await loadEnvironment('default', environmentsFileName, {from: path, silent: true})\n return {environment, isDefaultEnvironment: true}\n }\n}\n\nexport async function addFromParsedFlags(flags: {path?: string; verbose?: boolean}): Promise<void> {\n await addPublicMetadata(() => ({\n cmd_all_verbose: flags.verbose,\n cmd_all_path_override: flags.path !== undefined,\n cmd_all_path_override_hash: flags.path === undefined ? undefined : hashString(flags.path),\n }))\n}\n\n/**\n * Any flag which is:\n *\n * 1. Present in the final set of flags\n * 2. Specified in the environment\n * 3. Not specified by the user as a command line argument\n *\n * should be reported.\n *\n * It doesn't matter if the environment flag's value was the same as the default; from\n * the user's perspective, they want to know their environment was applied.\n */\nfunction reportEnvironmentApplication<\n TFlags extends FlagOutput,\n TGlobalFlags extends FlagOutput,\n TArgs extends ArgOutput,\n>(\n noDefaultsFlags: ParserOutput<TFlags, TGlobalFlags, TArgs>['flags'],\n flagsWithEnvironments: ParserOutput<TFlags, TGlobalFlags, TArgs>['flags'],\n environmentName: string,\n environment: JsonMap,\n): void {\n const changes: JsonMap = {}\n for (const [name, value] of Object.entries(flagsWithEnvironments)) {\n const userSpecifiedThisFlag = Object.prototype.hasOwnProperty.call(noDefaultsFlags, name)\n const environmentContainsFlag = Object.prototype.hasOwnProperty.call(environment, name)\n if (!userSpecifiedThisFlag && environmentContainsFlag) {\n const valueToReport = name === 'password' ? `********${value.substr(-4)}` : value\n changes[name] = valueToReport\n }\n }\n if (Object.keys(changes).length === 0) return\n\n const items = Object.entries(changes).map(([name, value]) => `${name}: ${value}`)\n // eslint-disable-next-line no-void\n void import('./ui.js').then(({renderInfo}) => {\n renderInfo({\n headline: ['Using applicable flags from', {userInput: environmentName}, 'environment:'],\n body: [{list: {items}}],\n })\n })\n}\n\n/**\n * Strips the defaults from configured flags. For example, if flags contains:\n *\n * ```\n * someFlag: Flags.boolean({\n * description: 'some flag',\n * default: false\n * })\n * ```\n *\n * it becomes:\n *\n * ```\n * someFlag: Flags.boolean({\n * description: 'some flag'\n * })\n * ```\n *\n * If we parse using this configuration, the only specified flags will be those\n * the user actually passed on the command line.\n */\nexport function noDefaultsOptions<TFlags extends FlagOutput, TGlobalFlags extends FlagOutput, TArgs extends ArgOutput>(\n options: Input<TFlags, TGlobalFlags, TArgs> | undefined,\n): Input<TFlags, TGlobalFlags, TArgs> | undefined {\n if (!options?.flags) return options\n return {\n ...options,\n flags: Object.fromEntries(\n Object.entries(options.flags).map(([label, settings]) => {\n const copiedSettings = {...(settings as {default?: unknown})}\n delete copiedSettings.default\n return [label, copiedSettings]\n }),\n ) as FlagInput<TFlags>,\n }\n}\n\n/**\n * Converts the environment's settings to arguments as though passed on the command\n * line, skipping any arguments the user specified on the command line.\n */\nfunction argsFromEnvironment<TFlags extends FlagOutput, TGlobalFlags extends FlagOutput, TArgs extends ArgOutput>(\n environment: JsonMap,\n options: Input<TFlags, TGlobalFlags, TArgs> | undefined,\n noDefaultsResult: ParserOutput<TFlags, TArgs>,\n): string[] {\n const args: string[] = []\n for (const [label, value] of Object.entries(environment)) {\n const flagIsRelevantToCommand = commandSupportsFlag(options?.flags, label)\n const userSpecifiedThisFlag =\n noDefaultsResult.flags && Object.prototype.hasOwnProperty.call(noDefaultsResult.flags, label)\n if (flagIsRelevantToCommand && !userSpecifiedThisFlag) {\n if (typeof value === 'boolean') {\n if (value) {\n args.push(`--${label}`)\n } else {\n throw new AbortError(\n outputContent`Environments can only specify true for boolean flags. Attempted to set ${outputToken.yellow(\n label,\n )} to false.`,\n )\n }\n } else if (Array.isArray(value)) {\n value.forEach((element) => args.push(`--${label}`, `${element}`))\n } else {\n args.push(`--${label}`, `${value}`)\n }\n }\n }\n return args\n}\n\nfunction commandSupportsFlag(flags: FlagInput | undefined, flagName: string): boolean {\n return Boolean(flags) && Object.prototype.hasOwnProperty.call(flags, flagName)\n}\n\nasync function removeDuplicatedPlugins(config: Config): Promise<void> {\n const plugins = Array.from(config.plugins.values())\n const bundlePlugins = ['@shopify/app', '@shopify/plugin-cloudflare']\n const pluginsToRemove = plugins.filter((plugin) => bundlePlugins.includes(plugin.name))\n if (pluginsToRemove.length > 0) {\n const commandsToRun = pluginsToRemove.map((plugin) => ` - shopify plugins remove ${plugin.name}`).join('\\n')\n const {renderWarning} = await import('./ui.js')\n renderWarning({\n headline: `Unsupported plugins detected: ${pluginsToRemove.map((plugin) => plugin.name).join(', ')}`,\n body: [\n 'They are already included in the CLI and installing them as custom plugins can cause conflicts.',\n `You can fix it by running:\\n${commandsToRun}`,\n ],\n })\n }\n const filteredPlugins = plugins.filter((plugin) => !bundlePlugins.includes(plugin.name))\n // eslint-disable-next-line require-atomic-updates -- config.plugins won't be modified by renderWarning above\n config.plugins = new Map(filteredPlugins.map((plugin) => [plugin.name, plugin]))\n}\n\nexport default BaseCommand\n"]}
|
|
1
|
+
{"version":3,"file":"base-command.js","sourceRoot":"","sources":["../../../src/public/node/base-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAA;AACrC,OAAO,EAAC,8BAA8B,EAAC,MAAM,qBAAqB,CAAA;AAClE,OAAO,EAAC,aAAa,EAAE,YAAY,EAAE,WAAW,EAAC,MAAM,aAAa,CAAA;AACpE,OAAO,EAAC,sBAAsB,EAAC,MAAM,cAAc,CAAA;AACnD,OAAO,EAAC,yBAAyB,EAAC,MAAM,aAAa,CAAA;AACrD,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAA;AACtC,OAAO,EAAC,QAAQ,EAAC,MAAM,wBAAw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\nimport {addPublicMetadata} from './metadata.js'\nimport {AbortError} from './error.js'\nimport {runWithCommandEventsForCommand} from './command-events.js'\nimport {outputContent, outputResult, outputToken} from './output.js'\nimport {setCurrentSessionAlias} from './session.js'\nimport {terminalSupportsPrompting} from './system.js'\nimport {hashString} from './crypto.js'\nimport {isTruthy} from './context/utilities.js'\nimport {setCurrentCommandId} from './global-context.js'\nimport {type JsonOutputSchema} from './json-output-schema.js'\nimport {JsonMap} from '../../private/common/json.js'\nimport {underscore} from '../common/string.js'\nimport {Command, Config, Errors, Flags} from '@oclif/core'\nimport {OutputFlags, Input, ParserOutput, FlagInput, OutputArgs} from '@oclif/core/parser'\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ArgOutput = OutputArgs<any>\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type FlagOutput = OutputFlags<any>\n\nexport interface NonTTYFlagRequirement {\n /** At least one of these flags must be present when the requirement applies. */\n flags: string[]\n /** Determines whether the requirement applies to the parsed flags. */\n when?: (flags: FlagOutput) => boolean\n}\n\ninterface EnvironmentFlags {\n 'auth-alias'?: string\n environment?: string[]\n path?: string\n}\n\nabstract class BaseCommand extends Command {\n static baseFlags: FlagInput<{}> = {\n 'json-schema': Flags.boolean({\n description: \"Print the command's JSON schemas.\",\n env: 'SHOPIFY_FLAG_JSON_SCHEMA',\n }),\n }\n\n static descriptionWithMarkdown?: string\n\n public static get jsonOutputSchema(): JsonOutputSchema | undefined {\n return undefined\n }\n\n public static get requiresSyncAnalytics(): boolean {\n return false\n }\n\n public static nonTTYFlagRequirements(_flags: FlagOutput): NonTTYFlagRequirement[] {\n return []\n }\n\n // Include the JSON result schema and convert Markdown links to plain text for command help.\n public static descriptionForHelp(): string | undefined {\n const description = (this.descriptionWithMarkdown ?? '').replace(/(\\[)(.*?)(])(\\()(.*?)(\\))/gm, '\"$2\" ($5)')\n return appendJsonOutputSchema(description, this.jsonOutputSchema)\n }\n\n /** @deprecated Use descriptionForHelp instead. */\n public static descriptionWithoutMarkdown(): string | undefined {\n return this.descriptionForHelp()\n }\n\n public static analyticsNameOverride(): string | undefined {\n return undefined\n }\n\n public static analyticsStopCommand(): string | undefined {\n return undefined\n }\n\n async catch(error: Error & {skipOclifErrorHandling: boolean}): Promise<void> {\n error.skipOclifErrorHandling = true\n const {errorHandler} = await import('./error-handler.js')\n await errorHandler(error, this.config)\n return Errors.handle(error)\n }\n\n protected async _run<T>(): Promise<T> {\n return runWithCommandEventsForCommand(this.argv, () => super._run<T>())\n }\n\n protected async init(): Promise<unknown> {\n this.exitWithTimestampWhenEnvVariablePresent()\n setCurrentCommandId(this.id ?? '')\n if (!isDevelopment()) {\n // This function runs just prior to `run`\n const {registerCleanBugsnagErrorsFromWithinPlugins} = await import('./error-handler.js')\n await registerCleanBugsnagErrorsFromWithinPlugins(this.config)\n }\n await removeDuplicatedPlugins(this.config)\n this.showNpmFlagWarning()\n const {showNotificationsIfNeeded} = await import('./notifications-system.js')\n await showNotificationsIfNeeded()\n return super.init()\n }\n\n // NPM creates an environment variable for every flag passed to a script.\n // This function checks for the presence of any of the available CLI flags\n // and warns the user to use the `--` separator.\n protected showNpmFlagWarning(): void {\n const commandVariables = this.constructor as unknown as {flags: JsonMap}\n const commandFlags = Object.keys(commandVariables.flags || {})\n const possibleNpmEnvVars = commandFlags.map((key) => `npm_config_${underscore(key).replace(/^no_/, '')}`)\n\n if (possibleNpmEnvVars.some((flag) => process.env[flag] !== undefined)) {\n // eslint-disable-next-line no-void\n void import('./ui.js').then(({renderWarning}) => {\n renderWarning({\n body: [\n 'NPM scripts require an extra',\n {command: '--'},\n 'separator to pass the flags. Example:',\n {command: 'npm run dev -- --reset'},\n ],\n })\n })\n }\n }\n\n protected exitWithTimestampWhenEnvVariablePresent() {\n if (isTruthy(process.env.SHOPIFY_CLI_ENV_STARTUP_PERFORMANCE_RUN)) {\n outputResult(`\n SHOPIFY_CLI_TIMESTAMP_START\n { \"timestamp\": ${Date.now()} }\n SHOPIFY_CLI_TIMESTAMP_END\n `)\n process.exit(0)\n }\n }\n\n protected async parse<\n TFlags extends FlagOutput & {path?: string; verbose?: boolean; 'auth-alias'?: string},\n TGlobalFlags extends FlagOutput,\n TArgs extends ArgOutput,\n >(\n options?: Input<TFlags, TGlobalFlags, TArgs>,\n argv?: string[],\n ): Promise<ParserOutput<TFlags, TGlobalFlags, TArgs> & {argv: string[]}> {\n let result = await super.parse<TFlags, TGlobalFlags, TArgs>(options, argv)\n result = await this.resultWithEnvironment<TFlags, TGlobalFlags, TArgs>(result, options, argv)\n await setCurrentSessionAlias(result.flags['auth-alias'])\n await addFromParsedFlags(result.flags)\n this.failMissingNonTTYFlagRequirements(result.flags, this.applicableNonTTYFlagRequirements(result.flags))\n return {...result, ...{argv: result.argv as string[]}}\n }\n\n protected environmentsFilename(): string | undefined {\n // To be re-implemented if needed\n return undefined\n }\n\n protected failMissingNonTTYFlags(flags: FlagOutput, requiredFlags: string[]): void {\n this.failMissingNonTTYFlagRequirements(\n flags,\n requiredFlags.map((flag) => ({flags: [flag]})),\n )\n }\n\n private failMissingNonTTYFlagRequirements(flags: FlagOutput, requirements: NonTTYFlagRequirement[]): void {\n if (terminalSupportsPrompting()) return\n\n const missingRequirements = requirements.filter((requirement) =>\n requirement.flags.every((flag) => flags[flag] === undefined || flags[flag] === false),\n )\n if (missingRequirements.length === 0) return\n\n const heading = missingRequirements.length === 1 ? 'Flag not specified' : 'Flags not specified'\n const formattedRequirements = missingRequirements\n .map((requirement) => requirement.flags.map((flag) => `--${flag}`).join(' or '))\n .join('\\n')\n const explanation = missingRequirements.length === 1 ? 'This flag is required' : 'These flags are required'\n\n throw new AbortError(\n outputContent`${heading}:\n\n${outputToken.cyan(formattedRequirements)}\n\n${explanation} in non-interactive terminal environments, such as a CI environment, or when piping input from another process.`,\n 'To resolve this, specify the options in the command, or run the command in an interactive environment such as your local terminal.',\n )\n }\n\n private applicableNonTTYFlagRequirements(flags: FlagOutput): NonTTYFlagRequirement[] {\n const command = this.constructor as unknown as {\n flags?: FlagInput\n baseFlags?: FlagInput\n nonTTYFlagRequirements?: (flags: FlagOutput) => NonTTYFlagRequirement[]\n }\n const allFlags = {...command.baseFlags, ...command.flags}\n const requirementsFromFlags = Object.entries(allFlags)\n .filter(([, flag]) => Boolean((flag as {requiredIfNonInteractive?: boolean}).requiredIfNonInteractive))\n .map(([name]) => ({flags: [name]}))\n const commandRequirements = (command.nonTTYFlagRequirements?.(flags) ?? []).filter(\n (requirement) => requirement.when?.(flags) ?? true,\n )\n\n return [...requirementsFromFlags, ...commandRequirements]\n }\n\n private async resultWithEnvironment<\n TFlags extends FlagOutput & {path?: string; verbose?: boolean},\n TGlobalFlags extends FlagOutput,\n TArgs extends ArgOutput,\n >(\n originalResult: ParserOutput<TFlags, TGlobalFlags, TArgs>,\n options?: Input<TFlags, TGlobalFlags, TArgs>,\n argv?: string[],\n ): Promise<ParserOutput<TFlags, TGlobalFlags, TArgs>> {\n const flags = originalResult.flags as EnvironmentFlags\n const environmentsFileName = this.environmentsFilename()\n\n if (!environmentsFileName) return originalResult\n\n const {environmentFilePath} = await import('./environments.js')\n const environmentFileExists = await environmentFilePath(environmentsFileName, {from: flags.path})\n\n // Handle both string and array cases for environment flag\n let environments: string[] = []\n if (flags.environment) {\n environments = Array.isArray(flags.environment) ? flags.environment : [flags.environment]\n }\n\n const environmentSpecified = environments.length > 0\n\n // Noop if no environment file exists and none was specified\n if (!environmentFileExists && !environmentSpecified) return originalResult\n\n // Noop if multiple environments were specified (let commands handle this)\n if (environmentSpecified && environments.length > 1) return originalResult\n\n const {environment, isDefaultEnvironment} = await this.loadEnvironmentForCommand(\n flags.path,\n environmentsFileName,\n environments[0],\n )\n\n if (!environment) return originalResult\n if (isDefaultEnvironment && !commandSupportsFlag(options?.flags, 'environment')) return originalResult\n\n // Parse using noDefaultsOptions to derive a list of flags specified as\n // command-line arguments.\n const noDefaultsResult = await super.parse<TFlags, TGlobalFlags, TArgs>(noDefaultsOptions(options), argv)\n\n // Add the environment's settings to argv and pass them to `super.parse`. This\n // invokes oclif's validation system without breaking the oclif black box.\n // Replace the original result with this one.\n const result = await super.parse<TFlags, TGlobalFlags, TArgs>(options, [\n // Need to specify argv default because we're merging with argsFromEnvironment.\n ...(argv ?? this.argv),\n ...argsFromEnvironment<TFlags, TGlobalFlags, TArgs>(environment, options, noDefaultsResult),\n ...(isDefaultEnvironment ? ['--environment', 'default'] : []),\n ])\n\n // Report successful application of the environment.\n reportEnvironmentApplication<TFlags, TGlobalFlags, TArgs>(\n noDefaultsResult.flags,\n result.flags,\n isDefaultEnvironment ? 'default' : (environments[0] as string),\n environment,\n )\n\n return result\n }\n\n /**\n * Tries to load an environment to forward to the command. If no environment\n * is specified it will try to load a default environment.\n */\n private async loadEnvironmentForCommand(\n path: string | undefined,\n environmentsFileName: string,\n specifiedEnvironment: string | undefined,\n ): Promise<{environment: JsonMap | undefined; isDefaultEnvironment: boolean}> {\n const {loadEnvironment} = await import('./environments.js')\n if (specifiedEnvironment) {\n const environment = await loadEnvironment(specifiedEnvironment, environmentsFileName, {from: path})\n return {environment, isDefaultEnvironment: false}\n }\n\n const environment = await loadEnvironment('default', environmentsFileName, {from: path, silent: true})\n return {environment, isDefaultEnvironment: true}\n }\n}\n\nexport async function addFromParsedFlags(flags: {path?: string; verbose?: boolean}): Promise<void> {\n await addPublicMetadata(() => ({\n cmd_all_verbose: flags.verbose,\n cmd_all_path_override: flags.path !== undefined,\n cmd_all_path_override_hash: flags.path === undefined ? undefined : hashString(flags.path),\n }))\n}\n\n/**\n * Any flag which is:\n *\n * 1. Present in the final set of flags\n * 2. Specified in the environment\n * 3. Not specified by the user as a command line argument\n *\n * should be reported.\n *\n * It doesn't matter if the environment flag's value was the same as the default; from\n * the user's perspective, they want to know their environment was applied.\n */\nfunction reportEnvironmentApplication<\n TFlags extends FlagOutput,\n TGlobalFlags extends FlagOutput,\n TArgs extends ArgOutput,\n>(\n noDefaultsFlags: ParserOutput<TFlags, TGlobalFlags, TArgs>['flags'],\n flagsWithEnvironments: ParserOutput<TFlags, TGlobalFlags, TArgs>['flags'],\n environmentName: string,\n environment: JsonMap,\n): void {\n const changes: JsonMap = {}\n for (const [name, value] of Object.entries(flagsWithEnvironments)) {\n const userSpecifiedThisFlag = Object.prototype.hasOwnProperty.call(noDefaultsFlags, name)\n const environmentContainsFlag = Object.prototype.hasOwnProperty.call(environment, name)\n if (!userSpecifiedThisFlag && environmentContainsFlag) {\n const valueToReport = name === 'password' ? `********${value.substr(-4)}` : value\n changes[name] = valueToReport\n }\n }\n if (Object.keys(changes).length === 0) return\n\n const items = Object.entries(changes).map(([name, value]) => `${name}: ${value}`)\n // eslint-disable-next-line no-void\n void import('./ui.js').then(({renderInfo}) => {\n renderInfo({\n headline: ['Using applicable flags from', {userInput: environmentName}, 'environment:'],\n body: [{list: {items}}],\n })\n })\n}\n\n/**\n * Strips the defaults from configured flags. For example, if flags contains:\n *\n * ```\n * someFlag: Flags.boolean({\n * description: 'some flag',\n * default: false\n * })\n * ```\n *\n * it becomes:\n *\n * ```\n * someFlag: Flags.boolean({\n * description: 'some flag'\n * })\n * ```\n *\n * If we parse using this configuration, the only specified flags will be those\n * the user actually passed on the command line.\n */\nexport function noDefaultsOptions<TFlags extends FlagOutput, TGlobalFlags extends FlagOutput, TArgs extends ArgOutput>(\n options: Input<TFlags, TGlobalFlags, TArgs> | undefined,\n): Input<TFlags, TGlobalFlags, TArgs> | undefined {\n if (!options?.flags) return options\n return {\n ...options,\n flags: Object.fromEntries(\n Object.entries(options.flags).map(([label, settings]) => {\n const copiedSettings = {...(settings as {default?: unknown})}\n delete copiedSettings.default\n return [label, copiedSettings]\n }),\n ) as FlagInput<TFlags>,\n }\n}\n\n/**\n * Converts the environment's settings to arguments as though passed on the command\n * line, skipping any arguments the user specified on the command line.\n */\nfunction argsFromEnvironment<TFlags extends FlagOutput, TGlobalFlags extends FlagOutput, TArgs extends ArgOutput>(\n environment: JsonMap,\n options: Input<TFlags, TGlobalFlags, TArgs> | undefined,\n noDefaultsResult: ParserOutput<TFlags, TArgs>,\n): string[] {\n const args: string[] = []\n for (const [label, value] of Object.entries(environment)) {\n const flagIsRelevantToCommand = commandSupportsFlag(options?.flags, label)\n const userSpecifiedThisFlag =\n noDefaultsResult.flags && Object.prototype.hasOwnProperty.call(noDefaultsResult.flags, label)\n if (flagIsRelevantToCommand && !userSpecifiedThisFlag) {\n if (typeof value === 'boolean') {\n if (value) {\n args.push(`--${label}`)\n } else {\n throw new AbortError(\n outputContent`Environments can only specify true for boolean flags. Attempted to set ${outputToken.yellow(\n label,\n )} to false.`,\n )\n }\n } else if (Array.isArray(value)) {\n value.forEach((element) => args.push(`--${label}`, `${element}`))\n } else {\n args.push(`--${label}`, `${value}`)\n }\n }\n }\n return args\n}\n\nfunction commandSupportsFlag(flags: FlagInput | undefined, flagName: string): boolean {\n return Boolean(flags) && Object.prototype.hasOwnProperty.call(flags, flagName)\n}\n\nfunction appendJsonOutputSchema(description: string, outputSchema: JsonOutputSchema | undefined): string {\n if (!outputSchema) return description\n\n const jsonOutputDescription = `Use \\`--json-schema\\` to print the result, error, and event schemas.\n\nOutput from \\`--json\\` conforms to the \\`${outputSchema.name}\\` schema.\n\n\\`\\`\\`json\n${JSON.stringify(outputSchema.jsonSchema, null, 2)}\n\\`\\`\\``\n\n return [description, jsonOutputDescription].filter(Boolean).join('\\n\\n')\n}\n\nasync function removeDuplicatedPlugins(config: Config): Promise<void> {\n const plugins = Array.from(config.plugins.values())\n const bundlePlugins = ['@shopify/app', '@shopify/plugin-cloudflare']\n const pluginsToRemove = plugins.filter((plugin) => bundlePlugins.includes(plugin.name))\n if (pluginsToRemove.length > 0) {\n const commandsToRun = pluginsToRemove.map((plugin) => ` - shopify plugins remove ${plugin.name}`).join('\\n')\n const {renderWarning} = await import('./ui.js')\n renderWarning({\n headline: `Unsupported plugins detected: ${pluginsToRemove.map((plugin) => plugin.name).join(', ')}`,\n body: [\n 'They are already included in the CLI and installing them as custom plugins can cause conflicts.',\n `You can fix it by running:\\n${commandsToRun}`,\n ],\n })\n }\n const filteredPlugins = plugins.filter((plugin) => !bundlePlugins.includes(plugin.name))\n // eslint-disable-next-line require-atomic-updates -- config.plugins won't be modified by renderWarning above\n config.plugins = new Map(filteredPlugins.map((plugin) => [plugin.name, plugin]))\n}\n\nexport default BaseCommand\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isTruthy } from './context/utilities.js';
|
|
1
2
|
import { fileURLToPath } from 'node:url';
|
|
2
3
|
/**
|
|
3
4
|
* Launches the CLI.
|
|
@@ -20,14 +21,31 @@ export async function launchCLI(options) {
|
|
|
20
21
|
if (options.lazyCommandLoader) {
|
|
21
22
|
config.setLazyCommandLoader(options.lazyCommandLoader);
|
|
22
23
|
}
|
|
23
|
-
|
|
24
|
+
const argv = options.argv ?? process.argv.slice(2);
|
|
25
|
+
const passthroughIndex = argv.indexOf('--');
|
|
26
|
+
const commandArguments = passthroughIndex === -1 ? argv : argv.slice(0, passthroughIndex);
|
|
27
|
+
if (commandArguments.includes('--json-schema') || isTruthy(process.env.SHOPIFY_FLAG_JSON_SCHEMA)) {
|
|
28
|
+
// Inspect the command before Oclif runs init or prerun hooks, which may require a project or start background work.
|
|
29
|
+
const { printCommandJsonSchema } = await import('../../private/node/command-json-schema.js');
|
|
30
|
+
await printCommandJsonSchema(config, argv, options.lazyCommandLoader);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
await run(argv, config);
|
|
24
34
|
await flush();
|
|
25
35
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
|
26
36
|
}
|
|
27
37
|
catch (error) {
|
|
28
38
|
const { errorHandler } = await import('./error-handler.js');
|
|
29
39
|
await errorHandler(error);
|
|
30
|
-
|
|
40
|
+
const handledError = error;
|
|
41
|
+
// Suppress duplicate output without mutating the thrown value, which may be frozen or null.
|
|
42
|
+
return Errors.handle({
|
|
43
|
+
...handledError,
|
|
44
|
+
name: handledError?.name ?? 'Error',
|
|
45
|
+
message: handledError?.message ?? String(error),
|
|
46
|
+
stack: handledError?.stack,
|
|
47
|
+
skipOclifErrorHandling: true,
|
|
48
|
+
});
|
|
31
49
|
}
|
|
32
50
|
}
|
|
33
51
|
//# sourceMappingURL=cli-launcher.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-launcher.js","sourceRoot":"","sources":["../../../src/public/node/cli-launcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAA;AAStC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAgB;IAC9C,MAAM,EAAC,aAAa,EAAC,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAA;IAC1D,MAAM,EAAC,aAAa,EAAC,GAAG,MAAM,MAAM,CAAC,0BAA0B,CAAC,CAAA;IAEhE,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAA;IAC/C,4FAA4F;IAC5F,MAAM,EAAC,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAC,GACjC,WAAiD,CAAC,OAAO,IAAI,WAAW,CAAA;IAE3E,IAAI,aAAa,EAAE,EAAE,CAAC;QACpB,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAA;IACvB,CAAC;IAED,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,EAAC,IAAI,EAAE,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,EAAC,CAAC,CAAA;QAC1E,MAAM,MAAM,CAAC,IAAI,EAAE,CAAA;QAEnB,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;YAC9B,MAAM,CAAC,oBAAoB,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAA;QACxD,CAAC;QAED,MAAM,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"cli-launcher.js","sourceRoot":"","sources":["../../../src/public/node/cli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AAC,CAAA;QACzF,IAAI,gBAAgB,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,EAAE,CAAC;YACjG,oHAAoH;YACpH,MAAM,EAAC,sBAAsB,EAAC,GAAG,MAAM,MAAM,CAAC,2CAA2C,CAAC,CAAA;YAC1F,MAAM,sBAAsB,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAA;YACrE,OAAM;QACR,CAAC;QAED,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;QACvB,MAAM,KAAK,EAAE,CAAA;QACb,qDAAqD;IACvD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,EAAC,YAAY,EAAC,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAA;QACzD,MAAM,YAAY,CAAC,KAAc,CAAC,CAAA;QAClC,MAAM,YAAY,GAAG,KAAiC,CAAA;QACtD,4FAA4F;QAC5F,OAAO,MAAM,CAAC,MAAM,CAAC;YACnB,GAAG,YAAY;YACf,IAAI,EAAE,YAAY,EAAE,IAAI,IAAI,OAAO;YACnC,OAAO,EAAE,YAAY,EAAE,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC;YAC/C,KAAK,EAAE,YAAY,EAAE,KAAK;YAC1B,sBAAsB,EAAE,IAAI;SAC7B,CAAC,CAAA;IACJ,CAAC;AACH,CAAC","sourcesContent":["import {isTruthy} from './context/utilities.js'\nimport {fileURLToPath} from 'node:url'\nimport type {LazyCommandLoader} from './custom-oclif-loader.js'\n\ninterface Options {\n moduleURL: string\n argv?: string[]\n lazyCommandLoader?: LazyCommandLoader\n}\n\n/**\n * Launches the CLI.\n *\n * @param options - Options.\n * @returns A promise that resolves when the CLI has been launched.\n */\nexport async function launchCLI(options: Options): Promise<void> {\n const {isDevelopment} = await import('./context/local.js')\n const {ShopifyConfig} = await import('./custom-oclif-loader.js')\n type OclifCore = typeof import('@oclif/core')\n const oclifModule = await import('@oclif/core')\n // esbuild wraps CJS dynamic imports under .default when bundling as ESM with code splitting\n const {run, flush, Errors, settings}: OclifCore =\n (oclifModule as OclifCore & {default?: OclifCore}).default ?? oclifModule\n\n if (isDevelopment()) {\n settings.debug = true\n }\n\n try {\n const config = new ShopifyConfig({root: fileURLToPath(options.moduleURL)})\n await config.load()\n\n if (options.lazyCommandLoader) {\n config.setLazyCommandLoader(options.lazyCommandLoader)\n }\n\n const argv = options.argv ?? process.argv.slice(2)\n const passthroughIndex = argv.indexOf('--')\n const commandArguments = passthroughIndex === -1 ? argv : argv.slice(0, passthroughIndex)\n if (commandArguments.includes('--json-schema') || isTruthy(process.env.SHOPIFY_FLAG_JSON_SCHEMA)) {\n // Inspect the command before Oclif runs init or prerun hooks, which may require a project or start background work.\n const {printCommandJsonSchema} = await import('../../private/node/command-json-schema.js')\n await printCommandJsonSchema(config, argv, options.lazyCommandLoader)\n return\n }\n\n await run(argv, config)\n await flush()\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch (error) {\n const {errorHandler} = await import('./error-handler.js')\n await errorHandler(error as Error)\n const handledError = error as Error | null | undefined\n // Suppress duplicate output without mutating the thrown value, which may be frozen or null.\n return Errors.handle({\n ...handledError,\n name: handledError?.name ?? 'Error',\n message: handledError?.message ?? String(error),\n stack: handledError?.stack,\n skipOclifErrorHandling: true,\n })\n }\n}\n"]}
|
|
@@ -35,6 +35,7 @@ export declare function runCreateCLI(options: RunCLIOptions, launchCLI?: (option
|
|
|
35
35
|
export declare const globalFlags: {
|
|
36
36
|
'no-color': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
37
37
|
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
38
|
+
'no-input': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
38
39
|
};
|
|
39
40
|
export declare const jsonFlag: {
|
|
40
41
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
package/dist/public/node/cli.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isTruthy } from './context/utilities.js';
|
|
2
|
+
import { noInputFlag } from './no-input.js';
|
|
2
3
|
import { launchCLI as defaultLaunchCli } from './cli-launcher.js';
|
|
3
4
|
import { environmentVariables } from '../../private/node/constants.js';
|
|
4
5
|
import { Flags } from '@oclif/core';
|
|
@@ -87,6 +88,7 @@ export async function runCreateCLI(options, launchCLI = defaultLaunchCli, argv =
|
|
|
87
88
|
* are shared across all the commands.
|
|
88
89
|
*/
|
|
89
90
|
export const globalFlags = {
|
|
91
|
+
...noInputFlag,
|
|
90
92
|
'no-color': Flags.boolean({
|
|
91
93
|
hidden: false,
|
|
92
94
|
description: 'Disable color output.',
|