@shopify/cli-kit 3.32.0 → 3.32.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.
Files changed (108) hide show
  1. package/dist/api.d.ts +2 -5
  2. package/dist/api.js +2 -5
  3. package/dist/api.js.map +1 -1
  4. package/dist/http/fetch.js +1 -1
  5. package/dist/http/fetch.js.map +1 -1
  6. package/dist/http.d.ts +0 -1
  7. package/dist/http.js +0 -1
  8. package/dist/http.js.map +1 -1
  9. package/dist/index.d.ts +0 -5
  10. package/dist/index.js +0 -5
  11. package/dist/index.js.map +1 -1
  12. package/dist/npm.js +1 -1
  13. package/dist/npm.js.map +1 -1
  14. package/dist/private/node/analytics.js +2 -2
  15. package/dist/private/node/analytics.js.map +1 -1
  16. package/dist/private/node/api/graphql.d.ts +5 -0
  17. package/dist/private/node/api/graphql.js +63 -0
  18. package/dist/private/node/api/graphql.js.map +1 -0
  19. package/dist/{api/common.d.ts → private/node/api/headers.d.ts} +3 -8
  20. package/dist/{api/common.js → private/node/api/headers.js} +20 -60
  21. package/dist/private/node/api/headers.js.map +1 -0
  22. package/dist/private/node/ui/components/FullScreen.js +11 -9
  23. package/dist/private/node/ui/components/FullScreen.js.map +1 -1
  24. package/dist/private/node/ui/components/SelectPrompt.js +15 -3
  25. package/dist/private/node/ui/components/SelectPrompt.js.map +1 -1
  26. package/dist/private/node/ui/components/Table.js +1 -1
  27. package/dist/private/node/ui/components/Table.js.map +1 -1
  28. package/dist/public/common/collection.js.map +1 -1
  29. package/dist/public/common/object.js +3 -3
  30. package/dist/public/common/object.js.map +1 -1
  31. package/dist/public/common/string.d.ts +55 -1
  32. package/dist/public/common/string.js +93 -1
  33. package/dist/public/common/string.js.map +1 -1
  34. package/dist/public/node/api/admin.d.ts +11 -0
  35. package/dist/public/node/api/admin.js +70 -0
  36. package/dist/public/node/api/admin.js.map +1 -0
  37. package/dist/public/node/api/oxygen.d.ts +22 -0
  38. package/dist/public/node/api/oxygen.js +40 -0
  39. package/dist/public/node/api/oxygen.js.map +1 -0
  40. package/dist/{api → public/node/api}/partners.d.ts +11 -3
  41. package/dist/public/node/api/partners.js +40 -0
  42. package/dist/public/node/api/partners.js.map +1 -0
  43. package/dist/public/node/base-command.js +1 -1
  44. package/dist/public/node/base-command.js.map +1 -1
  45. package/dist/public/node/crypto.d.ts +42 -0
  46. package/dist/public/node/crypto.js +55 -0
  47. package/dist/public/node/crypto.js.map +1 -0
  48. package/dist/{template.d.ts → public/node/liquid.d.ts} +10 -2
  49. package/dist/{template.js → public/node/liquid.js} +18 -13
  50. package/dist/public/node/liquid.js.map +1 -0
  51. package/dist/public/node/os.d.ts +16 -0
  52. package/dist/{os.js → public/node/os.js} +33 -28
  53. package/dist/public/node/os.js.map +1 -0
  54. package/dist/public/node/presets.js +2 -2
  55. package/dist/public/node/presets.js.map +1 -1
  56. package/dist/public/node/ruby.d.ts +11 -7
  57. package/dist/public/node/ruby.js +89 -21
  58. package/dist/public/node/ruby.js.map +1 -1
  59. package/dist/public/node/tcp.d.ts +2 -0
  60. package/dist/public/node/tcp.js +9 -0
  61. package/dist/public/node/tcp.js.map +1 -1
  62. package/dist/public/node/toml.d.ts +15 -0
  63. package/dist/public/node/toml.js +20 -0
  64. package/dist/public/node/toml.js.map +1 -0
  65. package/dist/public/node/vscode.d.ts +14 -0
  66. package/dist/{vscode.js → public/node/vscode.js} +13 -7
  67. package/dist/public/node/vscode.js.map +1 -0
  68. package/dist/session/authorize.d.ts +4 -0
  69. package/dist/session/authorize.js +7 -2
  70. package/dist/session/authorize.js.map +1 -1
  71. package/dist/{api/identity.d.ts → session/identity-token-validation.d.ts} +0 -0
  72. package/dist/{api/identity.js → session/identity-token-validation.js} +1 -1
  73. package/dist/session/identity-token-validation.js.map +1 -0
  74. package/dist/session/schema.d.ts +18 -18
  75. package/dist/session/store.js +1 -1
  76. package/dist/session/store.js.map +1 -1
  77. package/dist/session.js +3 -3
  78. package/dist/session.js.map +1 -1
  79. package/dist/system.js +1 -1
  80. package/dist/system.js.map +1 -1
  81. package/dist/tsconfig.tsbuildinfo +1 -1
  82. package/dist/ui/inquirer/autocomplete.js +1 -1
  83. package/dist/ui/inquirer/autocomplete.js.map +1 -1
  84. package/package.json +2 -1
  85. package/dist/api/admin.d.ts +0 -3
  86. package/dist/api/admin.js +0 -56
  87. package/dist/api/admin.js.map +0 -1
  88. package/dist/api/common.js.map +0 -1
  89. package/dist/api/identity.js.map +0 -1
  90. package/dist/api/oxygen.d.ts +0 -5
  91. package/dist/api/oxygen.js +0 -30
  92. package/dist/api/oxygen.js.map +0 -1
  93. package/dist/api/partners.js +0 -44
  94. package/dist/api/partners.js.map +0 -1
  95. package/dist/http/graphql.d.ts +0 -13
  96. package/dist/http/graphql.js +0 -12
  97. package/dist/http/graphql.js.map +0 -1
  98. package/dist/os.d.ts +0 -11
  99. package/dist/os.js.map +0 -1
  100. package/dist/string.d.ts +0 -28
  101. package/dist/string.js +0 -77
  102. package/dist/string.js.map +0 -1
  103. package/dist/template.js.map +0 -1
  104. package/dist/toml.d.ts +0 -3
  105. package/dist/toml.js +0 -8
  106. package/dist/toml.js.map +0 -1
  107. package/dist/vscode.d.ts +0 -8
  108. package/dist/vscode.js.map +0 -1
package/dist/api.d.ts CHANGED
@@ -1,6 +1,3 @@
1
- import * as admin from './api/admin.js';
2
- import * as partners from './api/partners.js';
3
1
  import * as graphql from './api/graphql/index.js';
4
- import * as identity from './api/identity.js';
5
- import * as oxygen from './api/oxygen.js';
6
- export { admin, partners, graphql, identity, oxygen };
2
+ import * as identity from './session/identity-token-validation.js';
3
+ export { graphql, identity };
package/dist/api.js CHANGED
@@ -1,7 +1,4 @@
1
- import * as admin from './api/admin.js';
2
- import * as partners from './api/partners.js';
3
1
  import * as graphql from './api/graphql/index.js';
4
- import * as identity from './api/identity.js';
5
- import * as oxygen from './api/oxygen.js';
6
- export { admin, partners, graphql, identity, oxygen };
2
+ import * as identity from './session/identity-token-validation.js';
3
+ export { graphql, identity };
7
4
  //# sourceMappingURL=api.js.map
package/dist/api.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAA;AACvC,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAA;AACjD,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AAEzC,OAAO,EAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAC,CAAA","sourcesContent":["import * as admin from './api/admin.js'\nimport * as partners from './api/partners.js'\nimport * as graphql from './api/graphql/index.js'\nimport * as identity from './api/identity.js'\nimport * as oxygen from './api/oxygen.js'\n\nexport {admin, partners, graphql, identity, oxygen}\n"]}
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAA;AACjD,OAAO,KAAK,QAAQ,MAAM,wCAAwC,CAAA;AAElE,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,CAAA","sourcesContent":["import * as graphql from './api/graphql/index.js'\nimport * as identity from './session/identity-token-validation.js'\n\nexport {graphql, identity}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { httpsAgent } from '../http.js';
2
- import { buildHeaders, sanitizedHeadersOutput } from '../api/common.js';
3
2
  import { content, debug } from '../output.js';
3
+ import { buildHeaders, sanitizedHeadersOutput } from '../private/node/api/headers.js';
4
4
  import nodeFetch from 'node-fetch';
5
5
  import { performance } from 'perf_hooks';
