@tokamohsen/sentry-mcp 0.29.4 → 0.29.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/{chunk-C0xms8kb.cjs → chunk-rXqPaSPc.cjs} +26 -0
  2. package/dist/cli/{parse-M8aGwIO5.d.ts → parse-CX7Bcldr.d.ts} +2 -2
  3. package/dist/cli/{parse-M8aGwIO5.d.ts.map → parse-CX7Bcldr.d.ts.map} +1 -1
  4. package/dist/cli/parse.cjs +1 -1
  5. package/dist/cli/{resolve-kNjr_UaF.d.ts → resolve-BVtyZcQM.d.ts} +2 -2
  6. package/dist/cli/resolve-BVtyZcQM.d.ts.map +1 -0
  7. package/dist/cli/resolve.cjs +9 -10
  8. package/dist/cli/resolve.cjs.map +1 -1
  9. package/dist/cli/resolve.js +2 -2
  10. package/dist/cli/{types-B2hDXVnQ.d.ts → types-CnTkIHzd.d.ts} +1 -1
  11. package/dist/cli/{types-B2hDXVnQ.d.ts.map → types-CnTkIHzd.d.ts.map} +1 -1
  12. package/dist/cli/{usage-BMxqEEQ3.d.ts → usage-BhCVaC5j.d.ts} +1 -1
  13. package/dist/cli/usage-BhCVaC5j.d.ts.map +1 -0
  14. package/dist/config-CzqCJmB9.js +613 -0
  15. package/dist/config-CzqCJmB9.js.map +1 -0
  16. package/dist/config-DMt6phB6.cjs +630 -0
  17. package/dist/config-DMt6phB6.cjs.map +1 -0
  18. package/dist/constants-BrEVt86y.js +194 -0
  19. package/dist/constants-BrEVt86y.js.map +1 -0
  20. package/dist/constants-C14tQf_s.cjs +217 -0
  21. package/dist/constants-C14tQf_s.cjs.map +1 -0
  22. package/dist/index.cjs +163 -14
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.js +191 -6
  25. package/dist/index.js.map +1 -1
  26. package/dist/server-DduxvXpe.js +32499 -0
  27. package/dist/server-DduxvXpe.js.map +1 -0
  28. package/dist/server-lur5iSHk.cjs +32530 -0
  29. package/dist/server-lur5iSHk.cjs.map +1 -0
  30. package/dist/skills-DOgs9MAy.cjs +96 -0
  31. package/dist/skills-DOgs9MAy.cjs.map +1 -0
  32. package/dist/skills-DfqlqYXj.js +72 -0
  33. package/dist/skills-DfqlqYXj.js.map +1 -0
  34. package/dist/token-CO5Bq1Ct.js +50 -0
  35. package/dist/token-CO5Bq1Ct.js.map +1 -0
  36. package/dist/token-GX19_oyM.cjs +54 -0
  37. package/dist/token-GX19_oyM.cjs.map +1 -0
  38. package/dist/token-util-1O_mwf8r.js +358 -0
  39. package/dist/token-util-1O_mwf8r.js.map +1 -0
  40. package/dist/token-util-Cw83HNFN.cjs +362 -0
  41. package/dist/token-util-Cw83HNFN.cjs.map +1 -0
  42. package/dist/transports/{stdio-DVcJU1wB.d.ts → stdio-DKQR8J7l.d.ts} +1 -1
  43. package/dist/transports/{stdio-DVcJU1wB.d.ts.map → stdio-DKQR8J7l.d.ts.map} +1 -1
  44. package/dist/transports/stdio.cjs +3 -3
  45. package/dist/transports/stdio.js +1 -1
  46. package/dist/url-utils-BHhxlntO.js +119 -0
  47. package/dist/url-utils-BHhxlntO.js.map +1 -0
  48. package/dist/url-utils-N2ExJl9F.cjs +161 -0
  49. package/dist/url-utils-N2ExJl9F.cjs.map +1 -0
  50. package/dist/version-4iOZzjiD.js +7 -0
  51. package/dist/version-4iOZzjiD.js.map +1 -0
  52. package/dist/version-BD4r13ze.cjs +19 -0
  53. package/dist/version-BD4r13ze.cjs.map +1 -0
  54. package/package.json +1 -1
  55. package/dist/cli/resolve-kNjr_UaF.d.ts.map +0 -1
  56. package/dist/cli/usage-BMxqEEQ3.d.ts.map +0 -1
  57. /package/dist/{index-DgNgxUxv.d.ts → index-UKPmYT-S.d.ts} +0 -0
