@shopify/shop-minis-cli 0.0.182 → 0.0.184
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/build/data/partners/query.d.ts +1 -27
- package/build/data/partners/query.js +0 -28
- package/build/data/partners/query.js.map +1 -1
- package/build/data/partners/types.d.ts +0 -6
- package/build/data/types/autogenerated/shop-minis-admin-api/gql.d.ts +0 -23
- package/build/data/types/autogenerated/shop-minis-admin-api/gql.js +0 -3
- package/build/data/types/autogenerated/shop-minis-admin-api/gql.js.map +1 -1
- package/build/data/types/autogenerated/shop-minis-admin-api/graphql.d.ts +83 -143
- package/build/data/types/autogenerated/shop-minis-admin-api/graphql.js +16 -244
- package/build/data/types/autogenerated/shop-minis-admin-api/graphql.js.map +1 -1
- package/build/program.js +0 -2
- package/build/program.js.map +1 -1
- package/build/utils/allowed-dependencies.js +6 -0
- package/build/utils/allowed-dependencies.js.map +1 -1
- package/package.json +1 -1
- package/build/commands/app/index.d.ts +0 -2
- package/build/commands/app/index.js +0 -17
- package/build/commands/app/index.js.map +0 -1
- package/build/commands/app/link.d.ts +0 -2
- package/build/commands/app/link.js +0 -62
- package/build/commands/app/link.js.map +0 -1
- package/build/commands/app/list.d.ts +0 -2
- package/build/commands/app/list.js +0 -45
- package/build/commands/app/list.js.map +0 -1
- package/build/commands/app/unlink.d.ts +0 -2
- package/build/commands/app/unlink.js +0 -55
- package/build/commands/app/unlink.js.map +0 -1
- package/build/data/get-linked-apps.d.ts +0 -13
- package/build/data/get-linked-apps.js +0 -21
- package/build/data/get-linked-apps.js.map +0 -1
- package/build/data/mini-link-app.d.ts +0 -20
- package/build/data/mini-link-app.js +0 -35
- package/build/data/mini-link-app.js.map +0 -1
- package/build/data/mini-unlink-app.d.ts +0 -18
- package/build/data/mini-unlink-app.js +0 -25
- package/build/data/mini-unlink-app.js.map +0 -1
- package/build/utils/extract-id-gid.d.ts +0 -1
- package/build/utils/extract-id-gid.js +0 -16
- package/build/utils/extract-id-gid.js.map +0 -1
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { outputInfo } from '@shopify/cli-kit/node/output';
|
|
3
|
-
import { handler as handleError } from '@shopify/cli-kit/node/error';
|
|
4
|
-
import { renderTable } from '@shopify/cli-kit/node/ui';
|
|
5
|
-
import { getLinkedApps } from '../../data/get-linked-apps.js';
|
|
6
|
-
import { extractIdFromGID } from '../../utils/extract-id-gid.js';
|
|
7
|
-
import { assertNetworkAndAuth } from '../../utils/common-tasks.js';
|
|
8
|
-
export const command = new Command()
|
|
9
|
-
.name('list')
|
|
10
|
-
.description('List all linked Shopify apps.')
|
|
11
|
-
.action(async () => {
|
|
12
|
-
try {
|
|
13
|
-
await assertNetworkAndAuth();
|
|
14
|
-
const linkedApps = await getLinkedApps();
|
|
15
|
-
const rows = [];
|
|
16
|
-
if (linkedApps.productionShopifyApp) {
|
|
17
|
-
rows.push({
|
|
18
|
-
id: extractIdFromGID(linkedApps.productionShopifyApp.id),
|
|
19
|
-
title: linkedApps.productionShopifyApp.title,
|
|
20
|
-
type: 'production',
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
linkedApps.developmentShopifyApps?.forEach(app => {
|
|
24
|
-
rows.push({
|
|
25
|
-
id: extractIdFromGID(app.id),
|
|
26
|
-
title: app.title,
|
|
27
|
-
type: 'development',
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
outputInfo('');
|
|
31
|
-
renderTable({
|
|
32
|
-
rows,
|
|
33
|
-
columns: {
|
|
34
|
-
title: { header: 'Title' },
|
|
35
|
-
type: { header: 'Type' },
|
|
36
|
-
id: { header: 'ID' },
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
outputInfo('');
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
handleError(error);
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
//# sourceMappingURL=list.js.map
|
|
@@ -1 +0,0 @@
|
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F,UAAU,CAAC,EAAE,CAAC,CAAA;QACd,WAAW,CAAC;YACV,IAAI;YACJ,OAAO,EAAE;gBACP,KAAK,EAAE,EAAC,MAAM,EAAE,OAAO,EAAC;gBACxB,IAAI,EAAE,EAAC,MAAM,EAAE,MAAM,EAAC;gBACtB,EAAE,EAAE,EAAC,MAAM,EAAE,IAAI,EAAC;aACnB;SACF,CAAC,CAAA;QACF,UAAU,CAAC,EAAE,CAAC,CAAA;KACf;IAAC,OAAO,KAAK,EAAE;QACd,WAAW,CAAC,KAAK,CAAC,CAAA;KACnB;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { renderError, renderSelectPrompt, renderSuccess, } from '@shopify/cli-kit/node/ui';
|
|
3
|
-
import { handler as handleError } from '@shopify/cli-kit/node/error';
|
|
4
|
-
import { getLinkedApps } from '../../data/get-linked-apps.js';
|
|
5
|
-
import { miniUnlinkApp } from '../../data/mini-unlink-app.js';
|
|
6
|
-
import { assertNetworkAndAuth } from '../../utils/common-tasks.js';
|
|
7
|
-
export const command = new Command()
|
|
8
|
-
.name('unlink')
|
|
9
|
-
.description('Unlink a development Shopify app.')
|
|
10
|
-
.action(async () => {
|
|
11
|
-
const linkedApps = await getLinkedApps();
|
|
12
|
-
// Only development apps are supported for unlinking
|
|
13
|
-
if (!linkedApps?.developmentShopifyApps?.length) {
|
|
14
|
-
renderError({
|
|
15
|
-
headline: 'Error unlinking app',
|
|
16
|
-
body: ['No development apps linked to your Shop Mini'],
|
|
17
|
-
});
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
const appId = (await renderSelectPrompt({
|
|
21
|
-
message: 'Select the development app to unlink',
|
|
22
|
-
choices: linkedApps.developmentShopifyApps.map(app => ({
|
|
23
|
-
label: app.title,
|
|
24
|
-
value: app.id,
|
|
25
|
-
})),
|
|
26
|
-
}));
|
|
27
|
-
const selectedApp = linkedApps.developmentShopifyApps.find(app => app.id === appId);
|
|
28
|
-
try {
|
|
29
|
-
await assertNetworkAndAuth();
|
|
30
|
-
const result = await miniUnlinkApp({
|
|
31
|
-
appId,
|
|
32
|
-
});
|
|
33
|
-
if (result.userErrors.length) {
|
|
34
|
-
renderError({
|
|
35
|
-
headline: 'Error unlinking app',
|
|
36
|
-
body: result.userErrors.map(userError => userError.message),
|
|
37
|
-
});
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
renderSuccess({
|
|
41
|
-
headline: 'App unlinked',
|
|
42
|
-
body: [
|
|
43
|
-
'Shopify app',
|
|
44
|
-
{
|
|
45
|
-
bold: selectedApp.title,
|
|
46
|
-
},
|
|
47
|
-
'has been unlinked from your Shop Mini.',
|
|
48
|
-
],
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
catch (error) {
|
|
52
|
-
handleError(error);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
//# sourceMappingURL=unlink.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unlink.js","sourceRoot":"","sources":["../../../src/commands/app/unlink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AACjC,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,aAAa,GACd,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,6BAA6B,CAAA;AAElE,OAAO,EAAC,aAAa,EAAC,MAAM,+BAA+B,CAAA;AAC3D,OAAO,EAAC,aAAa,EAAC,MAAM,+BAA+B,CAAA;AAC3D,OAAO,EAAC,oBAAoB,EAAC,MAAM,6BAA6B,CAAA;AAEhE,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE;KACjC,IAAI,CAAC,QAAQ,CAAC;KACd,WAAW,CAAC,mCAAmC,CAAC;KAChD,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,MAAM,UAAU,GAAG,MAAM,aAAa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,0 @@
|
|
|
1
|
-
export declare const getLinkedApps: () => Promise<{
|
|
2
|
-
__typename?: "Mini" | undefined;
|
|
3
|
-
productionShopifyApp?: {
|
|
4
|
-
__typename?: "ShopifyApp" | undefined;
|
|
5
|
-
id: string;
|
|
6
|
-
title: string;
|
|
7
|
-
} | null | undefined;
|
|
8
|
-
developmentShopifyApps: {
|
|
9
|
-
__typename?: "ShopifyApp" | undefined;
|
|
10
|
-
id: string;
|
|
11
|
-
title: string;
|
|
12
|
-
}[];
|
|
13
|
-
}>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { graphql } from './types/autogenerated/shop-minis-admin-api/gql.js';
|
|
2
|
-
import { client } from './gql-client.js';
|
|
3
|
-
const getLinkedAppsQuery = graphql(/* GraphQL */ `
|
|
4
|
-
query LinkedApps {
|
|
5
|
-
mini {
|
|
6
|
-
productionShopifyApp {
|
|
7
|
-
id
|
|
8
|
-
title
|
|
9
|
-
}
|
|
10
|
-
developmentShopifyApps {
|
|
11
|
-
id
|
|
12
|
-
title
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
`);
|
|
17
|
-
export const getLinkedApps = async () => {
|
|
18
|
-
const data = await client.request(getLinkedAppsQuery, {}, {});
|
|
19
|
-
return data.mini;
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=get-linked-apps.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-linked-apps.js","sourceRoot":"","sources":["../../src/data/get-linked-apps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,mDAAmD,CAAA;AACzE,OAAO,EAAC,MAAM,EAAC,MAAM,iBAAiB,CAAA;AAEtC,MAAM,kBAAkB,GAAG,OAAO,CAAC,aAAa,CAAC;;;;;;;;;;;;;CAahD,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,IAAI,EAAE;IACtC,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;IAE7D,OAAO,IAAI,CAAC,IAAK,CAAA;AACnB,CAAC,CAAA"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export interface MiniLinkAppParameters {
|
|
2
|
-
appApiKey: string;
|
|
3
|
-
partnersAccessToken: string;
|
|
4
|
-
primary?: boolean;
|
|
5
|
-
}
|
|
6
|
-
export declare const miniLinkApp: ({ appApiKey, partnersAccessToken, primary, }: MiniLinkAppParameters) => Promise<{
|
|
7
|
-
__typename?: "MiniLinkAppPayload" | undefined;
|
|
8
|
-
mini?: {
|
|
9
|
-
__typename?: "Mini" | undefined;
|
|
10
|
-
handle: string;
|
|
11
|
-
productionShopifyAppId?: string | null | undefined;
|
|
12
|
-
developmentShopifyAppIds: string[];
|
|
13
|
-
} | null | undefined;
|
|
14
|
-
userErrors: {
|
|
15
|
-
__typename?: "MiniLinkAppUserError" | undefined;
|
|
16
|
-
code: import("./types/autogenerated/shop-minis-admin-api/graphql.js").MiniLinkAppUserErrorCode;
|
|
17
|
-
message: string;
|
|
18
|
-
field?: string[] | null | undefined;
|
|
19
|
-
}[];
|
|
20
|
-
}>;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { graphql } from './types/autogenerated/shop-minis-admin-api/gql.js';
|
|
2
|
-
import { client } from './gql-client.js';
|
|
3
|
-
const miniLinkAppQuery = graphql(/* GraphQL */ `
|
|
4
|
-
mutation MiniLinkApp(
|
|
5
|
-
$appApiKey: String!
|
|
6
|
-
$partnersAccessToken: String!
|
|
7
|
-
$primary: Boolean
|
|
8
|
-
) {
|
|
9
|
-
miniLinkApp(
|
|
10
|
-
appApiKey: $appApiKey
|
|
11
|
-
partnersAccessToken: $partnersAccessToken
|
|
12
|
-
primary: $primary
|
|
13
|
-
) {
|
|
14
|
-
mini {
|
|
15
|
-
handle
|
|
16
|
-
productionShopifyAppId
|
|
17
|
-
developmentShopifyAppIds
|
|
18
|
-
}
|
|
19
|
-
userErrors {
|
|
20
|
-
code
|
|
21
|
-
message
|
|
22
|
-
field
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
`);
|
|
27
|
-
export const miniLinkApp = async ({ appApiKey, partnersAccessToken, primary, }) => {
|
|
28
|
-
const data = await client.request(miniLinkAppQuery, {
|
|
29
|
-
appApiKey,
|
|
30
|
-
partnersAccessToken,
|
|
31
|
-
primary,
|
|
32
|
-
});
|
|
33
|
-
return data.miniLinkApp;
|
|
34
|
-
};
|
|
35
|
-
//# sourceMappingURL=mini-link-app.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mini-link-app.js","sourceRoot":"","sources":["../../src/data/mini-link-app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,mDAAmD,CAAA;AACzE,OAAO,EAAC,MAAM,EAAC,MAAM,iBAAiB,CAAA;AAEtC,MAAM,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC;;;;;;;;;;;;;;;;;;;;;;;CAuB9C,CAAC,CAAA;AAQF,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAAE,EAChC,SAAS,EACT,mBAAmB,EACnB,OAAO,GACe,EAAE,EAAE;IAC1B,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,gBAAgB,EAAE;QAClD,SAAS;QACT,mBAAmB;QACnB,OAAO;KACR,CAAC,CAAA;IAEF,OAAO,IAAI,CAAC,WAAW,CAAA;AACzB,CAAC,CAAA"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export interface MiniUnlinkAppParameters {
|
|
2
|
-
appId: string;
|
|
3
|
-
}
|
|
4
|
-
export declare const miniUnlinkApp: ({ appId }: MiniUnlinkAppParameters) => Promise<{
|
|
5
|
-
__typename?: "MiniUnlinkAppPayload" | undefined;
|
|
6
|
-
mini?: {
|
|
7
|
-
__typename?: "Mini" | undefined;
|
|
8
|
-
handle: string;
|
|
9
|
-
productionShopifyAppId?: string | null | undefined;
|
|
10
|
-
developmentShopifyAppIds: string[];
|
|
11
|
-
} | null | undefined;
|
|
12
|
-
userErrors: {
|
|
13
|
-
__typename?: "MiniUnlinkAppUserError" | undefined;
|
|
14
|
-
code: import("./types/autogenerated/shop-minis-admin-api/graphql.js").MiniUnlinkAppUserErrorCode;
|
|
15
|
-
message: string;
|
|
16
|
-
field?: string[] | null | undefined;
|
|
17
|
-
}[];
|
|
18
|
-
}>;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { graphql } from './types/autogenerated/shop-minis-admin-api/gql.js';
|
|
2
|
-
import { client } from './gql-client.js';
|
|
3
|
-
const miniUnlinkAppQuery = graphql(/* GraphQL */ `
|
|
4
|
-
mutation MiniUnlinkApp($appId: ID!) {
|
|
5
|
-
miniUnlinkApp(appId: $appId) {
|
|
6
|
-
mini {
|
|
7
|
-
handle
|
|
8
|
-
productionShopifyAppId
|
|
9
|
-
developmentShopifyAppIds
|
|
10
|
-
}
|
|
11
|
-
userErrors {
|
|
12
|
-
code
|
|
13
|
-
message
|
|
14
|
-
field
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
`);
|
|
19
|
-
export const miniUnlinkApp = async ({ appId }) => {
|
|
20
|
-
const data = await client.request(miniUnlinkAppQuery, {
|
|
21
|
-
appId,
|
|
22
|
-
});
|
|
23
|
-
return data.miniUnlinkApp;
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=mini-unlink-app.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mini-unlink-app.js","sourceRoot":"","sources":["../../src/data/mini-unlink-app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,mDAAmD,CAAA;AACzE,OAAO,EAAC,MAAM,EAAC,MAAM,iBAAiB,CAAA;AAEtC,MAAM,kBAAkB,GAAG,OAAO,CAAC,aAAa,CAAC;;;;;;;;;;;;;;;CAehD,CAAC,CAAA;AAMF,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAAE,EAAC,KAAK,EAA0B,EAAE,EAAE;IACtE,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,kBAAkB,EAAE;QACpD,KAAK;KACN,CAAC,CAAA;IAEF,OAAO,IAAI,CAAC,aAAa,CAAA;AAC3B,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function extractIdFromGID(variantId: string): number;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
const GID_REGEXP = /\/(\w[\w-]*)(?:\?(.*))*$/;
|
|
2
|
-
function safeParseInt(value) {
|
|
3
|
-
const intValue = parseInt(value, 10);
|
|
4
|
-
if (isNaN(intValue)) {
|
|
5
|
-
return 0;
|
|
6
|
-
}
|
|
7
|
-
return intValue;
|
|
8
|
-
}
|
|
9
|
-
export function extractIdFromGID(variantId) {
|
|
10
|
-
const matches = variantId.match(GID_REGEXP);
|
|
11
|
-
if (matches && matches[1] !== undefined) {
|
|
12
|
-
return safeParseInt(matches[1]);
|
|
13
|
-
}
|
|
14
|
-
return safeParseInt(variantId);
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=extract-id-gid.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extract-id-gid.js","sourceRoot":"","sources":["../../src/utils/extract-id-gid.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,GAAG,0BAA0B,CAAA;AAE7C,SAAS,YAAY,CAAC,KAAa;IACjC,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;IACpC,IAAI,KAAK,CAAC,QAAQ,CAAC,EAAE;QACnB,OAAO,CAAC,CAAA;KACT;IAED,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,SAAiB;IAChD,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;IAC3C,IAAI,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE;QACvC,OAAO,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAA;KAChC;IACD,OAAO,YAAY,CAAC,SAAS,CAAC,CAAA;AAChC,CAAC"}
|