@sentry/mcp-server 0.2.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/LICENSE.md +105 -0
- package/dist/api-client/client.cjs +5 -0
- package/dist/api-client/client.d.cts +5 -0
- package/dist/api-client/client.d.ts +5 -0
- package/dist/api-client/client.js +4 -0
- package/dist/api-client/client.test.cjs +34 -0
- package/dist/api-client/client.test.cjs.map +1 -0
- package/dist/api-client/client.test.d.cts +1 -0
- package/dist/api-client/client.test.d.ts +1 -0
- package/dist/api-client/client.test.js +33 -0
- package/dist/api-client/client.test.js.map +1 -0
- package/dist/api-client/index.cjs +35 -0
- package/dist/api-client/index.d.cts +6 -0
- package/dist/api-client/index.d.ts +6 -0
- package/dist/api-client/index.js +6 -0
- package/dist/api-client/schema.cjs +30 -0
- package/dist/api-client/schema.d.cts +3 -0
- package/dist/api-client/schema.d.ts +3 -0
- package/dist/api-client/schema.js +3 -0
- package/dist/api-client/types.cjs +1 -0
- package/dist/api-client/types.d.cts +4 -0
- package/dist/api-client/types.d.ts +4 -0
- package/dist/api-client/types.js +1 -0
- package/dist/api-client-9mzrj2HY.js +0 -0
- package/dist/api-client-CEBuz3Zu.cjs +0 -0
- package/dist/chunk-BtT13l48.cjs +40 -0
- package/dist/chunk-CsIcISPO.js +30 -0
- package/dist/client-BlG0jPGS.cjs +206 -0
- package/dist/client-BlG0jPGS.cjs.map +1 -0
- package/dist/client-D1XjYhij.js +194 -0
- package/dist/client-D1XjYhij.js.map +1 -0
- package/dist/client.d-B8RB2Poz.d.ts +108 -0
- package/dist/client.d-B8RB2Poz.d.ts.map +1 -0
- package/dist/client.d-CXQCEkJz.d.cts +108 -0
- package/dist/dist-B914BQU9.cjs +8043 -0
- package/dist/dist-B914BQU9.cjs.map +1 -0
- package/dist/dist-DJoL0rVQ.js +7899 -0
- package/dist/dist-DJoL0rVQ.js.map +1 -0
- package/dist/formatting-BTSvl7n7.cjs +41 -0
- package/dist/formatting-BTSvl7n7.cjs.map +1 -0
- package/dist/formatting-Bacfde0I.js +28 -0
- package/dist/formatting-Bacfde0I.js.map +1 -0
- package/dist/index.cjs +52 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d-Cb-lHGvn.d.cts +1 -0
- package/dist/index.d-Db2MND9s.d.ts +1 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +50 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/formatting.cjs +4 -0
- package/dist/internal/formatting.d.cts +13 -0
- package/dist/internal/formatting.d.ts +13 -0
- package/dist/internal/formatting.d.ts.map +1 -0
- package/dist/internal/formatting.js +3 -0
- package/dist/internal/issue-helpers.cjs +3 -0
- package/dist/internal/issue-helpers.d.cts +16 -0
- package/dist/internal/issue-helpers.d.ts +16 -0
- package/dist/internal/issue-helpers.d.ts.map +1 -0
- package/dist/internal/issue-helpers.js +3 -0
- package/dist/internal/issue-helpers.test.cjs +74 -0
- package/dist/internal/issue-helpers.test.cjs.map +1 -0
- package/dist/internal/issue-helpers.test.d.cts +1 -0
- package/dist/internal/issue-helpers.test.d.ts +1 -0
- package/dist/internal/issue-helpers.test.js +73 -0
- package/dist/internal/issue-helpers.test.js.map +1 -0
- package/dist/issue-helpers-C0kEdXOE.cjs +39 -0
- package/dist/issue-helpers-C0kEdXOE.cjs.map +1 -0
- package/dist/issue-helpers-DFde36Zu.js +32 -0
- package/dist/issue-helpers-DFde36Zu.js.map +1 -0
- package/dist/logging-BEMgC5SA.cjs +32 -0
- package/dist/logging-BEMgC5SA.cjs.map +1 -0
- package/dist/logging-Cxm8lQvg.js +25 -0
- package/dist/logging-Cxm8lQvg.js.map +1 -0
- package/dist/logging.cjs +3 -0
- package/dist/logging.d.cts +7 -0
- package/dist/logging.d.ts +7 -0
- package/dist/logging.d.ts.map +1 -0
- package/dist/logging.js +3 -0
- package/dist/magic-string.es-COkPNEcb.cjs +1017 -0
- package/dist/magic-string.es-COkPNEcb.cjs.map +1 -0
- package/dist/magic-string.es-qySpjS4V.js +1015 -0
- package/dist/magic-string.es-qySpjS4V.js.map +1 -0
- package/dist/promptDefinitions-CVB4IyVf.cjs +23 -0
- package/dist/promptDefinitions-CVB4IyVf.cjs.map +1 -0
- package/dist/promptDefinitions-CaRMCDPI.js +16 -0
- package/dist/promptDefinitions-CaRMCDPI.js.map +1 -0
- package/dist/promptDefinitions.cjs +4 -0
- package/dist/promptDefinitions.d-X_QALSRc.d.cts +15 -0
- package/dist/promptDefinitions.d-qzT7TH_Z.d.ts +15 -0
- package/dist/promptDefinitions.d-qzT7TH_Z.d.ts.map +1 -0
- package/dist/promptDefinitions.d.cts +3 -0
- package/dist/promptDefinitions.d.ts +3 -0
- package/dist/promptDefinitions.js +4 -0
- package/dist/prompts--QCiXmR2.cjs +26 -0
- package/dist/prompts--QCiXmR2.cjs.map +1 -0
- package/dist/prompts-Tz-qECa0.js +19 -0
- package/dist/prompts-Tz-qECa0.js.map +1 -0
- package/dist/prompts.cjs +3 -0
- package/dist/prompts.d.cts +19 -0
- package/dist/prompts.d.ts +19 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/prompts.js +3 -0
- package/dist/resources-BAE7VVZZ.cjs +33 -0
- package/dist/resources-BAE7VVZZ.cjs.map +1 -0
- package/dist/resources-OM3EAnnj.js +26 -0
- package/dist/resources-OM3EAnnj.js.map +1 -0
- package/dist/resources.cjs +3 -0
- package/dist/resources.d.cts +15 -0
- package/dist/resources.d.ts +15 -0
- package/dist/resources.d.ts.map +1 -0
- package/dist/resources.js +3 -0
- package/dist/schema-BvloqMHW.cjs +57 -0
- package/dist/schema-BvloqMHW.cjs.map +1 -0
- package/dist/schema-Bvva80Pn.js +223 -0
- package/dist/schema-Bvva80Pn.js.map +1 -0
- package/dist/schema-CyHM0GZH.cjs +392 -0
- package/dist/schema-CyHM0GZH.cjs.map +1 -0
- package/dist/schema-k04PdSCK.js +14 -0
- package/dist/schema-k04PdSCK.js.map +1 -0
- package/dist/schema.cjs +9 -0
- package/dist/schema.d-BDStOeMD.d.cts +4978 -0
- package/dist/schema.d-Oa2HQQCX.d.ts +4978 -0
- package/dist/schema.d-Oa2HQQCX.d.ts.map +1 -0
- package/dist/schema.d.cts +14 -0
- package/dist/schema.d.ts +14 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +3 -0
- package/dist/server-DY8wjV9H.cjs +110 -0
- package/dist/server-DY8wjV9H.cjs.map +1 -0
- package/dist/server-DuRPgdH4.js +103 -0
- package/dist/server-DuRPgdH4.js.map +1 -0
- package/dist/server.cjs +16 -0
- package/dist/server.d.cts +15 -0
- package/dist/server.d.ts +15 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +16 -0
- package/dist/stdio-CSJMThag.cjs +23 -0
- package/dist/stdio-CSJMThag.cjs.map +1 -0
- package/dist/stdio-Ce5DHKZ4.js +16 -0
- package/dist/stdio-Ce5DHKZ4.js.map +1 -0
- package/dist/test-setup.cjs +18648 -0
- package/dist/test-setup.cjs.map +1 -0
- package/dist/test-setup.d.cts +1 -0
- package/dist/test-setup.d.ts +1 -0
- package/dist/test-setup.js +18647 -0
- package/dist/test-setup.js.map +1 -0
- package/dist/toolDefinitions-CMNKyt4H.js +400 -0
- package/dist/toolDefinitions-CMNKyt4H.js.map +1 -0
- package/dist/toolDefinitions-DS7wXdsP.cjs +407 -0
- package/dist/toolDefinitions-DS7wXdsP.cjs.map +1 -0
- package/dist/toolDefinitions.cjs +4 -0
- package/dist/toolDefinitions.d-CIXKiX81.d.cts +252 -0
- package/dist/toolDefinitions.d-DkYVHG7Y.d.ts +252 -0
- package/dist/toolDefinitions.d-DkYVHG7Y.d.ts.map +1 -0
- package/dist/toolDefinitions.d.cts +3 -0
- package/dist/toolDefinitions.d.ts +3 -0
- package/dist/toolDefinitions.js +4 -0
- package/dist/toolDefinitions.test.cjs +16 -0
- package/dist/toolDefinitions.test.cjs.map +1 -0
- package/dist/toolDefinitions.test.d.cts +1 -0
- package/dist/toolDefinitions.test.d.ts +1 -0
- package/dist/toolDefinitions.test.js +15 -0
- package/dist/toolDefinitions.test.js.map +1 -0
- package/dist/tools-BfTTqLNG.cjs +461 -0
- package/dist/tools-BfTTqLNG.cjs.map +1 -0
- package/dist/tools-qkapmf3p.js +455 -0
- package/dist/tools-qkapmf3p.js.map +1 -0
- package/dist/tools.cjs +10 -0
- package/dist/tools.d.cts +207 -0
- package/dist/tools.d.ts +207 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +10 -0
- package/dist/tools.test.cjs +845 -0
- package/dist/tools.test.cjs.map +1 -0
- package/dist/tools.test.d.cts +1 -0
- package/dist/tools.test.d.ts +1 -0
- package/dist/tools.test.js +844 -0
- package/dist/tools.test.js.map +1 -0
- package/dist/transports/stdio.cjs +17 -0
- package/dist/transports/stdio.d.cts +11 -0
- package/dist/transports/stdio.d.ts +11 -0
- package/dist/transports/stdio.d.ts.map +1 -0
- package/dist/transports/stdio.js +17 -0
- package/dist/types-H-TSmRpm.js +0 -0
- package/dist/types-o3zWarRp.cjs +0 -0
- package/dist/types.cjs +0 -0
- package/dist/types.d-B8gSnrcY.d.cts +43 -0
- package/dist/types.d-BDS-6_Sj.d.cts +25 -0
- package/dist/types.d-Bfi1CpIf.d.ts +25 -0
- package/dist/types.d-Bfi1CpIf.d.ts.map +1 -0
- package/dist/types.d-Bj1fPi3b.d.ts +43 -0
- package/dist/types.d-Bj1fPi3b.d.ts.map +1 -0
- package/dist/types.d.cts +5 -0
- package/dist/types.d.ts +5 -0
- package/dist/types.js +0 -0
- package/dist/vi.ClIskdbk-BhK8y4UO.cjs +6294 -0
- package/dist/vi.ClIskdbk-BhK8y4UO.cjs.map +1 -0
- package/dist/vi.ClIskdbk-CiLaali_.js +6279 -0
- package/dist/vi.ClIskdbk-CiLaali_.js.map +1 -0
- package/package.json +77 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
//#region src/internal/formatting.ts
|
|
4
|
+
function formatFrameHeader(frame, platform) {
|
|
5
|
+
if (platform?.startsWith("javascript")) return `${[
|
|
6
|
+
frame.filename,
|
|
7
|
+
frame.lineNo,
|
|
8
|
+
frame.colNo
|
|
9
|
+
].filter((i) => !!i).join(":")}${frame.function ? ` (${frame.function})` : ""}`;
|
|
10
|
+
return `${frame.function ? `"${frame.function}"` : "unknown function"} in "${frame.filename || frame.module}"${frame.lineNo ? ` at line ${frame.lineNo}${frame.colNo !== null ? `:${frame.colNo}` : ""}` : ""}`;
|
|
11
|
+
}
|
|
12
|
+
function formatEventOutput(event) {
|
|
13
|
+
let output = "";
|
|
14
|
+
for (const entry of event.entries) if (entry.type === "exception") {
|
|
15
|
+
const data = entry.data;
|
|
16
|
+
const firstError = data.value ?? data.values[0];
|
|
17
|
+
if (!firstError) continue;
|
|
18
|
+
output += `**Error:**\n\`\`\`\n${firstError.type}: ${firstError.value}\n\`\`\`\n\n`;
|
|
19
|
+
if (!firstError.stacktrace || !firstError.stacktrace.frames) continue;
|
|
20
|
+
output += `**Stacktrace:**\n\`\`\`\n${firstError.stacktrace.frames.map((frame) => {
|
|
21
|
+
const context = frame.context?.length ? `${frame.context.filter(([lineno, _]) => lineno === frame.lineNo).map(([_, code]) => `\n${code}`).join("")}` : "";
|
|
22
|
+
return `${formatFrameHeader(frame, event.platform)}${context}`;
|
|
23
|
+
}).join("\n")}\n\`\`\`\n\n`;
|
|
24
|
+
}
|
|
25
|
+
return output;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
Object.defineProperty(exports, 'formatEventOutput', {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () {
|
|
32
|
+
return formatEventOutput;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
Object.defineProperty(exports, 'formatFrameHeader', {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: function () {
|
|
38
|
+
return formatFrameHeader;
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=formatting-BTSvl7n7.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatting-BTSvl7n7.cjs","names":["frame: z.infer<typeof FrameInterface>","platform: string | undefined | null","event: Event"],"sources":["../src/internal/formatting.ts"],"sourcesContent":["import type { z } from \"zod\";\nimport type { Event } from \"../api-client/types\";\nimport type { ErrorEntrySchema, FrameInterface } from \"../api-client\";\n\nexport function formatFrameHeader(\n frame: z.infer<typeof FrameInterface>,\n platform: string | undefined | null,\n) {\n if (platform?.startsWith(\"javascript\")) {\n return `${[frame.filename, frame.lineNo, frame.colNo]\n .filter((i) => !!i)\n .join(\":\")}${frame.function ? ` (${frame.function})` : \"\"}`;\n }\n return `${frame.function ? `\"${frame.function}\"` : \"unknown function\"} in \"${frame.filename || frame.module}\"${\n frame.lineNo\n ? ` at line ${frame.lineNo}${frame.colNo !== null ? `:${frame.colNo}` : \"\"}`\n : \"\"\n }`;\n}\n\nexport function formatEventOutput(event: Event) {\n let output = \"\";\n for (const entry of event.entries) {\n if (entry.type === \"exception\") {\n const data = entry.data as z.infer<typeof ErrorEntrySchema>;\n const firstError = data.value ?? data.values[0];\n if (!firstError) {\n continue;\n }\n output += `**Error:**\\n${\"```\"}\\n${firstError.type}: ${\n firstError.value\n }\\n${\"```\"}\\n\\n`;\n if (!firstError.stacktrace || !firstError.stacktrace.frames) {\n continue;\n }\n output += `**Stacktrace:**\\n${\"```\"}\\n${firstError.stacktrace.frames\n .map((frame) => {\n const context = frame.context?.length\n ? `${frame.context\n .filter(([lineno, _]) => lineno === frame.lineNo)\n .map(([_, code]) => `\\n${code}`)\n .join(\"\")}`\n : \"\";\n\n return `${formatFrameHeader(frame, event.platform)}${context}`;\n })\n .join(\"\\n\")}\\n${\"```\"}\\n\\n`;\n }\n }\n return output;\n}\n"],"mappings":";;;AAIA,SAAgB,kBACdA,OACAC,UACA;AACA,KAAI,UAAU,WAAW,aAAa,CACpC,SAAQ,EAAE;EAAC,MAAM;EAAU,MAAM;EAAQ,MAAM;CAAM,EAClD,OAAO,CAAC,QAAQ,EAAE,CAClB,KAAK,IAAI,CAAC,EAAE,MAAM,YAAY,IAAI,MAAM,SAAS,KAAK,GAAG;AAE9D,SAAQ,EAAE,MAAM,YAAY,GAAG,MAAM,SAAS,KAAK,mBAAmB,OAAO,MAAM,YAAY,MAAM,OAAO,GAC1G,MAAM,UACD,WAAW,MAAM,OAAO,EAAE,MAAM,UAAU,QAAQ,GAAG,MAAM,MAAM,IAAI,GAAG,IACzE,GACL;AACF;AAED,SAAgB,kBAAkBC,OAAc;CAC9C,IAAI,SAAS;AACb,MAAK,MAAM,SAAS,MAAM,QACxB,KAAI,MAAM,SAAS,aAAa;EAC9B,MAAM,OAAO,MAAM;EACnB,MAAM,aAAa,KAAK,SAAS,KAAK,OAAO;AAC7C,OAAK,WACH;AAEF,aAAW,sBAAwB,WAAW,KAAK,IACjD,WAAW,MACZ;AACD,OAAK,WAAW,eAAe,WAAW,WAAW,OACnD;AAEF,aAAW,2BAA6B,WAAW,WAAW,OAC3D,IAAI,CAAC,UAAU;GACd,MAAM,UAAU,MAAM,SAAS,UAC1B,EAAE,MAAM,QACN,OAAO,CAAC,CAAC,QAAQ,EAAE,KAAK,WAAW,MAAM,OAAO,CAChD,IAAI,CAAC,CAAC,GAAG,KAAK,MAAM,IAAI,KAAK,EAAE,CAC/B,KAAK,GAAG,CAAC,IACZ;AAEJ,WAAQ,EAAE,kBAAkB,OAAO,MAAM,SAAS,CAAC,EAAE,QAAQ;EAC9D,EAAC,CACD,KAAK,KAAK,CAAC;CACf;AAEH,QAAO;AACR"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region src/internal/formatting.ts
|
|
2
|
+
function formatFrameHeader(frame, platform) {
|
|
3
|
+
if (platform?.startsWith("javascript")) return `${[
|
|
4
|
+
frame.filename,
|
|
5
|
+
frame.lineNo,
|
|
6
|
+
frame.colNo
|
|
7
|
+
].filter((i) => !!i).join(":")}${frame.function ? ` (${frame.function})` : ""}`;
|
|
8
|
+
return `${frame.function ? `"${frame.function}"` : "unknown function"} in "${frame.filename || frame.module}"${frame.lineNo ? ` at line ${frame.lineNo}${frame.colNo !== null ? `:${frame.colNo}` : ""}` : ""}`;
|
|
9
|
+
}
|
|
10
|
+
function formatEventOutput(event) {
|
|
11
|
+
let output = "";
|
|
12
|
+
for (const entry of event.entries) if (entry.type === "exception") {
|
|
13
|
+
const data = entry.data;
|
|
14
|
+
const firstError = data.value ?? data.values[0];
|
|
15
|
+
if (!firstError) continue;
|
|
16
|
+
output += `**Error:**\n\`\`\`\n${firstError.type}: ${firstError.value}\n\`\`\`\n\n`;
|
|
17
|
+
if (!firstError.stacktrace || !firstError.stacktrace.frames) continue;
|
|
18
|
+
output += `**Stacktrace:**\n\`\`\`\n${firstError.stacktrace.frames.map((frame) => {
|
|
19
|
+
const context = frame.context?.length ? `${frame.context.filter(([lineno, _]) => lineno === frame.lineNo).map(([_, code]) => `\n${code}`).join("")}` : "";
|
|
20
|
+
return `${formatFrameHeader(frame, event.platform)}${context}`;
|
|
21
|
+
}).join("\n")}\n\`\`\`\n\n`;
|
|
22
|
+
}
|
|
23
|
+
return output;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
export { formatEventOutput, formatFrameHeader };
|
|
28
|
+
//# sourceMappingURL=formatting-Bacfde0I.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatting-Bacfde0I.js","names":["frame: z.infer<typeof FrameInterface>","platform: string | undefined | null","event: Event"],"sources":["../src/internal/formatting.ts"],"sourcesContent":["import type { z } from \"zod\";\nimport type { Event } from \"../api-client/types\";\nimport type { ErrorEntrySchema, FrameInterface } from \"../api-client\";\n\nexport function formatFrameHeader(\n frame: z.infer<typeof FrameInterface>,\n platform: string | undefined | null,\n) {\n if (platform?.startsWith(\"javascript\")) {\n return `${[frame.filename, frame.lineNo, frame.colNo]\n .filter((i) => !!i)\n .join(\":\")}${frame.function ? ` (${frame.function})` : \"\"}`;\n }\n return `${frame.function ? `\"${frame.function}\"` : \"unknown function\"} in \"${frame.filename || frame.module}\"${\n frame.lineNo\n ? ` at line ${frame.lineNo}${frame.colNo !== null ? `:${frame.colNo}` : \"\"}`\n : \"\"\n }`;\n}\n\nexport function formatEventOutput(event: Event) {\n let output = \"\";\n for (const entry of event.entries) {\n if (entry.type === \"exception\") {\n const data = entry.data as z.infer<typeof ErrorEntrySchema>;\n const firstError = data.value ?? data.values[0];\n if (!firstError) {\n continue;\n }\n output += `**Error:**\\n${\"```\"}\\n${firstError.type}: ${\n firstError.value\n }\\n${\"```\"}\\n\\n`;\n if (!firstError.stacktrace || !firstError.stacktrace.frames) {\n continue;\n }\n output += `**Stacktrace:**\\n${\"```\"}\\n${firstError.stacktrace.frames\n .map((frame) => {\n const context = frame.context?.length\n ? `${frame.context\n .filter(([lineno, _]) => lineno === frame.lineNo)\n .map(([_, code]) => `\\n${code}`)\n .join(\"\")}`\n : \"\";\n\n return `${formatFrameHeader(frame, event.platform)}${context}`;\n })\n .join(\"\\n\")}\\n${\"```\"}\\n\\n`;\n }\n }\n return output;\n}\n"],"mappings":";AAIA,SAAgB,kBACdA,OACAC,UACA;AACA,KAAI,UAAU,WAAW,aAAa,CACpC,SAAQ,EAAE;EAAC,MAAM;EAAU,MAAM;EAAQ,MAAM;CAAM,EAClD,OAAO,CAAC,QAAQ,EAAE,CAClB,KAAK,IAAI,CAAC,EAAE,MAAM,YAAY,IAAI,MAAM,SAAS,KAAK,GAAG;AAE9D,SAAQ,EAAE,MAAM,YAAY,GAAG,MAAM,SAAS,KAAK,mBAAmB,OAAO,MAAM,YAAY,MAAM,OAAO,GAC1G,MAAM,UACD,WAAW,MAAM,OAAO,EAAE,MAAM,UAAU,QAAQ,GAAG,MAAM,MAAM,IAAI,GAAG,IACzE,GACL;AACF;AAED,SAAgB,kBAAkBC,OAAc;CAC9C,IAAI,SAAS;AACb,MAAK,MAAM,SAAS,MAAM,QACxB,KAAI,MAAM,SAAS,aAAa;EAC9B,MAAM,OAAO,MAAM;EACnB,MAAM,aAAa,KAAK,SAAS,KAAK,OAAO;AAC7C,OAAK,WACH;AAEF,aAAW,sBAAwB,WAAW,KAAK,IACjD,WAAW,MACZ;AACD,OAAK,WAAW,eAAe,WAAW,WAAW,OACnD;AAEF,aAAW,2BAA6B,WAAW,WAAW,OAC3D,IAAI,CAAC,UAAU;GACd,MAAM,UAAU,MAAM,SAAS,UAC1B,EAAE,MAAM,QACN,OAAO,CAAC,CAAC,QAAQ,EAAE,KAAK,WAAW,MAAM,OAAO,CAChD,IAAI,CAAC,CAAC,GAAG,KAAK,MAAM,IAAI,KAAK,EAAE,CAC/B,KAAK,GAAG,CAAC,IACZ;AAEJ,WAAQ,EAAE,kBAAkB,OAAO,MAAM,SAAS,CAAC,EAAE,QAAQ;EAC9D,EAAC,CACD,KAAK,KAAK,CAAC;CACf;AAEH,QAAO;AACR"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
const require_chunk = require('./chunk-BtT13l48.cjs');
|
|
4
|
+
require('./schema-CyHM0GZH.cjs');
|
|
5
|
+
require('./client-BlG0jPGS.cjs');
|
|
6
|
+
require('./types-o3zWarRp.cjs');
|
|
7
|
+
require('./api-client-CEBuz3Zu.cjs');
|
|
8
|
+
require('./formatting-BTSvl7n7.cjs');
|
|
9
|
+
require('./issue-helpers-C0kEdXOE.cjs');
|
|
10
|
+
require('./logging-BEMgC5SA.cjs');
|
|
11
|
+
require('./tools-BfTTqLNG.cjs');
|
|
12
|
+
require('./schema-BvloqMHW.cjs');
|
|
13
|
+
require('./toolDefinitions-DS7wXdsP.cjs');
|
|
14
|
+
require('./resources-BAE7VVZZ.cjs');
|
|
15
|
+
require('./promptDefinitions-CVB4IyVf.cjs');
|
|
16
|
+
require('./prompts--QCiXmR2.cjs');
|
|
17
|
+
require('./server-DY8wjV9H.cjs');
|
|
18
|
+
const require_stdio = require('./stdio-CSJMThag.cjs');
|
|
19
|
+
const __modelcontextprotocol_sdk_server_mcp_js = require_chunk.__toESM(require("@modelcontextprotocol/sdk/server/mcp.js"));
|
|
20
|
+
const __sentry_core = require_chunk.__toESM(require("@sentry/core"));
|
|
21
|
+
|
|
22
|
+
//#region src/index.ts
|
|
23
|
+
let accessToken = process.env.SENTRY_AUTH_TOKEN;
|
|
24
|
+
let host = process.env.SENTRY_HOST;
|
|
25
|
+
for (const arg of process.argv.slice(2)) if (arg.startsWith("--access-token=")) accessToken = arg.split("=")[1];
|
|
26
|
+
else if (arg.startsWith("--host=")) host = arg.split("=")[1];
|
|
27
|
+
else {
|
|
28
|
+
console.error("Invalid argument:", arg);
|
|
29
|
+
console.error("Usage: start-stdio --access-token=<token> [--host=<host>]");
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
if (!accessToken) {
|
|
33
|
+
console.error("SENTRY_AUTH_TOKEN is not set");
|
|
34
|
+
console.error("Usage: start-stdio --access-token=<token> [--host=<host>]");
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
const server = new __modelcontextprotocol_sdk_server_mcp_js.McpServer({
|
|
38
|
+
name: "Sentry MCP",
|
|
39
|
+
version: "0.1.0"
|
|
40
|
+
});
|
|
41
|
+
const instrumentedServer = (0, __sentry_core.wrapMcpServerWithSentry)(server);
|
|
42
|
+
require_stdio.startStdio(instrumentedServer, {
|
|
43
|
+
accessToken,
|
|
44
|
+
organizationSlug: null,
|
|
45
|
+
host
|
|
46
|
+
}).catch((err) => {
|
|
47
|
+
console.error("Server error:", err);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["accessToken: string | undefined","host: string | undefined","McpServer"],"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { startStdio } from \"./transports/stdio\";\nimport { wrapMcpServerWithSentry } from \"@sentry/core\";\n\nlet accessToken: string | undefined = process.env.SENTRY_AUTH_TOKEN;\nlet host: string | undefined = process.env.SENTRY_HOST;\n\nfor (const arg of process.argv.slice(2)) {\n if (arg.startsWith(\"--access-token=\")) {\n accessToken = arg.split(\"=\")[1];\n } else if (arg.startsWith(\"--host=\")) {\n host = arg.split(\"=\")[1];\n } else {\n console.error(\"Invalid argument:\", arg);\n console.error(\"Usage: start-stdio --access-token=<token> [--host=<host>]\");\n process.exit(1);\n }\n}\n\nif (!accessToken) {\n console.error(\"SENTRY_AUTH_TOKEN is not set\");\n console.error(\"Usage: start-stdio --access-token=<token> [--host=<host>]\");\n process.exit(1);\n}\n\nconst server = new McpServer({\n name: \"Sentry MCP\",\n version: \"0.1.0\",\n});\n\nconst instrumentedServer = wrapMcpServerWithSentry(server);\n\n// XXX: we could do what we're doing in routes/auth.ts and pass the context\n// identically, but we don't really need userId and userName yet\nstartStdio(instrumentedServer, {\n accessToken,\n organizationSlug: null,\n host,\n}).catch((err) => {\n console.error(\"Server error:\", err);\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAMA,IAAIA,cAAkC,QAAQ,IAAI;AAClD,IAAIC,OAA2B,QAAQ,IAAI;AAE3C,KAAK,MAAM,OAAO,QAAQ,KAAK,MAAM,EAAE,CACrC,KAAI,IAAI,WAAW,kBAAkB,CACnC,eAAc,IAAI,MAAM,IAAI,CAAC;SACpB,IAAI,WAAW,UAAU,CAClC,QAAO,IAAI,MAAM,IAAI,CAAC;KACjB;AACL,SAAQ,MAAM,qBAAqB,IAAI;AACvC,SAAQ,MAAM,4DAA4D;AAC1E,SAAQ,KAAK,EAAE;AAChB;AAGH,KAAK,aAAa;AAChB,SAAQ,MAAM,+BAA+B;AAC7C,SAAQ,MAAM,4DAA4D;AAC1E,SAAQ,KAAK,EAAE;AAChB;AAED,MAAM,SAAS,IAAIC,mDAAU;CAC3B,MAAM;CACN,SAAS;AACV;AAED,MAAM,qBAAqB,2CAAwB,OAAO;AAI1D,yBAAW,oBAAoB;CAC7B;CACA,kBAAkB;CAClB;AACD,EAAC,CAAC,MAAM,CAAC,QAAQ;AAChB,SAAQ,MAAM,iBAAiB,IAAI;AACnC,SAAQ,KAAK,EAAE;AAChB,EAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import "./schema-Bvva80Pn.js";
|
|
3
|
+
import "./client-D1XjYhij.js";
|
|
4
|
+
import "./types-H-TSmRpm.js";
|
|
5
|
+
import "./api-client-9mzrj2HY.js";
|
|
6
|
+
import "./formatting-Bacfde0I.js";
|
|
7
|
+
import "./issue-helpers-DFde36Zu.js";
|
|
8
|
+
import "./logging-Cxm8lQvg.js";
|
|
9
|
+
import "./tools-qkapmf3p.js";
|
|
10
|
+
import "./schema-k04PdSCK.js";
|
|
11
|
+
import "./toolDefinitions-CMNKyt4H.js";
|
|
12
|
+
import "./resources-OM3EAnnj.js";
|
|
13
|
+
import "./promptDefinitions-CaRMCDPI.js";
|
|
14
|
+
import "./prompts-Tz-qECa0.js";
|
|
15
|
+
import "./server-DuRPgdH4.js";
|
|
16
|
+
import { startStdio } from "./stdio-Ce5DHKZ4.js";
|
|
17
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
18
|
+
import { wrapMcpServerWithSentry } from "@sentry/core";
|
|
19
|
+
|
|
20
|
+
//#region src/index.ts
|
|
21
|
+
let accessToken = process.env.SENTRY_AUTH_TOKEN;
|
|
22
|
+
let host = process.env.SENTRY_HOST;
|
|
23
|
+
for (const arg of process.argv.slice(2)) if (arg.startsWith("--access-token=")) accessToken = arg.split("=")[1];
|
|
24
|
+
else if (arg.startsWith("--host=")) host = arg.split("=")[1];
|
|
25
|
+
else {
|
|
26
|
+
console.error("Invalid argument:", arg);
|
|
27
|
+
console.error("Usage: start-stdio --access-token=<token> [--host=<host>]");
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
if (!accessToken) {
|
|
31
|
+
console.error("SENTRY_AUTH_TOKEN is not set");
|
|
32
|
+
console.error("Usage: start-stdio --access-token=<token> [--host=<host>]");
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
const server = new McpServer({
|
|
36
|
+
name: "Sentry MCP",
|
|
37
|
+
version: "0.1.0"
|
|
38
|
+
});
|
|
39
|
+
const instrumentedServer = wrapMcpServerWithSentry(server);
|
|
40
|
+
startStdio(instrumentedServer, {
|
|
41
|
+
accessToken,
|
|
42
|
+
organizationSlug: null,
|
|
43
|
+
host
|
|
44
|
+
}).catch((err) => {
|
|
45
|
+
console.error("Server error:", err);
|
|
46
|
+
process.exit(1);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["accessToken: string | undefined","host: string | undefined"],"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { startStdio } from \"./transports/stdio\";\nimport { wrapMcpServerWithSentry } from \"@sentry/core\";\n\nlet accessToken: string | undefined = process.env.SENTRY_AUTH_TOKEN;\nlet host: string | undefined = process.env.SENTRY_HOST;\n\nfor (const arg of process.argv.slice(2)) {\n if (arg.startsWith(\"--access-token=\")) {\n accessToken = arg.split(\"=\")[1];\n } else if (arg.startsWith(\"--host=\")) {\n host = arg.split(\"=\")[1];\n } else {\n console.error(\"Invalid argument:\", arg);\n console.error(\"Usage: start-stdio --access-token=<token> [--host=<host>]\");\n process.exit(1);\n }\n}\n\nif (!accessToken) {\n console.error(\"SENTRY_AUTH_TOKEN is not set\");\n console.error(\"Usage: start-stdio --access-token=<token> [--host=<host>]\");\n process.exit(1);\n}\n\nconst server = new McpServer({\n name: \"Sentry MCP\",\n version: \"0.1.0\",\n});\n\nconst instrumentedServer = wrapMcpServerWithSentry(server);\n\n// XXX: we could do what we're doing in routes/auth.ts and pass the context\n// identically, but we don't really need userId and userName yet\nstartStdio(instrumentedServer, {\n accessToken,\n organizationSlug: null,\n host,\n}).catch((err) => {\n console.error(\"Server error:\", err);\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAMA,IAAIA,cAAkC,QAAQ,IAAI;AAClD,IAAIC,OAA2B,QAAQ,IAAI;AAE3C,KAAK,MAAM,OAAO,QAAQ,KAAK,MAAM,EAAE,CACrC,KAAI,IAAI,WAAW,kBAAkB,CACnC,eAAc,IAAI,MAAM,IAAI,CAAC;SACpB,IAAI,WAAW,UAAU,CAClC,QAAO,IAAI,MAAM,IAAI,CAAC;KACjB;AACL,SAAQ,MAAM,qBAAqB,IAAI;AACvC,SAAQ,MAAM,4DAA4D;AAC1E,SAAQ,KAAK,EAAE;AAChB;AAGH,KAAK,aAAa;AAChB,SAAQ,MAAM,+BAA+B;AAC7C,SAAQ,MAAM,4DAA4D;AAC1E,SAAQ,KAAK,EAAE;AAChB;AAED,MAAM,SAAS,IAAI,UAAU;CAC3B,MAAM;CACN,SAAS;AACV;AAED,MAAM,qBAAqB,wBAAwB,OAAO;AAI1D,WAAW,oBAAoB;CAC7B;CACA,kBAAkB;CAClB;AACD,EAAC,CAAC,MAAM,CAAC,QAAQ;AAChB,SAAQ,MAAM,iBAAiB,IAAI;AACnC,SAAQ,KAAK,EAAE;AAChB,EAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FrameInterface } from "../schema.d-BDStOeMD.cjs";
|
|
2
|
+
import { Event } from "../types.d-BDS-6_Sj.cjs";
|
|
3
|
+
import "../client.d-CXQCEkJz.cjs";
|
|
4
|
+
import "../index.d-Cb-lHGvn.cjs";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
|
|
7
|
+
//#region src/internal/formatting.d.ts
|
|
8
|
+
declare function formatFrameHeader(frame: z.infer<typeof FrameInterface>, platform: string | undefined | null): string;
|
|
9
|
+
declare function formatEventOutput(event: Event): string;
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { formatEventOutput, formatFrameHeader };
|
|
13
|
+
//# sourceMappingURL=formatting.d.cts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FrameInterface$1 as FrameInterface } from "../schema.d-Oa2HQQCX.js";
|
|
2
|
+
import { Event } from "../types.d-Bfi1CpIf.js";
|
|
3
|
+
import "../client.d-B8RB2Poz.js";
|
|
4
|
+
import "../index.d-Db2MND9s.js";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
|
|
7
|
+
//#region src/internal/formatting.d.ts
|
|
8
|
+
declare function formatFrameHeader(frame: z.infer<typeof FrameInterface>, platform: string | undefined | null): string;
|
|
9
|
+
declare function formatEventOutput(event: Event): string;
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { formatEventOutput, formatFrameHeader };
|
|
13
|
+
//# sourceMappingURL=formatting.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatting.d.ts","names":[],"sources":["../../src/internal/formatting.d.ts"],"sourcesContent":["import type { z } from \"zod\";\nimport type { Event } from \"../api-client/types\";\nimport type { FrameInterface } from \"../api-client\";\nexport declare function formatFrameHeader(frame: z.infer<typeof FrameInterface>, platform: string | undefined | null): string;\nexport declare function formatEventOutput(event: Event): string;\n//# sourceMappingURL=formatting.d.ts.map"],"mappings":";;;;;;;AAGA,IAAW,oBAAoB;CAAC;CAAI,MAAM;CAAgB,MAAM,EAAE;AAAM;AACxE,IAAW,oBAAoB,CAAC,IAAI,MAAM,KAAM"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/internal/issue-helpers.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Extracts the Sentry issue ID and organization slug from a full URL
|
|
4
|
+
*
|
|
5
|
+
* @param url - A full Sentry issue URL
|
|
6
|
+
* @returns Object containing the numeric issue ID and organization slug (if found)
|
|
7
|
+
* @throws Error if the input is invalid
|
|
8
|
+
*/
|
|
9
|
+
declare function extractIssueId(url: string): {
|
|
10
|
+
issueId: string;
|
|
11
|
+
organizationSlug: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { extractIssueId };
|
|
16
|
+
//# sourceMappingURL=issue-helpers.d.cts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/internal/issue-helpers.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Extracts the Sentry issue ID and organization slug from a full URL
|
|
4
|
+
*
|
|
5
|
+
* @param url - A full Sentry issue URL
|
|
6
|
+
* @returns Object containing the numeric issue ID and organization slug (if found)
|
|
7
|
+
* @throws Error if the input is invalid
|
|
8
|
+
*/
|
|
9
|
+
declare function extractIssueId(url: string): {
|
|
10
|
+
issueId: string;
|
|
11
|
+
organizationSlug: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { extractIssueId };
|
|
16
|
+
//# sourceMappingURL=issue-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issue-helpers.d.ts","names":[],"sources":["../../src/internal/issue-helpers.d.ts"],"sourcesContent":["/**\n * Extracts the Sentry issue ID and organization slug from a full URL\n *\n * @param url - A full Sentry issue URL\n * @returns Object containing the numeric issue ID and organization slug (if found)\n * @throws Error if the input is invalid\n */\nexport declare function extractIssueId(url: string): {\n issueId: string;\n organizationSlug: string;\n};\n//# sourceMappingURL=issue-helpers.d.ts.map"],"mappings":";;;;;;;;AAOA,IAAW,iBAAiB,CAAC,EAAK"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const require_issue_helpers = require('../issue-helpers-C0kEdXOE.cjs');
|
|
3
|
+
const require_dist = require('../dist-B914BQU9.cjs');
|
|
4
|
+
const require_vi_ClIskdbk = require('../vi.ClIskdbk-BhK8y4UO.cjs');
|
|
5
|
+
|
|
6
|
+
//#region src/internal/issue-helpers.test.ts
|
|
7
|
+
require_dist.describe("extractIssueId", () => {
|
|
8
|
+
require_dist.it("should extract issue ID from a full Sentry URL", () => {
|
|
9
|
+
require_vi_ClIskdbk.globalExpect(require_issue_helpers.extractIssueId("https://sentry.sentry.io/issues/1234")).toMatchInlineSnapshot(`
|
|
10
|
+
{
|
|
11
|
+
"issueId": "1234",
|
|
12
|
+
"organizationSlug": "sentry",
|
|
13
|
+
}
|
|
14
|
+
`);
|
|
15
|
+
});
|
|
16
|
+
require_dist.it("should extract issue ID from a Sentry URL with organization in path", () => {
|
|
17
|
+
require_vi_ClIskdbk.globalExpect(require_issue_helpers.extractIssueId("https://sentry.io/sentry/issues/123")).toMatchInlineSnapshot(`
|
|
18
|
+
{
|
|
19
|
+
"issueId": "123",
|
|
20
|
+
"organizationSlug": "sentry",
|
|
21
|
+
}
|
|
22
|
+
`);
|
|
23
|
+
});
|
|
24
|
+
require_dist.it("should extract issue ID and org slug from URL with organizations path", () => {
|
|
25
|
+
require_vi_ClIskdbk.globalExpect(require_issue_helpers.extractIssueId("https://sentry.io/organizations/my-org/issues/123")).toMatchInlineSnapshot(`
|
|
26
|
+
{
|
|
27
|
+
"issueId": "123",
|
|
28
|
+
"organizationSlug": "my-org",
|
|
29
|
+
}
|
|
30
|
+
`);
|
|
31
|
+
});
|
|
32
|
+
require_dist.it("should extract issue ID and org slug from subdomain URL", () => {
|
|
33
|
+
require_vi_ClIskdbk.globalExpect(require_issue_helpers.extractIssueId("https://my-team.sentry.io/issues/123")).toEqual({
|
|
34
|
+
issueId: "123",
|
|
35
|
+
organizationSlug: "my-team"
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
require_dist.it("should extract issue ID and org slug from self-hosted Sentry with subdomain", () => {
|
|
39
|
+
require_vi_ClIskdbk.globalExpect(require_issue_helpers.extractIssueId("https://sentry.mycompany.com/issues/123")).toMatchInlineSnapshot(`
|
|
40
|
+
{
|
|
41
|
+
"issueId": "123",
|
|
42
|
+
"organizationSlug": "sentry",
|
|
43
|
+
}
|
|
44
|
+
`);
|
|
45
|
+
});
|
|
46
|
+
require_dist.it("should extract issue ID and org slug from self-hosted Sentry with organization path", () => {
|
|
47
|
+
require_vi_ClIskdbk.globalExpect(require_issue_helpers.extractIssueId("https://mycompany.com/my-team/issues/123")).toMatchInlineSnapshot(`
|
|
48
|
+
{
|
|
49
|
+
"issueId": "123",
|
|
50
|
+
"organizationSlug": "my-team",
|
|
51
|
+
}
|
|
52
|
+
`);
|
|
53
|
+
});
|
|
54
|
+
require_dist.it("should throw error for empty input", () => {
|
|
55
|
+
require_vi_ClIskdbk.globalExpect(() => require_issue_helpers.extractIssueId("")).toThrowErrorMatchingInlineSnapshot(`[Error: Invalid Sentry issue URL. Must start with http:// or https://]`);
|
|
56
|
+
});
|
|
57
|
+
require_dist.it("should throw error for invalid URL path", () => {
|
|
58
|
+
require_vi_ClIskdbk.globalExpect(() => require_issue_helpers.extractIssueId("https://sentry.sentry.io/projects/123")).toThrowErrorMatchingInlineSnapshot(`[Error: Invalid Sentry issue URL. Path must contain '/issues/{issue_id}']`);
|
|
59
|
+
});
|
|
60
|
+
require_dist.it("should throw error for non-numeric issue ID in URL", () => {
|
|
61
|
+
require_vi_ClIskdbk.globalExpect(require_issue_helpers.extractIssueId("https://sentry.sentry.io/issues/abc")).toMatchInlineSnapshot(`
|
|
62
|
+
{
|
|
63
|
+
"issueId": "abc",
|
|
64
|
+
"organizationSlug": "sentry",
|
|
65
|
+
}
|
|
66
|
+
`);
|
|
67
|
+
});
|
|
68
|
+
require_dist.it("should throw error for non-numeric standalone ID", () => {
|
|
69
|
+
require_vi_ClIskdbk.globalExpect(() => require_issue_helpers.extractIssueId("abc")).toThrowErrorMatchingInlineSnapshot(`[Error: Invalid Sentry issue URL. Must start with http:// or https://]`);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
//#endregion
|
|
74
|
+
//# sourceMappingURL=issue-helpers.test.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issue-helpers.test.cjs","names":[],"sources":["../../src/internal/issue-helpers.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport { extractIssueId } from \"./issue-helpers\";\n\ndescribe(\"extractIssueId\", () => {\n it(\"should extract issue ID from a full Sentry URL\", () => {\n expect(\n extractIssueId(\"https://sentry.sentry.io/issues/1234\"),\n ).toMatchInlineSnapshot(`\n {\n \"issueId\": \"1234\",\n \"organizationSlug\": \"sentry\",\n }\n `);\n });\n\n it(\"should extract issue ID from a Sentry URL with organization in path\", () => {\n expect(\n extractIssueId(\"https://sentry.io/sentry/issues/123\"),\n ).toMatchInlineSnapshot(`\n {\n \"issueId\": \"123\",\n \"organizationSlug\": \"sentry\",\n }\n `);\n });\n\n it(\"should extract issue ID and org slug from URL with organizations path\", () => {\n expect(\n extractIssueId(\"https://sentry.io/organizations/my-org/issues/123\"),\n ).toMatchInlineSnapshot(`\n {\n \"issueId\": \"123\",\n \"organizationSlug\": \"my-org\",\n }\n `);\n });\n\n it(\"should extract issue ID and org slug from subdomain URL\", () => {\n expect(extractIssueId(\"https://my-team.sentry.io/issues/123\")).toEqual({\n issueId: \"123\",\n organizationSlug: \"my-team\",\n });\n });\n\n it(\"should extract issue ID and org slug from self-hosted Sentry with subdomain\", () => {\n expect(\n extractIssueId(\"https://sentry.mycompany.com/issues/123\"),\n ).toMatchInlineSnapshot(`\n {\n \"issueId\": \"123\",\n \"organizationSlug\": \"sentry\",\n }\n `);\n });\n\n it(\"should extract issue ID and org slug from self-hosted Sentry with organization path\", () => {\n expect(\n extractIssueId(\"https://mycompany.com/my-team/issues/123\"),\n ).toMatchInlineSnapshot(`\n {\n \"issueId\": \"123\",\n \"organizationSlug\": \"my-team\",\n }\n `);\n });\n\n it(\"should throw error for empty input\", () => {\n expect(() => extractIssueId(\"\")).toThrowErrorMatchingInlineSnapshot(\n `[Error: Invalid Sentry issue URL. Must start with http:// or https://]`,\n );\n });\n\n it(\"should throw error for invalid URL path\", () => {\n expect(() =>\n extractIssueId(\"https://sentry.sentry.io/projects/123\"),\n ).toThrowErrorMatchingInlineSnapshot(\n `[Error: Invalid Sentry issue URL. Path must contain '/issues/{issue_id}']`,\n );\n });\n\n it(\"should throw error for non-numeric issue ID in URL\", () => {\n expect(\n extractIssueId(\"https://sentry.sentry.io/issues/abc\"),\n ).toMatchInlineSnapshot(`\n {\n \"issueId\": \"abc\",\n \"organizationSlug\": \"sentry\",\n }\n `);\n });\n\n it(\"should throw error for non-numeric standalone ID\", () => {\n expect(() => extractIssueId(\"abc\")).toThrowErrorMatchingInlineSnapshot(\n `[Error: Invalid Sentry issue URL. Must start with http:// or https://]`,\n );\n });\n});\n"],"mappings":";;;;;;AAGA,sBAAS,kBAAkB,MAAM;AAC/B,iBAAG,kDAAkD,MAAM;AACzD,mCACE,qCAAe,uCAAuC,CACvD,CAAC,uBAAuB;;;;;MAKvB;CACH,EAAC;AAEF,iBAAG,uEAAuE,MAAM;AAC9E,mCACE,qCAAe,sCAAsC,CACtD,CAAC,uBAAuB;;;;;MAKvB;CACH,EAAC;AAEF,iBAAG,yEAAyE,MAAM;AAChF,mCACE,qCAAe,oDAAoD,CACpE,CAAC,uBAAuB;;;;;MAKvB;CACH,EAAC;AAEF,iBAAG,2DAA2D,MAAM;AAClE,mCAAO,qCAAe,uCAAuC,CAAC,CAAC,QAAQ;GACrE,SAAS;GACT,kBAAkB;EACnB,EAAC;CACH,EAAC;AAEF,iBAAG,+EAA+E,MAAM;AACtF,mCACE,qCAAe,0CAA0C,CAC1D,CAAC,uBAAuB;;;;;MAKvB;CACH,EAAC;AAEF,iBAAG,uFAAuF,MAAM;AAC9F,mCACE,qCAAe,2CAA2C,CAC3D,CAAC,uBAAuB;;;;;MAKvB;CACH,EAAC;AAEF,iBAAG,sCAAsC,MAAM;AAC7C,mCAAO,MAAM,qCAAe,GAAG,CAAC,CAAC,oCAC9B,wEACF;CACF,EAAC;AAEF,iBAAG,2CAA2C,MAAM;AAClD,mCAAO,MACL,qCAAe,wCAAwC,CACxD,CAAC,oCACC,2EACF;CACF,EAAC;AAEF,iBAAG,sDAAsD,MAAM;AAC7D,mCACE,qCAAe,sCAAsC,CACtD,CAAC,uBAAuB;;;;;MAKvB;CACH,EAAC;AAEF,iBAAG,oDAAoD,MAAM;AAC3D,mCAAO,MAAM,qCAAe,MAAM,CAAC,CAAC,oCACjC,wEACF;CACF,EAAC;AACH,EAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { extractIssueId } from "../issue-helpers-DFde36Zu.js";
|
|
2
|
+
import { describe, it } from "../dist-DJoL0rVQ.js";
|
|
3
|
+
import { globalExpect } from "../vi.ClIskdbk-CiLaali_.js";
|
|
4
|
+
|
|
5
|
+
//#region src/internal/issue-helpers.test.ts
|
|
6
|
+
describe("extractIssueId", () => {
|
|
7
|
+
it("should extract issue ID from a full Sentry URL", () => {
|
|
8
|
+
globalExpect(extractIssueId("https://sentry.sentry.io/issues/1234")).toMatchInlineSnapshot(`
|
|
9
|
+
{
|
|
10
|
+
"issueId": "1234",
|
|
11
|
+
"organizationSlug": "sentry",
|
|
12
|
+
}
|
|
13
|
+
`);
|
|
14
|
+
});
|
|
15
|
+
it("should extract issue ID from a Sentry URL with organization in path", () => {
|
|
16
|
+
globalExpect(extractIssueId("https://sentry.io/sentry/issues/123")).toMatchInlineSnapshot(`
|
|
17
|
+
{
|
|
18
|
+
"issueId": "123",
|
|
19
|
+
"organizationSlug": "sentry",
|
|
20
|
+
}
|
|
21
|
+
`);
|
|
22
|
+
});
|
|
23
|
+
it("should extract issue ID and org slug from URL with organizations path", () => {
|
|
24
|
+
globalExpect(extractIssueId("https://sentry.io/organizations/my-org/issues/123")).toMatchInlineSnapshot(`
|
|
25
|
+
{
|
|
26
|
+
"issueId": "123",
|
|
27
|
+
"organizationSlug": "my-org",
|
|
28
|
+
}
|
|
29
|
+
`);
|
|
30
|
+
});
|
|
31
|
+
it("should extract issue ID and org slug from subdomain URL", () => {
|
|
32
|
+
globalExpect(extractIssueId("https://my-team.sentry.io/issues/123")).toEqual({
|
|
33
|
+
issueId: "123",
|
|
34
|
+
organizationSlug: "my-team"
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
it("should extract issue ID and org slug from self-hosted Sentry with subdomain", () => {
|
|
38
|
+
globalExpect(extractIssueId("https://sentry.mycompany.com/issues/123")).toMatchInlineSnapshot(`
|
|
39
|
+
{
|
|
40
|
+
"issueId": "123",
|
|
41
|
+
"organizationSlug": "sentry",
|
|
42
|
+
}
|
|
43
|
+
`);
|
|
44
|
+
});
|
|
45
|
+
it("should extract issue ID and org slug from self-hosted Sentry with organization path", () => {
|
|
46
|
+
globalExpect(extractIssueId("https://mycompany.com/my-team/issues/123")).toMatchInlineSnapshot(`
|
|
47
|
+
{
|
|
48
|
+
"issueId": "123",
|
|
49
|
+
"organizationSlug": "my-team",
|
|
50
|
+
}
|
|
51
|
+
`);
|
|
52
|
+
});
|
|
53
|
+
it("should throw error for empty input", () => {
|
|
54
|
+
globalExpect(() => extractIssueId("")).toThrowErrorMatchingInlineSnapshot(`[Error: Invalid Sentry issue URL. Must start with http:// or https://]`);
|
|
55
|
+
});
|
|
56
|
+
it("should throw error for invalid URL path", () => {
|
|
57
|
+
globalExpect(() => extractIssueId("https://sentry.sentry.io/projects/123")).toThrowErrorMatchingInlineSnapshot(`[Error: Invalid Sentry issue URL. Path must contain '/issues/{issue_id}']`);
|
|
58
|
+
});
|
|
59
|
+
it("should throw error for non-numeric issue ID in URL", () => {
|
|
60
|
+
globalExpect(extractIssueId("https://sentry.sentry.io/issues/abc")).toMatchInlineSnapshot(`
|
|
61
|
+
{
|
|
62
|
+
"issueId": "abc",
|
|
63
|
+
"organizationSlug": "sentry",
|
|
64
|
+
}
|
|
65
|
+
`);
|
|
66
|
+
});
|
|
67
|
+
it("should throw error for non-numeric standalone ID", () => {
|
|
68
|
+
globalExpect(() => extractIssueId("abc")).toThrowErrorMatchingInlineSnapshot(`[Error: Invalid Sentry issue URL. Must start with http:// or https://]`);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
//#endregion
|
|
73
|
+
//# sourceMappingURL=issue-helpers.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issue-helpers.test.js","names":[],"sources":["../../src/internal/issue-helpers.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport { extractIssueId } from \"./issue-helpers\";\n\ndescribe(\"extractIssueId\", () => {\n it(\"should extract issue ID from a full Sentry URL\", () => {\n expect(\n extractIssueId(\"https://sentry.sentry.io/issues/1234\"),\n ).toMatchInlineSnapshot(`\n {\n \"issueId\": \"1234\",\n \"organizationSlug\": \"sentry\",\n }\n `);\n });\n\n it(\"should extract issue ID from a Sentry URL with organization in path\", () => {\n expect(\n extractIssueId(\"https://sentry.io/sentry/issues/123\"),\n ).toMatchInlineSnapshot(`\n {\n \"issueId\": \"123\",\n \"organizationSlug\": \"sentry\",\n }\n `);\n });\n\n it(\"should extract issue ID and org slug from URL with organizations path\", () => {\n expect(\n extractIssueId(\"https://sentry.io/organizations/my-org/issues/123\"),\n ).toMatchInlineSnapshot(`\n {\n \"issueId\": \"123\",\n \"organizationSlug\": \"my-org\",\n }\n `);\n });\n\n it(\"should extract issue ID and org slug from subdomain URL\", () => {\n expect(extractIssueId(\"https://my-team.sentry.io/issues/123\")).toEqual({\n issueId: \"123\",\n organizationSlug: \"my-team\",\n });\n });\n\n it(\"should extract issue ID and org slug from self-hosted Sentry with subdomain\", () => {\n expect(\n extractIssueId(\"https://sentry.mycompany.com/issues/123\"),\n ).toMatchInlineSnapshot(`\n {\n \"issueId\": \"123\",\n \"organizationSlug\": \"sentry\",\n }\n `);\n });\n\n it(\"should extract issue ID and org slug from self-hosted Sentry with organization path\", () => {\n expect(\n extractIssueId(\"https://mycompany.com/my-team/issues/123\"),\n ).toMatchInlineSnapshot(`\n {\n \"issueId\": \"123\",\n \"organizationSlug\": \"my-team\",\n }\n `);\n });\n\n it(\"should throw error for empty input\", () => {\n expect(() => extractIssueId(\"\")).toThrowErrorMatchingInlineSnapshot(\n `[Error: Invalid Sentry issue URL. Must start with http:// or https://]`,\n );\n });\n\n it(\"should throw error for invalid URL path\", () => {\n expect(() =>\n extractIssueId(\"https://sentry.sentry.io/projects/123\"),\n ).toThrowErrorMatchingInlineSnapshot(\n `[Error: Invalid Sentry issue URL. Path must contain '/issues/{issue_id}']`,\n );\n });\n\n it(\"should throw error for non-numeric issue ID in URL\", () => {\n expect(\n extractIssueId(\"https://sentry.sentry.io/issues/abc\"),\n ).toMatchInlineSnapshot(`\n {\n \"issueId\": \"abc\",\n \"organizationSlug\": \"sentry\",\n }\n `);\n });\n\n it(\"should throw error for non-numeric standalone ID\", () => {\n expect(() => extractIssueId(\"abc\")).toThrowErrorMatchingInlineSnapshot(\n `[Error: Invalid Sentry issue URL. Must start with http:// or https://]`,\n );\n });\n});\n"],"mappings":";;;;;AAGA,SAAS,kBAAkB,MAAM;AAC/B,IAAG,kDAAkD,MAAM;AACzD,eACE,eAAe,uCAAuC,CACvD,CAAC,uBAAuB;;;;;MAKvB;CACH,EAAC;AAEF,IAAG,uEAAuE,MAAM;AAC9E,eACE,eAAe,sCAAsC,CACtD,CAAC,uBAAuB;;;;;MAKvB;CACH,EAAC;AAEF,IAAG,yEAAyE,MAAM;AAChF,eACE,eAAe,oDAAoD,CACpE,CAAC,uBAAuB;;;;;MAKvB;CACH,EAAC;AAEF,IAAG,2DAA2D,MAAM;AAClE,eAAO,eAAe,uCAAuC,CAAC,CAAC,QAAQ;GACrE,SAAS;GACT,kBAAkB;EACnB,EAAC;CACH,EAAC;AAEF,IAAG,+EAA+E,MAAM;AACtF,eACE,eAAe,0CAA0C,CAC1D,CAAC,uBAAuB;;;;;MAKvB;CACH,EAAC;AAEF,IAAG,uFAAuF,MAAM;AAC9F,eACE,eAAe,2CAA2C,CAC3D,CAAC,uBAAuB;;;;;MAKvB;CACH,EAAC;AAEF,IAAG,sCAAsC,MAAM;AAC7C,eAAO,MAAM,eAAe,GAAG,CAAC,CAAC,oCAC9B,wEACF;CACF,EAAC;AAEF,IAAG,2CAA2C,MAAM;AAClD,eAAO,MACL,eAAe,wCAAwC,CACxD,CAAC,oCACC,2EACF;CACF,EAAC;AAEF,IAAG,sDAAsD,MAAM;AAC7D,eACE,eAAe,sCAAsC,CACtD,CAAC,uBAAuB;;;;;MAKvB;CACH,EAAC;AAEF,IAAG,oDAAoD,MAAM;AAC3D,eAAO,MAAM,eAAe,MAAM,CAAC,CAAC,oCACjC,wEACF;CACF,EAAC;AACH,EAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
//#region src/internal/issue-helpers.ts
|
|
4
|
+
/**
|
|
5
|
+
* Extracts the Sentry issue ID and organization slug from a full URL
|
|
6
|
+
*
|
|
7
|
+
* @param url - A full Sentry issue URL
|
|
8
|
+
* @returns Object containing the numeric issue ID and organization slug (if found)
|
|
9
|
+
* @throws Error if the input is invalid
|
|
10
|
+
*/
|
|
11
|
+
function extractIssueId(url) {
|
|
12
|
+
if (!url.startsWith("http://") && !url.startsWith("https://")) throw new Error("Invalid Sentry issue URL. Must start with http:// or https://");
|
|
13
|
+
const parsedUrl = new URL(url);
|
|
14
|
+
const pathParts = parsedUrl.pathname.split("/").filter(Boolean);
|
|
15
|
+
if (pathParts.length < 2 || !pathParts.includes("issues")) throw new Error("Invalid Sentry issue URL. Path must contain '/issues/{issue_id}'");
|
|
16
|
+
const issueId = pathParts[pathParts.indexOf("issues") + 1];
|
|
17
|
+
if (!issueId) throw new Error("Unable to determine issue ID from URL.");
|
|
18
|
+
let organizationSlug;
|
|
19
|
+
if (pathParts.includes("organizations")) organizationSlug = pathParts[pathParts.indexOf("organizations") + 1];
|
|
20
|
+
else if (pathParts.length > 1 && pathParts[0] !== "issues") organizationSlug = pathParts[0];
|
|
21
|
+
else {
|
|
22
|
+
const hostParts = parsedUrl.hostname.split(".");
|
|
23
|
+
if (hostParts.length > 2 && hostParts[0] !== "www") organizationSlug = hostParts[0];
|
|
24
|
+
}
|
|
25
|
+
if (!organizationSlug) throw new Error("Invalid Sentry issue URL. Could not determine organization.");
|
|
26
|
+
return {
|
|
27
|
+
issueId,
|
|
28
|
+
organizationSlug
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
Object.defineProperty(exports, 'extractIssueId', {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () {
|
|
36
|
+
return extractIssueId;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=issue-helpers-C0kEdXOE.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issue-helpers-C0kEdXOE.cjs","names":["url: string","organizationSlug: string | undefined"],"sources":["../src/internal/issue-helpers.ts"],"sourcesContent":["/**\n * Extracts the Sentry issue ID and organization slug from a full URL\n *\n * @param url - A full Sentry issue URL\n * @returns Object containing the numeric issue ID and organization slug (if found)\n * @throws Error if the input is invalid\n */\nexport function extractIssueId(url: string): {\n issueId: string;\n organizationSlug: string;\n} {\n if (!url.startsWith(\"http://\") && !url.startsWith(\"https://\")) {\n throw new Error(\n \"Invalid Sentry issue URL. Must start with http:// or https://\",\n );\n }\n\n const parsedUrl = new URL(url);\n\n const pathParts = parsedUrl.pathname.split(\"/\").filter(Boolean);\n if (pathParts.length < 2 || !pathParts.includes(\"issues\")) {\n throw new Error(\n \"Invalid Sentry issue URL. Path must contain '/issues/{issue_id}'\",\n );\n }\n\n const issueId = pathParts[pathParts.indexOf(\"issues\") + 1];\n if (!issueId) {\n throw new Error(\"Unable to determine issue ID from URL.\");\n }\n\n // Extract organization slug from either the path or subdomain\n let organizationSlug: string | undefined;\n if (pathParts.includes(\"organizations\")) {\n organizationSlug = pathParts[pathParts.indexOf(\"organizations\") + 1];\n } else if (pathParts.length > 1 && pathParts[0] !== \"issues\") {\n // If URL is like sentry.io/sentry/issues/123\n organizationSlug = pathParts[0];\n } else {\n // Check for subdomain\n const hostParts = parsedUrl.hostname.split(\".\");\n if (hostParts.length > 2 && hostParts[0] !== \"www\") {\n organizationSlug = hostParts[0];\n }\n }\n\n if (!organizationSlug) {\n throw new Error(\n \"Invalid Sentry issue URL. Could not determine organization.\",\n );\n }\n\n return { issueId, organizationSlug };\n}\n"],"mappings":";;;;;;;;;;AAOA,SAAgB,eAAeA,KAG7B;AACA,MAAK,IAAI,WAAW,UAAU,KAAK,IAAI,WAAW,WAAW,CAC3D,OAAM,IAAI,MACR;CAIJ,MAAM,YAAY,IAAI,IAAI;CAE1B,MAAM,YAAY,UAAU,SAAS,MAAM,IAAI,CAAC,OAAO,QAAQ;AAC/D,KAAI,UAAU,SAAS,MAAM,UAAU,SAAS,SAAS,CACvD,OAAM,IAAI,MACR;CAIJ,MAAM,UAAU,UAAU,UAAU,QAAQ,SAAS,GAAG;AACxD,MAAK,QACH,OAAM,IAAI,MAAM;CAIlB,IAAIC;AACJ,KAAI,UAAU,SAAS,gBAAgB,CACrC,oBAAmB,UAAU,UAAU,QAAQ,gBAAgB,GAAG;UACzD,UAAU,SAAS,KAAK,UAAU,OAAO,SAElD,oBAAmB,UAAU;MACxB;EAEL,MAAM,YAAY,UAAU,SAAS,MAAM,IAAI;AAC/C,MAAI,UAAU,SAAS,KAAK,UAAU,OAAO,MAC3C,oBAAmB,UAAU;CAEhC;AAED,MAAK,iBACH,OAAM,IAAI,MACR;AAIJ,QAAO;EAAE;EAAS;CAAkB;AACrC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/internal/issue-helpers.ts
|
|
2
|
+
/**
|
|
3
|
+
* Extracts the Sentry issue ID and organization slug from a full URL
|
|
4
|
+
*
|
|
5
|
+
* @param url - A full Sentry issue URL
|
|
6
|
+
* @returns Object containing the numeric issue ID and organization slug (if found)
|
|
7
|
+
* @throws Error if the input is invalid
|
|
8
|
+
*/
|
|
9
|
+
function extractIssueId(url) {
|
|
10
|
+
if (!url.startsWith("http://") && !url.startsWith("https://")) throw new Error("Invalid Sentry issue URL. Must start with http:// or https://");
|
|
11
|
+
const parsedUrl = new URL(url);
|
|
12
|
+
const pathParts = parsedUrl.pathname.split("/").filter(Boolean);
|
|
13
|
+
if (pathParts.length < 2 || !pathParts.includes("issues")) throw new Error("Invalid Sentry issue URL. Path must contain '/issues/{issue_id}'");
|
|
14
|
+
const issueId = pathParts[pathParts.indexOf("issues") + 1];
|
|
15
|
+
if (!issueId) throw new Error("Unable to determine issue ID from URL.");
|
|
16
|
+
let organizationSlug;
|
|
17
|
+
if (pathParts.includes("organizations")) organizationSlug = pathParts[pathParts.indexOf("organizations") + 1];
|
|
18
|
+
else if (pathParts.length > 1 && pathParts[0] !== "issues") organizationSlug = pathParts[0];
|
|
19
|
+
else {
|
|
20
|
+
const hostParts = parsedUrl.hostname.split(".");
|
|
21
|
+
if (hostParts.length > 2 && hostParts[0] !== "www") organizationSlug = hostParts[0];
|
|
22
|
+
}
|
|
23
|
+
if (!organizationSlug) throw new Error("Invalid Sentry issue URL. Could not determine organization.");
|
|
24
|
+
return {
|
|
25
|
+
issueId,
|
|
26
|
+
organizationSlug
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
export { extractIssueId };
|
|
32
|
+
//# sourceMappingURL=issue-helpers-DFde36Zu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issue-helpers-DFde36Zu.js","names":["url: string","organizationSlug: string | undefined"],"sources":["../src/internal/issue-helpers.ts"],"sourcesContent":["/**\n * Extracts the Sentry issue ID and organization slug from a full URL\n *\n * @param url - A full Sentry issue URL\n * @returns Object containing the numeric issue ID and organization slug (if found)\n * @throws Error if the input is invalid\n */\nexport function extractIssueId(url: string): {\n issueId: string;\n organizationSlug: string;\n} {\n if (!url.startsWith(\"http://\") && !url.startsWith(\"https://\")) {\n throw new Error(\n \"Invalid Sentry issue URL. Must start with http:// or https://\",\n );\n }\n\n const parsedUrl = new URL(url);\n\n const pathParts = parsedUrl.pathname.split(\"/\").filter(Boolean);\n if (pathParts.length < 2 || !pathParts.includes(\"issues\")) {\n throw new Error(\n \"Invalid Sentry issue URL. Path must contain '/issues/{issue_id}'\",\n );\n }\n\n const issueId = pathParts[pathParts.indexOf(\"issues\") + 1];\n if (!issueId) {\n throw new Error(\"Unable to determine issue ID from URL.\");\n }\n\n // Extract organization slug from either the path or subdomain\n let organizationSlug: string | undefined;\n if (pathParts.includes(\"organizations\")) {\n organizationSlug = pathParts[pathParts.indexOf(\"organizations\") + 1];\n } else if (pathParts.length > 1 && pathParts[0] !== \"issues\") {\n // If URL is like sentry.io/sentry/issues/123\n organizationSlug = pathParts[0];\n } else {\n // Check for subdomain\n const hostParts = parsedUrl.hostname.split(\".\");\n if (hostParts.length > 2 && hostParts[0] !== \"www\") {\n organizationSlug = hostParts[0];\n }\n }\n\n if (!organizationSlug) {\n throw new Error(\n \"Invalid Sentry issue URL. Could not determine organization.\",\n );\n }\n\n return { issueId, organizationSlug };\n}\n"],"mappings":";;;;;;;;AAOA,SAAgB,eAAeA,KAG7B;AACA,MAAK,IAAI,WAAW,UAAU,KAAK,IAAI,WAAW,WAAW,CAC3D,OAAM,IAAI,MACR;CAIJ,MAAM,YAAY,IAAI,IAAI;CAE1B,MAAM,YAAY,UAAU,SAAS,MAAM,IAAI,CAAC,OAAO,QAAQ;AAC/D,KAAI,UAAU,SAAS,MAAM,UAAU,SAAS,SAAS,CACvD,OAAM,IAAI,MACR;CAIJ,MAAM,UAAU,UAAU,UAAU,QAAQ,SAAS,GAAG;AACxD,MAAK,QACH,OAAM,IAAI,MAAM;CAIlB,IAAIC;AACJ,KAAI,UAAU,SAAS,gBAAgB,CACrC,oBAAmB,UAAU,UAAU,QAAQ,gBAAgB,GAAG;UACzD,UAAU,SAAS,KAAK,UAAU,OAAO,SAElD,oBAAmB,UAAU;MACxB;EAEL,MAAM,YAAY,UAAU,SAAS,MAAM,IAAI;AAC/C,MAAI,UAAU,SAAS,KAAK,UAAU,OAAO,MAC3C,oBAAmB,UAAU;CAEhC;AAED,MAAK,iBACH,OAAM,IAAI,MACR;AAIJ,QAAO;EAAE;EAAS;CAAkB;AACrC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const require_chunk = require('./chunk-BtT13l48.cjs');
|
|
3
|
+
const __sentry_core = require_chunk.__toESM(require("@sentry/core"));
|
|
4
|
+
|
|
5
|
+
//#region src/logging.ts
|
|
6
|
+
function logError(error, contexts, attachments) {
|
|
7
|
+
const level = "error";
|
|
8
|
+
console.error(error);
|
|
9
|
+
const eventId = (0, __sentry_core.withScope)((scope) => {
|
|
10
|
+
if (attachments) for (const [key, data] of Object.entries(attachments)) scope.addAttachment({
|
|
11
|
+
data,
|
|
12
|
+
filename: key
|
|
13
|
+
});
|
|
14
|
+
return typeof error === "string" ? (0, __sentry_core.captureMessage)(error, {
|
|
15
|
+
contexts,
|
|
16
|
+
level
|
|
17
|
+
}) : (0, __sentry_core.captureException)(error, {
|
|
18
|
+
contexts,
|
|
19
|
+
level
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
return eventId;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
Object.defineProperty(exports, 'logError', {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () {
|
|
29
|
+
return logError;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=logging-BEMgC5SA.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logging-BEMgC5SA.cjs","names":["error: string | Error | unknown","contexts?: Record<string, Record<string, any>>","attachments?: Record<string, string | Uint8Array>"],"sources":["../src/logging.ts"],"sourcesContent":["import { captureException, captureMessage, withScope } from \"@sentry/core\";\n\nexport function logError(\n error: Error | unknown,\n contexts?: Record<string, Record<string, any>>,\n attachments?: Record<string, string | Uint8Array>,\n): string | undefined;\nexport function logError(\n message: string,\n contexts?: Record<string, Record<string, any>>,\n attachments?: Record<string, string | Uint8Array>,\n): string | undefined;\nexport function logError(\n error: string | Error | unknown,\n contexts?: Record<string, Record<string, any>>,\n attachments?: Record<string, string | Uint8Array>,\n): string | undefined {\n const level = \"error\";\n\n console.error(error);\n\n const eventId = withScope((scope) => {\n if (attachments) {\n for (const [key, data] of Object.entries(attachments)) {\n scope.addAttachment({\n data,\n filename: key,\n });\n }\n }\n\n return typeof error === \"string\"\n ? captureMessage(error, {\n contexts,\n level,\n })\n : captureException(error, {\n contexts,\n level,\n });\n });\n\n return eventId;\n}\n"],"mappings":";;;;;AAYA,SAAgB,SACdA,OACAC,UACAC,aACoB;CACpB,MAAM,QAAQ;AAEd,SAAQ,MAAM,MAAM;CAEpB,MAAM,UAAU,6BAAU,CAAC,UAAU;AACnC,MAAI,YACF,MAAK,MAAM,CAAC,KAAK,KAAK,IAAI,OAAO,QAAQ,YAAY,CACnD,OAAM,cAAc;GAClB;GACA,UAAU;EACX,EAAC;AAIN,gBAAc,UAAU,WACpB,kCAAe,OAAO;GACpB;GACA;EACD,EAAC,GACF,oCAAiB,OAAO;GACtB;GACA;EACD,EAAC;CACP,EAAC;AAEF,QAAO;AACR"}
|