@slates/test 1.0.0-rc.17 → 1.0.0-rc.19

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 CHANGED
@@ -24,6 +24,11 @@ interface ExpectedSlateAction {
24
24
  description?: string;
25
25
  readOnly?: boolean;
26
26
  destructive?: boolean;
27
+ }
28
+ interface ExpectedSlateTriggerGroup {
29
+ id: string;
30
+ name?: string;
31
+ description?: string;
27
32
  invocationType?: 'polling' | 'webhook';
28
33
  }
29
34
  declare let getVitestExpect: () => vitest.ExpectStatic;
@@ -57,6 +62,8 @@ declare let expectToolCall: (d: {
57
62
  url: string;
58
63
  headers?: Record<string, string> | undefined;
59
64
  query?: Record<string, string> | undefined;
65
+ refreshReference?: unknown;
66
+ refreshAt?: string | undefined;
60
67
  } | {
61
68
  type: "content";
62
69
  encoding: "utf-8" | "base64";
@@ -150,34 +157,7 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
150
157
  }[];
151
158
  type: "action.trigger";
152
159
  capabilities: Record<string, never>;
153
- invocation: {
154
- type: "polling";
155
- intervalSeconds: number;
156
- } | {
157
- type: "webhook";
158
- autoRegistration: boolean;
159
- autoUnregistration: boolean;
160
- http?: {
161
- methods?: ("GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS")[] | undefined;
162
- sync?: {
163
- mode: "match" | "never" | "always";
164
- match?: {
165
- method?: string | undefined;
166
- hasQueryParam?: string | undefined;
167
- hasHeader?: string | undefined;
168
- jsonBodyField?: {
169
- path: string;
170
- equals?: string | undefined;
171
- } | undefined;
172
- formBodyField?: {
173
- path: string;
174
- equals?: string | undefined;
175
- } | undefined;
176
- }[] | undefined;
177
- timeoutMs?: number | undefined;
178
- } | undefined;
179
- } | undefined;
180
- };
160
+ triggerGroupId: string;
181
161
  description?: string | undefined;
182
162
  instructions?: string[] | undefined;
183
163
  constraints?: string[] | undefined;
@@ -235,34 +215,7 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
235
215
  }[];
236
216
  type: "action.trigger";
237
217
  capabilities: Record<string, never>;
238
- invocation: {
239
- type: "polling";
240
- intervalSeconds: number;
241
- } | {
242
- type: "webhook";
243
- autoRegistration: boolean;
244
- autoUnregistration: boolean;
245
- http?: {
246
- methods?: ("GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS")[] | undefined;
247
- sync?: {
248
- mode: "match" | "never" | "always";
249
- match?: {
250
- method?: string | undefined;
251
- hasQueryParam?: string | undefined;
252
- hasHeader?: string | undefined;
253
- jsonBodyField?: {
254
- path: string;
255
- equals?: string | undefined;
256
- } | undefined;
257
- formBodyField?: {
258
- path: string;
259
- equals?: string | undefined;
260
- } | undefined;
261
- }[] | undefined;
262
- timeoutMs?: number | undefined;
263
- } | undefined;
264
- } | undefined;
265
- };
218
+ triggerGroupId: string;
266
219
  description?: string | undefined;
267
220
  instructions?: string[] | undefined;
268
221
  constraints?: string[] | undefined;
@@ -279,6 +232,25 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
279
232
  authMethods?: string[] | undefined;
280
233
  adapter?: string | null | undefined;
281
234
  }[];
