shopify 3.93.0 → 3.93.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-SBSUITP6.js → chunk-PB3UDYWH.js} +1 -1
- package/dist/{chunk-MYTB32VB.js → chunk-SVYSLNQH.js} +1 -1
- package/dist/{chunk-O6CC6JKI.js → chunk-T57REQVZ.js} +1 -1
- package/dist/{chunk-U7JC7ESX.js → chunk-TCRHJ3ZH.js} +2 -2
- package/dist/{chunk-POO2TAEO.js → chunk-VLDSGLBP.js} +1 -1
- package/dist/{chunk-DLK7L2KZ.js → chunk-WOERFYNW.js} +2 -2
- package/dist/cli/commands/store/auth.d.ts +1 -0
- package/dist/cli/commands/store/auth.js +10 -3
- package/dist/cli/commands/store/execute.d.ts +1 -0
- package/dist/cli/commands/store/execute.js +7 -4
- package/dist/cli/services/store/auth/callback.d.ts +8 -0
- package/dist/cli/services/store/auth/callback.js +140 -0
- package/dist/cli/services/store/{auth-config.js → auth/config.js} +1 -1
- package/dist/cli/services/store/auth/existing-scopes.d.ts +5 -0
- package/dist/cli/services/store/auth/existing-scopes.js +40 -0
- package/dist/cli/services/store/auth/index.d.ts +18 -0
- package/dist/cli/services/store/auth/index.js +88 -0
- package/dist/cli/services/store/auth/pkce.d.ts +36 -0
- package/dist/cli/services/store/auth/pkce.js +49 -0
- package/dist/cli/services/store/{auth-recovery.js → auth/recovery.js} +1 -1
- package/dist/cli/services/store/auth/result.d.ts +24 -0
- package/dist/cli/services/store/auth/result.js +39 -0
- package/dist/cli/services/store/auth/scopes.d.ts +4 -0
- package/dist/cli/services/store/auth/scopes.js +53 -0
- package/dist/cli/services/store/auth/session-lifecycle.d.ts +3 -0
- package/dist/cli/services/store/auth/session-lifecycle.js +69 -0
- package/dist/cli/services/store/{session.d.ts → auth/session-store.d.ts} +1 -2
- package/dist/cli/services/store/auth/session-store.js +127 -0
- package/dist/cli/services/store/auth/token-client.d.ts +40 -0
- package/dist/cli/services/store/auth/token-client.js +95 -0
- package/dist/cli/services/store/{admin-graphql-context.d.ts → execute/admin-context.d.ts} +3 -2
- package/dist/cli/services/store/execute/admin-context.js +41 -0
- package/dist/cli/services/store/execute/admin-transport.d.ts +6 -0
- package/dist/cli/services/store/{admin-graphql-transport.js → execute/admin-transport.js} +7 -7
- package/dist/cli/services/store/{execute.d.ts → execute/index.d.ts} +2 -3
- package/dist/cli/services/store/{execute.js → execute/index.js} +4 -11
- package/dist/cli/services/store/{execute-request.d.ts → execute/request.d.ts} +0 -2
- package/dist/cli/services/store/{execute-request.js → execute/request.js} +1 -2
- package/dist/cli/services/store/execute/result.d.ts +3 -0
- package/dist/cli/services/store/execute/result.js +29 -0
- package/dist/cli/services/store/{graphql-targets.d.ts → execute/targets.d.ts} +2 -3
- package/dist/cli/services/store/{graphql-targets.js → execute/targets.js} +5 -11
- package/dist/{error-handler-IRR4EZPS.js → error-handler-54XVSWV5.js} +1 -1
- package/dist/hooks/postrun.js +1 -1
- package/dist/hooks/prerun.js +1 -1
- package/dist/index.js +867 -859
- package/dist/{local-PQUMWHWR.js → local-JCUIPKND.js} +1 -1
- package/dist/{node-package-manager-HIOT5VLV.js → node-package-manager-P7JQBCHZ.js} +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/{ui-QBSPD4RX.js → ui-XTVYPIVY.js} +1 -1
- package/dist/{workerd-QSZBPNES.js → workerd-3GJRSBJN.js} +1 -1
- package/oclif.manifest.json +23 -3
- package/package.json +6 -6
- package/dist/cli/services/store/admin-graphql-context.js +0 -103
- package/dist/cli/services/store/admin-graphql-transport.d.ts +0 -9
- package/dist/cli/services/store/auth.d.ts +0 -61
- package/dist/cli/services/store/auth.js +0 -326
- package/dist/cli/services/store/execute-result.d.ts +0 -1
- package/dist/cli/services/store/execute-result.js +0 -18
- package/dist/cli/services/store/session.js +0 -69
- /package/dist/cli/services/store/{auth-config.d.ts → auth/config.d.ts} +0 -0
- /package/dist/cli/services/store/{auth-recovery.d.ts → auth/recovery.d.ts} +0 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { fetchApiVersions } from '@shopify/cli-kit/node/api/admin';
|
|
2
|
+
import { AbortError } from '@shopify/cli-kit/node/error';
|
|
3
|
+
import { reauthenticateStoreAuthError } from '../auth/recovery.js';
|
|
4
|
+
import { clearStoredStoreAppSession } from '../auth/session-store.js';
|
|
5
|
+
import { loadStoredStoreSession } from '../auth/session-lifecycle.js';
|
|
6
|
+
async function resolveApiVersion(options) {
|
|
7
|
+
const { session, adminSession, userSpecifiedVersion } = options;
|
|
8
|
+
if (userSpecifiedVersion === 'unstable')
|
|
9
|
+
return userSpecifiedVersion;
|
|
10
|
+
let availableVersions;
|
|
11
|
+
try {
|
|
12
|
+
availableVersions = await fetchApiVersions(adminSession);
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
if (error instanceof AbortError &&
|
|
16
|
+
error.message.includes(`Error connecting to your store ${adminSession.storeFqdn}:`) &&
|
|
17
|
+
/\b(?:401|404)\b/.test(error.message)) {
|
|
18
|
+
clearStoredStoreAppSession(session.store, session.userId);
|
|
19
|
+
throw reauthenticateStoreAuthError(`Stored app authentication for ${session.store} is no longer valid.`, session.store, session.scopes.join(','));
|
|
20
|
+
}
|
|
21
|
+
throw error;
|
|
22
|
+
}
|
|
23
|
+
if (!userSpecifiedVersion) {
|
|
24
|
+
const supportedVersions = availableVersions.filter((version) => version.supported).map((version) => version.handle);
|
|
25
|
+
return supportedVersions.sort().reverse()[0];
|
|
26
|
+
}
|
|
27
|
+
const versionList = availableVersions.map((version) => version.handle);
|
|
28
|
+
if (versionList.includes(userSpecifiedVersion))
|
|
29
|
+
return userSpecifiedVersion;
|
|
30
|
+
throw new AbortError(`Invalid API version: ${userSpecifiedVersion}`, `Allowed versions: ${versionList.join(', ')}`);
|
|
31
|
+
}
|
|
32
|
+
export async function prepareAdminStoreGraphQLContext(input) {
|
|
33
|
+
const session = await loadStoredStoreSession(input.store);
|
|
34
|
+
const adminSession = {
|
|
35
|
+
token: session.accessToken,
|
|
36
|
+
storeFqdn: session.store,
|
|
37
|
+
};
|
|
38
|
+
const version = await resolveApiVersion({ session, adminSession, userSpecifiedVersion: input.userSpecifiedVersion });
|
|
39
|
+
return { adminSession, version, session };
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=admin-context.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PreparedStoreExecuteRequest } from './request.js';
|
|
2
|
+
import type { AdminStoreGraphQLContext } from './admin-context.js';
|
|
3
|
+
export declare function runAdminStoreGraphQLOperation(input: {
|
|
4
|
+
context: AdminStoreGraphQLContext;
|
|
5
|
+
request: PreparedStoreExecuteRequest;
|
|
6
|
+
}): Promise<unknown>;
|
|
@@ -3,8 +3,8 @@ import { graphqlRequest } from '@shopify/cli-kit/node/api/graphql';
|
|
|
3
3
|
import { AbortError } from '@shopify/cli-kit/node/error';
|
|
4
4
|
import { outputContent } from '@shopify/cli-kit/node/output';
|
|
5
5
|
import { renderSingleTask } from '@shopify/cli-kit/node/ui';
|
|
6
|
-
import { reauthenticateStoreAuthError } from '
|
|
7
|
-
import { clearStoredStoreAppSession } from '
|
|
6
|
+
import { reauthenticateStoreAuthError } from '../auth/recovery.js';
|
|
7
|
+
import { clearStoredStoreAppSession } from '../auth/session-store.js';
|
|
8
8
|
function isGraphQLClientError(error) {
|
|
9
9
|
if (!error || typeof error !== 'object' || !('response' in error))
|
|
10
10
|
return false;
|
|
@@ -19,8 +19,8 @@ export async function runAdminStoreGraphQLOperation(input) {
|
|
|
19
19
|
return graphqlRequest({
|
|
20
20
|
query: input.request.query,
|
|
21
21
|
api: 'Admin',
|
|
22
|
-
url: adminUrl(input.adminSession.storeFqdn, input.version, input.adminSession),
|
|
23
|
-
token: input.adminSession.token,
|
|
22
|
+
url: adminUrl(input.context.adminSession.storeFqdn, input.context.version, input.context.adminSession),
|
|
23
|
+
token: input.context.adminSession.token,
|
|
24
24
|
variables: input.request.parsedVariables,
|
|
25
25
|
responseOptions: { handleErrors: false },
|
|
26
26
|
});
|
|
@@ -30,8 +30,8 @@ export async function runAdminStoreGraphQLOperation(input) {
|
|
|
30
30
|
}
|
|
31
31
|
catch (error) {
|
|
32
32
|
if (isGraphQLClientError(error) && error.response.status === 401) {
|
|
33
|
-
clearStoredStoreAppSession(input.store, input.
|
|
34
|
-
throw reauthenticateStoreAuthError(`Stored app authentication for ${input.store} is no longer valid.`, input.store,
|
|
33
|
+
clearStoredStoreAppSession(input.context.session.store, input.context.session.userId);
|
|
34
|
+
throw reauthenticateStoreAuthError(`Stored app authentication for ${input.context.session.store} is no longer valid.`, input.context.session.store, input.context.session.scopes.join(','));
|
|
35
35
|
}
|
|
36
36
|
if (isGraphQLClientError(error) && error.response.errors) {
|
|
37
37
|
throw new AbortError('GraphQL operation failed.', JSON.stringify({ errors: error.response.errors }, null, 2));
|
|
@@ -39,4 +39,4 @@ export async function runAdminStoreGraphQLOperation(input) {
|
|
|
39
39
|
throw error;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
//# sourceMappingURL=admin-
|
|
42
|
+
//# sourceMappingURL=admin-transport.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StoreGraphQLApi } from './
|
|
1
|
+
import { type StoreGraphQLApi } from './targets.js';
|
|
2
2
|
interface ExecuteStoreOperationInput {
|
|
3
3
|
store: string;
|
|
4
4
|
api?: StoreGraphQLApi;
|
|
@@ -6,9 +6,8 @@ interface ExecuteStoreOperationInput {
|
|
|
6
6
|
queryFile?: string;
|
|
7
7
|
variables?: string;
|
|
8
8
|
variableFile?: string;
|
|
9
|
-
outputFile?: string;
|
|
10
9
|
version?: string;
|
|
11
10
|
allowMutations?: boolean;
|
|
12
11
|
}
|
|
13
|
-
export declare function executeStoreOperation(input: ExecuteStoreOperationInput): Promise<
|
|
12
|
+
export declare function executeStoreOperation(input: ExecuteStoreOperationInput): Promise<unknown>;
|
|
14
13
|
export {};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { renderSingleTask } from '@shopify/cli-kit/node/ui';
|
|
2
2
|
import { outputContent } from '@shopify/cli-kit/node/output';
|
|
3
|
-
import { prepareStoreExecuteRequest } from './
|
|
4
|
-
import {
|
|
5
|
-
import { getStoreGraphQLTarget } from './graphql-targets.js';
|
|
3
|
+
import { prepareStoreExecuteRequest } from './request.js';
|
|
4
|
+
import { getStoreGraphQLTarget } from './targets.js';
|
|
6
5
|
export async function executeStoreOperation(input) {
|
|
7
6
|
const target = getStoreGraphQLTarget(input.api ?? 'admin');
|
|
8
7
|
const request = await prepareStoreExecuteRequest({
|
|
@@ -10,7 +9,6 @@ export async function executeStoreOperation(input) {
|
|
|
10
9
|
queryFile: input.queryFile,
|
|
11
10
|
variables: input.variables,
|
|
12
11
|
variableFile: input.variableFile,
|
|
13
|
-
outputFile: input.outputFile,
|
|
14
12
|
version: input.version,
|
|
15
13
|
allowMutations: input.allowMutations,
|
|
16
14
|
});
|
|
@@ -19,11 +17,6 @@ export async function executeStoreOperation(input) {
|
|
|
19
17
|
task: async () => target.prepareContext({ store: input.store, requestedVersion: request.requestedVersion }),
|
|
20
18
|
renderOptions: { stdout: process.stderr },
|
|
21
19
|
});
|
|
22
|
-
|
|
23
|
-
store: input.store,
|
|
24
|
-
context,
|
|
25
|
-
request,
|
|
26
|
-
});
|
|
27
|
-
await writeOrOutputStoreExecuteResult(result, request.outputFile);
|
|
20
|
+
return await target.execute({ context, request });
|
|
28
21
|
}
|
|
29
|
-
//# sourceMappingURL=
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -8,7 +8,6 @@ export interface PreparedStoreExecuteRequest {
|
|
|
8
8
|
parsedVariables?: {
|
|
9
9
|
[key: string]: unknown;
|
|
10
10
|
};
|
|
11
|
-
outputFile?: string;
|
|
12
11
|
requestedVersion?: string;
|
|
13
12
|
}
|
|
14
13
|
export declare function prepareStoreExecuteRequest(input: {
|
|
@@ -16,7 +15,6 @@ export declare function prepareStoreExecuteRequest(input: {
|
|
|
16
15
|
queryFile?: string;
|
|
17
16
|
variables?: string;
|
|
18
17
|
variableFile?: string;
|
|
19
|
-
outputFile?: string;
|
|
20
18
|
version?: string;
|
|
21
19
|
allowMutations?: boolean;
|
|
22
20
|
}): Promise<PreparedStoreExecuteRequest>;
|
|
@@ -82,8 +82,7 @@ export async function prepareStoreExecuteRequest(input) {
|
|
|
82
82
|
query,
|
|
83
83
|
parsedOperation,
|
|
84
84
|
parsedVariables,
|
|
85
|
-
outputFile: input.outputFile,
|
|
86
85
|
requestedVersion: input.version,
|
|
87
86
|
};
|
|
88
87
|
}
|
|
89
|
-
//# sourceMappingURL=
|
|
88
|
+
//# sourceMappingURL=request.js.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { writeFile } from '@shopify/cli-kit/node/fs';
|
|
2
|
+
import { outputResult } from '@shopify/cli-kit/node/output';
|
|
3
|
+
import { renderSuccess } from '@shopify/cli-kit/node/ui';
|
|
4
|
+
function serializeStoreExecuteResult(result) {
|
|
5
|
+
return JSON.stringify(result, null, 2);
|
|
6
|
+
}
|
|
7
|
+
function renderStoreExecuteSuccess(outputFile) {
|
|
8
|
+
if (outputFile) {
|
|
9
|
+
renderSuccess({
|
|
10
|
+
headline: 'Operation succeeded.',
|
|
11
|
+
body: `Results written to ${outputFile}`,
|
|
12
|
+
});
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
renderSuccess({ headline: 'Operation succeeded.' });
|
|
16
|
+
}
|
|
17
|
+
export async function writeOrOutputStoreExecuteResult(result, outputFile, format = 'text') {
|
|
18
|
+
const serializedResult = serializeStoreExecuteResult(result);
|
|
19
|
+
if (outputFile) {
|
|
20
|
+
await writeFile(outputFile, serializedResult);
|
|
21
|
+
if (format === 'text')
|
|
22
|
+
renderStoreExecuteSuccess(outputFile);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (format === 'text')
|
|
26
|
+
renderStoreExecuteSuccess();
|
|
27
|
+
outputResult(serializedResult);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=result.js.map
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { PreparedStoreExecuteRequest } from './
|
|
2
|
-
import { AdminStoreGraphQLContext } from './admin-
|
|
1
|
+
import type { PreparedStoreExecuteRequest } from './request.js';
|
|
2
|
+
import { type AdminStoreGraphQLContext } from './admin-context.js';
|
|
3
3
|
export type StoreGraphQLApi = 'admin';
|
|
4
4
|
interface PrepareStoreGraphQLTargetContextInput {
|
|
5
5
|
store: string;
|
|
6
6
|
requestedVersion?: string;
|
|
7
7
|
}
|
|
8
8
|
interface ExecuteStoreGraphQLTargetInput<TContext> {
|
|
9
|
-
store: string;
|
|
10
9
|
context: TContext;
|
|
11
10
|
request: PreparedStoreExecuteRequest;
|
|
12
11
|
}
|
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
import { BugError } from '@shopify/cli-kit/node/error';
|
|
2
|
-
import { prepareAdminStoreGraphQLContext } from './admin-
|
|
3
|
-
import { runAdminStoreGraphQLOperation } from './admin-
|
|
2
|
+
import { prepareAdminStoreGraphQLContext } from './admin-context.js';
|
|
3
|
+
import { runAdminStoreGraphQLOperation } from './admin-transport.js';
|
|
4
4
|
const adminStoreGraphQLTarget = {
|
|
5
5
|
id: 'admin',
|
|
6
6
|
prepareContext: async ({ store, requestedVersion }) => {
|
|
7
7
|
return prepareAdminStoreGraphQLContext({ store, userSpecifiedVersion: requestedVersion });
|
|
8
8
|
},
|
|
9
|
-
execute: async ({
|
|
10
|
-
return runAdminStoreGraphQLOperation({
|
|
11
|
-
store,
|
|
12
|
-
adminSession: context.adminSession,
|
|
13
|
-
sessionUserId: context.sessionUserId,
|
|
14
|
-
version: context.version,
|
|
15
|
-
request,
|
|
16
|
-
});
|
|
9
|
+
execute: async ({ context, request }) => {
|
|
10
|
+
return runAdminStoreGraphQLOperation({ context, request });
|
|
17
11
|
},
|
|
18
12
|
};
|
|
19
13
|
export function getStoreGraphQLTarget(api) {
|
|
@@ -24,4 +18,4 @@ export function getStoreGraphQLTarget(api) {
|
|
|
24
18
|
throw new BugError(`Unsupported store GraphQL API target: ${api}`);
|
|
25
19
|
}
|
|
26
20
|
}
|
|
27
|
-
//# sourceMappingURL=
|
|
21
|
+
//# sourceMappingURL=targets.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Na as a,Oa as b,Pa as c,Qa as d,Ra as e}from"./chunk-
|
|
1
|
+
import{Na as a,Oa as b,Pa as c,Qa as d,Ra as e}from"./chunk-TCRHJ3ZH.js";import"./chunk-PRKBO42R.js";import"./chunk-PB3UDYWH.js";import"./chunk-WOERFYNW.js";import"./chunk-P3ASN7B5.js";import"./chunk-XV44IQDO.js";import"./chunk-QJEBL3WX.js";import"./chunk-EENHXSWU.js";import"./chunk-NOSKVZWJ.js";import"./chunk-T4M5CWAO.js";import"./chunk-PRVQAHWI.js";import"./chunk-QUTQDXSL.js";import"./chunk-VPRTJUIN.js";export{e as addBugsnagMetadata,c as cleanStackFrameFilePath,a as errorHandler,d as registerCleanBugsnagErrorsFromWithinPlugins,b as sendErrorToBugsnag};
|
package/dist/hooks/postrun.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as a}from"../chunk-
|
|
1
|
+
import{d as a}from"../chunk-VLDSGLBP.js";import"../chunk-TCRHJ3ZH.js";import"../chunk-PRKBO42R.js";import"../chunk-PB3UDYWH.js";import"../chunk-WOERFYNW.js";import"../chunk-P3ASN7B5.js";import"../chunk-XV44IQDO.js";import"../chunk-QJEBL3WX.js";import"../chunk-EENHXSWU.js";import"../chunk-NOSKVZWJ.js";import"../chunk-T4M5CWAO.js";import"../chunk-PRVQAHWI.js";import"../chunk-QUTQDXSL.js";import{g as o}from"../chunk-VPRTJUIN.js";o();export{a as default};
|
package/dist/hooks/prerun.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as c}from"../chunk-
|
|
1
|
+
import{e as c}from"../chunk-T57REQVZ.js";import{Ca as s,a}from"../chunk-TCRHJ3ZH.js";import"../chunk-PRKBO42R.js";import{N as i}from"../chunk-PB3UDYWH.js";import{Ed as m,lb as t}from"../chunk-WOERFYNW.js";import"../chunk-P3ASN7B5.js";import"../chunk-XV44IQDO.js";import"../chunk-QJEBL3WX.js";import"../chunk-EENHXSWU.js";import"../chunk-NOSKVZWJ.js";import"../chunk-T4M5CWAO.js";import"../chunk-PRVQAHWI.js";import"../chunk-QUTQDXSL.js";import{g as e}from"../chunk-VPRTJUIN.js";e();e();var d=async n=>{let r=f({id:n.Command.id,aliases:n.Command.aliases,pluginAlias:n.Command.plugin?.alias}),o=n.argv;h(),m(`Running command ${r.command}`),await s({commandContent:r,args:o,commandClass:n.Command}),c(n.Command.id)};function f(n){let r=p(n.pluginAlias);return r??(r=l(n.id,n.aliases)),r}function l(n,r){return{command:n.replace(/:/g," "),topic:C(n),alias:g(r)}}function p(n){if(n?.startsWith("@shopify/create-"))return{command:n.substring(n.indexOf("/")+1)}}function C(n){if(n.lastIndexOf(":")!==-1)return n.slice(0,n.lastIndexOf(":")).replace(/:/g," ")}function g(n){let r=n.find(o=>o.split(":").every(u=>process.argv.includes(u)));if(r)return r.replace(/:/g," ")}function h(){let n=a;t(n)||i("@shopify/cli",n,{cacheExpiryInHours:24})}export{d as default};
|