@trigger.dev/core 4.7.2 → 4.7.3
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/commonjs/v3/apiClient/index.d.ts +103 -1
- package/dist/commonjs/v3/apiClient/index.js +42 -0
- package/dist/commonjs/v3/apiClient/index.js.map +1 -1
- package/dist/commonjs/v3/isomorphic/friendlyId.d.ts +5 -0
- package/dist/commonjs/v3/isomorphic/friendlyId.js +8 -0
- package/dist/commonjs/v3/isomorphic/friendlyId.js.map +1 -1
- package/dist/commonjs/v3/resource-catalog/catalog.d.ts +7 -5
- package/dist/commonjs/v3/resource-catalog/index.d.ts +7 -5
- package/dist/commonjs/v3/resource-catalog/index.js +14 -8
- package/dist/commonjs/v3/resource-catalog/index.js.map +1 -1
- package/dist/commonjs/v3/resource-catalog/noopResourceCatalog.d.ts +7 -5
- package/dist/commonjs/v3/resource-catalog/noopResourceCatalog.js +10 -4
- package/dist/commonjs/v3/resource-catalog/noopResourceCatalog.js.map +1 -1
- package/dist/commonjs/v3/resource-catalog/standardResourceCatalog.d.ts +11 -8
- package/dist/commonjs/v3/resource-catalog/standardResourceCatalog.js +29 -20
- package/dist/commonjs/v3/resource-catalog/standardResourceCatalog.js.map +1 -1
- package/dist/commonjs/v3/runEngineWorker/index.d.ts +1 -0
- package/dist/commonjs/v3/runEngineWorker/index.js +1 -0
- package/dist/commonjs/v3/runEngineWorker/index.js.map +1 -1
- package/dist/commonjs/v3/runEngineWorker/supervisor/http.d.ts +6 -1
- package/dist/commonjs/v3/runEngineWorker/supervisor/http.js +12 -0
- package/dist/commonjs/v3/runEngineWorker/supervisor/http.js.map +1 -1
- package/dist/commonjs/v3/runEngineWorker/supervisor/queueConsumer.d.ts +4 -2
- package/dist/commonjs/v3/runEngineWorker/supervisor/queueConsumer.js +11 -4
- package/dist/commonjs/v3/runEngineWorker/supervisor/queueConsumer.js.map +1 -1
- package/dist/commonjs/v3/runEngineWorker/supervisor/schemas.d.ts +40 -1
- package/dist/commonjs/v3/runEngineWorker/supervisor/schemas.js +25 -10
- package/dist/commonjs/v3/runEngineWorker/supervisor/schemas.js.map +1 -1
- package/dist/commonjs/v3/runEngineWorker/supervisor/session.d.ts +2 -1
- package/dist/commonjs/v3/runEngineWorker/supervisor/session.js +1 -1
- package/dist/commonjs/v3/runEngineWorker/supervisor/session.js.map +1 -1
- package/dist/commonjs/v3/runEngineWorker/workerQueue.d.ts +121 -0
- package/dist/commonjs/v3/runEngineWorker/workerQueue.js +121 -0
- package/dist/commonjs/v3/runEngineWorker/workerQueue.js.map +1 -0
- package/dist/commonjs/v3/schemas/api.d.ts +26 -9
- package/dist/commonjs/v3/schemas/build.d.ts +48 -18
- package/dist/commonjs/v3/schemas/build.js +2 -1
- package/dist/commonjs/v3/schemas/build.js.map +1 -1
- package/dist/commonjs/v3/schemas/checkpoints.d.ts +2 -0
- package/dist/commonjs/v3/schemas/messages.d.ts +24 -9
- package/dist/commonjs/v3/schemas/resources.d.ts +50 -19
- package/dist/commonjs/v3/schemas/resources.js +9 -5
- package/dist/commonjs/v3/schemas/resources.js.map +1 -1
- package/dist/commonjs/v3/schemas/runEngine.d.ts +4 -0
- package/dist/commonjs/v3/schemas/runEngine.js +4 -0
- package/dist/commonjs/v3/schemas/runEngine.js.map +1 -1
- package/dist/commonjs/v3/schemas/schemas.d.ts +38 -29
- package/dist/commonjs/v3/schemas/schemas.js +12 -8
- package/dist/commonjs/v3/schemas/schemas.js.map +1 -1
- package/dist/commonjs/v3/schemas/webhookApi.d.ts +199 -8
- package/dist/commonjs/v3/schemas/webhookApi.js +100 -7
- package/dist/commonjs/v3/schemas/webhookApi.js.map +1 -1
- package/dist/commonjs/v3/schemas/webhookConfig.d.ts +64 -0
- package/dist/commonjs/v3/schemas/webhookConfig.js +36 -9
- package/dist/commonjs/v3/schemas/webhookConfig.js.map +1 -1
- package/dist/commonjs/v3/types/webhooks.d.ts +23 -2
- package/dist/commonjs/v3/webhooks/index.d.ts +5 -0
- package/dist/commonjs/v3/webhooks/index.js +29 -1
- package/dist/commonjs/v3/webhooks/index.js.map +1 -1
- package/dist/commonjs/version.js +1 -1
- package/dist/esm/v3/apiClient/index.d.ts +103 -1
- package/dist/esm/v3/apiClient/index.js +43 -1
- package/dist/esm/v3/apiClient/index.js.map +1 -1
- package/dist/esm/v3/isomorphic/friendlyId.d.ts +5 -0
- package/dist/esm/v3/isomorphic/friendlyId.js +7 -0
- package/dist/esm/v3/isomorphic/friendlyId.js.map +1 -1
- package/dist/esm/v3/resource-catalog/catalog.d.ts +7 -5
- package/dist/esm/v3/resource-catalog/index.d.ts +7 -5
- package/dist/esm/v3/resource-catalog/index.js +14 -8
- package/dist/esm/v3/resource-catalog/index.js.map +1 -1
- package/dist/esm/v3/resource-catalog/noopResourceCatalog.d.ts +7 -5
- package/dist/esm/v3/resource-catalog/noopResourceCatalog.js +10 -4
- package/dist/esm/v3/resource-catalog/noopResourceCatalog.js.map +1 -1
- package/dist/esm/v3/resource-catalog/standardResourceCatalog.d.ts +11 -8
- package/dist/esm/v3/resource-catalog/standardResourceCatalog.js +29 -20
- package/dist/esm/v3/resource-catalog/standardResourceCatalog.js.map +1 -1
- package/dist/esm/v3/runEngineWorker/index.d.ts +1 -0
- package/dist/esm/v3/runEngineWorker/index.js +1 -0
- package/dist/esm/v3/runEngineWorker/index.js.map +1 -1
- package/dist/esm/v3/runEngineWorker/supervisor/http.d.ts +6 -1
- package/dist/esm/v3/runEngineWorker/supervisor/http.js +13 -1
- package/dist/esm/v3/runEngineWorker/supervisor/http.js.map +1 -1
- package/dist/esm/v3/runEngineWorker/supervisor/queueConsumer.d.ts +4 -2
- package/dist/esm/v3/runEngineWorker/supervisor/queueConsumer.js +11 -4
- package/dist/esm/v3/runEngineWorker/supervisor/queueConsumer.js.map +1 -1
- package/dist/esm/v3/runEngineWorker/supervisor/schemas.d.ts +40 -1
- package/dist/esm/v3/runEngineWorker/supervisor/schemas.js +24 -9
- package/dist/esm/v3/runEngineWorker/supervisor/schemas.js.map +1 -1
- package/dist/esm/v3/runEngineWorker/supervisor/session.d.ts +2 -1
- package/dist/esm/v3/runEngineWorker/supervisor/session.js +1 -1
- package/dist/esm/v3/runEngineWorker/supervisor/session.js.map +1 -1
- package/dist/esm/v3/runEngineWorker/workerQueue.d.ts +121 -0
- package/dist/esm/v3/runEngineWorker/workerQueue.js +112 -0
- package/dist/esm/v3/runEngineWorker/workerQueue.js.map +1 -0
- package/dist/esm/v3/schemas/api.d.ts +26 -9
- package/dist/esm/v3/schemas/build.d.ts +48 -18
- package/dist/esm/v3/schemas/build.js +3 -2
- package/dist/esm/v3/schemas/build.js.map +1 -1
- package/dist/esm/v3/schemas/checkpoints.d.ts +2 -0
- package/dist/esm/v3/schemas/messages.d.ts +24 -9
- package/dist/esm/v3/schemas/resources.d.ts +50 -19
- package/dist/esm/v3/schemas/resources.js +8 -4
- package/dist/esm/v3/schemas/resources.js.map +1 -1
- package/dist/esm/v3/schemas/runEngine.d.ts +4 -0
- package/dist/esm/v3/schemas/runEngine.js +4 -0
- package/dist/esm/v3/schemas/runEngine.js.map +1 -1
- package/dist/esm/v3/schemas/schemas.d.ts +38 -29
- package/dist/esm/v3/schemas/schemas.js +11 -7
- package/dist/esm/v3/schemas/schemas.js.map +1 -1
- package/dist/esm/v3/schemas/webhookApi.d.ts +199 -8
- package/dist/esm/v3/schemas/webhookApi.js +99 -6
- package/dist/esm/v3/schemas/webhookApi.js.map +1 -1
- package/dist/esm/v3/schemas/webhookConfig.d.ts +64 -0
- package/dist/esm/v3/schemas/webhookConfig.js +35 -8
- package/dist/esm/v3/schemas/webhookConfig.js.map +1 -1
- package/dist/esm/v3/types/webhooks.d.ts +23 -2
- package/dist/esm/v3/webhooks/index.d.ts +5 -0
- package/dist/esm/v3/webhooks/index.js +28 -0
- package/dist/esm/v3/webhooks/index.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +1 -1
|
@@ -11,11 +11,12 @@ export declare const WebhookDeliveryApiStatus: z.ZodEnum<{
|
|
|
11
11
|
pending: "pending";
|
|
12
12
|
processing: "processing";
|
|
13
13
|
succeeded: "succeeded";
|
|
14
|
+
unmatched: "unmatched";
|
|
14
15
|
}>;
|
|
15
16
|
export type WebhookDeliveryApiStatus = z.infer<typeof WebhookDeliveryApiStatus>;
|
|
16
17
|
export declare const WebhookEndpointObject: z.ZodObject<{
|
|
17
18
|
id: z.ZodString;
|
|
18
|
-
|
|
19
|
+
declaredId: z.ZodString;
|
|
19
20
|
source: z.ZodString;
|
|
20
21
|
status: z.ZodEnum<{
|
|
21
22
|
active: "active";
|
|
@@ -38,7 +39,7 @@ export type WebhookEndpointObject = z.infer<typeof WebhookEndpointObject>;
|
|
|
38
39
|
export declare const ListWebhookEndpointsResponse: z.ZodObject<{
|
|
39
40
|
data: z.ZodArray<z.ZodObject<{
|
|
40
41
|
id: z.ZodString;
|
|
41
|
-
|
|
42
|
+
declaredId: z.ZodString;
|
|
42
43
|
source: z.ZodString;
|
|
43
44
|
status: z.ZodEnum<{
|
|
44
45
|
active: "active";
|
|
@@ -59,35 +60,99 @@ export declare const ListWebhookEndpointsResponse: z.ZodObject<{
|
|
|
59
60
|
}, z.core.$strip>>;
|
|
60
61
|
}, z.core.$strip>;
|
|
61
62
|
export type ListWebhookEndpointsResponse = z.infer<typeof ListWebhookEndpointsResponse>;
|
|
63
|
+
export declare const WebhookEndpointSubscriberObject: z.ZodObject<{
|
|
64
|
+
id: z.ZodString;
|
|
65
|
+
type: z.ZodEnum<{
|
|
66
|
+
session: "session";
|
|
67
|
+
task: "task";
|
|
68
|
+
}>;
|
|
69
|
+
taskId: z.ZodString;
|
|
70
|
+
filter: z.ZodNullable<z.ZodString>;
|
|
71
|
+
}, z.core.$strip>;
|
|
72
|
+
export type WebhookEndpointSubscriberObject = z.infer<typeof WebhookEndpointSubscriberObject>;
|
|
73
|
+
export declare const WebhookEndpointDetailObject: z.ZodObject<{
|
|
74
|
+
id: z.ZodString;
|
|
75
|
+
declaredId: z.ZodString;
|
|
76
|
+
source: z.ZodString;
|
|
77
|
+
status: z.ZodEnum<{
|
|
78
|
+
active: "active";
|
|
79
|
+
deleting: "deleting";
|
|
80
|
+
inactive: "inactive";
|
|
81
|
+
}>;
|
|
82
|
+
secretProvisioning: z.ZodEnum<{
|
|
83
|
+
either: "either";
|
|
84
|
+
integrator: "integrator";
|
|
85
|
+
provider: "provider";
|
|
86
|
+
}>;
|
|
87
|
+
secretSet: z.ZodBoolean;
|
|
88
|
+
tenantId: z.ZodNullable<z.ZodString>;
|
|
89
|
+
externalRef: z.ZodNullable<z.ZodString>;
|
|
90
|
+
url: z.ZodString;
|
|
91
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
92
|
+
updatedAt: z.ZodCoercedDate<unknown>;
|
|
93
|
+
subscribers: z.ZodArray<z.ZodObject<{
|
|
94
|
+
id: z.ZodString;
|
|
95
|
+
type: z.ZodEnum<{
|
|
96
|
+
session: "session";
|
|
97
|
+
task: "task";
|
|
98
|
+
}>;
|
|
99
|
+
taskId: z.ZodString;
|
|
100
|
+
filter: z.ZodNullable<z.ZodString>;
|
|
101
|
+
}, z.core.$strip>>;
|
|
102
|
+
setupPrompt: z.ZodString;
|
|
103
|
+
}, z.core.$strip>;
|
|
104
|
+
export type WebhookEndpointDetailObject = z.infer<typeof WebhookEndpointDetailObject>;
|
|
62
105
|
export declare const WebhookDeliveryListItem: z.ZodObject<{
|
|
63
106
|
id: z.ZodString;
|
|
64
|
-
|
|
107
|
+
endpoint: z.ZodNullable<z.ZodObject<{
|
|
108
|
+
id: z.ZodString;
|
|
109
|
+
declaredId: z.ZodString;
|
|
110
|
+
}, z.core.$strip>>;
|
|
65
111
|
status: z.ZodEnum<{
|
|
66
112
|
failed: "failed";
|
|
67
113
|
filtered: "filtered";
|
|
68
114
|
pending: "pending";
|
|
69
115
|
processing: "processing";
|
|
70
116
|
succeeded: "succeeded";
|
|
117
|
+
unmatched: "unmatched";
|
|
71
118
|
}>;
|
|
72
119
|
externalDeliveryId: z.ZodString;
|
|
73
|
-
|
|
120
|
+
isTest: z.ZodBoolean;
|
|
74
121
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
75
122
|
processedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
76
123
|
}, z.core.$strip>;
|
|
77
124
|
export type WebhookDeliveryListItem = z.infer<typeof WebhookDeliveryListItem>;
|
|
125
|
+
/** Query for `GET /api/v1/webhooks/deliveries`, newest first. */
|
|
126
|
+
export type ListWebhookDeliveriesQuery = {
|
|
127
|
+
/** Declared endpoint ids or `wh_` ids. */
|
|
128
|
+
endpoint?: string | string[];
|
|
129
|
+
status?: WebhookDeliveryApiStatus | WebhookDeliveryApiStatus[];
|
|
130
|
+
/** A duration back from now, such as `"1h"` or `"7d"`. */
|
|
131
|
+
period?: string;
|
|
132
|
+
from?: Date;
|
|
133
|
+
to?: Date;
|
|
134
|
+
/** 1 to 100. */
|
|
135
|
+
limit?: number;
|
|
136
|
+
/** The `pagination.next` cursor from a previous page. */
|
|
137
|
+
after?: string;
|
|
138
|
+
};
|
|
78
139
|
export declare const ListWebhookDeliveriesResponse: z.ZodObject<{
|
|
79
140
|
data: z.ZodArray<z.ZodObject<{
|
|
80
141
|
id: z.ZodString;
|
|
81
|
-
|
|
142
|
+
endpoint: z.ZodNullable<z.ZodObject<{
|
|
143
|
+
id: z.ZodString;
|
|
144
|
+
declaredId: z.ZodString;
|
|
145
|
+
}, z.core.$strip>>;
|
|
82
146
|
status: z.ZodEnum<{
|
|
83
147
|
failed: "failed";
|
|
84
148
|
filtered: "filtered";
|
|
85
149
|
pending: "pending";
|
|
86
150
|
processing: "processing";
|
|
87
151
|
succeeded: "succeeded";
|
|
152
|
+
unmatched: "unmatched";
|
|
88
153
|
}>;
|
|
89
154
|
externalDeliveryId: z.ZodString;
|
|
90
|
-
|
|
155
|
+
isTest: z.ZodBoolean;
|
|
91
156
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
92
157
|
processedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
93
158
|
}, z.core.$strip>>;
|
|
@@ -97,18 +162,57 @@ export declare const ListWebhookDeliveriesResponse: z.ZodObject<{
|
|
|
97
162
|
}, z.core.$strip>;
|
|
98
163
|
}, z.core.$strip>;
|
|
99
164
|
export type ListWebhookDeliveriesResponse = z.infer<typeof ListWebhookDeliveriesResponse>;
|
|
165
|
+
export declare const WebhookDeliveryTargetApiStatus: z.ZodEnum<{
|
|
166
|
+
failed: "failed";
|
|
167
|
+
filtered: "filtered";
|
|
168
|
+
pending: "pending";
|
|
169
|
+
succeeded: "succeeded";
|
|
170
|
+
}>;
|
|
171
|
+
export type WebhookDeliveryTargetApiStatus = z.infer<typeof WebhookDeliveryTargetApiStatus>;
|
|
172
|
+
/**
|
|
173
|
+
* What a delivery did for one subscriber, or (type `waiter`) the summary of the waiting runs it
|
|
174
|
+
* matched. `runId` and `sessionId` are friendly ids.
|
|
175
|
+
*/
|
|
176
|
+
export declare const WebhookDeliveryTargetObject: z.ZodObject<{
|
|
177
|
+
id: z.ZodString;
|
|
178
|
+
type: z.ZodEnum<{
|
|
179
|
+
session: "session";
|
|
180
|
+
task: "task";
|
|
181
|
+
waiter: "waiter";
|
|
182
|
+
}>;
|
|
183
|
+
status: z.ZodEnum<{
|
|
184
|
+
failed: "failed";
|
|
185
|
+
filtered: "filtered";
|
|
186
|
+
pending: "pending";
|
|
187
|
+
succeeded: "succeeded";
|
|
188
|
+
}>;
|
|
189
|
+
reason: z.ZodNullable<z.ZodString>;
|
|
190
|
+
error: z.ZodNullable<z.ZodString>;
|
|
191
|
+
runId: z.ZodNullable<z.ZodString>;
|
|
192
|
+
sessionId: z.ZodNullable<z.ZodString>;
|
|
193
|
+
waiters: z.ZodNullable<z.ZodObject<{
|
|
194
|
+
matched: z.ZodNumber;
|
|
195
|
+
resumed: z.ZodNumber;
|
|
196
|
+
failed: z.ZodNumber;
|
|
197
|
+
}, z.core.$strip>>;
|
|
198
|
+
}, z.core.$strip>;
|
|
199
|
+
export type WebhookDeliveryTargetObject = z.infer<typeof WebhookDeliveryTargetObject>;
|
|
100
200
|
export declare const WebhookDeliveryObject: z.ZodObject<{
|
|
101
201
|
id: z.ZodString;
|
|
102
|
-
|
|
202
|
+
endpoint: z.ZodNullable<z.ZodObject<{
|
|
203
|
+
id: z.ZodString;
|
|
204
|
+
declaredId: z.ZodString;
|
|
205
|
+
}, z.core.$strip>>;
|
|
103
206
|
status: z.ZodEnum<{
|
|
104
207
|
failed: "failed";
|
|
105
208
|
filtered: "filtered";
|
|
106
209
|
pending: "pending";
|
|
107
210
|
processing: "processing";
|
|
108
211
|
succeeded: "succeeded";
|
|
212
|
+
unmatched: "unmatched";
|
|
109
213
|
}>;
|
|
110
214
|
externalDeliveryId: z.ZodString;
|
|
111
|
-
|
|
215
|
+
isTest: z.ZodBoolean;
|
|
112
216
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
113
217
|
processedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
114
218
|
idempotencyKey: z.ZodString;
|
|
@@ -117,6 +221,29 @@ export declare const WebhookDeliveryObject: z.ZodObject<{
|
|
|
117
221
|
rawBodyHash: z.ZodNullable<z.ZodString>;
|
|
118
222
|
error: z.ZodNullable<z.ZodString>;
|
|
119
223
|
filterReason: z.ZodNullable<z.ZodString>;
|
|
224
|
+
targets: z.ZodArray<z.ZodObject<{
|
|
225
|
+
id: z.ZodString;
|
|
226
|
+
type: z.ZodEnum<{
|
|
227
|
+
session: "session";
|
|
228
|
+
task: "task";
|
|
229
|
+
waiter: "waiter";
|
|
230
|
+
}>;
|
|
231
|
+
status: z.ZodEnum<{
|
|
232
|
+
failed: "failed";
|
|
233
|
+
filtered: "filtered";
|
|
234
|
+
pending: "pending";
|
|
235
|
+
succeeded: "succeeded";
|
|
236
|
+
}>;
|
|
237
|
+
reason: z.ZodNullable<z.ZodString>;
|
|
238
|
+
error: z.ZodNullable<z.ZodString>;
|
|
239
|
+
runId: z.ZodNullable<z.ZodString>;
|
|
240
|
+
sessionId: z.ZodNullable<z.ZodString>;
|
|
241
|
+
waiters: z.ZodNullable<z.ZodObject<{
|
|
242
|
+
matched: z.ZodNumber;
|
|
243
|
+
resumed: z.ZodNumber;
|
|
244
|
+
failed: z.ZodNumber;
|
|
245
|
+
}, z.core.$strip>>;
|
|
246
|
+
}, z.core.$strip>>;
|
|
120
247
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
121
248
|
}, z.core.$strip>;
|
|
122
249
|
export type WebhookDeliveryObject = z.infer<typeof WebhookDeliveryObject>;
|
|
@@ -127,9 +254,73 @@ export declare const RotateWebhookEndpointSecretResponse: z.ZodObject<{
|
|
|
127
254
|
secret: z.ZodString;
|
|
128
255
|
}, z.core.$strip>;
|
|
129
256
|
export type RotateWebhookEndpointSecretResponse = z.infer<typeof RotateWebhookEndpointSecretResponse>;
|
|
257
|
+
/** `PUT /api/v1/webhooks/endpoints/:endpointId/secret`: store a secret or public key the provider issued. */
|
|
258
|
+
export declare const SetWebhookEndpointSecretRequestBody: z.ZodObject<{
|
|
259
|
+
secret: z.ZodString;
|
|
260
|
+
}, z.core.$strip>;
|
|
261
|
+
export type SetWebhookEndpointSecretRequestBody = z.infer<typeof SetWebhookEndpointSecretRequestBody>;
|
|
262
|
+
export declare const SetWebhookEndpointSecretResponse: z.ZodObject<{
|
|
263
|
+
id: z.ZodString;
|
|
264
|
+
secretSet: z.ZodLiteral<true>;
|
|
265
|
+
}, z.core.$strip>;
|
|
266
|
+
export type SetWebhookEndpointSecretResponse = z.infer<typeof SetWebhookEndpointSecretResponse>;
|
|
130
267
|
/** Replaying re-runs a delivery's task from its stored event as a new delivery. */
|
|
131
268
|
export declare const ReplayWebhookDeliveryResponse: z.ZodObject<{
|
|
132
269
|
deliveryId: z.ZodString;
|
|
133
270
|
replayedFrom: z.ZodString;
|
|
134
271
|
}, z.core.$strip>;
|
|
135
272
|
export type ReplayWebhookDeliveryResponse = z.infer<typeof ReplayWebhookDeliveryResponse>;
|
|
273
|
+
/**
|
|
274
|
+
* `POST /api/v1/webhooks/endpoints/:endpointId/waiters`, where `:endpointId` is the declared endpoint
|
|
275
|
+
* id or its `wh_` id. A waiter only matches deliveries that arrive after it was created.
|
|
276
|
+
*/
|
|
277
|
+
export declare const CreateWebhookWaiterRequestBody: z.ZodObject<{
|
|
278
|
+
match: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
279
|
+
filter: z.ZodOptional<z.ZodString>;
|
|
280
|
+
timeout: z.ZodOptional<z.ZodString>;
|
|
281
|
+
tags: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
282
|
+
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
283
|
+
idempotencyKeyTTL: z.ZodOptional<z.ZodString>;
|
|
284
|
+
endpoint: z.ZodOptional<z.ZodObject<{
|
|
285
|
+
tenantId: z.ZodOptional<z.ZodString>;
|
|
286
|
+
externalRef: z.ZodOptional<z.ZodString>;
|
|
287
|
+
}, z.core.$strip>>;
|
|
288
|
+
}, z.core.$strip>;
|
|
289
|
+
export type CreateWebhookWaiterRequestBody = z.infer<typeof CreateWebhookWaiterRequestBody>;
|
|
290
|
+
export declare const CreateWebhookWaiterResponseBody: z.ZodObject<{
|
|
291
|
+
id: z.ZodString;
|
|
292
|
+
url: z.ZodOptional<z.ZodString>;
|
|
293
|
+
expiresAt: z.ZodCoercedDate<unknown>;
|
|
294
|
+
isCached: z.ZodBoolean;
|
|
295
|
+
}, z.core.$strip>;
|
|
296
|
+
export type CreateWebhookWaiterResponseBody = z.infer<typeof CreateWebhookWaiterResponseBody>;
|
|
297
|
+
export declare const WebhookWaiterErrorCode: z.ZodEnum<{
|
|
298
|
+
invalid_request: "invalid_request";
|
|
299
|
+
webhook_endpoint_not_found: "webhook_endpoint_not_found";
|
|
300
|
+
webhook_filter_invalid: "webhook_filter_invalid";
|
|
301
|
+
webhook_waiter_limit: "webhook_waiter_limit";
|
|
302
|
+
}>;
|
|
303
|
+
export type WebhookWaiterErrorCode = z.infer<typeof WebhookWaiterErrorCode>;
|
|
304
|
+
export declare const WebhookWaiterErrorResponseBody: z.ZodObject<{
|
|
305
|
+
error: z.ZodString;
|
|
306
|
+
code: z.ZodEnum<{
|
|
307
|
+
invalid_request: "invalid_request";
|
|
308
|
+
webhook_endpoint_not_found: "webhook_endpoint_not_found";
|
|
309
|
+
webhook_filter_invalid: "webhook_filter_invalid";
|
|
310
|
+
webhook_waiter_limit: "webhook_waiter_limit";
|
|
311
|
+
}>;
|
|
312
|
+
reason: z.ZodOptional<z.ZodEnum<{
|
|
313
|
+
endpoint_limit: "endpoint_limit";
|
|
314
|
+
environment_limit: "environment_limit";
|
|
315
|
+
shape_limit: "shape_limit";
|
|
316
|
+
timeout_too_long: "timeout_too_long";
|
|
317
|
+
}>>;
|
|
318
|
+
}, z.core.$strip>;
|
|
319
|
+
export type WebhookWaiterErrorResponseBody = z.infer<typeof WebhookWaiterErrorResponseBody>;
|
|
320
|
+
/** `POST /api/v1/webhooks/waiters/:waiterId/cancel`. `too_late`: a delivery already claimed it. */
|
|
321
|
+
export declare const CancelWebhookWaiterResponseBody: z.ZodObject<{
|
|
322
|
+
cancelled: z.ZodBoolean;
|
|
323
|
+
reason: z.ZodOptional<z.ZodLiteral<"too_late">>;
|
|
324
|
+
deliveryId: z.ZodOptional<z.ZodString>;
|
|
325
|
+
}, z.core.$strip>;
|
|
326
|
+
export type CancelWebhookWaiterResponseBody = z.infer<typeof CancelWebhookWaiterResponseBody>;
|
|
@@ -12,12 +12,13 @@ export const WebhookDeliveryApiStatus = z.enum([
|
|
|
12
12
|
"succeeded",
|
|
13
13
|
"failed",
|
|
14
14
|
"filtered",
|
|
15
|
+
"unmatched",
|
|
15
16
|
]);
|
|
16
17
|
export const WebhookEndpointObject = z.object({
|
|
17
18
|
/** Stable friendly id, e.g. `wh_...`. */
|
|
18
19
|
id: z.string(),
|
|
19
|
-
/** The declared
|
|
20
|
-
|
|
20
|
+
/** The id the endpoint is declared with in code (`webhooks.endpoint.define({ id })`). */
|
|
21
|
+
declaredId: z.string(),
|
|
21
22
|
/** Provider tag, e.g. "stripe" | "github" | "standard". */
|
|
22
23
|
source: z.string(),
|
|
23
24
|
status: WebhookEndpointApiStatus,
|
|
@@ -36,16 +37,27 @@ export const WebhookEndpointObject = z.object({
|
|
|
36
37
|
export const ListWebhookEndpointsResponse = z.object({
|
|
37
38
|
data: z.array(WebhookEndpointObject),
|
|
38
39
|
});
|
|
40
|
+
export const WebhookEndpointSubscriberObject = z.object({
|
|
41
|
+
id: z.string(),
|
|
42
|
+
type: z.enum(["task", "session"]),
|
|
43
|
+
/** The subscribing task: the webhook() task, or the agent for a session subscriber. */
|
|
44
|
+
taskId: z.string(),
|
|
45
|
+
filter: z.string().nullable(),
|
|
46
|
+
});
|
|
47
|
+
export const WebhookEndpointDetailObject = WebhookEndpointObject.extend({
|
|
48
|
+
subscribers: z.array(WebhookEndpointSubscriberObject),
|
|
49
|
+
/** Instructions for an AI agent to register this endpoint with its provider. */
|
|
50
|
+
setupPrompt: z.string(),
|
|
51
|
+
});
|
|
39
52
|
export const WebhookDeliveryListItem = z.object({
|
|
40
53
|
/** Stable friendly id, e.g. `whd_...`. */
|
|
41
54
|
id: z.string(),
|
|
42
|
-
/** The
|
|
43
|
-
|
|
55
|
+
/** The endpoint the delivery arrived on, or null if it has since been removed. */
|
|
56
|
+
endpoint: z.object({ id: z.string(), declaredId: z.string() }).nullable(),
|
|
44
57
|
status: WebhookDeliveryApiStatus,
|
|
45
58
|
/** Provider delivery id (Stripe event id, GitHub X-GitHub-Delivery, …). */
|
|
46
59
|
externalDeliveryId: z.string(),
|
|
47
|
-
|
|
48
|
-
runId: z.string().nullable(),
|
|
60
|
+
isTest: z.boolean(),
|
|
49
61
|
createdAt: z.coerce.date(),
|
|
50
62
|
processedAt: z.coerce.date().nullable(),
|
|
51
63
|
});
|
|
@@ -56,6 +68,29 @@ export const ListWebhookDeliveriesResponse = z.object({
|
|
|
56
68
|
previous: z.string().optional(),
|
|
57
69
|
}),
|
|
58
70
|
});
|
|
71
|
+
export const WebhookDeliveryTargetApiStatus = z.enum([
|
|
72
|
+
"pending",
|
|
73
|
+
"succeeded",
|
|
74
|
+
"failed",
|
|
75
|
+
"filtered",
|
|
76
|
+
]);
|
|
77
|
+
/**
|
|
78
|
+
* What a delivery did for one subscriber, or (type `waiter`) the summary of the waiting runs it
|
|
79
|
+
* matched. `runId` and `sessionId` are friendly ids.
|
|
80
|
+
*/
|
|
81
|
+
export const WebhookDeliveryTargetObject = z.object({
|
|
82
|
+
/** The subscriber id on the endpoint, or `waiters` for the waiter summary. */
|
|
83
|
+
id: z.string(),
|
|
84
|
+
type: z.enum(["task", "session", "waiter"]),
|
|
85
|
+
status: WebhookDeliveryTargetApiStatus,
|
|
86
|
+
/** Why a filtered target skipped the event. */
|
|
87
|
+
reason: z.string().nullable(),
|
|
88
|
+
error: z.string().nullable(),
|
|
89
|
+
runId: z.string().nullable(),
|
|
90
|
+
sessionId: z.string().nullable(),
|
|
91
|
+
/** For the waiter summary: waiting runs matched, resumed, and given up on. */
|
|
92
|
+
waiters: z.object({ matched: z.number(), resumed: z.number(), failed: z.number() }).nullable(),
|
|
93
|
+
});
|
|
59
94
|
export const WebhookDeliveryObject = WebhookDeliveryListItem.extend({
|
|
60
95
|
idempotencyKey: z.string(),
|
|
61
96
|
/** The size-capped, verified event body. */
|
|
@@ -66,6 +101,8 @@ export const WebhookDeliveryObject = WebhookDeliveryListItem.extend({
|
|
|
66
101
|
error: z.string().nullable(),
|
|
67
102
|
/** For a `filtered` delivery: why it was not routed (failing clause + actual value). */
|
|
68
103
|
filterReason: z.string().nullable(),
|
|
104
|
+
/** One entry per subscriber, plus a waiter summary when waiting runs matched. */
|
|
105
|
+
targets: z.array(WebhookDeliveryTargetObject),
|
|
69
106
|
updatedAt: z.coerce.date(),
|
|
70
107
|
});
|
|
71
108
|
// ── Write actions ──
|
|
@@ -75,6 +112,14 @@ export const RotateWebhookEndpointSecretResponse = z.object({
|
|
|
75
112
|
secretSet: z.literal(true),
|
|
76
113
|
secret: z.string(),
|
|
77
114
|
});
|
|
115
|
+
/** `PUT /api/v1/webhooks/endpoints/:endpointId/secret`: store a secret or public key the provider issued. */
|
|
116
|
+
export const SetWebhookEndpointSecretRequestBody = z.object({
|
|
117
|
+
secret: z.string().trim().min(1).max(4096),
|
|
118
|
+
});
|
|
119
|
+
export const SetWebhookEndpointSecretResponse = z.object({
|
|
120
|
+
id: z.string(),
|
|
121
|
+
secretSet: z.literal(true),
|
|
122
|
+
});
|
|
78
123
|
/** Replaying re-runs a delivery's task from its stored event as a new delivery. */
|
|
79
124
|
export const ReplayWebhookDeliveryResponse = z.object({
|
|
80
125
|
/** The new delivery's friendly id (GET it once processed for the run). */
|
|
@@ -82,4 +127,52 @@ export const ReplayWebhookDeliveryResponse = z.object({
|
|
|
82
127
|
/** The original delivery id the replay was created from. */
|
|
83
128
|
replayedFrom: z.string(),
|
|
84
129
|
});
|
|
130
|
+
// ── Webhook waiters ──
|
|
131
|
+
/**
|
|
132
|
+
* `POST /api/v1/webhooks/endpoints/:endpointId/waiters`, where `:endpointId` is the declared endpoint
|
|
133
|
+
* id or its `wh_` id. A waiter only matches deliveries that arrive after it was created.
|
|
134
|
+
*/
|
|
135
|
+
export const CreateWebhookWaiterRequestBody = z.object({
|
|
136
|
+
/** Paths to expected values: `event.*` reads the body, `header.*` a header and `webhook.*` the endpoint. Omit for a URL-matched waiter. */
|
|
137
|
+
match: z.record(z.string(), z.union([z.string(), z.number(), z.boolean()])).optional(),
|
|
138
|
+
/** A filter the event must also pass, checked after `match`. */
|
|
139
|
+
filter: z.string().optional(),
|
|
140
|
+
/** A duration (`"1h"`) or an ISO date. Default 24 hours, maximum 90 days. */
|
|
141
|
+
timeout: z.string().optional(),
|
|
142
|
+
tags: z.union([z.string(), z.array(z.string())]).optional(),
|
|
143
|
+
idempotencyKey: z.string().optional(),
|
|
144
|
+
idempotencyKeyTTL: z.string().optional(),
|
|
145
|
+
/** Selects a dynamic endpoint instance. Reserved: only the declared instance is supported. */
|
|
146
|
+
endpoint: z
|
|
147
|
+
.object({ tenantId: z.string().optional(), externalRef: z.string().optional() })
|
|
148
|
+
.optional(),
|
|
149
|
+
});
|
|
150
|
+
export const CreateWebhookWaiterResponseBody = z.object({
|
|
151
|
+
/** The waiter id, which is also its waitpoint id. */
|
|
152
|
+
id: z.string(),
|
|
153
|
+
/** For a URL-matched waiter: the URL to hand the provider as its per-request callback. */
|
|
154
|
+
url: z.string().optional(),
|
|
155
|
+
expiresAt: z.coerce.date(),
|
|
156
|
+
isCached: z.boolean(),
|
|
157
|
+
});
|
|
158
|
+
export const WebhookWaiterErrorCode = z.enum([
|
|
159
|
+
"webhook_waiter_limit",
|
|
160
|
+
"webhook_endpoint_not_found",
|
|
161
|
+
"webhook_filter_invalid",
|
|
162
|
+
"invalid_request",
|
|
163
|
+
]);
|
|
164
|
+
export const WebhookWaiterErrorResponseBody = z.object({
|
|
165
|
+
error: z.string(),
|
|
166
|
+
code: WebhookWaiterErrorCode,
|
|
167
|
+
/** For `webhook_waiter_limit`: which limit. */
|
|
168
|
+
reason: z
|
|
169
|
+
.enum(["environment_limit", "endpoint_limit", "shape_limit", "timeout_too_long"])
|
|
170
|
+
.optional(),
|
|
171
|
+
});
|
|
172
|
+
/** `POST /api/v1/webhooks/waiters/:waiterId/cancel`. `too_late`: a delivery already claimed it. */
|
|
173
|
+
export const CancelWebhookWaiterResponseBody = z.object({
|
|
174
|
+
cancelled: z.boolean(),
|
|
175
|
+
reason: z.literal("too_late").optional(),
|
|
176
|
+
deliveryId: z.string().optional(),
|
|
177
|
+
});
|
|
85
178
|
//# sourceMappingURL=webhookApi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhookApi.js","sourceRoot":"","sources":["../../../../src/v3/schemas/webhookApi.ts"],"names":[],"mapp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AG,CAAC,CAAC,MAAM,CAAC;IACtD,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;IACtB,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE;IACxC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
|
+
import type { FilterAst } from "./webhookFilter.js";
|
|
2
3
|
export declare const WebhookSecretProvisioning: z.ZodEnum<{
|
|
3
4
|
either: "either";
|
|
4
5
|
integrator: "integrator";
|
|
@@ -470,6 +471,10 @@ export type WebhookHandshakeConfig = z.infer<typeof WebhookHandshakeConfig>;
|
|
|
470
471
|
*/
|
|
471
472
|
export declare const WebhookResponseConfig: z.ZodObject<{
|
|
472
473
|
acceptedStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<200>, z.ZodLiteral<202>, z.ZodLiteral<204>]>>;
|
|
474
|
+
acceptedBody: z.ZodOptional<z.ZodEnum<{
|
|
475
|
+
empty: "empty";
|
|
476
|
+
json: "json";
|
|
477
|
+
}>>;
|
|
473
478
|
rejectedStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<400>, z.ZodLiteral<401>, z.ZodLiteral<403>]>>;
|
|
474
479
|
}, z.core.$strip>;
|
|
475
480
|
export type WebhookResponseConfig = z.infer<typeof WebhookResponseConfig>;
|
|
@@ -677,6 +682,10 @@ export declare const WebhookVerifierArtifact: import("../utils/zod.js").Compatib
|
|
|
677
682
|
}, z.core.$strip>>;
|
|
678
683
|
response: z.ZodOptional<z.ZodObject<{
|
|
679
684
|
acceptedStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<200>, z.ZodLiteral<202>, z.ZodLiteral<204>]>>;
|
|
685
|
+
acceptedBody: z.ZodOptional<z.ZodEnum<{
|
|
686
|
+
empty: "empty";
|
|
687
|
+
json: "json";
|
|
688
|
+
}>>;
|
|
680
689
|
rejectedStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<400>, z.ZodLiteral<401>, z.ZodLiteral<403>]>>;
|
|
681
690
|
}, z.core.$strip>>;
|
|
682
691
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -872,6 +881,10 @@ export declare const WebhookVerifierArtifact: import("../utils/zod.js").Compatib
|
|
|
872
881
|
}, z.core.$strip>>;
|
|
873
882
|
response: z.ZodOptional<z.ZodObject<{
|
|
874
883
|
acceptedStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<200>, z.ZodLiteral<202>, z.ZodLiteral<204>]>>;
|
|
884
|
+
acceptedBody: z.ZodOptional<z.ZodEnum<{
|
|
885
|
+
empty: "empty";
|
|
886
|
+
json: "json";
|
|
887
|
+
}>>;
|
|
875
888
|
rejectedStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<400>, z.ZodLiteral<401>, z.ZodLiteral<403>]>>;
|
|
876
889
|
}, z.core.$strip>>;
|
|
877
890
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -880,11 +893,20 @@ export declare const WebhookVerifierArtifact: import("../utils/zod.js").Compatib
|
|
|
880
893
|
hash: z.ZodString;
|
|
881
894
|
}, z.core.$strip>]>;
|
|
882
895
|
export type WebhookVerifierArtifact = z.infer<typeof WebhookVerifierArtifact>;
|
|
896
|
+
/**
|
|
897
|
+
* One subscriber of a shared endpoint. `id` is the descriptor that declared it (the `webhook()` id, or
|
|
898
|
+
* `agentId:eventId` / `agentId:connectorId` for a session subscriber) and is unique within the endpoint.
|
|
899
|
+
* `filter` is this subscriber's own delivery filter; the session variant's `startOn` separately gates
|
|
900
|
+
* session creation.
|
|
901
|
+
*/
|
|
883
902
|
export declare const WebhookRoutingTarget: import("../utils/zod.js").CompatibleZodDiscriminatedUnion<readonly [z.ZodObject<{
|
|
884
903
|
type: z.ZodLiteral<"task">;
|
|
904
|
+
id: z.ZodString;
|
|
885
905
|
taskId: z.ZodString;
|
|
906
|
+
filter: z.ZodOptional<z.ZodString>;
|
|
886
907
|
}, z.core.$strip>, z.ZodObject<{
|
|
887
908
|
type: z.ZodLiteral<"session">;
|
|
909
|
+
id: z.ZodString;
|
|
888
910
|
taskIdentifier: z.ZodString;
|
|
889
911
|
keyTemplate: z.ZodString;
|
|
890
912
|
deliverAs: z.ZodEnum<{
|
|
@@ -895,8 +917,50 @@ export declare const WebhookRoutingTarget: import("../utils/zod.js").CompatibleZ
|
|
|
895
917
|
connectorId: z.ZodOptional<z.ZodString>;
|
|
896
918
|
triggerConfigTemplate: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
897
919
|
startOn: z.ZodOptional<z.ZodString>;
|
|
920
|
+
filter: z.ZodOptional<z.ZodString>;
|
|
898
921
|
}, z.core.$strip>]>;
|
|
899
922
|
export type WebhookRoutingTarget = z.infer<typeof WebhookRoutingTarget>;
|
|
923
|
+
/** A routing target as stored on `WebhookEndpoint.routingTargets`, with its filter compiled at deploy. */
|
|
924
|
+
export type StoredWebhookRoutingTarget = WebhookRoutingTarget & {
|
|
925
|
+
filterAst?: FilterAst;
|
|
926
|
+
filterAstVersion?: number;
|
|
927
|
+
};
|
|
928
|
+
export declare const WebhookDeliveryTargetStatus: z.ZodEnum<{
|
|
929
|
+
FAILED: "FAILED";
|
|
930
|
+
FILTERED: "FILTERED";
|
|
931
|
+
PENDING: "PENDING";
|
|
932
|
+
SUCCEEDED: "SUCCEEDED";
|
|
933
|
+
}>;
|
|
934
|
+
export type WebhookDeliveryTargetStatus = z.infer<typeof WebhookDeliveryTargetStatus>;
|
|
935
|
+
/** One target's outcome for one delivery, stored on `WebhookDelivery.targets`. */
|
|
936
|
+
export declare const WebhookDeliveryTargetResult: z.ZodObject<{
|
|
937
|
+
id: z.ZodString;
|
|
938
|
+
type: z.ZodEnum<{
|
|
939
|
+
session: "session";
|
|
940
|
+
task: "task";
|
|
941
|
+
waiter: "waiter";
|
|
942
|
+
}>;
|
|
943
|
+
status: z.ZodEnum<{
|
|
944
|
+
FAILED: "FAILED";
|
|
945
|
+
FILTERED: "FILTERED";
|
|
946
|
+
PENDING: "PENDING";
|
|
947
|
+
SUCCEEDED: "SUCCEEDED";
|
|
948
|
+
}>;
|
|
949
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
950
|
+
runId: z.ZodOptional<z.ZodString>;
|
|
951
|
+
error: z.ZodOptional<z.ZodString>;
|
|
952
|
+
deliverAs: z.ZodOptional<z.ZodEnum<{
|
|
953
|
+
action: "action";
|
|
954
|
+
message: "message";
|
|
955
|
+
}>>;
|
|
956
|
+
taskId: z.ZodOptional<z.ZodString>;
|
|
957
|
+
waiters: z.ZodOptional<z.ZodObject<{
|
|
958
|
+
matched: z.ZodNumber;
|
|
959
|
+
resumed: z.ZodNumber;
|
|
960
|
+
failed: z.ZodNumber;
|
|
961
|
+
}, z.core.$strip>>;
|
|
962
|
+
}, z.core.$strip>;
|
|
963
|
+
export type WebhookDeliveryTargetResult = z.infer<typeof WebhookDeliveryTargetResult>;
|
|
900
964
|
export declare const WebhookVerifierResult: z.ZodObject<{
|
|
901
965
|
ok: z.ZodBoolean;
|
|
902
966
|
idempotencyKey: z.ZodString;
|
|
@@ -147,6 +147,11 @@ export const WebhookHandshakeConfig = z.object({
|
|
|
147
147
|
export const WebhookResponseConfig = z.object({
|
|
148
148
|
/** Status for a recorded or deduplicated delivery. 204 sends no body. Default 200 with a JSON body. */
|
|
149
149
|
acceptedStatus: z.union([z.literal(200), z.literal(202), z.literal(204)]).optional(),
|
|
150
|
+
/**
|
|
151
|
+
* Body for a recorded or deduplicated delivery. `"empty"` answers with no body, for providers
|
|
152
|
+
* that show a non-empty reply to the user (Slack slash commands). Default `"json"`.
|
|
153
|
+
*/
|
|
154
|
+
acceptedBody: z.enum(["json", "empty"]).optional(),
|
|
150
155
|
/** Status when signature verification fails. Default 400. */
|
|
151
156
|
rejectedStatus: z.union([z.literal(400), z.literal(401), z.literal(403)]).optional(),
|
|
152
157
|
});
|
|
@@ -189,26 +194,48 @@ export const WebhookVerifierArtifact = discriminatedUnion("kind", [
|
|
|
189
194
|
}),
|
|
190
195
|
z.object({ kind: z.literal("bundle"), bundleUrl: z.string(), hash: z.string() }), // P3 seam
|
|
191
196
|
]);
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
+
/**
|
|
198
|
+
* One subscriber of a shared endpoint. `id` is the descriptor that declared it (the `webhook()` id, or
|
|
199
|
+
* `agentId:eventId` / `agentId:connectorId` for a session subscriber) and is unique within the endpoint.
|
|
200
|
+
* `filter` is this subscriber's own delivery filter; the session variant's `startOn` separately gates
|
|
201
|
+
* session creation.
|
|
202
|
+
*/
|
|
197
203
|
export const WebhookRoutingTarget = discriminatedUnion("type", [
|
|
198
|
-
z.object({
|
|
204
|
+
z.object({
|
|
205
|
+
type: z.literal("task"),
|
|
206
|
+
id: z.string().min(1),
|
|
207
|
+
taskId: z.string(),
|
|
208
|
+
filter: z.string().optional(),
|
|
209
|
+
}),
|
|
199
210
|
z.object({
|
|
200
211
|
type: z.literal("session"),
|
|
212
|
+
id: z.string().min(1),
|
|
201
213
|
taskIdentifier: z.string(),
|
|
202
214
|
keyTemplate: z.string(),
|
|
203
215
|
deliverAs: z.enum(["action", "message"]),
|
|
204
216
|
actionType: z.string().optional(),
|
|
205
217
|
connectorId: z.string().optional(),
|
|
206
218
|
triggerConfigTemplate: z.record(z.string(), z.unknown()).optional(),
|
|
207
|
-
// Gate session CREATION: an event that already resolves to an existing session always resumes it,
|
|
208
|
-
// but a key with no session is only started when the event matches this filter. Absent => always start.
|
|
209
219
|
startOn: z.string().optional(),
|
|
220
|
+
filter: z.string().optional(),
|
|
210
221
|
}),
|
|
211
222
|
]);
|
|
223
|
+
export const WebhookDeliveryTargetStatus = z.enum(["PENDING", "FILTERED", "SUCCEEDED", "FAILED"]);
|
|
224
|
+
/** One target's outcome for one delivery, stored on `WebhookDelivery.targets`. */
|
|
225
|
+
export const WebhookDeliveryTargetResult = z.object({
|
|
226
|
+
id: z.string(),
|
|
227
|
+
type: z.enum(["task", "session", "waiter"]),
|
|
228
|
+
status: WebhookDeliveryTargetStatus,
|
|
229
|
+
reason: z.string().optional(),
|
|
230
|
+
runId: z.string().optional(),
|
|
231
|
+
error: z.string().optional(),
|
|
232
|
+
/** For a session target: how it was delivered, kept so the result reads the same after a redeploy. */
|
|
233
|
+
deliverAs: z.enum(["action", "message"]).optional(),
|
|
234
|
+
/** On a replay's target: the task the replay was authorized to reach. If the subscriber now points elsewhere, it fails instead of running. */
|
|
235
|
+
taskId: z.string().optional(),
|
|
236
|
+
/** On the delivery's one waiter entry: how many waiters it matched, resumed and failed to resume. */
|
|
237
|
+
waiters: z.object({ matched: z.number(), resumed: z.number(), failed: z.number() }).optional(),
|
|
238
|
+
});
|
|
212
239
|
// ── Data-only verdict the engine verifier returns (M5 consumes) ──
|
|
213
240
|
export const WebhookVerifierResult = z.object({
|
|
214
241
|
ok: z.boolean(),
|