@shopify/cli-kit 3.32.1 → 3.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants.d.ts +0 -1
- package/dist/constants.js +0 -1
- package/dist/constants.js.map +1 -1
- package/dist/environment/local.d.ts +0 -1
- package/dist/environment/local.js +0 -3
- package/dist/environment/local.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/private/common/array.d.ts +1 -0
- package/dist/private/common/array.js +4 -0
- package/dist/private/common/array.js.map +1 -0
- package/dist/private/node/api/rest.d.ts +6 -0
- package/dist/private/node/api/rest.js +27 -0
- package/dist/private/node/api/rest.js.map +1 -0
- package/dist/private/node/ui/components/Subdued.d.ts +9 -0
- package/dist/private/node/ui/components/Subdued.js +10 -0
- package/dist/private/node/ui/components/Subdued.js.map +1 -0
- package/dist/private/node/ui/components/Subdued.test.d.ts +1 -0
- package/dist/private/node/ui/components/Subdued.test.js +11 -0
- package/dist/private/node/ui/components/Subdued.test.js.map +1 -0
- package/dist/private/node/ui/components/TokenizedText.d.ts +4 -1
- package/dist/private/node/ui/components/TokenizedText.js +4 -0
- package/dist/private/node/ui/components/TokenizedText.js.map +1 -1
- package/dist/private/node/ui/components/TokenizedText.test.js +4 -1
- package/dist/private/node/ui/components/TokenizedText.test.js.map +1 -1
- package/dist/public/common/array.d.ts +4 -0
- package/dist/public/common/array.js +4 -0
- package/dist/public/common/array.js.map +1 -1
- package/dist/public/common/object.d.ts +3 -3
- package/dist/public/common/object.js +5 -7
- package/dist/public/common/object.js.map +1 -1
- package/dist/public/common/url.d.ts +2 -1
- package/dist/public/common/url.js +3 -2
- package/dist/public/common/url.js.map +1 -1
- package/dist/public/node/api/admin.d.ts +30 -0
- package/dist/public/node/api/admin.js +28 -0
- package/dist/public/node/api/admin.js.map +1 -1
- package/dist/public/node/api/partners.js +6 -1
- package/dist/public/node/api/partners.js.map +1 -1
- package/dist/public/node/ruby.js +1 -1
- package/dist/public/node/ruby.js.map +1 -1
- package/dist/public/node/ui.d.ts +1 -1
- package/dist/public/node/ui.js.map +1 -1
- package/dist/session/validate.js +2 -2
- package/dist/session/validate.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -2
- package/dist/api/graphql/all_app_extension_registrations.d.ts +0 -20
- package/dist/api/graphql/all_app_extension_registrations.js +0 -20
- package/dist/api/graphql/all_app_extension_registrations.js.map +0 -1
- package/dist/api/graphql/all_dev_stores_by_org.d.ts +0 -18
- package/dist/api/graphql/all_dev_stores_by_org.js +0 -21
- package/dist/api/graphql/all_dev_stores_by_org.js.map +0 -1
- package/dist/api/graphql/all_orgs.d.ts +0 -12
- package/dist/api/graphql/all_orgs.js +0 -14
- package/dist/api/graphql/all_orgs.js.map +0 -1
- package/dist/api/graphql/convert_dev_to_test_store.d.ts +0 -16
- package/dist/api/graphql/convert_dev_to_test_store.js +0 -13
- package/dist/api/graphql/convert_dev_to_test_store.js.map +0 -1
- package/dist/api/graphql/create_app.d.ts +0 -29
- package/dist/api/graphql/create_app.js +0 -33
- package/dist/api/graphql/create_app.js.map +0 -1
- package/dist/api/graphql/create_deployment.d.ts +0 -33
- package/dist/api/graphql/create_deployment.js +0 -25
- package/dist/api/graphql/create_deployment.js.map +0 -1
- package/dist/api/graphql/extension_create.d.ts +0 -30
- package/dist/api/graphql/extension_create.js +0 -26
- package/dist/api/graphql/extension_create.js.map +0 -1
- package/dist/api/graphql/extension_specifications.d.ts +0 -27
- package/dist/api/graphql/extension_specifications.js +0 -22
- package/dist/api/graphql/extension_specifications.js.map +0 -1
- package/dist/api/graphql/find_app.d.ts +0 -14
- package/dist/api/graphql/find_app.js +0 -17
- package/dist/api/graphql/find_app.js.map +0 -1
- package/dist/api/graphql/find_org.d.ts +0 -18
- package/dist/api/graphql/find_org.js +0 -21
- package/dist/api/graphql/find_org.js.map +0 -1
- package/dist/api/graphql/find_org_basic.d.ts +0 -11
- package/dist/api/graphql/find_org_basic.js +0 -14
- package/dist/api/graphql/find_org_basic.js.map +0 -1
- package/dist/api/graphql/find_store_by_domain.d.ts +0 -21
- package/dist/api/graphql/find_store_by_domain.js +0 -24
- package/dist/api/graphql/find_store_by_domain.js.map +0 -1
- package/dist/api/graphql/functions/api_schema_definition.d.ts +0 -9
- package/dist/api/graphql/functions/api_schema_definition.js +0 -7
- package/dist/api/graphql/functions/api_schema_definition.js.map +0 -1
- package/dist/api/graphql/functions/app_function_set.d.ts +0 -30
- package/dist/api/graphql/functions/app_function_set.js +0 -38
- package/dist/api/graphql/functions/app_function_set.js.map +0 -1
- package/dist/api/graphql/functions/function_service_proxy.d.ts +0 -4
- package/dist/api/graphql/functions/function_service_proxy.js +0 -7
- package/dist/api/graphql/functions/function_service_proxy.js.map +0 -1
- package/dist/api/graphql/functions/upload_url_generate.d.ts +0 -12
- package/dist/api/graphql/functions/upload_url_generate.js +0 -11
- package/dist/api/graphql/functions/upload_url_generate.js.map +0 -1
- package/dist/api/graphql/generate_signed_upload_url.d.ts +0 -15
- package/dist/api/graphql/generate_signed_upload_url.js +0 -15
- package/dist/api/graphql/generate_signed_upload_url.js.map +0 -1
- package/dist/api/graphql/get_urls.d.ts +0 -10
- package/dist/api/graphql/get_urls.js +0 -10
- package/dist/api/graphql/get_urls.js.map +0 -1
- package/dist/api/graphql/get_variant_id.d.ts +0 -17
- package/dist/api/graphql/get_variant_id.js +0 -20
- package/dist/api/graphql/get_variant_id.js.map +0 -1
- package/dist/api/graphql/index.d.ts +0 -21
- package/dist/api/graphql/index.js +0 -22
- package/dist/api/graphql/index.js.map +0 -1
- package/dist/api/graphql/update_draft.d.ts +0 -33
- package/dist/api/graphql/update_draft.js +0 -24
- package/dist/api/graphql/update_draft.js.map +0 -1
- package/dist/api/graphql/update_urls.d.ts +0 -14
- package/dist/api/graphql/update_urls.js +0 -12
- package/dist/api/graphql/update_urls.js.map +0 -1
- package/dist/api.d.ts +0 -3
- package/dist/api.js +0 -4
- package/dist/api.js.map +0 -1
- package/dist/public/node/checksum.d.ts +0 -20
- package/dist/public/node/checksum.js +0 -32
- package/dist/public/node/checksum.js.map +0 -1
package/dist/constants.d.ts
CHANGED
package/dist/constants.js
CHANGED
|
@@ -26,7 +26,6 @@ const constants = {
|
|
|
26
26
|
themeToken: 'SHOPIFY_CLI_THEME_TOKEN',
|
|
27
27
|
unitTest: 'SHOPIFY_UNIT_TEST',
|
|
28
28
|
verbose: 'SHOPIFY_FLAG_VERBOSE',
|
|
29
|
-
functionMatching: 'SHOPIFY_CLI_FUNCTION_MATCHING',
|
|
30
29
|
themeBundling: 'SHOPIFY_THEME_BUNDLING',
|
|
31
30
|
// Variables to detect if the CLI is running in a cloud environment
|
|
32
31
|
codespaceName: 'CODESPACE_NAME',
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,IAAI,QAAQ,EAAC,MAAM,WAAW,CAAA;AAC1C,OAAO,EAAC,oBAAoB,EAAC,MAAM,uCAAuC,CAAA;AAC1E,OAAO,QAAQ,MAAM,WAAW,CAAA;AAEhC,MAAM,UAAU,GAAG,aAAa,CAAA;AAEhC,MAAM,WAAW,GAAG,GAAG,EAAE;IACvB,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc;QAAE,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,CAAA;IACjE,OAAO,QAAQ,CAAC,UAAU,CAAC,CAAC,KAAK,CAAA;AACnC,CAAC,CAAA;AAED,MAAM,SAAS,GAAG;IAChB,oBAAoB,EAAE;QACpB,kBAAkB,EAAE,kCAAkC;QACtD,UAAU,EAAE,yBAAyB;QACrC,iBAAiB,EAAE,iCAAiC;QACpD,GAAG,EAAE,iBAAiB;QACtB,aAAa,EAAE,oBAAoB;QACnC,WAAW,EAAE,0BAA0B;QACvC,aAAa,EAAE,4BAA4B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E,sBAAsB;QAC/B,aAAa,EAAE,wBAAwB;QACvC,mEAAmE;QACnE,aAAa,EAAE,gBAAgB;QAC/B,UAAU,EAAE,YAAY;QACxB,MAAM,EAAE,sBAAsB;QAC9B,IAAI,EAAE,MAAM;KACb;IACD,KAAK,EAAE;QACL,WAAW,EAAE;YACX,GAAG,EAAE,kBAAkB;SACxB;QACD,WAAW,EAAE;YACX,KAAK,EAAE;gBACL,IAAI,EAAE,GAAG,EAAE;oBACT,OAAO,WAAW,EAAE,CAAA;gBACtB,CAAC;gBACD,MAAM,EAAE;oBACN,IAAI,EAAE,GAAG,EAAE;wBACT,OAAO,QAAQ,CAAC,WAAW,EAAE,EAAE,QAAQ,CAAC,CAAA;oBAC1C,CAAC;oBACD,QAAQ,EAAE,GAAG,EAAE;wBACb,OAAO,QAAQ,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAA;oBACtD,CAAC;iBACF;aACF;SACF;KACF;IACD,QAAQ,EAAE;QACR,MAAM,EAAE,KAAK,IAAI,EAAE;YACjB,OAAO,oBAAoB,CAAC,EAAC,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,EAAC,CAAC,CAAA;QAC/D,CAAC;KACF;IACD,QAAQ,EAAE;QACR,OAAO,EAAE,aAAa;KACvB;IACD,OAAO,EAAE;QACP,6BAA6B,EAAE,CAAC;KACjC;CACF,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,kCAAkC,CAAA;AAE/D,eAAe,SAAS,CAAA","sourcesContent":["import {join as pathJoin} from './path.js'\nimport {findPackageVersionUp} from './public/node/node-package-manager.js'\nimport envPaths from 'env-paths'\n\nconst identifier = 'shopify-cli'\n\nconst cacheFolder = () => {\n if (process.env.XDG_CACHE_HOME) return process.env.XDG_CACHE_HOME\n return envPaths(identifier).cache\n}\n\nconst constants = {\n environmentVariables: {\n alwaysLogAnalytics: 'SHOPIFY_CLI_ALWAYS_LOG_ANALYTICS',\n deviceAuth: 'SHOPIFY_CLI_DEVICE_AUTH',\n enableCliRedirect: 'SHOPIFY_CLI_ENABLE_CLI_REDIRECT',\n env: 'SHOPIFY_CLI_ENV',\n firstPartyDev: 'SHOPIFY_CLI_1P_DEV',\n noAnalytics: 'SHOPIFY_CLI_NO_ANALYTICS',\n partnersToken: 'SHOPIFY_CLI_PARTNERS_TOKEN',\n runAsUser: 'SHOPIFY_RUN_AS_USER',\n serviceEnv: 'SHOPIFY_SERVICE_ENV',\n skipCliRedirect: 'SHOPIFY_CLI_SKIP_CLI_REDIRECT',\n spinHost: 'SPIN_HOST',\n spinInstance: 'SPIN_INSTANCE',\n spinNamespace: 'SPIN_NAMESPACE',\n spinWorkspace: 'SPIN_WORKSPACE',\n themeToken: 'SHOPIFY_CLI_THEME_TOKEN',\n unitTest: 'SHOPIFY_UNIT_TEST',\n verbose: 'SHOPIFY_FLAG_VERBOSE',\n themeBundling: 'SHOPIFY_THEME_BUNDLING',\n // Variables to detect if the CLI is running in a cloud environment\n codespaceName: 'CODESPACE_NAME',\n codespaces: 'CODESPACES',\n gitpod: 'GITPOD_WORKSPACE_URL',\n spin: 'SPIN',\n },\n paths: {\n executables: {\n dev: '/opt/dev/bin/dev',\n },\n directories: {\n cache: {\n path: () => {\n return cacheFolder()\n },\n vendor: {\n path: () => {\n return pathJoin(cacheFolder(), 'vendor')\n },\n binaries: () => {\n return pathJoin(cacheFolder(), 'vendor', 'binaries')\n },\n },\n },\n },\n },\n versions: {\n cliKit: async () => {\n return findPackageVersionUp({fromModuleURL: import.meta.url})\n },\n },\n keychain: {\n service: 'shopify-cli',\n },\n session: {\n expirationTimeMarginInMinutes: 4,\n },\n}\n\nexport const bugsnagApiKey = '9e1e6889176fd0c795d5c659225e0fae'\n\nexport default constants\n"]}
|
|
@@ -45,7 +45,6 @@ export declare function analyticsDisabled(env?: NodeJS.ProcessEnv): boolean;
|
|
|
45
45
|
export declare function alwaysLogAnalytics(env?: NodeJS.ProcessEnv): boolean;
|
|
46
46
|
export declare function firstPartyDev(env?: NodeJS.ProcessEnv): boolean;
|
|
47
47
|
export declare function useDeviceAuth(env?: NodeJS.ProcessEnv): boolean;
|
|
48
|
-
export declare function useFunctionMatching(env?: NodeJS.ProcessEnv): boolean;
|
|
49
48
|
export declare function useThemeBundling(env?: NodeJS.ProcessEnv): boolean;
|
|
50
49
|
export declare function gitpodURL(env?: NodeJS.ProcessEnv): string | undefined;
|
|
51
50
|
export declare function codespaceURL(env?: NodeJS.ProcessEnv): string | undefined;
|
|
@@ -76,9 +76,6 @@ export function firstPartyDev(env = process.env) {
|
|
|
76
76
|
export function useDeviceAuth(env = process.env) {
|
|
77
77
|
return isTruthy(env[constants.environmentVariables.deviceAuth]) || isCloudEnvironment(env);
|
|
78
78
|
}
|
|
79
|
-
export function useFunctionMatching(env = process.env) {
|
|
80
|
-
return isTruthy(env[constants.environmentVariables.functionMatching]);
|
|
81
|
-
}
|
|
82
79
|
export function useThemeBundling(env = process.env) {
|
|
83
80
|
return isTruthy(env[constants.environmentVariables.themeBundling]);
|
|
84
81
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local.js","sourceRoot":"","sources":["../../src/environment/local.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAA;AAChC,OAAO,SAAS,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAC,MAAM,IAAI,UAAU,EAAC,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAC,IAAI,EAAC,MAAM,cAAc,CAAA;AACjC,OAAO,aAAa,MAAM,gBAAgB,CAAA;AAC1C,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,EAAC,OAAO,EAAC,MAAM,IAAI,CAAA;AAE1B;;;GAGG;AACH,MAAM,UAAU,qBAAqB;IACnC,OAAO,aAAa,EAAE,CAAA;AACxB,CAAC;AAED;;;GAGG;AACH,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AI,GAAG,UAAU,CAAA;SAClB;aAAM,IAAI,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE;YACnC,IAAI,GAAG,QAAQ,CAAA;SAChB;aAAM,IAAI,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;YAClC,IAAI,GAAG,QAAQ,CAAA;SAChB;QAED,OAAO;YACL,IAAI,EAAE,IAAI;YACV,IAAI;SACL,CAAA;KACF;IACD,OAAO;QACL,IAAI,EAAE,KAAK;KACZ,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU;IACxB,OAAO,UAAU,CAAC,GAAG,EAAE,CAAA;AACzB,CAAC","sourcesContent":["import {isTruthy, isSet} from './utilities.js'\nimport {isSpin} from './spin.js'\nimport constants from '../constants.js'\nimport {exists as fileExists} from '../file.js'\nimport {exec} from '../system.js'\nimport isInteractive from 'is-interactive'\nimport macaddress from 'macaddress'\nimport {homedir} from 'os'\n\n/**\n * It returns true if the terminal is interactive.\n * @returns True if the terminal is interactive.\n */\nexport function isTerminalInteractive(): boolean {\n return isInteractive()\n}\n\n/**\n * Returns the path to the user's home directory.\n * @returns The path to the user's home directory.\n */\nexport function homeDirectory(): string {\n return homedir()\n}\n\n/**\n * Returns true if the CLI is running in debug mode.\n * @param env - The environment variables from the environment of the current process.\n * @returns true if SHOPIFY_ENV is development\n */\nexport function isDevelopment(env = process.env): boolean {\n return env[constants.environmentVariables.env] === 'development'\n}\n\n/**\n * Returns true if the CLI is running in verbose mode.\n * @param env - The environment variables from the environment of the current process.\n * @returns true if SHOPIFY_FLAG_VERBOSE is truthy or the flag --verbose has been passed\n */\nexport function isVerbose(env = process.env): boolean {\n return isTruthy(env[constants.environmentVariables.verbose]) || process.argv.includes('--verbose')\n}\n\n/**\n * Returns true if the environment in which the CLI is running is either\n * a local environment (where dev is present) or a cloud environment (spin).\n * @returns True if the CLI is used in a Shopify environment.\n */\nexport async function isShopify(env = process.env): Promise<boolean> {\n if (Object.prototype.hasOwnProperty.call(env, constants.environmentVariables.runAsUser)) {\n return !isTruthy(env[constants.environmentVariables.runAsUser])\n }\n const devInstalled = await fileExists(constants.paths.executables.dev)\n return devInstalled || isSpin(env)\n}\n\n/**\n * This variable is used when running unit tests to indicate that the CLI's business logic\n * is run as a subject of a unit test. We can use this variable to disable output through\n * the standard streams.\n * @param env - The environment variables from the environment of the current process.\n * @returns True if the SHOPIFY_UNIT_TEST environment variable is truthy.\n */\nexport function isUnitTest(env = process.env): boolean {\n return isTruthy(env[constants.environmentVariables.unitTest])\n}\n\n/**\n * Returns true if reporting analytics is enabled.\n * @param env - The environment variables from the environment of the current process.\n * @returns true unless SHOPIFY_CLI_NO_ANALYTICS is truthy or debug mode is enabled.\n */\nexport function analyticsDisabled(env = process.env): boolean {\n return isTruthy(env[constants.environmentVariables.noAnalytics]) || isDevelopment(env)\n}\n\n/** Returns true if reporting analytics should always happen, regardless of DEBUG mode etc. */\nexport function alwaysLogAnalytics(env = process.env): boolean {\n return isTruthy(env[constants.environmentVariables.alwaysLogAnalytics])\n}\n\nexport function firstPartyDev(env = process.env): boolean {\n return isTruthy(env[constants.environmentVariables.firstPartyDev])\n}\n\nexport function useDeviceAuth(env = process.env): boolean {\n return isTruthy(env[constants.environmentVariables.deviceAuth]) || isCloudEnvironment(env)\n}\n\nexport function useFunctionMatching(env = process.env): boolean {\n return isTruthy(env[constants.environmentVariables.functionMatching])\n}\n\nexport function useThemeBundling(env = process.env): boolean {\n return isTruthy(env[constants.environmentVariables.themeBundling])\n}\n\n// https://www.gitpod.io/docs/environment-variables#default-environment-variables\nexport function gitpodURL(env = process.env): string | undefined {\n return env[constants.environmentVariables.gitpod]\n}\n\n// https://docs.github.com/en/codespaces/developing-in-codespaces/default-environment-variables-for-your-codespace#list-of-default-environment-variables\nexport function codespaceURL(env = process.env): string | undefined {\n return env[constants.environmentVariables.codespaceName]\n}\n\n/**\n * Checks if the CLI is run from a cloud environment\n *\n * @param env - Environment variables used when the cli is launched\n *\n * @returns True in case the CLI is run from a cloud environment\n */\nexport function isCloudEnvironment(env: NodeJS.ProcessEnv = process.env): boolean {\n return cloudEnvironment(env).platform !== 'localhost'\n}\n\n/**\n * Returns the cloud environment platform name and if the platform support online IDE in case the CLI is run from one of\n * them. Platform name 'localhost' is returned otherwise\n *\n * @param env - Environment variables used when the cli is launched\n *\n * @returns Cloud platform information\n */\nexport function cloudEnvironment(env: NodeJS.ProcessEnv = process.env): {\n platform: 'spin' | 'codespaces' | 'gitpod' | 'localhost'\n editor: boolean\n} {\n if (isSet(env[constants.environmentVariables.codespaces])) {\n return {platform: 'codespaces', editor: true}\n }\n if (isSet(env[constants.environmentVariables.gitpod])) {\n return {platform: 'gitpod', editor: true}\n }\n if (isSpin(env)) {\n return {platform: 'spin', editor: false}\n }\n return {platform: 'localhost', editor: false}\n}\n\n/**\n * Returns whether the environment has Git available.\n * @returns A promise that resolves with the value.\n */\nexport async function hasGit(): Promise<boolean> {\n try {\n await exec('git', ['--version'])\n return true\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return false\n }\n}\n\n/**\n * Gets info on the CI platform the CLI is running on, if applicable\n */\nexport function ciPlatform(env = process.env): {isCI: true; name: string} | {isCI: false; name?: undefined} {\n if (isTruthy(env.CI)) {\n let name = 'unknown'\n if (isTruthy(env.CIRCLECI)) {\n name = 'circleci'\n } else if (isSet(env.GITHUB_ACTION)) {\n name = 'github'\n } else if (isTruthy(env.GITLAB_CI)) {\n name = 'gitlab'\n }\n\n return {\n isCI: true,\n name,\n }\n }\n return {\n isCI: false,\n }\n}\n\n/**\n * Returns the first mac address found\n *\n * @returns Mac address\n */\nexport function macAddress() {\n return macaddress.one()\n}\n"]}
|
|
1
|
+
{"version":3,"file":"local.js","sourceRoot":"","sources":["../../src/environment/local.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAA;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M,UAAU,UAAU,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG;IAC1C,IAAI,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;QACpB,IAAI,IAAI,GAAG,SAAS,CAAA;QACpB,IAAI,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;YAC1B,IAAI,GAAG,UAAU,CAAA;SAClB;aAAM,IAAI,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE;YACnC,IAAI,GAAG,QAAQ,CAAA;SAChB;aAAM,IAAI,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;YAClC,IAAI,GAAG,QAAQ,CAAA;SAChB;QAED,OAAO;YACL,IAAI,EAAE,IAAI;YACV,IAAI;SACL,CAAA;KACF;IACD,OAAO;QACL,IAAI,EAAE,KAAK;KACZ,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU;IACxB,OAAO,UAAU,CAAC,GAAG,EAAE,CAAA;AACzB,CAAC","sourcesContent":["import {isTruthy, isSet} from './utilities.js'\nimport {isSpin} from './spin.js'\nimport constants from '../constants.js'\nimport {exists as fileExists} from '../file.js'\nimport {exec} from '../system.js'\nimport isInteractive from 'is-interactive'\nimport macaddress from 'macaddress'\nimport {homedir} from 'os'\n\n/**\n * It returns true if the terminal is interactive.\n * @returns True if the terminal is interactive.\n */\nexport function isTerminalInteractive(): boolean {\n return isInteractive()\n}\n\n/**\n * Returns the path to the user's home directory.\n * @returns The path to the user's home directory.\n */\nexport function homeDirectory(): string {\n return homedir()\n}\n\n/**\n * Returns true if the CLI is running in debug mode.\n * @param env - The environment variables from the environment of the current process.\n * @returns true if SHOPIFY_ENV is development\n */\nexport function isDevelopment(env = process.env): boolean {\n return env[constants.environmentVariables.env] === 'development'\n}\n\n/**\n * Returns true if the CLI is running in verbose mode.\n * @param env - The environment variables from the environment of the current process.\n * @returns true if SHOPIFY_FLAG_VERBOSE is truthy or the flag --verbose has been passed\n */\nexport function isVerbose(env = process.env): boolean {\n return isTruthy(env[constants.environmentVariables.verbose]) || process.argv.includes('--verbose')\n}\n\n/**\n * Returns true if the environment in which the CLI is running is either\n * a local environment (where dev is present) or a cloud environment (spin).\n * @returns True if the CLI is used in a Shopify environment.\n */\nexport async function isShopify(env = process.env): Promise<boolean> {\n if (Object.prototype.hasOwnProperty.call(env, constants.environmentVariables.runAsUser)) {\n return !isTruthy(env[constants.environmentVariables.runAsUser])\n }\n const devInstalled = await fileExists(constants.paths.executables.dev)\n return devInstalled || isSpin(env)\n}\n\n/**\n * This variable is used when running unit tests to indicate that the CLI's business logic\n * is run as a subject of a unit test. We can use this variable to disable output through\n * the standard streams.\n * @param env - The environment variables from the environment of the current process.\n * @returns True if the SHOPIFY_UNIT_TEST environment variable is truthy.\n */\nexport function isUnitTest(env = process.env): boolean {\n return isTruthy(env[constants.environmentVariables.unitTest])\n}\n\n/**\n * Returns true if reporting analytics is enabled.\n * @param env - The environment variables from the environment of the current process.\n * @returns true unless SHOPIFY_CLI_NO_ANALYTICS is truthy or debug mode is enabled.\n */\nexport function analyticsDisabled(env = process.env): boolean {\n return isTruthy(env[constants.environmentVariables.noAnalytics]) || isDevelopment(env)\n}\n\n/** Returns true if reporting analytics should always happen, regardless of DEBUG mode etc. */\nexport function alwaysLogAnalytics(env = process.env): boolean {\n return isTruthy(env[constants.environmentVariables.alwaysLogAnalytics])\n}\n\nexport function firstPartyDev(env = process.env): boolean {\n return isTruthy(env[constants.environmentVariables.firstPartyDev])\n}\n\nexport function useDeviceAuth(env = process.env): boolean {\n return isTruthy(env[constants.environmentVariables.deviceAuth]) || isCloudEnvironment(env)\n}\n\nexport function useThemeBundling(env = process.env): boolean {\n return isTruthy(env[constants.environmentVariables.themeBundling])\n}\n\n// https://www.gitpod.io/docs/environment-variables#default-environment-variables\nexport function gitpodURL(env = process.env): string | undefined {\n return env[constants.environmentVariables.gitpod]\n}\n\n// https://docs.github.com/en/codespaces/developing-in-codespaces/default-environment-variables-for-your-codespace#list-of-default-environment-variables\nexport function codespaceURL(env = process.env): string | undefined {\n return env[constants.environmentVariables.codespaceName]\n}\n\n/**\n * Checks if the CLI is run from a cloud environment\n *\n * @param env - Environment variables used when the cli is launched\n *\n * @returns True in case the CLI is run from a cloud environment\n */\nexport function isCloudEnvironment(env: NodeJS.ProcessEnv = process.env): boolean {\n return cloudEnvironment(env).platform !== 'localhost'\n}\n\n/**\n * Returns the cloud environment platform name and if the platform support online IDE in case the CLI is run from one of\n * them. Platform name 'localhost' is returned otherwise\n *\n * @param env - Environment variables used when the cli is launched\n *\n * @returns Cloud platform information\n */\nexport function cloudEnvironment(env: NodeJS.ProcessEnv = process.env): {\n platform: 'spin' | 'codespaces' | 'gitpod' | 'localhost'\n editor: boolean\n} {\n if (isSet(env[constants.environmentVariables.codespaces])) {\n return {platform: 'codespaces', editor: true}\n }\n if (isSet(env[constants.environmentVariables.gitpod])) {\n return {platform: 'gitpod', editor: true}\n }\n if (isSpin(env)) {\n return {platform: 'spin', editor: false}\n }\n return {platform: 'localhost', editor: false}\n}\n\n/**\n * Returns whether the environment has Git available.\n * @returns A promise that resolves with the value.\n */\nexport async function hasGit(): Promise<boolean> {\n try {\n await exec('git', ['--version'])\n return true\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return false\n }\n}\n\n/**\n * Gets info on the CI platform the CLI is running on, if applicable\n */\nexport function ciPlatform(env = process.env): {isCI: true; name: string} | {isCI: false; name?: undefined} {\n if (isTruthy(env.CI)) {\n let name = 'unknown'\n if (isTruthy(env.CIRCLECI)) {\n name = 'circleci'\n } else if (isSet(env.GITHUB_ACTION)) {\n name = 'github'\n } else if (isTruthy(env.GITLAB_CI)) {\n name = 'gitlab'\n }\n\n return {\n isCI: true,\n name,\n }\n }\n return {\n isCI: false,\n }\n}\n\n/**\n * Returns the first mac address found\n *\n * @returns Mac address\n */\nexport function macAddress() {\n return macaddress.one()\n}\n"]}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
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,
|
|
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,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 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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function unionArrayStrategy(destinationArray: unknown[], sourceArray: unknown[]): unknown[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../../src/private/common/array.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,kBAAkB,CAAC,gBAA2B,EAAE,WAAsB;IACpF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,gBAAgB,EAAE,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;AACnE,CAAC","sourcesContent":["export function unionArrayStrategy(destinationArray: unknown[], sourceArray: unknown[]): unknown[] {\n return Array.from(new Set([...destinationArray, ...sourceArray]))\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AdminSession } from '../../../session.js';
|
|
2
|
+
export declare function restRequestBody<T>(requestBody?: T): string | undefined;
|
|
3
|
+
export declare function restRequestUrl(session: AdminSession, apiVersion: string, path: string): string;
|
|
4
|
+
export declare function restRequestHeaders(session: AdminSession): Promise<{
|
|
5
|
+
[key: string]: string;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { buildHeaders } from './headers.js';
|
|
2
|
+
export function restRequestBody(requestBody) {
|
|
3
|
+
if (!requestBody) {
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
return JSON.stringify(requestBody);
|
|
7
|
+
}
|
|
8
|
+
export function restRequestUrl(session, apiVersion, path) {
|
|
9
|
+
if (isThemeAccessSession(session)) {
|
|
10
|
+
return `https://theme-kit-access.shopifyapps.com/cli/admin/api/${apiVersion}${path}.json`;
|
|
11
|
+
}
|
|
12
|
+
return `https://${session.storeFqdn}/admin/api/${apiVersion}${path}.json`;
|
|
13
|
+
}
|
|
14
|
+
export async function restRequestHeaders(session) {
|
|
15
|
+
const store = session.storeFqdn;
|
|
16
|
+
const token = session.token;
|
|
17
|
+
const headers = await buildHeaders(session.token);
|
|
18
|
+
if (isThemeAccessSession(session)) {
|
|
19
|
+
headers['X-Shopify-Shop'] = store;
|
|
20
|
+
headers['X-Shopify-Access-Token'] = token;
|
|
21
|
+
}
|
|
22
|
+
return headers;
|
|
23
|
+
}
|
|
24
|
+
function isThemeAccessSession(session) {
|
|
25
|
+
return session.token.startsWith('shptka_');
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=rest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rest.js","sourceRoot":"","sources":["../../../../src/private/node/api/rest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,cAAc,CAAA;AAGzC,MAAM,UAAU,eAAe,CAAI,WAAe;IAChD,IAAI,CAAC,WAAW,EAAE;QAChB,OAAM;KACP;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAA;AACpC,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,OAAqB,EAAE,UAAkB,EAAE,IAAY;IACpF,IAAI,oBAAoB,CAAC,OAAO,CAAC,EAAE;QACjC,OAAO,0DAA0D,UAAU,GAAG,IAAI,OAAO,CAAA;KAC1F;IAED,OAAO,WAAW,OAAO,CAAC,SAAS,cAAc,UAAU,GAAG,IAAI,OAAO,CAAA;AAC3E,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,OAAqB;IAC5D,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,CAAA;IAC/B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAA;IAC3B,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAEjD,IAAI,oBAAoB,CAAC,OAAO,CAAC,EAAE;QACjC,OAAO,CAAC,gBAAgB,CAAC,GAAG,KAAK,CAAA;QACjC,OAAO,CAAC,wBAAwB,CAAC,GAAG,KAAK,CAAA;KAC1C;IAED,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,SAAS,oBAAoB,CAAC,OAAqB;IACjD,OAAO,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,CAAA;AAC5C,CAAC","sourcesContent":["import {buildHeaders} from './headers.js'\nimport {AdminSession} from '../../../session.js'\n\nexport function restRequestBody<T>(requestBody?: T) {\n if (!requestBody) {\n return\n }\n return JSON.stringify(requestBody)\n}\n\nexport function restRequestUrl(session: AdminSession, apiVersion: string, path: string) {\n if (isThemeAccessSession(session)) {\n return `https://theme-kit-access.shopifyapps.com/cli/admin/api/${apiVersion}${path}.json`\n }\n\n return `https://${session.storeFqdn}/admin/api/${apiVersion}${path}.json`\n}\n\nexport async function restRequestHeaders(session: AdminSession) {\n const store = session.storeFqdn\n const token = session.token\n const headers = await buildHeaders(session.token)\n\n if (isThemeAccessSession(session)) {\n headers['X-Shopify-Shop'] = store\n headers['X-Shopify-Access-Token'] = token\n }\n\n return headers\n}\n\nfunction isThemeAccessSession(session: AdminSession) {\n return session.token.startsWith('shptka_')\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Text } from 'ink';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* `Subdued` displays some text with subdued colors
|
|
5
|
+
*/
|
|
6
|
+
const Subdued = ({ subdued }) => {
|
|
7
|
+
return React.createElement(Text, { dimColor: true }, subdued);
|
|
8
|
+
};
|
|
9
|
+
export { Subdued };
|
|
10
|
+
//# sourceMappingURL=Subdued.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Subdued.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/Subdued.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAA;AACxB,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB;;GAEG;AACH,MAAM,OAAO,GAAoB,CAAC,EAAC,OAAO,EAAiC,EAAe,EAAE;IAC1F,OAAO,oBAAC,IAAI,IAAC,QAAQ,UAAE,OAAO,CAAQ,CAAA;AACxC,CAAC,CAAA;AAED,OAAO,EAAC,OAAO,EAAC,CAAA","sourcesContent":["import {Text} from 'ink'\nimport React from 'react'\n\ninterface Props {\n subdued: string\n}\n\n/**\n * `Subdued` displays some text with subdued colors\n */\nconst Subdued: React.FC<Props> = ({subdued}: React.PropsWithChildren<Props>): JSX.Element => {\n return <Text dimColor>{subdued}</Text>\n}\n\nexport {Subdued}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Subdued } from './Subdued.js';
|
|
2
|
+
import { describe, expect, test } from 'vitest';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { render } from 'ink-testing-library';
|
|
5
|
+
describe('Subdued', async () => {
|
|
6
|
+
test('renders correctly', async () => {
|
|
7
|
+
const { lastFrame } = render(React.createElement(Subdued, { subdued: "my-text" }));
|
|
8
|
+
expect(lastFrame()).toEqual('[2mmy-text[22m');
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=Subdued.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Subdued.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/Subdued.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAA;AACpC,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAC,MAAM,QAAQ,CAAA;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAA;AAE1C,QAAQ,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;IAC7B,IAAI,CAAC,mBAAmB,EAAE,KAAK,IAAI,EAAE;QACnC,MAAM,EAAC,SAAS,EAAC,GAAG,MAAM,CAAC,oBAAC,OAAO,IAAC,OAAO,EAAC,SAAS,GAAG,CAAC,CAAA;QAEzD,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAA;IACjD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import {Subdued} from './Subdued.js'\nimport {describe, expect, test} from 'vitest'\nimport React from 'react'\nimport {render} from 'ink-testing-library'\n\ndescribe('Subdued', async () => {\n test('renders correctly', async () => {\n const {lastFrame} = render(<Subdued subdued=\"my-text\" />)\n\n expect(lastFrame()).toEqual('\u001b[2mmy-text\u001b[22m')\n })\n})\n"]}
|
|
@@ -14,6 +14,9 @@ interface CharToken {
|
|
|
14
14
|
interface UserInputToken {
|
|
15
15
|
userInput: string;
|
|
16
16
|
}
|
|
17
|
+
interface SubduedToken {
|
|
18
|
+
subdued: string;
|
|
19
|
+
}
|
|
17
20
|
interface FilePathToken {
|
|
18
21
|
filePath: string;
|
|
19
22
|
}
|
|
@@ -23,7 +26,7 @@ interface ListToken {
|
|
|
23
26
|
ordered?: boolean;
|
|
24
27
|
};
|
|
25
28
|
}
|
|
26
|
-
declare type Token = string | CommandToken | LinkToken | CharToken | UserInputToken | FilePathToken | ListToken;
|
|
29
|
+
declare type Token = string | CommandToken | LinkToken | CharToken | UserInputToken | SubduedToken | FilePathToken | ListToken;
|
|
27
30
|
export declare type TokenItem = Token | Token[];
|
|
28
31
|
interface Props {
|
|
29
32
|
item: TokenItem;
|
|
@@ -3,6 +3,7 @@ import { Link } from './Link.js';
|
|
|
3
3
|
import { List } from './List.js';
|
|
4
4
|
import { UserInput } from './UserInput.js';
|
|
5
5
|
import { FilePath } from './FilePath.js';
|
|
6
|
+
import { Subdued } from './Subdued.js';
|
|
6
7
|
import { Box, Text } from 'ink';
|
|
7
8
|
import React from 'react';
|
|
8
9
|
function tokenToBlock(token) {
|
|
@@ -46,6 +47,9 @@ const TokenizedText = ({ item }) => {
|
|
|
46
47
|
else if ('userInput' in item) {
|
|
47
48
|
return React.createElement(UserInput, { userInput: item.userInput });
|
|
48
49
|
}
|
|
50
|
+
else if ('subdued' in item) {
|
|
51
|
+
return React.createElement(Subdued, { subdued: item.subdued });
|
|
52
|
+
}
|
|
49
53
|
else if ('filePath' in item) {
|
|
50
54
|
return React.createElement(FilePath, { filePath: item.filePath });
|
|
51
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TokenizedText.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/TokenizedText.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAA;AACpC,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAA;AACtC,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,KAAK,CAAA;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"TokenizedText.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/TokenizedText.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAA;AACpC,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAA;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AAa,IAAC,IAAI,EAAE,IAAI,CAAC,KAAK,GAAI,CAC9B,CACR,CAAC,CACG,CACR,CAAA;aACF;iBAAM;gBACL,OAAO,oBAAC,IAAI,IAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAG,KAAK,CAAC,CAAC,CAAE,CAAC,KAAmB,CAAC,IAAI,CAAC,KAAK,GAAI,CAAA;aACnF;QACH,CAAC,CAAC,CACE,CACP,CAAA;KACF;AACH,CAAC,CAAA;AAED,OAAO,EAAC,aAAa,EAAC,CAAA","sourcesContent":["import {Command} from './Command.js'\nimport {Link} from './Link.js'\nimport {List} from './List.js'\nimport {UserInput} from './UserInput.js'\nimport {FilePath} from './FilePath.js'\nimport {Subdued} from './Subdued.js'\nimport {Box, Text} from 'ink'\nimport React from 'react'\n\ninterface CommandToken {\n command: string\n}\n\ninterface LinkToken {\n link: {\n label?: string\n url: string\n }\n}\n\ninterface CharToken {\n char: string\n}\n\ninterface UserInputToken {\n userInput: string\n}\n\ninterface SubduedToken {\n subdued: string\n}\n\ninterface FilePathToken {\n filePath: string\n}\n\ninterface ListToken {\n list: {\n items: TokenItem[]\n ordered?: boolean\n }\n}\n\ntype Token = string | CommandToken | LinkToken | CharToken | UserInputToken | SubduedToken | FilePathToken | ListToken\nexport type TokenItem = Token | Token[]\n\ntype DisplayType = 'block' | 'inline'\ninterface Block {\n display: DisplayType\n value: Token\n}\n\nfunction tokenToBlock(token: Token): Block {\n return {\n display: typeof token !== 'string' && 'list' in token ? 'block' : 'inline',\n value: token,\n }\n}\n\nfunction splitByDisplayType(acc: Block[][], item: Block) {\n if (item.display === 'block') {\n acc.push([item])\n } else {\n const last = acc[acc.length - 1]\n if (last && last[0]!.display === 'inline') {\n last.push(item)\n } else {\n acc.push([item])\n }\n }\n return acc\n}\n\ninterface Props {\n item: TokenItem\n}\n\n/**\n * `TokenizedText` renders a text string with tokens that can be either strings,\n * links, and commands.\n */\nconst TokenizedText: React.FC<Props> = ({item}) => {\n if (typeof item === 'string') {\n return <Text>{item}</Text>\n } else if ('command' in item) {\n return <Command command={item.command} />\n } else if ('link' in item) {\n return <Link {...item.link} />\n } else if ('char' in item) {\n return <Text>{item.char[0]}</Text>\n } else if ('userInput' in item) {\n return <UserInput userInput={item.userInput} />\n } else if ('subdued' in item) {\n return <Subdued subdued={item.subdued} />\n } else if ('filePath' in item) {\n return <FilePath filePath={item.filePath} />\n } else if ('list' in item) {\n return <List {...item.list} />\n } else {\n const groupedItems = item.map(tokenToBlock).reduce(splitByDisplayType, [])\n\n return (\n <Box flexDirection=\"column\">\n {groupedItems.map((items, groupIndex) => {\n if (items[0]!.display === 'inline') {\n return (\n <Text key={groupIndex}>\n {items.map((item, itemIndex) => (\n <Text key={itemIndex}>\n {itemIndex !== 0 && !(typeof item.value !== 'string' && 'char' in item.value) && <Text> </Text>}\n <TokenizedText item={item.value} />\n </Text>\n ))}\n </Text>\n )\n } else {\n return <List key={groupIndex} items={(items[0]!.value as ListToken).list.items} />\n }\n })}\n </Box>\n )\n }\n}\n\nexport {TokenizedText}\n"]}
|
|
@@ -22,6 +22,9 @@ describe('TokenizedText', async () => {
|
|
|
22
22
|
{
|
|
23
23
|
userInput: 'my-app',
|
|
24
24
|
},
|
|
25
|
+
{
|
|
26
|
+
subdued: '(my-text)',
|
|
27
|
+
},
|
|
25
28
|
{
|
|
26
29
|
list: {
|
|
27
30
|
items: ['Item 1', 'Item 2', 'Item 3'],
|
|
@@ -33,7 +36,7 @@ describe('TokenizedText', async () => {
|
|
|
33
36
|
];
|
|
34
37
|
const { lastFrame } = render(React.createElement(TokenizedText, { item: item }));
|
|
35
38
|
expect(unstyled(lastFrame())).toMatchInlineSnapshot(`
|
|
36
|
-
"Run \`cd verification-app\` Example ( https://example.com )! my-app
|
|
39
|
+
"Run \`cd verification-app\` Example ( https://example.com )! my-app (my-text)
|
|
37
40
|
• Item 1
|
|
38
41
|
• Item 2
|
|
39
42
|
• Item 3
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TokenizedText.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/TokenizedText.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAC,MAAM,QAAQ,CAAA;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAA;AAE1C,QAAQ,CAAC,eAAe,EAAE,KAAK,IAAI,EAAE;IACnC,IAAI,CAAC,6CAA6C,EAAE,KAAK,IAAI,EAAE;QAC7D,MAAM,IAAI,GAAG;YACX,KAAK;YACL;gBACE,OAAO,EAAE,qBAAqB;aAC/B;YACD;gBACE,IAAI,EAAE;oBACJ,GAAG,EAAE,qBAAqB;oBAC1B,KAAK,EAAE,SAAS;iBACjB;aACF;YACD;gBACE,IAAI,EAAE,GAAG;aACV;YACD;gBACE,SAAS,EAAE,QAAQ;aACpB;YACD;gBACE,IAAI,EAAE;oBACJ,KAAK,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC;iBACtC;aACF;YACD;gBACE,QAAQ,EAAE,uBAAuB;aAClC;SACF,CAAA;QAED,MAAM,EAAC,SAAS,EAAC,GAAG,MAAM,CAAC,oBAAC,aAAa,IAAC,IAAI,EAAE,IAAI,GAAI,CAAC,CAAA;QAEzD,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAG,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;;;KAMpD,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import {TokenizedText} from './TokenizedText.js'\nimport {unstyled} from '../../../../output.js'\nimport {describe, expect, test} from 'vitest'\nimport React from 'react'\nimport {render} from 'ink-testing-library'\n\ndescribe('TokenizedText', async () => {\n test('renders arrays of items separated by spaces', async () => {\n const item = [\n 'Run',\n {\n command: 'cd verification-app',\n },\n {\n link: {\n url: 'https://example.com',\n label: 'Example',\n },\n },\n {\n char: '!',\n },\n {\n userInput: 'my-app',\n },\n {\n list: {\n items: ['Item 1', 'Item 2', 'Item 3'],\n },\n },\n {\n filePath: 'src/this/is/a/test.js',\n },\n ]\n\n const {lastFrame} = render(<TokenizedText item={item} />)\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"Run \\`cd verification-app\\` Example ( https://example.com )! my-app\n • Item 1\n • Item 2\n • Item 3\n \\\\\"src/this/is/a/test.js\\\\\"\"\n `)\n })\n})\n"]}
|
|
1
|
+
{"version":3,"file":"TokenizedText.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/TokenizedText.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAC,MAAM,QAAQ,CAAA;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAA;AAE1C,QAAQ,CAAC,eAAe,EAAE,KAAK,IAAI,EAAE;IACnC,IAAI,CAAC,6CAA6C,EAAE,KAAK,IAAI,EAAE;QAC7D,MAAM,IAAI,GAAG;YACX,KAAK;YACL;gBACE,OAAO,EAAE,qBAAqB;aAC/B;YACD;gBACE,IAAI,EAAE;oBACJ,GAAG,EAAE,qBAAqB;oBAC1B,KAAK,EAAE,SAAS;iBACjB;aACF;YACD;gBACE,IAAI,EAAE,GAAG;aACV;YACD;gBACE,SAAS,EAAE,QAAQ;aACpB;YACD;gBACE,OAAO,EAAE,WAAW;aACrB;YACD;gBACE,IAAI,EAAE;oBACJ,KAAK,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC;iBACtC;aACF;YACD;gBACE,QAAQ,EAAE,uBAAuB;aAClC;SACF,CAAA;QAED,MAAM,EAAC,SAAS,EAAC,GAAG,MAAM,CAAC,oBAAC,aAAa,IAAC,IAAI,EAAE,IAAI,GAAI,CAAC,CAAA;QAEzD,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAG,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;;;KAMpD,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import {TokenizedText} from './TokenizedText.js'\nimport {unstyled} from '../../../../output.js'\nimport {describe, expect, test} from 'vitest'\nimport React from 'react'\nimport {render} from 'ink-testing-library'\n\ndescribe('TokenizedText', async () => {\n test('renders arrays of items separated by spaces', async () => {\n const item = [\n 'Run',\n {\n command: 'cd verification-app',\n },\n {\n link: {\n url: 'https://example.com',\n label: 'Example',\n },\n },\n {\n char: '!',\n },\n {\n userInput: 'my-app',\n },\n {\n subdued: '(my-text)',\n },\n {\n list: {\n items: ['Item 1', 'Item 2', 'Item 3'],\n },\n },\n {\n filePath: 'src/this/is/a/test.js',\n },\n ]\n\n const {lastFrame} = render(<TokenizedText item={item} />)\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"Run \\`cd verification-app\\` Example ( https://example.com )! my-app (my-text)\n • Item 1\n • Item 2\n • Item 3\n \\\\\"src/this/is/a/test.js\\\\\"\"\n `)\n })\n})\n"]}
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import type { List, ValueIteratee } from 'lodash';
|
|
2
2
|
/**
|
|
3
3
|
* Takes a random value from an array.
|
|
4
|
+
*
|
|
4
5
|
* @param array - Array from which we'll select a random item.
|
|
5
6
|
* @returns A random element from the array.
|
|
6
7
|
*/
|
|
7
8
|
export declare function takeRandomFromArray<T>(array: T[]): T;
|
|
8
9
|
/**
|
|
9
10
|
* Returns a copy of the array deleting the elemements that are undefined.
|
|
11
|
+
*
|
|
10
12
|
* @param array - The array whose undefined will be deleted.
|
|
11
13
|
* @returns A copy of the array with the undefined elements deleted.
|
|
12
14
|
*/
|
|
13
15
|
export declare function getArrayRejectingUndefined<T>(array: (T | undefined)[]): T[];
|
|
14
16
|
/**
|
|
15
17
|
* Returns true if an array contains duplicates.
|
|
18
|
+
*
|
|
19
|
+
* @param array - The array to check against.
|
|
16
20
|
* @returns True if the array contains duplicates.
|
|
17
21
|
*/
|
|
18
22
|
export declare function getArrayContainsDuplicates<T>(array: T[]): boolean;
|
|
@@ -2,6 +2,7 @@ import { createRequire } from 'module';
|
|
|
2
2
|
const require = createRequire(import.meta.url);
|
|
3
3
|
/**
|
|
4
4
|
* Takes a random value from an array.
|
|
5
|
+
*
|
|
5
6
|
* @param array - Array from which we'll select a random item.
|
|
6
7
|
* @returns A random element from the array.
|
|
7
8
|
*/
|
|
@@ -10,6 +11,7 @@ export function takeRandomFromArray(array) {
|
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
12
13
|
* Returns a copy of the array deleting the elemements that are undefined.
|
|
14
|
+
*
|
|
13
15
|
* @param array - The array whose undefined will be deleted.
|
|
14
16
|
* @returns A copy of the array with the undefined elements deleted.
|
|
15
17
|
*/
|
|
@@ -18,6 +20,8 @@ export function getArrayRejectingUndefined(array) {
|
|
|
18
20
|
}
|
|
19
21
|
/**
|
|
20
22
|
* Returns true if an array contains duplicates.
|
|
23
|
+
*
|
|
24
|
+
* @param array - The array to check against.
|
|
21
25
|
* @returns True if the array contains duplicates.
|
|
22
26
|
*/
|
|
23
27
|
export function getArrayContainsDuplicates(array) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../../src/public/common/array.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
|
|
1
|
+
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../../src/public/common/array.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;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAI,KAAU;IAC/C,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAE,CAAA;AACzD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CAAI,KAAwB;IACpE,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,SAAS,CAAmC,CAAA;AACrF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CAAI,KAAU;IACtD,OAAO,KAAK,CAAC,MAAM,KAAK,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,CAAA;AAC7C,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,MAAM,CAAI,KAAiC,EAAE,QAA0B;IACrF,MAAM,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;IAC7C,OAAO,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;AACtC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CAAI,KAAiC,EAAE,GAAG,MAAiB;IACnF,MAAM,gBAAgB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAA;IACrD,OAAO,gBAAgB,CAAC,KAAK,EAAE,GAAG,MAAM,CAAC,CAAA;AAC3C,CAAC","sourcesContent":["import {createRequire} from 'module'\nimport type {List, ValueIteratee} from 'lodash'\n\nconst require = createRequire(import.meta.url)\n\n/**\n * Takes a random value from an array.\n *\n * @param array - Array from which we'll select a random item.\n * @returns A random element from the array.\n */\nexport function takeRandomFromArray<T>(array: T[]): T {\n return array[Math.floor(Math.random() * array.length)]!\n}\n\n/**\n * Returns a copy of the array deleting the elemements that are undefined.\n *\n * @param array - The array whose undefined will be deleted.\n * @returns A copy of the array with the undefined elements deleted.\n */\nexport function getArrayRejectingUndefined<T>(array: (T | undefined)[]): T[] {\n return array.filter((item) => item !== undefined) as Exclude<T, null | undefined>[]\n}\n\n/**\n * Returns true if an array contains duplicates.\n *\n * @param array - The array to check against.\n * @returns True if the array contains duplicates.\n */\nexport function getArrayContainsDuplicates<T>(array: T[]): boolean {\n return array.length !== new Set(array).size\n}\n\n/**\n * This method is like `_.uniq` except that it accepts `iteratee` which is\n * invoked for each element in `array` to generate the criterion by which\n * uniqueness is computed. The iteratee is invoked with one argument: (value).\n *\n * @param array - The array to inspect.\n * @param iteratee - The iteratee invoked per element.\n * @returns Returns the new duplicate free array.\n */\nexport function uniqBy<T>(array: List<T> | null | undefined, iteratee: ValueIteratee<T>): T[] {\n const lodashUniqBy = require('lodash/uniqBy')\n return lodashUniqBy(array, iteratee)\n}\n\n/**\n * Creates an array of `array` values not included in the other provided arrays using SameValueZero for\n * equality comparisons. The order and references of result values are determined by the first array.\n *\n * @param array - The array to inspect.\n * @param values - The arrays of values to exclude.\n * @returns Returns the new array of filtered values.\n */\nexport function difference<T>(array: List<T> | null | undefined, ...values: List<T>[]): T[] {\n const lodashDifference = require('lodash/difference')\n return lodashDifference(array, ...values)\n}\n"]}
|
|
@@ -13,7 +13,7 @@ export declare function deepMergeObjects<T1, T2>(lhs: Partial<T1>, rhs: Partial<
|
|
|
13
13
|
* Creates an object composed of the `object` properties `predicate` returns
|
|
14
14
|
* truthy for. The predicate is invoked with two arguments: (value, key).
|
|
15
15
|
*
|
|
16
|
-
* @param object-
|
|
16
|
+
* @param object - The source object.
|
|
17
17
|
* @param predicate - The function invoked per property.
|
|
18
18
|
* @returns Returns the new object.
|
|
19
19
|
*/
|
|
@@ -23,10 +23,10 @@ export declare function pickBy<T, S extends T>(object: Dictionary<T> | null | un
|
|
|
23
23
|
* enumerable property of object through iteratee. The iteratee function is
|
|
24
24
|
* invoked with three arguments: (value, key, object).
|
|
25
25
|
*
|
|
26
|
-
* @param
|
|
26
|
+
* @param source - The object to iterate over.
|
|
27
27
|
* @param callback - The function invoked per iteration.
|
|
28
28
|
* @returns Returns the new mapped object.
|
|
29
29
|
*/
|
|
30
|
-
export declare function mapValues<T extends object, TResult>(
|
|
30
|
+
export declare function mapValues<T extends object, TResult>(source: T | null | undefined, callback: ObjectIterator<T, TResult>): {
|
|
31
31
|
[P in keyof T]: TResult;
|
|
32
32
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { unionArrayStrategy } from '../../private/common/array.js';
|
|
1
2
|
import deepMerge from 'deepmerge';
|
|
2
3
|
import { createRequire } from 'module';
|
|
3
4
|
const require = createRequire(import.meta.url);
|
|
@@ -17,7 +18,7 @@ export function deepMergeObjects(lhs, rhs, arrayMergeStrategy = unionArrayStrate
|
|
|
17
18
|
* Creates an object composed of the `object` properties `predicate` returns
|
|
18
19
|
* truthy for. The predicate is invoked with two arguments: (value, key).
|
|
19
20
|
*
|
|
20
|
-
* @param object-
|
|
21
|
+
* @param object - The source object.
|
|
21
22
|
* @param predicate - The function invoked per property.
|
|
22
23
|
* @returns Returns the new object.
|
|
23
24
|
*/
|
|
@@ -31,15 +32,12 @@ export function pickBy(object, predicate) {
|
|
|
31
32
|
* enumerable property of object through iteratee. The iteratee function is
|
|
32
33
|
* invoked with three arguments: (value, key, object).
|
|
33
34
|
*
|
|
34
|
-
* @param
|
|
35
|
+
* @param source - The object to iterate over.
|
|
35
36
|
* @param callback - The function invoked per iteration.
|
|
36
37
|
* @returns Returns the new mapped object.
|
|
37
38
|
*/
|
|
38
|
-
export function mapValues(
|
|
39
|
+
export function mapValues(source, callback) {
|
|
39
40
|
const lodashMapValues = require('lodash/mapValues.js');
|
|
40
|
-
return lodashMapValues(
|
|
41
|
-
}
|
|
42
|
-
function unionArrayStrategy(destinationArray, sourceArray) {
|
|
43
|
-
return Array.from(new Set([...destinationArray, ...sourceArray]));
|
|
41
|
+
return lodashMapValues(source, callback);
|
|
44
42
|
}
|
|
45
43
|
//# sourceMappingURL=object.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object.js","sourceRoot":"","sources":["../../../src/public/common/object.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAA;AAEjC,OAAO,EAAC,aAAa,EAAC,MAAM,QAAQ,CAAA;AAEpC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAE9C;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAC9B,GAAgB,EAChB,GAAgB,EAChB,qBAAyF,kBAAkB;IAE3G,OAAO,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAC,UAAU,EAAE,kBAAkB,EAAC,CAAC,CAAA;AAC9D,CAAC;AAED;;;;;;;GAOG;AACH,gEAAgE;AAChE,MAAM,UAAU,MAAM,CACpB,MAAwC,EACxC,SAA+B;IAE/B,MAAM,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAA;IAChD,OAAO,YAAY,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;AACxC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,SAAS,CACvB,
|
|
1
|
+
{"version":3,"file":"object.js","sourceRoot":"","sources":["../../../src/public/common/object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,+BAA+B,CAAA;AAChE,OAAO,SAAS,MAAM,WAAW,CAAA;AAEjC,OAAO,EAAC,aAAa,EAAC,MAAM,QAAQ,CAAA;AAEpC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAE9C;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAC9B,GAAgB,EAChB,GAAgB,EAChB,qBAAyF,kBAAkB;IAE3G,OAAO,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAC,UAAU,EAAE,kBAAkB,EAAC,CAAC,CAAA;AAC9D,CAAC;AAED;;;;;;;GAOG;AACH,gEAAgE;AAChE,MAAM,UAAU,MAAM,CACpB,MAAwC,EACxC,SAA+B;IAE/B,MAAM,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAA;IAChD,OAAO,YAAY,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;AACxC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,SAAS,CACvB,MAA4B,EAC5B,QAAoC;IAEpC,MAAM,eAAe,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAA;IACtD,OAAO,eAAe,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;AAC1C,CAAC","sourcesContent":["import {unionArrayStrategy} from '../../private/common/array.js'\nimport deepMerge from 'deepmerge'\nimport {Dictionary, ObjectIterator, ValueKeyIteratee} from 'lodash'\nimport {createRequire} from 'module'\n\nconst require = createRequire(import.meta.url)\n\n/**\n * Deep merges the two objects and returns a new object with the merge result.\n *\n * @param lhs - One of the objects to be merged.\n * @param rhs - Another object to be merged.\n * @param arrayMergeStrategy - Strategy used to merge the array typed fields. Union strategy is used by default to avoid\n * duplicated elements.\n * @returns A Javascrip tobject with th emerged objects.\n */\nexport function deepMergeObjects<T1, T2>(\n lhs: Partial<T1>,\n rhs: Partial<T2>,\n arrayMergeStrategy: (destinationArray: unknown[], sourceArray: unknown[]) => unknown[] = unionArrayStrategy,\n): T1 & T2 {\n return deepMerge(lhs, rhs, {arrayMerge: arrayMergeStrategy})\n}\n\n/**\n * Creates an object composed of the `object` properties `predicate` returns\n * truthy for. The predicate is invoked with two arguments: (value, key).\n *\n * @param object - The source object.\n * @param predicate - The function invoked per property.\n * @returns Returns the new object.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function pickBy<T, S extends T>(\n object: Dictionary<T> | null | undefined,\n predicate?: ValueKeyIteratee<T>,\n): Dictionary<S> {\n const lodashPickBy = require('lodash/pickBy.js')\n return lodashPickBy(object, predicate)\n}\n\n/**\n * Creates an object with the same keys as object and values generated by running each own\n * enumerable property of object through iteratee. The iteratee function is\n * invoked with three arguments: (value, key, object).\n *\n * @param source - The object to iterate over.\n * @param callback - The function invoked per iteration.\n * @returns Returns the new mapped object.\n */\nexport function mapValues<T extends object, TResult>(\n source: T | null | undefined,\n callback: ObjectIterator<T, TResult>,\n): {[P in keyof T]: TResult} {\n const lodashMapValues = require('lodash/mapValues.js')\n return lodashMapValues(source, callback)\n}\n"]}
|
|
@@ -3,5 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @param url - URL to be checked.
|
|
5
5
|
* @returns True if the URL is valid, false otherwise.
|
|
6
|
+
* @throws An error if URL's constructor throws an error other than `TypeError`.
|
|
6
7
|
*/
|
|
7
|
-
export declare
|
|
8
|
+
export declare function isValidURL(url: string): boolean;
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @param url - URL to be checked.
|
|
5
5
|
* @returns True if the URL is valid, false otherwise.
|
|
6
|
+
* @throws An error if URL's constructor throws an error other than `TypeError`.
|
|
6
7
|
*/
|
|
7
|
-
export
|
|
8
|
+
export function isValidURL(url) {
|
|
8
9
|
try {
|
|
9
10
|
return Boolean(new URL(url));
|
|
10
11
|
}
|
|
@@ -13,5 +14,5 @@ export const isValidURL = (url) => {
|
|
|
13
14
|
return false;
|
|
14
15
|
throw error;
|
|
15
16
|
}
|
|
16
|
-
}
|
|
17
|
+
}
|
|
17
18
|
//# sourceMappingURL=url.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../../src/public/common/url.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../../src/public/common/url.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,IAAI;QACF,OAAO,OAAO,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;KAC7B;IAAC,OAAO,KAAc,EAAE;QACvB,IAAI,KAAK,YAAY,SAAS;YAAE,OAAO,KAAK,CAAA;QAC5C,MAAM,KAAK,CAAA;KACZ;AACH,CAAC","sourcesContent":["/**\n * Check if the format of a URL is valid or not.\n *\n * @param url - URL to be checked.\n * @returns True if the URL is valid, false otherwise.\n * @throws An error if URL's constructor throws an error other than `TypeError`.\n */\nexport function isValidURL(url: string): boolean {\n try {\n return Boolean(new URL(url))\n } catch (error: unknown) {\n if (error instanceof TypeError) return false\n throw error\n }\n}\n"]}
|
|
@@ -9,3 +9,33 @@ import { GraphQLVariables } from '../../../private/node/api/graphql.js';
|
|
|
9
9
|
* @returns The response of the query of generic type <T>.
|
|
10
10
|
*/
|
|
11
11
|
export declare function adminRequest<T>(query: string, session: AdminSession, variables?: GraphQLVariables): Promise<T>;
|
|
12
|
+
/**
|
|
13
|
+
* Executes a REST request against the Admin API.
|
|
14
|
+
*
|
|
15
|
+
* @param method - Request's HTTP method.
|
|
16
|
+
* @param path - Path of the REST resource.
|
|
17
|
+
* @param session - Shopify Admin session including token and Store FQDN.
|
|
18
|
+
* @param requestBody - Request body of including REST resource specific parameters.
|
|
19
|
+
* @param apiVersion - Admin API version.
|
|
20
|
+
* @returns - The {@link RestResponse}.
|
|
21
|
+
*/
|
|
22
|
+
export declare function restRequest<T>(method: string, path: string, session: AdminSession, requestBody?: T, apiVersion?: string): Promise<RestResponse>;
|
|
23
|
+
/**
|
|
24
|
+
* Respose of a REST request.
|
|
25
|
+
*/
|
|
26
|
+
export interface RestResponse {
|
|
27
|
+
/**
|
|
28
|
+
* REST JSON respose.
|
|
29
|
+
*/
|
|
30
|
+
json: any;
|
|
31
|
+
/**
|
|
32
|
+
* HTTP response status.
|
|
33
|
+
*/
|
|
34
|
+
status: number;
|
|
35
|
+
/**
|
|
36
|
+
* HTTP response headers.
|
|
37
|
+
*/
|
|
38
|
+
headers: {
|
|
39
|
+
[key: string]: string[];
|
|
40
|
+
};
|
|
41
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { content, token as outputToken } from '../../../output.js';
|
|
2
2
|
import { Bug, Abort } from '../../../error.js';
|
|
3
3
|
import { graphqlRequest } from '../../../private/node/api/graphql.js';
|
|
4
|
+
import { restRequestBody, restRequestHeaders, restRequestUrl } from '../../../private/node/api/rest.js';
|
|
5
|
+
import fetch from '../../../http/fetch.js';
|
|
4
6
|
import { ClientError, gql } from 'graphql-request';
|
|
5
7
|
/**
|
|
6
8
|
* Executes a GraphQL query against the Admin API.
|
|
@@ -67,4 +69,30 @@ function apiVersionQuery() {
|
|
|
67
69
|
}
|
|
68
70
|
`;
|
|
69
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Executes a REST request against the Admin API.
|
|
74
|
+
*
|
|
75
|
+
* @param method - Request's HTTP method.
|
|
76
|
+
* @param path - Path of the REST resource.
|
|
77
|
+
* @param session - Shopify Admin session including token and Store FQDN.
|
|
78
|
+
* @param requestBody - Request body of including REST resource specific parameters.
|
|
79
|
+
* @param apiVersion - Admin API version.
|
|
80
|
+
* @returns - The {@link RestResponse}.
|
|
81
|
+
*/
|
|
82
|
+
export async function restRequest(method, path, session, requestBody, apiVersion = 'unstable') {
|
|
83
|
+
const url = restRequestUrl(session, apiVersion, path);
|
|
84
|
+
const body = restRequestBody(requestBody);
|
|
85
|
+
const headers = await restRequestHeaders(session);
|
|
86
|
+
const response = await fetch(url, {
|
|
87
|
+
headers,
|
|
88
|
+
method,
|
|
89
|
+
body,
|
|
90
|
+
});
|
|
91
|
+
const json = await response.json().catch(() => ({}));
|
|
92
|
+
return {
|
|
93
|
+
json,
|
|
94
|
+
status: response.status,
|
|
95
|
+
headers: response.headers.raw(),
|
|
96
|
+
};
|
|
97
|
+
}
|
|
70
98
|
//# sourceMappingURL=admin.js.map
|