@@ -0,0 +1,96 @@
1
+
2
+ //#region ../mcp-core/dist/skills.js
3
+ const SKILLS = {
4
+ inspect: {
5
+ id: "inspect",
6
+ name: "Inspect Issues & Events",
7
+ description: "Search for errors, analyze traces, and explore event details",
8
+ defaultEnabled: true,
9
+ order: 1
10
+ },
11
+ seer: {
12
+ id: "seer",
13
+ name: "Seer",
14
+ description: "Sentry's AI debugger that helps you analyze, root cause, and fix issues",
15
+ defaultEnabled: true,
16
+ order: 2
17
+ },
18
+ docs: {
19
+ id: "docs",
20
+ name: "Documentation",
21
+ description: "Search and read Sentry SDK documentation",
22
+ defaultEnabled: false,
23
+ order: 3
24
+ },
25
+ triage: {
26
+ id: "triage",
27
+ name: "Triage Issues",
28
+ description: "Resolve, assign, and update issues",
29
+ defaultEnabled: false,
30
+ order: 4
31
+ },
32
+ "project-management": {
33
+ id: "project-management",
34
+ name: "Manage Projects & Teams",
35
+ description: "Create and modify projects, teams, and DSNs",
36
+ defaultEnabled: false,
37
+ order: 5
38
+ }
39
+ };
40
+ const SKILLS_ARRAY = Object.values(SKILLS).sort((a, b) => a.order - b.order);
41
+ const ALL_SKILLS = Object.keys(SKILLS);
42
+ const DEFAULT_SKILLS = SKILLS_ARRAY.filter((s) => s.defaultEnabled).map((s) => s.id);
43
+ function isValidSkill(skill) {
44
+ return skill in SKILLS;
45
+ }
46
+ function isEnabledBySkills(grantedSkills, toolSkills) {
47
+ if (!grantedSkills || toolSkills.length === 0) return false;
48
+ return toolSkills.some((skill) => grantedSkills.has(skill));
49
+ }
50
+ function parseSkills(input) {
51
+ const valid = /* @__PURE__ */ new Set();
52
+ const invalid = [];
53
+ if (!input) return {
54
+ valid,
55
+ invalid
56
+ };
57
+ let skills = [];
58
+ if (typeof input === "string") skills = input.split(",");
59
+ else if (Array.isArray(input)) skills = input.map((v) => typeof v === "string" ? v : "");
60
+ for (const skill of skills) {
61
+ const trimmed = String(skill).trim();
62
+ if (isValidSkill(trimmed)) valid.add(trimmed);
63
+ else if (trimmed) invalid.push(trimmed);
64
+ }
65
+ return {
66
+ valid,
67
+ invalid
68
+ };
69
+ }
70
+
71
+ //#endregion
72
+ Object.defineProperty(exports, 'ALL_SKILLS', {
73
+ enumerable: true,
74
+ get: function () {
75
+ return ALL_SKILLS;
76
+ }
77
+ });
78
+ Object.defineProperty(exports, 'SKILLS', {
79
+ enumerable: true,
80
+ get: function () {
81
+ return SKILLS;
82
+ }
83
+ });
84
+ Object.defineProperty(exports, 'isEnabledBySkills', {
85
+ enumerable: true,
86
+ get: function () {
87
+ return isEnabledBySkills;
88
+ }
89
+ });
90
+ Object.defineProperty(exports, 'parseSkills', {
91
+ enumerable: true,
92
+ get: function () {
93
+ return parseSkills;
94
+ }
95
+ });
96
+ //# sourceMappingURL=skills-DOgs9MAy.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills-DOgs9MAy.cjs","names":[],"sources":["../../mcp-core/dist/skills.js"],"sourcesContent":["//#region src/skills.ts\nconst SKILLS = {\n\tinspect: {\n\t\tid: \"inspect\",\n\t\tname: \"Inspect Issues & Events\",\n\t\tdescription: \"Search for errors, analyze traces, and explore event details\",\n\t\tdefaultEnabled: true,\n\t\torder: 1\n\t},\n\tseer: {\n\t\tid: \"seer\",\n\t\tname: \"Seer\",\n\t\tdescription: \"Sentry's AI debugger that helps you analyze, root cause, and fix issues\",\n\t\tdefaultEnabled: true,\n\t\torder: 2\n\t},\n\tdocs: {\n\t\tid: \"docs\",\n\t\tname: \"Documentation\",\n\t\tdescription: \"Search and read Sentry SDK documentation\",\n\t\tdefaultEnabled: false,\n\t\torder: 3\n\t},\n\ttriage: {\n\t\tid: \"triage\",\n\t\tname: \"Triage Issues\",\n\t\tdescription: \"Resolve, assign, and update issues\",\n\t\tdefaultEnabled: false,\n\t\torder: 4\n\t},\n\t\"project-management\": {\n\t\tid: \"project-management\",\n\t\tname: \"Manage Projects & Teams\",\n\t\tdescription: \"Create and modify projects, teams, and DSNs\",\n\t\tdefaultEnabled: false,\n\t\torder: 5\n\t}\n};\nconst SKILLS_ARRAY = Object.values(SKILLS).sort((a, b) => a.order - b.order);\nasync function getSkillsArrayWithCounts() {\n\tconst tools = (await import(\"./tools/index.js\")).default;\n\tconst counts = /* @__PURE__ */ new Map();\n\tfor (const skill of Object.keys(SKILLS)) counts.set(skill, 0);\n\tfor (const tool of Object.values(tools)) if (Array.isArray(tool.skills)) for (const skill of tool.skills) counts.set(skill, (counts.get(skill) || 0) + 1);\n\treturn SKILLS_ARRAY.map((skill) => ({\n\t\t...skill,\n\t\ttoolCount: counts.get(skill.id) || 0\n\t}));\n}\nconst ALL_SKILLS = Object.keys(SKILLS);\nconst DEFAULT_SKILLS = SKILLS_ARRAY.filter((s) => s.defaultEnabled).map((s) => s.id);\nfunction isValidSkill(skill) {\n\treturn skill in SKILLS;\n}\nfunction isEnabledBySkills(grantedSkills, toolSkills) {\n\tif (!grantedSkills || toolSkills.length === 0) return false;\n\treturn toolSkills.some((skill) => grantedSkills.has(skill));\n}\nfunction parseSkills(input) {\n\tconst valid = /* @__PURE__ */ new Set();\n\tconst invalid = [];\n\tif (!input) return {\n\t\tvalid,\n\t\tinvalid\n\t};\n\tlet skills = [];\n\tif (typeof input === \"string\") skills = input.split(\",\");\n\telse if (Array.isArray(input)) skills = input.map((v) => typeof v === \"string\" ? v : \"\");\n\tfor (const skill of skills) {\n\t\tconst trimmed = String(skill).trim();\n\t\tif (isValidSkill(trimmed)) valid.add(trimmed);\n\t\telse if (trimmed) invalid.push(trimmed);\n\t}\n\treturn {\n\t\tvalid,\n\t\tinvalid\n\t};\n}\nasync function getScopesForSkills(grantedSkills) {\n\tconst { DEFAULT_SCOPES } = await import(\"./constants.js\");\n\tconst tools = (await import(\"./tools/index.js\")).default;\n\tconst scopes = new Set(DEFAULT_SCOPES);\n\tfor (const tool of Object.values(tools)) if (tool.skills.some((skill) => grantedSkills.has(skill))) for (const scope of tool.requiredScopes) scopes.add(scope);\n\treturn scopes;\n}\n\n//#endregion\nexport { ALL_SKILLS, DEFAULT_SKILLS, SKILLS, SKILLS_ARRAY, getScopesForSkills, getSkillsArrayWithCounts, isEnabledBySkills, isValidSkill, parseSkills };\n//# sourceMappingURL=skills.js.map"],"mappings":";;AACA,MAAM,SAAS;CACd,SAAS;EACR,IAAI;EACJ,MAAM;EACN,aAAa;EACb,gBAAgB;EAChB,OAAO;EACP;CACD,MAAM;EACL,IAAI;EACJ,MAAM;EACN,aAAa;EACb,gBAAgB;EAChB,OAAO;EACP;CACD,MAAM;EACL,IAAI;EACJ,MAAM;EACN,aAAa;EACb,gBAAgB;EAChB,OAAO;EACP;CACD,QAAQ;EACP,IAAI;EACJ,MAAM;EACN,aAAa;EACb,gBAAgB;EAChB,OAAO;EACP;CACD,sBAAsB;EACrB,IAAI;EACJ,MAAM;EACN,aAAa;EACb,gBAAgB;EAChB,OAAO;EACP;CACD;AACD,MAAM,eAAe,OAAO,OAAO,OAAO,CAAC,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,MAAM;AAW5E,MAAM,aAAa,OAAO,KAAK,OAAO;AACtC,MAAM,iBAAiB,aAAa,QAAQ,MAAM,EAAE,eAAe,CAAC,KAAK,MAAM,EAAE,GAAG;AACpF,SAAS,aAAa,OAAO;AAC5B,QAAO,SAAS;;AAEjB,SAAS,kBAAkB,eAAe,YAAY;AACrD,KAAI,CAAC,iBAAiB,WAAW,WAAW,EAAG,QAAO;AACtD,QAAO,WAAW,MAAM,UAAU,cAAc,IAAI,MAAM,CAAC;;AAE5D,SAAS,YAAY,OAAO;CAC3B,MAAM,wBAAwB,IAAI,KAAK;CACvC,MAAM,UAAU,EAAE;AAClB,KAAI,CAAC,MAAO,QAAO;EAClB;EACA;EACA;CACD,IAAI,SAAS,EAAE;AACf,KAAI,OAAO,UAAU,SAAU,UAAS,MAAM,MAAM,IAAI;UAC/C,MAAM,QAAQ,MAAM,CAAE,UAAS,MAAM,KAAK,MAAM,OAAO,MAAM,WAAW,IAAI,GAAG;AACxF,MAAK,MAAM,SAAS,QAAQ;EAC3B,MAAM,UAAU,OAAO,MAAM,CAAC,MAAM;AACpC,MAAI,aAAa,QAAQ,CAAE,OAAM,IAAI,QAAQ;WACpC,QAAS,SAAQ,KAAK,QAAQ;;AAExC,QAAO;EACN;EACA;EACA"}
@@ -0,0 +1,72 @@
1
+ //#region ../mcp-core/dist/skills.js
2
+ const SKILLS = {
3
+ inspect: {
4
+ id: "inspect",
5
+ name: "Inspect Issues & Events",
6
+ description: "Search for errors, analyze traces, and explore event details",
7
+ defaultEnabled: true,
8
+ order: 1
9
+ },
10
+ seer: {
11
+ id: "seer",
12
+ name: "Seer",
13
+ description: "Sentry's AI debugger that helps you analyze, root cause, and fix issues",
14
+ defaultEnabled: true,
15
+ order: 2
16
+ },
17
+ docs: {
18
+ id: "docs",
19
+ name: "Documentation",
20
+ description: "Search and read Sentry SDK documentation",
21
+ defaultEnabled: false,
22
+ order: 3
23
+ },
24
+ triage: {
25
+ id: "triage",
26
+ name: "Triage Issues",
27
+ description: "Resolve, assign, and update issues",
28
+ defaultEnabled: false,
29
+ order: 4
30
+ },
31
+ "project-management": {
32
+ id: "project-management",
33
+ name: "Manage Projects & Teams",
34
+ description: "Create and modify projects, teams, and DSNs",
35
+ defaultEnabled: false,
36
+ order: 5
37
+ }
38
+ };
39
+ const SKILLS_ARRAY = Object.values(SKILLS).sort((a, b) => a.order - b.order);
40
+ const ALL_SKILLS = Object.keys(SKILLS);
41
+ const DEFAULT_SKILLS = SKILLS_ARRAY.filter((s) => s.defaultEnabled).map((s) => s.id);
42
+ function isValidSkill(skill) {
43
+ return skill in SKILLS;
44
+ }
45
+ function isEnabledBySkills(grantedSkills, toolSkills) {
46
+ if (!grantedSkills || toolSkills.length === 0) return false;
47
+ return toolSkills.some((skill) => grantedSkills.has(skill));
48
+ }
49
+ function parseSkills(input) {
50
+ const valid = /* @__PURE__ */ new Set();
51
+ const invalid = [];
52
+ if (!input) return {
53
+ valid,
54
+ invalid
55
+ };
56
+ let skills = [];
57
+ if (typeof input === "string") skills = input.split(",");
58
+ else if (Array.isArray(input)) skills = input.map((v) => typeof v === "string" ? v : "");
59
+ for (const skill of skills) {
60
+ const trimmed = String(skill).trim();
61
+ if (isValidSkill(trimmed)) valid.add(trimmed);
62
+ else if (trimmed) invalid.push(trimmed);
63
+ }
64
+ return {
65
+ valid,
66
+ invalid
67
+ };
68
+ }
69
+
70
+ //#endregion
71
+ export { parseSkills as i, SKILLS as n, isEnabledBySkills as r, ALL_SKILLS as t };
72
+ //# sourceMappingURL=skills-DfqlqYXj.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills-DfqlqYXj.js","names":[],"sources":["../../mcp-core/dist/skills.js"],"sourcesContent":["//#region src/skills.ts\nconst SKILLS = {\n\tinspect: {\n\t\tid: \"inspect\",\n\t\tname: \"Inspect Issues & Events\",\n\t\tdescription: \"Search for errors, analyze traces, and explore event details\",\n\t\tdefaultEnabled: true,\n\t\torder: 1\n\t},\n\tseer: {\n\t\tid: \"seer\",\n\t\tname: \"Seer\",\n\t\tdescription: \"Sentry's AI debugger that helps you analyze, root cause, and fix issues\",\n\t\tdefaultEnabled: true,\n\t\torder: 2\n\t},\n\tdocs: {\n\t\tid: \"docs\",\n\t\tname: \"Documentation\",\n\t\tdescription: \"Search and read Sentry SDK documentation\",\n\t\tdefaultEnabled: false,\n\t\torder: 3\n\t},\n\ttriage: {\n\t\tid: \"triage\",\n\t\tname: \"Triage Issues\",\n\t\tdescription: \"Resolve, assign, and update issues\",\n\t\tdefaultEnabled: false,\n\t\torder: 4\n\t},\n\t\"project-management\": {\n\t\tid: \"project-management\",\n\t\tname: \"Manage Projects & Teams\",\n\t\tdescription: \"Create and modify projects, teams, and DSNs\",\n\t\tdefaultEnabled: false,\n\t\torder: 5\n\t}\n};\nconst SKILLS_ARRAY = Object.values(SKILLS).sort((a, b) => a.order - b.order);\nasync function getSkillsArrayWithCounts() {\n\tconst tools = (await import(\"./tools/index.js\")).default;\n\tconst counts = /* @__PURE__ */ new Map();\n\tfor (const skill of Object.keys(SKILLS)) counts.set(skill, 0);\n\tfor (const tool of Object.values(tools)) if (Array.isArray(tool.skills)) for (const skill of tool.skills) counts.set(skill, (counts.get(skill) || 0) + 1);\n\treturn SKILLS_ARRAY.map((skill) => ({\n\t\t...skill,\n\t\ttoolCount: counts.get(skill.id) || 0\n\t}));\n}\nconst ALL_SKILLS = Object.keys(SKILLS);\nconst DEFAULT_SKILLS = SKILLS_ARRAY.filter((s) => s.defaultEnabled).map((s) => s.id);\nfunction isValidSkill(skill) {\n\treturn skill in SKILLS;\n}\nfunction isEnabledBySkills(grantedSkills, toolSkills) {\n\tif (!grantedSkills || toolSkills.length === 0) return false;\n\treturn toolSkills.some((skill) => grantedSkills.has(skill));\n}\nfunction parseSkills(input) {\n\tconst valid = /* @__PURE__ */ new Set();\n\tconst invalid = [];\n\tif (!input) return {\n\t\tvalid,\n\t\tinvalid\n\t};\n\tlet skills = [];\n\tif (typeof input === \"string\") skills = input.split(\",\");\n\telse if (Array.isArray(input)) skills = input.map((v) => typeof v === \"string\" ? v : \"\");\n\tfor (const skill of skills) {\n\t\tconst trimmed = String(skill).trim();\n\t\tif (isValidSkill(trimmed)) valid.add(trimmed);\n\t\telse if (trimmed) invalid.push(trimmed);\n\t}\n\treturn {\n\t\tvalid,\n\t\tinvalid\n\t};\n}\nasync function getScopesForSkills(grantedSkills) {\n\tconst { DEFAULT_SCOPES } = await import(\"./constants.js\");\n\tconst tools = (await import(\"./tools/index.js\")).default;\n\tconst scopes = new Set(DEFAULT_SCOPES);\n\tfor (const tool of Object.values(tools)) if (tool.skills.some((skill) => grantedSkills.has(skill))) for (const scope of tool.requiredScopes) scopes.add(scope);\n\treturn scopes;\n}\n\n//#endregion\nexport { ALL_SKILLS, DEFAULT_SKILLS, SKILLS, SKILLS_ARRAY, getScopesForSkills, getSkillsArrayWithCounts, isEnabledBySkills, isValidSkill, parseSkills };\n//# sourceMappingURL=skills.js.map"],"mappings":";AACA,MAAM,SAAS;CACd,SAAS;EACR,IAAI;EACJ,MAAM;EACN,aAAa;EACb,gBAAgB;EAChB,OAAO;EACP;CACD,MAAM;EACL,IAAI;EACJ,MAAM;EACN,aAAa;EACb,gBAAgB;EAChB,OAAO;EACP;CACD,MAAM;EACL,IAAI;EACJ,MAAM;EACN,aAAa;EACb,gBAAgB;EAChB,OAAO;EACP;CACD,QAAQ;EACP,IAAI;EACJ,MAAM;EACN,aAAa;EACb,gBAAgB;EAChB,OAAO;EACP;CACD,sBAAsB;EACrB,IAAI;EACJ,MAAM;EACN,aAAa;EACb,gBAAgB;EAChB,OAAO;EACP;CACD;AACD,MAAM,eAAe,OAAO,OAAO,OAAO,CAAC,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,MAAM;AAW5E,MAAM,aAAa,OAAO,KAAK,OAAO;AACtC,MAAM,iBAAiB,aAAa,QAAQ,MAAM,EAAE,eAAe,CAAC,KAAK,MAAM,EAAE,GAAG;AACpF,SAAS,aAAa,OAAO;AAC5B,QAAO,SAAS;;AAEjB,SAAS,kBAAkB,eAAe,YAAY;AACrD,KAAI,CAAC,iBAAiB,WAAW,WAAW,EAAG,QAAO;AACtD,QAAO,WAAW,MAAM,UAAU,cAAc,IAAI,MAAM,CAAC;;AAE5D,SAAS,YAAY,OAAO;CAC3B,MAAM,wBAAwB,IAAI,KAAK;CACvC,MAAM,UAAU,EAAE;AAClB,KAAI,CAAC,MAAO,QAAO;EAClB;EACA;EACA;CACD,IAAI,SAAS,EAAE;AACf,KAAI,OAAO,UAAU,SAAU,UAAS,MAAM,MAAM,IAAI;UAC/C,MAAM,QAAQ,MAAM,CAAE,UAAS,MAAM,KAAK,MAAM,OAAO,MAAM,WAAW,IAAI,GAAG;AACxF,MAAK,MAAM,SAAS,QAAQ;EAC3B,MAAM,UAAU,OAAO,MAAM,CAAC,MAAM;AACpC,MAAI,aAAa,QAAQ,CAAE,OAAM,IAAI,QAAQ;WACpC,QAAS,SAAQ,KAAK,QAAQ;;AAExC,QAAO;EACN;EACA;EACA"}
@@ -0,0 +1,50 @@
1
+ import { n as __commonJSMin, t as require_token_error } from "./index.js";
2
+ import { t as require_token_util } from "./token-util-1O_mwf8r.js";
3
+
4
+ //#region ../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token.js
5
+ var require_token = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6
+ var __defProp = Object.defineProperty;
7
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
+ var __getOwnPropNames = Object.getOwnPropertyNames;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __export = (target, all) => {
11
+ for (var name in all) __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
15
+ };
16
+ var __copyProps = (to, from, except, desc) => {
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
19
+ get: () => from[key],
20
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
+ });
22
+ }
23
+ return to;
24
+ };
25
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
26
+ var token_exports = {};
27
+ __export(token_exports, { refreshToken: () => refreshToken });
28
+ module.exports = __toCommonJS(token_exports);
29
+ var import_token_error = require_token_error();
30
+ var import_token_util = require_token_util();
31
+ async function refreshToken() {
32
+ const { projectId, teamId } = (0, import_token_util.findProjectInfo)();
33
+ let maybeToken = (0, import_token_util.loadToken)(projectId);
34
+ if (!maybeToken || (0, import_token_util.isExpired)((0, import_token_util.getTokenPayload)(maybeToken.token))) {
35
+ const authToken = await (0, import_token_util.getVercelCliToken)();
36
+ if (!authToken) throw new import_token_error.VercelOidcTokenError("Failed to refresh OIDC token: Log in to Vercel CLI and link your project with `vc link`");
37
+ if (!projectId) throw new import_token_error.VercelOidcTokenError("Failed to refresh OIDC token: Try re-linking your project with `vc link`");
38
+ maybeToken = await (0, import_token_util.getVercelOidcToken)(authToken, projectId, teamId);
39
+ if (!maybeToken) throw new import_token_error.VercelOidcTokenError("Failed to refresh OIDC token");
40
+ (0, import_token_util.saveToken)(maybeToken, projectId);
41
+ }
42
+ process.env.VERCEL_OIDC_TOKEN = maybeToken.token;
43
+ }
44
+ }));
45
+
46
+ //#endregion
47
+ export default require_token();
48
+
49
+ export { };
50
+ //# sourceMappingURL=token-CO5Bq1Ct.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-CO5Bq1Ct.js","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 CommonJS export names for ESM import in node:\n0 && (module.exports = {\n refreshToken\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,YAAY,QAAQ,QAAQ;AAC9B,OAAK,IAAI,QAAQ,IACf,WAAU,QAAQ,MAAM;GAAE,KAAK,IAAI;GAAO,YAAY;GAAM,CAAC;;CAEjE,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;AAC5C,MAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YACtD;QAAK,IAAI,OAAO,kBAAkB,KAAK,CACrC,KAAI,CAAC,aAAa,KAAK,IAAI,IAAI,IAAI,QAAQ,OACzC,WAAU,IAAI,KAAK;IAAE,WAAW,KAAK;IAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,IAAI,KAAK,KAAK;IAAY,CAAC;;AAExH,SAAO;;CAET,IAAI,gBAAgB,QAAQ,YAAY,UAAU,EAAE,EAAE,cAAc,EAAE,OAAO,MAAM,CAAC,EAAE,IAAI;CAC1F,IAAI,gBAAgB,EAAE;AACtB,UAAS,eAAe,EACtB,oBAAoB,cACrB,CAAC;AACF,QAAO,UAAU,aAAa,cAAc;CAC5C,IAAI;CACJ,IAAI;CACJ,eAAe,eAAe;EAC5B,MAAM,EAAE,WAAW,YAAY,GAAG,kBAAkB,kBAAkB;EACtE,IAAI,cAAc,GAAG,kBAAkB,WAAW,UAAU;AAC5D,MAAI,CAAC,eAAe,GAAG,kBAAkB,YAAY,GAAG,kBAAkB,iBAAiB,WAAW,MAAM,CAAC,EAAE;GAC7G,MAAM,YAAY,OAAO,GAAG,kBAAkB,oBAAoB;AAClE,OAAI,CAAC,UACH,OAAM,IAAI,mBAAmB,qBAC3B,0FACD;AAEH,OAAI,CAAC,UACH,OAAM,IAAI,mBAAmB,qBAC3B,2EACD;AAEH,gBAAa,OAAO,GAAG,kBAAkB,oBAAoB,WAAW,WAAW,OAAO;AAC1F,OAAI,CAAC,WACH,OAAM,IAAI,mBAAmB,qBAAqB,+BAA+B;AAEnF,IAAC,GAAG,kBAAkB,WAAW,YAAY,UAAU;;AAEzD,UAAQ,IAAI,oBAAoB,WAAW"}
@@ -0,0 +1,54 @@
1
+ const require_chunk = require('./chunk-rXqPaSPc.cjs');
2
+ const require_index = require('./index.cjs');
3
+ const require_token_util$1 = require('./token-util-Cw83HNFN.cjs');
4
+
5
+ //#region ../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token.js
6
+ var require_token = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
7
+ var __defProp = Object.defineProperty;
8
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9
+ var __getOwnPropNames = Object.getOwnPropertyNames;
10
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __export = (target, all) => {
12
+ for (var name in all) __defProp(target, name, {
13
+ get: all[name],
14
+ enumerable: true
15
+ });
16
+ };
17
+ var __copyProps = (to, from, except, desc) => {
18
+ if (from && typeof from === "object" || typeof from === "function") {
19
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
20
+ get: () => from[key],
21
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
22
+ });
23
+ }
24
+ return to;
25
+ };
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
+ var token_exports = {};
28
+ __export(token_exports, { refreshToken: () => refreshToken });
29
+ module.exports = __toCommonJS(token_exports);
30
+ var import_token_error = require_index.require_token_error();
31
+ var import_token_util = require_token_util$1.default;
32
+ async function refreshToken() {
33
+ const { projectId, teamId } = (0, import_token_util.findProjectInfo)();
34
+ let maybeToken = (0, import_token_util.loadToken)(projectId);
35
+ if (!maybeToken || (0, import_token_util.isExpired)((0, import_token_util.getTokenPayload)(maybeToken.token))) {
36
+ const authToken = await (0, import_token_util.getVercelCliToken)();
37
+ if (!authToken) throw new import_token_error.VercelOidcTokenError("Failed to refresh OIDC token: Log in to Vercel CLI and link your project with `vc link`");
38
+ if (!projectId) throw new import_token_error.VercelOidcTokenError("Failed to refresh OIDC token: Try re-linking your project with `vc link`");
39
+ maybeToken = await (0, import_token_util.getVercelOidcToken)(authToken, projectId, teamId);
40
+ if (!maybeToken) throw new import_token_error.VercelOidcTokenError("Failed to refresh OIDC token");
41
+ (0, import_token_util.saveToken)(maybeToken, projectId);
42
+ }
43
+ process.env.VERCEL_OIDC_TOKEN = maybeToken.token;
44
+ }
45
+ }));
46
+
47
+ //#endregion
48
+ Object.defineProperty(exports, 'default', {
49
+ enumerable: true,
50
+ get: function () {
51
+ return require_token();
52
+ }
53
+ });
54
+ //# sourceMappingURL=token-GX19_oyM.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-GX19_oyM.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 CommonJS export names for ESM import in node:\n0 && (module.exports = {\n refreshToken\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,YAAY,QAAQ,QAAQ;AAC9B,OAAK,IAAI,QAAQ,IACf,WAAU,QAAQ,MAAM;GAAE,KAAK,IAAI;GAAO,YAAY;GAAM,CAAC;;CAEjE,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;AAC5C,MAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YACtD;QAAK,IAAI,OAAO,kBAAkB,KAAK,CACrC,KAAI,CAAC,aAAa,KAAK,IAAI,IAAI,IAAI,QAAQ,OACzC,WAAU,IAAI,KAAK;IAAE,WAAW,KAAK;IAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,IAAI,KAAK,KAAK;IAAY,CAAC;;AAExH,SAAO;;CAET,IAAI,gBAAgB,QAAQ,YAAY,UAAU,EAAE,EAAE,cAAc,EAAE,OAAO,MAAM,CAAC,EAAE,IAAI;CAC1F,IAAI,gBAAgB,EAAE;AACtB,UAAS,eAAe,EACtB,oBAAoB,cACrB,CAAC;AACF,QAAO,UAAU,aAAa,cAAc;CAC5C,IAAI;CACJ,IAAI;CACJ,eAAe,eAAe;EAC5B,MAAM,EAAE,WAAW,YAAY,GAAG,kBAAkB,kBAAkB;EACtE,IAAI,cAAc,GAAG,kBAAkB,WAAW,UAAU;AAC5D,MAAI,CAAC,eAAe,GAAG,kBAAkB,YAAY,GAAG,kBAAkB,iBAAiB,WAAW,MAAM,CAAC,EAAE;GAC7G,MAAM,YAAY,OAAO,GAAG,kBAAkB,oBAAoB;AAClE,OAAI,CAAC,UACH,OAAM,IAAI,mBAAmB,qBAC3B,0FACD;AAEH,OAAI,CAAC,UACH,OAAM,IAAI,mBAAmB,qBAC3B,2EACD;AAEH,gBAAa,OAAO,GAAG,kBAAkB,oBAAoB,WAAW,WAAW,OAAO;AAC1F,OAAI,CAAC,WACH,OAAM,IAAI,mBAAmB,qBAAqB,+BAA+B;AAEnF,IAAC,GAAG,kBAAkB,WAAW,YAAY,UAAU;;AAEzD,UAAQ,IAAI,oBAAoB,WAAW"}
@@ -0,0 +1,358 @@
1
+ import { i as __require, n as __commonJSMin, t as require_token_error } from "./index.js";
2
+
3
+ //#region ../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token-io.js
4
+ var require_token_io = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5
+ var __create = Object.create;
6
+ var __defProp = Object.defineProperty;
7
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
+ var __getOwnPropNames = Object.getOwnPropertyNames;
9
+ var __getProtoOf = Object.getPrototypeOf;
10
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __export = (target, all) => {
12
+ for (var name in all) __defProp(target, name, {
13
+ get: all[name],
14
+ enumerable: true
15
+ });
16
+ };
17
+ var __copyProps = (to, from, except, desc) => {
18
+ if (from && typeof from === "object" || typeof from === "function") {
19
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
20
+ get: () => from[key],
21
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
22
+ });
23
+ }
24
+ return to;
25
+ };
26
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
27
+ value: mod,
28
+ enumerable: true
29
+ }) : target, mod));
30
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
+ var token_io_exports = {};
32
+ __export(token_io_exports, {
33
+ findRootDir: () => findRootDir,
34
+ getUserDataDir: () => getUserDataDir
35
+ });
36
+ module.exports = __toCommonJS(token_io_exports);
37
+ var import_path = __toESM(__require("path"));
38
+ var import_fs = __toESM(__require("fs"));
39
+ var import_os$1 = __toESM(__require("os"));
40
+ var import_token_error = require_token_error();
41
+ function findRootDir() {
42
+ try {
43
+ let dir = process.cwd();
44
+ while (dir !== import_path.default.dirname(dir)) {
45
+ const pkgPath = import_path.default.join(dir, ".vercel");
46
+ if (import_fs.default.existsSync(pkgPath)) return dir;
47
+ dir = import_path.default.dirname(dir);
48
+ }
49
+ } catch (e) {
50
+ throw new import_token_error.VercelOidcTokenError("Token refresh only supported in node server environments");
51
+ }
52
+ return null;
53
+ }
54
+ function getUserDataDir() {
55
+ if (process.env.XDG_DATA_HOME) return process.env.XDG_DATA_HOME;
56
+ switch (import_os$1.default.platform()) {
57
+ case "darwin": return import_path.default.join(import_os$1.default.homedir(), "Library/Application Support");
58
+ case "linux": return import_path.default.join(import_os$1.default.homedir(), ".local/share");
59
+ case "win32":
60
+ if (process.env.LOCALAPPDATA) return process.env.LOCALAPPDATA;
61
+ return null;
62
+ default: return null;
63
+ }
64
+ }
65
+ }));
66
+
67
+ //#endregion
68
+ //#region ../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/auth-config.js
69
+ var require_auth_config = /* @__PURE__ */ __commonJSMin(((exports, module) => {
70
+ var __create = Object.create;
71
+ var __defProp = Object.defineProperty;
72
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
73
+ var __getOwnPropNames = Object.getOwnPropertyNames;
74
+ var __getProtoOf = Object.getPrototypeOf;
75
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
76
+ var __export = (target, all) => {
77
+ for (var name in all) __defProp(target, name, {
78
+ get: all[name],
79
+ enumerable: true
80
+ });
81
+ };
82
+ var __copyProps = (to, from, except, desc) => {
83
+ if (from && typeof from === "object" || typeof from === "function") {
84
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
85
+ get: () => from[key],
86
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
87
+ });
88
+ }
89
+ return to;
90
+ };
91
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
92
+ value: mod,
93
+ enumerable: true
94
+ }) : target, mod));
95
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
96
+ var auth_config_exports = {};
97
+ __export(auth_config_exports, {
98
+ isValidAccessToken: () => isValidAccessToken,
99
+ readAuthConfig: () => readAuthConfig,
100
+ writeAuthConfig: () => writeAuthConfig
101
+ });
102
+ module.exports = __toCommonJS(auth_config_exports);
103
+ var fs$1 = __toESM(__require("fs"));
104
+ var path$1 = __toESM(__require("path"));
105
+ var import_token_util = require_token_util();
106
+ function getAuthConfigPath() {
107
+ const dataDir = (0, import_token_util.getVercelDataDir)();
108
+ if (!dataDir) throw new Error(`Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`);
109
+ return path$1.join(dataDir, "auth.json");
110
+ }
111
+ function readAuthConfig() {
112
+ try {
113
+ const authPath = getAuthConfigPath();
114
+ if (!fs$1.existsSync(authPath)) return null;
115
+ const content = fs$1.readFileSync(authPath, "utf8");
116
+ if (!content) return null;
117
+ return JSON.parse(content);
118
+ } catch (error) {
119
+ return null;
120
+ }
121
+ }
122
+ function writeAuthConfig(config) {
123
+ const authPath = getAuthConfigPath();
124
+ const authDir = path$1.dirname(authPath);
125
+ if (!fs$1.existsSync(authDir)) fs$1.mkdirSync(authDir, {
126
+ mode: 504,
127
+ recursive: true
128
+ });
129
+ fs$1.writeFileSync(authPath, JSON.stringify(config, null, 2), { mode: 384 });
130
+ }
131
+ function isValidAccessToken(authConfig) {
132
+ if (!authConfig.token) return false;
133
+ if (typeof authConfig.expiresAt !== "number") return true;
134
+ const nowInSeconds = Math.floor(Date.now() / 1e3);
135
+ return authConfig.expiresAt >= nowInSeconds;
136
+ }
137
+ }));
138
+
139
+ //#endregion
140
+ //#region ../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/oauth.js
141
+ var require_oauth = /* @__PURE__ */ __commonJSMin(((exports, module) => {
142
+ var __defProp = Object.defineProperty;
143
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
144
+ var __getOwnPropNames = Object.getOwnPropertyNames;
145
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
146
+ var __export = (target, all) => {
147
+ for (var name in all) __defProp(target, name, {
148
+ get: all[name],
149
+ enumerable: true
150
+ });
151
+ };
152
+ var __copyProps = (to, from, except, desc) => {
153
+ if (from && typeof from === "object" || typeof from === "function") {
154
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
155
+ get: () => from[key],
156
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
157
+ });
158
+ }
159
+ return to;
160
+ };
161
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
162
+ var oauth_exports = {};
163
+ __export(oauth_exports, {
164
+ processTokenResponse: () => processTokenResponse,
165
+ refreshTokenRequest: () => refreshTokenRequest
166
+ });
167
+ module.exports = __toCommonJS(oauth_exports);
168
+ var import_os = __require("os");
169
+ const VERCEL_ISSUER = "https://vercel.com";
170
+ const VERCEL_CLI_CLIENT_ID = "cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp";
171
+ const userAgent = `@vercel/oidc node-${process.version} ${(0, import_os.platform)()} (${(0, import_os.arch)()}) ${(0, import_os.hostname)()}`;
172
+ let _tokenEndpoint = null;
173
+ async function getTokenEndpoint() {
174
+ if (_tokenEndpoint) return _tokenEndpoint;
175
+ const discoveryUrl = `${VERCEL_ISSUER}/.well-known/openid-configuration`;
176
+ const response = await fetch(discoveryUrl, { headers: { "user-agent": userAgent } });
177
+ if (!response.ok) throw new Error("Failed to discover OAuth endpoints");
178
+ const metadata = await response.json();
179
+ if (!metadata || typeof metadata.token_endpoint !== "string") throw new Error("Invalid OAuth discovery response");
180
+ const endpoint = metadata.token_endpoint;
181
+ _tokenEndpoint = endpoint;
182
+ return endpoint;
183
+ }
184
+ async function refreshTokenRequest(options) {
185
+ const tokenEndpoint = await getTokenEndpoint();
186
+ return await fetch(tokenEndpoint, {
187
+ method: "POST",
188
+ headers: {
189
+ "Content-Type": "application/x-www-form-urlencoded",
190
+ "user-agent": userAgent
191
+ },
192
+ body: new URLSearchParams({
193
+ client_id: VERCEL_CLI_CLIENT_ID,
194
+ grant_type: "refresh_token",
195
+ ...options
196
+ })
197
+ });
198
+ }
199
+ async function processTokenResponse(response) {
200
+ const json = await response.json();
201
+ if (!response.ok) {
202
+ const errorMsg = typeof json === "object" && json && "error" in json ? String(json.error) : "Token refresh failed";
203
+ return [new Error(errorMsg)];
204
+ }
205
+ if (typeof json !== "object" || json === null) return [/* @__PURE__ */ new Error("Invalid token response")];
206
+ if (typeof json.access_token !== "string") return [/* @__PURE__ */ new Error("Missing access_token in response")];
207
+ if (json.token_type !== "Bearer") return [/* @__PURE__ */ new Error("Invalid token_type in response")];
208
+ if (typeof json.expires_in !== "number") return [/* @__PURE__ */ new Error("Missing expires_in in response")];
209
+ return [null, json];
210
+ }
211
+ }));
212
+
213
+ //#endregion
214
+ //#region ../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token-util.js
215
+ var require_token_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
216
+ var __create = Object.create;
217
+ var __defProp = Object.defineProperty;
218
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
219
+ var __getOwnPropNames = Object.getOwnPropertyNames;
220
+ var __getProtoOf = Object.getPrototypeOf;
221
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
222
+ var __export = (target, all) => {
223
+ for (var name in all) __defProp(target, name, {
224
+ get: all[name],
225
+ enumerable: true
226
+ });
227
+ };
228
+ var __copyProps = (to, from, except, desc) => {
229
+ if (from && typeof from === "object" || typeof from === "function") {
230
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
231
+ get: () => from[key],
232
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
233
+ });
234
+ }
235
+ return to;
236
+ };
237
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
238
+ value: mod,
239
+ enumerable: true
240
+ }) : target, mod));
241
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
242
+ var token_util_exports = {};
243
+ __export(token_util_exports, {
244
+ assertVercelOidcTokenResponse: () => assertVercelOidcTokenResponse,
245
+ findProjectInfo: () => findProjectInfo,
246
+ getTokenPayload: () => getTokenPayload,
247
+ getVercelCliToken: () => getVercelCliToken,
248
+ getVercelDataDir: () => getVercelDataDir,
249
+ getVercelOidcToken: () => getVercelOidcToken,
250
+ isExpired: () => isExpired,
251
+ loadToken: () => loadToken,
252
+ saveToken: () => saveToken
253
+ });
254
+ module.exports = __toCommonJS(token_util_exports);
255
+ var path = __toESM(__require("path"));
256
+ var fs = __toESM(__require("fs"));
257
+ var import_token_error = require_token_error();
258
+ var import_token_io = require_token_io();
259
+ var import_auth_config = require_auth_config();
260
+ var import_oauth = require_oauth();
261
+ function getVercelDataDir() {
262
+ const vercelFolder = "com.vercel.cli";
263
+ const dataDir = (0, import_token_io.getUserDataDir)();
264
+ if (!dataDir) return null;
265
+ return path.join(dataDir, vercelFolder);
266
+ }
267
+ async function getVercelCliToken() {
268
+ const authConfig = (0, import_auth_config.readAuthConfig)();
269
+ if (!authConfig) return null;
270
+ if ((0, import_auth_config.isValidAccessToken)(authConfig)) return authConfig.token || null;
271
+ if (!authConfig.refreshToken) {
272
+ (0, import_auth_config.writeAuthConfig)({});
273
+ return null;
274
+ }
275
+ try {
276
+ const tokenResponse = await (0, import_oauth.refreshTokenRequest)({ refresh_token: authConfig.refreshToken });
277
+ const [tokensError, tokens] = await (0, import_oauth.processTokenResponse)(tokenResponse);
278
+ if (tokensError || !tokens) {
279
+ (0, import_auth_config.writeAuthConfig)({});
280
+ return null;
281
+ }
282
+ const updatedConfig = {
283
+ token: tokens.access_token,
284
+ expiresAt: Math.floor(Date.now() / 1e3) + tokens.expires_in
285
+ };
286
+ if (tokens.refresh_token) updatedConfig.refreshToken = tokens.refresh_token;
287
+ (0, import_auth_config.writeAuthConfig)(updatedConfig);
288
+ return updatedConfig.token ?? null;
289
+ } catch (error) {
290
+ (0, import_auth_config.writeAuthConfig)({});
291
+ return null;
292
+ }
293
+ }
294
+ async function getVercelOidcToken(authToken, projectId, teamId) {
295
+ const url = `https://api.vercel.com/v1/projects/${projectId}/token?source=vercel-oidc-refresh${teamId ? `&teamId=${teamId}` : ""}`;
296
+ const res = await fetch(url, {
297
+ method: "POST",
298
+ headers: { Authorization: `Bearer ${authToken}` }
299
+ });
300
+ if (!res.ok) throw new import_token_error.VercelOidcTokenError(`Failed to refresh OIDC token: ${res.statusText}`);
301
+ const tokenRes = await res.json();
302
+ assertVercelOidcTokenResponse(tokenRes);
303
+ return tokenRes;
304
+ }
305
+ function assertVercelOidcTokenResponse(res) {
306
+ if (!res || typeof res !== "object") throw new TypeError("Vercel OIDC token is malformed. Expected an object. Please run `vc env pull` and try again");
307
+ if (!("token" in res) || typeof res.token !== "string") throw new TypeError("Vercel OIDC token is malformed. Expected a string-valued token property. Please run `vc env pull` and try again");
308
+ }
309
+ function findProjectInfo() {
310
+ const dir = (0, import_token_io.findRootDir)();
311
+ if (!dir) throw new import_token_error.VercelOidcTokenError("Unable to find project root directory. Have you linked your project with `vc link?`");
312
+ const prjPath = path.join(dir, ".vercel", "project.json");
313
+ if (!fs.existsSync(prjPath)) throw new import_token_error.VercelOidcTokenError("project.json not found, have you linked your project with `vc link?`");
314
+ const prj = JSON.parse(fs.readFileSync(prjPath, "utf8"));
315
+ if (typeof prj.projectId !== "string" && typeof prj.orgId !== "string") throw new TypeError("Expected a string-valued projectId property. Try running `vc link` to re-link your project.");
316
+ return {
317
+ projectId: prj.projectId,
318
+ teamId: prj.orgId
319
+ };
320
+ }
321
+ function saveToken(token, projectId) {
322
+ const dir = (0, import_token_io.getUserDataDir)();
323
+ if (!dir) throw new import_token_error.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");
324
+ const tokenPath = path.join(dir, "com.vercel.token", `${projectId}.json`);
325
+ const tokenJson = JSON.stringify(token);
326
+ fs.mkdirSync(path.dirname(tokenPath), {
327
+ mode: 504,
328
+ recursive: true
329
+ });
330
+ fs.writeFileSync(tokenPath, tokenJson);
331
+ fs.chmodSync(tokenPath, 432);
332
+ }
333
+ function loadToken(projectId) {
334
+ const dir = (0, import_token_io.getUserDataDir)();
335
+ if (!dir) throw new import_token_error.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");
336
+ const tokenPath = path.join(dir, "com.vercel.token", `${projectId}.json`);
337
+ if (!fs.existsSync(tokenPath)) return null;
338
+ const token = JSON.parse(fs.readFileSync(tokenPath, "utf8"));
339
+ assertVercelOidcTokenResponse(token);
340
+ return token;
341
+ }
342
+ function getTokenPayload(token) {
343
+ const tokenParts = token.split(".");
344
+ if (tokenParts.length !== 3) throw new import_token_error.VercelOidcTokenError("Invalid token. Please run `vc env pull` and try again");
345
+ const base64 = tokenParts[1].replace(/-/g, "+").replace(/_/g, "/");
346
+ const padded = base64.padEnd(base64.length + (4 - base64.length % 4) % 4, "=");
347
+ return JSON.parse(Buffer.from(padded, "base64").toString("utf8"));
348
+ }
349
+ function isExpired(token) {
350
+ return token.exp * 1e3 < Date.now();
351
+ }
352
+ }));
353
+
354
+ //#endregion
355
+ export default require_token_util();
356
+
357
+ export { require_token_util as t };
358
+ //# sourceMappingURL=token-util-1O_mwf8r.js.map