@shopify/cli-kit 4.9.5 → 5.0.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/cli/api/graphql/admin/generated/metafield_definitions_by_owner_type.d.ts +5 -0
- package/dist/cli/api/graphql/admin/generated/metafield_definitions_by_owner_type.js +22 -0
- package/dist/cli/api/graphql/admin/generated/metafield_definitions_by_owner_type.js.map +1 -1
- package/dist/private/node/api/graphql.d.ts +2 -1
- package/dist/private/node/api/graphql.js +12 -1
- package/dist/private/node/api/graphql.js.map +1 -1
- package/dist/private/node/api.d.ts +2 -0
- package/dist/private/node/api.js +49 -22
- package/dist/private/node/api.js.map +1 -1
- package/dist/private/node/command-json-schema.js +1 -0
- package/dist/private/node/command-json-schema.js.map +1 -1
- package/dist/private/node/constants.d.ts +1 -0
- package/dist/private/node/constants.js +1 -0
- package/dist/private/node/constants.js.map +1 -1
- package/dist/private/node/dev-instance-output.d.ts +47 -0
- package/dist/private/node/dev-instance-output.js +143 -0
- package/dist/private/node/dev-instance-output.js.map +1 -0
- package/dist/private/node/json-error.d.ts +1 -15
- package/dist/private/node/json-error.js +4 -98
- package/dist/private/node/json-error.js.map +1 -1
- package/dist/private/node/output-context.d.ts +8 -0
- package/dist/private/node/output-context.js +10 -0
- package/dist/private/node/output-context.js.map +1 -0
- package/dist/private/node/output.test.js +4 -4
- package/dist/private/node/output.test.js.map +1 -1
- package/dist/private/node/session/automation-token.d.ts +50 -0
- package/dist/private/node/session/automation-token.js +77 -0
- package/dist/private/node/session/automation-token.js.map +1 -0
- package/dist/private/node/session/exchange.d.ts +2 -1
- package/dist/private/node/session/exchange.js +5 -3
- package/dist/private/node/session/exchange.js.map +1 -1
- package/dist/private/node/session/permanent-store-domain.d.ts +21 -0
- package/dist/private/node/session/permanent-store-domain.js +72 -0
- package/dist/private/node/session/permanent-store-domain.js.map +1 -0
- package/dist/private/node/session.d.ts +3 -2
- package/dist/private/node/session.js +12 -3
- package/dist/private/node/session.js.map +1 -1
- package/dist/private/node/themes/trust-challenge.d.ts +31 -0
- package/dist/private/node/themes/trust-challenge.js +143 -0
- package/dist/private/node/themes/trust-challenge.js.map +1 -0
- package/dist/private/node/ui/alert.js +1 -1
- package/dist/private/node/ui/alert.js.map +1 -1
- package/dist/private/node/ui/components/ConcurrentOutput.d.ts +2 -7
- package/dist/private/node/ui/components/ConcurrentOutput.js +4 -8
- package/dist/private/node/ui/components/ConcurrentOutput.js.map +1 -1
- package/dist/private/node/ui/components/LoadingBar.js +9 -15
- package/dist/private/node/ui/components/LoadingBar.js.map +1 -1
- package/dist/private/node/ui/components/LoadingBar.test.js +45 -107
- package/dist/private/node/ui/components/LoadingBar.test.js.map +1 -1
- package/dist/private/node/ui/components/LoadingIndicator.d.ts +7 -0
- package/dist/private/node/ui/components/LoadingIndicator.js +22 -0
- package/dist/private/node/ui/components/LoadingIndicator.js.map +1 -0
- package/dist/public/common/version.d.ts +1 -1
- package/dist/public/common/version.js +1 -1
- package/dist/public/common/version.js.map +1 -1
- package/dist/public/node/api/admin.js +13 -0
- package/dist/public/node/api/admin.js.map +1 -1
- package/dist/public/node/api/graphql.js +38 -7
- package/dist/public/node/api/graphql.js.map +1 -1
- package/dist/public/node/archiver.js +13 -6
- package/dist/public/node/archiver.js.map +1 -1
- package/dist/public/node/base-command.d.ts +6 -0
- package/dist/public/node/base-command.js +97 -16
- package/dist/public/node/base-command.js.map +1 -1
- package/dist/public/node/dev-instance.d.ts +138 -0
- package/dist/public/node/dev-instance.js +365 -0
- package/dist/public/node/dev-instance.js.map +1 -0
- package/dist/public/node/environment.d.ts +6 -3
- package/dist/public/node/environment.js +11 -4
- package/dist/public/node/environment.js.map +1 -1
- package/dist/public/node/error/index.js +2 -1
- package/dist/public/node/error/index.js.map +1 -1
- package/dist/public/node/error/schema.d.ts +24 -24
- package/dist/public/node/error/serialization.d.ts +8 -0
- package/dist/public/node/error/serialization.js +103 -0
- package/dist/public/node/error/serialization.js.map +1 -0
- package/dist/public/node/graphiql/server.js +18 -2
- package/dist/public/node/graphiql/server.js.map +1 -1
- package/dist/public/node/is-global.js +2 -1
- package/dist/public/node/is-global.js.map +1 -1
- package/dist/public/node/notifications-system.d.ts +6 -6
- package/dist/public/node/path.d.ts +19 -3
- package/dist/public/node/path.js +21 -3
- package/dist/public/node/path.js.map +1 -1
- package/dist/public/node/session.d.ts +36 -2
- package/dist/public/node/session.js +48 -4
- package/dist/public/node/session.js.map +1 -1
- package/dist/public/node/system.d.ts +4 -0
- package/dist/public/node/system.js +39 -9
- package/dist/public/node/system.js.map +1 -1
- package/dist/public/node/themes/api.d.ts +9 -0
- package/dist/public/node/themes/api.js +50 -22
- package/dist/public/node/themes/api.js.map +1 -1
- package/dist/public/node/themes/theme-manager.d.ts +8 -1
- package/dist/public/node/themes/theme-manager.js +1 -1
- package/dist/public/node/themes/theme-manager.js.map +1 -1
- package/dist/public/node/tree-kill.js +12 -2
- package/dist/public/node/tree-kill.js.map +1 -1
- package/dist/public/node/ui/components.d.ts +1 -0
- package/dist/public/node/ui/components.js +1 -0
- package/dist/public/node/ui/components.js.map +1 -1
- package/dist/public/node/ui.d.ts +24 -4
- package/dist/public/node/ui.js +41 -18
- package/dist/public/node/ui.js.map +1 -1
- package/dist/public/node/upgrade/output.d.ts +17 -0
- package/dist/public/node/upgrade/output.js +51 -0
- package/dist/public/node/upgrade/output.js.map +1 -0
- package/dist/public/node/upgrade/result.d.ts +8 -0
- package/dist/public/node/upgrade/result.js +21 -0
- package/dist/public/node/upgrade/result.js.map +1 -0
- package/dist/public/node/upgrade/types.d.ts +61 -0
- package/dist/public/node/upgrade/types.js +46 -0
- package/dist/public/node/upgrade/types.js.map +1 -0
- package/dist/public/node/upgrade.d.ts +8 -0
- package/dist/public/node/upgrade.js +57 -22
- package/dist/public/node/upgrade.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/dist/private/node/ui/components/TextAnimation.d.ts +0 -10
- package/dist/private/node/ui/components/TextAnimation.js +0 -56
- package/dist/private/node/ui/components/TextAnimation.js.map +0 -1
- package/dist/private/node/ui/components/TextAnimation.test.d.ts +0 -1
- package/dist/private/node/ui/components/TextAnimation.test.js +0 -73
- package/dist/private/node/ui/components/TextAnimation.test.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-instance.js","sourceRoot":"","sources":["../../../src/public/node/dev-instance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,8BAA8B,EAAC,MAAM,oBAAoB,CAAA;AACjE,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAA;AAClC,OAAO,EAAC,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,KAAK,EAAC,MAAM,SAAS,CAAA;AACxG,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAA;AACrC,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAA;AACvC,OAAO,EAAC,yBAAyB,EAAC,MAAM,yBAAyB,CAAA;AACjE,OAAO,EAAC,UAAU,EAAE,UAAU,EAAC,MAAM,aAAa,CAAA;AAClD,OAAO,EAAC,uBAAuB,EAA2B,MAAM,2CAA2C,CAAA;AAC3G,OAAO,QAAQ,MAAM,iBAAiB,CAAA;AACtC,OAAO,EAAE,EAAE,EAAC,YAAY,EAAC,MAAM,IAAI,CAAA;AACnC,OAAO,EAAC,KAAK,IAAI,cAAc,EAAE,KAAK,IAAI,oBAAoB,EAAE,SAAS,IAAI,iBAAiB,EAAC,MAAM,aAAa,CAAA;AAGlH;;;GAGG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,8BAA8B,CAAA;AAE/E,MAAM,oBAAoB,GAAG,KAAK,CAAA;AAClC,MAAM,gBAAgB,GAAG,MAAM,CAAA;AA0B/B,OAAO,EAAC,0BAA0B,EAA2B,MAAM,2CAA2C,CAAA;AA4D9G;;;;;;GAMG;AACH,MAA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AAW,CAAC;gBAC7F,kBAAkB,EAAE,IAAI;aACzB;SACF;KACF,CACF,CAAA;IACD,KAAK,CAAC,IAAI,GAAG,iCAAiC,CAAA;IAC9C,KAAK,CAAC,OAAO,GAAG,EAAC,QAAQ,EAAE,QAAQ,EAAC,CAAA;IACpC,OAAO,KAAK,CAAA;AACd,CAAC","sourcesContent":["import {getOrCreateHiddenShopifyFolder} from './hidden-folder.js'\nimport {joinPath} from './path.js'\nimport {fileExists, glob, mkdir, readFile, removeFile, removeFileSync, renameFile, rmdir} from './fs.js'\nimport {AbortError} from './error.js'\nimport {outputDebug} from './output.js'\nimport {formatJsonOutputTimestamp} from './json-output-schema.js'\nimport {hashString, randomUUID} from './crypto.js'\nimport {createDevInstanceOutput, type DevInstanceLogEntry} from '../../private/node/dev-instance-output.js'\nimport lockfile from 'proper-lockfile'\nimport fs, {readFileSync} from 'fs'\nimport {mkdir as mkdirExclusive, rmdir as removeEmptyDirectory, writeFile as writeFileWithMode} from 'fs/promises'\nimport {Writable} from 'stream'\n\n/**\n * A stable error code for JSON consumers when a long-running command refuses to start because another instance of\n * it is already running for the same project.\n */\nexport const DEV_INSTANCE_ALREADY_RUNNING_CODE = 'dev_instance_already_running'\n\nconst DEV_INSTANCES_FOLDER = 'dev'\nconst DEFAULT_STALE_MS = 15_000\n\n/**\n * Describes a running instance of a long-running command such as `app dev` or `theme dev`.\n * It's written to `.shopify/dev/<slug>.json` so agents and other tools can discover the instance.\n */\nexport interface DevInstanceInfo {\n schemaVersion: 1\n /** Identifies this run, including when the OS reuses a PID. */\n sessionId: string\n /** The command that owns the instance, for example `app dev`. */\n command: string\n /** Distinguishes instances of the same command in the same directory, for example the app configuration file. */\n key?: string\n pid: number\n status: 'starting' | 'running'\n startedAt: string\n updatedAt: string\n /** The project directory the instance runs for. */\n directory: string\n /** The JSON Lines file the instance appends its output to. */\n logFile: string\n /** Command-specific, JSON-serializable details such as URLs and ports. */\n details: {[key: string]: unknown}\n}\n\nexport {devInstanceLogOutputSchema, type DevInstanceLogEntry} from '../../private/node/dev-instance-output.js'\n\nexport interface DevInstancePaths {\n /** The folder that holds every dev instance of the project: `.shopify/dev`. */\n folder: string\n /** The instance description. */\n infoFile: string\n /** The lock directory, owned by `proper-lockfile`. */\n lockFile: string\n /** The JSON Lines log. */\n logFile: string\n}\n\nexport interface DevInstanceIdentity {\n /** The command that owns the instance, for example `app dev`. */\n command: string\n /** The project directory. */\n directory: string\n /** Distinguishes several instances of the same command in the same directory. */\n key?: string\n}\n\nexport interface AcquireDevInstanceOptions extends DevInstanceIdentity {\n /** Initial command-specific details. */\n details?: {[key: string]: unknown}\n /** Receives the exact JSONL bytes written to the session log. The caller owns this stream. */\n logOutput?: Writable\n}\n\nexport interface DevInstanceUpdate {\n status?: DevInstanceInfo['status']\n /** Merged into the existing details. */\n details?: {[key: string]: unknown}\n}\n\nexport interface DevInstance {\n readonly info: DevInstanceInfo\n readonly paths: DevInstancePaths\n /** Aborts when this session loses its lock or output fails. Consumers must stop their owned work. */\n readonly abortSignal: AbortSignal\n /** Updates and persists the instance description. */\n update: (changes: DevInstanceUpdate) => Promise<void>\n /** Appends one entry to the JSON Lines log. */\n log: (entry: Omit<DevInstanceLogEntry, 'timestamp'> & {timestamp?: string}) => Promise<void>\n /**\n * Wraps a stream so every line written to it is also appended to the log, without ANSI styling.\n * The returned stream forwards the original bytes to `target` unchanged.\n */\n tee: (\n target: Writable,\n options: {\n source: string\n /** Treat each string write as a complete message. Byte writes remain buffered into lines. */\n stringWritesAreMessages?: boolean\n },\n ) => Writable\n /** Closes the log, removes the instance description and releases the lock. Safe to call more than once. */\n release: () => Promise<void>\n}\n\n/**\n * Returns the files used by a dev instance. Every instance of a project shares `.shopify/dev`,\n * with one `<slug>.json`, `<slug>.lock` and `<slug>.jsonl` per command and key.\n *\n * @param identity - The command, directory and optional key of the instance.\n * @returns The paths of the instance files.\n */\nexport function devInstancePaths(identity: DevInstanceIdentity): DevInstancePaths {\n const folder = joinPath(identity.directory, '.shopify', DEV_INSTANCES_FOLDER)\n const slug = devInstanceSlug(identity)\n return {\n folder,\n infoFile: joinPath(folder, `${slug}.json`),\n lockFile: joinPath(folder, `${slug}.lock`),\n logFile: joinPath(folder, `${slug}.jsonl`),\n }\n}\n\n/**\n * Marks this process as the running instance of a long-running command for a project.\n *\n * Mutual exclusion uses `proper-lockfile`: an atomic `mkdir` lock whose mtime this process refreshes as a heartbeat.\n * An exclusive startup directory serializes abandoned-lock recovery. An interrupted startup requires explicit\n * cleanup of that directory. A live owner blocks takeover, including when its heartbeat is stale.\n *\n * @param options - The instance identity, initial details.\n * @returns The acquired instance.\n * @throws AbortError with code {@link DEV_INSTANCE_ALREADY_RUNNING_CODE} when another live instance holds the lock.\n */\nexport async function acquireDevInstance(options: AcquireDevInstanceOptions): Promise<DevInstance> {\n const paths = devInstancePaths(options)\n await getOrCreateHiddenShopifyFolder(options.directory)\n await mkdir(paths.folder)\n const startupLock = `${paths.lockFile}.acquire`\n try {\n await mkdirExclusive(startupLock, {mode: 0o700})\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== 'EEXIST') throw error\n const startupError = new AbortError(\n `Another \\`shopify ${options.command}\\` is starting, or a previous startup was interrupted.`,\n 'Wait for other starts to finish. If none is running, remove the startup lock below and try again.',\n [['Startup lock', {filePath: startupLock}]],\n )\n startupError.code = DEV_INSTANCE_ALREADY_RUNNING_CODE\n throw startupError\n }\n try {\n return await createDevInstance(options, paths)\n } catch (error) {\n if (!isLockedError(error)) throw error\n const existing = await readDevInstanceInfo(paths.infoFile)\n throw devInstanceAlreadyRunningError(options, existing && isProcessAlive(existing.pid) ? existing : undefined)\n } finally {\n await removeEmptyDirectory(startupLock)\n }\n}\n\n/**\n * Acquires a dev instance and releases it after the callback completes or throws.\n *\n * @param options - The command, project and output options for the instance.\n * @param execute - The work to run while the instance is owned.\n * @returns The callback's result after instance cleanup completes.\n */\nexport async function withDevInstance<T>(\n options: AcquireDevInstanceOptions,\n execute: (instance: DevInstance) => T | Promise<T>,\n): Promise<T> {\n const instance = await acquireDevInstance(options)\n try {\n return await execute(instance)\n } finally {\n await instance.release()\n }\n}\n\nasync function createDevInstance(options: AcquireDevInstanceOptions, paths: DevInstancePaths): Promise<DevInstance> {\n const previous = await readDevInstanceInfo(paths.infoFile)\n if (previous && isProcessAlive(previous.pid)) throw devInstanceAlreadyRunningError(options, previous)\n const sessionId = randomUUID()\n const abortController = new AbortController()\n let compromised = false\n const ownsInfo = () => {\n if (compromised) return false\n try {\n return (JSON.parse(readFileSync(paths.infoFile, 'utf8')) as DevInstanceInfo).sessionId === sessionId\n // A missing or unreadable record does not authorize deleting another session's files.\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return false\n }\n }\n let published = false\n const removeOwnedLockSync = (path: fs.PathLike) => {\n if (published && !ownsInfo()) return\n try {\n fs.rmdirSync(path)\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error\n }\n }\n const lockOptions = {\n realpath: false,\n lockfilePath: paths.lockFile,\n stale: DEFAULT_STALE_MS,\n retries: 0,\n // The default handler throws asynchronously and would crash the long-running command.\n onCompromised: (error: Error) => {\n compromised = true\n outputDebug(`The ${options.command} instance lock was compromised: ${error.message}`)\n abortController.abort(\n new AbortError(`The ${options.command} instance lost its lock.`, 'Start the command again.'),\n )\n },\n fs: {\n ...fs,\n rmdir: (path: fs.PathLike, callback: fs.NoParamCallback) => {\n if (published && !ownsInfo()) return callback(null)\n // proper-lockfile requires the callback filesystem API.\n // eslint-disable-next-line n/prefer-promises/fs\n fs.rmdir(path, callback)\n },\n rmdirSync: removeOwnedLockSync,\n },\n }\n\n if (previous) await rmdir(paths.lockFile, {force: true})\n const releaseLock = await lockfile.lock(paths.infoFile, lockOptions)\n\n const now = formatJsonOutputTimestamp(new Date())\n const info: DevInstanceInfo = {\n schemaVersion: 1,\n sessionId,\n command: options.command,\n ...(options.key ? {key: options.key} : {}),\n pid: process.pid,\n status: 'starting',\n startedAt: now,\n updatedAt: now,\n directory: options.directory,\n logFile: paths.logFile,\n details: {...(options.details ?? {})},\n }\n\n let updates = Promise.resolve()\n let released = false\n const output = createDevInstanceOutput({\n logFile: paths.logFile,\n logOutput: options.logOutput,\n isActive: () => !released && !compromised,\n onError: (error) => abortController.abort(error),\n })\n let releasePromise: Promise<void> | undefined\n const removeInfoOnExit = () => {\n // Remove the lock before the live owner's record, so a new starter cannot enter during cleanup.\n if (!released && ownsInfo()) {\n removeOwnedLockSync(paths.lockFile)\n removeFileSync(paths.infoFile)\n }\n }\n process.once('exit', removeInfoOnExit)\n\n const instance: DevInstance = {\n info,\n paths,\n abortSignal: abortController.signal,\n update: async (changes) => {\n if (releasePromise || compromised) return\n if (changes.status) info.status = changes.status\n if (changes.details) info.details = {...info.details, ...changes.details}\n info.updatedAt = formatJsonOutputTimestamp(new Date())\n const snapshot = {...info, details: {...info.details}}\n const write = updates.then(async () => {\n if (!compromised) await writeDevInstanceInfo(paths.infoFile, snapshot)\n })\n updates = write.catch(() => {})\n await write\n },\n log: output.log,\n tee: output.tee,\n release: () => {\n releasePromise ??= (async () => {\n try {\n const results = await output.flush()\n const failure = results.find((result) => result.status === 'rejected')\n await updates\n if (failure?.status === 'rejected') throw failure.reason\n } finally {\n released = true\n process.removeListener('exit', removeInfoOnExit)\n try {\n await output.close()\n } finally {\n const owned = ownsInfo()\n await releaseLock().catch((error: Error) =>\n outputDebug(`Failed to release the dev instance lock: ${error.message}`),\n )\n if (owned) await removeFile(paths.infoFile).catch(() => {})\n }\n }\n })()\n return releasePromise\n },\n }\n\n try {\n await output.opened\n await writeDevInstanceInfo(paths.infoFile, info)\n published = true\n return instance\n } catch (error) {\n // Closing an already failed log can reject too; preserve the original setup error.\n await instance.release().catch((cleanupError: Error) => outputDebug(cleanupError.message))\n await removeFile(`${paths.infoFile}.${sessionId}.tmp`)\n throw error\n }\n}\n\n/**\n * Returns the running instance of a command for a project, if there is one.\n *\n * @param identity - The command, directory and optional key of the instance.\n * @returns The instance description, or undefined when no live instance holds the lock.\n */\nexport async function readDevInstance(identity: DevInstanceIdentity): Promise<DevInstanceInfo | undefined> {\n const paths = devInstancePaths(identity)\n return readLiveDevInstance(paths)\n}\n\n/**\n * Lists every running dev instance of a project, across commands and keys.\n *\n * @param directory - The project directory.\n * @returns The descriptions of the live instances.\n */\nexport async function listDevInstances(directory: string): Promise<DevInstanceInfo[]> {\n const folder = joinPath(directory, '.shopify', DEV_INSTANCES_FOLDER)\n if (!(await fileExists(folder))) return []\n const infoFiles = await glob('*.json', {cwd: folder, absolute: true, onlyFiles: true})\n const instances = await Promise.all(\n infoFiles.map((infoFile) =>\n readLiveDevInstance({\n folder,\n infoFile,\n lockFile: infoFile.replace(/\\.json$/, '.lock'),\n logFile: infoFile.replace(/\\.json$/, '.jsonl'),\n }),\n ),\n )\n return instances.filter((instance): instance is DevInstanceInfo => instance !== undefined)\n}\n\n/**\n * Checks whether a process exists. A process owned by another user counts as alive.\n *\n * @param pid - The process ID.\n * @returns True when the process exists.\n */\nexport function isProcessAlive(pid: number): boolean {\n if (!Number.isInteger(pid) || pid <= 0) return false\n try {\n process.kill(pid, 0)\n return true\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch (error) {\n return (error as NodeJS.ErrnoException).code === 'EPERM'\n }\n}\n\nasync function readLiveDevInstance(paths: DevInstancePaths): Promise<DevInstanceInfo | undefined> {\n const info = await readDevInstanceInfo(paths.infoFile)\n if (!info || !isProcessAlive(info.pid)) return undefined\n if (!(await lockIsFresh(paths))) return undefined\n return info\n}\n\nasync function lockIsFresh(paths: DevInstancePaths): Promise<boolean> {\n try {\n return await lockfile.check(paths.infoFile, {\n realpath: false,\n lockfilePath: paths.lockFile,\n stale: DEFAULT_STALE_MS,\n })\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return false\n }\n}\n\nasync function readDevInstanceInfo(infoFile: string): Promise<DevInstanceInfo | undefined> {\n try {\n const parsed = JSON.parse(await readFile(infoFile)) as DevInstanceInfo\n return typeof parsed?.pid === 'number' ? parsed : undefined\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return undefined\n }\n}\n\nasync function writeDevInstanceInfo(infoFile: string, info: DevInstanceInfo): Promise<void> {\n // Write then rename so readers never see a partial file. Details may hold local URLs with keys, so keep it private.\n const temporaryFile = `${infoFile}.${info.sessionId}.tmp`\n await writeFileWithMode(temporaryFile, `${JSON.stringify(info, null, 2)}\\n`, {mode: 0o600})\n await renameFile(temporaryFile, infoFile)\n}\n\nfunction isLockedError(error: unknown): boolean {\n return (error as NodeJS.ErrnoException | undefined)?.code === 'ELOCKED'\n}\n\nfunction devInstanceSlug({command, key}: DevInstanceIdentity): string {\n const slug = [command, key]\n .filter(Boolean)\n .join('-')\n .toLowerCase()\n .replace(/[^a-z0-9._-]+/g, '-')\n .replace(/^-+|-+$/g, '')\n // Normalization can merge distinct identities, so hash the original command/key pair.\n const identityHash = hashString(JSON.stringify([command, key ?? ''])).slice(0, 4)\n return `${slug}-${identityHash}`\n}\n\nfunction devInstanceAlreadyRunningError(\n identity: DevInstanceIdentity,\n existing: DevInstanceInfo | undefined,\n): AbortError {\n const command = `shopify ${identity.command}`\n if (!existing) {\n const error = new AbortError(\n `Another \\`${command}\\` is starting for this project.`,\n 'Wait a few seconds and try again, or stop the other process first.',\n )\n error.code = DEV_INSTANCE_ALREADY_RUNNING_CODE\n return error\n }\n\n const stopCommand = process.platform === 'win32' ? `taskkill /PID ${existing.pid} /F` : `kill ${existing.pid}`\n const detailLines = Object.entries(existing.details)\n .filter(([, value]) => typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean')\n .map(([name, value]) => [name, String(value)])\n\n const error = new AbortError(\n `Another \\`${command}\\` is already running for this project.`,\n 'Use the running instance, or stop it before starting a new one.',\n [\n ['Read its output in', {filePath: existing.logFile}],\n ['Stop it with', {command: stopCommand}],\n ],\n [\n {\n body: {\n tabularData: [['PID', String(existing.pid)], ['Started', existing.startedAt], ...detailLines],\n firstColumnSubdued: true,\n },\n },\n ],\n )\n error.code = DEV_INSTANCE_ALREADY_RUNNING_CODE\n error.details = {instance: existing}\n return error\n}\n"]}
|
|
@@ -10,10 +10,13 @@
|
|
|
10
10
|
*/
|
|
11
11
|
export declare function getEnvironmentVariables(): NodeJS.ProcessEnv;
|
|
12
12
|
/**
|
|
13
|
-
* Returns the
|
|
14
|
-
*
|
|
13
|
+
* Returns the automation token the CLI authenticates with, from the first of these variables that is set:
|
|
14
|
+
* SHOPIFY_SERVICE_ACCOUNT_TOKEN, or the deprecated SHOPIFY_APP_AUTOMATION_TOKEN and SHOPIFY_CLI_PARTNERS_TOKEN.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
16
|
+
* Returns undefined when the variables can't be used (an empty value, or the service account variable set alongside
|
|
17
|
+
* another one). Callers then fall back to the login flow, which reports the problem instead of logging in.
|
|
18
|
+
*
|
|
19
|
+
* @returns The automation token, or undefined if there is no usable one.
|
|
17
20
|
*/
|
|
18
21
|
export declare function getAppAutomationToken(): string | undefined;
|
|
19
22
|
/**
|
|
@@ -2,6 +2,7 @@ import { nonRandomUUID } from './crypto.js';
|
|
|
2
2
|
import { isTruthy } from './context/utilities.js';
|
|
3
3
|
import { sniffForJson } from './path.js';
|
|
4
4
|
import { environmentVariables, systemEnvironmentVariables } from '../../private/node/constants.js';
|
|
5
|
+
import { automationTokenVariable, automationTokenVariablesProblem } from '../../private/node/session/automation-token.js';
|
|
5
6
|
/**
|
|
6
7
|
* It returns the environment variables of the environment
|
|
7
8
|
* where the Node process is running.
|
|
@@ -16,14 +17,20 @@ export function getEnvironmentVariables() {
|
|
|
16
17
|
return process.env;
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
19
|
-
* Returns the
|
|
20
|
-
*
|
|
20
|
+
* Returns the automation token the CLI authenticates with, from the first of these variables that is set:
|
|
21
|
+
* SHOPIFY_SERVICE_ACCOUNT_TOKEN, or the deprecated SHOPIFY_APP_AUTOMATION_TOKEN and SHOPIFY_CLI_PARTNERS_TOKEN.
|
|
21
22
|
*
|
|
22
|
-
*
|
|
23
|
+
* Returns undefined when the variables can't be used (an empty value, or the service account variable set alongside
|
|
24
|
+
* another one). Callers then fall back to the login flow, which reports the problem instead of logging in.
|
|
25
|
+
*
|
|
26
|
+
* @returns The automation token, or undefined if there is no usable one.
|
|
23
27
|
*/
|
|
24
28
|
export function getAppAutomationToken() {
|
|
25
29
|
const env = getEnvironmentVariables();
|
|
26
|
-
|
|
30
|
+
if (automationTokenVariablesProblem(env))
|
|
31
|
+
return undefined;
|
|
32
|
+
const variable = automationTokenVariable(env);
|
|
33
|
+
return variable ? env[variable] : undefined;
|
|
27
34
|
}
|
|
28
35
|
/**
|
|
29
36
|
* Returns the value of the organization id from the environment variables.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../../src/public/node/environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAA;AACzC,OAAO,EAAC,QAAQ,EAAC,MAAM,wBAAwB,CAAA;AAC/C,OAAO,EAAC,YAAY,EAAC,MAAM,WAAW,CAAA;AACtC,OAAO,EAAC,oBAAoB,EAAE,0BAA0B,EAAC,MAAM,iCAAiC,CAAA;
|
|
1
|
+
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../../src/public/node/environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAA;AACzC,OAAO,EAAC,QAAQ,EAAC,MAAM,wBAAwB,CAAA;AAC/C,OAAO,EAAC,YAAY,EAAC,MAAM,WAAW,CAAA;AACtC,OAAO,EAAC,oBAAoB,EAAE,0BAA0B,EAAC,MAAM,iCAAiC,CAAA;AAChG,OAAO,EAAC,uBAAuB,EAAE,+BAA+B,EAAC,MAAM,gDAAgD,CAAA;AAEvH;;;;;;;;;GASG;AACH,MAAM,UAAU,uBAAuB;IACrC,OAAO,OAAO,CAAC,GAAG,CAAA;AACpB,CAAC;AAED;;;;;;;;GAQG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IAAI;IAC5F,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAA;AAC/E,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CAAC,WAAW,GAAG,uBAAuB,EAAE;IAC3E,OAAO,QAAQ,CAAC,WAAW,CAAC,oBAAoB,CAAC,qBAAqB,CAAC,CAAC,CAAA;AAC1E,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,+BAA+B,CAAC,WAAW,GAAG,uBAAuB,EAAE;IACrF,OAAO,cAAc,CAAC,WAAW,CAAC,oBAAoB,CAAC,6BAA6B,CAAC,CAAC,IAAI,EAAE,GAAG,IAAI,CAAA;AACrG,CAAC","sourcesContent":["import {nonRandomUUID} from './crypto.js'\nimport {isTruthy} from './context/utilities.js'\nimport {sniffForJson} from './path.js'\nimport {environmentVariables, systemEnvironmentVariables} from '../../private/node/constants.js'\nimport {automationTokenVariable, automationTokenVariablesProblem} from '../../private/node/session/automation-token.js'\n\n/**\n * It returns the environment variables of the environment\n * where the Node process is running.\n *\n * This function exists to prevent the access of the process\n * global variable which is discouraged via the no-process-env\n * ESLint rule.\n *\n * @returns Current process environment variables.\n */\nexport function getEnvironmentVariables(): NodeJS.ProcessEnv {\n return process.env\n}\n\n/**\n * Returns the automation token the CLI authenticates with, from the first of these variables that is set:\n * SHOPIFY_SERVICE_ACCOUNT_TOKEN, or the deprecated SHOPIFY_APP_AUTOMATION_TOKEN and SHOPIFY_CLI_PARTNERS_TOKEN.\n *\n * Returns undefined when the variables can't be used (an empty value, or the service account variable set alongside\n * another one). Callers then fall back to the login flow, which reports the problem instead of logging in.\n *\n * @returns The automation token, or undefined if there is no usable one.\n */\nexport function getAppAutomationToken(): string | undefined {\n const env = getEnvironmentVariables()\n if (automationTokenVariablesProblem(env)) return undefined\n const variable = automationTokenVariable(env)\n return variable ? env[variable] : undefined\n}\n\n/**\n * Returns the value of the organization id from the environment variables.\n *\n * @returns True if the current proccess is running using the partners token.\n */\nexport function getOrganization(): string | undefined {\n return getEnvironmentVariables()[environmentVariables.organization]\n}\n\nfunction parseEnvNumber(value: string | undefined): number | undefined {\n if (value && !isNaN(Number(value))) {\n return Number(value)\n }\n return undefined\n}\n\n/**\n * Return the backend port value.\n *\n * @returns The port as a number. Undefined otherwise.\n */\nexport function getBackendPort(): number | undefined {\n return parseEnvNumber(getEnvironmentVariables()[systemEnvironmentVariables.backendPort])\n}\n\n/**\n * Returns the information of the identity & refresh tokens, provided by environment variables.\n *\n * @returns The identity token information in case it exists.\n */\nexport function getIdentityTokenInformation(): {accessToken: string; refreshToken: string; userId: string} | undefined {\n const identityToken = getEnvironmentVariables()[environmentVariables.identityToken]\n const refreshToken = getEnvironmentVariables()[environmentVariables.refreshToken]\n if (!identityToken || !refreshToken) return undefined\n return {\n accessToken: identityToken,\n refreshToken,\n userId: nonRandomUUID(identityToken),\n }\n}\n\n/**\n * Checks if the JSON output is enabled via flag (--json or -j) or environment variable (SHOPIFY_FLAG_JSON).\n *\n * @param environment - Process environment variables.\n * @param argv - Command arguments to inspect for JSON flags.\n * @returns True if the JSON output is enabled, false otherwise.\n */\nexport function jsonOutputEnabled(environment = getEnvironmentVariables(), argv = process.argv): boolean {\n return sniffForJson(argv) || isTruthy(environment[environmentVariables.json])\n}\n\n/**\n * If true, the CLI should not use the network level retry.\n *\n * If there is an error when calling a network API that looks like a DNS or connectivity issue, the CLI will by default\n * automatically retry the request.\n *\n * @param environment - Process environment variables.\n * @returns True if the SHOPIFY_CLI_SKIP_NETWORK_LEVEL_RETRY environment variable is set.\n */\nexport function skipNetworkLevelRetry(environment = getEnvironmentVariables()): boolean {\n return isTruthy(environment[environmentVariables.skipNetworkLevelRetry])\n}\n\n/**\n * Returns the default maximum request time for network calls in milliseconds.\n *\n * After this long, API requests may be cancelled by an AbortSignal. The limit can be overridden by setting the\n * SHOPIFY_CLI_MAX_REQUEST_TIME_FOR_NETWORK_CALLS environment variable.\n *\n * @param environment - Process environment variables.\n * @returns The maximum request time in milliseconds.\n */\nexport function maxRequestTimeForNetworkCallsMs(environment = getEnvironmentVariables()): number {\n return parseEnvNumber(environment[environmentVariables.maxRequestTimeForNetworkCalls]) ?? 30 * 1000\n}\n"]}
|
|
@@ -125,7 +125,8 @@ export async function handler(error) {
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
const { jsonOutputEnabled } = await import('../environment.js');
|
|
128
|
-
|
|
128
|
+
const { commandEventOutputMode } = await import('../../../private/node/command-event-context.js');
|
|
129
|
+
if (jsonOutputEnabled() || commandEventOutputMode() === 'json') {
|
|
129
130
|
const { renderFatalErrorAsJson } = await import('../../../private/node/json-error.js');
|
|
130
131
|
renderFatalErrorAsJson(fatal);
|
|
131
132
|
await flushStdout();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/public/node/error/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAA;AACxC,OAAO,EAAC,WAAW,EAAiB,gBAAgB,EAAE,eAAe,EAAC,MAAM,cAAc,CAAA;AAC1F,OAAO,EAAC,iBAAiB,EAAmC,MAAM,mDAAmD,CAAA;AACrH,OAAO,EAAC,gBAAgB,EAAC,MAAM,wDAAwD,CAAA;AACvF,OAAO,EAAC,oBAAoB,EAAC,MAAM,4CAA4C,CAAA;AAE/E,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAA;AAIlC,MAAM,CAAN,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,gGAAgG;IAChG,qDAAS,CAAA;IACT,iEAAe,CAAA;IACf,iDAAO,CAAA;AACT,CAAC,EALW,cAAc,KAAd,cAAc,QAKzB;AAED,MAAM,OAAO,eAAgB,SAAQ,KAAK;CAAG;AAE7C;;;GAGG;AACH,MAAM,OAAgB,UAAW,SAAQ,KAAK;IAC5C,UAAU,CAAkB;IAC5B,IAA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,OAAO,aAAa,CAAC,QAAQ,CAAC;SAC3B,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC;SACtB,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAA;AAC9B,CAAC;AAED;;;;;GAKG;AACH,SAAS,mCAAmC,CAAC,OAAe;IAC1D,MAAM,wBAAwB,GAAG;QAC/B,yCAAyC;QACzC,wCAAwC;QACxC,2BAA2B;QAC3B,yCAAyC;QACzC,0DAA0D;QAC1D,gCAAgC;QAChC,gCAAgC;QAChC,uBAAuB;QACvB,iFAAiF;QACjF,aAAa;QACb,gBAAgB;QAChB,6BAA6B;QAC7B,aAAa;QACb,sBAAsB;KACvB,CAAA;IACD,MAAM,UAAU,GAAG,wBAAwB,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAA;IAClG,OAAO,UAAU,CAAA;AACnB,CAAC","sourcesContent":["import {normalizePath} from '../path.js'\nimport {flushStdout, OutputMessage, stringifyMessage, TokenizedString} from '../output.js'\nimport {tokenItemToString, type InlineToken, type TokenItem} from '../../../private/node/ui/components/token-item.js'\nimport {hasRateLimitCode} from '../../../private/node/analytics/graphql-error-codes.js'\nimport {isGatewayErrorStatus} from '../../../private/node/api/status-checks.js'\n\nimport {Errors} from '@oclif/core'\n\nimport type {AlertCustomSection} from '../ui.js'\n\nexport enum FatalErrorType {\n // These values are also read from errors created by other cli-kit copies. Do not renumber them.\n Abort = 0,\n AbortSilent = 1,\n Bug = 2,\n}\n\nexport class CancelExecution extends Error {}\n\n/**\n * A fatal error represents an error shouldn't be rescued and that causes the execution to terminate.\n * There shouldn't be code that catches fatal errors.\n */\nexport abstract class FatalError extends Error {\n tryMessage: TokenItem | null\n type: FatalErrorType\n nextSteps?: TokenItem<InlineToken>[]\n formattedMessage?: TokenItem\n customSections?: AlertCustomSection[]\n /** A stable code for JSON consumers to identify this error, included only when known. */\n code?: string\n /** Selected JSON-serializable data to include in JSON errors. Never attach the raw error or request. */\n details?: unknown\n skipOclifErrorHandling: boolean\n /**\n * Creates a new FatalError error.\n *\n * @param message - The error message.\n * @param type - The type of fatal error.\n * @param tryMessage - The message that recommends next steps to the user.\n * You can pass a string a {@link TokenizedString} or a {@link TokenItem}\n * if you need to style the message inside the error Banner component.\n * @param nextSteps - Message to show as \"next steps\" with suggestions to solve the issue.\n * @param customSections - Custom sections to show in the error banner. To be used if nextSteps is not enough.\n */\n constructor(\n message: TokenItem | OutputMessage,\n type: FatalErrorType,\n tryMessage: TokenItem | OutputMessage | null = null,\n nextSteps?: TokenItem<InlineToken>[],\n customSections?: AlertCustomSection[],\n ) {\n const messageIsOutputMessage = typeof message === 'string' || 'value' in message\n super(messageIsOutputMessage ? stringifyMessage(message) : tokenItemToString(message))\n\n if (tryMessage) {\n if (tryMessage instanceof TokenizedString) {\n this.tryMessage = stringifyMessage(tryMessage)\n } else {\n this.tryMessage = tryMessage\n }\n } else {\n this.tryMessage = null\n }\n\n this.type = type\n this.nextSteps = nextSteps\n this.customSections = customSections\n this.skipOclifErrorHandling = true\n\n if (!messageIsOutputMessage) {\n this.formattedMessage = message\n }\n }\n}\n\n/**\n * An abort error is a fatal error that shouldn't be reported as a bug.\n * Those usually represent unexpected scenarios that we can't handle and that usually require some action from the developer.\n */\nexport class AbortError extends FatalError {\n constructor(\n message: TokenItem | OutputMessage,\n tryMessage: TokenItem | OutputMessage | null = null,\n nextSteps?: TokenItem<InlineToken>[],\n customSections?: AlertCustomSection[],\n ) {\n super(message, FatalErrorType.Abort, tryMessage, nextSteps, customSections)\n }\n}\n\n/**\n * An external error is similar to Abort but has extra command and args attributes.\n * This is useful to represent errors coming from external commands, usually executed by execa.\n */\nexport class ExternalError extends FatalError {\n command: string\n args: string[]\n\n constructor(\n message: OutputMessage,\n command: string,\n args: string[],\n tryMessage: TokenItem | OutputMessage | null = null,\n ) {\n super(message, FatalErrorType.Abort, tryMessage)\n this.command = command\n this.args = args\n }\n}\n\nexport class AbortSilentError extends FatalError {\n constructor() {\n super('', FatalErrorType.AbortSilent)\n }\n}\n\n/**\n * A bug error is an error that represents a bug and therefore should be reported.\n */\nexport class BugError extends FatalError {\n constructor(message: TokenItem | OutputMessage, tryMessage: TokenItem | OutputMessage | null = null) {\n super(message, FatalErrorType.Bug, tryMessage)\n }\n}\n\n/**\n * A function that handles errors that blow up in the CLI.\n *\n * @param error - Error to be handled.\n * @returns A promise that resolves with the error passed.\n */\nexport async function handler(error: unknown): Promise<unknown> {\n let fatal: FatalError\n if (isFatal(error)) {\n fatal = error\n } else if (typeof error === 'string') {\n fatal = new BugError(error)\n } else if (error instanceof Error) {\n fatal = new BugError(error.message)\n fatal.stack = error.stack\n } else {\n // errors can come in all shapes and sizes...\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const maybeError = error as any\n fatal = new BugError(maybeError?.message ?? 'Unknown error')\n if (maybeError?.stack) {\n fatal.stack = maybeError?.stack\n }\n }\n\n const {jsonOutputEnabled} = await import('../environment.js')\n if (jsonOutputEnabled()) {\n const {renderFatalErrorAsJson} = await import('../../../private/node/json-error.js')\n renderFatalErrorAsJson(fatal)\n await flushStdout()\n return error\n }\n\n const {renderFatalError} = await import('../ui.js')\n renderFatalError(fatal)\n return Promise.resolve(error)\n}\n\n/**\n * A function that maps an error to an Abort with the stack trace when coming from the CLI.\n *\n * @param error - Error to be mapped.\n * @returns A promise that resolves with the new error object.\n */\nexport function errorMapper(error: unknown): Promise<unknown> {\n if (error instanceof Errors.CLIError) {\n const mappedError = new AbortError(error.message)\n mappedError.stack = error.stack\n return Promise.resolve(mappedError)\n } else {\n return Promise.resolve(error)\n }\n}\n\n/**\n * A function that checks if an error is a fatal one.\n *\n * @param error - Error to be checked.\n * @returns A boolean indicating if the error is a fatal one.\n */\nfunction isFatal(error: unknown): error is FatalError {\n try {\n return Object.prototype.hasOwnProperty.call(error, 'type')\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return false\n }\n}\n\n/**\n * A function that checks if an error should be reported as unexpected.\n *\n * @param error - Error to be checked.\n * @returns A boolean indicating if the error should be reported as unexpected.\n */\nexport function shouldReportErrorAsUnexpected(error: unknown): boolean {\n if (!isFatal(error)) {\n // this means its not one of the CLI wrapped errors\n if (error instanceof Error) {\n // Raw API errors that slip through unwrapped (e.g. the handleErrors:false path) are expected\n // environmental conditions, not CLI bugs. Treat them as expected so they don't pollute crash\n // reporting.\n if (isExpectedApiError(error)) {\n return false\n }\n const message = error.message\n return !errorMessageImpliesEnvironmentIssue(message)\n }\n return true\n }\n if (error.type === FatalErrorType.Bug) {\n return true\n }\n return false\n}\n\n/**\n * Detects raw graphql-request `ClientError`s that are expected environmental conditions rather than\n * CLI bugs. These reach the reporter as plain `Error`s (not `FatalError`s) and would otherwise be\n * reported as unexpected.\n *\n * HTTP 401 (unauthenticated) is not \"transient\" in the retry sense — it means the user's session\n * token is expired or invalid, a credential/environment condition (see issue #7891). Rate limiting\n * (HTTP 429, or a `THROTTLED`/`429` GraphQL code on any error in the response) matches the shape\n * detected by `errorsIncludeStatus429` in `private/node/api.ts`. Gateway errors (502/503/504) are\n * also expected infrastructure failures.\n *\n * Scoped to the external `ClientError` shape only — importing the cli-kit `GraphQLClientError`\n * wrapper here would create an `error.ts → headers.ts → error.ts` import cycle.\n *\n * Matched structurally rather than with `instanceof ClientError`, because importing the class\n * pulls `graphql-request` — and through it `graphql`, `tr46` and `whatwg-url` — into the module\n * graph of every command, for one type check on an error path. `ClientError` is the only error\n * reaching here that carries both `response` and `request`; the cli-kit wrapper carries\n * `statusCode` instead (see `private/node/api/headers.ts`).\n *\n * @param error - Error to be checked.\n * @returns A boolean indicating if the error is a known expected API error.\n */\nfunction isExpectedApiError(error: Error): boolean {\n const candidate = error as Error & {\n response?: {status?: number; errors?: unknown}\n request?: unknown\n }\n if (typeof candidate.response !== 'object' || candidate.response === null || candidate.request === undefined) {\n return false\n }\n const status = candidate.response.status\n if (status === 401 || status === 429 || isGatewayErrorStatus(status)) {\n return true\n }\n return hasRateLimitCode(candidate.response.errors)\n}\n\n/**\n * Stack traces usually have file:// - we strip that and also remove the Windows drive designation.\n *\n * @param filePath - Path to be cleaned.\n * @returns The cleaned path.\n */\nexport function cleanSingleStackTracePath(filePath: string): string {\n return normalizePath(filePath)\n .replace('file:/', '/')\n .replace(/^\\/?[A-Z]:/, '')\n}\n\n/**\n * There are certain errors that we know are not due to a CLI bug, but are environmental/user error.\n *\n * @param message - The error message to check.\n * @returns A boolean indicating if the error message implies an environment issue.\n */\nfunction errorMessageImpliesEnvironmentIssue(message: string): boolean {\n const environmentIssueMessages = [\n 'EPERM: operation not permitted, scandir',\n 'EPERM: operation not permitted, rename',\n 'EACCES: permission denied',\n 'EPERM: operation not permitted, symlink',\n 'This version of npm supports the following node versions',\n 'EBUSY: resource busy or locked',\n 'ENOTEMPTY: directory not empty',\n 'getaddrinfo ENOTFOUND',\n 'Client network socket disconnected before secure TLS connection was established',\n 'spawn EPERM',\n 'socket hang up',\n 'The user aborted a request.',\n 'write EPIPE',\n 'Unsupported platform',\n ]\n const anyMatches = environmentIssueMessages.some((issueMessage) => message.includes(issueMessage))\n return anyMatches\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/public/node/error/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAA;AACxC,OAAO,EAAC,WAAW,EAAiB,gBAAgB,EAAE,eAAe,EAAC,MAAM,cAAc,CAAA;AAC1F,OAAO,EAAC,iBAAiB,EAAmC,MAAM,mDAAmD,CAAA;AACrH,OAAO,EAAC,gBAAgB,EAAC,MAAM,wDAAwD,CAAA;AACvF,OAAO,EAAC,oBAAoB,EAAC,MAAM,4CAA4C,CAAA;AAE/E,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAA;AAIlC,MAAM,CAAN,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,gGAAgG;IAChG,qDAAS,CAAA;IACT,iEAAe,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CAAC,QAAQ,CAAC,MAAM,CAAA;IACxC,IAAI,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG,IAAI,oBAAoB,CAAC,MAAM,CAAC,EAAE,CAAC;QACrE,OAAO,IAAI,CAAA;IACb,CAAC;IACD,OAAO,gBAAgB,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;AACpD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,QAAgB;IACxD,OAAO,aAAa,CAAC,QAAQ,CAAC;SAC3B,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC;SACtB,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAA;AAC9B,CAAC;AAED;;;;;GAKG;AACH,SAAS,mCAAmC,CAAC,OAAe;IAC1D,MAAM,wBAAwB,GAAG;QAC/B,yCAAyC;QACzC,wCAAwC;QACxC,2BAA2B;QAC3B,yCAAyC;QACzC,0DAA0D;QAC1D,gCAAgC;QAChC,gCAAgC;QAChC,uBAAuB;QACvB,iFAAiF;QACjF,aAAa;QACb,gBAAgB;QAChB,6BAA6B;QAC7B,aAAa;QACb,sBAAsB;KACvB,CAAA;IACD,MAAM,UAAU,GAAG,wBAAwB,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAA;IAClG,OAAO,UAAU,CAAA;AACnB,CAAC","sourcesContent":["import {normalizePath} from '../path.js'\nimport {flushStdout, OutputMessage, stringifyMessage, TokenizedString} from '../output.js'\nimport {tokenItemToString, type InlineToken, type TokenItem} from '../../../private/node/ui/components/token-item.js'\nimport {hasRateLimitCode} from '../../../private/node/analytics/graphql-error-codes.js'\nimport {isGatewayErrorStatus} from '../../../private/node/api/status-checks.js'\n\nimport {Errors} from '@oclif/core'\n\nimport type {AlertCustomSection} from '../ui.js'\n\nexport enum FatalErrorType {\n // These values are also read from errors created by other cli-kit copies. Do not renumber them.\n Abort = 0,\n AbortSilent = 1,\n Bug = 2,\n}\n\nexport class CancelExecution extends Error {}\n\n/**\n * A fatal error represents an error shouldn't be rescued and that causes the execution to terminate.\n * There shouldn't be code that catches fatal errors.\n */\nexport abstract class FatalError extends Error {\n tryMessage: TokenItem | null\n type: FatalErrorType\n nextSteps?: TokenItem<InlineToken>[]\n formattedMessage?: TokenItem\n customSections?: AlertCustomSection[]\n /** A stable code for JSON consumers to identify this error, included only when known. */\n code?: string\n /** Selected JSON-serializable data to include in JSON errors. Never attach the raw error or request. */\n details?: unknown\n skipOclifErrorHandling: boolean\n /**\n * Creates a new FatalError error.\n *\n * @param message - The error message.\n * @param type - The type of fatal error.\n * @param tryMessage - The message that recommends next steps to the user.\n * You can pass a string a {@link TokenizedString} or a {@link TokenItem}\n * if you need to style the message inside the error Banner component.\n * @param nextSteps - Message to show as \"next steps\" with suggestions to solve the issue.\n * @param customSections - Custom sections to show in the error banner. To be used if nextSteps is not enough.\n */\n constructor(\n message: TokenItem | OutputMessage,\n type: FatalErrorType,\n tryMessage: TokenItem | OutputMessage | null = null,\n nextSteps?: TokenItem<InlineToken>[],\n customSections?: AlertCustomSection[],\n ) {\n const messageIsOutputMessage = typeof message === 'string' || 'value' in message\n super(messageIsOutputMessage ? stringifyMessage(message) : tokenItemToString(message))\n\n if (tryMessage) {\n if (tryMessage instanceof TokenizedString) {\n this.tryMessage = stringifyMessage(tryMessage)\n } else {\n this.tryMessage = tryMessage\n }\n } else {\n this.tryMessage = null\n }\n\n this.type = type\n this.nextSteps = nextSteps\n this.customSections = customSections\n this.skipOclifErrorHandling = true\n\n if (!messageIsOutputMessage) {\n this.formattedMessage = message\n }\n }\n}\n\n/**\n * An abort error is a fatal error that shouldn't be reported as a bug.\n * Those usually represent unexpected scenarios that we can't handle and that usually require some action from the developer.\n */\nexport class AbortError extends FatalError {\n constructor(\n message: TokenItem | OutputMessage,\n tryMessage: TokenItem | OutputMessage | null = null,\n nextSteps?: TokenItem<InlineToken>[],\n customSections?: AlertCustomSection[],\n ) {\n super(message, FatalErrorType.Abort, tryMessage, nextSteps, customSections)\n }\n}\n\n/**\n * An external error is similar to Abort but has extra command and args attributes.\n * This is useful to represent errors coming from external commands, usually executed by execa.\n */\nexport class ExternalError extends FatalError {\n command: string\n args: string[]\n\n constructor(\n message: OutputMessage,\n command: string,\n args: string[],\n tryMessage: TokenItem | OutputMessage | null = null,\n ) {\n super(message, FatalErrorType.Abort, tryMessage)\n this.command = command\n this.args = args\n }\n}\n\nexport class AbortSilentError extends FatalError {\n constructor() {\n super('', FatalErrorType.AbortSilent)\n }\n}\n\n/**\n * A bug error is an error that represents a bug and therefore should be reported.\n */\nexport class BugError extends FatalError {\n constructor(message: TokenItem | OutputMessage, tryMessage: TokenItem | OutputMessage | null = null) {\n super(message, FatalErrorType.Bug, tryMessage)\n }\n}\n\n/**\n * A function that handles errors that blow up in the CLI.\n *\n * @param error - Error to be handled.\n * @returns A promise that resolves with the error passed.\n */\nexport async function handler(error: unknown): Promise<unknown> {\n let fatal: FatalError\n if (isFatal(error)) {\n fatal = error\n } else if (typeof error === 'string') {\n fatal = new BugError(error)\n } else if (error instanceof Error) {\n fatal = new BugError(error.message)\n fatal.stack = error.stack\n } else {\n // errors can come in all shapes and sizes...\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const maybeError = error as any\n fatal = new BugError(maybeError?.message ?? 'Unknown error')\n if (maybeError?.stack) {\n fatal.stack = maybeError?.stack\n }\n }\n\n const {jsonOutputEnabled} = await import('../environment.js')\n const {commandEventOutputMode} = await import('../../../private/node/command-event-context.js')\n if (jsonOutputEnabled() || commandEventOutputMode() === 'json') {\n const {renderFatalErrorAsJson} = await import('../../../private/node/json-error.js')\n renderFatalErrorAsJson(fatal)\n await flushStdout()\n return error\n }\n\n const {renderFatalError} = await import('../ui.js')\n renderFatalError(fatal)\n return Promise.resolve(error)\n}\n\n/**\n * A function that maps an error to an Abort with the stack trace when coming from the CLI.\n *\n * @param error - Error to be mapped.\n * @returns A promise that resolves with the new error object.\n */\nexport function errorMapper(error: unknown): Promise<unknown> {\n if (error instanceof Errors.CLIError) {\n const mappedError = new AbortError(error.message)\n mappedError.stack = error.stack\n return Promise.resolve(mappedError)\n } else {\n return Promise.resolve(error)\n }\n}\n\n/**\n * A function that checks if an error is a fatal one.\n *\n * @param error - Error to be checked.\n * @returns A boolean indicating if the error is a fatal one.\n */\nfunction isFatal(error: unknown): error is FatalError {\n try {\n return Object.prototype.hasOwnProperty.call(error, 'type')\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return false\n }\n}\n\n/**\n * A function that checks if an error should be reported as unexpected.\n *\n * @param error - Error to be checked.\n * @returns A boolean indicating if the error should be reported as unexpected.\n */\nexport function shouldReportErrorAsUnexpected(error: unknown): boolean {\n if (!isFatal(error)) {\n // this means its not one of the CLI wrapped errors\n if (error instanceof Error) {\n // Raw API errors that slip through unwrapped (e.g. the handleErrors:false path) are expected\n // environmental conditions, not CLI bugs. Treat them as expected so they don't pollute crash\n // reporting.\n if (isExpectedApiError(error)) {\n return false\n }\n const message = error.message\n return !errorMessageImpliesEnvironmentIssue(message)\n }\n return true\n }\n if (error.type === FatalErrorType.Bug) {\n return true\n }\n return false\n}\n\n/**\n * Detects raw graphql-request `ClientError`s that are expected environmental conditions rather than\n * CLI bugs. These reach the reporter as plain `Error`s (not `FatalError`s) and would otherwise be\n * reported as unexpected.\n *\n * HTTP 401 (unauthenticated) is not \"transient\" in the retry sense — it means the user's session\n * token is expired or invalid, a credential/environment condition (see issue #7891). Rate limiting\n * (HTTP 429, or a `THROTTLED`/`429` GraphQL code on any error in the response) matches the shape\n * detected by `errorsIncludeStatus429` in `private/node/api.ts`. Gateway errors (502/503/504) are\n * also expected infrastructure failures.\n *\n * Scoped to the external `ClientError` shape only — importing the cli-kit `GraphQLClientError`\n * wrapper here would create an `error.ts → headers.ts → error.ts` import cycle.\n *\n * Matched structurally rather than with `instanceof ClientError`, because importing the class\n * pulls `graphql-request` — and through it `graphql`, `tr46` and `whatwg-url` — into the module\n * graph of every command, for one type check on an error path. `ClientError` is the only error\n * reaching here that carries both `response` and `request`; the cli-kit wrapper carries\n * `statusCode` instead (see `private/node/api/headers.ts`).\n *\n * @param error - Error to be checked.\n * @returns A boolean indicating if the error is a known expected API error.\n */\nfunction isExpectedApiError(error: Error): boolean {\n const candidate = error as Error & {\n response?: {status?: number; errors?: unknown}\n request?: unknown\n }\n if (typeof candidate.response !== 'object' || candidate.response === null || candidate.request === undefined) {\n return false\n }\n const status = candidate.response.status\n if (status === 401 || status === 429 || isGatewayErrorStatus(status)) {\n return true\n }\n return hasRateLimitCode(candidate.response.errors)\n}\n\n/**\n * Stack traces usually have file:// - we strip that and also remove the Windows drive designation.\n *\n * @param filePath - Path to be cleaned.\n * @returns The cleaned path.\n */\nexport function cleanSingleStackTracePath(filePath: string): string {\n return normalizePath(filePath)\n .replace('file:/', '/')\n .replace(/^\\/?[A-Z]:/, '')\n}\n\n/**\n * There are certain errors that we know are not due to a CLI bug, but are environmental/user error.\n *\n * @param message - The error message to check.\n * @returns A boolean indicating if the error message implies an environment issue.\n */\nfunction errorMessageImpliesEnvironmentIssue(message: string): boolean {\n const environmentIssueMessages = [\n 'EPERM: operation not permitted, scandir',\n 'EPERM: operation not permitted, rename',\n 'EACCES: permission denied',\n 'EPERM: operation not permitted, symlink',\n 'This version of npm supports the following node versions',\n 'EBUSY: resource busy or locked',\n 'ENOTEMPTY: directory not empty',\n 'getaddrinfo ENOTFOUND',\n 'Client network socket disconnected before secure TLS connection was established',\n 'spawn EPERM',\n 'socket hang up',\n 'The user aborted a request.',\n 'write EPIPE',\n 'Unsupported platform',\n ]\n const anyMatches = environmentIssueMessages.some((issueMessage) => message.includes(issueMessage))\n return anyMatches\n}\n"]}
|
|
@@ -30,24 +30,24 @@ export declare const JsonAbortErrorSchema: zod.ZodObject<{
|
|
|
30
30
|
type: "abort";
|
|
31
31
|
message: string;
|
|
32
32
|
code?: string | undefined;
|
|
33
|
+
tryMessage?: string | undefined;
|
|
33
34
|
nextSteps?: string[] | undefined;
|
|
34
35
|
customSections?: {
|
|
35
36
|
body: string | string[][];
|
|
36
37
|
title?: string | undefined;
|
|
37
38
|
}[] | undefined;
|
|
38
39
|
details?: unknown;
|
|
39
|
-
tryMessage?: string | undefined;
|
|
40
40
|
}, {
|
|
41
41
|
type: "abort";
|
|
42
42
|
message: string;
|
|
43
43
|
code?: string | undefined;
|
|
44
|
+
tryMessage?: string | undefined;
|
|
44
45
|
nextSteps?: string[] | undefined;
|
|
45
46
|
customSections?: {
|
|
46
47
|
body: string | string[][];
|
|
47
48
|
title?: string | undefined;
|
|
48
49
|
}[] | undefined;
|
|
49
50
|
details?: unknown;
|
|
50
|
-
tryMessage?: string | undefined;
|
|
51
51
|
}>;
|
|
52
52
|
export declare const JsonBugErrorSchema: zod.ZodObject<{
|
|
53
53
|
stack: zod.ZodOptional<zod.ZodString>;
|
|
@@ -71,6 +71,7 @@ export declare const JsonBugErrorSchema: zod.ZodObject<{
|
|
|
71
71
|
type: "bug";
|
|
72
72
|
message: string;
|
|
73
73
|
code?: string | undefined;
|
|
74
|
+
tryMessage?: string | undefined;
|
|
74
75
|
stack?: string | undefined;
|
|
75
76
|
nextSteps?: string[] | undefined;
|
|
76
77
|
customSections?: {
|
|
@@ -78,11 +79,11 @@ export declare const JsonBugErrorSchema: zod.ZodObject<{
|
|
|
78
79
|
title?: string | undefined;
|
|
79
80
|
}[] | undefined;
|
|
80
81
|
details?: unknown;
|
|
81
|
-
tryMessage?: string | undefined;
|
|
82
82
|
}, {
|
|
83
83
|
type: "bug";
|
|
84
84
|
message: string;
|
|
85
85
|
code?: string | undefined;
|
|
86
|
+
tryMessage?: string | undefined;
|
|
86
87
|
stack?: string | undefined;
|
|
87
88
|
nextSteps?: string[] | undefined;
|
|
88
89
|
customSections?: {
|
|
@@ -90,7 +91,6 @@ export declare const JsonBugErrorSchema: zod.ZodObject<{
|
|
|
90
91
|
title?: string | undefined;
|
|
91
92
|
}[] | undefined;
|
|
92
93
|
details?: unknown;
|
|
93
|
-
tryMessage?: string | undefined;
|
|
94
94
|
}>;
|
|
95
95
|
export declare const JsonExternalErrorSchema: zod.ZodObject<{
|
|
96
96
|
command: zod.ZodString;
|
|
@@ -117,26 +117,26 @@ export declare const JsonExternalErrorSchema: zod.ZodObject<{
|
|
|
117
117
|
command: string;
|
|
118
118
|
args: string[];
|
|
119
119
|
code?: string | undefined;
|
|
120
|
+
tryMessage?: string | undefined;
|
|
120
121
|
nextSteps?: string[] | undefined;
|
|
121
122
|
customSections?: {
|
|
122
123
|
body: string | string[][];
|
|
123
124
|
title?: string | undefined;
|
|
124
125
|
}[] | undefined;
|
|
125
126
|
details?: unknown;
|
|
126
|
-
tryMessage?: string | undefined;
|
|
127
127
|
}, {
|
|
128
128
|
type: "external";
|
|
129
129
|
message: string;
|
|
130
130
|
command: string;
|
|
131
131
|
args: string[];
|
|
132
132
|
code?: string | undefined;
|
|
133
|
+
tryMessage?: string | undefined;
|
|
133
134
|
nextSteps?: string[] | undefined;
|
|
134
135
|
customSections?: {
|
|
135
136
|
body: string | string[][];
|
|
136
137
|
title?: string | undefined;
|
|
137
138
|
}[] | undefined;
|
|
138
139
|
details?: unknown;
|
|
139
|
-
tryMessage?: string | undefined;
|
|
140
140
|
}>;
|
|
141
141
|
export declare const JsonErrorSchema: zod.ZodUnion<[zod.ZodObject<{
|
|
142
142
|
message: zod.ZodString;
|
|
@@ -159,24 +159,24 @@ export declare const JsonErrorSchema: zod.ZodUnion<[zod.ZodObject<{
|
|
|
159
159
|
type: "abort";
|
|
160
160
|
message: string;
|
|
161
161
|
code?: string | undefined;
|
|
162
|
+
tryMessage?: string | undefined;
|
|
162
163
|
nextSteps?: string[] | undefined;
|
|
163
164
|
customSections?: {
|
|
164
165
|
body: string | string[][];
|
|
165
166
|
title?: string | undefined;
|
|
166
167
|
}[] | undefined;
|
|
167
168
|
details?: unknown;
|
|
168
|
-
tryMessage?: string | undefined;
|
|
169
169
|
}, {
|
|
170
170
|
type: "abort";
|
|
171
171
|
message: string;
|
|
172
172
|
code?: string | undefined;
|
|
173
|
+
tryMessage?: string | undefined;
|
|
173
174
|
nextSteps?: string[] | undefined;
|
|
174
175
|
customSections?: {
|
|
175
176
|
body: string | string[][];
|
|
176
177
|
title?: string | undefined;
|
|
177
178
|
}[] | undefined;
|
|
178
179
|
details?: unknown;
|
|
179
|
-
tryMessage?: string | undefined;
|
|
180
180
|
}>, zod.ZodObject<{
|
|
181
181
|
stack: zod.ZodOptional<zod.ZodString>;
|
|
182
182
|
message: zod.ZodString;
|
|
@@ -199,6 +199,7 @@ export declare const JsonErrorSchema: zod.ZodUnion<[zod.ZodObject<{
|
|
|
199
199
|
type: "bug";
|
|
200
200
|
message: string;
|
|
201
201
|
code?: string | undefined;
|
|
202
|
+
tryMessage?: string | undefined;
|
|
202
203
|
stack?: string | undefined;
|
|
203
204
|
nextSteps?: string[] | undefined;
|
|
204
205
|
customSections?: {
|
|
@@ -206,11 +207,11 @@ export declare const JsonErrorSchema: zod.ZodUnion<[zod.ZodObject<{
|
|
|
206
207
|
title?: string | undefined;
|
|
207
208
|
}[] | undefined;
|
|
208
209
|
details?: unknown;
|
|
209
|
-
tryMessage?: string | undefined;
|
|
210
210
|
}, {
|
|
211
211
|
type: "bug";
|
|
212
212
|
message: string;
|
|
213
213
|
code?: string | undefined;
|
|
214
|
+
tryMessage?: string | undefined;
|
|
214
215
|
stack?: string | undefined;
|
|
215
216
|
nextSteps?: string[] | undefined;
|
|
216
217
|
customSections?: {
|
|
@@ -218,7 +219,6 @@ export declare const JsonErrorSchema: zod.ZodUnion<[zod.ZodObject<{
|
|
|
218
219
|
title?: string | undefined;
|
|
219
220
|
}[] | undefined;
|
|
220
221
|
details?: unknown;
|
|
221
|
-
tryMessage?: string | undefined;
|
|
222
222
|
}>, zod.ZodObject<{
|
|
223
223
|
command: zod.ZodString;
|
|
224
224
|
args: zod.ZodArray<zod.ZodString, "many">;
|
|
@@ -244,26 +244,26 @@ export declare const JsonErrorSchema: zod.ZodUnion<[zod.ZodObject<{
|
|
|
244
244
|
command: string;
|
|
245
245
|
args: string[];
|
|
246
246
|
code?: string | undefined;
|
|
247
|
+
tryMessage?: string | undefined;
|
|
247
248
|
nextSteps?: string[] | undefined;
|
|
248
249
|
customSections?: {
|
|
249
250
|
body: string | string[][];
|
|
250
251
|
title?: string | undefined;
|
|
251
252
|
}[] | undefined;
|
|
252
253
|
details?: unknown;
|
|
253
|
-
tryMessage?: string | undefined;
|
|
254
254
|
}, {
|
|
255
255
|
type: "external";
|
|
256
256
|
message: string;
|
|
257
257
|
command: string;
|
|
258
258
|
args: string[];
|
|
259
259
|
code?: string | undefined;
|
|
260
|
+
tryMessage?: string | undefined;
|
|
260
261
|
nextSteps?: string[] | undefined;
|
|
261
262
|
customSections?: {
|
|
262
263
|
body: string | string[][];
|
|
263
264
|
title?: string | undefined;
|
|
264
265
|
}[] | undefined;
|
|
265
266
|
details?: unknown;
|
|
266
|
-
tryMessage?: string | undefined;
|
|
267
267
|
}>]>;
|
|
268
268
|
export declare const jsonErrorOutputSchema: import("../json-output-schema.js").JsonOutputSchema<zod.ZodObject<{
|
|
269
269
|
error: zod.ZodUnion<[zod.ZodObject<{
|
|
@@ -287,24 +287,24 @@ export declare const jsonErrorOutputSchema: import("../json-output-schema.js").J
|
|
|
287
287
|
type: "abort";
|
|
288
288
|
message: string;
|
|
289
289
|
code?: string | undefined;
|
|
290
|
+
tryMessage?: string | undefined;
|
|
290
291
|
nextSteps?: string[] | undefined;
|
|
291
292
|
customSections?: {
|
|
292
293
|
body: string | string[][];
|
|
293
294
|
title?: string | undefined;
|
|
294
295
|
}[] | undefined;
|
|
295
296
|
details?: unknown;
|
|
296
|
-
tryMessage?: string | undefined;
|
|
297
297
|
}, {
|
|
298
298
|
type: "abort";
|
|
299
299
|
message: string;
|
|
300
300
|
code?: string | undefined;
|
|
301
|
+
tryMessage?: string | undefined;
|
|
301
302
|
nextSteps?: string[] | undefined;
|
|
302
303
|
customSections?: {
|
|
303
304
|
body: string | string[][];
|
|
304
305
|
title?: string | undefined;
|
|
305
306
|
}[] | undefined;
|
|
306
307
|
details?: unknown;
|
|
307
|
-
tryMessage?: string | undefined;
|
|
308
308
|
}>, zod.ZodObject<{
|
|
309
309
|
stack: zod.ZodOptional<zod.ZodString>;
|
|
310
310
|
message: zod.ZodString;
|
|
@@ -327,6 +327,7 @@ export declare const jsonErrorOutputSchema: import("../json-output-schema.js").J
|
|
|
327
327
|
type: "bug";
|
|
328
328
|
message: string;
|
|
329
329
|
code?: string | undefined;
|
|
330
|
+
tryMessage?: string | undefined;
|
|
330
331
|
stack?: string | undefined;
|
|
331
332
|
nextSteps?: string[] | undefined;
|
|
332
333
|
customSections?: {
|
|
@@ -334,11 +335,11 @@ export declare const jsonErrorOutputSchema: import("../json-output-schema.js").J
|
|
|
334
335
|
title?: string | undefined;
|
|
335
336
|
}[] | undefined;
|
|
336
337
|
details?: unknown;
|
|
337
|
-
tryMessage?: string | undefined;
|
|
338
338
|
}, {
|
|
339
339
|
type: "bug";
|
|
340
340
|
message: string;
|
|
341
341
|
code?: string | undefined;
|
|
342
|
+
tryMessage?: string | undefined;
|
|
342
343
|
stack?: string | undefined;
|
|
343
344
|
nextSteps?: string[] | undefined;
|
|
344
345
|
customSections?: {
|
|
@@ -346,7 +347,6 @@ export declare const jsonErrorOutputSchema: import("../json-output-schema.js").J
|
|
|
346
347
|
title?: string | undefined;
|
|
347
348
|
}[] | undefined;
|
|
348
349
|
details?: unknown;
|
|
349
|
-
tryMessage?: string | undefined;
|
|
350
350
|
}>, zod.ZodObject<{
|
|
351
351
|
command: zod.ZodString;
|
|
352
352
|
args: zod.ZodArray<zod.ZodString, "many">;
|
|
@@ -372,43 +372,44 @@ export declare const jsonErrorOutputSchema: import("../json-output-schema.js").J
|
|
|
372
372
|
command: string;
|
|
373
373
|
args: string[];
|
|
374
374
|
code?: string | undefined;
|
|
375
|
+
tryMessage?: string | undefined;
|
|
375
376
|
nextSteps?: string[] | undefined;
|
|
376
377
|
customSections?: {
|
|
377
378
|
body: string | string[][];
|
|
378
379
|
title?: string | undefined;
|
|
379
380
|
}[] | undefined;
|
|
380
381
|
details?: unknown;
|
|
381
|
-
tryMessage?: string | undefined;
|
|
382
382
|
}, {
|
|
383
383
|
type: "external";
|
|
384
384
|
message: string;
|
|
385
385
|
command: string;
|
|
386
386
|
args: string[];
|
|
387
387
|
code?: string | undefined;
|
|
388
|
+
tryMessage?: string | undefined;
|
|
388
389
|
nextSteps?: string[] | undefined;
|
|
389
390
|
customSections?: {
|
|
390
391
|
body: string | string[][];
|
|
391
392
|
title?: string | undefined;
|
|
392
393
|
}[] | undefined;
|
|
393
394
|
details?: unknown;
|
|
394
|
-
tryMessage?: string | undefined;
|
|
395
395
|
}>]>;
|
|
396
396
|
}, "strict", zod.ZodTypeAny, {
|
|
397
397
|
error: {
|
|
398
398
|
type: "abort";
|
|
399
399
|
message: string;
|
|
400
400
|
code?: string | undefined;
|
|
401
|
+
tryMessage?: string | undefined;
|
|
401
402
|
nextSteps?: string[] | undefined;
|
|
402
403
|
customSections?: {
|
|
403
404
|
body: string | string[][];
|
|
404
405
|
title?: string | undefined;
|
|
405
406
|
}[] | undefined;
|
|
406
407
|
details?: unknown;
|
|
407
|
-
tryMessage?: string | undefined;
|
|
408
408
|
} | {
|
|
409
409
|
type: "bug";
|
|
410
410
|
message: string;
|
|
411
411
|
code?: string | undefined;
|
|
412
|
+
tryMessage?: string | undefined;
|
|
412
413
|
stack?: string | undefined;
|
|
413
414
|
nextSteps?: string[] | undefined;
|
|
414
415
|
customSections?: {
|
|
@@ -416,37 +417,37 @@ export declare const jsonErrorOutputSchema: import("../json-output-schema.js").J
|
|
|
416
417
|
title?: string | undefined;
|
|
417
418
|
}[] | undefined;
|
|
418
419
|
details?: unknown;
|
|
419
|
-
tryMessage?: string | undefined;
|
|
420
420
|
} | {
|
|
421
421
|
type: "external";
|
|
422
422
|
message: string;
|
|
423
423
|
command: string;
|
|
424
424
|
args: string[];
|
|
425
425
|
code?: string | undefined;
|
|
426
|
+
tryMessage?: string | undefined;
|
|
426
427
|
nextSteps?: string[] | undefined;
|
|
427
428
|
customSections?: {
|
|
428
429
|
body: string | string[][];
|
|
429
430
|
title?: string | undefined;
|
|
430
431
|
}[] | undefined;
|
|
431
432
|
details?: unknown;
|
|
432
|
-
tryMessage?: string | undefined;
|
|
433
433
|
};
|
|
434
434
|
}, {
|
|
435
435
|
error: {
|
|
436
436
|
type: "abort";
|
|
437
437
|
message: string;
|
|
438
438
|
code?: string | undefined;
|
|
439
|
+
tryMessage?: string | undefined;
|
|
439
440
|
nextSteps?: string[] | undefined;
|
|
440
441
|
customSections?: {
|
|
441
442
|
body: string | string[][];
|
|
442
443
|
title?: string | undefined;
|
|
443
444
|
}[] | undefined;
|
|
444
445
|
details?: unknown;
|
|
445
|
-
tryMessage?: string | undefined;
|
|
446
446
|
} | {
|
|
447
447
|
type: "bug";
|
|
448
448
|
message: string;
|
|
449
449
|
code?: string | undefined;
|
|
450
|
+
tryMessage?: string | undefined;
|
|
450
451
|
stack?: string | undefined;
|
|
451
452
|
nextSteps?: string[] | undefined;
|
|
452
453
|
customSections?: {
|
|
@@ -454,19 +455,18 @@ export declare const jsonErrorOutputSchema: import("../json-output-schema.js").J
|
|
|
454
455
|
title?: string | undefined;
|
|
455
456
|
}[] | undefined;
|
|
456
457
|
details?: unknown;
|
|
457
|
-
tryMessage?: string | undefined;
|
|
458
458
|
} | {
|
|
459
459
|
type: "external";
|
|
460
460
|
message: string;
|
|
461
461
|
command: string;
|
|
462
462
|
args: string[];
|
|
463
463
|
code?: string | undefined;
|
|
464
|
+
tryMessage?: string | undefined;
|
|
464
465
|
nextSteps?: string[] | undefined;
|
|
465
466
|
customSections?: {
|
|
466
467
|
body: string | string[][];
|
|
467
468
|
title?: string | undefined;
|
|
468
469
|
}[] | undefined;
|
|
469
470
|
details?: unknown;
|
|
470
|
-
tryMessage?: string | undefined;
|
|
471
471
|
};
|
|
472
472
|
}>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { JsonError } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Projects an error into the shared JSON error contract, retaining only allowlisted fields.
|
|
4
|
+
*
|
|
5
|
+
* @param source - Error to project.
|
|
6
|
+
* @returns The error classification, message, and available recovery information.
|
|
7
|
+
*/
|
|
8
|
+
export declare function errorToJson(source: unknown): JsonError;
|