@theholocron/sentry-client 1.58.0-alpha.2 → 1.58.0-alpha.26
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 +72 -0
- package/dist/index.mjs +1 -0
- package/package.json +18 -18
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import "@theholocron/http-client";
|
|
2
2
|
import { ErrorSink, Logger } from "@theholocron/observability/core";
|
|
3
|
+
/** Options for `createSentryClient()` and `createSentryRestClient()`. */
|
|
3
4
|
interface SentryClientOptions {
|
|
5
|
+
/** Sentry auth token. */
|
|
4
6
|
token: string;
|
|
5
7
|
/** Override base URL for testing. Defaults to https://sentry.io/api/0 */
|
|
6
8
|
baseUrl?: string;
|
|
@@ -11,32 +13,53 @@ interface SentryClientOptions {
|
|
|
11
13
|
/** Reports transport failures and unexpected 5xx. Defaults to a no-op. */
|
|
12
14
|
errors?: ErrorSink;
|
|
13
15
|
}
|
|
16
|
+
/** A Sentry organization. */
|
|
14
17
|
interface SentryOrganization {
|
|
18
|
+
/** The organization id. */
|
|
15
19
|
id: string;
|
|
20
|
+
/** The organization slug used in API paths. */
|
|
16
21
|
slug: string;
|
|
22
|
+
/** The organization's display name. */
|
|
17
23
|
name: string;
|
|
18
24
|
}
|
|
25
|
+
/** A Sentry project. */
|
|
19
26
|
interface SentryProject {
|
|
27
|
+
/** The project id. */
|
|
20
28
|
id: string;
|
|
29
|
+
/** The project slug used in API paths. */
|
|
21
30
|
slug: string;
|
|
31
|
+
/** The project's display name. */
|
|
22
32
|
name: string;
|
|
33
|
+
/** The platform identifier, or `null` when none is set. */
|
|
23
34
|
platform: string | null;
|
|
24
35
|
}
|
|
36
|
+
/** The DSN URLs of a client key. */
|
|
25
37
|
interface SentryKeyDsn {
|
|
38
|
+
/** The DSN to give an SDK; it carries only the public key. */
|
|
26
39
|
public: string;
|
|
40
|
+
/** The DSN that includes the secret key. */
|
|
27
41
|
secret: string;
|
|
28
42
|
/** Content Security Policy endpoint. */
|
|
29
43
|
csp: string;
|
|
30
44
|
}
|
|
45
|
+
/** A client key (DSN) of a project. */
|
|
31
46
|
interface SentryKey {
|
|
47
|
+
/** The key id. */
|
|
32
48
|
id: string;
|
|
49
|
+
/** The key's label. */
|
|
33
50
|
label: string;
|
|
51
|
+
/** The public key. */
|
|
34
52
|
public: string;
|
|
53
|
+
/** The secret key. */
|
|
35
54
|
secret: string;
|
|
55
|
+
/** The DSN URLs built from the key. */
|
|
36
56
|
dsn: SentryKeyDsn;
|
|
37
57
|
}
|
|
58
|
+
/** Input for `projects.create()`. */
|
|
38
59
|
interface CreateSentryProjectInput {
|
|
60
|
+
/** The project name. */
|
|
39
61
|
name: string;
|
|
62
|
+
/** The platform identifier, e.g. `node`; omitted, none is sent. */
|
|
40
63
|
platform?: string;
|
|
41
64
|
}
|
|
42
65
|
/**
|
|
@@ -44,64 +67,102 @@ interface CreateSentryProjectInput {
|
|
|
44
67
|
* integration has, so it is absent for a token with fewer. It signs the webhooks Sentry sends to `webhookUrl`.
|
|
45
68
|
*/
|
|
46
69
|
interface SentryApp {
|
|
70
|
+
/** The integration's name. */
|
|
47
71
|
name: string;
|
|
72
|
+
/** The integration's slug. */
|
|
48
73
|
slug: string;
|
|
74
|
+
/** The integration's UUID. */
|
|
49
75
|
uuid: string;
|
|
76
|
+
/** The integration's status as Sentry reports it. */
|
|
50
77
|
status: string;
|
|
78
|
+
/** The scopes the integration holds. */
|
|
51
79
|
scopes: string[];
|
|
80
|
+
/** Where Sentry sends webhooks, or `null` for none. */
|
|
52
81
|
webhookUrl: string | null;
|
|
82
|
+
/** Whether the integration is offered as an action in alert rules. */
|
|
53
83
|
isAlertable: boolean;
|
|
84
|
+
/** The OAuth client id; present only when the token may see it. */
|
|
54
85
|
clientId?: string;
|
|
86
|
+
/** The secret that signs webhooks; present only when the token may see it. */
|
|
55
87
|
clientSecret?: string;
|
|
56
88
|
}
|
|
89
|
+
/** Input for `sentryApps.create()` and `sentryApps.update()`. */
|
|
57
90
|
interface SentryAppInput {
|
|
91
|
+
/** The integration's name. */
|
|
58
92
|
name: string;
|
|
59
93
|
/** What the integration may read or write, e.g. `event:read`. The token making the call must hold each. */
|
|
60
94
|
scopes: string[];
|
|
95
|
+
/** Where Sentry sends webhooks; `null` or omitted for none. */
|
|
61
96
|
webhookUrl?: string | null;
|
|
62
97
|
/** Offer the integration as an action in alert rules. */
|
|
63
98
|
isAlertable?: boolean;
|
|
64
99
|
}
|
|
65
100
|
/** An integration installed on the organization. For an internal one this happens when it is created. */
|
|
66
101
|
interface SentryAppInstallation {
|
|
102
|
+
/** The installation's UUID. */
|
|
67
103
|
uuid: string;
|
|
104
|
+
/** The installation's status as Sentry reports it. */
|
|
68
105
|
status: string;
|
|
106
|
+
/** The installed integration. */
|
|
69
107
|
app: {
|
|
108
|
+
/** The integration's UUID. */
|
|
70
109
|
uuid: string;
|
|
110
|
+
/** The integration's slug. */
|
|
71
111
|
slug: string;
|
|
112
|
+
/** The numeric integration id that alert actions point at. */
|
|
72
113
|
sentryAppId: number;
|
|
73
114
|
};
|
|
74
115
|
}
|
|
116
|
+
/** A condition of a workflow trigger or action filter. */
|
|
75
117
|
interface SentryWorkflowCondition {
|
|
118
|
+
/** The condition type. */
|
|
76
119
|
type: string;
|
|
120
|
+
/** What the condition compares against; its shape depends on `type`. */
|
|
77
121
|
comparison: unknown;
|
|
122
|
+
/** The result the condition produces when it holds; its shape depends on `type`. */
|
|
78
123
|
conditionResult: unknown;
|
|
79
124
|
}
|
|
125
|
+
/** An action a workflow runs, such as notifying a channel. */
|
|
80
126
|
interface SentryWorkflowAction {
|
|
127
|
+
/** The action type. */
|
|
81
128
|
type: string;
|
|
129
|
+
/** The action's settings; their shape depends on `type`. */
|
|
82
130
|
config: Record<string, unknown>;
|
|
131
|
+
/** Extra data for the action; its shape depends on `type`. */
|
|
83
132
|
data: Record<string, unknown>;
|
|
84
133
|
}
|
|
134
|
+
/** A group of conditions with the actions to run when they hold. */
|
|
85
135
|
interface SentryWorkflowActionFilter {
|
|
136
|
+
/** How `conditions` combine. */
|
|
86
137
|
logicType: string;
|
|
138
|
+
/** The conditions to test. */
|
|
87
139
|
conditions: SentryWorkflowCondition[];
|
|
140
|
+
/** The actions to run. */
|
|
88
141
|
actions: SentryWorkflowAction[];
|
|
89
142
|
}
|
|
90
143
|
/** What a workflow (an alert rule in Sentry's Monitors → Alerts) is made of, as sent when creating or updating one. */
|
|
91
144
|
interface SentryWorkflowInput {
|
|
145
|
+
/** The workflow's name. */
|
|
92
146
|
name: string;
|
|
147
|
+
/** Whether the workflow is active. */
|
|
93
148
|
enabled: boolean;
|
|
149
|
+
/** The environment it is limited to, or `null` for all. */
|
|
94
150
|
environment: string | null;
|
|
95
151
|
/** `frequency` is minutes between notifications for one issue. */
|
|
96
152
|
config: {
|
|
153
|
+
/** Minutes between notifications for one issue. */
|
|
97
154
|
frequency: number;
|
|
98
155
|
};
|
|
99
156
|
/** The detectors it is attached to; an issue stream detector per project covers that project's issues. */
|
|
100
157
|
detectorIds: string[];
|
|
158
|
+
/** The conditions that start the workflow. */
|
|
101
159
|
triggers: {
|
|
160
|
+
/** How `conditions` combine. */
|
|
102
161
|
logicType: string;
|
|
162
|
+
/** The conditions to test. */
|
|
103
163
|
conditions: SentryWorkflowCondition[];
|
|
104
164
|
};
|
|
165
|
+
/** The condition groups with the actions each runs. */
|
|
105
166
|
actionFilters: SentryWorkflowActionFilter[];
|
|
106
167
|
}
|
|
107
168
|
/** A condition or action as a read returns it: the same shape, with the id Sentry gave it. */
|
|
@@ -112,12 +173,17 @@ type SentryWorkflowActionRead = SentryWorkflowAction & {
|
|
|
112
173
|
id?: string;
|
|
113
174
|
};
|
|
114
175
|
interface SentryWorkflow extends SentryWorkflowInput {
|
|
176
|
+
/** The workflow id. */
|
|
115
177
|
id: string;
|
|
116
178
|
triggers: {
|
|
179
|
+
/** The id Sentry gave the trigger group. */
|
|
117
180
|
id?: string;
|
|
181
|
+
/** How `conditions` combine. */
|
|
118
182
|
logicType: string;
|
|
183
|
+
/** The trigger conditions, with the ids Sentry gave them. */
|
|
119
184
|
conditions: SentryWorkflowConditionRead[];
|
|
120
185
|
};
|
|
186
|
+
/** The condition groups with the actions each runs, with the ids Sentry gave them. */
|
|
121
187
|
actionFilters: Array<{
|
|
122
188
|
id?: string;
|
|
123
189
|
logicType: string;
|
|
@@ -125,15 +191,20 @@ interface SentryWorkflow extends SentryWorkflowInput {
|
|
|
125
191
|
actions: SentryWorkflowActionRead[];
|
|
126
192
|
}>;
|
|
127
193
|
}
|
|
194
|
+
/** A detector: what a workflow is attached to. */
|
|
128
195
|
interface SentryDetector {
|
|
196
|
+
/** The detector id. */
|
|
129
197
|
id: string;
|
|
130
198
|
/** Null for an "all projects" detector. */
|
|
131
199
|
projectId: string | null;
|
|
200
|
+
/** The detector's name. */
|
|
132
201
|
name: string;
|
|
133
202
|
/** `issue_stream` receives every issue of its project; `error` is the error monitor. */
|
|
134
203
|
type: string;
|
|
204
|
+
/** The ids of the workflows attached to it. */
|
|
135
205
|
workflowIds: string[];
|
|
136
206
|
}
|
|
207
|
+
/** Create a Sentry client with `auth`, `projects`, `sentryApps` and `workflows` groups, all sharing one REST client built from `opts`. */
|
|
137
208
|
export declare function createSentryClient(opts: SentryClientOptions): {
|
|
138
209
|
auth: {
|
|
139
210
|
organizations: () => Promise<SentryOrganization[]>;
|
|
@@ -161,5 +232,6 @@ export declare function createSentryClient(opts: SentryClientOptions): {
|
|
|
161
232
|
detectors: (org: string) => Promise<SentryDetector[]>;
|
|
162
233
|
};
|
|
163
234
|
};
|
|
235
|
+
/** The client `createSentryClient()` returns. */
|
|
164
236
|
export type SentryClient = ReturnType<typeof createSentryClient>;
|
|
165
237
|
export type { CreateSentryProjectInput, SentryApp, SentryAppInput, SentryAppInstallation, SentryClientOptions, SentryDetector, SentryKey, SentryKeyDsn, SentryOrganization, SentryProject, SentryWorkflow, SentryWorkflowAction, SentryWorkflowActionFilter, SentryWorkflowCondition, SentryWorkflowInput };
|
package/dist/index.mjs
CHANGED
|
@@ -111,6 +111,7 @@ function workflows(rest) {
|
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
113
|
// src/index.ts
|
|
114
|
+
/** Create a Sentry client with `auth`, `projects`, `sentryApps` and `workflows` groups, all sharing one REST client built from `opts`. */
|
|
114
115
|
function createSentryClient(opts) {
|
|
115
116
|
const rest = createSentryRestClient(opts);
|
|
116
117
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/sentry-client",
|
|
3
|
-
"version": "1.58.0-alpha.
|
|
3
|
+
"version": "1.58.0-alpha.26",
|
|
4
4
|
"description": "A TypeScript client for the Sentry management API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sentry",
|
|
@@ -32,23 +32,23 @@
|
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@theholocron/
|
|
36
|
-
"@theholocron/
|
|
35
|
+
"@theholocron/http-client": "^1.58.0-alpha.26",
|
|
36
|
+
"@theholocron/observability": "^0.7.0-alpha.3"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/node": "^26",
|
|
40
|
-
"@vitest/coverage-v8": "^5.0
|
|
41
|
-
"@vitest/eslint-plugin": "^1.6.
|
|
42
|
-
"eslint": "^10.
|
|
43
|
-
"eslint-plugin-n": "^18.
|
|
44
|
-
"globals": "^17.
|
|
45
|
-
"tsdown": "^0.23.
|
|
40
|
+
"@vitest/coverage-v8": "^5.1.0",
|
|
41
|
+
"@vitest/eslint-plugin": "^1.6.28",
|
|
42
|
+
"eslint": "^10.14.0",
|
|
43
|
+
"eslint-plugin-n": "^18.5.0",
|
|
44
|
+
"globals": "^17.14.0",
|
|
45
|
+
"tsdown": "^0.23.5",
|
|
46
46
|
"typescript": "^5.9.3",
|
|
47
|
-
"vitest": "^5.0
|
|
48
|
-
"@theholocron/eslint-config": "^8.9.0-alpha.
|
|
49
|
-
"@theholocron/
|
|
50
|
-
"@theholocron/
|
|
51
|
-
"@theholocron/
|
|
47
|
+
"vitest": "^5.1.0",
|
|
48
|
+
"@theholocron/eslint-config": "^8.9.0-alpha.15",
|
|
49
|
+
"@theholocron/tsconfig": "^8.9.0-alpha.15",
|
|
50
|
+
"@theholocron/tsdown-config": "^8.9.0-alpha.15",
|
|
51
|
+
"@theholocron/vitest-config": "^8.9.0-alpha.15"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": ">=22.0.0"
|
|
@@ -57,10 +57,10 @@
|
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
|
-
"
|
|
61
|
-
"
|
|
60
|
+
"build": "tsdown && node ../scripts/check-bundle-size.mjs",
|
|
61
|
+
"lint:code": "eslint .",
|
|
62
|
+
"test:unit": "vitest run --coverage",
|
|
62
63
|
"test:watch": "vitest",
|
|
63
|
-
"
|
|
64
|
-
"verification.unitTests": "vitest run"
|
|
64
|
+
"typecheck": "tsc --noEmit"
|
|
65
65
|
}
|
|
66
66
|
}
|