@sentry/mcp-server 0.35.0 → 0.37.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/auth/constants.cjs +1 -1
- package/dist/auth/constants.d.cts +1 -1
- package/dist/auth/constants.d.ts +1 -1
- package/dist/auth/constants.js +1 -1
- package/dist/auth/device-code-flow.cjs +4 -4
- package/dist/auth/device-code-flow.d.ts +1 -1
- package/dist/auth/device-code-flow.js +4 -4
- package/dist/auth/resolve-token.cjs +6 -6
- package/dist/auth/resolve-token.d.cts +1 -1
- package/dist/auth/resolve-token.d.ts +1 -1
- package/dist/auth/resolve-token.js +6 -6
- package/dist/auth/token-cache.cjs +1 -1
- package/dist/auth/token-cache.d.ts +1 -1
- package/dist/auth/token-cache.js +1 -1
- package/dist/auth/types.cjs +1 -1
- package/dist/auth/types.d.ts +1 -1
- package/dist/auth/types.js +1 -1
- package/dist/{auth-DeUVu86q.cjs → auth-CoEHiogK.cjs} +7 -7
- package/dist/{auth-DeUVu86q.cjs.map → auth-CoEHiogK.cjs.map} +1 -1
- package/dist/{auth-NuILycy3.js → auth-DMKQfLeC.js} +7 -7
- package/dist/{auth-NuILycy3.js.map → auth-DMKQfLeC.js.map} +1 -1
- package/dist/blob-utils-C7JBV2hl.js +3 -0
- package/dist/blob-utils-DaykNmFv.cjs +3 -0
- package/dist/blob-utils-W1AQ3zH3-CbD1HBpG.cjs +4709 -0
- package/dist/blob-utils-W1AQ3zH3-CbD1HBpG.cjs.map +1 -0
- package/dist/blob-utils-W1AQ3zH3-Dqg_Ruod.js +4692 -0
- package/dist/blob-utils-W1AQ3zH3-Dqg_Ruod.js.map +1 -0
- package/dist/chunk-CunrlGP7.js +37 -0
- package/dist/cli/commands/auth.cjs +8 -8
- package/dist/cli/commands/auth.js +8 -8
- package/dist/cli/output.cjs +3 -0
- package/dist/cli/output.d.cts +7 -0
- package/dist/cli/output.d.cts.map +1 -0
- package/dist/cli/output.d.ts +7 -0
- package/dist/cli/output.d.ts.map +1 -0
- package/dist/cli/output.js +3 -0
- package/dist/cli/parse.cjs +1 -1
- package/dist/cli/parse.d.cts +1 -1
- package/dist/cli/parse.d.ts +1 -1
- package/dist/cli/parse.js +1 -1
- package/dist/cli/resolve.cjs +2 -2
- package/dist/cli/resolve.d.cts +1 -1
- package/dist/cli/resolve.d.cts.map +1 -1
- package/dist/cli/resolve.d.ts +1 -1
- package/dist/cli/resolve.d.ts.map +1 -1
- package/dist/cli/resolve.js +2 -2
- package/dist/cli/types.d.cts +2 -2
- package/dist/cli/types.d.ts +2 -2
- package/dist/cli/usage.cjs +1 -1
- package/dist/cli/usage.js +1 -1
- package/dist/{config-Bnslg67w.js → config-8Hjp9aiG.js} +1 -1
- package/dist/config-BXJMmHuY.cjs +7 -0
- package/dist/{config-YHBj037H-DRbUBG2X.js → config-CUeobZnr-BYvJlg7Z.js} +7 -5
- package/dist/config-CUeobZnr-BYvJlg7Z.js.map +1 -0
- package/dist/{config-YHBj037H-DI-vM9pT.cjs → config-CUeobZnr-C1uLYu0T.cjs} +7 -5
- package/dist/config-CUeobZnr-C1uLYu0T.cjs.map +1 -0
- package/dist/{constants-BjQ5jCEg.js → constants-D_84kMgg.js} +71 -9
- package/dist/constants-D_84kMgg.js.map +1 -0
- package/dist/{constants-Bgs-7WBj.cjs → constants-zNdapUB3.cjs} +94 -8
- package/dist/constants-zNdapUB3.cjs.map +1 -0
- package/dist/{device-code-flow-b6KaQzNJ.cjs → device-code-flow-C8F3AhEF.cjs} +4 -4
- package/dist/{device-code-flow-b6KaQzNJ.cjs.map → device-code-flow-C8F3AhEF.cjs.map} +1 -1
- package/dist/{device-code-flow-CltWJnOC.js → device-code-flow-CcQul2R1.js} +4 -4
- package/dist/{device-code-flow-CltWJnOC.js.map → device-code-flow-CcQul2R1.js.map} +1 -1
- package/dist/index.cjs +8286 -1828
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8284 -1825
- package/dist/index.js.map +1 -1
- package/dist/output-A_-7o7gV.js +8 -0
- package/dist/output-A_-7o7gV.js.map +1 -0
- package/dist/output-DEoNyYz7.cjs +14 -0
- package/dist/output-DEoNyYz7.cjs.map +1 -0
- package/dist/{parse-BSFxOAQG.js → parse-Da-x492e.js} +1 -1
- package/dist/{parse-BSFxOAQG.js.map → parse-Da-x492e.js.map} +1 -1
- package/dist/{parse-BTaa9TK5.cjs → parse-zwbX4Y-K.cjs} +1 -1
- package/dist/{parse-BTaa9TK5.cjs.map → parse-zwbX4Y-K.cjs.map} +1 -1
- package/dist/{resolve-D9XJMdCX.js → resolve-8tYs_T8S.js} +10 -15
- package/dist/resolve-8tYs_T8S.js.map +1 -0
- package/dist/{resolve-D4TZw-d-.cjs → resolve-CZF3TTNf.cjs} +10 -15
- package/dist/resolve-CZF3TTNf.cjs.map +1 -0
- package/dist/{resolve-token-DitlJMRA.js → resolve-token-BZT0rfog.js} +5 -5
- package/dist/{resolve-token-DitlJMRA.js.map → resolve-token-BZT0rfog.js.map} +1 -1
- package/dist/{resolve-token-BfHulcsU.cjs → resolve-token-DVtQqc4m.cjs} +5 -5
- package/dist/{resolve-token-BfHulcsU.cjs.map → resolve-token-DVtQqc4m.cjs.map} +1 -1
- package/dist/{stdio-CHTzpWeM.cjs → stdio-BuQ6IY8U.cjs} +17 -8
- package/dist/stdio-BuQ6IY8U.cjs.map +1 -0
- package/dist/{stdio-Eif0LiAU.js → stdio-CFhXG3ra.js} +17 -8
- package/dist/stdio-CFhXG3ra.js.map +1 -0
- package/dist/{token-YhriRz-K.js → token-3xpHVxQo.js} +4 -3
- package/dist/{token-YhriRz-K.js.map → token-3xpHVxQo.js.map} +1 -1
- package/dist/{token-URCv7LSS.cjs → token-C7MavkKX.cjs} +2 -2
- package/dist/{token-URCv7LSS.cjs.map → token-C7MavkKX.cjs.map} +1 -1
- package/dist/{token-cache-914WGYb3.cjs → token-cache-ATUcs1cg.cjs} +1 -1
- package/dist/token-cache-ATUcs1cg.cjs.map +1 -0
- package/dist/{token-cache-DHBN2ixb.js → token-cache-DbZp4rvg.js} +1 -1
- package/dist/token-cache-DbZp4rvg.js.map +1 -0
- package/dist/token-error-CBmJNKLY.js +43 -0
- package/dist/{token-error-Df8A7mgb.js.map → token-error-CBmJNKLY.js.map} +1 -1
- package/dist/token-util-4bIYDTMS.js +4 -0
- package/dist/{token-util-I45r8kkb.cjs → token-util-BRoQwIG6.cjs} +1 -1
- package/dist/{token-util-I45r8kkb.cjs.map → token-util-BRoQwIG6.cjs.map} +1 -1
- package/dist/{token-util-B-ZIWywO.cjs → token-util-DurDL44i.cjs} +1 -1
- package/dist/{token-util-Dnkz6ExF.js → token-util-batRsXGA.js} +3 -2
- package/dist/{token-util-Dnkz6ExF.js.map → token-util-batRsXGA.js.map} +1 -1
- package/dist/transports/stdio.cjs +2 -2
- package/dist/transports/stdio.d.cts +9 -5
- package/dist/transports/stdio.d.cts.map +1 -1
- package/dist/transports/stdio.d.ts +9 -5
- package/dist/transports/stdio.d.ts.map +1 -1
- package/dist/transports/stdio.js +2 -2
- package/dist/{types-nsyASfJr.js → types-BCSxlxZI.js} +1 -1
- package/dist/{types-nsyASfJr.js.map → types-BCSxlxZI.js.map} +1 -1
- package/dist/{types-C0xriI9T.d.ts → types-BclC2DY0.d.ts} +1 -1
- package/dist/{types-C0xriI9T.d.ts.map → types-BclC2DY0.d.ts.map} +1 -1
- package/dist/{types-BdLzKRyK.d.ts → types-DcYSHvwR.d.cts} +4 -3
- package/dist/types-DcYSHvwR.d.cts.map +1 -0
- package/dist/{types-BHd78Leq.d.cts → types-Ky5RNldv.d.ts} +4 -3
- package/dist/types-Ky5RNldv.d.ts.map +1 -0
- package/dist/{types-CxTPg1vE.cjs → types-dghCRFW4.cjs} +1 -1
- package/dist/{types-CxTPg1vE.cjs.map → types-dghCRFW4.cjs.map} +1 -1
- package/dist/{usage-WAgAGh1G.cjs → usage-D486x6Lh.cjs} +8 -5
- package/dist/usage-D486x6Lh.cjs.map +1 -0
- package/dist/{usage-CyXue87B.js → usage-QiSwuC5N.js} +8 -5
- package/dist/usage-QiSwuC5N.js.map +1 -0
- package/dist/{version-BsYB56vP.cjs → version-CDrryFjP.cjs} +3 -3
- package/dist/version-CDrryFjP.cjs.map +1 -0
- package/dist/version-COFS7UF2.js +7 -0
- package/dist/version-COFS7UF2.js.map +1 -0
- package/package.json +9 -9
- package/dist/blob-utils-B9a20TSV.js +0 -3
- package/dist/blob-utils-CGHZbDNh-CN3juEJQ.cjs +0 -66
- package/dist/blob-utils-CGHZbDNh-CN3juEJQ.cjs.map +0 -1
- package/dist/blob-utils-CGHZbDNh-Dhzb2_wT.js +0 -54
- package/dist/blob-utils-CGHZbDNh-Dhzb2_wT.js.map +0 -1
- package/dist/blob-utils-dQmZRlIb.cjs +0 -3
- package/dist/config-IA5hZFjI.cjs +0 -7
- package/dist/config-YHBj037H-DI-vM9pT.cjs.map +0 -1
- package/dist/config-YHBj037H-DRbUBG2X.js.map +0 -1
- package/dist/constants-Bgs-7WBj.cjs.map +0 -1
- package/dist/constants-BjQ5jCEg.js.map +0 -1
- package/dist/resolve-D4TZw-d-.cjs.map +0 -1
- package/dist/resolve-D9XJMdCX.js.map +0 -1
- package/dist/stdio-CHTzpWeM.cjs.map +0 -1
- package/dist/stdio-Eif0LiAU.js.map +0 -1
- package/dist/token-cache-914WGYb3.cjs.map +0 -1
- package/dist/token-cache-DHBN2ixb.js.map +0 -1
- package/dist/token-error-Df8A7mgb.js +0 -77
- package/dist/token-util-7XgZqk3d.js +0 -4
- package/dist/types-BHd78Leq.d.cts.map +0 -1
- package/dist/types-BdLzKRyK.d.ts.map +0 -1
- package/dist/usage-CyXue87B.js.map +0 -1
- package/dist/usage-WAgAGh1G.cjs.map +0 -1
- package/dist/version-BbMRHfZS.js +0 -7
- package/dist/version-BbMRHfZS.js.map +0 -1
- package/dist/version-BsYB56vP.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-
|
|
1
|
+
{"version":3,"file":"token-C7MavkKX.cjs","names":[],"sources":["../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar token_exports = {};\n__export(token_exports, {\n refreshToken: () => refreshToken\n});\nmodule.exports = __toCommonJS(token_exports);\nvar import_token_error = require(\"./token-error\");\nvar import_token_util = require(\"./token-util\");\nasync function refreshToken() {\n const { projectId, teamId } = (0, import_token_util.findProjectInfo)();\n let maybeToken = (0, import_token_util.loadToken)(projectId);\n if (!maybeToken || (0, import_token_util.isExpired)((0, import_token_util.getTokenPayload)(maybeToken.token))) {\n const authToken = await (0, import_token_util.getVercelCliToken)();\n if (!authToken) {\n throw new import_token_error.VercelOidcTokenError(\n \"Failed to refresh OIDC token: Log in to Vercel CLI and link your project with `vc link`\"\n );\n }\n if (!projectId) {\n throw new import_token_error.VercelOidcTokenError(\n \"Failed to refresh OIDC token: Try re-linking your project with `vc link`\"\n );\n }\n maybeToken = await (0, import_token_util.getVercelOidcToken)(authToken, projectId, teamId);\n if (!maybeToken) {\n throw new import_token_error.VercelOidcTokenError(\"Failed to refresh OIDC token\");\n }\n (0, import_token_util.saveToken)(maybeToken, projectId);\n }\n process.env.VERCEL_OIDC_TOKEN = maybeToken.token;\n return;\n}\n// Annotate the Common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BAC3B;AAGJ,gBAAa,MAAM,CAAC,GAAG,kBAAkB,oBAAoB,WAAW,WAAW,OAAO;AAC1F,QAAK,WACH,OAAM,IAAI,mBAAmB,qBAAqB;AAEpD,IAAC,GAAG,kBAAkB,WAAW,YAAY,UAAU;EACxD;AACD,UAAQ,IAAI,oBAAoB,WAAW;AAC3C;CACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-cache-ATUcs1cg.cjs","names":["host: string","clientId: string","data: CacheFile","token: CachedToken"],"sources":["../src/auth/token-cache.ts"],"sourcesContent":["/**\n * Persistent token cache for device code auth.\n * Tokens are stored at ~/.sentry/mcp.json, keyed by {host}:{clientId}.\n * See docs/operations/stdio-auth.md for cache format and security details.\n */\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport * as os from \"node:os\";\nimport type { CachedToken } from \"./types\";\n\n/** Safety window: treat tokens as expired 5 minutes before actual expiry. */\nconst EXPIRY_SAFETY_MS = 5 * 60 * 1000;\n\nfunction getCacheFilePath(): string {\n if (process.env.SENTRY_MCP_AUTH_CACHE) {\n return process.env.SENTRY_MCP_AUTH_CACHE;\n }\n return path.join(os.homedir(), \".sentry\", \"mcp.json\");\n}\n\nfunction cacheKey(host: string, clientId: string): string {\n return `${host}:${clientId}`;\n}\n\ntype CacheFile = Record<string, CachedToken>;\n\nasync function readCacheFile(): Promise<CacheFile> {\n try {\n const raw = await fs.readFile(getCacheFilePath(), \"utf-8\");\n return JSON.parse(raw) as CacheFile;\n } catch {\n return {};\n }\n}\n\nasync function writeCacheFile(data: CacheFile): Promise<void> {\n const filePath = getCacheFilePath();\n const dir = path.dirname(filePath);\n\n await fs.mkdir(dir, { recursive: true, mode: 0o700 });\n\n // Atomic write: write to temp file then rename\n const tmpPath = `${filePath}.tmp.${process.pid}`;\n await fs.writeFile(tmpPath, JSON.stringify(data, null, 2), {\n encoding: \"utf-8\",\n mode: 0o600,\n });\n await fs.rename(tmpPath, filePath);\n}\n\nexport async function readCachedToken(\n host: string,\n clientId: string,\n): Promise<CachedToken | null> {\n const data = await readCacheFile();\n const key = cacheKey(host, clientId);\n const entry = data[key];\n if (!entry) return null;\n\n const expiresAt = new Date(entry.expires_at).getTime();\n if (\n !Number.isFinite(expiresAt) ||\n expiresAt - Date.now() <= EXPIRY_SAFETY_MS\n ) {\n delete data[key];\n await writeCacheFile(data);\n return null;\n }\n\n return entry;\n}\n\nexport async function writeCachedToken(token: CachedToken): Promise<void> {\n const data = await readCacheFile();\n data[cacheKey(token.sentry_host, token.client_id)] = token;\n await writeCacheFile(data);\n}\n\nexport async function clearCachedToken(\n host: string,\n clientId: string,\n): Promise<void> {\n const data = await readCacheFile();\n const key = cacheKey(host, clientId);\n if (key in data) {\n delete data[key];\n await writeCacheFile(data);\n }\n}\n"],"mappings":";;;;;;;AAWA,MAAM,mBAAmB,IAAI,KAAK;AAElC,SAAS,mBAA2B;AAClC,KAAI,QAAQ,IAAI,sBACd,QAAO,QAAQ,IAAI;AAErB,QAAO,UAAK,KAAK,QAAG,SAAS,EAAE,WAAW,WAAW;AACtD;AAED,SAAS,SAASA,MAAcC,UAA0B;AACxD,WAAU,KAAK,GAAG;AACnB;AAID,eAAe,gBAAoC;AACjD,KAAI;EACF,MAAM,MAAM,MAAM,iBAAG,SAAS,kBAAkB,EAAE,QAAQ;AAC1D,SAAO,KAAK,MAAM,IAAI;CACvB,QAAO;AACN,SAAO,CAAE;CACV;AACF;AAED,eAAe,eAAeC,MAAgC;CAC5D,MAAM,WAAW,kBAAkB;CACnC,MAAM,MAAM,UAAK,QAAQ,SAAS;AAElC,OAAM,iBAAG,MAAM,KAAK;EAAE,WAAW;EAAM,MAAM;CAAO,EAAC;CAGrD,MAAM,aAAa,SAAS,OAAO,QAAQ;AAC3C,OAAM,iBAAG,UAAU,SAAS,KAAK,UAAU,MAAM,MAAM,EAAE,EAAE;EACzD,UAAU;EACV,MAAM;CACP,EAAC;AACF,OAAM,iBAAG,OAAO,SAAS,SAAS;AACnC;AAED,eAAsB,gBACpBF,MACAC,UAC6B;CAC7B,MAAM,OAAO,MAAM,eAAe;CAClC,MAAM,MAAM,SAAS,MAAM,SAAS;CACpC,MAAM,QAAQ,KAAK;AACnB,MAAK,MAAO,QAAO;CAEnB,MAAM,YAAY,IAAI,KAAK,MAAM,YAAY,SAAS;AACtD,MACG,OAAO,SAAS,UAAU,IAC3B,YAAY,KAAK,KAAK,IAAI,kBAC1B;AACA,SAAO,KAAK;AACZ,QAAM,eAAe,KAAK;AAC1B,SAAO;CACR;AAED,QAAO;AACR;AAED,eAAsB,iBAAiBE,OAAmC;CACxE,MAAM,OAAO,MAAM,eAAe;AAClC,MAAK,SAAS,MAAM,aAAa,MAAM,UAAU,IAAI;AACrD,OAAM,eAAe,KAAK;AAC3B;AAED,eAAsB,iBACpBH,MACAC,UACe;CACf,MAAM,OAAO,MAAM,eAAe;CAClC,MAAM,MAAM,SAAS,MAAM,SAAS;AACpC,KAAI,OAAO,MAAM;AACf,SAAO,KAAK;AACZ,QAAM,eAAe,KAAK;CAC3B;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-cache-DbZp4rvg.js","names":["host: string","clientId: string","data: CacheFile","token: CachedToken"],"sources":["../src/auth/token-cache.ts"],"sourcesContent":["/**\n * Persistent token cache for device code auth.\n * Tokens are stored at ~/.sentry/mcp.json, keyed by {host}:{clientId}.\n * See docs/operations/stdio-auth.md for cache format and security details.\n */\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport * as os from \"node:os\";\nimport type { CachedToken } from \"./types\";\n\n/** Safety window: treat tokens as expired 5 minutes before actual expiry. */\nconst EXPIRY_SAFETY_MS = 5 * 60 * 1000;\n\nfunction getCacheFilePath(): string {\n if (process.env.SENTRY_MCP_AUTH_CACHE) {\n return process.env.SENTRY_MCP_AUTH_CACHE;\n }\n return path.join(os.homedir(), \".sentry\", \"mcp.json\");\n}\n\nfunction cacheKey(host: string, clientId: string): string {\n return `${host}:${clientId}`;\n}\n\ntype CacheFile = Record<string, CachedToken>;\n\nasync function readCacheFile(): Promise<CacheFile> {\n try {\n const raw = await fs.readFile(getCacheFilePath(), \"utf-8\");\n return JSON.parse(raw) as CacheFile;\n } catch {\n return {};\n }\n}\n\nasync function writeCacheFile(data: CacheFile): Promise<void> {\n const filePath = getCacheFilePath();\n const dir = path.dirname(filePath);\n\n await fs.mkdir(dir, { recursive: true, mode: 0o700 });\n\n // Atomic write: write to temp file then rename\n const tmpPath = `${filePath}.tmp.${process.pid}`;\n await fs.writeFile(tmpPath, JSON.stringify(data, null, 2), {\n encoding: \"utf-8\",\n mode: 0o600,\n });\n await fs.rename(tmpPath, filePath);\n}\n\nexport async function readCachedToken(\n host: string,\n clientId: string,\n): Promise<CachedToken | null> {\n const data = await readCacheFile();\n const key = cacheKey(host, clientId);\n const entry = data[key];\n if (!entry) return null;\n\n const expiresAt = new Date(entry.expires_at).getTime();\n if (\n !Number.isFinite(expiresAt) ||\n expiresAt - Date.now() <= EXPIRY_SAFETY_MS\n ) {\n delete data[key];\n await writeCacheFile(data);\n return null;\n }\n\n return entry;\n}\n\nexport async function writeCachedToken(token: CachedToken): Promise<void> {\n const data = await readCacheFile();\n data[cacheKey(token.sentry_host, token.client_id)] = token;\n await writeCacheFile(data);\n}\n\nexport async function clearCachedToken(\n host: string,\n clientId: string,\n): Promise<void> {\n const data = await readCacheFile();\n const key = cacheKey(host, clientId);\n if (key in data) {\n delete data[key];\n await writeCacheFile(data);\n }\n}\n"],"mappings":";;;;;;AAWA,MAAM,mBAAmB,IAAI,KAAK;AAElC,SAAS,mBAA2B;AAClC,KAAI,QAAQ,IAAI,sBACd,QAAO,QAAQ,IAAI;AAErB,QAAO,KAAK,KAAK,GAAG,SAAS,EAAE,WAAW,WAAW;AACtD;AAED,SAAS,SAASA,MAAcC,UAA0B;AACxD,WAAU,KAAK,GAAG;AACnB;AAID,eAAe,gBAAoC;AACjD,KAAI;EACF,MAAM,MAAM,MAAM,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modules/@vercel/oidc/dist/token-error.js
|
|
4
|
+
var require_token_error = __commonJS({ "../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token-error.js"(exports, module) {
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
18
|
+
get: () => from[key],
|
|
19
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var token_error_exports = {};
|
|
26
|
+
__export(token_error_exports, { VercelOidcTokenError: () => VercelOidcTokenError });
|
|
27
|
+
module.exports = __toCommonJS(token_error_exports);
|
|
28
|
+
var VercelOidcTokenError = class extends Error {
|
|
29
|
+
constructor(message, cause) {
|
|
30
|
+
super(message);
|
|
31
|
+
this.name = "VercelOidcTokenError";
|
|
32
|
+
this.cause = cause;
|
|
33
|
+
}
|
|
34
|
+
toString() {
|
|
35
|
+
if (this.cause) return `${this.name}: ${this.message}: ${this.cause}`;
|
|
36
|
+
return `${this.name}: ${this.message}`;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
} });
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
export { require_token_error };
|
|
43
|
+
//# sourceMappingURL=token-error-CBmJNKLY.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-error-
|
|
1
|
+
{"version":3,"file":"token-error-CBmJNKLY.js","names":[],"sources":["../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token-error.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar token_error_exports = {};\n__export(token_error_exports, {\n VercelOidcTokenError: () => VercelOidcTokenError\n});\nmodule.exports = __toCommonJS(token_error_exports);\nclass VercelOidcTokenError extends Error {\n constructor(message, cause) {\n super(message);\n this.name = \"VercelOidcTokenError\";\n this.cause = cause;\n }\n toString() {\n if (this.cause) {\n return `${this.name}: ${this.message}: ${this.cause}`;\n }\n return `${this.name}: ${this.message}`;\n }\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n VercelOidcTokenError\n});\n"],"x_google_ignoreList":[0],"mappings":";;;;CACA,IAAI,YAAY,OAAO;CACvB,IAAI,mBAAmB,OAAO;CAC9B,IAAI,oBAAoB,OAAO;CAC/B,IAAI,eAAe,OAAO,UAAU;CACpC,IAAI,WAAW,CAAC,QAAQ,QAAQ;AAC9B,OAAK,IAAI,QAAQ,IACf,WAAU,QAAQ,MAAM;GAAE,KAAK,IAAI;GAAO,YAAY;EAAM,EAAC;CAChE;CACD,IAAI,cAAc,CAAC,IAAI,MAAM,QAAQ,SAAS;AAC5C,MAAI,eAAe,SAAS,mBAAmB,SAAS,YACtD;QAAK,IAAI,OAAO,kBAAkB,KAAK,CACrC,MAAK,aAAa,KAAK,IAAI,IAAI,IAAI,QAAQ,OACzC,WAAU,IAAI,KAAK;IAAE,KAAK,MAAM,KAAK;IAAM,cAAc,OAAO,iBAAiB,MAAM,IAAI,KAAK,KAAK;GAAY,EAAC;EAAC;AAEzH,SAAO;CACR;CACD,IAAI,eAAe,CAAC,QAAQ,YAAY,UAAU,CAAE,GAAE,cAAc,EAAE,OAAO,KAAM,EAAC,EAAE,IAAI;CAC1F,IAAI,sBAAsB,CAAE;AAC5B,UAAS,qBAAqB,EAC5B,sBAAsB,MAAM,qBAC7B,EAAC;AACF,QAAO,UAAU,aAAa,oBAAoB;CAClD,IAAM,uBAAN,cAAmC,MAAM;EACvC,YAAY,SAAS,OAAO;AAC1B,SAAM,QAAQ;AACd,QAAK,OAAO;AACZ,QAAK,QAAQ;EACd;EACD,WAAW;AACT,OAAI,KAAK,MACP,WAAU,KAAK,KAAK,IAAI,KAAK,QAAQ,IAAI,KAAK;AAEhD,aAAU,KAAK,KAAK,IAAI,KAAK;EAC9B;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-util-I45r8kkb.cjs","names":["__create","__defProp","__getOwnPropDesc","__getOwnPropNames","__getProtoOf","__hasOwnProp","__export","__copyProps","__toESM","__toCommonJS","import_os","import_token_error","__create","__defProp","__getOwnPropDesc","__getOwnPropNames","__getProtoOf","__hasOwnProp","__export","__copyProps","__toESM","__toCommonJS","fs","path","__defProp","__getOwnPropDesc","__getOwnPropNames","__hasOwnProp","__export","__copyProps","__toCommonJS"],"sources":["../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token-io.js","../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/auth-config.js","../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/oauth.js","../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token-util.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar token_io_exports = {};\n__export(token_io_exports, {\n findRootDir: () => findRootDir,\n getUserDataDir: () => getUserDataDir\n});\nmodule.exports = __toCommonJS(token_io_exports);\nvar import_path = __toESM(require(\"path\"));\nvar import_fs = __toESM(require(\"fs\"));\nvar import_os = __toESM(require(\"os\"));\nvar import_token_error = require(\"./token-error\");\nfunction findRootDir() {\n try {\n let dir = process.cwd();\n while (dir !== import_path.default.dirname(dir)) {\n const pkgPath = import_path.default.join(dir, \".vercel\");\n if (import_fs.default.existsSync(pkgPath)) {\n return dir;\n }\n dir = import_path.default.dirname(dir);\n }\n } catch (e) {\n throw new import_token_error.VercelOidcTokenError(\n \"Token refresh only supported in node server environments\"\n );\n }\n return null;\n}\nfunction getUserDataDir() {\n if (process.env.XDG_DATA_HOME) {\n return process.env.XDG_DATA_HOME;\n }\n switch (import_os.default.platform()) {\n case \"darwin\":\n return import_path.default.join(import_os.default.homedir(), \"Library/Application Support\");\n case \"linux\":\n return import_path.default.join(import_os.default.homedir(), \".local/share\");\n case \"win32\":\n if (process.env.LOCALAPPDATA) {\n return process.env.LOCALAPPDATA;\n }\n return null;\n default:\n return null;\n }\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n findRootDir,\n getUserDataDir\n});\n","\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar auth_config_exports = {};\n__export(auth_config_exports, {\n isValidAccessToken: () => isValidAccessToken,\n readAuthConfig: () => readAuthConfig,\n writeAuthConfig: () => writeAuthConfig\n});\nmodule.exports = __toCommonJS(auth_config_exports);\nvar fs = __toESM(require(\"fs\"));\nvar path = __toESM(require(\"path\"));\nvar import_token_util = require(\"./token-util\");\nfunction getAuthConfigPath() {\n const dataDir = (0, import_token_util.getVercelDataDir)();\n if (!dataDir) {\n throw new Error(\n `Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`\n );\n }\n return path.join(dataDir, \"auth.json\");\n}\nfunction readAuthConfig() {\n try {\n const authPath = getAuthConfigPath();\n if (!fs.existsSync(authPath)) {\n return null;\n }\n const content = fs.readFileSync(authPath, \"utf8\");\n if (!content) {\n return null;\n }\n return JSON.parse(content);\n } catch (error) {\n return null;\n }\n}\nfunction writeAuthConfig(config) {\n const authPath = getAuthConfigPath();\n const authDir = path.dirname(authPath);\n if (!fs.existsSync(authDir)) {\n fs.mkdirSync(authDir, { mode: 504, recursive: true });\n }\n fs.writeFileSync(authPath, JSON.stringify(config, null, 2), { mode: 384 });\n}\nfunction isValidAccessToken(authConfig) {\n if (!authConfig.token)\n return false;\n if (typeof authConfig.expiresAt !== \"number\")\n return true;\n const nowInSeconds = Math.floor(Date.now() / 1e3);\n return authConfig.expiresAt >= nowInSeconds;\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n isValidAccessToken,\n readAuthConfig,\n writeAuthConfig\n});\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar oauth_exports = {};\n__export(oauth_exports, {\n processTokenResponse: () => processTokenResponse,\n refreshTokenRequest: () => refreshTokenRequest\n});\nmodule.exports = __toCommonJS(oauth_exports);\nvar import_os = require(\"os\");\nconst VERCEL_ISSUER = \"https://vercel.com\";\nconst VERCEL_CLI_CLIENT_ID = \"cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp\";\nconst userAgent = `@vercel/oidc node-${process.version} ${(0, import_os.platform)()} (${(0, import_os.arch)()}) ${(0, import_os.hostname)()}`;\nlet _tokenEndpoint = null;\nasync function getTokenEndpoint() {\n if (_tokenEndpoint) {\n return _tokenEndpoint;\n }\n const discoveryUrl = `${VERCEL_ISSUER}/.well-known/openid-configuration`;\n const response = await fetch(discoveryUrl, {\n headers: { \"user-agent\": userAgent }\n });\n if (!response.ok) {\n throw new Error(\"Failed to discover OAuth endpoints\");\n }\n const metadata = await response.json();\n if (!metadata || typeof metadata.token_endpoint !== \"string\") {\n throw new Error(\"Invalid OAuth discovery response\");\n }\n const endpoint = metadata.token_endpoint;\n _tokenEndpoint = endpoint;\n return endpoint;\n}\nasync function refreshTokenRequest(options) {\n const tokenEndpoint = await getTokenEndpoint();\n return await fetch(tokenEndpoint, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n \"user-agent\": userAgent\n },\n body: new URLSearchParams({\n client_id: VERCEL_CLI_CLIENT_ID,\n grant_type: \"refresh_token\",\n ...options\n })\n });\n}\nasync function processTokenResponse(response) {\n const json = await response.json();\n if (!response.ok) {\n const errorMsg = typeof json === \"object\" && json && \"error\" in json ? String(json.error) : \"Token refresh failed\";\n return [new Error(errorMsg)];\n }\n if (typeof json !== \"object\" || json === null) {\n return [new Error(\"Invalid token response\")];\n }\n if (typeof json.access_token !== \"string\") {\n return [new Error(\"Missing access_token in response\")];\n }\n if (json.token_type !== \"Bearer\") {\n return [new Error(\"Invalid token_type in response\")];\n }\n if (typeof json.expires_in !== \"number\") {\n return [new Error(\"Missing expires_in in response\")];\n }\n return [null, json];\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n processTokenResponse,\n refreshTokenRequest\n});\n","\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar token_util_exports = {};\n__export(token_util_exports, {\n assertVercelOidcTokenResponse: () => assertVercelOidcTokenResponse,\n findProjectInfo: () => findProjectInfo,\n getTokenPayload: () => getTokenPayload,\n getVercelCliToken: () => getVercelCliToken,\n getVercelDataDir: () => getVercelDataDir,\n getVercelOidcToken: () => getVercelOidcToken,\n isExpired: () => isExpired,\n loadToken: () => loadToken,\n saveToken: () => saveToken\n});\nmodule.exports = __toCommonJS(token_util_exports);\nvar path = __toESM(require(\"path\"));\nvar fs = __toESM(require(\"fs\"));\nvar import_token_error = require(\"./token-error\");\nvar import_token_io = require(\"./token-io\");\nvar import_auth_config = require(\"./auth-config\");\nvar import_oauth = require(\"./oauth\");\nfunction getVercelDataDir() {\n const vercelFolder = \"com.vercel.cli\";\n const dataDir = (0, import_token_io.getUserDataDir)();\n if (!dataDir) {\n return null;\n }\n return path.join(dataDir, vercelFolder);\n}\nasync function getVercelCliToken() {\n const authConfig = (0, import_auth_config.readAuthConfig)();\n if (!authConfig) {\n return null;\n }\n if ((0, import_auth_config.isValidAccessToken)(authConfig)) {\n return authConfig.token || null;\n }\n if (!authConfig.refreshToken) {\n (0, import_auth_config.writeAuthConfig)({});\n return null;\n }\n try {\n const tokenResponse = await (0, import_oauth.refreshTokenRequest)({\n refresh_token: authConfig.refreshToken\n });\n const [tokensError, tokens] = await (0, import_oauth.processTokenResponse)(tokenResponse);\n if (tokensError || !tokens) {\n (0, import_auth_config.writeAuthConfig)({});\n return null;\n }\n const updatedConfig = {\n token: tokens.access_token,\n expiresAt: Math.floor(Date.now() / 1e3) + tokens.expires_in\n };\n if (tokens.refresh_token) {\n updatedConfig.refreshToken = tokens.refresh_token;\n }\n (0, import_auth_config.writeAuthConfig)(updatedConfig);\n return updatedConfig.token ?? null;\n } catch (error) {\n (0, import_auth_config.writeAuthConfig)({});\n return null;\n }\n}\nasync function getVercelOidcToken(authToken, projectId, teamId) {\n const url = `https://api.vercel.com/v1/projects/${projectId}/token?source=vercel-oidc-refresh${teamId ? `&teamId=${teamId}` : \"\"}`;\n const res = await fetch(url, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${authToken}`\n }\n });\n if (!res.ok) {\n throw new import_token_error.VercelOidcTokenError(\n `Failed to refresh OIDC token: ${res.statusText}`\n );\n }\n const tokenRes = await res.json();\n assertVercelOidcTokenResponse(tokenRes);\n return tokenRes;\n}\nfunction assertVercelOidcTokenResponse(res) {\n if (!res || typeof res !== \"object\") {\n throw new TypeError(\n \"Vercel OIDC token is malformed. Expected an object. Please run `vc env pull` and try again\"\n );\n }\n if (!(\"token\" in res) || typeof res.token !== \"string\") {\n throw new TypeError(\n \"Vercel OIDC token is malformed. Expected a string-valued token property. Please run `vc env pull` and try again\"\n );\n }\n}\nfunction findProjectInfo() {\n const dir = (0, import_token_io.findRootDir)();\n if (!dir) {\n throw new import_token_error.VercelOidcTokenError(\n \"Unable to find project root directory. Have you linked your project with `vc link?`\"\n );\n }\n const prjPath = path.join(dir, \".vercel\", \"project.json\");\n if (!fs.existsSync(prjPath)) {\n throw new import_token_error.VercelOidcTokenError(\n \"project.json not found, have you linked your project with `vc link?`\"\n );\n }\n const prj = JSON.parse(fs.readFileSync(prjPath, \"utf8\"));\n if (typeof prj.projectId !== \"string\" && typeof prj.orgId !== \"string\") {\n throw new TypeError(\n \"Expected a string-valued projectId property. Try running `vc link` to re-link your project.\"\n );\n }\n return { projectId: prj.projectId, teamId: prj.orgId };\n}\nfunction saveToken(token, projectId) {\n const dir = (0, import_token_io.getUserDataDir)();\n if (!dir) {\n throw new import_token_error.VercelOidcTokenError(\n \"Unable to find user data directory. Please reach out to Vercel support.\"\n );\n }\n const tokenPath = path.join(dir, \"com.vercel.token\", `${projectId}.json`);\n const tokenJson = JSON.stringify(token);\n fs.mkdirSync(path.dirname(tokenPath), { mode: 504, recursive: true });\n fs.writeFileSync(tokenPath, tokenJson);\n fs.chmodSync(tokenPath, 432);\n return;\n}\nfunction loadToken(projectId) {\n const dir = (0, import_token_io.getUserDataDir)();\n if (!dir) {\n throw new import_token_error.VercelOidcTokenError(\n \"Unable to find user data directory. Please reach out to Vercel support.\"\n );\n }\n const tokenPath = path.join(dir, \"com.vercel.token\", `${projectId}.json`);\n if (!fs.existsSync(tokenPath)) {\n return null;\n }\n const token = JSON.parse(fs.readFileSync(tokenPath, \"utf8\"));\n assertVercelOidcTokenResponse(token);\n return token;\n}\nfunction getTokenPayload(token) {\n const tokenParts = token.split(\".\");\n if (tokenParts.length !== 3) {\n throw new import_token_error.VercelOidcTokenError(\n \"Invalid token. Please run `vc env pull` and try again\"\n );\n }\n const base64 = tokenParts[1].replace(/-/g, \"+\").replace(/_/g, \"/\");\n const padded = base64.padEnd(\n base64.length + (4 - base64.length % 4) % 4,\n \"=\"\n );\n return JSON.parse(Buffer.from(padded, \"base64\").toString(\"utf8\"));\n}\nfunction isExpired(token) {\n return token.exp * 1e3 < Date.now();\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n assertVercelOidcTokenResponse,\n findProjectInfo,\n getTokenPayload,\n getVercelCliToken,\n getVercelDataDir,\n getVercelOidcToken,\n isExpired,\n loadToken,\n saveToken\n});\n"],"x_google_ignoreList":[0,1,2,3],"mappings":";;;;;CACA,IAAIA,aAAW,OAAO;CACtB,IAAIC,cAAY,OAAO;CACvB,IAAIC,qBAAmB,OAAO;CAC9B,IAAIC,sBAAoB,OAAO;CAC/B,IAAIC,iBAAe,OAAO;CAC1B,IAAIC,iBAAe,OAAO,UAAU;CACpC,IAAIC,aAAW,CAAC,QAAQ,QAAQ;AAC9B,OAAK,IAAI,QAAQ,IACf,aAAU,QAAQ,MAAM;GAAE,KAAK,IAAI;GAAO,YAAY;EAAM,EAAC;CAChE;CACD,IAAIC,gBAAc,CAAC,IAAI,MAAM,QAAQ,SAAS;AAC5C,MAAI,eAAe,SAAS,mBAAmB,SAAS,YACtD;QAAK,IAAI,OAAO,oBAAkB,KAAK,CACrC,MAAK,eAAa,KAAK,IAAI,IAAI,IAAI,QAAQ,OACzC,aAAU,IAAI,KAAK;IAAE,KAAK,MAAM,KAAK;IAAM,cAAc,OAAO,mBAAiB,MAAM,IAAI,KAAK,KAAK;GAAY,EAAC;EAAC;AAEzH,SAAO;CACR;CACD,IAAIC,YAAU,CAAC,KAAK,YAAY,YAAY,SAAS,OAAO,O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,gBAAgB,iBAAiB;AACjD,OAAK,IACH,OAAM,IAAI,mBAAmB,qBAC3B;EAGJ,MAAM,YAAY,KAAK,KAAK,KAAK,uBAAuB,UAAU,OAAO;EACzE,MAAM,YAAY,KAAK,UAAU,MAAM;AACvC,KAAG,UAAU,KAAK,QAAQ,UAAU,EAAE;GAAE,MAAM;GAAK,WAAW;EAAM,EAAC;AACrE,KAAG,cAAc,WAAW,UAAU;AACtC,KAAG,UAAU,WAAW,IAAI;AAC5B;CACD;CACD,SAAS,UAAU,WAAW;EAC5B,MAAM,MAAM,CAAC,GAAG,gBAAgB,iBAAiB;AACjD,OAAK,IACH,OAAM,IAAI,mBAAmB,qBAC3B;EAGJ,MAAM,YAAY,KAAK,KAAK,KAAK,uBAAuB,UAAU,OAAO;AACzE,OAAK,GAAG,WAAW,UAAU,CAC3B,QAAO;EAET,MAAM,QAAQ,KAAK,MAAM,GAAG,aAAa,WAAW,OAAO,CAAC;AAC5D,gCAA8B,MAAM;AACpC,SAAO;CACR;CACD,SAAS,gBAAgB,OAAO;EAC9B,MAAM,aAAa,MAAM,MAAM,IAAI;AACnC,MAAI,WAAW,WAAW,EACxB,OAAM,IAAI,mBAAmB,qBAC3B;EAGJ,MAAM,SAAS,WAAW,GAAG,QAAQ,MAAM,IAAI,CAAC,QAAQ,MAAM,IAAI;EAClE,MAAM,SAAS,OAAO,OACpB,OAAO,UAAU,IAAI,OAAO,SAAS,KAAK,GAC1C,IACD;AACD,SAAO,KAAK,MAAM,OAAO,KAAK,QAAQ,SAAS,CAAC,SAAS,OAAO,CAAC;CAClE;CACD,SAAS,UAAU,OAAO;AACxB,SAAO,MAAM,MAAM,MAAM,KAAK,KAAK;CACpC"}
|
|
1
|
+
{"version":3,"file":"token-util-BRoQwIG6.cjs","names":["__create","__defProp","__getOwnPropDesc","__getOwnPropNames","__getProtoOf","__hasOwnProp","__export","__copyProps","__toESM","__toCommonJS","import_os","import_token_error","__create","__defProp","__getOwnPropDesc","__getOwnPropNames","__getProtoOf","__hasOwnProp","__export","__copyProps","__toESM","__toCommonJS","fs","path","__defProp","__getOwnPropDesc","__getOwnPropNames","__hasOwnProp","__export","__copyProps","__toCommonJS"],"sources":["../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token-io.js","../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/auth-config.js","../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/oauth.js","../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token-util.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar token_io_exports = {};\n__export(token_io_exports, {\n findRootDir: () => findRootDir,\n getUserDataDir: () => getUserDataDir\n});\nmodule.exports = __toCommonJS(token_io_exports);\nvar import_path = __toESM(require(\"path\"));\nvar import_fs = __toESM(require(\"fs\"));\nvar import_os = __toESM(require(\"os\"));\nvar import_token_error = require(\"./token-error\");\nfunction findRootDir() {\n try {\n let dir = process.cwd();\n while (dir !== import_path.default.dirname(dir)) {\n const pkgPath = import_path.default.join(dir, \".vercel\");\n if (import_fs.default.existsSync(pkgPath)) {\n return dir;\n }\n dir = import_path.default.dirname(dir);\n }\n } catch (e) {\n throw new import_token_error.VercelOidcTokenError(\n \"Token refresh only supported in node server environments\"\n );\n }\n return null;\n}\nfunction getUserDataDir() {\n if (process.env.XDG_DATA_HOME) {\n return process.env.XDG_DATA_HOME;\n }\n switch (import_os.default.platform()) {\n case \"darwin\":\n return import_path.default.join(import_os.default.homedir(), \"Library/Application Support\");\n case \"linux\":\n return import_path.default.join(import_os.default.homedir(), \".local/share\");\n case \"win32\":\n if (process.env.LOCALAPPDATA) {\n return process.env.LOCALAPPDATA;\n }\n return null;\n default:\n return null;\n }\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n findRootDir,\n getUserDataDir\n});\n","\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar auth_config_exports = {};\n__export(auth_config_exports, {\n isValidAccessToken: () => isValidAccessToken,\n readAuthConfig: () => readAuthConfig,\n writeAuthConfig: () => writeAuthConfig\n});\nmodule.exports = __toCommonJS(auth_config_exports);\nvar fs = __toESM(require(\"fs\"));\nvar path = __toESM(require(\"path\"));\nvar import_token_util = require(\"./token-util\");\nfunction getAuthConfigPath() {\n const dataDir = (0, import_token_util.getVercelDataDir)();\n if (!dataDir) {\n throw new Error(\n `Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`\n );\n }\n return path.join(dataDir, \"auth.json\");\n}\nfunction readAuthConfig() {\n try {\n const authPath = getAuthConfigPath();\n if (!fs.existsSync(authPath)) {\n return null;\n }\n const content = fs.readFileSync(authPath, \"utf8\");\n if (!content) {\n return null;\n }\n return JSON.parse(content);\n } catch (error) {\n return null;\n }\n}\nfunction writeAuthConfig(config) {\n const authPath = getAuthConfigPath();\n const authDir = path.dirname(authPath);\n if (!fs.existsSync(authDir)) {\n fs.mkdirSync(authDir, { mode: 504, recursive: true });\n }\n fs.writeFileSync(authPath, JSON.stringify(config, null, 2), { mode: 384 });\n}\nfunction isValidAccessToken(authConfig) {\n if (!authConfig.token)\n return false;\n if (typeof authConfig.expiresAt !== \"number\")\n return true;\n const nowInSeconds = Math.floor(Date.now() / 1e3);\n return authConfig.expiresAt >= nowInSeconds;\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n isValidAccessToken,\n readAuthConfig,\n writeAuthConfig\n});\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar oauth_exports = {};\n__export(oauth_exports, {\n processTokenResponse: () => processTokenResponse,\n refreshTokenRequest: () => refreshTokenRequest\n});\nmodule.exports = __toCommonJS(oauth_exports);\nvar import_os = require(\"os\");\nconst VERCEL_ISSUER = \"https://vercel.com\";\nconst VERCEL_CLI_CLIENT_ID = \"cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp\";\nconst userAgent = `@vercel/oidc node-${process.version} ${(0, import_os.platform)()} (${(0, import_os.arch)()}) ${(0, import_os.hostname)()}`;\nlet _tokenEndpoint = null;\nasync function getTokenEndpoint() {\n if (_tokenEndpoint) {\n return _tokenEndpoint;\n }\n const discoveryUrl = `${VERCEL_ISSUER}/.well-known/openid-configuration`;\n const response = await fetch(discoveryUrl, {\n headers: { \"user-agent\": userAgent }\n });\n if (!response.ok) {\n throw new Error(\"Failed to discover OAuth endpoints\");\n }\n const metadata = await response.json();\n if (!metadata || typeof metadata.token_endpoint !== \"string\") {\n throw new Error(\"Invalid OAuth discovery response\");\n }\n const endpoint = metadata.token_endpoint;\n _tokenEndpoint = endpoint;\n return endpoint;\n}\nasync function refreshTokenRequest(options) {\n const tokenEndpoint = await getTokenEndpoint();\n return await fetch(tokenEndpoint, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n \"user-agent\": userAgent\n },\n body: new URLSearchParams({\n client_id: VERCEL_CLI_CLIENT_ID,\n grant_type: \"refresh_token\",\n ...options\n })\n });\n}\nasync function processTokenResponse(response) {\n const json = await response.json();\n if (!response.ok) {\n const errorMsg = typeof json === \"object\" && json && \"error\" in json ? String(json.error) : \"Token refresh failed\";\n return [new Error(errorMsg)];\n }\n if (typeof json !== \"object\" || json === null) {\n return [new Error(\"Invalid token response\")];\n }\n if (typeof json.access_token !== \"string\") {\n return [new Error(\"Missing access_token in response\")];\n }\n if (json.token_type !== \"Bearer\") {\n return [new Error(\"Invalid token_type in response\")];\n }\n if (typeof json.expires_in !== \"number\") {\n return [new Error(\"Missing expires_in in response\")];\n }\n return [null, json];\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n processTokenResponse,\n refreshTokenRequest\n});\n","\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar token_util_exports = {};\n__export(token_util_exports, {\n assertVercelOidcTokenResponse: () => assertVercelOidcTokenResponse,\n findProjectInfo: () => findProjectInfo,\n getTokenPayload: () => getTokenPayload,\n getVercelCliToken: () => getVercelCliToken,\n getVercelDataDir: () => getVercelDataDir,\n getVercelOidcToken: () => getVercelOidcToken,\n isExpired: () => isExpired,\n loadToken: () => loadToken,\n saveToken: () => saveToken\n});\nmodule.exports = __toCommonJS(token_util_exports);\nvar path = __toESM(require(\"path\"));\nvar fs = __toESM(require(\"fs\"));\nvar import_token_error = require(\"./token-error\");\nvar import_token_io = require(\"./token-io\");\nvar import_auth_config = require(\"./auth-config\");\nvar import_oauth = require(\"./oauth\");\nfunction getVercelDataDir() {\n const vercelFolder = \"com.vercel.cli\";\n const dataDir = (0, import_token_io.getUserDataDir)();\n if (!dataDir) {\n return null;\n }\n return path.join(dataDir, vercelFolder);\n}\nasync function getVercelCliToken() {\n const authConfig = (0, import_auth_config.readAuthConfig)();\n if (!authConfig) {\n return null;\n }\n if ((0, import_auth_config.isValidAccessToken)(authConfig)) {\n return authConfig.token || null;\n }\n if (!authConfig.refreshToken) {\n (0, import_auth_config.writeAuthConfig)({});\n return null;\n }\n try {\n const tokenResponse = await (0, import_oauth.refreshTokenRequest)({\n refresh_token: authConfig.refreshToken\n });\n const [tokensError, tokens] = await (0, import_oauth.processTokenResponse)(tokenResponse);\n if (tokensError || !tokens) {\n (0, import_auth_config.writeAuthConfig)({});\n return null;\n }\n const updatedConfig = {\n token: tokens.access_token,\n expiresAt: Math.floor(Date.now() / 1e3) + tokens.expires_in\n };\n if (tokens.refresh_token) {\n updatedConfig.refreshToken = tokens.refresh_token;\n }\n (0, import_auth_config.writeAuthConfig)(updatedConfig);\n return updatedConfig.token ?? null;\n } catch (error) {\n (0, import_auth_config.writeAuthConfig)({});\n return null;\n }\n}\nasync function getVercelOidcToken(authToken, projectId, teamId) {\n const url = `https://api.vercel.com/v1/projects/${projectId}/token?source=vercel-oidc-refresh${teamId ? `&teamId=${teamId}` : \"\"}`;\n const res = await fetch(url, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${authToken}`\n }\n });\n if (!res.ok) {\n throw new import_token_error.VercelOidcTokenError(\n `Failed to refresh OIDC token: ${res.statusText}`\n );\n }\n const tokenRes = await res.json();\n assertVercelOidcTokenResponse(tokenRes);\n return tokenRes;\n}\nfunction assertVercelOidcTokenResponse(res) {\n if (!res || typeof res !== \"object\") {\n throw new TypeError(\n \"Vercel OIDC token is malformed. Expected an object. Please run `vc env pull` and try again\"\n );\n }\n if (!(\"token\" in res) || typeof res.token !== \"string\") {\n throw new TypeError(\n \"Vercel OIDC token is malformed. Expected a string-valued token property. Please run `vc env pull` and try again\"\n );\n }\n}\nfunction findProjectInfo() {\n const dir = (0, import_token_io.findRootDir)();\n if (!dir) {\n throw new import_token_error.VercelOidcTokenError(\n \"Unable to find project root directory. Have you linked your project with `vc link?`\"\n );\n }\n const prjPath = path.join(dir, \".vercel\", \"project.json\");\n if (!fs.existsSync(prjPath)) {\n throw new import_token_error.VercelOidcTokenError(\n \"project.json not found, have you linked your project with `vc link?`\"\n );\n }\n const prj = JSON.parse(fs.readFileSync(prjPath, \"utf8\"));\n if (typeof prj.projectId !== \"string\" && typeof prj.orgId !== \"string\") {\n throw new TypeError(\n \"Expected a string-valued projectId property. Try running `vc link` to re-link your project.\"\n );\n }\n return { projectId: prj.projectId, teamId: prj.orgId };\n}\nfunction saveToken(token, projectId) {\n const dir = (0, import_token_io.getUserDataDir)();\n if (!dir) {\n throw new import_token_error.VercelOidcTokenError(\n \"Unable to find user data directory. Please reach out to Vercel support.\"\n );\n }\n const tokenPath = path.join(dir, \"com.vercel.token\", `${projectId}.json`);\n const tokenJson = JSON.stringify(token);\n fs.mkdirSync(path.dirname(tokenPath), { mode: 504, recursive: true });\n fs.writeFileSync(tokenPath, tokenJson);\n fs.chmodSync(tokenPath, 432);\n return;\n}\nfunction loadToken(projectId) {\n const dir = (0, import_token_io.getUserDataDir)();\n if (!dir) {\n throw new import_token_error.VercelOidcTokenError(\n \"Unable to find user data directory. Please reach out to Vercel support.\"\n );\n }\n const tokenPath = path.join(dir, \"com.vercel.token\", `${projectId}.json`);\n if (!fs.existsSync(tokenPath)) {\n return null;\n }\n const token = JSON.parse(fs.readFileSync(tokenPath, \"utf8\"));\n assertVercelOidcTokenResponse(token);\n return token;\n}\nfunction getTokenPayload(token) {\n const tokenParts = token.split(\".\");\n if (tokenParts.length !== 3) {\n throw new import_token_error.VercelOidcTokenError(\n \"Invalid token. Please run `vc env pull` and try again\"\n );\n }\n const base64 = tokenParts[1].replace(/-/g, \"+\").replace(/_/g, \"/\");\n const padded = base64.padEnd(\n base64.length + (4 - base64.length % 4) % 4,\n \"=\"\n );\n return JSON.parse(Buffer.from(padded, \"base64\").toString(\"utf8\"));\n}\nfunction isExpired(token) {\n return token.exp * 1e3 < Date.now();\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n assertVercelOidcTokenResponse,\n findProjectInfo,\n getTokenPayload,\n getVercelCliToken,\n getVercelDataDir,\n getVercelOidcToken,\n isExpired,\n loadToken,\n saveToken\n});\n"],"x_google_ignoreList":[0,1,2,3],"mappings":";;;;;CACA,IAAIA,aAAW,OAAO;CACtB,IAAIC,cAAY,OAAO;CACvB,IAAIC,qBAAmB,OAAO;CAC9B,IAAIC,sBAAoB,OAAO;CAC/B,IAAIC,iBAAe,OAAO;CAC1B,IAAIC,iBAAe,OAAO,UAAU;CACpC,IAAIC,aAAW,CAAC,QAAQ,QAAQ;AAC9B,OAAK,IAAI,QAAQ,IACf,aAAU,QAAQ,MAAM;GAAE,KAAK,IAAI;GAAO,YAAY;EAAM,EAAC;CAChE;CACD,IAAIC,gBAAc,CAAC,IAAI,MAAM,QAAQ,SAAS;AAC5C,MAAI,eAAe,SAAS,mBAAmB,SAAS,YACtD;QAAK,IAAI,OAAO,oBAAkB,KAAK,CACrC,MAAK,eAAa,KAAK,IAAI,IA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,MAAM,KAAK,KAAK;CACpC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { __commonJS, __require
|
|
1
|
+
import { __commonJS, __require } from "./chunk-CunrlGP7.js";
|
|
2
|
+
import { require_token_error } from "./token-error-CBmJNKLY.js";
|
|
2
3
|
|
|
3
4
|
//#region ../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token-io.js
|
|
4
5
|
var require_token_io = __commonJS({ "../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token-io.js"(exports, module) {
|
|
@@ -354,4 +355,4 @@ var require_token_util = __commonJS({ "../../node_modules/.pnpm/@vercel+oidc@3.1
|
|
|
354
355
|
|
|
355
356
|
//#endregion
|
|
356
357
|
export { require_token_util };
|
|
357
|
-
//# sourceMappingURL=token-util-
|
|
358
|
+
//# sourceMappingURL=token-util-batRsXGA.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-util-Dnkz6ExF.js","names":["__create","__defProp","__getOwnPropDesc","__getOwnPropNames","__getProtoOf","__hasOwnProp","__export","__copyProps","__toESM","__toCommonJS","import_os","import_token_error","__create","__defProp","__getOwnPropDesc","__getOwnPropNames","__getProtoOf","__hasOwnProp","__export","__copyProps","__toESM","__toCommonJS","fs","path","__defProp","__getOwnPropDesc","__getOwnPropNames","__hasOwnProp","__export","__copyProps","__toCommonJS"],"sources":["../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token-io.js","../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/auth-config.js","../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/oauth.js","../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token-util.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar token_io_exports = {};\n__export(token_io_exports, {\n findRootDir: () => findRootDir,\n getUserDataDir: () => getUserDataDir\n});\nmodule.exports = __toCommonJS(token_io_exports);\nvar import_path = __toESM(require(\"path\"));\nvar import_fs = __toESM(require(\"fs\"));\nvar import_os = __toESM(require(\"os\"));\nvar import_token_error = require(\"./token-error\");\nfunction findRootDir() {\n try {\n let dir = process.cwd();\n while (dir !== import_path.default.dirname(dir)) {\n const pkgPath = import_path.default.join(dir, \".vercel\");\n if (import_fs.default.existsSync(pkgPath)) {\n return dir;\n }\n dir = import_path.default.dirname(dir);\n }\n } catch (e) {\n throw new import_token_error.VercelOidcTokenError(\n \"Token refresh only supported in node server environments\"\n );\n }\n return null;\n}\nfunction getUserDataDir() {\n if (process.env.XDG_DATA_HOME) {\n return process.env.XDG_DATA_HOME;\n }\n switch (import_os.default.platform()) {\n case \"darwin\":\n return import_path.default.join(import_os.default.homedir(), \"Library/Application Support\");\n case \"linux\":\n return import_path.default.join(import_os.default.homedir(), \".local/share\");\n case \"win32\":\n if (process.env.LOCALAPPDATA) {\n return process.env.LOCALAPPDATA;\n }\n return null;\n default:\n return null;\n }\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n findRootDir,\n getUserDataDir\n});\n","\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar auth_config_exports = {};\n__export(auth_config_exports, {\n isValidAccessToken: () => isValidAccessToken,\n readAuthConfig: () => readAuthConfig,\n writeAuthConfig: () => writeAuthConfig\n});\nmodule.exports = __toCommonJS(auth_config_exports);\nvar fs = __toESM(require(\"fs\"));\nvar path = __toESM(require(\"path\"));\nvar import_token_util = require(\"./token-util\");\nfunction getAuthConfigPath() {\n const dataDir = (0, import_token_util.getVercelDataDir)();\n if (!dataDir) {\n throw new Error(\n `Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`\n );\n }\n return path.join(dataDir, \"auth.json\");\n}\nfunction readAuthConfig() {\n try {\n const authPath = getAuthConfigPath();\n if (!fs.existsSync(authPath)) {\n return null;\n }\n const content = fs.readFileSync(authPath, \"utf8\");\n if (!content) {\n return null;\n }\n return JSON.parse(content);\n } catch (error) {\n return null;\n }\n}\nfunction writeAuthConfig(config) {\n const authPath = getAuthConfigPath();\n const authDir = path.dirname(authPath);\n if (!fs.existsSync(authDir)) {\n fs.mkdirSync(authDir, { mode: 504, recursive: true });\n }\n fs.writeFileSync(authPath, JSON.stringify(config, null, 2), { mode: 384 });\n}\nfunction isValidAccessToken(authConfig) {\n if (!authConfig.token)\n return false;\n if (typeof authConfig.expiresAt !== \"number\")\n return true;\n const nowInSeconds = Math.floor(Date.now() / 1e3);\n return authConfig.expiresAt >= nowInSeconds;\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n isValidAccessToken,\n readAuthConfig,\n writeAuthConfig\n});\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar oauth_exports = {};\n__export(oauth_exports, {\n processTokenResponse: () => processTokenResponse,\n refreshTokenRequest: () => refreshTokenRequest\n});\nmodule.exports = __toCommonJS(oauth_exports);\nvar import_os = require(\"os\");\nconst VERCEL_ISSUER = \"https://vercel.com\";\nconst VERCEL_CLI_CLIENT_ID = \"cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp\";\nconst userAgent = `@vercel/oidc node-${process.version} ${(0, import_os.platform)()} (${(0, import_os.arch)()}) ${(0, import_os.hostname)()}`;\nlet _tokenEndpoint = null;\nasync function getTokenEndpoint() {\n if (_tokenEndpoint) {\n return _tokenEndpoint;\n }\n const discoveryUrl = `${VERCEL_ISSUER}/.well-known/openid-configuration`;\n const response = await fetch(discoveryUrl, {\n headers: { \"user-agent\": userAgent }\n });\n if (!response.ok) {\n throw new Error(\"Failed to discover OAuth endpoints\");\n }\n const metadata = await response.json();\n if (!metadata || typeof metadata.token_endpoint !== \"string\") {\n throw new Error(\"Invalid OAuth discovery response\");\n }\n const endpoint = metadata.token_endpoint;\n _tokenEndpoint = endpoint;\n return endpoint;\n}\nasync function refreshTokenRequest(options) {\n const tokenEndpoint = await getTokenEndpoint();\n return await fetch(tokenEndpoint, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n \"user-agent\": userAgent\n },\n body: new URLSearchParams({\n client_id: VERCEL_CLI_CLIENT_ID,\n grant_type: \"refresh_token\",\n ...options\n })\n });\n}\nasync function processTokenResponse(response) {\n const json = await response.json();\n if (!response.ok) {\n const errorMsg = typeof json === \"object\" && json && \"error\" in json ? String(json.error) : \"Token refresh failed\";\n return [new Error(errorMsg)];\n }\n if (typeof json !== \"object\" || json === null) {\n return [new Error(\"Invalid token response\")];\n }\n if (typeof json.access_token !== \"string\") {\n return [new Error(\"Missing access_token in response\")];\n }\n if (json.token_type !== \"Bearer\") {\n return [new Error(\"Invalid token_type in response\")];\n }\n if (typeof json.expires_in !== \"number\") {\n return [new Error(\"Missing expires_in in response\")];\n }\n return [null, json];\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n processTokenResponse,\n refreshTokenRequest\n});\n","\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar token_util_exports = {};\n__export(token_util_exports, {\n assertVercelOidcTokenResponse: () => assertVercelOidcTokenResponse,\n findProjectInfo: () => findProjectInfo,\n getTokenPayload: () => getTokenPayload,\n getVercelCliToken: () => getVercelCliToken,\n getVercelDataDir: () => getVercelDataDir,\n getVercelOidcToken: () => getVercelOidcToken,\n isExpired: () => isExpired,\n loadToken: () => loadToken,\n saveToken: () => saveToken\n});\nmodule.exports = __toCommonJS(token_util_exports);\nvar path = __toESM(require(\"path\"));\nvar fs = __toESM(require(\"fs\"));\nvar import_token_error = require(\"./token-error\");\nvar import_token_io = require(\"./token-io\");\nvar import_auth_config = require(\"./auth-config\");\nvar import_oauth = require(\"./oauth\");\nfunction getVercelDataDir() {\n const vercelFolder = \"com.vercel.cli\";\n const dataDir = (0, import_token_io.getUserDataDir)();\n if (!dataDir) {\n return null;\n }\n return path.join(dataDir, vercelFolder);\n}\nasync function getVercelCliToken() {\n const authConfig = (0, import_auth_config.readAuthConfig)();\n if (!authConfig) {\n return null;\n }\n if ((0, import_auth_config.isValidAccessToken)(authConfig)) {\n return authConfig.token || null;\n }\n if (!authConfig.refreshToken) {\n (0, import_auth_config.writeAuthConfig)({});\n return null;\n }\n try {\n const tokenResponse = await (0, import_oauth.refreshTokenRequest)({\n refresh_token: authConfig.refreshToken\n });\n const [tokensError, tokens] = await (0, import_oauth.processTokenResponse)(tokenResponse);\n if (tokensError || !tokens) {\n (0, import_auth_config.writeAuthConfig)({});\n return null;\n }\n const updatedConfig = {\n token: tokens.access_token,\n expiresAt: Math.floor(Date.now() / 1e3) + tokens.expires_in\n };\n if (tokens.refresh_token) {\n updatedConfig.refreshToken = tokens.refresh_token;\n }\n (0, import_auth_config.writeAuthConfig)(updatedConfig);\n return updatedConfig.token ?? null;\n } catch (error) {\n (0, import_auth_config.writeAuthConfig)({});\n return null;\n }\n}\nasync function getVercelOidcToken(authToken, projectId, teamId) {\n const url = `https://api.vercel.com/v1/projects/${projectId}/token?source=vercel-oidc-refresh${teamId ? `&teamId=${teamId}` : \"\"}`;\n const res = await fetch(url, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${authToken}`\n }\n });\n if (!res.ok) {\n throw new import_token_error.VercelOidcTokenError(\n `Failed to refresh OIDC token: ${res.statusText}`\n );\n }\n const tokenRes = await res.json();\n assertVercelOidcTokenResponse(tokenRes);\n return tokenRes;\n}\nfunction assertVercelOidcTokenResponse(res) {\n if (!res || typeof res !== \"object\") {\n throw new TypeError(\n \"Vercel OIDC token is malformed. Expected an object. Please run `vc env pull` and try again\"\n );\n }\n if (!(\"token\" in res) || typeof res.token !== \"string\") {\n throw new TypeError(\n \"Vercel OIDC token is malformed. Expected a string-valued token property. Please run `vc env pull` and try again\"\n );\n }\n}\nfunction findProjectInfo() {\n const dir = (0, import_token_io.findRootDir)();\n if (!dir) {\n throw new import_token_error.VercelOidcTokenError(\n \"Unable to find project root directory. Have you linked your project with `vc link?`\"\n );\n }\n const prjPath = path.join(dir, \".vercel\", \"project.json\");\n if (!fs.existsSync(prjPath)) {\n throw new import_token_error.VercelOidcTokenError(\n \"project.json not found, have you linked your project with `vc link?`\"\n );\n }\n const prj = JSON.parse(fs.readFileSync(prjPath, \"utf8\"));\n if (typeof prj.projectId !== \"string\" && typeof prj.orgId !== \"string\") {\n throw new TypeError(\n \"Expected a string-valued projectId property. Try running `vc link` to re-link your project.\"\n );\n }\n return { projectId: prj.projectId, teamId: prj.orgId };\n}\nfunction saveToken(token, projectId) {\n const dir = (0, import_token_io.getUserDataDir)();\n if (!dir) {\n throw new import_token_error.VercelOidcTokenError(\n \"Unable to find user data directory. Please reach out to Vercel support.\"\n );\n }\n const tokenPath = path.join(dir, \"com.vercel.token\", `${projectId}.json`);\n const tokenJson = JSON.stringify(token);\n fs.mkdirSync(path.dirname(tokenPath), { mode: 504, recursive: true });\n fs.writeFileSync(tokenPath, tokenJson);\n fs.chmodSync(tokenPath, 432);\n return;\n}\nfunction loadToken(projectId) {\n const dir = (0, import_token_io.getUserDataDir)();\n if (!dir) {\n throw new import_token_error.VercelOidcTokenError(\n \"Unable to find user data directory. Please reach out to Vercel support.\"\n );\n }\n const tokenPath = path.join(dir, \"com.vercel.token\", `${projectId}.json`);\n if (!fs.existsSync(tokenPath)) {\n return null;\n }\n const token = JSON.parse(fs.readFileSync(tokenPath, \"utf8\"));\n assertVercelOidcTokenResponse(token);\n return token;\n}\nfunction getTokenPayload(token) {\n const tokenParts = token.split(\".\");\n if (tokenParts.length !== 3) {\n throw new import_token_error.VercelOidcTokenError(\n \"Invalid token. Please run `vc env pull` and try again\"\n );\n }\n const base64 = tokenParts[1].replace(/-/g, \"+\").replace(/_/g, \"/\");\n const padded = base64.padEnd(\n base64.length + (4 - base64.length % 4) % 4,\n \"=\"\n );\n return JSON.parse(Buffer.from(padded, \"base64\").toString(\"utf8\"));\n}\nfunction isExpired(token) {\n return token.exp * 1e3 < Date.now();\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n assertVercelOidcTokenResponse,\n findProjectInfo,\n getTokenPayload,\n getVercelCliToken,\n getVercelDataDir,\n getVercelOidcToken,\n isExpired,\n loadToken,\n saveToken\n});\n"],"x_google_ignoreList":[0,1,2,3],"mappings":";;;;CACA,IAAIA,aAAW,OAAO;CACtB,IAAIC,cAAY,OAAO;CACvB,IAAIC,qBAAmB,OAAO;CAC9B,IAAIC,sBAAoB,OAAO;CAC/B,IAAIC,iBAAe,OAAO;CAC1B,IAAIC,iBAAe,OAAO,UAAU;CACpC,IAAIC,aAAW,CAAC,QAAQ,QAAQ;AAC9B,OAAK,IAAI,QAAQ,IACf,aAAU,QAAQ,MAAM;GAAE,KAAK,IAAI;GAAO,YAAY;EAAM,EAAC;CAChE;CACD,IAAIC,gBAAc,CAAC,IAAI,MAAM,QAAQ,SAAS;AAC5C,MAAI,eAAe,SAAS,mBAAmB,SAAS,YACtD;QAAK,IAAI,OAAO,oBAAkB,KAAK,CACrC,MAAK,eAAa,KAAK,IAAI,IAAI,IAAI,QAAQ,OACzC,aAAU,IAAI,KAAK;IAAE,KAAK,MAAM,KAAK;IAAM,cAAc,OAAO,mBAAiB,MAAM,IAAI,KAAK,KAAK;GAAY,EAAC;EAAC;AAEzH,SAAO;CACR;CACD,IAAIC,YAAU,CAAC,KAAK,YAAY,YAAY,SAAS,OAAO,OAAO,WAAS,eAAa,IAAI,CAAC,GAAG,CAAE,GAAE,cAKnG,eAAe,QAAQ,IAAI,aAAa,YAAU,QAAQ,WAAW;EAAE,OAAO;EAAK,YAAY;CAAM,EAAC,GAAG,QACzG,IACD;CACD,IAAIC,iBAAe,CAAC,QAAQ,cAAY,YAAU,CAAE,GAAE,cAAc,EAAE,OAAO,KAAM,EAAC,EAAE,IAAI;CAC1F,IA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,UAAU;AACtC,KAAG,UAAU,WAAW,IAAI;AAC5B;CACD;CACD,SAAS,UAAU,WAAW;EAC5B,MAAM,MAAM,CAAC,GAAG,gBAAgB,iBAAiB;AACjD,OAAK,IACH,OAAM,IAAI,mBAAmB,qBAC3B;EAGJ,MAAM,YAAY,KAAK,KAAK,KAAK,uBAAuB,UAAU,OAAO;AACzE,OAAK,GAAG,WAAW,UAAU,CAC3B,QAAO;EAET,MAAM,QAAQ,KAAK,MAAM,GAAG,aAAa,WAAW,OAAO,CAAC;AAC5D,gCAA8B,MAAM;AACpC,SAAO;CACR;CACD,SAAS,gBAAgB,OAAO;EAC9B,MAAM,aAAa,MAAM,MAAM,IAAI;AACnC,MAAI,WAAW,WAAW,EACxB,OAAM,IAAI,mBAAmB,qBAC3B;EAGJ,MAAM,SAAS,WAAW,GAAG,QAAQ,MAAM,IAAI,CAAC,QAAQ,MAAM,IAAI;EAClE,MAAM,SAAS,OAAO,OACpB,OAAO,UAAU,IAAI,OAAO,SAAS,KAAK,GAC1C,IACD;AACD,SAAO,KAAK,MAAM,OAAO,KAAK,QAAQ,SAAS,CAAC,SAAS,OAAO,CAAC;CAClE;CACD,SAAS,UAAU,OAAO;AACxB,SAAO,MAAM,MAAM,MAAM,KAAK,KAAK;CACpC"}
|
|
1
|
+
{"version":3,"file":"token-util-batRsXGA.js","names":["__create","__defProp","__getOwnPropDesc","__getOwnPropNames","__getProtoOf","__hasOwnProp","__export","__copyProps","__toESM","__toCommonJS","import_os","import_token_error","__create","__defProp","__getOwnPropDesc","__getOwnPropNames","__getProtoOf","__hasOwnProp","__export","__copyProps","__toESM","__toCommonJS","fs","path","__defProp","__getOwnPropDesc","__getOwnPropNames","__hasOwnProp","__export","__copyProps","__toCommonJS"],"sources":["../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token-io.js","../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/auth-config.js","../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/oauth.js","../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token-util.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar token_io_exports = {};\n__export(token_io_exports, {\n findRootDir: () => findRootDir,\n getUserDataDir: () => getUserDataDir\n});\nmodule.exports = __toCommonJS(token_io_exports);\nvar import_path = __toESM(require(\"path\"));\nvar import_fs = __toESM(require(\"fs\"));\nvar import_os = __toESM(require(\"os\"));\nvar import_token_error = require(\"./token-error\");\nfunction findRootDir() {\n try {\n let dir = process.cwd();\n while (dir !== import_path.default.dirname(dir)) {\n const pkgPath = import_path.default.join(dir, \".vercel\");\n if (import_fs.default.existsSync(pkgPath)) {\n return dir;\n }\n dir = import_path.default.dirname(dir);\n }\n } catch (e) {\n throw new import_token_error.VercelOidcTokenError(\n \"Token refresh only supported in node server environments\"\n );\n }\n return null;\n}\nfunction getUserDataDir() {\n if (process.env.XDG_DATA_HOME) {\n return process.env.XDG_DATA_HOME;\n }\n switch (import_os.default.platform()) {\n case \"darwin\":\n return import_path.default.join(import_os.default.homedir(), \"Library/Application Support\");\n case \"linux\":\n return import_path.default.join(import_os.default.homedir(), \".local/share\");\n case \"win32\":\n if (process.env.LOCALAPPDATA) {\n return process.env.LOCALAPPDATA;\n }\n return null;\n default:\n return null;\n }\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n findRootDir,\n getUserDataDir\n});\n","\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar auth_config_exports = {};\n__export(auth_config_exports, {\n isValidAccessToken: () => isValidAccessToken,\n readAuthConfig: () => readAuthConfig,\n writeAuthConfig: () => writeAuthConfig\n});\nmodule.exports = __toCommonJS(auth_config_exports);\nvar fs = __toESM(require(\"fs\"));\nvar path = __toESM(require(\"path\"));\nvar import_token_util = require(\"./token-util\");\nfunction getAuthConfigPath() {\n const dataDir = (0, import_token_util.getVercelDataDir)();\n if (!dataDir) {\n throw new Error(\n `Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`\n );\n }\n return path.join(dataDir, \"auth.json\");\n}\nfunction readAuthConfig() {\n try {\n const authPath = getAuthConfigPath();\n if (!fs.existsSync(authPath)) {\n return null;\n }\n const content = fs.readFileSync(authPath, \"utf8\");\n if (!content) {\n return null;\n }\n return JSON.parse(content);\n } catch (error) {\n return null;\n }\n}\nfunction writeAuthConfig(config) {\n const authPath = getAuthConfigPath();\n const authDir = path.dirname(authPath);\n if (!fs.existsSync(authDir)) {\n fs.mkdirSync(authDir, { mode: 504, recursive: true });\n }\n fs.writeFileSync(authPath, JSON.stringify(config, null, 2), { mode: 384 });\n}\nfunction isValidAccessToken(authConfig) {\n if (!authConfig.token)\n return false;\n if (typeof authConfig.expiresAt !== \"number\")\n return true;\n const nowInSeconds = Math.floor(Date.now() / 1e3);\n return authConfig.expiresAt >= nowInSeconds;\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n isValidAccessToken,\n readAuthConfig,\n writeAuthConfig\n});\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar oauth_exports = {};\n__export(oauth_exports, {\n processTokenResponse: () => processTokenResponse,\n refreshTokenRequest: () => refreshTokenRequest\n});\nmodule.exports = __toCommonJS(oauth_exports);\nvar import_os = require(\"os\");\nconst VERCEL_ISSUER = \"https://vercel.com\";\nconst VERCEL_CLI_CLIENT_ID = \"cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp\";\nconst userAgent = `@vercel/oidc node-${process.version} ${(0, import_os.platform)()} (${(0, import_os.arch)()}) ${(0, import_os.hostname)()}`;\nlet _tokenEndpoint = null;\nasync function getTokenEndpoint() {\n if (_tokenEndpoint) {\n return _tokenEndpoint;\n }\n const discoveryUrl = `${VERCEL_ISSUER}/.well-known/openid-configuration`;\n const response = await fetch(discoveryUrl, {\n headers: { \"user-agent\": userAgent }\n });\n if (!response.ok) {\n throw new Error(\"Failed to discover OAuth endpoints\");\n }\n const metadata = await response.json();\n if (!metadata || typeof metadata.token_endpoint !== \"string\") {\n throw new Error(\"Invalid OAuth discovery response\");\n }\n const endpoint = metadata.token_endpoint;\n _tokenEndpoint = endpoint;\n return endpoint;\n}\nasync function refreshTokenRequest(options) {\n const tokenEndpoint = await getTokenEndpoint();\n return await fetch(tokenEndpoint, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n \"user-agent\": userAgent\n },\n body: new URLSearchParams({\n client_id: VERCEL_CLI_CLIENT_ID,\n grant_type: \"refresh_token\",\n ...options\n })\n });\n}\nasync function processTokenResponse(response) {\n const json = await response.json();\n if (!response.ok) {\n const errorMsg = typeof json === \"object\" && json && \"error\" in json ? String(json.error) : \"Token refresh failed\";\n return [new Error(errorMsg)];\n }\n if (typeof json !== \"object\" || json === null) {\n return [new Error(\"Invalid token response\")];\n }\n if (typeof json.access_token !== \"string\") {\n return [new Error(\"Missing access_token in response\")];\n }\n if (json.token_type !== \"Bearer\") {\n return [new Error(\"Invalid token_type in response\")];\n }\n if (typeof json.expires_in !== \"number\") {\n return [new Error(\"Missing expires_in in response\")];\n }\n return [null, json];\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n processTokenResponse,\n refreshTokenRequest\n});\n","\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar token_util_exports = {};\n__export(token_util_exports, {\n assertVercelOidcTokenResponse: () => assertVercelOidcTokenResponse,\n findProjectInfo: () => findProjectInfo,\n getTokenPayload: () => getTokenPayload,\n getVercelCliToken: () => getVercelCliToken,\n getVercelDataDir: () => getVercelDataDir,\n getVercelOidcToken: () => getVercelOidcToken,\n isExpired: () => isExpired,\n loadToken: () => loadToken,\n saveToken: () => saveToken\n});\nmodule.exports = __toCommonJS(token_util_exports);\nvar path = __toESM(require(\"path\"));\nvar fs = __toESM(require(\"fs\"));\nvar import_token_error = require(\"./token-error\");\nvar import_token_io = require(\"./token-io\");\nvar import_auth_config = require(\"./auth-config\");\nvar import_oauth = require(\"./oauth\");\nfunction getVercelDataDir() {\n const vercelFolder = \"com.vercel.cli\";\n const dataDir = (0, import_token_io.getUserDataDir)();\n if (!dataDir) {\n return null;\n }\n return path.join(dataDir, vercelFolder);\n}\nasync function getVercelCliToken() {\n const authConfig = (0, import_auth_config.readAuthConfig)();\n if (!authConfig) {\n return null;\n }\n if ((0, import_auth_config.isValidAccessToken)(authConfig)) {\n return authConfig.token || null;\n }\n if (!authConfig.refreshToken) {\n (0, import_auth_config.writeAuthConfig)({});\n return null;\n }\n try {\n const tokenResponse = await (0, import_oauth.refreshTokenRequest)({\n refresh_token: authConfig.refreshToken\n });\n const [tokensError, tokens] = await (0, import_oauth.processTokenResponse)(tokenResponse);\n if (tokensError || !tokens) {\n (0, import_auth_config.writeAuthConfig)({});\n return null;\n }\n const updatedConfig = {\n token: tokens.access_token,\n expiresAt: Math.floor(Date.now() / 1e3) + tokens.expires_in\n };\n if (tokens.refresh_token) {\n updatedConfig.refreshToken = tokens.refresh_token;\n }\n (0, import_auth_config.writeAuthConfig)(updatedConfig);\n return updatedConfig.token ?? null;\n } catch (error) {\n (0, import_auth_config.writeAuthConfig)({});\n return null;\n }\n}\nasync function getVercelOidcToken(authToken, projectId, teamId) {\n const url = `https://api.vercel.com/v1/projects/${projectId}/token?source=vercel-oidc-refresh${teamId ? `&teamId=${teamId}` : \"\"}`;\n const res = await fetch(url, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${authToken}`\n }\n });\n if (!res.ok) {\n throw new import_token_error.VercelOidcTokenError(\n `Failed to refresh OIDC token: ${res.statusText}`\n );\n }\n const tokenRes = await res.json();\n assertVercelOidcTokenResponse(tokenRes);\n return tokenRes;\n}\nfunction assertVercelOidcTokenResponse(res) {\n if (!res || typeof res !== \"object\") {\n throw new TypeError(\n \"Vercel OIDC token is malformed. Expected an object. Please run `vc env pull` and try again\"\n );\n }\n if (!(\"token\" in res) || typeof res.token !== \"string\") {\n throw new TypeError(\n \"Vercel OIDC token is malformed. Expected a string-valued token property. Please run `vc env pull` and try again\"\n );\n }\n}\nfunction findProjectInfo() {\n const dir = (0, import_token_io.findRootDir)();\n if (!dir) {\n throw new import_token_error.VercelOidcTokenError(\n \"Unable to find project root directory. Have you linked your project with `vc link?`\"\n );\n }\n const prjPath = path.join(dir, \".vercel\", \"project.json\");\n if (!fs.existsSync(prjPath)) {\n throw new import_token_error.VercelOidcTokenError(\n \"project.json not found, have you linked your project with `vc link?`\"\n );\n }\n const prj = JSON.parse(fs.readFileSync(prjPath, \"utf8\"));\n if (typeof prj.projectId !== \"string\" && typeof prj.orgId !== \"string\") {\n throw new TypeError(\n \"Expected a string-valued projectId property. Try running `vc link` to re-link your project.\"\n );\n }\n return { projectId: prj.projectId, teamId: prj.orgId };\n}\nfunction saveToken(token, projectId) {\n const dir = (0, import_token_io.getUserDataDir)();\n if (!dir) {\n throw new import_token_error.VercelOidcTokenError(\n \"Unable to find user data directory. Please reach out to Vercel support.\"\n );\n }\n const tokenPath = path.join(dir, \"com.vercel.token\", `${projectId}.json`);\n const tokenJson = JSON.stringify(token);\n fs.mkdirSync(path.dirname(tokenPath), { mode: 504, recursive: true });\n fs.writeFileSync(tokenPath, tokenJson);\n fs.chmodSync(tokenPath, 432);\n return;\n}\nfunction loadToken(projectId) {\n const dir = (0, import_token_io.getUserDataDir)();\n if (!dir) {\n throw new import_token_error.VercelOidcTokenError(\n \"Unable to find user data directory. Please reach out to Vercel support.\"\n );\n }\n const tokenPath = path.join(dir, \"com.vercel.token\", `${projectId}.json`);\n if (!fs.existsSync(tokenPath)) {\n return null;\n }\n const token = JSON.parse(fs.readFileSync(tokenPath, \"utf8\"));\n assertVercelOidcTokenResponse(token);\n return token;\n}\nfunction getTokenPayload(token) {\n const tokenParts = token.split(\".\");\n if (tokenParts.length !== 3) {\n throw new import_token_error.VercelOidcTokenError(\n \"Invalid token. Please run `vc env pull` and try again\"\n );\n }\n const base64 = tokenParts[1].replace(/-/g, \"+\").replace(/_/g, \"/\");\n const padded = base64.padEnd(\n base64.length + (4 - base64.length % 4) % 4,\n \"=\"\n );\n return JSON.parse(Buffer.from(padded, \"base64\").toString(\"utf8\"));\n}\nfunction isExpired(token) {\n return token.exp * 1e3 < Date.now();\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n assertVercelOidcTokenResponse,\n findProjectInfo,\n getTokenPayload,\n getVercelCliToken,\n getVercelDataDir,\n getVercelOidcToken,\n isExpired,\n loadToken,\n saveToken\n});\n"],"x_google_ignoreList":[0,1,2,3],"mappings":";;;;;CACA,IAAIA,aAAW,OAAO;CACtB,IAAIC,cAAY,OAAO;CACvB,IAAIC,qBAAmB,OAAO;CAC9B,IAAIC,sBAAoB,OAAO;CAC/B,IAAIC,iBAAe,OAAO;CAC1B,IAAIC,iBAAe,OAAO,UAAU;CACpC,IAAIC,aAAW,CAAC,QAAQ,QAAQ;AAC9B,OAAK,IAAI,QAAQ,IACf,aAAU,QAAQ,MAAM;GAAE,KAAK,IAAI;GAAO,YAAY;EAAM,EAAC;CAChE;CACD,IAAIC,gBAAc,CAAC,IAAI,MAAM,QAAQ,SAAS;AAC5C,MAAI,eAAe,SAAS,mBAAmB,SAAS,YACtD;QAAK,IAAI,OAAO,oBAAkB,KAAK,CACrC,MAAK,eAAa,KAAK,IAAI,IAAI,IAAI,QAAQ,OACzC,aAAU,IAAI,KAAK;IAAE,KAAK,MAAM,KAAK;IAAM,cAAc,OAAO,mBAAiB,MAAM,IAAI,KAAK,KAAK;GAAY,EAAC;EAAC;AAEzH,SAAO;CACR;CACD,IAAIC,YAAU,CAAC,KAAK,YAAY,YAAY,SAAS,OAAO,OAAO,WAAS,eAAa,IAAI,CAAC,GAAG,CAAE,GAAE,cAKnG,eAA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AC3B;EAGJ,MAAM,YAAY,KAAK,KAAK,KAAK,uBAAuB,UAAU,OAAO;EACzE,MAAM,YAAY,KAAK,UAAU,MAAM;AACvC,KAAG,UAAU,KAAK,QAAQ,UAAU,EAAE;GAAE,MAAM;GAAK,WAAW;EAAM,EAAC;AACrE,KAAG,cAAc,WAAW,UAAU;AACtC,KAAG,UAAU,WAAW,IAAI;AAC5B;CACD;CACD,SAAS,UAAU,WAAW;EAC5B,MAAM,MAAM,CAAC,GAAG,gBAAgB,iBAAiB;AACjD,OAAK,IACH,OAAM,IAAI,mBAAmB,qBAC3B;EAGJ,MAAM,YAAY,KAAK,KAAK,KAAK,uBAAuB,UAAU,OAAO;AACzE,OAAK,GAAG,WAAW,UAAU,CAC3B,QAAO;EAET,MAAM,QAAQ,KAAK,MAAM,GAAG,aAAa,WAAW,OAAO,CAAC;AAC5D,gCAA8B,MAAM;AACpC,SAAO;CACR;CACD,SAAS,gBAAgB,OAAO;EAC9B,MAAM,aAAa,MAAM,MAAM,IAAI;AACnC,MAAI,WAAW,WAAW,EACxB,OAAM,IAAI,mBAAmB,qBAC3B;EAGJ,MAAM,SAAS,WAAW,GAAG,QAAQ,MAAM,IAAI,CAAC,QAAQ,MAAM,IAAI;EAClE,MAAM,SAAS,OAAO,OACpB,OAAO,UAAU,IAAI,OAAO,SAAS,KAAK,GAC1C,IACD;AACD,SAAO,KAAK,MAAM,OAAO,KAAK,QAAQ,SAAS,CAAC,SAAS,OAAO,CAAC;CAClE;CACD,SAAS,UAAU,OAAO;AACxB,SAAO,MAAM,MAAM,MAAM,KAAK,KAAK;CACpC"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { ServerContext } from "@sentry/mcp-core/types";
|
|
2
1
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
2
|
|
|
4
3
|
//#region src/transports/stdio.d.ts
|
|
5
|
-
|
|
4
|
+
type StdioServerContext = {
|
|
5
|
+
sentryHost?: string;
|
|
6
|
+
mcpUrl?: string;
|
|
7
|
+
agentMode?: boolean;
|
|
8
|
+
experimentalMode?: boolean;
|
|
9
|
+
};
|
|
6
10
|
/**
|
|
7
11
|
* Starts the MCP server with stdio transport and telemetry.
|
|
8
12
|
*
|
|
@@ -11,7 +15,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
11
15
|
* All operations are wrapped in Sentry tracing for observability.
|
|
12
16
|
*
|
|
13
17
|
* @param server - Configured and instrumented MCP server instance (with context in closures)
|
|
14
|
-
* @param context -
|
|
18
|
+
* @param context - Context values used for telemetry attributes
|
|
15
19
|
*
|
|
16
20
|
* @example CLI Integration
|
|
17
21
|
* ```typescript
|
|
@@ -30,8 +34,8 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
30
34
|
* await startStdio(server, context);
|
|
31
35
|
* ```
|
|
32
36
|
*/
|
|
33
|
-
declare function startStdio(server: McpServer, context:
|
|
37
|
+
declare function startStdio<Context extends StdioServerContext>(server: McpServer, context: Context): Promise<void>;
|
|
34
38
|
//# sourceMappingURL=stdio.d.ts.map
|
|
35
39
|
//#endregion
|
|
36
|
-
export { startStdio };
|
|
40
|
+
export { StdioServerContext, startStdio };
|
|
37
41
|
//# sourceMappingURL=stdio.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.d.cts","names":[],"sources":["../../src/transports/stdio.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stdio.d.cts","names":[],"sources":["../../src/transports/stdio.ts"],"sourcesContent":[],"mappings":";;;KAyBY,kBAAA;;EAAA,MAAA,CAAA,EAAA,MAAA;EAwDU,SAAA,CAAA,EAAA,OAAU;EAAA,gBAAA,CAAA,EAAA,OAAA;CAAA;;;;AAEd;;;;;;;;;;;;;;;;;;;;;;;;iBAFI,2BAA2B,4BACvC,oBACC,UAAO"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
import { ServerContext } from "@sentry/mcp-core/types";
|
|
3
2
|
|
|
4
3
|
//#region src/transports/stdio.d.ts
|
|
5
|
-
|
|
4
|
+
type StdioServerContext = {
|
|
5
|
+
sentryHost?: string;
|
|
6
|
+
mcpUrl?: string;
|
|
7
|
+
agentMode?: boolean;
|
|
8
|
+
experimentalMode?: boolean;
|
|
9
|
+
};
|
|
6
10
|
/**
|
|
7
11
|
* Starts the MCP server with stdio transport and telemetry.
|
|
8
12
|
*
|
|
@@ -11,7 +15,7 @@ import { ServerContext } from "@sentry/mcp-core/types";
|
|
|
11
15
|
* All operations are wrapped in Sentry tracing for observability.
|
|
12
16
|
*
|
|
13
17
|
* @param server - Configured and instrumented MCP server instance (with context in closures)
|
|
14
|
-
* @param context -
|
|
18
|
+
* @param context - Context values used for telemetry attributes
|
|
15
19
|
*
|
|
16
20
|
* @example CLI Integration
|
|
17
21
|
* ```typescript
|
|
@@ -30,8 +34,8 @@ import { ServerContext } from "@sentry/mcp-core/types";
|
|
|
30
34
|
* await startStdio(server, context);
|
|
31
35
|
* ```
|
|
32
36
|
*/
|
|
33
|
-
declare function startStdio(server: McpServer, context:
|
|
37
|
+
declare function startStdio<Context extends StdioServerContext>(server: McpServer, context: Context): Promise<void>;
|
|
34
38
|
//# sourceMappingURL=stdio.d.ts.map
|
|
35
39
|
//#endregion
|
|
36
|
-
export { startStdio };
|
|
40
|
+
export { StdioServerContext, startStdio };
|
|
37
41
|
//# sourceMappingURL=stdio.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.d.ts","names":[],"sources":["../../src/transports/stdio.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stdio.d.ts","names":[],"sources":["../../src/transports/stdio.ts"],"sourcesContent":[],"mappings":";;;KAyBY,kBAAA;;EAAA,MAAA,CAAA,EAAA,MAAA;EAwDU,SAAA,CAAA,EAAA,OAAU;EAAA,gBAAA,CAAA,EAAA,OAAA;CAAA;;;;AAEd;;;;;;;;;;;;;;;;;;;;;;;;iBAFI,2BAA2B,4BACvC,oBACC,UAAO"}
|
package/dist/transports/stdio.js
CHANGED
|
@@ -54,4 +54,4 @@ function toCachedToken(tokenResponse, sentryHost, clientId) {
|
|
|
54
54
|
|
|
55
55
|
//#endregion
|
|
56
56
|
export { DeviceCodeErrorSchema, DeviceCodeResponseSchema, TokenResponseSchema, getTokenUserLabel, toCachedToken };
|
|
57
|
-
//# sourceMappingURL=types-
|
|
57
|
+
//# sourceMappingURL=types-BCSxlxZI.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types-
|
|
1
|
+
{"version":3,"file":"types-BCSxlxZI.js","names":["tokenResponse: TokenResponse","sentryHost: string","clientId: string"],"sources":["../src/auth/types.ts"],"sourcesContent":["import { z } from \"zod\";\n\n/**\n * Response from Sentry's device code endpoint (POST /oauth/device/code/).\n * See: https://docs.sentry.io/api/auth/#device-authorization-flow\n */\nexport const DeviceCodeResponseSchema = z.object({\n device_code: z.string(),\n user_code: z.string(),\n verification_uri: z.string().url(),\n verification_uri_complete: z.string().url(),\n interval: z.number().int().positive(),\n expires_in: z.number().int().positive(),\n});\n\nexport type DeviceCodeResponse = z.infer<typeof DeviceCodeResponseSchema>;\n\n/**\n * Error response during device code token polling.\n */\nexport const DeviceCodeErrorSchema = z.object({\n error: z.string(),\n error_description: z.string().optional(),\n});\n\n/**\n * Successful token response from Sentry's token endpoint.\n * Mirrors the shape used by the cloudflare OAuth callback.\n */\nexport const TokenResponseSchema = z.object({\n access_token: z.string(),\n refresh_token: z.string(),\n token_type: z.string(),\n expires_in: z.number(),\n expires_at: z.string().datetime(),\n user: z.object({\n email: z.string().nullable().optional(),\n id: z.string(),\n name: z.string().nullable(),\n }),\n scope: z.string(),\n});\n\nexport type TokenResponse = z.infer<typeof TokenResponseSchema>;\n\n/**\n * Shape of a cached token entry stored on disk.\n */\nexport type CachedToken = {\n access_token: string;\n refresh_token: string;\n expires_at: string;\n sentry_host: string;\n client_id: string;\n // Historical name retained for cache compatibility; this stores a user label,\n // not necessarily an email address.\n user_email: string;\n scope: string;\n};\n\nexport function getTokenUserLabel(tokenResponse: TokenResponse): string {\n return (\n tokenResponse.user.name ?? tokenResponse.user.email ?? tokenResponse.user.id\n );\n}\n\nexport function toCachedToken(\n tokenResponse: TokenResponse,\n sentryHost: string,\n clientId: string,\n): CachedToken {\n return {\n access_token: tokenResponse.access_token,\n refresh_token: tokenResponse.refresh_token,\n expires_at: tokenResponse.expires_at,\n sentry_host: sentryHost,\n client_id: clientId,\n user_email: getTokenUserLabel(tokenResponse),\n scope: tokenResponse.scope,\n };\n}\n"],"mappings":";;;;;;;AAMA,MAAa,2BAA2B,EAAE,OAAO;CAC/C,aAAa,EAAE,QAAQ;CACvB,WAAW,EAAE,QAAQ;CACrB,kBAAkB,EAAE,QAAQ,CAAC,KAAK;CAClC,2BAA2B,EAAE,QAAQ,CAAC,KAAK;CAC3C,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,UAAU;CACrC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,UAAU;AACxC,EAAC;;;;AAOF,MAAa,wBAAwB,EAAE,OAAO;CAC5C,OAAO,EAAE,QAAQ;CACjB,mBAAmB,EAAE,QAAQ,CAAC,UAAU;AACzC,EAAC;;;;;AAMF,MAAa,sBAAsB,EAAE,OAAO;CAC1C,cAAc,EAAE,QAAQ;CACxB,eAAe,EAAE,QAAQ;CACzB,YAAY,EAAE,QAAQ;CACtB,YAAY,EAAE,QAAQ;CACtB,YAAY,EAAE,QAAQ,CAAC,UAAU;CACjC,MAAM,EAAE,OAAO;EACb,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,UAAU;EACvC,IAAI,EAAE,QAAQ;EACd,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC5B,EAAC;CACF,OAAO,EAAE,QAAQ;AAClB,EAAC;AAmBF,SAAgB,kBAAkBA,eAAsC;AACtE,QACE,cAAc,KAAK,QAAQ,cAAc,KAAK,SAAS,cAAc,KAAK;AAE7E;AAED,SAAgB,cACdA,eACAC,YACAC,UACa;AACb,QAAO;EACL,cAAc,cAAc;EAC5B,eAAe,cAAc;EAC7B,YAAY,cAAc;EAC1B,aAAa;EACb,WAAW;EACX,YAAY,kBAAkB,cAAc;EAC5C,OAAO,cAAc;CACtB;AACF"}
|
|
@@ -109,4 +109,4 @@ declare function toCachedToken(tokenResponse: TokenResponse, sentryHost: string,
|
|
|
109
109
|
//# sourceMappingURL=types.d.ts.map
|
|
110
110
|
//#endregion
|
|
111
111
|
export { CachedToken, DeviceCodeErrorSchema, DeviceCodeResponse, DeviceCodeResponseSchema, TokenResponse, TokenResponseSchema, getTokenUserLabel, toCachedToken };
|
|
112
|
-
//# sourceMappingURL=types-
|
|
112
|
+
//# sourceMappingURL=types-BclC2DY0.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types-
|
|
1
|
+
{"version":3,"file":"types-BclC2DY0.d.ts","names":[],"sources":["../src/auth/types.ts"],"sourcesContent":[],"mappings":";;;;;;AAMA;;AAOE,cAPW,wBAOX,EAPmC,CAAA,CAAA,SAOnC,CAAA;eAAA,CAAA,CAAA;;;;;;UAPmC,cAAA,EAAA;EAAA,WAAA,EAAA,MAAA;EASzB,SAAA,EAAA,MAAA;EAAkB,gBAAA,EAAA,MAAA;EAAA,yBAAkB,EAAA,MAAA;EAAwB,QAArC,EAAA,MAAA;EAAK,UAAA,EAAA,MAAA;AAKxC,CAAA,EAAA;EAGE,WAAA,EAAA,MAAA;EAAA,SAAA,EAAA,MAAA;;;;YAHgC,EAAA,MAAA;AAAA,CAAA,CAAA;AASrB,KAdD,kBAAA,GAAqB,CAAA,CAAE,KA0BjC,CAAA,OA1B8C,wBA0B9C,CAAA;;;;cArBW,uBAAqB,CAAA,CAAA;SAGhC,CAAA,CAAA;;;;;;;;;;;;;AAM8B,cAAnB,mBAAmB,EAAA,CAAA,CAAA,SAAA,CAAA;EAcpB,YAAA,EAFV,CAAA,CAAA,SAEuB;EAAA,aAAA,aAAA;EAAA,UAAkB,aAAA;EAAmB,UAAhC,aAAA;EAAK,UAAA,aAAA;EAKvB,IAAA,aAAW,CAAA;IAYP,KAAA,eAAiB,cAAgB,YAAa,CAAA,CAAA;IAM9C,EAAA,aAAa;IAAA,IAAA,eAAA,YAAA,CAAA;EAAA,CAAA,EACZ,OAAA,cAAA,EAAA;IAGd,EAAA,EAAA,MAAA;IAAW,IAAA,EAAA,MAAA,GAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA3BF,aAAA,GAAgB,CAAA,CAAE,aAAa;;;;KAK/B,WAAA;;;;;;;;;iBAYI,iBAAA,gBAAiC;iBAMjC,aAAA,gBACC,sDAGd"}
|
|
@@ -60,6 +60,7 @@ type MergedArgs = {
|
|
|
60
60
|
version?: boolean;
|
|
61
61
|
unknownArgs: string[];
|
|
62
62
|
};
|
|
63
|
+
type CliAgentProvider = "openai" | "azure-openai" | "anthropic" | "openrouter";
|
|
63
64
|
/**
|
|
64
65
|
* Partially resolved config — accessToken may not yet be available
|
|
65
66
|
* (will be resolved via device code flow or cache).
|
|
@@ -75,7 +76,7 @@ type PartiallyResolvedConfig = {
|
|
|
75
76
|
openaiModel?: string;
|
|
76
77
|
anthropicBaseUrl?: string;
|
|
77
78
|
anthropicModel?: string;
|
|
78
|
-
agentProvider?:
|
|
79
|
+
agentProvider?: CliAgentProvider;
|
|
79
80
|
/** Skills granted for this session (always populated by finalize()) */
|
|
80
81
|
finalSkills: Set<Skill>;
|
|
81
82
|
organizationSlug?: string;
|
|
@@ -86,5 +87,5 @@ type ResolvedConfig = Omit<PartiallyResolvedConfig, "accessToken"> & {
|
|
|
86
87
|
};
|
|
87
88
|
//# sourceMappingURL=types.d.ts.map
|
|
88
89
|
//#endregion
|
|
89
|
-
export { CliArgs, EnvArgs, MergedArgs, PartiallyResolvedConfig, ResolvedConfig };
|
|
90
|
-
//# sourceMappingURL=types-
|
|
90
|
+
export { CliAgentProvider, CliArgs, EnvArgs, MergedArgs, PartiallyResolvedConfig, ResolvedConfig };
|
|
91
|
+
//# sourceMappingURL=types-DcYSHvwR.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-DcYSHvwR.d.cts","names":[],"sources":["../src/cli/types.ts"],"sourcesContent":[],"mappings":";;;;KAGY,OAAA;;EAAA,IAAA,CAAA,EAAA,MAAO;EAuBP,YAAO,CAAA,EAAA,OAAA;EAcP,GAAA,CAAA,EAAA,MAAA;EAwBA,MAAA,CAAA,EAAA,MAAA;EAUA,SAAA,CAAA,EAAA,MAAA;EAAuB,aAAA,CAAA,EAAA,MAAA;EAAA,WAIjB,CAAA,EAAA,MAAA;EAAc,gBAOd,CAAA,EAAA,MAAA;EAAgB,cAEf,CAAA,EAAA,MAAA;EAAK,aAAT,CAAA,EAAA,MAAA;EAAG,MAAA,CAAA,EAAA,MAAA;EAKN,aAAA,CAAA,EAAA,MAAc;EAAA,KAAA,CAAA,EAAA,OAAA;EAAA,YAAQ,CAAA,EAAA,OAAA;EAAuB,gBAA5B,CAAA,EAAA,MAAA;EAAI,WAAA,CAAA,EAAA,MAAA;;;;;KAlErB,OAAA;;;;;;;;;;;;;KAcA,UAAA;;;;;;;;;;;;;;;;;;;;;;;KAwBA,gBAAA;;;;;KAUA,uBAAA;;;;kBAIM;;;;;;;kBAOA;;eAEH,IAAI;;;;KAKP,cAAA,GAAiB,KAAK"}
|