@sentry/junior-plugin-api 0.66.2 → 0.67.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +38 -0
- package/package.json +1 -1
- package/src/index.ts +52 -0
package/dist/index.d.ts
CHANGED
|
@@ -137,6 +137,9 @@ export interface AgentPluginState {
|
|
|
137
137
|
setIfNotExists(key: string, value: unknown, ttlMs?: number): Promise<boolean>;
|
|
138
138
|
withLock<T>(key: string, ttlMs: number, callback: () => Promise<T>): Promise<T>;
|
|
139
139
|
}
|
|
140
|
+
export interface AgentPluginReadState {
|
|
141
|
+
get<T = unknown>(key: string): Promise<T | undefined>;
|
|
142
|
+
}
|
|
140
143
|
export interface HeartbeatHookContext extends AgentPluginContext {
|
|
141
144
|
agent: {
|
|
142
145
|
dispatch(options: DispatchOptions): Promise<DispatchResult>;
|
|
@@ -148,6 +151,40 @@ export interface HeartbeatHookContext extends AgentPluginContext {
|
|
|
148
151
|
export interface HeartbeatResult {
|
|
149
152
|
dispatchCount?: number;
|
|
150
153
|
}
|
|
154
|
+
export type PluginOperationalTone = "danger" | "good" | "neutral" | "warning";
|
|
155
|
+
export interface PluginOperationalMetric {
|
|
156
|
+
label: string;
|
|
157
|
+
tone?: PluginOperationalTone;
|
|
158
|
+
value: string;
|
|
159
|
+
}
|
|
160
|
+
export interface PluginOperationalField {
|
|
161
|
+
key: string;
|
|
162
|
+
label: string;
|
|
163
|
+
}
|
|
164
|
+
export interface PluginOperationalRecord {
|
|
165
|
+
id: string;
|
|
166
|
+
tone?: PluginOperationalTone;
|
|
167
|
+
values: Record<string, string>;
|
|
168
|
+
}
|
|
169
|
+
export interface PluginOperationalRecordSet {
|
|
170
|
+
fields?: PluginOperationalField[];
|
|
171
|
+
emptyText?: string;
|
|
172
|
+
records?: PluginOperationalRecord[];
|
|
173
|
+
title: string;
|
|
174
|
+
}
|
|
175
|
+
export interface PluginOperationalReportContent {
|
|
176
|
+
generatedAt?: string;
|
|
177
|
+
metrics?: PluginOperationalMetric[];
|
|
178
|
+
recordSets?: PluginOperationalRecordSet[];
|
|
179
|
+
title?: string;
|
|
180
|
+
}
|
|
181
|
+
export interface PluginOperationalReport extends PluginOperationalReportContent {
|
|
182
|
+
pluginName: string;
|
|
183
|
+
}
|
|
184
|
+
export interface OperationalReportHookContext extends AgentPluginContext {
|
|
185
|
+
nowMs: number;
|
|
186
|
+
state: AgentPluginReadState;
|
|
187
|
+
}
|
|
151
188
|
export type AgentPluginRouteMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS" | "ALL";
|
|
152
189
|
export type AgentPluginRouteHandler = {
|
|
153
190
|
bivarianceHack(request: Request): Promise<Response> | Response;
|
|
@@ -171,6 +208,7 @@ export interface AgentPluginHooks {
|
|
|
171
208
|
routes?(ctx: RouteRegistrationHookContext): AgentPluginRoute[];
|
|
172
209
|
tools?(ctx: ToolRegistrationHookContext): Record<string, AgentPluginToolDefinition>;
|
|
173
210
|
heartbeat?(ctx: HeartbeatHookContext): Promise<HeartbeatResult | void> | HeartbeatResult | void;
|
|
211
|
+
operationalReport?(ctx: OperationalReportHookContext): Promise<PluginOperationalReportContent | undefined> | PluginOperationalReportContent | undefined;
|
|
174
212
|
slackConversationLink?(ctx: SlackConversationLinkHookContext): SlackConversationLink | undefined;
|
|
175
213
|
}
|
|
176
214
|
export interface JuniorPluginOAuthConfig {
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -167,6 +167,10 @@ export interface AgentPluginState {
|
|
|
167
167
|
): Promise<T>;
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
+
export interface AgentPluginReadState {
|
|
171
|
+
get<T = unknown>(key: string): Promise<T | undefined>;
|
|
172
|
+
}
|
|
173
|
+
|
|
170
174
|
export interface HeartbeatHookContext extends AgentPluginContext {
|
|
171
175
|
agent: {
|
|
172
176
|
dispatch(options: DispatchOptions): Promise<DispatchResult>;
|
|
@@ -180,6 +184,48 @@ export interface HeartbeatResult {
|
|
|
180
184
|
dispatchCount?: number;
|
|
181
185
|
}
|
|
182
186
|
|
|
187
|
+
export type PluginOperationalTone = "danger" | "good" | "neutral" | "warning";
|
|
188
|
+
|
|
189
|
+
export interface PluginOperationalMetric {
|
|
190
|
+
label: string;
|
|
191
|
+
tone?: PluginOperationalTone;
|
|
192
|
+
value: string;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export interface PluginOperationalField {
|
|
196
|
+
key: string;
|
|
197
|
+
label: string;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export interface PluginOperationalRecord {
|
|
201
|
+
id: string;
|
|
202
|
+
tone?: PluginOperationalTone;
|
|
203
|
+
values: Record<string, string>;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export interface PluginOperationalRecordSet {
|
|
207
|
+
fields?: PluginOperationalField[];
|
|
208
|
+
emptyText?: string;
|
|
209
|
+
records?: PluginOperationalRecord[];
|
|
210
|
+
title: string;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export interface PluginOperationalReportContent {
|
|
214
|
+
generatedAt?: string;
|
|
215
|
+
metrics?: PluginOperationalMetric[];
|
|
216
|
+
recordSets?: PluginOperationalRecordSet[];
|
|
217
|
+
title?: string;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export interface PluginOperationalReport extends PluginOperationalReportContent {
|
|
221
|
+
pluginName: string;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export interface OperationalReportHookContext extends AgentPluginContext {
|
|
225
|
+
nowMs: number;
|
|
226
|
+
state: AgentPluginReadState;
|
|
227
|
+
}
|
|
228
|
+
|
|
183
229
|
export type AgentPluginRouteMethod =
|
|
184
230
|
| "GET"
|
|
185
231
|
| "POST"
|
|
@@ -220,6 +266,12 @@ export interface AgentPluginHooks {
|
|
|
220
266
|
heartbeat?(
|
|
221
267
|
ctx: HeartbeatHookContext,
|
|
222
268
|
): Promise<HeartbeatResult | void> | HeartbeatResult | void;
|
|
269
|
+
operationalReport?(
|
|
270
|
+
ctx: OperationalReportHookContext,
|
|
271
|
+
):
|
|
272
|
+
| Promise<PluginOperationalReportContent | undefined>
|
|
273
|
+
| PluginOperationalReportContent
|
|
274
|
+
| undefined;
|
|
223
275
|
slackConversationLink?(
|
|
224
276
|
ctx: SlackConversationLinkHookContext,
|
|
225
277
|
): SlackConversationLink | undefined;
|