@theholocron/holocron-plugin-sentry 5.0.0-alpha.246 → 5.0.0-alpha.248
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +12 -20
- package/dist/index.mjs +11 -22
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,26 +1,23 @@
|
|
|
1
1
|
import { AuthError, EnsureRelayInput, EnsureRelayResult, Errors, ResolveTokenInput, VerifyTokenFailure, VerifyTokenResult, VerifyTokenResult as VerifyTokenResult$1, VerifyTokenSuccess } from "@theholocron/cli";
|
|
2
2
|
import { SentryClient, SentryClientOptions, createSentryClient } from "@theholocron/sentry-client";
|
|
3
|
-
|
|
4
|
-
declare const resolveToken: (input?: ResolveTokenInput) => string;
|
|
3
|
+
export declare const resolveToken: (input?: ResolveTokenInput) => string;
|
|
5
4
|
/**
|
|
6
5
|
* The token for the Comlink relay: an integration, its client secret and an alert rule need more than the general token
|
|
7
6
|
* (`alerts:write`, `org:write`, `event:read`), so it has its own.
|
|
8
7
|
*/
|
|
9
|
-
declare const resolveComlinkToken: (input?: ResolveTokenInput) => string;
|
|
8
|
+
export declare const resolveComlinkToken: (input?: ResolveTokenInput) => string;
|
|
10
9
|
/**
|
|
11
10
|
* The token for the relay: the Comlink one when there is one, else the general Sentry token as the last resort. The
|
|
12
11
|
* fallback only helps if the general token happens to carry the scopes; otherwise Sentry's answer names what is missing.
|
|
13
12
|
*/
|
|
14
|
-
declare function resolveRelayToken(input?: ResolveTokenInput): string;
|
|
15
|
-
//#endregion
|
|
16
|
-
//#region src/capabilities/errors.d.ts
|
|
13
|
+
export declare function resolveRelayToken(input?: ResolveTokenInput): string;
|
|
17
14
|
interface SentryErrorsOptions {
|
|
18
15
|
/** Sentry organization slug. Required for `whoami` and `ensureProject`. */
|
|
19
16
|
org?: string;
|
|
20
17
|
/** Default team slug for project creation. Defaults to org slug. */
|
|
21
18
|
team?: string;
|
|
22
19
|
}
|
|
23
|
-
declare class SentryErrors implements Errors {
|
|
20
|
+
export declare class SentryErrors implements Errors {
|
|
24
21
|
private readonly client;
|
|
25
22
|
private readonly opts;
|
|
26
23
|
/** The client for the relay, made with the Comlink token (see `resolveRelayToken`). */
|
|
@@ -52,16 +49,12 @@ declare class SentryErrors implements Errors {
|
|
|
52
49
|
*/
|
|
53
50
|
private requireOrg;
|
|
54
51
|
}
|
|
55
|
-
//#endregion
|
|
56
|
-
//#region src/verify-token.d.ts
|
|
57
52
|
interface VerifyTokenOptions {
|
|
58
53
|
baseUrl?: string;
|
|
59
54
|
fetch?: typeof fetch;
|
|
60
55
|
}
|
|
61
|
-
declare function verifyToken(token: string, opts?: VerifyTokenOptions): Promise<VerifyTokenResult$1>;
|
|
62
|
-
|
|
63
|
-
//#region src/index.d.ts
|
|
64
|
-
interface SentryPluginOptions extends ResolveTokenInput, SentryErrorsOptions {
|
|
56
|
+
export declare function verifyToken(token: string, opts?: VerifyTokenOptions): Promise<VerifyTokenResult$1>;
|
|
57
|
+
export interface SentryPluginOptions extends ResolveTokenInput, SentryErrorsOptions {
|
|
65
58
|
/**
|
|
66
59
|
* Sentry organization slug. Optional at load time — the `errors` capability
|
|
67
60
|
* activates from env vars alone — but required for `whoami` / `ensureProject`
|
|
@@ -72,15 +65,15 @@ interface SentryPluginOptions extends ResolveTokenInput, SentryErrorsOptions {
|
|
|
72
65
|
baseUrl?: string;
|
|
73
66
|
fetch?: typeof fetch;
|
|
74
67
|
}
|
|
75
|
-
interface PluginContext {
|
|
68
|
+
export interface PluginContext {
|
|
76
69
|
options: SentryPluginOptions;
|
|
77
70
|
client: () => SentryClient;
|
|
78
71
|
/** The client for the Comlink relay: its own token (`sentry.comlink`), the general one only as a last resort. */
|
|
79
72
|
relayClient: () => SentryClient;
|
|
80
73
|
}
|
|
81
|
-
declare function createContext(options: SentryPluginOptions): PluginContext;
|
|
82
|
-
declare function errors(ctx: PluginContext): Errors;
|
|
83
|
-
declare function createPlugin(options: SentryPluginOptions): {
|
|
74
|
+
export declare function createContext(options: SentryPluginOptions): PluginContext;
|
|
75
|
+
export declare function errors(ctx: PluginContext): Errors;
|
|
76
|
+
export declare function createPlugin(options: SentryPluginOptions): {
|
|
84
77
|
name: string;
|
|
85
78
|
probes: {
|
|
86
79
|
connection: import("@theholocron/cli").Probe;
|
|
@@ -89,6 +82,5 @@ declare function createPlugin(options: SentryPluginOptions): {
|
|
|
89
82
|
errors: () => Errors;
|
|
90
83
|
};
|
|
91
84
|
};
|
|
92
|
-
declare const AUTH_HINT: string;
|
|
93
|
-
|
|
94
|
-
export { AUTH_HINT, AuthError, PluginContext, type ResolveTokenInput, type SentryClient, type SentryClientOptions, SentryErrors, type SentryErrorsOptions, SentryPluginOptions, type VerifyTokenFailure, type VerifyTokenResult, type VerifyTokenSuccess, createContext, createPlugin, createSentryClient, errors, resolveComlinkToken, resolveRelayToken, resolveToken, verifyToken };
|
|
85
|
+
export declare const AUTH_HINT: string;
|
|
86
|
+
export { AuthError, type ResolveTokenInput, type SentryClient, type SentryClientOptions, type SentryErrorsOptions, type VerifyTokenFailure, type VerifyTokenResult, type VerifyTokenSuccess, createSentryClient };
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { AuthError, ProviderApiError, connectionProbe, createFeatureResolver, cr
|
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { createSentryClient } from "@theholocron/sentry-client";
|
|
4
4
|
import { errorMessage } from "@theholocron/misc-utils";
|
|
5
|
-
|
|
5
|
+
// src/auth.ts
|
|
6
6
|
const resolveToken = createResolveToken({
|
|
7
7
|
envName: "HOLOCRON_SENTRY_TOKEN",
|
|
8
8
|
vendorEnvName: "SENTRY_AUTH_TOKEN",
|
|
@@ -30,8 +30,7 @@ function resolveRelayToken(input = {}) {
|
|
|
30
30
|
return resolveToken(input);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
//#region src/capabilities/relay.ts
|
|
33
|
+
// src/capabilities/relay.ts
|
|
35
34
|
/** What the integration needs to read: the alert's event. It is also why reading its secret needs the same scope. */
|
|
36
35
|
const INTEGRATION_SCOPES = ["event:read"];
|
|
37
36
|
const DEFAULT_FREQUENCY = 5;
|
|
@@ -233,8 +232,7 @@ async function ensureSentryRelay(client, org, input) {
|
|
|
233
232
|
...clientSecret ? { clientSecret } : {}
|
|
234
233
|
};
|
|
235
234
|
}
|
|
236
|
-
|
|
237
|
-
//#region src/capabilities/errors.ts
|
|
235
|
+
// src/capabilities/errors.ts
|
|
238
236
|
var SentryErrors = class {
|
|
239
237
|
client;
|
|
240
238
|
opts;
|
|
@@ -300,14 +298,12 @@ var SentryErrors = class {
|
|
|
300
298
|
function toSlug(name) {
|
|
301
299
|
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
302
300
|
}
|
|
303
|
-
|
|
304
|
-
//#region src/probes/probe-deps.type.ts
|
|
301
|
+
// src/probes/probe-deps.type.ts
|
|
305
302
|
function requireOrg(deps) {
|
|
306
303
|
if (!deps.org) throw new Error("the Sentry probes need `org` in the sentry provider's options");
|
|
307
304
|
return deps.org;
|
|
308
305
|
}
|
|
309
|
-
|
|
310
|
-
//#region src/probes/integrations.ts
|
|
306
|
+
// src/probes/integrations.ts
|
|
311
307
|
/** Where a webhook points, without a query string that could carry a token. */
|
|
312
308
|
function where(url) {
|
|
313
309
|
if (!url) return "no webhook";
|
|
@@ -344,8 +340,7 @@ function integrationsProbe(deps) {
|
|
|
344
340
|
}
|
|
345
341
|
};
|
|
346
342
|
}
|
|
347
|
-
|
|
348
|
-
//#region src/probes/rule-update.ts
|
|
343
|
+
// src/probes/rule-update.ts
|
|
349
344
|
const FROM = 5;
|
|
350
345
|
const TO = 10;
|
|
351
346
|
/** The detector the throwaway rule hangs on: the issue stream of `HOLOCRON_SENTRY_PROBE_PROJECT`, else of any project. */
|
|
@@ -434,8 +429,7 @@ function ruleUpdateProbe(deps) {
|
|
|
434
429
|
}
|
|
435
430
|
};
|
|
436
431
|
}
|
|
437
|
-
|
|
438
|
-
//#region src/probes/rules.ts
|
|
432
|
+
// src/probes/rules.ts
|
|
439
433
|
function rulesProbe(deps) {
|
|
440
434
|
return {
|
|
441
435
|
summary: "List the alert rules: enabled, projects attached, and what each action sends to.",
|
|
@@ -474,8 +468,7 @@ function rulesProbe(deps) {
|
|
|
474
468
|
}
|
|
475
469
|
};
|
|
476
470
|
}
|
|
477
|
-
|
|
478
|
-
//#region src/probes/send-error.ts
|
|
471
|
+
// src/probes/send-error.ts
|
|
479
472
|
/** Which DSN to send to: `SENTRY_DSN`, else the first client key of the project named in `HOLOCRON_SENTRY_PROBE_PROJECT`. */
|
|
480
473
|
async function dsnFor(deps) {
|
|
481
474
|
const env = deps.env ?? process.env;
|
|
@@ -531,8 +524,7 @@ function sendErrorProbe(deps) {
|
|
|
531
524
|
}
|
|
532
525
|
};
|
|
533
526
|
}
|
|
534
|
-
|
|
535
|
-
//#region src/probes/index.ts
|
|
527
|
+
// src/probes/index.ts
|
|
536
528
|
function sentryProbes(deps) {
|
|
537
529
|
return {
|
|
538
530
|
integrations: integrationsProbe(deps),
|
|
@@ -541,8 +533,7 @@ function sentryProbes(deps) {
|
|
|
541
533
|
"send-error": sendErrorProbe(deps)
|
|
542
534
|
};
|
|
543
535
|
}
|
|
544
|
-
|
|
545
|
-
//#region src/verify-token.ts
|
|
536
|
+
// src/verify-token.ts
|
|
546
537
|
async function verifyToken(token, opts = {}) {
|
|
547
538
|
const client = createSentryClient({
|
|
548
539
|
token,
|
|
@@ -561,8 +552,7 @@ async function verifyToken(token, opts = {}) {
|
|
|
561
552
|
};
|
|
562
553
|
}
|
|
563
554
|
}
|
|
564
|
-
|
|
565
|
-
//#region src/index.ts
|
|
555
|
+
// src/index.ts
|
|
566
556
|
function createContext(options) {
|
|
567
557
|
let client;
|
|
568
558
|
let relayClient;
|
|
@@ -611,5 +601,4 @@ function createPlugin(options) {
|
|
|
611
601
|
};
|
|
612
602
|
}
|
|
613
603
|
const AUTH_HINT = "generate an auth token at https://sentry.io/settings/account/api/auth-tokens/ with project:read, project:write, and org:read scopes, then run: holocron auth set sentry <TOKEN>";
|
|
614
|
-
//#endregion
|
|
615
604
|
export { AUTH_HINT, AuthError, SentryErrors, createContext, createPlugin, createSentryClient, errors, resolveComlinkToken, resolveRelayToken, resolveToken, verifyToken };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/holocron-plugin-sentry",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.248",
|
|
4
4
|
"description": "Holocron plugin for Sentry. Implements the errors capability against Sentry's management API — project provisioning and DSN retrieval.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"errors",
|
|
@@ -38,22 +38,22 @@
|
|
|
38
38
|
"@theholocron/tsdown-config": "^8.8.2",
|
|
39
39
|
"@theholocron/vitest-config": "^8.8.2",
|
|
40
40
|
"@types/node": "^26",
|
|
41
|
-
"@vitest/coverage-v8": "^
|
|
41
|
+
"@vitest/coverage-v8": "^5.0.5",
|
|
42
42
|
"@vitest/eslint-plugin": "^1.6.27",
|
|
43
43
|
"chalk": "^6.0.0",
|
|
44
44
|
"eslint": "^10.8.1",
|
|
45
45
|
"eslint-plugin-n": "^18.3.0",
|
|
46
46
|
"globals": "^17.11.0",
|
|
47
|
-
"tsdown": "^0.
|
|
47
|
+
"tsdown": "^0.23.3",
|
|
48
48
|
"tsx": "4.23.15",
|
|
49
49
|
"typescript": "^5.9.3",
|
|
50
|
-
"vitest": "^
|
|
51
|
-
"@theholocron/cli": "5.0.0-alpha.
|
|
50
|
+
"vitest": "^5.0.5",
|
|
51
|
+
"@theholocron/cli": "5.0.0-alpha.248"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"@theholocron/misc-utils": "^1.16.0",
|
|
55
55
|
"@theholocron/sentry-client": "^1.56.0",
|
|
56
|
-
"@theholocron/cli": "5.0.0-alpha.
|
|
56
|
+
"@theholocron/cli": "5.0.0-alpha.248"
|
|
57
57
|
},
|
|
58
58
|
"peerDependenciesMeta": {
|
|
59
59
|
"@theholocron/sentry-client": {}
|