6
6
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../src/http/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAA;AACrC,O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E,CAAC,KAAK,CAAC,CAAA;IAC3G,OAAO,QAAQ,CAAA;AACjB,CAAC","sourcesContent":["import {httpsAgent} from '../http.js'\nimport {buildHeaders, sanitizedHeadersOutput} from '../api/common.js'\nimport {content, debug} from '../output.js'\nimport nodeFetch from 'node-fetch'\nimport {performance} from 'perf_hooks'\nimport type {RequestInfo, RequestInit} from 'node-fetch'\n\ntype Response = ReturnType<typeof nodeFetch>\n/**\n * An interface that abstracts way node-fetch. When Node has built-in\n * support for \"fetch\" in the standard library, we can drop the node-fetch\n * dependency from here.\n * Note that we are exposing types from \"node-fetch\". The reason being is that\n * they are consistent with the Web API so if we drop node-fetch in the future\n * it won't require changes from the callers.\n * @param url - This defines the resource that you wish to fetch.\n * @param init - An object containing any custom settings that you want to apply to the request\n * @returns A promise that resolves with the response.\n */\nexport default async function fetch(url: RequestInfo, init?: RequestInit): Response {\n const response = await nodeFetch(url, init)\n return response\n}\n\n/**\n * A fetch function to use with Shopify services. The function ensures the right\n * TLS configuragion is used based on the environment in which the service is running\n * (e.g. spin)\n */\nexport async function shopifyFetch(url: RequestInfo, init?: RequestInit): Response {\n const options: RequestInit = {\n ...(init ?? {}),\n headers: {\n ...(await buildHeaders()),\n ...(init?.headers ?? {}),\n },\n }\n\n debug(content`\nSending ${options.method ?? 'GET'} request to URL ${url.toString()} and headers:\n${sanitizedHeadersOutput((options?.headers ?? {}) as {[header: string]: string})}\n`)\n const t0 = performance.now()\n const response = await nodeFetch(url, {...init, agent: await httpsAgent()})\n const t1 = performance.now()\n debug(`Request to ${url.toString()} completed with status ${response.status} in ${Math.round(t1 - t0)} ms`)\n return response\n}\n"]}
1
+ {"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../src/http/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAA;AACrC,OAAO,EAAC,OAAO,EAAE,KAAK,EAAC,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAC,YAAY,EAAE,sBAAsB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js'\nimport {content, debug} from '../output.js'\nimport {buildHeaders, sanitizedHeadersOutput} from '../private/node/api/headers.js'\nimport nodeFetch from 'node-fetch'\nimport {performance} from 'perf_hooks'\nimport type {RequestInfo, RequestInit} from 'node-fetch'\n\ntype Response = ReturnType<typeof nodeFetch>\n/**\n * An interface that abstracts way node-fetch. When Node has built-in\n * support for \"fetch\" in the standard library, we can drop the node-fetch\n * dependency from here.\n * Note that we are exposing types from \"node-fetch\". The reason being is that\n * they are consistent with the Web API so if we drop node-fetch in the future\n * it won't require changes from the callers.\n * @param url - This defines the resource that you wish to fetch.\n * @param init - An object containing any custom settings that you want to apply to the request\n * @returns A promise that resolves with the response.\n */\nexport default async function fetch(url: RequestInfo, init?: RequestInit): Response {\n const response = await nodeFetch(url, init)\n return response\n}\n\n/**\n * A fetch function to use with Shopify services. The function ensures the right\n * TLS configuragion is used based on the environment in which the service is running\n * (e.g. spin)\n */\nexport async function shopifyFetch(url: RequestInfo, init?: RequestInit): Response {\n const options: RequestInit = {\n ...(init ?? {}),\n headers: {\n ...(await buildHeaders()),\n ...(init?.headers ?? {}),\n },\n }\n\n debug(content`\nSending ${options.method ?? 'GET'} request to URL ${url.toString()} and headers:\n${sanitizedHeadersOutput((options?.headers ?? {}) as {[header: string]: string})}\n`)\n const t0 = performance.now()\n const response = await nodeFetch(url, {...init, agent: await httpsAgent()})\n const t1 = performance.now()\n debug(`Request to ${url.toString()} completed with status ${response.status} in ${Math.round(t1 - t0)} ms`)\n return response\n}\n"]}
package/dist/http.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import https from 'https';
3
3
  export { default as fetch } from './http/fetch.js';
4
- export { graphqlClient } from './http/graphql.js';
5
4
  export { shopifyFetch } from './http/fetch.js';
6
5
  export { default as formData } from './http/formdata.js';
7
6
  export { createApp, createRouter, IncomingMessage, ServerResponse, CompatibilityEvent, createError, send, sendError, sendRedirect, H3Error, } from 'h3';
package/dist/http.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import { serviceEnvironment } from './environment/service.js';
2
2
  import https from 'https';
3
3
  export { default as fetch } from './http/fetch.js';
4
- export { graphqlClient } from './http/graphql.js';
5
4
  export { shopifyFetch } from './http/fetch.js';
6
5
  export { default as formData } from './http/formdata.js';
7
6
  export { createApp, createRouter, createError, send, sendError, sendRedirect, H3Error, } from 'h3';