235
+ triggerGroups: {
236
+ id: string;
237
+ name: string;
238
+ invocation: {
239
+ type: "polling";
240
+ intervalSeconds: number;
241
+ } | {
242
+ type: "webhook";
243
+ registration: {
244
+ mode: "auto";
245
+ } | {
246
+ mode: "manual";
247
+ userConfigSchema: Record<string, any>;
248
+ fullConfigSchema: Record<string, any>;
249
+ };
250
+ };
251
+ description?: string | undefined;
252
+ metadata?: Record<string, any> | undefined;
253
+ }[];
282
254
  authMethods: {
283
255
  id: string;
284
256
  name: string;
@@ -321,9 +293,11 @@ declare let expectSlateContract: (d: {
321
293
  };
322
294
  toolIds?: string[];
323
295
  triggerIds?: string[];
296
+ triggerGroupIds?: string[];
324
297
  authMethodIds?: string[];
325
298
  tools?: ExpectedSlateAction[];
326
299
  triggers?: ExpectedSlateAction[];
300
+ triggerGroups?: ExpectedSlateTriggerGroup[];
327
301
  }) => Promise<{
328
302
  provider: {
329
303
  type: "provider";
@@ -372,34 +346,7 @@ declare let expectSlateContract: (d: {
372
346
  }[];
373
347
  type: "action.trigger";
374
348
  capabilities: Record<string, never>;
375
- invocation: {
376
- type: "polling";
377
- intervalSeconds: number;
378
- } | {
379
- type: "webhook";
380
- autoRegistration: boolean;
381
- autoUnregistration: boolean;
382
- http?: {
383
- methods?: ("GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS")[] | undefined;
384
- sync?: {
385
- mode: "match" | "never" | "always";
386
- match?: {
387
- method?: string | undefined;
388
- hasQueryParam?: string | undefined;
389
- hasHeader?: string | undefined;
390
- jsonBodyField?: {
391
- path: string;
392
- equals?: string | undefined;
393
- } | undefined;
394
- formBodyField?: {
395
- path: string;
396
- equals?: string | undefined;
397
- } | undefined;
398
- }[] | undefined;
399
- timeoutMs?: number | undefined;
400
- } | undefined;
401
- } | undefined;
402
- };
349
+ triggerGroupId: string;
403
350
  description?: string | undefined;
404
351
  instructions?: string[] | undefined;
405
352
  constraints?: string[] | undefined;
@@ -457,34 +404,7 @@ declare let expectSlateContract: (d: {
457
404
  }[];
458
405
  type: "action.trigger";
459
406
  capabilities: Record<string, never>;
460
- invocation: {
461
- type: "polling";
462
- intervalSeconds: number;
463
- } | {
464
- type: "webhook";
465
- autoRegistration: boolean;
466
- autoUnregistration: boolean;
467
- http?: {
468
- methods?: ("GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS")[] | undefined;
469
- sync?: {
470
- mode: "match" | "never" | "always";
471
- match?: {
472
- method?: string | undefined;
473
- hasQueryParam?: string | undefined;
474
- hasHeader?: string | undefined;
475
- jsonBodyField?: {
476
- path: string;
477
- equals?: string | undefined;
478
- } | undefined;
479
- formBodyField?: {
480
- path: string;
481
- equals?: string | undefined;
482
- } | undefined;
483
- }[] | undefined;
484
- timeoutMs?: number | undefined;
485
- } | undefined;
486
- } | undefined;
487
- };
407
+ triggerGroupId: string;
488
408
  description?: string | undefined;
489
409
  instructions?: string[] | undefined;
490
410
  constraints?: string[] | undefined;
@@ -501,6 +421,25 @@ declare let expectSlateContract: (d: {
501
421
  authMethods?: string[] | undefined;
502
422
  adapter?: string | null | undefined;
503
423
  }[];
424
+ triggerGroups: {
425
+ id: string;
426
+ name: string;
427
+ invocation: {
428
+ type: "polling";
429
+ intervalSeconds: number;
430
+ } | {
431
+ type: "webhook";
432
+ registration: {
433
+ mode: "auto";
434
+ } | {
435
+ mode: "manual";
436
+ userConfigSchema: Record<string, any>;
437
+ fullConfigSchema: Record<string, any>;
438
+ };
439
+ };
440
+ description?: string | undefined;
441
+ metadata?: Record<string, any> | undefined;
442
+ }[];
504
443
  authMethods: {
505
444
  id: string;
506
445
  name: string;
@@ -534,13 +473,15 @@ declare let expectSlateContract: (d: {
534
473
  }[];
535
474
  configSchema: Record<string, any>;
536
475
  }>;
537
- declare let registerSlateTriggerWebhook: (d: {
476
+ declare let registerSlateTriggerGroupWebhook: (d: {
538
477
  client: SlatesTestClient;
539
- triggerId: string;
540
- webhookBaseUrl: string;
478
+ triggerGroupId: string;
479
+ webhookTargetIdentifier: string;
480
+ webhookTargetPayload: any;
481
+ webhookUrl: string;
541
482
  }) => Promise<{
542
- registrationDetails: any;
543
- state?: any;
483
+ webhookRegistrationIdentifier: string;
484
+ webhookRegistrationPayload: any;
544
485
  requestTraces?: {
545
486
  startedAt: string;
546
487
  durationMs: number;
@@ -570,12 +511,16 @@ declare let registerSlateTriggerWebhook: (d: {
570
511
  } | undefined;
571
512
  }[] | undefined;
572
513
  }>;
573
- declare let pollSlateTriggerEvents: (d: {
514
+ declare let pollSlateTriggerGroupEvents: (d: {
574
515
  client: SlatesTestClient;
575
- triggerId: string;
516
+ triggerGroupId: string;
576
517
  state?: any;
577
518
  }) => Promise<{
578
- inputs: Record<string, any>[];
519
+ events: {
520
+ payload: Record<string, any>;
521
+ triggerIds: string[];
522
+ idempotencyKey?: string | undefined;
523
+ }[];
579
524
  updatedState?: any;
580
525
  requestTraces?: {
581
526
  startedAt: string;
@@ -606,18 +551,21 @@ declare let pollSlateTriggerEvents: (d: {
606
551
  } | undefined;
607
552
  }[] | undefined;
608
553
  }>;
609
- declare let handleSlateTriggerWebhook: (d: {
554
+ declare let processSlateTriggerGroupWebhook: (d: {
610
555
  client: SlatesTestClient;
611
- triggerId: string;
556
+ triggerGroupId: string;
612
557
  url: string;
613
558
  method?: string;
614
559
  headers?: Record<string, string>;
615
560
  body?: string | Uint8Array | null;
616
- state?: any;
617
- registrationDetails?: any;
561
+ webhookRegistrationPayload?: any;
618
562
  }) => Promise<{
619
- inputs: Record<string, any>[];
620
- updatedState?: any;
563
+ events: {
564
+ matchers: Record<string, any>[];
565
+ payload: Record<string, any>;
566
+ triggerIds: string[];
567
+ idempotencyKey?: string | undefined;
568
+ }[];
621
569
  response?: {
622
570
  status: number;
623
571
  headers: Record<string, string>;
@@ -655,12 +603,11 @@ declare let handleSlateTriggerWebhook: (d: {
655
603
  } | undefined;
656
604
  }[] | undefined;
657
605
  }>;
658
- declare let unregisterSlateTriggerWebhook: (d: {
606
+ declare let unregisterSlateTriggerGroupWebhook: (d: {
659
607
  client: SlatesTestClient;
660
- triggerId: string;
661
- webhookBaseUrl: string;
662
- registrationDetails: any;
663
- state?: any;
608
+ triggerGroupId: string;
609
+ webhookRegistrationIdentifier: string;
610
+ webhookRegistrationPayload: any;
664
611
  }) => Promise<{
665
612
  requestTraces?: {
666
613
  startedAt: string;
@@ -743,4 +690,4 @@ declare let getMcpCompatibleToolSchemaCases: (source: ToolSchemaSource) => Reado
743
690
  declare let expectMcpCompatibleToolSchema: (tool: ToolSchemaTarget) => void;
744
691
  declare let describeMcpCompatibleToolSchemas: (name: string, source: ToolSchemaSource) => void;
745
692
 
746
- export { type ExpectedSlateAction, type SlatesRuntimeContext, type SlatesTestClient, createLocalSlateTestClient, createSlatesTestClient, describeMcpCompatibleToolSchemas, expectMcpCompatibleToolSchema, expectSlateContract, expectSlateError, expectToolCall, getMcpCompatibleToolSchemaCases, getSlateContract, getVitestExpect, handleSlateTriggerWebhook, loadSlatesProfile, loadSlatesRuntimeContext, mapSlateTriggerEvent, pollSlateTriggerEvents, registerSlateTriggerWebhook, unregisterSlateTriggerWebhook, withSlateProfile };
693
+ export { type ExpectedSlateAction, type ExpectedSlateTriggerGroup, type SlatesRuntimeContext, type SlatesTestClient, createLocalSlateTestClient, createSlatesTestClient, describeMcpCompatibleToolSchemas, expectMcpCompatibleToolSchema, expectSlateContract, expectSlateError, expectToolCall, getMcpCompatibleToolSchemaCases, getSlateContract, getVitestExpect, loadSlatesProfile, loadSlatesRuntimeContext, mapSlateTriggerEvent, pollSlateTriggerGroupEvents, processSlateTriggerGroupWebhook, registerSlateTriggerGroupWebhook, unregisterSlateTriggerGroupWebhook, withSlateProfile };
@@ -114,15 +114,19 @@ var expectToolCall = async (d) => {
114
114
  };
115
115
  var createLocalSlateTestClient = (opts) => createSlatesClient({
116
116
  transport: createLocalSlateTransport({ slate: opts.slate }),
117
- state: opts.state,
117
+ state: {
118
+ capabilities: { triggers: true },
119
+ ...opts.state
120
+ },
118
121
  participants: opts.participants
119
122
  });
120
123
  var getSlateContract = async (client) => {
121
- let [provider, actions, authMethods, configSchema] = await Promise.all([
124
+ let [provider, actions, authMethods, configSchema, triggerGroups] = await Promise.all([
122
125
  client.identify(),
123
126
  client.listActions(),
124
127
  client.listAuthMethods(),
125
- client.getConfigSchema()
128
+ client.getConfigSchema(),
129
+ client.listTriggerGroups()
126
130
  ]);
127
131
  return {
128
132
  provider: provider.provider,
@@ -133,6 +137,7 @@ var getSlateContract = async (client) => {
133
137
  triggers: actions.actions.filter(
134
138
  (action) => action.type === "action.trigger"
135
139
  ),
140
+ triggerGroups: triggerGroups.triggerGroups,
136
141
  authMethods: authMethods.authenticationMethods,
137
142
  configSchema: configSchema.schema
138
143
  };
@@ -153,6 +158,17 @@ var expectActionMatches = (actual, expected) => {
153
158
  if (expected.destructive !== void 0) {
154
159
  expect2(actual?.tags?.destructive ?? false).toBe(expected.destructive);
155
160
  }
161
+ };
162
+ var expectTriggerGroupMatches = (actual, expected) => {
163
+ let expect2 = getVitestExpect();
164
+ expect2(actual).toBeTruthy();
165
+ expect2(actual?.id).toBe(expected.id);
166
+ if (expected.name !== void 0) {
167
+ expect2(actual?.name).toBe(expected.name);
168
+ }
169
+ if (expected.description !== void 0) {
170
+ expect2(actual?.description).toBe(expected.description);
171
+ }
156
172
  if (expected.invocationType !== void 0) {
157
173
  expect2(actual?.invocation?.type).toBe(
158
174
  expected.invocationType
@@ -179,6 +195,9 @@ var expectSlateContract = async (d) => {
179
195
  d.triggerIds
180
196
  );
181
197
  }
198
+ if (d.triggerGroupIds) {
199
+ expect2(contract.triggerGroups.map((group) => group.id)).toEqual(d.triggerGroupIds);
200
+ }
182
201
  if (d.authMethodIds) {
183
202
  expect2(contract.authMethods.map((method) => method.id)).toEqual(
184
203
  d.authMethodIds
@@ -196,30 +215,39 @@ var expectSlateContract = async (d) => {
196
215
  trigger
197
216
  );
198
217
  }
218
+ for (let triggerGroup of d.triggerGroups ?? []) {
219
+ expectTriggerGroupMatches(
220
+ contract.triggerGroups.find((group) => group.id === triggerGroup.id),
221
+ triggerGroup
222
+ );
223
+ }
199
224
  return contract;
200
225
  };
201
- var registerSlateTriggerWebhook = async (d) => d.client.registerTriggerWebhook(d.triggerId, d.webhookBaseUrl);
202
- var pollSlateTriggerEvents = async (d) => {
226
+ var registerSlateTriggerGroupWebhook = async (d) => d.client.registerTriggerGroupWebhook({
227
+ triggerGroupId: d.triggerGroupId,
228
+ webhookTargetIdentifier: d.webhookTargetIdentifier,
229
+ webhookTargetPayload: d.webhookTargetPayload,
230
+ webhookUrl: d.webhookUrl
231
+ });
232
+ var pollSlateTriggerGroupEvents = async (d) => {
203
233
  d.client.ensureSession();
204
- return d.client.request("slates/action.trigger.poll_events", {
205
- actionId: d.triggerId,
234
+ return d.client.pollTriggerGroup({
235
+ triggerGroupId: d.triggerGroupId,
206
236
  state: d.state ?? null
207
237
  });
208
238
  };
209
- var handleSlateTriggerWebhook = async (d) => d.client.handleTriggerWebhook({
210
- actionId: d.triggerId,
239
+ var processSlateTriggerGroupWebhook = async (d) => d.client.processTriggerGroupWebhook({
240
+ triggerGroupId: d.triggerGroupId,
211
241
  url: d.url,
212
242
  method: d.method ?? "POST",
213
243
  headers: d.headers,
214
244
  body: d.body,
215
- state: d.state,
216
- registrationDetails: d.registrationDetails
245
+ webhookRegistrationPayload: d.webhookRegistrationPayload ?? null
217
246
  });
218
- var unregisterSlateTriggerWebhook = async (d) => d.client.unregisterTriggerWebhook({
219
- actionId: d.triggerId,
220
- webhookBaseUrl: d.webhookBaseUrl,
221
- registrationDetails: d.registrationDetails,
222
- state: d.state
247
+ var unregisterSlateTriggerGroupWebhook = async (d) => d.client.unregisterTriggerGroupWebhook({
248
+ triggerGroupId: d.triggerGroupId,
249
+ webhookRegistrationIdentifier: d.webhookRegistrationIdentifier,
250
+ webhookRegistrationPayload: d.webhookRegistrationPayload
223
251
  });
224
252
  var mapSlateTriggerEvent = async (d) => {
225
253
  let expect2 = getVitestExpect();
@@ -14818,12 +14846,12 @@ export {
14818
14846
  getMcpCompatibleToolSchemaCases,
14819
14847
  getSlateContract,
14820
14848
  getVitestExpect,
14821
- handleSlateTriggerWebhook,
14822
14849
  loadSlatesProfile,
14823
14850
  loadSlatesRuntimeContext,
14824
14851
  mapSlateTriggerEvent,
14825
- pollSlateTriggerEvents,
14826
- registerSlateTriggerWebhook,
14827
- unregisterSlateTriggerWebhook,
14852
+ pollSlateTriggerGroupEvents,
14853
+ processSlateTriggerGroupWebhook,
14854
+ registerSlateTriggerGroupWebhook,
14855
+ unregisterSlateTriggerGroupWebhook,
14828
14856
  withSlateProfile
14829
14857
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slates/test",
3
- "version": "1.0.0-rc.17",
3
+ "version": "1.0.0-rc.19",
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.20",
44
- "@slates/profiles": "1.0.0-rc.18"
43
+ "@slates/client": "1.0.0-rc.22",
44
+ "@slates/profiles": "1.0.0-rc.20"
45
45
  },
46
46
  "devDependencies": {
47
- "@slates/provider": "1.0.0-rc.21",
47
+ "@slates/provider": "1.0.0-rc.23",
48
48
  "@slates/tsconfig": "1.0.0-rc.1",
49
49
  "typescript": "5.8.2",
50
50
  "vitest": "^3.1.2",