@sentry/junior-plugin-api 0.106.0 → 0.107.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.js +11 -0
- package/dist/operations.d.ts +3 -0
- package/dist/resource-events.d.ts +15 -0
- package/package.json +1 -1
- package/src/operations.ts +5 -1
- package/src/resource-events.ts +20 -0
package/dist/index.js
CHANGED
|
@@ -190,6 +190,16 @@ var subscribableResourceSchema = z3.object({
|
|
|
190
190
|
supportedEvents: z3.array(z3.string().min(1)),
|
|
191
191
|
type: z3.string().min(1)
|
|
192
192
|
}).strict();
|
|
193
|
+
var resourceEventSchema = z3.object({
|
|
194
|
+
eventKey: z3.string().min(1),
|
|
195
|
+
eventType: z3.string().min(1),
|
|
196
|
+
occurredAtMs: z3.number().finite(),
|
|
197
|
+
provider: z3.string().min(1),
|
|
198
|
+
resourceRef: z3.string().min(1),
|
|
199
|
+
terminal: z3.boolean().optional(),
|
|
200
|
+
trustedSummary: z3.string().min(1),
|
|
201
|
+
untrustedText: z3.string().optional()
|
|
202
|
+
}).strict();
|
|
193
203
|
|
|
194
204
|
// src/tasks.ts
|
|
195
205
|
import { z as z4 } from "zod";
|
|
@@ -487,6 +497,7 @@ export {
|
|
|
487
497
|
pluginToolErrorSchema,
|
|
488
498
|
pluginToolResultSchema,
|
|
489
499
|
promptMessageSchema,
|
|
500
|
+
resourceEventSchema,
|
|
490
501
|
slackActorSchema,
|
|
491
502
|
slackDestinationSchema,
|
|
492
503
|
slackSourceSchema,
|
package/dist/operations.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import type { PluginContext } from "./context";
|
|
3
3
|
import type { Dispatch, DispatchOptions, DispatchResult } from "./dispatch";
|
|
4
4
|
import type { PluginReadState, PluginState } from "./state";
|
|
5
|
+
import type { ResourceEventPublisher } from "./resource-events";
|
|
5
6
|
export interface HeartbeatHookContext extends PluginContext {
|
|
6
7
|
agent: {
|
|
7
8
|
dispatch(options: DispatchOptions): Promise<DispatchResult>;
|
|
@@ -71,6 +72,8 @@ export type PluginRouteApp = {
|
|
|
71
72
|
fetch(request: Request, context?: PluginApiRouteRequestContext): Promise<Response> | Response;
|
|
72
73
|
};
|
|
73
74
|
export interface RouteRegistrationHookContext extends PluginContext {
|
|
75
|
+
/** Core-owned delivery boundary for provider webhook events. */
|
|
76
|
+
resourceEvents: ResourceEventPublisher;
|
|
74
77
|
}
|
|
75
78
|
export interface ApiRouteRegistrationHookContext extends PluginContext {
|
|
76
79
|
}
|
|
@@ -8,3 +8,18 @@ export declare const subscribableResourceSchema: z.ZodObject<{
|
|
|
8
8
|
type: z.ZodString;
|
|
9
9
|
}, z.core.$strict>;
|
|
10
10
|
export type SubscribableResource = z.output<typeof subscribableResourceSchema>;
|
|
11
|
+
export declare const resourceEventSchema: z.ZodObject<{
|
|
12
|
+
eventKey: z.ZodString;
|
|
13
|
+
eventType: z.ZodString;
|
|
14
|
+
occurredAtMs: z.ZodNumber;
|
|
15
|
+
provider: z.ZodString;
|
|
16
|
+
resourceRef: z.ZodString;
|
|
17
|
+
terminal: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
+
trustedSummary: z.ZodString;
|
|
19
|
+
untrustedText: z.ZodOptional<z.ZodString>;
|
|
20
|
+
}, z.core.$strict>;
|
|
21
|
+
export type ResourceEvent = z.output<typeof resourceEventSchema>;
|
|
22
|
+
export interface ResourceEventPublisher {
|
|
23
|
+
/** Publish one normalized event whose provider matches the owning plugin name. */
|
|
24
|
+
publish(event: ResourceEvent): Promise<void>;
|
|
25
|
+
}
|
package/package.json
CHANGED
package/src/operations.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { PluginContext } from "./context";
|
|
|
3
3
|
import type { Dispatch, DispatchOptions, DispatchResult } from "./dispatch";
|
|
4
4
|
import { nonBlankStringSchema } from "./schemas";
|
|
5
5
|
import type { PluginReadState, PluginState } from "./state";
|
|
6
|
+
import type { ResourceEventPublisher } from "./resource-events";
|
|
6
7
|
|
|
7
8
|
export interface HeartbeatHookContext extends PluginContext {
|
|
8
9
|
agent: {
|
|
@@ -99,7 +100,10 @@ export type PluginRouteApp = {
|
|
|
99
100
|
): Promise<Response> | Response;
|
|
100
101
|
};
|
|
101
102
|
|
|
102
|
-
export interface RouteRegistrationHookContext extends PluginContext {
|
|
103
|
+
export interface RouteRegistrationHookContext extends PluginContext {
|
|
104
|
+
/** Core-owned delivery boundary for provider webhook events. */
|
|
105
|
+
resourceEvents: ResourceEventPublisher;
|
|
106
|
+
}
|
|
103
107
|
|
|
104
108
|
export interface ApiRouteRegistrationHookContext extends PluginContext {}
|
|
105
109
|
|
package/src/resource-events.ts
CHANGED
|
@@ -12,3 +12,23 @@ export const subscribableResourceSchema = z
|
|
|
12
12
|
.strict();
|
|
13
13
|
|
|
14
14
|
export type SubscribableResource = z.output<typeof subscribableResourceSchema>;
|
|
15
|
+
|
|
16
|
+
export const resourceEventSchema = z
|
|
17
|
+
.object({
|
|
18
|
+
eventKey: z.string().min(1),
|
|
19
|
+
eventType: z.string().min(1),
|
|
20
|
+
occurredAtMs: z.number().finite(),
|
|
21
|
+
provider: z.string().min(1),
|
|
22
|
+
resourceRef: z.string().min(1),
|
|
23
|
+
terminal: z.boolean().optional(),
|
|
24
|
+
trustedSummary: z.string().min(1),
|
|
25
|
+
untrustedText: z.string().optional(),
|
|
26
|
+
})
|
|
27
|
+
.strict();
|
|
28
|
+
|
|
29
|
+
export type ResourceEvent = z.output<typeof resourceEventSchema>;
|
|
30
|
+
|
|
31
|
+
export interface ResourceEventPublisher {
|
|
32
|
+
/** Publish one normalized event whose provider matches the owning plugin name. */
|
|
33
|
+
publish(event: ResourceEvent): Promise<void>;
|
|
34
|
+
}
|