package/dist/http.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,0BAA0B,CAAA;AAC3D,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAC,OAAO,IAAI,KAAK,EAAC,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAC,OAAO,IAAI,QAAQ,EAAC,MAAM,oBAAoB,CAAA;AAEtD,OAAO,EACL,SAAS,EACT,YAAY,EAIZ,WAAW,EACX,IAAI,EACJ,SAAS,EACT,YAAY,EACZ,OAAO,GACR,MAAM,IAAI,CAAA;AAEX;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU;IAC9B,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,EAAC,kBAAkB,EAAE,MAAM,gCAAgC,EAAE,EAAC,CAAC,CAAA;AACxF,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,gCAAgC;IACpD,OAAO,CAAC,MAAM,kBAAkB,EAAE,CAAC,KAAK,MAAM,CAAA;AAChD,CAAC","sourcesContent":["import {serviceEnvironment} from './environment/service.js'\nimport https from 'https'\n\nexport {default as fetch} from './http/fetch.js'\nexport {graphqlClient} from './http/graphql.js'\nexport {shopifyFetch} from './http/fetch.js'\nexport {default as formData} from './http/formdata.js'\n\nexport {\n createApp,\n createRouter,\n IncomingMessage,\n ServerResponse,\n CompatibilityEvent,\n createError,\n send,\n sendError,\n sendRedirect,\n H3Error,\n} from 'h3'\n\n/**\n * This utility function returns the https.Agent to use for a given service. The agent\n * includes the right configuration based on the service's environment. For example,\n * if the service is running in a Spin environment, the attribute \"rejectUnauthorized\" is\n * set to false\n */\nexport async function httpsAgent() {\n return new https.Agent({rejectUnauthorized: await shouldRejectUnauthorizedRequests()})\n}\n\n/**\n * Spin stores the CA certificate in the keychain and it should be used when sending HTTP\n * requests to Spin instances. However, Node doesn't read certificates from the Keychain\n * by default, which leads to Shopifolks running into issues that they workaround by setting the\n * NODE_TLS_REJECT_UNAUTHORIZED=0 environment variable, which applies to all the HTTP\n * requests sent from the CLI (context: https://github.com/nodejs/node/issues/39657)\n * This utility function allows controlling the behavior in a per-service level by returning\n * the value of for the \"rejectUnauthorized\" attribute that's used in the https agent.\n *\n * @returns A promise that resolves with a boolean indicating whether\n * unauthorized requests should be rejected or not.\n */\nexport async function shouldRejectUnauthorizedRequests(): Promise<boolean> {\n return (await serviceEnvironment()) !== 'spin'\n}\n"]}
1
+ {"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,0BAA0B,CAAA;AAC3D,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAC,OAAO,IAAI,KAAK,EAAC,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAC,OAAO,IAAI,QAAQ,EAAC,MAAM,oBAAoB,CAAA;AAEtD,OAAO,EACL,SAAS,EACT,YAAY,EAIZ,WAAW,EACX,IAAI,EACJ,SAAS,EACT,YAAY,EACZ,OAAO,GACR,MAAM,IAAI,CAAA;AAEX;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU;IAC9B,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,EAAC,kBAAkB,EAAE,MAAM,gCAAgC,EAAE,EAAC,CAAC,CAAA;AACxF,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,gCAAgC;IACpD,OAAO,CAAC,MAAM,kBAAkB,EAAE,CAAC,KAAK,MAAM,CAAA;AAChD,CAAC","sourcesContent":["import {serviceEnvironment} from './environment/service.js'\nimport https from 'https'\n\nexport {default as fetch} from './http/fetch.js'\nexport {shopifyFetch} from './http/fetch.js'\nexport {default as formData} from './http/formdata.js'\n\nexport {\n createApp,\n createRouter,\n IncomingMessage,\n ServerResponse,\n CompatibilityEvent,\n createError,\n send,\n sendError,\n sendRedirect,\n H3Error,\n} from 'h3'\n\n/**\n * This utility function returns the https.Agent to use for a given service. The agent\n * includes the right configuration based on the service's environment. For example,\n * if the service is running in a Spin environment, the attribute \"rejectUnauthorized\" is\n * set to false\n */\nexport async function httpsAgent() {\n return new https.Agent({rejectUnauthorized: await shouldRejectUnauthorizedRequests()})\n}\n\n/**\n * Spin stores the CA certificate in the keychain and it should be used when sending HTTP\n * requests to Spin instances. However, Node doesn't read certificates from the Keychain\n * by default, which leads to Shopifolks running into issues that they workaround by setting the\n * NODE_TLS_REJECT_UNAUTHORIZED=0 environment variable, which applies to all the HTTP\n * requests sent from the CLI (context: https://github.com/nodejs/node/issues/39657)\n * This utility function allows controlling the behavior in a per-service level by returning\n * the value of for the \"rejectUnauthorized\" attribute that's used in the https agent.\n *\n * @returns A promise that resolves with a boolean indicating whether\n * unauthorized requests should be rejected or not.\n */\nexport async function shouldRejectUnauthorizedRequests(): Promise<boolean> {\n return (await serviceEnvironment()) !== 'spin'\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -7,19 +7,14 @@ export * as file from './file.js';
7
7
  export * as git from './git.js';
8
8
  export * as http from './http.js';
9
9
  export * as npm from './npm.js';
10
- export * as os from './os.js';
11
10
  export * as output from './output.js';
12
11
  export * as path from './path.js';
13
12
  export * as plugins from './plugins.js';
14
13
  export * as schema from './schema.js';
15
14
  export * as session from './session.js';
16
15
  export * as store from './store.js';
17
- export * as string from './string.js';
18
16
  export * as system from './system.js';
19
- export * as template from './template.js';
20
- export * as toml from './toml.js';
21
17
  export * as ui from './ui.js';
22
- export * as vscode from './vscode.js';
23
18
  export * as outputMocker from './testing/output.js';
24
19
  export * as metadata from './metadata.js';
25
20
  export * as monorail from './monorail.js';
package/dist/index.js CHANGED
@@ -7,19 +7,14 @@ export * as file from './file.js';
7
7
  export * as git from './git.js';
8
8
  export * as http from './http.js';
9
9
  export * as npm from './npm.js';
10
- export * as os from './os.js';
11
10
  export * as output from './output.js';
12
11
  export * as path from './path.js';
13
12
  export * as plugins from './plugins.js';
14
13
  export * as schema from './schema.js';
15
14
  export * as session from './session.js';
16
15
  export * as store from './store.js';
17
- export * as string from './string.js';
18
16
  export * as system from './system.js';
19
- export * as template from './template.js';
20
- export * as toml from './toml.js';
21
17
  export * as ui from './ui.js';
22
- export * as vscode from './vscode.js';
23
18
  export * as outputMocker from './testing/output.js';
24
19
  export * as metadata from './metadata.js';
25
20
  export * as monorail from './monorail.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,gBAAgB,CAAA;AACnD,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAC/C,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,YAAY,MAAM,qBAAqB,CAAA;AACnD,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA","sourcesContent":["export {default as constants} from './constants.js'\nexport * as api from './api.js'\nexport * as cli from './cli.js'\nexport * as environment from './environment.js'\nexport * as error from './error.js'\nexport * as file from './file.js'\nexport * as git from './git.js'\nexport * as http from './http.js'\nexport * as npm from './npm.js'\nexport * as os from './os.js'\nexport * as output from './output.js'\nexport * as path from './path.js'\nexport * as plugins from './plugins.js'\nexport * as schema from './schema.js'\nexport * as session from './session.js'\nexport * as store from './store.js'\nexport * as string from './string.js'\nexport * as system from './system.js'\nexport * as template from './template.js'\nexport * as toml from './toml.js'\nexport * as ui from './ui.js'\nexport * as vscode from './vscode.js'\nexport * as outputMocker from './testing/output.js'\nexport * as metadata from './metadata.js'\nexport * as monorail from './monorail.js'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,gBAAgB,CAAA;AACnD,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAC/C,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,KAAK,YAAY,MAAM,qBAAqB,CAAA;AACnD,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA","sourcesContent":["export {default as constants} from './constants.js'\nexport * as api from './api.js'\nexport * as cli from './cli.js'\nexport * as environment from './environment.js'\nexport * as error from './error.js'\nexport * as file from './file.js'\nexport * as git from './git.js'\nexport * as http from './http.js'\nexport * as npm from './npm.js'\nexport * as output from './output.js'\nexport * as path from './path.js'\nexport * as plugins from './plugins.js'\nexport * as schema from './schema.js'\nexport * as session from './session.js'\nexport * as store from './store.js'\nexport * as system from './system.js'\nexport * as ui from './ui.js'\nexport * as outputMocker from './testing/output.js'\nexport * as metadata from './metadata.js'\nexport * as monorail from './monorail.js'\n"]}
package/dist/npm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { join } from './path.js';
2
2
  import * as file from './file.js';
3
- import * as os from './os.js';
3
+ import * as os from './public/node/os.js';
4
4
  import { debug, token, content } from './output.js';
5
5
  export async function readPackageJSON(directory) {
6
6
  debug(content `Reading and decoding the content from package.json at ${token.path(directory)}...`);
package/dist/npm.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"npm.js","sourceRoot":"","sources":["../src/npm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAC,MAAM,aAAa,CAAA;AAkBjD,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,SAAiB;IACrD,KAAK,CAAC,OAAO,CAAA,yDAAyD,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IACjG,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAA;IACnD,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAA;IAE5D,OAAO,WAAW,CAAA;AACpB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,SAAiB,EAAE,WAAiB;IACzE,KAAK,CAAC,OAAO,CAAA,wDAAwD,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IAChG,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAA;IACnD,MAAM,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;AACrE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,WAAiB,EAAE,IAAY;IACjE,WAAW,CAAC,IAAI,GAAG,IAAI,CAAA;IACvB,WAAW,CAAC,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAA;AAClD,CAAC","sourcesContent":["import {join} from './path.js'\nimport * as file from './file.js'\nimport * as os from './os.js'\nimport {debug, token, content} from './output.js'\n\ninterface JSON {\n [key: string]: JSONValue\n}\n\ntype JSONValue = string | number | boolean | JSON | JSONValue[]\n\nexport interface PackageJSON extends JSON {\n name: string\n author: string\n dependencies: {[key: string]: string}\n devDependencies: {[key: string]: string}\n resolutions: {[key: string]: string}\n overrides: {[key: string]: string}\n scripts: {[key: string]: string}\n}\n\nexport async function readPackageJSON(directory: string): Promise<PackageJSON> {\n debug(content`Reading and decoding the content from package.json at ${token.path(directory)}...`)\n const packagePath = join(directory, 'package.json')\n const packageJSON = JSON.parse(await file.read(packagePath))\n\n return packageJSON\n}\n\nexport async function writePackageJSON(directory: string, packageJSON: JSON): Promise<void> {\n debug(content`JSON-encoding and writing content to package.json at ${token.path(directory)}...`)\n const packagePath = join(directory, 'package.json')\n await file.write(packagePath, JSON.stringify(packageJSON, null, 2))\n}\n\nexport async function updateAppData(packageJSON: JSON, name: string): Promise<void> {\n packageJSON.name = name\n packageJSON.author = (await os.username()) ?? ''\n}\n"]}
1
+ {"version":3,"file":"npm.js","sourceRoot":"","sources":["../src/npm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,EAAE,MAAM,qBAAqB,CAAA;AACzC,OAAO,EAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAC,MAAM,aAAa,CAAA;AAkBjD,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,SAAiB;IACrD,KAAK,CAAC,OAAO,CAAA,yDAAyD,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IACjG,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAA;IACnD,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAA;IAE5D,OAAO,WAAW,CAAA;AACpB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,SAAiB,EAAE,WAAiB;IACzE,KAAK,CAAC,OAAO,CAAA,wDAAwD,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IAChG,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAA;IACnD,MAAM,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;AACrE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,WAAiB,EAAE,IAAY;IACjE,WAAW,CAAC,IAAI,GAAG,IAAI,CAAA;IACvB,WAAW,CAAC,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAA;AAClD,CAAC","sourcesContent":["import {join} from './path.js'\nimport * as file from './file.js'\nimport * as os from './public/node/os.js'\nimport {debug, token, content} from './output.js'\n\ninterface JSON {\n [key: string]: JSONValue\n}\n\ntype JSONValue = string | number | boolean | JSON | JSONValue[]\n\nexport interface PackageJSON extends JSON {\n name: string\n author: string\n dependencies: {[key: string]: string}\n devDependencies: {[key: string]: string}\n resolutions: {[key: string]: string}\n overrides: {[key: string]: string}\n scripts: {[key: string]: string}\n}\n\nexport async function readPackageJSON(directory: string): Promise<PackageJSON> {\n debug(content`Reading and decoding the content from package.json at ${token.path(directory)}...`)\n const packagePath = join(directory, 'package.json')\n const packageJSON = JSON.parse(await file.read(packagePath))\n\n return packageJSON\n}\n\nexport async function writePackageJSON(directory: string, packageJSON: JSON): Promise<void> {\n debug(content`JSON-encoding and writing content to package.json at ${token.path(directory)}...`)\n const packagePath = join(directory, 'package.json')\n await file.write(packagePath, JSON.stringify(packageJSON, null, 2))\n}\n\nexport async function updateAppData(packageJSON: JSON, name: string): Promise<void> {\n packageJSON.name = name\n packageJSON.author = (await os.username()) ?? ''\n}\n"]}
@@ -1,8 +1,8 @@
1
+ import { hashString } from '../../public/node/crypto.js';
1
2
  import { getPackageManager, packageManagerUsedForCreating } from '../../public/node/node-package-manager.js';
2
3
  import * as metadata from '../../metadata.js';
3
4
  import { macAddress } from '../../environment/local.js';
4
- import { platformAndArch } from '../../os.js';
5
- import { hashString } from '../../string.js';
5
+ import { platformAndArch } from '../../public/node/os.js';
6
6
  import * as environment from '../../environment.js';
7
7
  export async function startAnalytics({ commandContent, args, currentTime = new Date().getTime(), commandClass, }) {
8
8
  let startCommand = commandContent.command;
@@ -1 +1 @@
1
- {"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../../src/private/node/analytics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAE,6BAA6B,EAAC,MAAM,2CAA2C,CAAA;AAG1G,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAC,UAAU,EAAC,MAAM,4BAA4B,CAAA;AACrD,OAAO,EAAC,eAAe,EAAC,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAA;AAC1C,OAAO,KAAK,WAAW,MAAM,sBAAsB,CAAA;AAUnD,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,EACnC,cAAc,EACd,IAAI,EACJ,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,EAClC,YAAY,GACC;IACb,IAAI,YAAY,GAAW,cAAc,CAAC,OAAO,CAAA;IACjD,IAAI,YAAY,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,YAAY,EAAE,uBAAuB,CAAC,EAAE;QAC/F,YAAY,GA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C,CAAC,WAAW,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC,QAAQ;YAC/C,CAAC,CAAC,SAAS;QACb,aAAa,EAAE,UAAU,CAAC,MAAM,UAAU,EAAE,CAAC;QAC7C,SAAS,EAAE,WAAW,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC,QAAQ;QACxD,mBAAmB,EAAE,MAAM,iBAAiB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;KAC5D,CAAA;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,MAAyB;IACzE,OAAO;QACL,wBAAwB,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;KACjE,CAAA;AACH,CAAC;AAED,SAAS,cAAc,CAAC,MAAyB;IAC/C,OAAO,MAAM,CAAC,OAAO;SAClB,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC;SAC5B,IAAI,EAAE;SACN,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAA;AACtD,CAAC","sourcesContent":["import {getPackageManager, packageManagerUsedForCreating} from '../../public/node/node-package-manager.js'\nimport BaseCommand from '../../public/node/base-command.js'\nimport {CommandContent} from '../../public/node/hooks/prerun.js'\nimport * as metadata from '../../metadata.js'\nimport {macAddress} from '../../environment/local.js'\nimport {platformAndArch} from '../../os.js'\nimport {hashString} from '../../string.js'\nimport * as environment from '../../environment.js'\nimport {Interfaces} from '@oclif/core'\n\ninterface StartOptions {\n commandContent: CommandContent\n args: string[]\n currentTime?: number\n commandClass?: Interfaces.Command.Class | typeof BaseCommand\n}\n\nexport async function startAnalytics({\n commandContent,\n args,\n currentTime = new Date().getTime(),\n commandClass,\n}: StartOptions): Promise<void> {\n let startCommand: string = commandContent.command\n if (commandClass && Object.prototype.hasOwnProperty.call(commandClass, 'analyticsNameOverride')) {\n startCommand = (commandClass as typeof BaseCommand).analyticsNameOverride() ?? commandContent.command\n }\n\n await metadata.addSensitive(() => ({\n commandStartOptions: {\n startTime: currentTime,\n startCommand,\n startArgs: args,\n },\n }))\n\n await metadata.addPublic(() => ({\n cmd_all_launcher: packageManagerUsedForCreating(),\n cmd_all_alias_used: commandContent.alias,\n cmd_all_topic: commandContent.topic,\n cmd_all_plugin: commandClass?.plugin?.name,\n }))\n}\n\ninterface EnvironmentData {\n uname: string\n env_ci: boolean\n env_ci_platform?: string\n env_plugin_installed_any_custom: boolean\n env_plugin_installed_shopify: string\n env_shell: string\n env_web_ide: string | undefined\n env_device_id: string\n env_cloud: string\n env_package_manager: string\n}\n\nexport async function getEnvironmentData(config: Interfaces.Config): Promise<EnvironmentData> {\n const ciPlatform = environment.local.ciPlatform()\n\n const pluginNames = getPluginNames(config)\n const shopifyPlugins = pluginNames.filter((plugin) => plugin.startsWith('@shopify/'))\n\n const {platform, arch} = platformAndArch()\n\n return {\n uname: `${platform} ${arch}`,\n env_ci: ciPlatform.isCI,\n env_ci_platform: ciPlatform.name,\n env_plugin_installed_any_custom: pluginNames.length !== shopifyPlugins.length,\n env_plugin_installed_shopify: JSON.stringify(shopifyPlugins),\n env_shell: config.shell,\n env_web_ide: environment.local.cloudEnvironment().editor\n ? environment.local.cloudEnvironment().platform\n : undefined,\n env_device_id: hashString(await macAddress()),\n env_cloud: environment.local.cloudEnvironment().platform,\n env_package_manager: await getPackageManager(process.cwd()),\n }\n}\n\nexport async function getSensitiveEnvironmentData(config: Interfaces.Config) {\n return {\n env_plugin_installed_all: JSON.stringify(getPluginNames(config)),\n }\n}\n\nfunction getPluginNames(config: Interfaces.Config) {\n return config.plugins\n .map((plugin) => plugin.name)\n .sort()\n .filter((plugin) => !plugin.startsWith('@oclif/'))\n}\n"]}
1
+ {"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../../src/private/node/analytics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,6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AE,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAA;AACtD,CAAC","sourcesContent":["import {hashString} from '../../public/node/crypto.js'\nimport {getPackageManager, packageManagerUsedForCreating} from '../../public/node/node-package-manager.js'\nimport BaseCommand from '../../public/node/base-command.js'\nimport {CommandContent} from '../../public/node/hooks/prerun.js'\nimport * as metadata from '../../metadata.js'\nimport {macAddress} from '../../environment/local.js'\nimport {platformAndArch} from '../../public/node/os.js'\nimport * as environment from '../../environment.js'\nimport {Interfaces} from '@oclif/core'\n\ninterface StartOptions {\n commandContent: CommandContent\n args: string[]\n currentTime?: number\n commandClass?: Interfaces.Command.Class | typeof BaseCommand\n}\n\nexport async function startAnalytics({\n commandContent,\n args,\n currentTime = new Date().getTime(),\n commandClass,\n}: StartOptions): Promise<void> {\n let startCommand: string = commandContent.command\n if (commandClass && Object.prototype.hasOwnProperty.call(commandClass, 'analyticsNameOverride')) {\n startCommand = (commandClass as typeof BaseCommand).analyticsNameOverride() ?? commandContent.command\n }\n\n await metadata.addSensitive(() => ({\n commandStartOptions: {\n startTime: currentTime,\n startCommand,\n startArgs: args,\n },\n }))\n\n await metadata.addPublic(() => ({\n cmd_all_launcher: packageManagerUsedForCreating(),\n cmd_all_alias_used: commandContent.alias,\n cmd_all_topic: commandContent.topic,\n cmd_all_plugin: commandClass?.plugin?.name,\n }))\n}\n\ninterface EnvironmentData {\n uname: string\n env_ci: boolean\n env_ci_platform?: string\n env_plugin_installed_any_custom: boolean\n env_plugin_installed_shopify: string\n env_shell: string\n env_web_ide: string | undefined\n env_device_id: string\n env_cloud: string\n env_package_manager: string\n}\n\nexport async function getEnvironmentData(config: Interfaces.Config): Promise<EnvironmentData> {\n const ciPlatform = environment.local.ciPlatform()\n\n const pluginNames = getPluginNames(config)\n const shopifyPlugins = pluginNames.filter((plugin) => plugin.startsWith('@shopify/'))\n\n const {platform, arch} = platformAndArch()\n\n return {\n uname: `${platform} ${arch}`,\n env_ci: ciPlatform.isCI,\n env_ci_platform: ciPlatform.name,\n env_plugin_installed_any_custom: pluginNames.length !== shopifyPlugins.length,\n env_plugin_installed_shopify: JSON.stringify(shopifyPlugins),\n env_shell: config.shell,\n env_web_ide: environment.local.cloudEnvironment().editor\n ? environment.local.cloudEnvironment().platform\n : undefined,\n env_device_id: hashString(await macAddress()),\n env_cloud: environment.local.cloudEnvironment().platform,\n env_package_manager: await getPackageManager(process.cwd()),\n }\n}\n\nexport async function getSensitiveEnvironmentData(config: Interfaces.Config) {\n return {\n env_plugin_installed_all: JSON.stringify(getPluginNames(config)),\n }\n}\n\nfunction getPluginNames(config: Interfaces.Config) {\n return config.plugins\n .map((plugin) => plugin.name)\n .sort()\n .filter((plugin) => !plugin.startsWith('@oclif/'))\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import { RequestDocument, Variables } from 'graphql-request';
2
+ export interface GraphQLVariables {
3
+ [key: string]: any;
4
+ }
5
+ export declare function graphqlRequest<T>(query: RequestDocument, api: string, url: string, token: string, variables?: Variables, handleErrors?: boolean): Promise<T>;
@@ -0,0 +1,63 @@
1
+ import { buildHeaders, RequestClientError, sanitizedHeadersOutput } from './headers.js';
2
+ import { stringifyMessage, content, token as outputToken, token, debug } from '../../../output.js';
3
+ import { Abort } from '../../../error.js';
4
+ import { httpsAgent } from '../../../http.js';
5
+ import { ClientError, GraphQLClient } from 'graphql-request';
6
+ export function graphqlRequest(query, api, url, token, variables, handleErrors = true) {
7
+ const action = async () => {
8
+ const headers = await buildHeaders(token);
9
+ debugLogRequest(api, query, variables, headers);
10
+ const clientOptions = { agent: await httpsAgent(), headers };
11
+ const client = new GraphQLClient(url, clientOptions);
12
+ const t0 = performance.now();
13
+ const response = await client.request(query, variables);
14
+ const t1 = performance.now();
15
+ debug(`Request to ${url.toString()} completed in ${Math.round(t1 - t0)} ms`);
16
+ return response;
17
+ };
18
+ if (handleErrors) {
19
+ return handlingErrors(api, action);
20
+ }
21
+ else {
22
+ return action();
23
+ }
24
+ }
25
+ function debugLogRequest(api, query, variables, headers = {}) {
26
+ debug(content `
27
+ Sending ${token.json(api)} GraphQL request:
28
+ ${token.raw(query.toString())}
29
+
30
+ With variables:
31
+ ${variables ? JSON.stringify(variables, null, 2) : ''}
32
+
33
+ And headers:
34
+ ${sanitizedHeadersOutput(headers)}
35
+ `);
36
+ }
37
+ async function handlingErrors(api, action) {
38
+ try {
39
+ return await action();
40
+ }
41
+ catch (error) {
42
+ if (error instanceof ClientError) {
43
+ const errorMessage = stringifyMessage(content `
44
+ The ${token.raw(api)} GraphQL API responded unsuccessfully with the HTTP status ${`${error.response.status}`} and errors:
45
+
46
+ ${outputToken.json(error.response.errors)}
47
+ `);
48
+ let mappedError;
49
+ if (error.response.status < 500) {
50
+ mappedError = new RequestClientError(errorMessage, error.response.status);
51
+ }
52
+ else {
53
+ mappedError = new Abort(errorMessage);
54
+ }
55
+ mappedError.stack = error.stack;
56
+ throw mappedError;
57
+ }
58
+ else {
59
+ throw error;
60
+ }
61
+ }
62
+ }
63
+ //# sourceMappingURL=graphql.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql.js","sourceRoot":"","sources":["../../../../src/private/node/api/graphql.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,kBAAkB,EAAE,sBAAsB,EAAC,MAAM,cAAc,CAAA;AACrF,OAAO,EAAC,gBAAgB,EAAE,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,oBAAoB,CAAA;AAChG,OAAO,EAAC,KAAK,EAAC,MAAM,mBAAmB,CAAA;AACvC,OAAO,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAC,WAAW,EAAE,aAAa,EAA6B,MAAM,iBAAiB,CAAA;AAOtF,MAAM,UAAU,cAAc,CAC5B,KAAsB,EACtB,GAAW,EACX,GAAW,EACX,KAAa,EACb,SAAqB,EACrB,YAAY,GAAG,IAAI;IAEnB,MAAM,MAAM,G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GAAW,EAAE,MAAwB;IACpE,IAAI;QACF,OAAO,MAAM,MAAM,EAAE,CAAA;KACtB;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,KAAK,YAAY,WAAW,EAAE;YAChC,MAAM,YAAY,GAAG,gBAAgB,CAAC,OAAO,CAAA;QAC3C,KAAK,CAAC,GAAG,CACb,GAAG,CACJ,8DAA8D,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE;;IAEvF,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;OACpC,CAAC,CAAA;YACF,IAAI,WAAkB,CAAA;YACtB,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAG,GAAG,EAAE;gBAC/B,WAAW,GAAG,IAAI,kBAAkB,CAAC,YAAY,EAAE,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;aAC1E;iBAAM;gBACL,WAAW,GAAG,IAAI,KAAK,CAAC,YAAY,CAAC,CAAA;aACtC;YACD,WAAW,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAA;YAC/B,MAAM,WAAW,CAAA;SAClB;aAAM;YACL,MAAM,KAAK,CAAA;SACZ;KACF;AACH,CAAC","sourcesContent":["import {buildHeaders, RequestClientError, sanitizedHeadersOutput} from './headers.js'\nimport {stringifyMessage, content, token as outputToken, token, debug} from '../../../output.js'\nimport {Abort} from '../../../error.js'\nimport {httpsAgent} from '../../../http.js'\nimport {ClientError, GraphQLClient, RequestDocument, Variables} from 'graphql-request'\n\nexport interface GraphQLVariables {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any\n}\n\nexport function graphqlRequest<T>(\n query: RequestDocument,\n api: string,\n url: string,\n token: string,\n variables?: Variables,\n handleErrors = true,\n): Promise<T> {\n const action = async () => {\n const headers = await buildHeaders(token)\n debugLogRequest(api, query, variables, headers)\n const clientOptions = {agent: await httpsAgent(), headers}\n const client = new GraphQLClient(url, clientOptions)\n const t0 = performance.now()\n const response = await client.request<T>(query, variables)\n const t1 = performance.now()\n debug(`Request to ${url.toString()} completed in ${Math.round(t1 - t0)} ms`)\n return response\n }\n\n if (handleErrors) {\n return handlingErrors(api, action)\n } else {\n return action()\n }\n}\n\nfunction debugLogRequest<T>(\n api: string,\n query: RequestDocument,\n variables?: Variables,\n headers: {[key: string]: string} = {},\n) {\n debug(content`\nSending ${token.json(api)} GraphQL request:\n${token.raw(query.toString())}\n\nWith variables:\n${variables ? JSON.stringify(variables, null, 2) : ''}\n\nAnd headers:\n${sanitizedHeadersOutput(headers)}\n`)\n}\n\nasync function handlingErrors<T>(api: string, action: () => Promise<T>): Promise<T> {\n try {\n return await action()\n } catch (error) {\n if (error instanceof ClientError) {\n const errorMessage = stringifyMessage(content`\n The ${token.raw(\n api,\n )} GraphQL API responded unsuccessfully with the HTTP status ${`${error.response.status}`} and errors:\n\n ${outputToken.json(error.response.errors)}\n `)\n let mappedError: Error\n if (error.response.status < 500) {\n mappedError = new RequestClientError(errorMessage, error.response.status)\n } else {\n mappedError = new Abort(errorMessage)\n }\n mappedError.stack = error.stack\n throw mappedError\n } else {\n throw error\n }\n }\n}\n"]}
@@ -1,12 +1,8 @@
1
- import { ExtendableError } from '../error.js';
2
- import { RequestDocument, Variables } from 'graphql-request';
1
+ import { ExtendableError } from '../../../error.js';
3
2
  export declare class RequestClientError extends ExtendableError {
4
3
  statusCode: number;
5
4
  constructor(message: string, statusCode: number);
6
5
  }
7
- export declare function buildHeaders(token?: string): Promise<{
8
- [key: string]: string;
9
- }>;
10
6
  /**
11
7
  * Removes the sensitive data from the headers and outputs them as a string.
12
8
  * @param headers - HTTP headers.
@@ -15,7 +11,6 @@ export declare function buildHeaders(token?: string): Promise<{
15
11
  export declare function sanitizedHeadersOutput(headers: {
16
12
  [key: string]: string;
17
13
  }): string;
18
- export declare function debugLogRequest<T>(api: string, query: RequestDocument, variables?: Variables, headers?: {
14
+ export declare function buildHeaders(token?: string): Promise<{
19
15
  [key: string]: string;
20
- }): void;
21
- export declare function handlingErrors<T>(api: string, action: () => Promise<T>): Promise<T>;
16
+ }>;
@@ -1,32 +1,13 @@
1
- import { firstPartyDev } from '../environment/local.js';
2
- import constants from '../constants.js';
3
- import { stringifyMessage, content, token as outputToken, token, debug } from '../output.js';
4
- import { Abort, ExtendableError } from '../error.js';
5
- import { ClientError } from 'graphql-request';
6
- import { randomUUID } from 'crypto';
1
+ import constants from '../../../constants.js';
2
+ import { firstPartyDev } from '../../../environment/local.js';
3
+ import { ExtendableError } from '../../../error.js';
4
+ import { randomUUID } from '../../../public/node/crypto.js';
7
5
  export class RequestClientError extends ExtendableError {
8
6
  constructor(message, statusCode) {
9
7
  super(message);
10
8
  this.statusCode = statusCode;
11
9
  }
12
10
  }
13
- export async function buildHeaders(token) {
14
- const userAgent = `Shopify CLI; v=${await constants.versions.cliKit()}`;
15
- const headers = {
16
- 'User-Agent': userAgent,
17
- // 'Sec-CH-UA': secCHUA, This header requires the Git sha.
18
- 'Sec-CH-UA-PLATFORM': process.platform,
19
- 'X-Request-Id': randomUUID(),
20
- 'Content-Type': 'application/json',
21
- ...(firstPartyDev() && { 'X-Shopify-Cli-Employee': '1' }),
22
- };
23
- if (token) {
24
- // eslint-disable-next-line dot-notation
25
- headers['authorization'] = `Bearer ${token}`;
26
- headers['X-Shopify-Access-Token'] = `Bearer ${token}`;
27
- }
28
- return headers;
29
- }
30
11
  /**
31
12
  * Removes the sensitive data from the headers and outputs them as a string.
32
13
  * @param headers - HTTP headers.
@@ -46,42 +27,21 @@ export function sanitizedHeadersOutput(headers) {
46
27
  })
47
28
  .join('\n');
48
29
  }
49
- export function debugLogRequest(api, query, variables, headers = {}) {
50
- debug(content `
51
- Sending ${token.json(api)} GraphQL request:
52
- ${token.raw(query.toString())}
53
-
54
- With variables:
55
- ${variables ? JSON.stringify(variables, null, 2) : ''}
56
-
57
- And headers:
58
- ${sanitizedHeadersOutput(headers)}
59
- `);
60
- }
61
- export async function handlingErrors(api, action) {
62
- try {
63
- return await action();
64
- }
65
- catch (error) {
66
- if (error instanceof ClientError) {
67
- const errorMessage = stringifyMessage(content `
68
- The ${token.raw(api)} GraphQL API responded unsuccessfully with the HTTP status ${`${error.response.status}`} and errors:
69
-
70
- ${outputToken.json(error.response.errors)}
71
- `);
72
- let mappedError;
73
- if (error.response.status < 500) {
74
- mappedError = new RequestClientError(errorMessage, error.response.status);
75
- }
76
- else {
77
- mappedError = new Abort(errorMessage);
78
- }
79
- mappedError.stack = error.stack;
80
- throw mappedError;
81
- }
82
- else {
83
- throw error;
84
- }
30
+ export async function buildHeaders(token) {
31
+ const userAgent = `Shopify CLI; v=${await constants.versions.cliKit()}`;
32
+ const headers = {
33
+ 'User-Agent': userAgent,
34
+ // 'Sec-CH-UA': secCHUA, This header requires the Git sha.
35
+ 'Sec-CH-UA-PLATFORM': process.platform,
36
+ 'X-Request-Id': randomUUID(),
37
+ 'Content-Type': 'application/json',
38
+ ...(firstPartyDev() && { 'X-Shopify-Cli-Employee': '1' }),
39
+ };
40
+ if (token) {
41
+ // eslint-disable-next-line dot-notation
42
+ headers['authorization'] = `Bearer ${token}`;
43
+ headers['X-Shopify-Access-Token'] = `Bearer ${token}`;
85
44
  }
45
+ return headers;
86
46
  }
87
- //# sourceMappingURL=common.js.map
47
+ //# sourceMappingURL=headers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"headers.js","sourceRoot":"","sources":["../../../../src/private/node/api/headers.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,uBAAuB,CAAA;AAC7C,OAAO,EAAC,aAAa,EAAC,MAAM,+BAA+B,CAAA;AAC3D,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAC,UAAU,EAAC,MAAM,gCAAgC,CAAA;AAEzD,MAAM,OAAO,kBAAmB,SAAQ,eAAe;IAErD,YAAmB,OAAe,EAAE,UAAkB;QACpD,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,UAAU,GAAG,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AAC,wBAAwB,CAAC,GAAG,UAAU,KAAK,EAAE,CAAA;KACtD;IAED,OAAO,OAAO,CAAA;AAChB,CAAC","sourcesContent":["import constants from '../../../constants.js'\nimport {firstPartyDev} from '../../../environment/local.js'\nimport {ExtendableError} from '../../../error.js'\nimport {randomUUID} from '../../../public/node/crypto.js'\n\nexport class RequestClientError extends ExtendableError {\n statusCode: number\n public constructor(message: string, statusCode: number) {\n super(message)\n this.statusCode = statusCode\n }\n}\n\n/**\n * Removes the sensitive data from the headers and outputs them as a string.\n * @param headers - HTTP headers.\n * @returns A sanitized version of the headers as a string.\n */\nexport function sanitizedHeadersOutput(headers: {[key: string]: string}): string {\n const sanitized: {[key: string]: string} = {}\n const keywords = ['token', 'authorization']\n Object.keys(headers).forEach((header) => {\n if (keywords.find((keyword) => header.toLocaleLowerCase().includes(keyword)) === undefined) {\n sanitized[header] = headers[header]!\n }\n })\n return Object.keys(sanitized)\n .map((header) => {\n return ` - ${header}: ${sanitized[header]}`\n })\n .join('\\n')\n}\n\nexport async function buildHeaders(token?: string): Promise<{[key: string]: string}> {\n const userAgent = `Shopify CLI; v=${await constants.versions.cliKit()}`\n\n const headers: {[header: string]: string} = {\n 'User-Agent': userAgent,\n // 'Sec-CH-UA': secCHUA, This header requires the Git sha.\n 'Sec-CH-UA-PLATFORM': process.platform,\n 'X-Request-Id': randomUUID(),\n 'Content-Type': 'application/json',\n ...(firstPartyDev() && {'X-Shopify-Cli-Employee': '1'}),\n }\n if (token) {\n // eslint-disable-next-line dot-notation\n headers['authorization'] = `Bearer ${token}`\n headers['X-Shopify-Access-Token'] = `Bearer ${token}`\n }\n\n return headers\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { Box } from 'ink';
1
+ import { Box, useStdout } from 'ink';
2
2
  import React, { useEffect, useState } from 'react';
3
3
  /**
4
4
  * `FullScreen` renders all output in a new buffer and makes it full screen. This is useful when:
@@ -6,24 +6,26 @@ import React, { useEffect, useState } from 'react';
6
6
  * - You want to respond to the resize event of the terminal. Whenever the user resizes their terminal window the output's height and width will be recalculated and re-rendered properly.
7
7
  */
8
8
  const FullScreen = ({ children }) => {
9
+ const { stdout } = useStdout();
10
+ const standardOutput = stdout;
9
11
  const [size, setSize] = useState({
10
- columns: process.stdout.columns,
11
- rows: process.stdout.rows,
12
+ columns: standardOutput.columns,
13
+ rows: standardOutput.rows,
12
14
  });
13
15
  useEffect(() => {
14
16
  function onResize() {
15
17
  setSize({
16
- columns: process.stdout.columns,
17
- rows: process.stdout.rows,
18
+ columns: standardOutput.columns,
19
+ rows: standardOutput.rows,
18
20
  });
19
21
  }
20
- process.stdout.on('resize', onResize);
22
+ standardOutput.on('resize', onResize);
21
23
  // switch to an alternate buffer
22
- process.stdout.write('\u001B[?1049h');
24
+ standardOutput.write('\u001B[?1049h');
23
25
  return () => {
24
- process.stdout.off('resize', onResize);
26
+ standardOutput.off('resize', onResize);
25
27
  // switch back to the main buffer
26
- process.stdout.write('\u001B[?1049l');
28
+ standardOutput.write('\u001B[?1049l');
27
29
  };
28
30
  }, []);
29
31
  return (React.createElement(Box, { width: size.columns, height: size.rows }, children));
@@ -1 +1 @@
1
- {"version":3,"file":"FullScreen.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/FullScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAA;AAEhD;;;;GAIG;AACH,MAAM,UAAU,GAAa,CAAC,EAAC,QAAQ,EAAC,EAAe,EAAE;IACvD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC;QAC/B,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO;QAC/B,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI;KAC1B,CAAC,CAAA;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,SAAS,QAAQ;YACf,OAAO,CAAC;gBACN,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO;gBAC/B,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI;aAC1B,CAAC,CAAA;QACJ,CAAC;QAED,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;QACrC,gCAAgC;QAChC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAA;QACrC,OAAO,GAAG,EAAE;YACV,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;YACtC,iCAAiC;YACjC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAA;QACvC,CAAC,CAAA;IACH,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,CACL,oBAAC,GAAG,IAAC,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,IACxC,QAAQ,CACL,CACP,CAAA;AACH,CAAC,CAAA;AAED,eAAe,UAAU,CAAA","sourcesContent":["import {Box} from 'ink'\nimport React, {useEffect, useState} from 'react'\n\n/**\n * `FullScreen` renders all output in a new buffer and makes it full screen. This is useful when:\n * - You want to preserve terminal history. `ink` [normally clears the terminal history](https://github.com/vadimdemedes/ink/issues/382) if the rendered output is taller than the terminal window. By rendering in a separate buffer history will be preserved and will be visible after pressing `Ctrl+C`.\n * - You want to respond to the resize event of the terminal. Whenever the user resizes their terminal window the output's height and width will be recalculated and re-rendered properly.\n */\nconst FullScreen: React.FC = ({children}): JSX.Element => {\n const [size, setSize] = useState({\n columns: process.stdout.columns,\n rows: process.stdout.rows,\n })\n\n useEffect(() => {\n function onResize() {\n setSize({\n columns: process.stdout.columns,\n rows: process.stdout.rows,\n })\n }\n\n process.stdout.on('resize', onResize)\n // switch to an alternate buffer\n process.stdout.write('\\u001B[?1049h')\n return () => {\n process.stdout.off('resize', onResize)\n // switch back to the main buffer\n process.stdout.write('\\u001B[?1049l')\n }\n }, [])\n\n return (\n <Box width={size.columns} height={size.rows}>\n {children}\n </Box>\n )\n}\n\nexport default FullScreen\n"]}
1
+ {"version":3,"file":"FullScreen.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/FullScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,SAAS,EAAC,MAAM,KAAK,CAAA;AAClC,OAAO,KAAK,EAAE,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAA;AAEhD;;;;GAIG;AACH,MAAM,UAAU,GAAa,CAAC,EAAC,QAAQ,EAAC,EAAe,EAAE;IACvD,MAAM,EAAC,MAAM,EAAC,GAAG,SAAS,EAAE,CAAA;IAC5B,MAAM,cAAc,GAAG,MAAO,CAAA;IAE9B,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC;QAC/B,OAAO,EAAE,cAAc,CAAC,OAAO;QAC/B,IAAI,EAAE,cAAc,CAAC,IAAI;KAC1B,CAAC,CAAA;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,SAAS,QAAQ;YACf,OAAO,CAAC;gBACN,OAAO,EAAE,cAAc,CAAC,OAAO;gBAC/B,IAAI,EAAE,cAAc,CAAC,IAAI;aAC1B,CAAC,CAAA;QACJ,CAAC;QAED,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;QACrC,gCAAgC;QAChC,cAAc,CAAC,KAAK,CAAC,eAAe,CAAC,CAAA;QACrC,OAAO,GAAG,EAAE;YACV,cAAc,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;YACtC,iCAAiC;YACjC,cAAc,CAAC,KAAK,CAAC,eAAe,CAAC,CAAA;QACvC,CAAC,CAAA;IACH,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,CACL,oBAAC,GAAG,IAAC,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,IACxC,QAAQ,CACL,CACP,CAAA;AACH,CAAC,CAAA;AAED,eAAe,UAAU,CAAA","sourcesContent":["import {Box, useStdout} from 'ink'\nimport React, {useEffect, useState} from 'react'\n\n/**\n * `FullScreen` renders all output in a new buffer and makes it full screen. This is useful when:\n * - You want to preserve terminal history. `ink` [normally clears the terminal history](https://github.com/vadimdemedes/ink/issues/382) if the rendered output is taller than the terminal window. By rendering in a separate buffer history will be preserved and will be visible after pressing `Ctrl+C`.\n * - You want to respond to the resize event of the terminal. Whenever the user resizes their terminal window the output's height and width will be recalculated and re-rendered properly.\n */\nconst FullScreen: React.FC = ({children}): JSX.Element => {\n const {stdout} = useStdout()\n const standardOutput = stdout!\n\n const [size, setSize] = useState({\n columns: standardOutput.columns,\n rows: standardOutput.rows,\n })\n\n useEffect(() => {\n function onResize() {\n setSize({\n columns: standardOutput.columns,\n rows: standardOutput.rows,\n })\n }\n\n standardOutput.on('resize', onResize)\n // switch to an alternate buffer\n standardOutput.write('\\u001B[?1049h')\n return () => {\n standardOutput.off('resize', onResize)\n // switch back to the main buffer\n standardOutput.write('\\u001B[?1049l')\n }\n }, [])\n\n return (\n <Box width={size.columns} height={size.rows}>\n {children}\n </Box>\n )\n}\n\nexport default FullScreen\n"]}
@@ -2,21 +2,33 @@ import SelectInput from './SelectInput.js';
2
2
  import Table from './Table.js';
3
3
  import { handleCtrlC } from '../../ui.js';
4
4
  import React, { useCallback, useState } from 'react';
5
- import { Box, Text, useApp, useInput } from 'ink';
5
+ import { Box, measureElement, Text, useApp, useInput, useStdout } from 'ink';
6
6
  import { figures } from 'listr2';
7
+ import ansiEscapes from 'ansi-escapes';
7
8
  function SelectPrompt({ message, choices, infoTable, onSubmit, }) {
8
9
  const [answer, setAnswer] = useState(choices[0]);
9
10
  const { exit: unmountInk } = useApp();
10
11
  const [submitted, setSubmitted] = useState(false);
12
+ const { stdout } = useStdout();
13
+ const [height, setHeight] = useState(0);
14
+ const measuredRef = useCallback((node) => {
15
+ if (node !== null) {
16
+ const { height } = measureElement(node);
17
+ setHeight(height);
18
+ }
19
+ }, []);
11
20
  useInput(useCallback((input, key) => {
12
21
  handleCtrlC(input, key);
13
22
  if (key.return) {
23
+ if (stdout && height >= stdout.rows) {
24
+ stdout.write(ansiEscapes.clearTerminal);
25
+ }
14
26
  setSubmitted(true);
15
27
  unmountInk();
16
28
  onSubmit(answer.value);
17
29
  }
18
- }, [answer, onSubmit]));
19
- return (React.createElement(Box, { flexDirection: "column", marginBottom: 1 },
30
+ }, [answer, onSubmit, height]));
31
+ return (React.createElement(Box, { flexDirection: "column", marginBottom: 1, ref: measuredRef },
20
32
  React.createElement(Box, null,
21
33
  React.createElement(Box, { marginRight: 2 },
22
34
  React.createElement(Text, null, "?")),
@@ -1 +1 @@
1
- {"version":3,"file":"SelectPrompt.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/SelectPrompt.tsx"],"names":[],"mappings":"AAAA,OAAO,WAA6D,MAAM,kBAAkB,CAAA;AAC5F,OAAO,KAA4B,MAAM,YAAY,CAAA;AACrD,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,EAAE,EAAe,WAAW,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAA;AAChE,OAAO,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAC,OAAO,EAAC,MAAM,QAAQ,CAAA;AAS9B,SAAS,YAAY,CAAI,EACvB,OAAO,EACP,OAAO,EACP,SAAS,EACT,QAAQ,GAC0B;IAClC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAgB,OAAO,CAAC,CAAC,CAAE,CAAC,CAAA;IAChE,MAAM,EAAC,IAAI,EAAE,UAAU,EAAC,GAAG,MAAM,EAAE,CAAA;IACnC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK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nimport Table, {Props as TableProps} from './Table.js'\nimport {handleCtrlC} from '../../ui.js'\nimport React, {ReactElement, useCallback, useState} from 'react'\nimport {Box, Text, useApp, useInput} from 'ink'\nimport {figures} from 'listr2'\n\nexport interface Props<T> {\n message: string\n choices: SelectProps<T>['items']\n onSubmit: (value: T) => void\n infoTable?: TableProps['table']\n}\n\nfunction SelectPrompt<T>({\n message,\n choices,\n infoTable,\n onSubmit,\n}: React.PropsWithChildren<Props<T>>): ReactElement | null {\n const [answer, setAnswer] = useState<SelectItem<T>>(choices[0]!)\n const {exit: unmountInk} = useApp()\n const [submitted, setSubmitted] = useState(false)\n\n useInput(\n useCallback(\n (input, key) => {\n handleCtrlC(input, key)\n\n if (key.return) {\n setSubmitted(true)\n unmountInk()\n onSubmit(answer.value)\n }\n },\n [answer, onSubmit],\n ),\n )\n\n return (\n <Box flexDirection=\"column\" marginBottom={1}>\n <Box>\n <Box marginRight={2}>\n <Text>?</Text>\n </Box>\n <Text>{message}</Text>\n </Box>\n {infoTable && !submitted && (\n <Box marginLeft={7}>\n <Table table={infoTable} />\n </Box>\n )}\n {submitted ? (\n <Box>\n <Box marginRight={2}>\n <Text color=\"cyan\">{figures.tick}</Text>\n </Box>\n\n <Text color=\"cyan\">{answer.label}</Text>\n </Box>\n ) : (\n <SelectInput\n items={choices}\n onChange={(item: Item<T>) => {\n setAnswer(item)\n }}\n />\n )}\n </Box>\n )\n}\n\nexport {SelectPrompt}\n"]}
1
+ {"version":3,"file":"SelectPrompt.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/SelectPrompt.tsx"],"names":[],"mappings":"AAAA,OAAO,WAA6D,MAAM,kBAAkB,CAAA;AAC5F,OAAO,KAA4B,MAAM,YAAY,CAAA;AACrD,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,EAAE,EAAe,WAAW,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAA;AAChE,OAAO,EAAC,GAAG,EAAE,cAAc,EA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,CAAA;SACvB;IACH,CAAC,EACD,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CAC3B,CACF,CAAA;IAED,OAAO,CACL,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,YAAY,EAAE,CAAC,EAAE,GAAG,EAAE,WAAW;QAC3D,oBAAC,GAAG;YACF,oBAAC,GAAG,IAAC,WAAW,EAAE,CAAC;gBACjB,oBAAC,IAAI,YAAS,CACV;YACN,oBAAC,IAAI,QAAE,OAAO,CAAQ,CAClB;QACL,SAAS,IAAI,CAAC,SAAS,IAAI,CAC1B,oBAAC,GAAG,IAAC,UAAU,EAAE,CAAC;YAChB,oBAAC,KAAK,IAAC,KAAK,EAAE,SAAS,GAAI,CACvB,CACP;QACA,SAAS,CAAC,CAAC,CAAC,CACX,oBAAC,GAAG;YACF,oBAAC,GAAG,IAAC,WAAW,EAAE,CAAC;gBACjB,oBAAC,IAAI,IAAC,KAAK,EAAC,MAAM,IAAE,OAAO,CAAC,IAAI,CAAQ,CACpC;YAEN,oBAAC,IAAI,IAAC,KAAK,EAAC,MAAM,IAAE,MAAM,CAAC,KAAK,CAAQ,CACpC,CACP,CAAC,CAAC,CAAC,CACF,oBAAC,WAAW,IACV,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,CAAC,IAAa,EAAE,EAAE;gBAC1B,SAAS,CAAC,IAAI,CAAC,CAAA;YACjB,CAAC,GACD,CACH,CACG,CACP,CAAA;AACH,CAAC;AAED,OAAO,EAAC,YAAY,EAAC,CAAA","sourcesContent":["import SelectInput, {Props as SelectProps, Item as SelectItem, Item} from './SelectInput.js'\nimport Table, {Props as TableProps} from './Table.js'\nimport {handleCtrlC} from '../../ui.js'\nimport React, {ReactElement, useCallback, useState} from 'react'\nimport {Box, measureElement, Text, useApp, useInput, useStdout} from 'ink'\nimport {figures} from 'listr2'\nimport ansiEscapes from 'ansi-escapes'\n\nexport interface Props<T> {\n message: string\n choices: SelectProps<T>['items']\n onSubmit: (value: T) => void\n infoTable?: TableProps['table']\n}\n\nfunction SelectPrompt<T>({\n message,\n choices,\n infoTable,\n onSubmit,\n}: React.PropsWithChildren<Props<T>>): ReactElement | null {\n const [answer, setAnswer] = useState<SelectItem<T>>(choices[0]!)\n const {exit: unmountInk} = useApp()\n const [submitted, setSubmitted] = useState(false)\n const {stdout} = useStdout()\n const [height, setHeight] = useState(0)\n\n const measuredRef = useCallback((node) => {\n if (node !== null) {\n const {height} = measureElement(node)\n setHeight(height)\n }\n }, [])\n\n useInput(\n useCallback(\n (input, key) => {\n handleCtrlC(input, key)\n\n if (key.return) {\n if (stdout && height >= stdout.rows) {\n stdout.write(ansiEscapes.clearTerminal)\n }\n setSubmitted(true)\n unmountInk()\n onSubmit(answer.value)\n }\n },\n [answer, onSubmit, height],\n ),\n )\n\n return (\n <Box flexDirection=\"column\" marginBottom={1} ref={measuredRef}>\n <Box>\n <Box marginRight={2}>\n <Text>?</Text>\n </Box>\n <Text>{message}</Text>\n </Box>\n {infoTable && !submitted && (\n <Box marginLeft={7}>\n <Table table={infoTable} />\n </Box>\n )}\n {submitted ? (\n <Box>\n <Box marginRight={2}>\n <Text color=\"cyan\">{figures.tick}</Text>\n </Box>\n\n <Text color=\"cyan\">{answer.label}</Text>\n </Box>\n ) : (\n <SelectInput\n items={choices}\n onChange={(item: Item<T>) => {\n setAnswer(item)\n }}\n />\n )}\n </Box>\n )\n}\n\nexport {SelectPrompt}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { List } from './List.js';
2
- import { capitalize } from '../../../../string.js';
2
+ import { capitalize } from '../../../../public/common/string.js';
3
3
  import { Box, Text } from 'ink';
4
4
  import React from 'react';
5
5
  const Table = ({ table }) => {
@@ -1 +1 @@
1
- {"version":3,"file":"Table.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,KAAK,CAAA;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAA;AAQzB,MAAM,KAAK,GAAoB,CAAC,EAAC,KAAK,EAAC,EAAE,EAAE;IACzC,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAClC,MAAM,iBAAiB,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA;IAE7E,OAAO,CACL,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,QAAQ,EAAE,CAAC,IACpC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAC9B,oBAAC,GAAG,IAAC,GAAG,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,KAAK,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACjE,oBAAC,GAAG,IAAC,KAAK,EAAE,iBAAiB,GAAG,CAAC;YAC/B,oBAAC,IAAI;gBAAE,UAAU,CAAC,MAAM,CAAC;oBAAS,CAC9B;QACN,oBAAC,GAAG,IAAC,QAAQ,EAAE,CAAC;YACd,oBAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAE,GAAI,CAC3B,CACF,CACP,CAAC,CACE,CACP,CAAA;AACH,CAAC,CAAA;AAED,eAAe,KAAK,CAAA","sourcesContent":["import {List} from './List.js'\nimport {capitalize} from '../../../../string.js'\nimport {Box, Text} from 'ink'\nimport React from 'react'\n\nexport interface Props {\n table: {\n [header: string]: string[]\n }\n}\n\nconst Table: React.FC<Props> = ({table}) => {\n const headers = Object.keys(table)\n const headerColumnWidth = Math.max(...headers.map((header) => header.length))\n\n return (\n <Box flexDirection=\"column\" paddingY={1}>\n {headers.map((header, index) => (\n <Box key={index} marginBottom={index === headers.length - 1 ? 0 : 1}>\n <Box width={headerColumnWidth + 1}>\n <Text>{capitalize(header)}:</Text>\n </Box>\n <Box flexGrow={1}>\n <List items={table[header]!} />\n </Box>\n </Box>\n ))}\n </Box>\n )\n}\n\nexport default Table\n"]}
1
+ {"version":3,"file":"Table.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,EAAC,UAAU,EAAC,MAAM,qCAAqC,CAAA;AAC9D,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,KAAK,CAAA;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAA;AAQzB,MAAM,KAAK,GAAoB,CAAC,EAAC,KAAK,EAAC,EAAE,EAAE;IACzC,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAClC,MAAM,iBAAiB,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA;IAE7E,OAAO,CACL,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,QAAQ,EAAE,CAAC,IACpC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAC9B,oBAAC,GAAG,IAAC,GAAG,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,KAAK,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACjE,oBAAC,GAAG,IAAC,KAAK,EAAE,iBAAiB,GAAG,CAAC;YAC/B,oBAAC,IAAI;gBAAE,UAAU,CAAC,MAAM,CAAC;oBAAS,CAC9B;QACN,oBAAC,GAAG,IAAC,QAAQ,EAAE,CAAC;YACd,oBAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAE,GAAI,CAC3B,CACF,CACP,CAAC,CACE,CACP,CAAA;AACH,CAAC,CAAA;AAED,eAAe,KAAK,CAAA","sourcesContent":["import {List} from './List.js'\nimport {capitalize} from '../../../../public/common/string.js'\nimport {Box, Text} from 'ink'\nimport React from 'react'\n\nexport interface Props {\n table: {\n [header: string]: string[]\n }\n}\n\nconst Table: React.FC<Props> = ({table}) => {\n const headers = Object.keys(table)\n const headerColumnWidth = Math.max(...headers.map((header) => header.length))\n\n return (\n <Box flexDirection=\"column\" paddingY={1}>\n {headers.map((header, index) => (\n <Box key={index} marginBottom={index === headers.length - 1 ? 0 : 1}>\n <Box width={headerColumnWidth + 1}>\n <Text>{capitalize(header)}:</Text>\n </Box>\n <Box flexGrow={1}>\n <List items={table[header]!} />\n </Box>\n </Box>\n ))}\n </Box>\n )\n}\n\nexport default Table\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"collection.js","sourceRoot":"","sources":["../../../src/public/common/collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,QAAQ,CAAA;AAGpC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAE9C;;;;;;;;GAQG;AACH,MAAM,UAAU,OAAO,CACrB,UAA2C,EAC3C,QAA2B;IAI3B,MAAM,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAC/C,OAAO,aAAa,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;AAC5C,CAAC;AAED;;;;;;;;GAQG;AAEH,MAAM,UAAU,SAAS,CAAI,UAAsC,EAAE,QAA0B;IAC7F,MAAM,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAA;IACnD,OAAO,eAAe,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;AAC9C,CAAC","sourcesContent":["import {createRequire} from 'module'\nimport type {List, ValueIteratee} from 'lodash'\n\nconst require = createRequire(import.meta.url)\n\n/**\n * Creates an object composed of keys generated from the results of running each element of collection through\n * iteratee. The corresponding value of each key is an array of the elements responsible for generating the\n * key. The iteratee is invoked with one argument: (value).\n *\n * @param collection - The collection to iterate over.\n * @param iteratee - The function invoked per iteration.\n * @returns Returns the composed aggregate object.\n */\nexport function groupBy<T>(\n collection: ArrayLike<T> | null | undefined,\n iteratee?: ValueIteratee<T>,\n): {\n [index: string]: T[]\n} {\n const lodashBroupBy = require('lodash/groupBy')\n return lodashBroupBy(collection, iteratee)\n}\n\n/**\n * Creates an array of elements split into two groups, the first of which contains elements predicate returns truthy for,\n * while the second of which contains elements predicate returns falsey for.\n * The predicate is invoked with three arguments: (value, index|key, collection).\n *\n * @param collection - The collection to iterate over.\n * @param callback - The function called per iteration.\n * @returns Returns the array of grouped elements.\n */\n\nexport function partition<T>(collection: List<T> | null | undefined, callback: ValueIteratee<T>): [T[], T[]] {\n const lodashPartition = require('lodash/partition')\n return lodashPartition(collection, callback)\n}\n"]}
1
+ {"version":3,"file":"collection.js","sourceRoot":"","sources":["../../../src/public/common/collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,QAAQ,CAAA;AAGpC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAE9C;;;;;;;;GAQG;AACH,MAAM,UAAU,OAAO,CACrB,UAA2C,EAC3C,QAA2B;IAI3B,MAAM,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAC/C,OAAO,aAAa,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;AAC5C,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,SAAS,CAAI,UAAsC,EAAE,QAA0B;IAC7F,MAAM,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAA;IACnD,OAAO,eAAe,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;AAC9C,CAAC","sourcesContent":["import {createRequire} from 'module'\nimport type {List, ValueIteratee} from 'lodash'\n\nconst require = createRequire(import.meta.url)\n\n/**\n * Creates an object composed of keys generated from the results of running each element of collection through\n * iteratee. The corresponding value of each key is an array of the elements responsible for generating the\n * key. The iteratee is invoked with one argument: (value).\n *\n * @param collection - The collection to iterate over.\n * @param iteratee - The function invoked per iteration.\n * @returns Returns the composed aggregate object.\n */\nexport function groupBy<T>(\n collection: ArrayLike<T> | null | undefined,\n iteratee?: ValueIteratee<T>,\n): {\n [index: string]: T[]\n} {\n const lodashBroupBy = require('lodash/groupBy')\n return lodashBroupBy(collection, iteratee)\n}\n\n/**\n * Creates an array of elements split into two groups, the first of which contains elements predicate returns truthy for,\n * while the second of which contains elements predicate returns falsey for.\n * The predicate is invoked with three arguments: (value, index|key, collection).\n *\n * @param collection - The collection to iterate over.\n * @param callback - The function called per iteration.\n * @returns Returns the array of grouped elements.\n */\nexport function partition<T>(collection: List<T> | null | undefined, callback: ValueIteratee<T>): [T[], T[]] {\n const lodashPartition = require('lodash/partition')\n return lodashPartition(collection, callback)\n}\n"]}
@@ -13,9 +13,6 @@ const require = createRequire(import.meta.url);
13
13
  export function deepMergeObjects(lhs, rhs, arrayMergeStrategy = unionArrayStrategy) {
14
14
  return deepMerge(lhs, rhs, { arrayMerge: arrayMergeStrategy });
15
15
  }
16
- function unionArrayStrategy(destinationArray, sourceArray) {
17
- return Array.from(new Set([...destinationArray, ...sourceArray]));
18
- }
19
16
  /**
20
17
  * Creates an object composed of the `object` properties `predicate` returns
21
18
  * truthy for. The predicate is invoked with two arguments: (value, key).
@@ -42,4 +39,7 @@ export function mapValues(obj, callback) {
42
39
  const lodashMapValues = require('lodash/mapValues.js');
43
40
  return lodashMapValues(obj, callback);
44
41
  }
42
+ function unionArrayStrategy(destinationArray, sourceArray) {
43
+ return Array.from(new Set([...destinationArray, ...sourceArray]));
44
+ }
45
45
  //# sourceMappingURL=object.js.map