@slates/test 1.0.0-rc.10 → 1.0.0-rc.12
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.cjs +2 -1
- package/dist/index.d.cts +101 -0
- package/dist/index.d.ts +101 -0
- package/dist/index.module.js +2 -1
- package/package.json +4 -4
- package/src/index.test.ts +66 -2
- package/src/runtime.ts +3 -1
package/dist/index.cjs
CHANGED
|
@@ -242,7 +242,8 @@ var handleSlateTriggerWebhook = async (d) => d.client.handleTriggerWebhook({
|
|
|
242
242
|
method: d.method ?? "POST",
|
|
243
243
|
headers: d.headers,
|
|
244
244
|
body: d.body,
|
|
245
|
-
state: d.state
|
|
245
|
+
state: d.state,
|
|
246
|
+
registrationDetails: d.registrationDetails
|
|
246
247
|
});
|
|
247
248
|
var unregisterSlateTriggerWebhook = async (d) => d.client.unregisterTriggerWebhook({
|
|
248
249
|
actionId: d.triggerId,
|
package/dist/index.d.cts
CHANGED
|
@@ -116,6 +116,7 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
|
|
|
116
116
|
}[];
|
|
117
117
|
type: "action.tool";
|
|
118
118
|
capabilities: Record<string, never>;
|
|
119
|
+
isPublic: boolean;
|
|
119
120
|
description?: string | undefined;
|
|
120
121
|
instructions?: string[] | undefined;
|
|
121
122
|
constraints?: string[] | undefined;
|
|
@@ -130,6 +131,7 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
|
|
|
130
131
|
}[];
|
|
131
132
|
} | undefined;
|
|
132
133
|
authMethods?: string[] | undefined;
|
|
134
|
+
adapter?: string | null | undefined;
|
|
133
135
|
} | {
|
|
134
136
|
id: string;
|
|
135
137
|
name: string;
|
|
@@ -149,6 +151,26 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
|
|
|
149
151
|
type: "webhook";
|
|
150
152
|
autoRegistration: boolean;
|
|
151
153
|
autoUnregistration: boolean;
|
|
154
|
+
http?: {
|
|
155
|
+
methods?: ("GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS")[] | undefined;
|
|
156
|
+
sync?: {
|
|
157
|
+
mode: "match" | "never" | "always";
|
|
158
|
+
match?: {
|
|
159
|
+
method?: string | undefined;
|
|
160
|
+
hasQueryParam?: string | undefined;
|
|
161
|
+
hasHeader?: string | undefined;
|
|
162
|
+
jsonBodyField?: {
|
|
163
|
+
path: string;
|
|
164
|
+
equals?: string | undefined;
|
|
165
|
+
} | undefined;
|
|
166
|
+
formBodyField?: {
|
|
167
|
+
path: string;
|
|
168
|
+
equals?: string | undefined;
|
|
169
|
+
} | undefined;
|
|
170
|
+
}[] | undefined;
|
|
171
|
+
timeoutMs?: number | undefined;
|
|
172
|
+
} | undefined;
|
|
173
|
+
} | undefined;
|
|
152
174
|
};
|
|
153
175
|
description?: string | undefined;
|
|
154
176
|
instructions?: string[] | undefined;
|
|
@@ -164,6 +186,7 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
|
|
|
164
186
|
}[];
|
|
165
187
|
} | undefined;
|
|
166
188
|
authMethods?: string[] | undefined;
|
|
189
|
+
adapter?: string | null | undefined;
|
|
167
190
|
})[];
|
|
168
191
|
tools: {
|
|
169
192
|
id: string;
|
|
@@ -177,6 +200,7 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
|
|
|
177
200
|
}[];
|
|
178
201
|
type: "action.tool";
|
|
179
202
|
capabilities: Record<string, never>;
|
|
203
|
+
isPublic: boolean;
|
|
180
204
|
description?: string | undefined;
|
|
181
205
|
instructions?: string[] | undefined;
|
|
182
206
|
constraints?: string[] | undefined;
|
|
@@ -191,6 +215,7 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
|
|
|
191
215
|
}[];
|
|
192
216
|
} | undefined;
|
|
193
217
|
authMethods?: string[] | undefined;
|
|
218
|
+
adapter?: string | null | undefined;
|
|
194
219
|
}[];
|
|
195
220
|
triggers: {
|
|
196
221
|
id: string;
|
|
@@ -211,6 +236,26 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
|
|
|
211
236
|
type: "webhook";
|
|
212
237
|
autoRegistration: boolean;
|
|
213
238
|
autoUnregistration: boolean;
|
|
239
|
+
http?: {
|
|
240
|
+
methods?: ("GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS")[] | undefined;
|
|
241
|
+
sync?: {
|
|
242
|
+
mode: "match" | "never" | "always";
|
|
243
|
+
match?: {
|
|
244
|
+
method?: string | undefined;
|
|
245
|
+
hasQueryParam?: string | undefined;
|
|
246
|
+
hasHeader?: string | undefined;
|
|
247
|
+
jsonBodyField?: {
|
|
248
|
+
path: string;
|
|
249
|
+
equals?: string | undefined;
|
|
250
|
+
} | undefined;
|
|
251
|
+
formBodyField?: {
|
|
252
|
+
path: string;
|
|
253
|
+
equals?: string | undefined;
|
|
254
|
+
} | undefined;
|
|
255
|
+
}[] | undefined;
|
|
256
|
+
timeoutMs?: number | undefined;
|
|
257
|
+
} | undefined;
|
|
258
|
+
} | undefined;
|
|
214
259
|
};
|
|
215
260
|
description?: string | undefined;
|
|
216
261
|
instructions?: string[] | undefined;
|
|
@@ -226,6 +271,7 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
|
|
|
226
271
|
}[];
|
|
227
272
|
} | undefined;
|
|
228
273
|
authMethods?: string[] | undefined;
|
|
274
|
+
adapter?: string | null | undefined;
|
|
229
275
|
}[];
|
|
230
276
|
authMethods: {
|
|
231
277
|
id: string;
|
|
@@ -293,6 +339,7 @@ declare let expectSlateContract: (d: {
|
|
|
293
339
|
}[];
|
|
294
340
|
type: "action.tool";
|
|
295
341
|
capabilities: Record<string, never>;
|
|
342
|
+
isPublic: boolean;
|
|
296
343
|
description?: string | undefined;
|
|
297
344
|
instructions?: string[] | undefined;
|
|
298
345
|
constraints?: string[] | undefined;
|
|
@@ -307,6 +354,7 @@ declare let expectSlateContract: (d: {
|
|
|
307
354
|
}[];
|
|
308
355
|
} | undefined;
|
|
309
356
|
authMethods?: string[] | undefined;
|
|
357
|
+
adapter?: string | null | undefined;
|
|
310
358
|
} | {
|
|
311
359
|
id: string;
|
|
312
360
|
name: string;
|
|
@@ -326,6 +374,26 @@ declare let expectSlateContract: (d: {
|
|
|
326
374
|
type: "webhook";
|
|
327
375
|
autoRegistration: boolean;
|
|
328
376
|
autoUnregistration: boolean;
|
|
377
|
+
http?: {
|
|
378
|
+
methods?: ("GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS")[] | undefined;
|
|
379
|
+
sync?: {
|
|
380
|
+
mode: "match" | "never" | "always";
|
|
381
|
+
match?: {
|
|
382
|
+
method?: string | undefined;
|
|
383
|
+
hasQueryParam?: string | undefined;
|
|
384
|
+
hasHeader?: string | undefined;
|
|
385
|
+
jsonBodyField?: {
|
|
386
|
+
path: string;
|
|
387
|
+
equals?: string | undefined;
|
|
388
|
+
} | undefined;
|
|
389
|
+
formBodyField?: {
|
|
390
|
+
path: string;
|
|
391
|
+
equals?: string | undefined;
|
|
392
|
+
} | undefined;
|
|
393
|
+
}[] | undefined;
|
|
394
|
+
timeoutMs?: number | undefined;
|
|
395
|
+
} | undefined;
|
|
396
|
+
} | undefined;
|
|
329
397
|
};
|
|
330
398
|
description?: string | undefined;
|
|
331
399
|
instructions?: string[] | undefined;
|
|
@@ -341,6 +409,7 @@ declare let expectSlateContract: (d: {
|
|
|
341
409
|
}[];
|
|
342
410
|
} | undefined;
|
|
343
411
|
authMethods?: string[] | undefined;
|
|
412
|
+
adapter?: string | null | undefined;
|
|
344
413
|
})[];
|
|
345
414
|
tools: {
|
|
346
415
|
id: string;
|
|
@@ -354,6 +423,7 @@ declare let expectSlateContract: (d: {
|
|
|
354
423
|
}[];
|
|
355
424
|
type: "action.tool";
|
|
356
425
|
capabilities: Record<string, never>;
|
|
426
|
+
isPublic: boolean;
|
|
357
427
|
description?: string | undefined;
|
|
358
428
|
instructions?: string[] | undefined;
|
|
359
429
|
constraints?: string[] | undefined;
|
|
@@ -368,6 +438,7 @@ declare let expectSlateContract: (d: {
|
|
|
368
438
|
}[];
|
|
369
439
|
} | undefined;
|
|
370
440
|
authMethods?: string[] | undefined;
|
|
441
|
+
adapter?: string | null | undefined;
|
|
371
442
|
}[];
|
|
372
443
|
triggers: {
|
|
373
444
|
id: string;
|
|
@@ -388,6 +459,26 @@ declare let expectSlateContract: (d: {
|
|
|
388
459
|
type: "webhook";
|
|
389
460
|
autoRegistration: boolean;
|
|
390
461
|
autoUnregistration: boolean;
|
|
462
|
+
http?: {
|
|
463
|
+
methods?: ("GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS")[] | undefined;
|
|
464
|
+
sync?: {
|
|
465
|
+
mode: "match" | "never" | "always";
|
|
466
|
+
match?: {
|
|
467
|
+
method?: string | undefined;
|
|
468
|
+
hasQueryParam?: string | undefined;
|
|
469
|
+
hasHeader?: string | undefined;
|
|
470
|
+
jsonBodyField?: {
|
|
471
|
+
path: string;
|
|
472
|
+
equals?: string | undefined;
|
|
473
|
+
} | undefined;
|
|
474
|
+
formBodyField?: {
|
|
475
|
+
path: string;
|
|
476
|
+
equals?: string | undefined;
|
|
477
|
+
} | undefined;
|
|
478
|
+
}[] | undefined;
|
|
479
|
+
timeoutMs?: number | undefined;
|
|
480
|
+
} | undefined;
|
|
481
|
+
} | undefined;
|
|
391
482
|
};
|
|
392
483
|
description?: string | undefined;
|
|
393
484
|
instructions?: string[] | undefined;
|
|
@@ -403,6 +494,7 @@ declare let expectSlateContract: (d: {
|
|
|
403
494
|
}[];
|
|
404
495
|
} | undefined;
|
|
405
496
|
authMethods?: string[] | undefined;
|
|
497
|
+
adapter?: string | null | undefined;
|
|
406
498
|
}[];
|
|
407
499
|
authMethods: {
|
|
408
500
|
id: string;
|
|
@@ -518,9 +610,18 @@ declare let handleSlateTriggerWebhook: (d: {
|
|
|
518
610
|
headers?: Record<string, string>;
|
|
519
611
|
body?: string | Uint8Array | null;
|
|
520
612
|
state?: any;
|
|
613
|
+
registrationDetails?: any;
|
|
521
614
|
}) => Promise<{
|
|
522
615
|
inputs: Record<string, any>[];
|
|
523
616
|
updatedState?: any;
|
|
617
|
+
response?: {
|
|
618
|
+
status: number;
|
|
619
|
+
headers: Record<string, string>;
|
|
620
|
+
body: {
|
|
621
|
+
encoding: "base64";
|
|
622
|
+
content: string;
|
|
623
|
+
} | null;
|
|
624
|
+
} | null | undefined;
|
|
524
625
|
requestTraces?: {
|
|
525
626
|
startedAt: string;
|
|
526
627
|
durationMs: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -116,6 +116,7 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
|
|
|
116
116
|
}[];
|
|
117
117
|
type: "action.tool";
|
|
118
118
|
capabilities: Record<string, never>;
|
|
119
|
+
isPublic: boolean;
|
|
119
120
|
description?: string | undefined;
|
|
120
121
|
instructions?: string[] | undefined;
|
|
121
122
|
constraints?: string[] | undefined;
|
|
@@ -130,6 +131,7 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
|
|
|
130
131
|
}[];
|
|
131
132
|
} | undefined;
|
|
132
133
|
authMethods?: string[] | undefined;
|
|
134
|
+
adapter?: string | null | undefined;
|
|
133
135
|
} | {
|
|
134
136
|
id: string;
|
|
135
137
|
name: string;
|
|
@@ -149,6 +151,26 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
|
|
|
149
151
|
type: "webhook";
|
|
150
152
|
autoRegistration: boolean;
|
|
151
153
|
autoUnregistration: boolean;
|
|
154
|
+
http?: {
|
|
155
|
+
methods?: ("GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS")[] | undefined;
|
|
156
|
+
sync?: {
|
|
157
|
+
mode: "match" | "never" | "always";
|
|
158
|
+
match?: {
|
|
159
|
+
method?: string | undefined;
|
|
160
|
+
hasQueryParam?: string | undefined;
|
|
161
|
+
hasHeader?: string | undefined;
|
|
162
|
+
jsonBodyField?: {
|
|
163
|
+
path: string;
|
|
164
|
+
equals?: string | undefined;
|
|
165
|
+
} | undefined;
|
|
166
|
+
formBodyField?: {
|
|
167
|
+
path: string;
|
|
168
|
+
equals?: string | undefined;
|
|
169
|
+
} | undefined;
|
|
170
|
+
}[] | undefined;
|
|
171
|
+
timeoutMs?: number | undefined;
|
|
172
|
+
} | undefined;
|
|
173
|
+
} | undefined;
|
|
152
174
|
};
|
|
153
175
|
description?: string | undefined;
|
|
154
176
|
instructions?: string[] | undefined;
|
|
@@ -164,6 +186,7 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
|
|
|
164
186
|
}[];
|
|
165
187
|
} | undefined;
|
|
166
188
|
authMethods?: string[] | undefined;
|
|
189
|
+
adapter?: string | null | undefined;
|
|
167
190
|
})[];
|
|
168
191
|
tools: {
|
|
169
192
|
id: string;
|
|
@@ -177,6 +200,7 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
|
|
|
177
200
|
}[];
|
|
178
201
|
type: "action.tool";
|
|
179
202
|
capabilities: Record<string, never>;
|
|
203
|
+
isPublic: boolean;
|
|
180
204
|
description?: string | undefined;
|
|
181
205
|
instructions?: string[] | undefined;
|
|
182
206
|
constraints?: string[] | undefined;
|
|
@@ -191,6 +215,7 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
|
|
|
191
215
|
}[];
|
|
192
216
|
} | undefined;
|
|
193
217
|
authMethods?: string[] | undefined;
|
|
218
|
+
adapter?: string | null | undefined;
|
|
194
219
|
}[];
|
|
195
220
|
triggers: {
|
|
196
221
|
id: string;
|
|
@@ -211,6 +236,26 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
|
|
|
211
236
|
type: "webhook";
|
|
212
237
|
autoRegistration: boolean;
|
|
213
238
|
autoUnregistration: boolean;
|
|
239
|
+
http?: {
|
|
240
|
+
methods?: ("GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS")[] | undefined;
|
|
241
|
+
sync?: {
|
|
242
|
+
mode: "match" | "never" | "always";
|
|
243
|
+
match?: {
|
|
244
|
+
method?: string | undefined;
|
|
245
|
+
hasQueryParam?: string | undefined;
|
|
246
|
+
hasHeader?: string | undefined;
|
|
247
|
+
jsonBodyField?: {
|
|
248
|
+
path: string;
|
|
249
|
+
equals?: string | undefined;
|
|
250
|
+
} | undefined;
|
|
251
|
+
formBodyField?: {
|
|
252
|
+
path: string;
|
|
253
|
+
equals?: string | undefined;
|
|
254
|
+
} | undefined;
|
|
255
|
+
}[] | undefined;
|
|
256
|
+
timeoutMs?: number | undefined;
|
|
257
|
+
} | undefined;
|
|
258
|
+
} | undefined;
|
|
214
259
|
};
|
|
215
260
|
description?: string | undefined;
|
|
216
261
|
instructions?: string[] | undefined;
|
|
@@ -226,6 +271,7 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
|
|
|
226
271
|
}[];
|
|
227
272
|
} | undefined;
|
|
228
273
|
authMethods?: string[] | undefined;
|
|
274
|
+
adapter?: string | null | undefined;
|
|
229
275
|
}[];
|
|
230
276
|
authMethods: {
|
|
231
277
|
id: string;
|
|
@@ -293,6 +339,7 @@ declare let expectSlateContract: (d: {
|
|
|
293
339
|
}[];
|
|
294
340
|
type: "action.tool";
|
|
295
341
|
capabilities: Record<string, never>;
|
|
342
|
+
isPublic: boolean;
|
|
296
343
|
description?: string | undefined;
|
|
297
344
|
instructions?: string[] | undefined;
|
|
298
345
|
constraints?: string[] | undefined;
|
|
@@ -307,6 +354,7 @@ declare let expectSlateContract: (d: {
|
|
|
307
354
|
}[];
|
|
308
355
|
} | undefined;
|
|
309
356
|
authMethods?: string[] | undefined;
|
|
357
|
+
adapter?: string | null | undefined;
|
|
310
358
|
} | {
|
|
311
359
|
id: string;
|
|
312
360
|
name: string;
|
|
@@ -326,6 +374,26 @@ declare let expectSlateContract: (d: {
|
|
|
326
374
|
type: "webhook";
|
|
327
375
|
autoRegistration: boolean;
|
|
328
376
|
autoUnregistration: boolean;
|
|
377
|
+
http?: {
|
|
378
|
+
methods?: ("GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS")[] | undefined;
|
|
379
|
+
sync?: {
|
|
380
|
+
mode: "match" | "never" | "always";
|
|
381
|
+
match?: {
|
|
382
|
+
method?: string | undefined;
|
|
383
|
+
hasQueryParam?: string | undefined;
|
|
384
|
+
hasHeader?: string | undefined;
|
|
385
|
+
jsonBodyField?: {
|
|
386
|
+
path: string;
|
|
387
|
+
equals?: string | undefined;
|
|
388
|
+
} | undefined;
|
|
389
|
+
formBodyField?: {
|
|
390
|
+
path: string;
|
|
391
|
+
equals?: string | undefined;
|
|
392
|
+
} | undefined;
|
|
393
|
+
}[] | undefined;
|
|
394
|
+
timeoutMs?: number | undefined;
|
|
395
|
+
} | undefined;
|
|
396
|
+
} | undefined;
|
|
329
397
|
};
|
|
330
398
|
description?: string | undefined;
|
|
331
399
|
instructions?: string[] | undefined;
|
|
@@ -341,6 +409,7 @@ declare let expectSlateContract: (d: {
|
|
|
341
409
|
}[];
|
|
342
410
|
} | undefined;
|
|
343
411
|
authMethods?: string[] | undefined;
|
|
412
|
+
adapter?: string | null | undefined;
|
|
344
413
|
})[];
|
|
345
414
|
tools: {
|
|
346
415
|
id: string;
|
|
@@ -354,6 +423,7 @@ declare let expectSlateContract: (d: {
|
|
|
354
423
|
}[];
|
|
355
424
|
type: "action.tool";
|
|
356
425
|
capabilities: Record<string, never>;
|
|
426
|
+
isPublic: boolean;
|
|
357
427
|
description?: string | undefined;
|
|
358
428
|
instructions?: string[] | undefined;
|
|
359
429
|
constraints?: string[] | undefined;
|
|
@@ -368,6 +438,7 @@ declare let expectSlateContract: (d: {
|
|
|
368
438
|
}[];
|
|
369
439
|
} | undefined;
|
|
370
440
|
authMethods?: string[] | undefined;
|
|
441
|
+
adapter?: string | null | undefined;
|
|
371
442
|
}[];
|
|
372
443
|
triggers: {
|
|
373
444
|
id: string;
|
|
@@ -388,6 +459,26 @@ declare let expectSlateContract: (d: {
|
|
|
388
459
|
type: "webhook";
|
|
389
460
|
autoRegistration: boolean;
|
|
390
461
|
autoUnregistration: boolean;
|
|
462
|
+
http?: {
|
|
463
|
+
methods?: ("GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS")[] | undefined;
|
|
464
|
+
sync?: {
|
|
465
|
+
mode: "match" | "never" | "always";
|
|
466
|
+
match?: {
|
|
467
|
+
method?: string | undefined;
|
|
468
|
+
hasQueryParam?: string | undefined;
|
|
469
|
+
hasHeader?: string | undefined;
|
|
470
|
+
jsonBodyField?: {
|
|
471
|
+
path: string;
|
|
472
|
+
equals?: string | undefined;
|
|
473
|
+
} | undefined;
|
|
474
|
+
formBodyField?: {
|
|
475
|
+
path: string;
|
|
476
|
+
equals?: string | undefined;
|
|
477
|
+
} | undefined;
|
|
478
|
+
}[] | undefined;
|
|
479
|
+
timeoutMs?: number | undefined;
|
|
480
|
+
} | undefined;
|
|
481
|
+
} | undefined;
|
|
391
482
|
};
|
|
392
483
|
description?: string | undefined;
|
|
393
484
|
instructions?: string[] | undefined;
|
|
@@ -403,6 +494,7 @@ declare let expectSlateContract: (d: {
|
|
|
403
494
|
}[];
|
|
404
495
|
} | undefined;
|
|
405
496
|
authMethods?: string[] | undefined;
|
|
497
|
+
adapter?: string | null | undefined;
|
|
406
498
|
}[];
|
|
407
499
|
authMethods: {
|
|
408
500
|
id: string;
|
|
@@ -518,9 +610,18 @@ declare let handleSlateTriggerWebhook: (d: {
|
|
|
518
610
|
headers?: Record<string, string>;
|
|
519
611
|
body?: string | Uint8Array | null;
|
|
520
612
|
state?: any;
|
|
613
|
+
registrationDetails?: any;
|
|
521
614
|
}) => Promise<{
|
|
522
615
|
inputs: Record<string, any>[];
|
|
523
616
|
updatedState?: any;
|
|
617
|
+
response?: {
|
|
618
|
+
status: number;
|
|
619
|
+
headers: Record<string, string>;
|
|
620
|
+
body: {
|
|
621
|
+
encoding: "base64";
|
|
622
|
+
content: string;
|
|
623
|
+
} | null;
|
|
624
|
+
} | null | undefined;
|
|
524
625
|
requestTraces?: {
|
|
525
626
|
startedAt: string;
|
|
526
627
|
durationMs: number;
|
package/dist/index.module.js
CHANGED
|
@@ -212,7 +212,8 @@ var handleSlateTriggerWebhook = async (d) => d.client.handleTriggerWebhook({
|
|
|
212
212
|
method: d.method ?? "POST",
|
|
213
213
|
headers: d.headers,
|
|
214
214
|
body: d.body,
|
|
215
|
-
state: d.state
|
|
215
|
+
state: d.state,
|
|
216
|
+
registrationDetails: d.registrationDetails
|
|
216
217
|
});
|
|
217
218
|
var unregisterSlateTriggerWebhook = async (d) => d.client.unregisterTriggerWebhook({
|
|
218
219
|
actionId: d.triggerId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slates/test",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.12",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@lowerdeck/testing-tools": "latest",
|
|
43
|
-
"@slates/client": "1.0.0-rc.
|
|
44
|
-
"@slates/profiles": "1.0.0-rc.
|
|
43
|
+
"@slates/client": "1.0.0-rc.15",
|
|
44
|
+
"@slates/profiles": "1.0.0-rc.13"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@slates/provider": "1.0.0-rc.
|
|
47
|
+
"@slates/provider": "1.0.0-rc.18",
|
|
48
48
|
"@slates/tsconfig": "1.0.0-rc.1",
|
|
49
49
|
"typescript": "5.8.2",
|
|
50
50
|
"vitest": "^3.1.2",
|
package/src/index.test.ts
CHANGED
|
@@ -186,6 +186,25 @@ let createDemoSlate = () => {
|
|
|
186
186
|
})
|
|
187
187
|
)
|
|
188
188
|
.webhook({
|
|
189
|
+
http: {
|
|
190
|
+
methods: ['POST', 'OPTIONS'],
|
|
191
|
+
sync: {
|
|
192
|
+
mode: 'match',
|
|
193
|
+
match: [
|
|
194
|
+
{
|
|
195
|
+
method: 'POST',
|
|
196
|
+
hasHeader: 'x-demo-event'
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
formBodyField: {
|
|
200
|
+
path: 'mode',
|
|
201
|
+
equals: 'subscribe'
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
],
|
|
205
|
+
timeoutMs: 4_000
|
|
206
|
+
}
|
|
207
|
+
},
|
|
189
208
|
autoRegisterWebhook: async ctx => ({
|
|
190
209
|
registrationDetails: {
|
|
191
210
|
webhookBaseUrl: ctx.input.webhookBaseUrl,
|
|
@@ -213,7 +232,14 @@ let createDemoSlate = () => {
|
|
|
213
232
|
],
|
|
214
233
|
updatedState: {
|
|
215
234
|
lastEvent: ctx.request.headers.get('x-demo-event') ?? 'unknown'
|
|
216
|
-
}
|
|
235
|
+
},
|
|
236
|
+
response: new Response(ctx.registrationDetails?.channelId ?? 'missing', {
|
|
237
|
+
status: 201,
|
|
238
|
+
headers: {
|
|
239
|
+
'content-type': 'text/plain',
|
|
240
|
+
'x-demo-response': 'accepted'
|
|
241
|
+
}
|
|
242
|
+
})
|
|
217
243
|
};
|
|
218
244
|
},
|
|
219
245
|
handleEvent: async ctx => ({
|
|
@@ -404,6 +430,32 @@ describe('@slates/test', () => {
|
|
|
404
430
|
});
|
|
405
431
|
|
|
406
432
|
expect(contract.configSchema.properties.prefix.type).toBe('string');
|
|
433
|
+
expect(contract.triggers.find(action => action.id === 'webhook_echo')?.invocation).toEqual(
|
|
434
|
+
{
|
|
435
|
+
type: 'webhook',
|
|
436
|
+
autoRegistration: true,
|
|
437
|
+
autoUnregistration: true,
|
|
438
|
+
http: {
|
|
439
|
+
methods: ['POST', 'OPTIONS'],
|
|
440
|
+
sync: {
|
|
441
|
+
mode: 'match',
|
|
442
|
+
match: [
|
|
443
|
+
{
|
|
444
|
+
method: 'POST',
|
|
445
|
+
hasHeader: 'x-demo-event'
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
formBodyField: {
|
|
449
|
+
path: 'mode',
|
|
450
|
+
equals: 'subscribe'
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
],
|
|
454
|
+
timeoutMs: 4_000
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
);
|
|
407
459
|
|
|
408
460
|
await expectToolCall({
|
|
409
461
|
client,
|
|
@@ -490,12 +542,24 @@ describe('@slates/test', () => {
|
|
|
490
542
|
headers: {
|
|
491
543
|
'x-demo-event': 'created'
|
|
492
544
|
},
|
|
493
|
-
body: 'payload-value'
|
|
545
|
+
body: 'payload-value',
|
|
546
|
+
registrationDetails: registration.registrationDetails
|
|
494
547
|
});
|
|
495
548
|
expect(handled).toMatchObject({
|
|
496
549
|
inputs: [{ value: 'payload-value' }],
|
|
497
550
|
updatedState: {
|
|
498
551
|
lastEvent: 'created'
|
|
552
|
+
},
|
|
553
|
+
response: {
|
|
554
|
+
status: 201,
|
|
555
|
+
headers: {
|
|
556
|
+
'content-type': 'text/plain',
|
|
557
|
+
'x-demo-response': 'accepted'
|
|
558
|
+
},
|
|
559
|
+
body: {
|
|
560
|
+
encoding: 'base64',
|
|
561
|
+
content: Buffer.from('channel-1').toString('base64')
|
|
562
|
+
}
|
|
499
563
|
}
|
|
500
564
|
});
|
|
501
565
|
|
package/src/runtime.ts
CHANGED
|
@@ -337,6 +337,7 @@ export let handleSlateTriggerWebhook = async (d: {
|
|
|
337
337
|
headers?: Record<string, string>;
|
|
338
338
|
body?: string | Uint8Array | null;
|
|
339
339
|
state?: any;
|
|
340
|
+
registrationDetails?: any;
|
|
340
341
|
}) =>
|
|
341
342
|
d.client.handleTriggerWebhook({
|
|
342
343
|
actionId: d.triggerId,
|
|
@@ -344,7 +345,8 @@ export let handleSlateTriggerWebhook = async (d: {
|
|
|
344
345
|
method: d.method ?? 'POST',
|
|
345
346
|
headers: d.headers,
|
|
346
347
|
body: d.body,
|
|
347
|
-
state: d.state
|
|
348
|
+
state: d.state,
|
|
349
|
+
registrationDetails: d.registrationDetails
|
|
348
350
|
});
|
|
349
351
|
|
|
350
352
|
export let unregisterSlateTriggerWebhook = async (d: {
|