@shopify/shop-minis-cli 0.0.154 → 0.0.156

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/build/commands/proxies/apply.d.ts +3 -0
  2. package/build/commands/proxies/apply.js +53 -0
  3. package/build/commands/proxies/apply.js.map +1 -0
  4. package/build/commands/proxies/index.d.ts +2 -0
  5. package/build/commands/proxies/index.js +14 -0
  6. package/build/commands/proxies/index.js.map +1 -0
  7. package/build/commands/proxies/list.d.ts +2 -0
  8. package/build/commands/proxies/list.js +48 -0
  9. package/build/commands/proxies/list.js.map +1 -0
  10. package/build/commands/proxies/pull.d.ts +2 -0
  11. package/build/commands/proxies/pull.js +34 -0
  12. package/build/commands/proxies/pull.js.map +1 -0
  13. package/build/commands/secrets/delete.d.ts +2 -0
  14. package/build/commands/secrets/delete.js +53 -0
  15. package/build/commands/secrets/delete.js.map +1 -0
  16. package/build/commands/secrets/index.d.ts +2 -0
  17. package/build/commands/secrets/index.js +14 -0
  18. package/build/commands/secrets/index.js.map +1 -0
  19. package/build/commands/secrets/list.d.ts +2 -0
  20. package/build/commands/secrets/list.js +29 -0
  21. package/build/commands/secrets/list.js.map +1 -0
  22. package/build/commands/secrets/set.d.ts +2 -0
  23. package/build/commands/secrets/set.js +57 -0
  24. package/build/commands/secrets/set.js.map +1 -0
  25. package/build/commands/sync-user-metafield-definitions/index.d.ts +3 -0
  26. package/build/commands/sync-user-metafield-definitions/index.js +98 -0
  27. package/build/commands/sync-user-metafield-definitions/index.js.map +1 -0
  28. package/build/data/gql-client.js +2 -0
  29. package/build/data/gql-client.js.map +1 -1
  30. package/build/data/proxies/proxies-list.d.ts +9 -0
  31. package/build/data/proxies/proxies-list.js +19 -0
  32. package/build/data/proxies/proxies-list.js.map +1 -0
  33. package/build/data/proxies/proxies-set.d.ts +5 -0
  34. package/build/data/proxies/proxies-set.js +18 -0
  35. package/build/data/proxies/proxies-set.js.map +1 -0
  36. package/build/data/proxies/types.d.ts +10 -0
  37. package/build/data/proxies/types.js +2 -0
  38. package/build/data/proxies/types.js.map +1 -0
  39. package/build/data/secrets/secret-delete.d.ts +12 -0
  40. package/build/data/secrets/secret-delete.js +20 -0
  41. package/build/data/secrets/secret-delete.js.map +1 -0
  42. package/build/data/secrets/secret-set.d.ts +11 -0
  43. package/build/data/secrets/secret-set.js +19 -0
  44. package/build/data/secrets/secret-set.js.map +1 -0
  45. package/build/data/secrets/secrets-list.d.ts +8 -0
  46. package/build/data/secrets/secrets-list.js +14 -0
  47. package/build/data/secrets/secrets-list.js.map +1 -0
  48. package/build/data/types/autogenerated/shop-minis-admin-api/gql.d.ts +57 -7
  49. package/build/data/types/autogenerated/shop-minis-admin-api/gql.js +8 -1
  50. package/build/data/types/autogenerated/shop-minis-admin-api/gql.js.map +1 -1
  51. package/build/data/types/autogenerated/shop-minis-admin-api/graphql.d.ts +309 -41
  52. package/build/data/types/autogenerated/shop-minis-admin-api/graphql.js +471 -48
  53. package/build/data/types/autogenerated/shop-minis-admin-api/graphql.js.map +1 -1
  54. package/build/data/user-metafield-definitions/create-user-metafield-definition.d.ts +7 -0
  55. package/build/data/user-metafield-definitions/create-user-metafield-definition.js +25 -0
  56. package/build/data/user-metafield-definitions/create-user-metafield-definition.js.map +1 -0
  57. package/build/data/user-metafield-definitions/delete-user-metafield-definition.d.ts +4 -0
  58. package/build/data/user-metafield-definitions/delete-user-metafield-definition.js +21 -0
  59. package/build/data/user-metafield-definitions/delete-user-metafield-definition.js.map +1 -0
  60. package/build/data/user-metafield-definitions/get-user-metafield-definitions.d.ts +7 -0
  61. package/build/data/user-metafield-definitions/get-user-metafield-definitions.js +19 -0
  62. package/build/data/user-metafield-definitions/get-user-metafield-definitions.js.map +1 -0
  63. package/build/index.js +6 -0
  64. package/build/index.js.map +1 -1
  65. package/build/schemas/manifest.schema.json +84 -1
  66. package/build/utils/minis-manifest.d.ts +2 -0
  67. package/build/utils/minis-manifest.js +8 -0
  68. package/build/utils/minis-manifest.js.map +1 -1
  69. package/build/utils/patch-package.js +4 -1
  70. package/build/utils/patch-package.js.map +1 -1
  71. package/build/utils/proxies.d.ts +11 -0
  72. package/build/utils/proxies.js +91 -0
  73. package/build/utils/proxies.js.map +1 -0
  74. package/package.json +3 -1
  75. package/scripts/graphql-codegen.ts +1 -0
  76. package/build/data/accept-invitation.d.ts +0 -4
  77. package/build/data/accept-invitation.js +0 -16
  78. package/build/data/accept-invitation.js.map +0 -1
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function assertManifestValid(): void;
3
+ export declare const command: Command;
@@ -0,0 +1,53 @@
1
+ import { Command } from 'commander';
2
+ import { renderConfirmationPrompt, renderInfo } from '@shopify/cli-kit/node/ui';
3
+ import { AbortError, handler as handleError } from '@shopify/cli-kit/node/error';
4
+ import { assertNetworkAndAuth } from '../../utils/common-tasks.js';
5
+ import { proxiesList } from '../../data/proxies/proxies-list.js';
6
+ import { validateManifest } from '../../utils/minis-manifest.js';
7
+ import { getLocalProxies, proxiesDiff, remoteProxiesToManifestProxies, } from '../../utils/proxies.js';
8
+ import { proxiesSet } from '../../data/proxies/proxies-set.js';
9
+ export function assertManifestValid() {
10
+ const { valid, errors } = validateManifest();
11
+ if (!valid) {
12
+ throw new AbortError('Manifest invalid. Errors:', errors.map(error => ` • ${error}`).join('\n'), [
13
+ ['Fix the above issues in your', { bold: 'manifest.json' }],
14
+ 'Try again and if the issue continues, contact us.',
15
+ ]);
16
+ }
17
+ }
18
+ export const command = new Command()
19
+ .name('apply')
20
+ .description('Save your proxy config')
21
+ .action(async () => {
22
+ try {
23
+ await assertNetworkAndAuth();
24
+ assertManifestValid();
25
+ // Get the remote proxies and convert them to the manifest proxy format
26
+ // This makes nicer diffs for the user (it excludes default values too)
27
+ const remoteProxies = remoteProxiesToManifestProxies(await proxiesList());
28
+ const localProxies = getLocalProxies();
29
+ const { string: diffString, changes } = proxiesDiff(remoteProxies, localProxies);
30
+ let message = 'This will overwrite your proxy configuration in production. If you have already launched your mini proceed with caution';
31
+ // Changes always has at least one entry, >= 2 entries indicates something changed
32
+ if (changes.length === 1) {
33
+ message = `No changes found`;
34
+ }
35
+ else {
36
+ renderInfo({
37
+ headline: 'Changes that will be applied',
38
+ body: [diffString],
39
+ });
40
+ }
41
+ const shouldContinue = await renderConfirmationPrompt({
42
+ defaultValue: false,
43
+ message: [`${message}. Are you sure you want to continue?`],
44
+ });
45
+ if (!shouldContinue)
46
+ return;
47
+ await proxiesSet({ proxies: localProxies });
48
+ }
49
+ catch (error) {
50
+ handleError(error);
51
+ }
52
+ });
53
+ //# sourceMappingURL=apply.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply.js","sourceRoot":"","sources":["../../../src/commands/proxies/apply.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AACjC,OAAO,EAAC,wBAAwB,EAAE,UAAU,EAAC,MAAM,0BAA0B,CAAA;AAC7E,OAAO,EAAC,UAAU,EAAE,OAAO,IAAI,WAAW,EAAC,MAAM,6BAA6B,CAAA;AAE9E,OAAO,EAAC,oBAAoB,EAAC,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAC,WAAW,EAAC,MAAM,oCAAoC,CAAA;AAC9D,OAAO,EAAC,gBAAgB,EAAC,MAAM,+BAA+B,CAAA;AAC9D,OAAO,EACL,eAAe,EACf,WAAW,EACX,8BAA8B,GAC/B,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAC,UAAU,EAAC,MAAM,mCAAmC,CAAA;AAE5D,MAAM,UAAU,mBAAmB;IACjC,MAAM,EAAC,KAAK,EAAE,MAAM,EAAC,GAAG,gBAAgB,EAAE,CAAA;IAE1C,IAAI,CAAC,KAAK,EAAE;QACV,MAAM,IAAI,UAAU,CAClB,2BAA2B,EAC3B,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI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gram: Command): void;
@@ -0,0 +1,14 @@
1
+ import { Command } from 'commander';
2
+ import { command as applyCommand } from './apply.js';
3
+ import { command as listCommand } from './list.js';
4
+ import { command as pullCommand } from './pull.js';
5
+ export function loadCommand(parentProgram) {
6
+ const command = new Command()
7
+ .name('proxies')
8
+ .description('Manage proxy configuration')
9
+ .addCommand(applyCommand)
10
+ .addCommand(listCommand)
11
+ .addCommand(pullCommand);
12
+ parentProgram.addCommand(command);
13
+ }
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/proxies/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AAEjC,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,MAAM,YAAY,CAAA;AAClD,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,WAAW,CAAA;AAChD,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,WAAW,CAAA;AAEhD,MAAM,UAAU,WAAW,CAAC,aAAsB;IAChD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE;SAC1B,IAAI,CAAC,SAAS,CAAC;SACf,WAAW,CAAC,4BAA4B,CAAC;SACzC,UAAU,CAAC,YAAY,CAAC;SACxB,UAAU,CAAC,WAAW,CAAC;SACvB,UAAU,CAAC,WAAW,CAAC,CAAA;IAE1B,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;AACnC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare const command: Command;
@@ -0,0 +1,48 @@
1
+ import { Command } from 'commander';
2
+ import { renderInfo } from '@shopify/cli-kit/node/ui';
3
+ import { handler as handleError } from '@shopify/cli-kit/node/error';
4
+ import { proxiesList } from '../../data/proxies/proxies-list.js';
5
+ import { assertNetworkAndAuth } from '../../utils/common-tasks.js';
6
+ import { getLocalProxies, proxiesDiff, remoteProxiesToManifestProxies, } from '../../utils/proxies.js';
7
+ import { getRunBinCommand } from '../../utils/package-manager.js';
8
+ export const command = new Command()
9
+ .name('list')
10
+ .description('Show the proxies used by your Shop Mini')
11
+ .action(async () => {
12
+ try {
13
+ await assertNetworkAndAuth();
14
+ // Get the remote proxies and convert them to the manifest proxy format
15
+ // This makes nicer diffs for the user (it excludes default values too)
16
+ const remoteProxies = remoteProxiesToManifestProxies(await proxiesList());
17
+ const localProxies = getLocalProxies();
18
+ const { string: diffString, changes } = proxiesDiff(remoteProxies, localProxies);
19
+ if (remoteProxies.length === 0 && localProxies.length === 0) {
20
+ renderInfo({
21
+ headline: 'No proxies found',
22
+ });
23
+ }
24
+ else if (changes.length === 1) {
25
+ renderInfo({
26
+ headline: 'Proxy config is in sync',
27
+ body: JSON.stringify(remoteProxies, null, 2),
28
+ });
29
+ }
30
+ else {
31
+ renderInfo({
32
+ headline: 'Changes found. Local proxy config has not been applied. See diff below:',
33
+ body: [diffString],
34
+ nextSteps: [
35
+ [
36
+ 'Run',
37
+ { command: await getRunBinCommand('shop-minis proxies apply') },
38
+ 'to apply the proxy config to your mini',
39
+ ],
40
+ ],
41
+ });
42
+ }
43
+ }
44
+ catch (error) {
45
+ handleError(error);
46
+ }
47
+ });
48
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/proxies/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AACjC,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAA;AACnD,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,6BAA6B,CAAA;AAElE,OAAO,EAAC,WAAW,EAAC,MAAM,oCAAoC,CAAA;AAC9D,OAAO,EAAC,oBAAoB,EAAC,MAAM,6BAA6B,CAAA;AAChE,OAAO,EACL,eAAe,EACf,WAAW,EACX,8BAA8B,GAC/B,MAAM,wBAAwB,CAAA;AAC/B,OAAO,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0 +1,34 @@
1
+ import { Command } from 'commander';
2
+ import { renderConfirmationPrompt, renderSuccess } from '@shopify/cli-kit/node/ui';
3
+ import { handler as handleError } from '@shopify/cli-kit/node/error';
4
+ import { assertNetworkAndAuth } from '../../utils/common-tasks.js';
5
+ import { proxiesList } from '../../data/proxies/proxies-list.js';
6
+ import { setMiniManifestProxies } from '../../utils/minis-manifest.js';
7
+ import { remoteProxiesToManifestProxies } from '../../utils/proxies.js';
8
+ export const command = new Command()
9
+ .name('pull')
10
+ .description('Sync your local proxy configuration with the remote')
11
+ .action(async () => {
12
+ try {
13
+ await assertNetworkAndAuth();
14
+ const shouldContinue = await renderConfirmationPrompt({
15
+ message: [
16
+ 'This will overwrite your local proxy configuration with the remote configuration. Are you sure you want to continue?',
17
+ ],
18
+ });
19
+ if (!shouldContinue)
20
+ return;
21
+ const remoteProxies = remoteProxiesToManifestProxies(await proxiesList());
22
+ setMiniManifestProxies(remoteProxies);
23
+ renderSuccess({
24
+ headline: 'Proxy configuration synced',
25
+ body: [
26
+ 'Your manifest.json has been updated with the remote proxy configuration.',
27
+ ],
28
+ });
29
+ }
30
+ catch (error) {
31
+ handleError(error);
32
+ }
33
+ });
34
+ //# sourceMappingURL=pull.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pull.js","sourceRoot":"","sources":["../../../src/commands/proxies/pull.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AACjC,OAAO,EAAC,wBAAwB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAA;AAChF,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,6BAA6B,CAAA;AAElE,OAAO,EAAC,oBAAoB,EAAC,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAC,WAAW,EAAC,MAAM,oCAAoC,CAAA;AAC9D,OAAO,EAAC,sBAAsB,EAAC,MAAM,+BAA+B,CAAA;AACpE,OAAO,EAAC,8BAA8B,EAAC,MAAM,wBAAwB,CAAA;AAErE,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE;KACjC,IAAI,CAAC,MAAM,CAAC;KACZ,WAAW,CAAC,qDAAqD,CAAC;KAClE,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,IAAI;QACF,MAAM,oBAAoB,EAAE,CAAA;QAE5B,MAAM,cAAc,GAAG,MAAM,wBAAwB,CAAC;YACpD,OAAO,EAAE;gBACP,sHAAsH;aACvH;SACF,CAAC,CAAA;QAEF,IAAI,CAAC,cAAc;YAAE,OAAM;QAE3B,MAAM,aAAa,GAAG,8BAA8B,CAAC,MAAM,WAAW,EAAE,CAAC,CAAA;QAEzE,sBAAsB,CAAC,aAAa,CAAC,CAAA;QAErC,aAAa,CAAC;YACZ,QAAQ,EAAE,4BAA4B;YACtC,IAAI,EAAE;gBACJ,0EAA0E;aAC3E;SACF,CAAC,CAAA;KACH;IAAC,OAAO,KAAK,EAAE;QACd,WAAW,CAAC,KAAK,CAAC,CAAA;KACnB;AACH,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare const command: Command;
@@ -0,0 +1,53 @@
1
+ import { Command } from 'commander';
2
+ import { renderError, renderSuccess } from '@shopify/cli-kit/node/ui';
3
+ import { handler as handleError } from '@shopify/cli-kit/node/error';
4
+ import { secretDelete } from '../../data/secrets/secret-delete.js';
5
+ import { assertNetworkAndAuth } from '../../utils/common-tasks.js';
6
+ import { getRunBinCommand } from '../../utils/package-manager.js';
7
+ export const command = new Command()
8
+ .name('delete')
9
+ .description('Delete a secret from your Shop Mini')
10
+ .argument('[secret key]', 'the key of the secret')
11
+ .action(async (secretKeyArg) => {
12
+ try {
13
+ if (!secretKeyArg) {
14
+ const exampleCommand = await getRunBinCommand('shop-minis secrets delete my-secret-key');
15
+ renderError({
16
+ headline: 'Missing secret key',
17
+ body: [
18
+ 'Please provide a secret key.\nExample:',
19
+ {
20
+ bold: exampleCommand,
21
+ },
22
+ ],
23
+ });
24
+ return;
25
+ }
26
+ await assertNetworkAndAuth();
27
+ const { userErrors } = await secretDelete({
28
+ key: secretKeyArg,
29
+ });
30
+ if (userErrors.length > 0) {
31
+ renderError({
32
+ headline: 'Error deleting a secret',
33
+ body: userErrors.map(error => error.message),
34
+ });
35
+ }
36
+ else {
37
+ renderSuccess({
38
+ headline: 'Secret deleted',
39
+ body: [
40
+ 'Secret key',
41
+ {
42
+ bold: secretKeyArg,
43
+ },
44
+ 'has been deleted from your Shop Mini.',
45
+ ],
46
+ });
47
+ }
48
+ }
49
+ catch (error) {
50
+ handleError(error);
51
+ }
52
+ });
53
+ //# sourceMappingURL=delete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../src/commands/secrets/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AACjC,OAAO,EAAC,WAAW,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAA;AACnE,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,6BAA6B,CAAA;AAElE,OAAO,EAAC,YAAY,EAAC,MAAM,qCAAqC,CAAA;AAChE,OAAO,EAAC,oBAAoB,EAAC,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAC,gBAAgB,EAAC,MAAM,gCAAgC,CAAA;AAE/D,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE;KACjC,IAAI,CAAC,QAAQ,CAAC;KACd,WAAW,CAAC,qCAAqC,CAAC;KAClD,QAAQ,CAAC,cAAc,EAAE,uBAAuB,CAAC;KACjD,MAAM,CAAC,KAAK,EAAE,YAAqB,EAAE,EAAE;IACtC,IAAI;QACF,IAAI,CAAC,YAAY,EAAE;YACjB,MAAM,cAAc,GAAG,MAAM,gBAAgB,CAC3C,yCAAyC,CAC1C,CAAA;YACD,WAAW,CAAC;gBACV,QAAQ,EAAE,oBAAoB;gBAC9B,IAAI,EAAE;oBACJ,wCAAwC;oBACxC;wBACE,IAAI,EAAE,cAAc;qBACrB;iBACF;aACF,CAAC,CAAA;YACF,OAAM;SACP;QAED,MAAM,oBAAoB,EAAE,CAAA;QAE5B,MAAM,EAAC,UAAU,EAAC,GAAG,MAAM,YAAY,CAAC;YACtC,GAAG,EAAE,YAAY;SAClB,CAAC,CAAA;QAEF,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;YACzB,WAAW,CAAC;gBACV,QAAQ,EAAE,yBAAyB;gBACnC,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC;aAC7C,CAAC,CAAA;SACH;aAAM;YACL,aAAa,CAAC;gBACZ,QAAQ,EAAE,gBAAgB;gBAC1B,IAAI,EAAE;oBACJ,YAAY;oBACZ;wBACE,IAAI,EAAE,YAAY;qBACnB;oBACD,uCAAuC;iBACxC;aACF,CAAC,CAAA;SACH;KACF;IAAC,OAAO,KAAK,EAAE;QACd,WAAW,CAAC,KAAK,CAAC,CAAA;KACnB;AACH,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function loadCommand(parentProgram: Command): void;
@@ -0,0 +1,14 @@
1
+ import { Command } from 'commander';
2
+ import { command as listCommand } from './list.js';
3
+ import { command as setCommand } from './set.js';
4
+ import { command as deleteCommand } from './delete.js';
5
+ export function loadCommand(parentProgram) {
6
+ const command = new Command()
7
+ .name('secrets')
8
+ .description('Manage stored sensitive data for your Shop Mini')
9
+ .addCommand(listCommand)
10
+ .addCommand(setCommand)
11
+ .addCommand(deleteCommand);
12
+ parentProgram.addCommand(command);
13
+ }
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/secrets/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AAEjC,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,WAAW,CAAA;AAChD,OAAO,EAAC,OAAO,IAAI,UAAU,EAAC,MAAM,UAAU,CAAA;AAC9C,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,MAAM,aAAa,CAAA;AAEpD,MAAM,UAAU,WAAW,CAAC,aAAsB;IAChD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE;SAC1B,IAAI,CAAC,SAAS,CAAC;SACf,WAAW,CAAC,iDAAiD,CAAC;SAC9D,UAAU,CAAC,WAAW,CAAC;SACvB,UAAU,CAAC,UAAU,CAAC;SACtB,UAAU,CAAC,aAAa,CAAC,CAAA;IAE5B,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;AACnC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare const command: Command;
@@ -0,0 +1,29 @@
1
+ import { Command } from 'commander';
2
+ import { renderInfo } from '@shopify/cli-kit/node/ui';
3
+ import { handler as handleError } from '@shopify/cli-kit/node/error';
4
+ import { secretsList } from '../../data/secrets/secrets-list.js';
5
+ import { assertNetworkAndAuth } from '../../utils/common-tasks.js';
6
+ export const command = new Command()
7
+ .name('list')
8
+ .description('List secrets of your Shop Mini')
9
+ .action(async () => {
10
+ try {
11
+ await assertNetworkAndAuth();
12
+ const secrets = await secretsList();
13
+ if (secrets.length === 0) {
14
+ renderInfo({
15
+ headline: 'No secrets available',
16
+ });
17
+ }
18
+ else {
19
+ renderInfo({
20
+ headline: 'Available secret keys',
21
+ body: secrets.map(secret => secret.key).join('\n'),
22
+ });
23
+ }
24
+ }
25
+ catch (error) {
26
+ handleError(error);
27
+ }
28
+ });
29
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/secrets/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AACjC,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAA;AACnD,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,6BAA6B,CAAA;AAElE,OAAO,EAAC,WAAW,EAAC,MAAM,oCAAoC,CAAA;AAC9D,OAAO,EAAC,oBAAoB,EAAC,MAAM,6BAA6B,CAAA;AAEhE,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE;KACjC,IAAI,CAAC,MAAM,CAAC;KACZ,WAAW,CAAC,gCAAgC,CAAC;KAC7C,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,IAAI;QACF,MAAM,oBAAoB,EAAE,CAAA;QAE5B,MAAM,OAAO,GAAG,MAAM,WAAW,EAAE,CAAA;QAEnC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;YACxB,UAAU,CAAC;gBACT,QAAQ,EAAE,sBAAsB;aACjC,CAAC,CAAA;SACH;aAAM;YACL,UAAU,CAAC;gBACT,QAAQ,EAAE,uBAAuB;gBACjC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;aACnD,CAAC,CAAA;SACH;KACF;IAAC,OAAO,KAAK,EAAE;QACd,WAAW,CAAC,KAAK,CAAC,CAAA;KACnB;AACH,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare const command: Command;
@@ -0,0 +1,57 @@
1
+ import { Command } from 'commander';
2
+ import { renderError, renderSuccess } from '@shopify/cli-kit/node/ui';
3
+ import { handler as handleError } from '@shopify/cli-kit/node/error';
4
+ import { secretSet } from '../../data/secrets/secret-set.js';
5
+ import { assertNetworkAndAuth } from '../../utils/common-tasks.js';
6
+ import { getRunBinCommand } from '../../utils/package-manager.js';
7
+ export const command = new Command()
8
+ .name('set')
9
+ .description('Set a secret for your Shop Mini')
10
+ .argument('[secret key]', 'the key of the secret')
11
+ .argument('[secret value]', 'the value of the secret')
12
+ .action(async (secretKeyArg, secretValueArg) => {
13
+ try {
14
+ if (!secretKeyArg || !secretValueArg) {
15
+ const exampleCommand = await getRunBinCommand('shop-minis secrets set my-secret-key my-secret-value');
16
+ renderError({
17
+ headline: 'Missing secret key or value',
18
+ body: [
19
+ // Below looks ugly but if the string is split into a new array item it gets an extra space character.
20
+ 'Please provide both a secret key and value.\nExample:',
21
+ {
22
+ bold: exampleCommand,
23
+ },
24
+ ],
25
+ });
26
+ return;
27
+ }
28
+ await assertNetworkAndAuth();
29
+ const { secret } = await secretSet({
30
+ key: secretKeyArg,
31
+ value: secretValueArg,
32
+ });
33
+ if (secret) {
34
+ renderSuccess({
35
+ headline: 'Secret set',
36
+ body: [
37
+ 'Secret key',
38
+ {
39
+ bold: secret.key,
40
+ },
41
+ 'has been set for your Shop Mini.',
42
+ ],
43
+ });
44
+ }
45
+ else {
46
+ renderError({
47
+ headline: 'Error setting secret',
48
+ // The API doesn't provide errors yet
49
+ body: 'Please try again.',
50
+ });
51
+ }
52
+ }
53
+ catch (error) {
54
+ handleError(error);
55
+ }
56
+ });
57
+ //# sourceMappingURL=set.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set.js","sourceRoot":"","sources":["../../../src/commands/secrets/set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AACjC,OAAO,EAAC,WAAW,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAA;AACnE,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,6BAA6B,CAAA;AAElE,OAAO,EAAC,SAAS,EAAC,MAAM,kCAAkC,CAAA;AAC1D,OAAO,EAAC,oBAAoB,EAAC,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAC,gBAAgB,EAAC,MAAM,gCAAgC,CAAA;AAE/D,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE;KACjC,IAAI,CAAC,KAAK,CAAC;KACX,WAAW,CAAC,iCAAiC,CAAC;KAC9C,QAAQ,CAAC,cAAc,EAAE,uBAAuB,CAAC;KACjD,QAAQ,CAAC,gBAAgB,EAAE,yBAAyB,CAAC;KACrD,MAAM,CAAC,KAAK,EAAE,YAAqB,EAAE,cAAuB,EAAE,EAAE;IAC/D,IAAI;QACF,IAAI,CAAC,YAAY,IAAI,CAAC,cAAc,EAAE;YACpC,MAAM,cAAc,GAAG,MAAM,gBAAgB,CAC3C,sDAAsD,CACvD,CAAA;YACD,WAAW,CAAC;gBACV,QAAQ,EAAE,6BAA6B;gBACvC,IAAI,EAAE;oBACJ,sGAAsG;oBACtG,uDAAuD;oBACvD;wBACE,IAAI,EAAE,cAAc;qBACrB;iBACF;aACF,CAAC,CAAA;YACF,OAAM;SACP;QAED,MAAM,oBAAoB,EAAE,CAAA;QAE5B,MAAM,EAAC,MAAM,EAAC,GAAG,MAAM,SAAS,CAAC;YAC/B,GAAG,EAAE,YAAY;YACjB,KAAK,EAAE,cAAc;SACtB,CAAC,CAAA;QAEF,IAAI,MAAM,EAAE;YACV,aAAa,CAAC;gBACZ,QAAQ,EAAE,YAAY;gBACtB,IAAI,EAAE;oBACJ,YAAY;oBACZ;wBACE,IAAI,EAAE,MAAM,CAAC,GAAG;qBACjB;oBACD,kCAAkC;iBACnC;aACF,CAAC,CAAA;SACH;aAAM;YACL,WAAW,CAAC;gBACV,QAAQ,EAAE,sBAAsB;gBAChC,qCAAqC;gBACrC,IAAI,EAAE,mBAAmB;aAC1B,CAAC,CAAA;SACH;KACF;IAAC,OAAO,KAAK,EAAE;QACd,WAAW,CAAC,KAAK,CAAC,CAAA;KACnB;AACH,CAAC,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare const command: Command;
3
+ export declare function loadCommand(parentProgram: Command): void;
@@ -0,0 +1,98 @@
1
+ import { Command } from 'commander';
2
+ import { renderConfirmationPrompt, renderSuccess } from '@shopify/cli-kit/node/ui';
3
+ import { AbortError, handler as handleError } from '@shopify/cli-kit/node/error';
4
+ import { DEFAULT_MANIFEST_PATH, getMiniManifest, validateManifest, } from '../../utils/minis-manifest.js';
5
+ import { assertNetworkAndAuth } from '../../utils/common-tasks.js';
6
+ import { getUserMetafiledDefinitions } from '../../data/user-metafield-definitions/get-user-metafield-definitions.js';
7
+ import { deleteUserMetafiledDefinition } from '../../data/user-metafield-definitions/delete-user-metafield-definition.js';
8
+ import { createUserMetafiledDefinition } from '../../data/user-metafield-definitions/create-user-metafield-definition.js';
9
+ import { getRunBinCommand } from '../../utils/package-manager.js';
10
+ export const command = new Command()
11
+ .name('sync-user-metafield-definitions')
12
+ .description('sync-user-metafield-definitions')
13
+ .option('--path <path>', 'the path to your manifest file', DEFAULT_MANIFEST_PATH)
14
+ .option('--verbose', 'print debugging messages')
15
+ .option('-y --yes', 'automatically answer prompts with default options')
16
+ .action(async (options) => {
17
+ try {
18
+ const localDefinitions = getMiniManifest(options.path).user_metafield_definitions ?? [];
19
+ const { errors: validateErrors } = validateManifest(options.path);
20
+ if (validateErrors.length) {
21
+ const validateManifestCmd = await getRunBinCommand('shop-minis validate-manifest');
22
+ throw new AbortError('Invalid manifest file.', `Run "${validateManifestCmd}" for more details.`);
23
+ }
24
+ await assertNetworkAndAuth();
25
+ const remoteDefinitions = await getUserMetafiledDefinitions();
26
+ const remoteDefinitionsToUpdate = remoteDefinitions.filter(remoteDefinition => {
27
+ const matchedLocalDefinition = localDefinitions.find((localDefinition) => localDefinition.key === remoteDefinition.key);
28
+ return (matchedLocalDefinition &&
29
+ (remoteDefinition.name !== matchedLocalDefinition.name ||
30
+ remoteDefinition.description !==
31
+ matchedLocalDefinition.description ||
32
+ remoteDefinition.type !== matchedLocalDefinition.type));
33
+ });
34
+ const definitionKeysToDelete = remoteDefinitions
35
+ .filter(remoteDefinition => {
36
+ return !localDefinitions.some((localDefinition) => localDefinition.key === remoteDefinition.key);
37
+ })
38
+ .map(definition => definition.key)
39
+ .concat(remoteDefinitionsToUpdate.map(definition => definition.key));
40
+ const definitionsToCreate = localDefinitions
41
+ .filter((localDefinition) => {
42
+ return !remoteDefinitions.some(remoteDefinition => remoteDefinition.key === localDefinition.key);
43
+ })
44
+ .concat(remoteDefinitionsToUpdate.map(({ key }) => localDefinitions.find((localDefinition) => localDefinition.key === key)));
45
+ if (!definitionKeysToDelete.length && !definitionsToCreate.length) {
46
+ renderSuccess({
47
+ headline: 'No changes to apply',
48
+ body: ['All user metafield definitions are already in sync.'],
49
+ });
50
+ return;
51
+ }
52
+ if (!options.yes) {
53
+ const shouldContinue = await renderConfirmationPrompt({
54
+ message: [
55
+ 'Are you sure you want to apply these user metafield definition changes?',
56
+ {
57
+ warn: 'Deleting a definition will also delete all associated metafield values.',
58
+ },
59
+ ],
60
+ infoTable: [
61
+ ...(definitionKeysToDelete.length > 0
62
+ ? [
63
+ {
64
+ header: 'Definitions to delete',
65
+ items: definitionKeysToDelete,
66
+ },
67
+ ]
68
+ : []),
69
+ ...(definitionsToCreate.length > 0
70
+ ? [
71
+ {
72
+ header: 'Definitions to create',
73
+ items: definitionsToCreate.map((definition) => JSON.stringify(definition, null, 2)),
74
+ },
75
+ ]
76
+ : []),
77
+ ],
78
+ });
79
+ if (!shouldContinue)
80
+ return;
81
+ }
82
+ definitionKeysToDelete.forEach(async (key) => {
83
+ await deleteUserMetafiledDefinition(key);
84
+ });
85
+ definitionsToCreate.forEach(async (definition) => {
86
+ await createUserMetafiledDefinition(definition);
87
+ });
88
+ }
89
+ catch (error) {
90
+ delete error.stack;
91
+ // Always output the error first
92
+ handleError(error);
93
+ }
94
+ });
95
+ export function loadCommand(parentProgram) {
96
+ parentProgram.addCommand(command);
97
+ }
98
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/sync-user-metafield-definitions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AACjC,OAAO,EAAC,wBAAwB,EAAE,aAAa,EAAC,M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E;QACnB,OAAQ,KAAe,CAAC,KAAK,CAAA;QAC7B,gCAAgC;QAChC,WAAW,CAAC,KAAK,CAAC,CAAA;KACnB;AACH,CAAC,CAAC,CAAA;AAEJ,MAAM,UAAU,WAAW,CAAC,aAAsB;IAChD,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;AACnC,CAAC"}
@@ -3,12 +3,14 @@ import { SHOP_MINIS_ADMIN_API, SHOP_MINIS_ADMIN_API_KEY, } from '../commands/con
3
3
  export const clientWithoutAuthorization = new GraphQLClient(SHOP_MINIS_ADMIN_API, {
4
4
  headers: {
5
5
  'X-Shop-Minis-Experimental': '1',
6
+ 'X-Shop-Minis-CLI': '1',
6
7
  },
7
8
  });
