@shopify/cli-kit 3.50.2 → 3.51.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/README.md +1 -0
- package/assets/cli-ruby/lib/shopify_cli/constants.rb +3 -2
- package/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server/local_assets.rb +2 -2
- package/assets/cli-ruby/lib/shopify_cli/theme/repl/remote_evaluator.rb +7 -2
- package/dist/private/node/session.d.ts +4 -1
- package/dist/private/node/session.js +6 -1
- package/dist/private/node/session.js.map +1 -1
- package/dist/public/common/string.d.ts +8 -0
- package/dist/public/common/string.js +11 -1
- package/dist/public/common/string.js.map +1 -1
- 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/analytics.js +11 -3
- package/dist/public/node/analytics.js.map +1 -1
- package/dist/public/node/base-command.js +1 -1
- package/dist/public/node/base-command.js.map +1 -1
- package/dist/public/node/cli.js +9 -6
- package/dist/public/node/cli.js.map +1 -1
- package/dist/public/node/error-handler.d.ts +0 -4
- package/dist/public/node/error-handler.js +1 -1
- package/dist/public/node/error-handler.js.map +1 -1
- package/dist/public/node/error.d.ts +1 -0
- package/dist/public/node/error.js +1 -0
- package/dist/public/node/error.js.map +1 -1
- package/dist/public/node/git.js +46 -43
- package/dist/public/node/git.js.map +1 -1
- package/dist/public/node/metadata.js +32 -28
- package/dist/public/node/metadata.js.map +1 -1
- package/dist/public/node/node-package-manager.d.ts +4 -2
- package/dist/public/node/node-package-manager.js +44 -8
- package/dist/public/node/node-package-manager.js.map +1 -1
- package/dist/public/node/output.js +1 -0
- package/dist/public/node/output.js.map +1 -1
- package/dist/public/node/ruby.d.ts +0 -1
- package/dist/public/node/ruby.js +12 -9
- package/dist/public/node/ruby.js.map +1 -1
- package/dist/public/node/session.d.ts +7 -2
- package/dist/public/node/session.js +6 -5
- package/dist/public/node/session.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -6,16 +6,20 @@ export interface AdminSession {
|
|
|
6
6
|
token: string;
|
|
7
7
|
storeFqdn: string;
|
|
8
8
|
}
|
|
9
|
+
interface EnsureAuthenticatedPartnersOptions {
|
|
10
|
+
noPrompt?: boolean;
|
|
11
|
+
}
|
|
9
12
|
/**
|
|
10
13
|
* Ensure that we have a valid session to access the Partners API.
|
|
11
14
|
* If SHOPIFY_CLI_PARTNERS_TOKEN exists, that token will be used to obtain a valid Partners Token
|
|
12
15
|
* If SHOPIFY_CLI_PARTNERS_TOKEN exists, scopes will be ignored.
|
|
13
16
|
*
|
|
14
17
|
* @param scopes - Optional array of extra scopes to authenticate with.
|
|
15
|
-
* @param
|
|
18
|
+
* @param env - Optional environment variables to use.
|
|
19
|
+
* @param options - Optional extra options to use.
|
|
16
20
|
* @returns The access token for the Partners API.
|
|
17
21
|
*/
|
|
18
|
-
export declare function ensureAuthenticatedPartners(scopes?: string[],
|
|
22
|
+
export declare function ensureAuthenticatedPartners(scopes?: string[], env?: NodeJS.ProcessEnv, options?: EnsureAuthenticatedPartnersOptions): Promise<string>;
|
|
19
23
|
/**
|
|
20
24
|
* Ensure that we have a valid session to access the Storefront API.
|
|
21
25
|
*
|
|
@@ -59,3 +63,4 @@ export declare function ensureAuthenticatedBusinessPlatform(scopes?: string[]):
|
|
|
59
63
|
* @returns A promise that resolves when the logout is complete.
|
|
60
64
|
*/
|
|
61
65
|
export declare function logout(): Promise<void>;
|
|
66
|
+
export {};
|
|
@@ -11,10 +11,11 @@ import { ensureAuthenticated } from '../../private/node/session.js';
|
|
|
11
11
|
* If SHOPIFY_CLI_PARTNERS_TOKEN exists, scopes will be ignored.
|
|
12
12
|
*
|
|
13
13
|
* @param scopes - Optional array of extra scopes to authenticate with.
|
|
14
|
-
* @param
|
|
14
|
+
* @param env - Optional environment variables to use.
|
|
15
|
+
* @param options - Optional extra options to use.
|
|
15
16
|
* @returns The access token for the Partners API.
|
|
16
17
|
*/
|
|
17
|
-
export async function ensureAuthenticatedPartners(scopes = [],
|
|
18
|
+
export async function ensureAuthenticatedPartners(scopes = [], env = process.env, options = {}) {
|
|
18
19
|
outputDebug(outputContent `Ensuring that the user is authenticated with the Partners API with the following scopes:
|
|
19
20
|
${outputToken.json(scopes)}
|
|
20
21
|
`);
|
|
@@ -22,7 +23,7 @@ ${outputToken.json(scopes)}
|
|
|
22
23
|
if (envToken) {
|
|
23
24
|
return (await exchangeCustomPartnerToken(envToken)).accessToken;
|
|
24
25
|
}
|
|
25
|
-
const tokens = await ensureAuthenticated({ partnersApi: { scopes } });
|
|
26
|
+
const tokens = await ensureAuthenticated({ partnersApi: { scopes } }, env, options);
|
|
26
27
|
if (!tokens.partners) {
|
|
27
28
|
throw new BugError('No partners token found after ensuring authenticated');
|
|
28
29
|
}
|
|
@@ -42,7 +43,7 @@ export async function ensureAuthenticatedStorefront(scopes = [], password = unde
|
|
|
42
43
|
outputDebug(outputContent `Ensuring that the user is authenticated with the Storefront API with the following scopes:
|
|
43
44
|
${outputToken.json(scopes)}
|
|
44
45
|
`);
|
|
45
|
-
const tokens = await ensureAuthenticated({ storefrontRendererApi: { scopes } }, process.env, forceRefresh);
|
|
46
|
+
const tokens = await ensureAuthenticated({ storefrontRendererApi: { scopes } }, process.env, { forceRefresh });
|
|
46
47
|
if (!tokens.storefront) {
|
|
47
48
|
throw new BugError('No storefront token found after ensuring authenticated');
|
|
48
49
|
}
|
|
@@ -60,7 +61,7 @@ export async function ensureAuthenticatedAdmin(store, scopes = [], forceRefresh
|
|
|
60
61
|
outputDebug(outputContent `Ensuring that the user is authenticated with the Admin API with the following scopes for the store ${outputToken.raw(store)}:
|
|
61
62
|
${outputToken.json(scopes)}
|
|
62
63
|
`);
|
|
63
|
-
const tokens = await ensureAuthenticated({ adminApi: { scopes, storeFqdn: store } }, process.env, forceRefresh);
|
|
64
|
+
const tokens = await ensureAuthenticated({ adminApi: { scopes, storeFqdn: store } }, process.env, { forceRefresh });
|
|
64
65
|
if (!tokens.admin) {
|
|
65
66
|
throw new BugError('No admin token found after ensuring authenticated');
|
|
66
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/public/node/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAA;AACnC,OAAO,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,WAAW,MAAM,qCAAqC,CAAA;AAClE,OAAO,EAAC,0BAA0B,EAAC,MAAM,wCAAwC,CAAA;AACjF,OAAO,EAAC,aAAa,EAAE,WAAW,EAAE,WAAW,EAAC,MAAM,6BAA6B,CAAA;AACnF,OAAO,EAAC,mBAAmB,EAAC,MAAM,+BAA+B,CAAA;
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/public/node/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAA;AACnC,OAAO,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,WAAW,MAAM,qCAAqC,CAAA;AAClE,OAAO,EAAC,0BAA0B,EAAC,MAAM,wCAAwC,CAAA;AACjF,OAAO,EAAC,aAAa,EAAE,WAAW,EAAE,WAAW,EAAC,MAAM,6BAA6B,CAAA;AACnF,OAAO,EAAC,mBAAmB,EAAC,MAAM,+BAA+B,CAAA;AAcjE;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,SAAmB,EAAE,EACrB,GAAG,GAAG,OAAO,CAAC,GAAG,EACjB,UAA8C,EAAE;IAEhD,WAAW,CAAC,aAAa,CAAA;EACzB,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC;CACzB,CA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W,CAAC,MAAM,EAAE,CAAA;AAC7B,CAAC","sourcesContent":["import {normalizeStoreFqdn} from './context/fqdn.js'\nimport {BugError} from './error.js'\nimport {getPartnersToken} from './environment.js'\nimport * as secureStore from '../../private/node/session/store.js'\nimport {exchangeCustomPartnerToken} from '../../private/node/session/exchange.js'\nimport {outputContent, outputToken, outputDebug} from '../../public/node/output.js'\nimport {ensureAuthenticated} from '../../private/node/session.js'\n\n/**\n * Session Object to access the Admin API, includes the token and the store FQDN.\n */\nexport interface AdminSession {\n token: string\n storeFqdn: string\n}\n\ninterface EnsureAuthenticatedPartnersOptions {\n noPrompt?: boolean\n}\n\n/**\n * Ensure that we have a valid session to access the Partners API.\n * If SHOPIFY_CLI_PARTNERS_TOKEN exists, that token will be used to obtain a valid Partners Token\n * If SHOPIFY_CLI_PARTNERS_TOKEN exists, scopes will be ignored.\n *\n * @param scopes - Optional array of extra scopes to authenticate with.\n * @param env - Optional environment variables to use.\n * @param options - Optional extra options to use.\n * @returns The access token for the Partners API.\n */\nexport async function ensureAuthenticatedPartners(\n scopes: string[] = [],\n env = process.env,\n options: EnsureAuthenticatedPartnersOptions = {},\n): Promise<string> {\n outputDebug(outputContent`Ensuring that the user is authenticated with the Partners API with the following scopes:\n${outputToken.json(scopes)}\n`)\n const envToken = getPartnersToken()\n if (envToken) {\n return (await exchangeCustomPartnerToken(envToken)).accessToken\n }\n const tokens = await ensureAuthenticated({partnersApi: {scopes}}, env, options)\n if (!tokens.partners) {\n throw new BugError('No partners token found after ensuring authenticated')\n }\n return tokens.partners\n}\n\n/**\n * Ensure that we have a valid session to access the Storefront API.\n *\n * @param scopes - Optional array of extra scopes to authenticate with.\n * @param password - Optional password to use.\n * @param forceRefresh - Optional flag to force a refresh of the token.\n * @returns The access token for the Storefront API.\n */\nexport async function ensureAuthenticatedStorefront(\n scopes: string[] = [],\n password: string | undefined = undefined,\n forceRefresh = false,\n): Promise<string> {\n if (password) return password\n\n outputDebug(outputContent`Ensuring that the user is authenticated with the Storefront API with the following scopes:\n${outputToken.json(scopes)}\n`)\n const tokens = await ensureAuthenticated({storefrontRendererApi: {scopes}}, process.env, {forceRefresh})\n if (!tokens.storefront) {\n throw new BugError('No storefront token found after ensuring authenticated')\n }\n return tokens.storefront\n}\n\n/**\n * Ensure that we have a valid Admin session for the given store.\n *\n * @param store - Store fqdn to request auth for.\n * @param scopes - Optional array of extra scopes to authenticate with.\n * @param forceRefresh - Optional flag to force a refresh of the token.\n * @returns The access token for the Admin API.\n */\nexport async function ensureAuthenticatedAdmin(\n store: string,\n scopes: string[] = [],\n forceRefresh = false,\n): Promise<AdminSession> {\n outputDebug(outputContent`Ensuring that the user is authenticated with the Admin API with the following scopes for the store ${outputToken.raw(\n store,\n )}:\n${outputToken.json(scopes)}\n`)\n const tokens = await ensureAuthenticated({adminApi: {scopes, storeFqdn: store}}, process.env, {forceRefresh})\n if (!tokens.admin) {\n throw new BugError('No admin token found after ensuring authenticated')\n }\n return tokens.admin\n}\n\n/**\n * Ensure that we have a valid session to access the Theme API.\n * If a password is provided, that token will be used against Theme Access API.\n * Otherwise, it will ensure that the user is authenticated with the Admin API.\n *\n * @param store - Store fqdn to request auth for.\n * @param password - Password generated from Theme Access app.\n * @param scopes - Optional array of extra scopes to authenticate with.\n * @param forceRefresh - Optional flag to force a refresh of the token.\n * @returns The access token and store.\n */\nexport async function ensureAuthenticatedThemes(\n store: string,\n password: string | undefined,\n scopes: string[] = [],\n forceRefresh = false,\n): Promise<AdminSession> {\n outputDebug(outputContent`Ensuring that the user is authenticated with the Theme API with the following scopes:\n${outputToken.json(scopes)}\n`)\n if (password) return {token: password, storeFqdn: await normalizeStoreFqdn(store)}\n return ensureAuthenticatedAdmin(store, scopes, forceRefresh)\n}\n\n/**\n * Ensure that we have a valid session to access the Business Platform API.\n *\n * @param scopes - Optional array of extra scopes to authenticate with.\n * @returns The access token for the Business Platform API.\n */\nexport async function ensureAuthenticatedBusinessPlatform(scopes: string[] = []): Promise<string> {\n outputDebug(outputContent`Ensuring that the user is authenticated with the Business Platform API with the following scopes:\n${outputToken.json(scopes)}\n`)\n const tokens = await ensureAuthenticated({businessPlatformApi: {scopes}}, process.env)\n if (!tokens.businessPlatform) {\n throw new BugError('No business-platform token found after ensuring authenticated')\n }\n return tokens.businessPlatform\n}\n\n/**\n * Logout from Shopify.\n *\n * @returns A promise that resolves when the logout is complete.\n */\nexport function logout(): Promise<void> {\n return secureStore.remove()\n}\n"]}
|