8
9
  export const client = new GraphQLClient(SHOP_MINIS_ADMIN_API, {
9
10
  headers: {
10
11
  Authorization: `Bearer ${SHOP_MINIS_ADMIN_API_KEY}`,
11
12
  'X-Shop-Minis-Experimental': '1',
13
+ 'X-Shop-Minis-CLI': '1',
12
14
  },
13
15
  });
14
16
  //# sourceMappingURL=gql-client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"gql-client.js","sourceRoot":"","sources":["../../src/data/gql-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAA;AAE7C,OAAO,EACL,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,uBAAuB,CAAA;AAE9B,MAAM,CAAC,MAAM,0BAA0B,GAAG,IAAI,aAAa,CACzD,oBAAoB,EACpB;IACE,OAAO,EAAE;QACP,2BAA2B,EAAE,GAAG;KACjC;CACF,CACF,CAAA;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,oBAAoB,EAAE;IAC5D,OAAO,EAAE;QACP,aAAa,EAAE,UAAU,wBAAwB,EAAE;QACnD,2BAA2B,EAAE,GAAG;KACjC;CACF,CAAC,CAAA"}
1
+ {"version":3,"file":"gql-client.js","sourceRoot":"","sources":["../../src/data/gql-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAA;AAE7C,OAAO,EACL,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,uBAAuB,CAAA;AAE9B,MAAM,CAAC,MAAM,0BAA0B,GAAG,IAAI,aAAa,CACzD,oBAAoB,EACpB;IACE,OAAO,EAAE;QACP,2BAA2B,EAAE,GAAG;QAChC,kBAAkB,EAAE,GAAG;KACxB;CACF,CACF,CAAA;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,oBAAoB,EAAE;IAC5D,OAAO,EAAE;QACP,aAAa,EAAE,UAAU,wBAAwB,EAAE;QACnD,2BAA2B,EAAE,GAAG;QAChC,kBAAkB,EAAE,GAAG;KACxB;CACF,CAAC,CAAA"}
@@ -0,0 +1,9 @@
1
+ export declare const proxiesList: () => Promise<{
2
+ __typename?: "Proxy" | undefined;
3
+ allowedMethods?: import("../types/autogenerated/shop-minis-admin-api/graphql.js").HttpRequestMethod[] | null | undefined;
4
+ appendedHeaders?: string[] | null | undefined;
5
+ bodyJsonSchema?: any;
6
+ targetUrlPattern: string;
7
+ userRateLimitInterval?: number | null | undefined;
8
+ userRateLimitRequests?: number | null | undefined;
9
+ }[]>;
@@ -0,0 +1,19 @@
1
+ import { graphql } from '../types/autogenerated/shop-minis-admin-api/gql.js';
2
+ import { client } from '../gql-client.js';
3
+ const proxiesQuery = graphql(/* GraphQL */ `
4
+ query Proxies {
5
+ proxies {
6
+ allowedMethods
7
+ appendedHeaders
8
+ bodyJsonSchema
9
+ targetUrlPattern
10
+ userRateLimitInterval
11
+ userRateLimitRequests
12
+ }
13
+ }
14
+ `);
15
+ export const proxiesList = async () => {
16
+ const data = await client.request(proxiesQuery);
17
+ return data.proxies;
18
+ };
19
+ //# sourceMappingURL=proxies-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxies-list.js","sourceRoot":"","sources":["../../../src/data/proxies/proxies-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,oDAAoD,CAAA;AAC1E,OAAO,EAAC,MAAM,EAAC,MAAM,kBAAkB,CAAA;AAEvC,MAAM,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;;;;;;;;;;;CAW1C,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,IAAI,EAAE;IACpC,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;IAE/C,OAAO,IAAI,CAAC,OAAO,CAAA;AACrB,CAAC,CAAA"}
@@ -0,0 +1,5 @@
1
+ import { ProxyInput } from '../types/autogenerated/shop-minis-admin-api/graphql.js';
2
+ export interface ProxiesSetParameters {
3
+ proxies: ProxyInput[];
4
+ }
5
+ export declare const proxiesSet: ({ proxies }: ProxiesSetParameters) => Promise<import("../types/autogenerated/shop-minis-admin-api/graphql.js").ProxiesSetMutation>;
@@ -0,0 +1,18 @@
1
+ import { graphql } from '../types/autogenerated/shop-minis-admin-api/gql.js';
2
+ import { client } from '../gql-client.js';
3
+ const proxiesSetQuery = graphql(/* GraphQL */ `
4
+ mutation ProxiesSet($proxies: [ProxyInput!]!) {
5
+ proxiesSet(proxies: $proxies) {
6
+ proxies {
7
+ targetUrlPattern
8
+ }
9
+ }
10
+ }
11
+ `);
12
+ export const proxiesSet = async ({ proxies }) => {
13
+ const data = await client.request(proxiesSetQuery, {
14
+ proxies,
15
+ });
16
+ return data;
17
+ };
18
+ //# sourceMappingURL=proxies-set.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxies-set.js","sourceRoot":"","sources":["../../../src/data/proxies/proxies-set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,oDAAoD,CAAA;AAE1E,OAAO,EAAC,MAAM,EAAC,MAAM,kBAAkB,CAAA;AAEvC,MAAM,eAAe,GAAG,OAAO,CAAC,aAAa,CAAC;;;;;;;;CAQ7C,CAAC,CAAA;AAMF,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,EAAE,EAAC,OAAO,EAAuB,EAAE,EAAE;IAClE,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,eAAe,EAAE;QACjD,OAAO;KACR,CAAC,CAAA;IAEF,OAAO,IAAI,CAAA;AACb,CAAC,CAAA"}
@@ -0,0 +1,10 @@
1
+ import type { Proxy, HttpRequestMethod } from '../types/autogenerated/shop-minis-admin-api/graphql.js';
2
+ export type RemoteProxy = Proxy;
3
+ export interface ManifestProxy {
4
+ targetUrlPattern: string;
5
+ allowedMethods?: HttpRequestMethod[];
6
+ appendedHeaders?: string[];
7
+ bodyJsonSchema?: any;
8
+ userRateLimitInterval?: number;
9
+ userRateLimitRequests?: number;
10
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/data/proxies/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ export interface SecretSetParameters {
2
+ key: string;
3
+ }
4
+ export declare const secretDelete: ({ key }: SecretSetParameters) => Promise<{
5
+ __typename?: "SecretDeletePayload" | undefined;
6
+ userErrors: {
7
+ __typename?: "SecretDeleteUserError" | undefined;
8
+ code: import("../types/autogenerated/shop-minis-admin-api/graphql.js").SecretDeleteUserErrorCode;
9
+ field?: string[] | null | undefined;
10
+ message: string;
11
+ }[];
12
+ }>;