@slates/provider 1.0.0-rc.23 → 1.0.0-rc.25

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 CHANGED
@@ -1248,6 +1248,7 @@ var SlateTrigger = class _SlateTrigger extends SlateAction {
1248
1248
  var trigger = (spec2, params) => SlateTrigger.create(spec2, params);
1249
1249
 
1250
1250
  // src/action/triggerGroup.ts
1251
+ var import_zod2 = require("zod");
1251
1252
  var SlateDefaultPollingIntervalSeconds = 60 * 10;
1252
1253
  var SlateTriggerGroup = class _SlateTriggerGroup {
1253
1254
  constructor(_spec, _params) {
@@ -1274,6 +1275,9 @@ var SlateTriggerGroup = class _SlateTriggerGroup {
1274
1275
  get metadata() {
1275
1276
  return this._params.metadata;
1276
1277
  }
1278
+ get eventSchema() {
1279
+ return this._params.eventSchema ?? import_zod2.z.object({}).passthrough();
1280
+ }
1277
1281
  get source() {
1278
1282
  return this._params.source;
1279
1283
  }
@@ -2847,7 +2851,7 @@ var Slate = class _Slate {
2847
2851
  };
2848
2852
 
2849
2853
  // src/specification/specification.ts
2850
- var import_zod2 = __toESM(require("zod"), 1);
2854
+ var import_zod3 = __toESM(require("zod"), 1);
2851
2855
  var SlateSpecification = class _SlateSpecification {
2852
2856
  constructor(_config, _auth, _params) {
2853
2857
  this._config = _config;
@@ -2864,7 +2868,7 @@ var SlateSpecification = class _SlateSpecification {
2864
2868
  return this._config.configSchema;
2865
2869
  }
2866
2870
  get authSchema() {
2867
- return "outputSchema" in this._auth ? this._auth.outputSchema : import_zod2.default.object({});
2871
+ return "outputSchema" in this._auth ? this._auth.outputSchema : import_zod3.default.object({});
2868
2872
  }
2869
2873
  get config() {
2870
2874
  return this._config;
package/dist/index.d.cts CHANGED
@@ -149,6 +149,7 @@ type SlateAuthWithOauth<InputType extends {}, OutputType extends {
149
149
  description?: string;
150
150
  scope: string;
151
151
  }[];
152
+ adapters?: string[];
152
153
  docs?: SlateAuthDocsReference[];
153
154
  inputSchema?: z.ZodType<InputType>;
154
155
  onInputChanged?: (params: {
@@ -213,6 +214,7 @@ type SlateAuthWithToken<InputType extends {}, OutputType extends {
213
214
  type: 'auth.token';
214
215
  name: string;
215
216
  key: string;
217
+ adapters?: string[];
216
218
  inputSchema?: z.ZodType<InputType>;
217
219
  docs?: SlateAuthDocsReference[];
218
220
  getOutput: (ctx: {
@@ -242,6 +244,7 @@ type SlateAuthWithServiceAccount<InputType extends {}, OutputType extends {}> =
242
244
  type: 'auth.service_account';
243
245
  name: string;
244
246
  key: string;
247
+ adapters?: string[];
245
248
  inputSchema?: z.ZodType<InputType>;
246
249
  docs?: SlateAuthDocsReference[];
247
250
  getOutput: (ctx: {
@@ -271,6 +274,7 @@ type SlateAuthWithCustomData<InputType extends {}, OutputType extends {}> = {
271
274
  type: 'auth.custom';
272
275
  name: string;
273
276
  key: string;
277
+ adapters?: string[];
274
278
  inputSchema?: z.ZodType<InputType>;
275
279
  docs?: SlateAuthDocsReference[];
276
280
  getOutput: (ctx: {
@@ -523,6 +527,7 @@ type SlateWebhookTargetListHandler<ConfigType extends {}, AuthType extends {}> =
523
527
  }>) => Promise<{
524
528
  targets: SlateWebhookTarget[];
525
529
  nextPageToken: any | null;
530
+ isPartial?: boolean;
526
531
  }>;
527
532
  type SlateWebhookRegisterHandler<ConfigType extends {}, AuthType extends {}> = (context: SlateContext<ConfigType, AuthType, {
528
533
  webhookTargetIdentifier: string;
@@ -536,18 +541,18 @@ type SlateWebhookUnregisterHandler<ConfigType extends {}, AuthType extends {}> =
536
541
  webhookRegistrationIdentifier: string;
537
542
  webhookRegistrationPayload: any;
538
543
  }>) => Promise<unknown>;
539
- type SlateWebhookManualSetupHandler<FullConfigSchema extends z.ZodType<any> = z.ZodType<any>> = (context: SlateContext<{}, {}, {
544
+ type SlateWebhookManualSetupHandler<FullConfigSchema extends z$1.ZodType<any> = z$1.ZodType<any>> = (context: SlateContext<{}, {}, {
540
545
  webhookUrl: string;
541
546
  }>) => Promise<{
542
547
  webhookSetupDocument: string;
543
- partialWebhookRegistrationPayload: Partial<z.infer<FullConfigSchema>>;
548
+ partialWebhookRegistrationPayload: Partial<z$1.infer<FullConfigSchema>>;
544
549
  }>;
545
- type SlateWebhookManualFinishHandler<UserConfigSchema extends z.ZodType<any> = z.ZodType<any>, FullConfigSchema extends z.ZodType<any> = z.ZodType<any>> = (context: SlateContext<{}, {}, {
550
+ type SlateWebhookManualFinishHandler<UserConfigSchema extends z$1.ZodType<any> = z$1.ZodType<any>, FullConfigSchema extends z$1.ZodType<any> = z$1.ZodType<any>> = (context: SlateContext<{}, {}, {
546
551
  webhookUrl: string;
547
- partialWebhookRegistrationPayload: Partial<z.infer<FullConfigSchema>>;
548
- userWebhookRegistrationPayload: z.infer<UserConfigSchema>;
552
+ partialWebhookRegistrationPayload: Partial<z$1.infer<FullConfigSchema>>;
553
+ userWebhookRegistrationPayload: z$1.infer<UserConfigSchema>;
549
554
  }>) => Promise<{
550
- webhookRegistrationPayload: z.infer<FullConfigSchema>;
555
+ webhookRegistrationPayload: z$1.infer<FullConfigSchema>;
551
556
  }>;
552
557
  type SlateWebhookProcessHandler = (context: SlateContext<{}, {}, {
553
558
  request: Request;
@@ -569,7 +574,7 @@ interface SlateTriggerGroupWebhookAutoRegistrationParameters<ConfigType extends
569
574
  webhookRegister: SlateWebhookRegisterHandler<ConfigType, AuthType>;
570
575
  webhookUnregister: SlateWebhookUnregisterHandler<ConfigType, AuthType>;
571
576
  }
572
- interface SlateTriggerGroupWebhookManualRegistrationParameters<UserConfigSchema extends z.ZodType<any> = z.ZodType<any>, FullConfigSchema extends z.ZodType<any> = z.ZodType<any>> {
577
+ interface SlateTriggerGroupWebhookManualRegistrationParameters<UserConfigSchema extends z$1.ZodType<any> = z$1.ZodType<any>, FullConfigSchema extends z$1.ZodType<any> = z$1.ZodType<any>> {
573
578
  userConfigSchema: UserConfigSchema;
574
579
  fullConfigSchema: FullConfigSchema;
575
580
  setup: SlateWebhookManualSetupHandler<FullConfigSchema>;
@@ -580,52 +585,54 @@ interface SlateTriggerGroupWebhookParameters<ConfigType extends {}, AuthType ext
580
585
  manualRegistration?: SlateTriggerGroupWebhookManualRegistrationParameters<any, any>;
581
586
  process: SlateWebhookProcessHandler;
582
587
  }
583
- interface SlateTriggerGroupCreateParameters {
588
+ interface SlateTriggerGroupCreateParameters<InputType extends {} = Record<string, unknown>> {
584
589
  key: string;
585
590
  name: string;
586
591
  description?: string;
587
592
  metadata?: Record<string, any>;
593
+ eventSchema?: z$1.ZodType<InputType>;
588
594
  }
589
- interface SlateTriggerGroupParameters<ConfigType extends {}, AuthType extends {}> extends SlateTriggerGroupCreateParameters {
595
+ interface SlateTriggerGroupParameters<ConfigType extends {}, AuthType extends {}, InputType extends {} = Record<string, unknown>> extends SlateTriggerGroupCreateParameters<InputType> {
590
596
  source: 'polling' | 'webhook';
591
597
  polling?: SlateTriggerGroupPollingParameters<ConfigType, AuthType>;
592
598
  webhook?: SlateTriggerGroupWebhookParameters<ConfigType, AuthType>;
593
599
  routingMatchers: SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType>;
594
600
  }
595
- declare class SlateTriggerGroup<ConfigType extends {}, AuthType extends {}> {
601
+ declare class SlateTriggerGroup<ConfigType extends {}, AuthType extends {}, InputType extends {} = Record<string, unknown>> {
596
602
  private readonly _spec;
597
603
  private readonly _params;
598
604
  private constructor();
599
- static create<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateTriggerGroupCreateParameters): SlateTriggerGroupBuilder<ConfigType, AuthType>;
605
+ static create<ConfigType extends {}, AuthType extends {}, InputType extends {} = Record<string, unknown>>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateTriggerGroupCreateParameters<InputType>): SlateTriggerGroupBuilder<ConfigType, AuthType, InputType>;
600
606
  get spec(): SlateSpecification<ConfigType, AuthType>;
601
607
  get key(): string;
602
608
  get name(): string;
603
609
  get description(): string | undefined;
604
610
  get metadata(): Record<string, any> | undefined;
611
+ get eventSchema(): z$1.ZodType<InputType, unknown, z$1.core.$ZodTypeInternals<InputType, unknown>>;
605
612
  get source(): "polling" | "webhook";
606
613
  get polling(): SlateTriggerGroupPollingParameters<ConfigType, AuthType> | undefined;
607
614
  get webhook(): SlateTriggerGroupWebhookParameters<ConfigType, AuthType> | undefined;
608
615
  get routingMatchers(): SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType>;
609
616
  }
610
- declare class SlateTriggerGroupBuilder<ConfigType extends {}, AuthType extends {}> {
617
+ declare class SlateTriggerGroupBuilder<ConfigType extends {}, AuthType extends {}, InputType extends {} = Record<string, unknown>> {
611
618
  #private;
612
619
  private readonly spec;
613
620
  private readonly params;
614
621
  private readonly factory;
615
- constructor(spec: SlateSpecification<ConfigType, AuthType>, params: SlateTriggerGroupCreateParameters, factory: (params: SlateTriggerGroupParameters<ConfigType, AuthType>) => SlateTriggerGroup<ConfigType, AuthType>);
622
+ constructor(spec: SlateSpecification<ConfigType, AuthType>, params: SlateTriggerGroupCreateParameters<InputType>, factory: (params: SlateTriggerGroupParameters<ConfigType, AuthType, InputType>) => SlateTriggerGroup<ConfigType, AuthType, InputType>);
616
623
  polling(props: {
617
624
  intervalSeconds?: number;
618
625
  pollEvents: SlateTriggerGroupPollHandler<ConfigType, AuthType>;
619
- }): SlateTriggerGroupBuilder<ConfigType, AuthType>;
620
- webhook<UserConfigSchema extends z.ZodType<any> = z.ZodType<any>, FullConfigSchema extends z.ZodType<any> = z.ZodType<any>>(props: {
626
+ }): SlateTriggerGroupBuilder<ConfigType, AuthType, InputType>;
627
+ webhook<UserConfigSchema extends z$1.ZodType<any> = z$1.ZodType<any>, FullConfigSchema extends z$1.ZodType<any> = z$1.ZodType<any>>(props: {
621
628
  autoRegistration?: SlateTriggerGroupWebhookAutoRegistrationParameters<ConfigType, AuthType>;
622
629
  manualRegistration?: SlateTriggerGroupWebhookManualRegistrationParameters<UserConfigSchema, FullConfigSchema>;
623
630
  process: SlateWebhookProcessHandler;
624
- }): SlateTriggerGroupBuilder<ConfigType, AuthType>;
625
- routingMatchers(handler: SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType>): SlateTriggerGroupBuilder<ConfigType, AuthType>;
626
- build(): SlateTriggerGroup<ConfigType, AuthType>;
631
+ }): SlateTriggerGroupBuilder<ConfigType, AuthType, InputType>;
632
+ routingMatchers(handler: SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType>): SlateTriggerGroupBuilder<ConfigType, AuthType, InputType>;
633
+ build(): SlateTriggerGroup<ConfigType, AuthType, InputType>;
627
634
  }
628
- declare let triggerGroup: <ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateTriggerGroupCreateParameters) => SlateTriggerGroupBuilder<ConfigType, AuthType>;
635
+ declare let triggerGroup: <ConfigType extends {}, AuthType extends {}, InputType extends {} = Record<string, unknown>>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateTriggerGroupCreateParameters<InputType>) => SlateTriggerGroupBuilder<ConfigType, AuthType, InputType>;
629
636
 
630
637
  type SlateActionType = 'tool' | 'trigger';
631
638
  interface SlateActionScopeClause {
@@ -805,7 +812,7 @@ declare class SlateTrigger<ConfigType extends {}, AuthType extends {}, InputType
805
812
  #private;
806
813
  private constructor();
807
814
  static create<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters): SlateActionBuilder<"trigger", ConfigType, AuthType, {}, {}, SlateTrigger<any, any, any, any>, false>;
808
- get triggerGroup(): SlateTriggerGroup<ConfigType, AuthType>;
815
+ get triggerGroup(): SlateTriggerGroup<ConfigType, AuthType, Record<string, unknown>>;
809
816
  get matches(): SlateTriggerMatchesHandler;
810
817
  get map(): SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
811
818
  }
@@ -1048,7 +1055,7 @@ declare class Slate<ConfigType extends {}, AuthType extends {}> {
1048
1055
  get spec(): SlateSpecification<ConfigType, AuthType>;
1049
1056
  get actions(): (SlateTrigger<ConfigType, AuthType, any, any> | SlateTool<ConfigType, AuthType, any, any>)[];
1050
1057
  get adapters(): SlateAdapter<ConfigType, AuthType>[];
1051
- get triggerGroups(): SlateTriggerGroup<ConfigType, AuthType>[];
1058
+ get triggerGroups(): SlateTriggerGroup<ConfigType, AuthType, Record<string, unknown>>[];
1052
1059
  }
1053
1060
 
1054
1061
  declare const graphWebhookHttp: {
package/dist/index.d.ts CHANGED
@@ -149,6 +149,7 @@ type SlateAuthWithOauth<InputType extends {}, OutputType extends {
149
149
  description?: string;
150
150
  scope: string;
151
151
  }[];
152
+ adapters?: string[];
152
153
  docs?: SlateAuthDocsReference[];
153
154
  inputSchema?: z.ZodType<InputType>;
154
155
  onInputChanged?: (params: {
@@ -213,6 +214,7 @@ type SlateAuthWithToken<InputType extends {}, OutputType extends {
213
214
  type: 'auth.token';
214
215
  name: string;
215
216
  key: string;
217
+ adapters?: string[];
216
218
  inputSchema?: z.ZodType<InputType>;
217
219
  docs?: SlateAuthDocsReference[];
218
220
  getOutput: (ctx: {
@@ -242,6 +244,7 @@ type SlateAuthWithServiceAccount<InputType extends {}, OutputType extends {}> =
242
244
  type: 'auth.service_account';
243
245
  name: string;
244
246
  key: string;
247
+ adapters?: string[];
245
248
  inputSchema?: z.ZodType<InputType>;
246
249
  docs?: SlateAuthDocsReference[];
247
250
  getOutput: (ctx: {
@@ -271,6 +274,7 @@ type SlateAuthWithCustomData<InputType extends {}, OutputType extends {}> = {
271
274
  type: 'auth.custom';
272
275
  name: string;
273
276
  key: string;
277
+ adapters?: string[];
274
278
  inputSchema?: z.ZodType<InputType>;
275
279
  docs?: SlateAuthDocsReference[];
276
280
  getOutput: (ctx: {
@@ -523,6 +527,7 @@ type SlateWebhookTargetListHandler<ConfigType extends {}, AuthType extends {}> =
523
527
  }>) => Promise<{
524
528
  targets: SlateWebhookTarget[];
525
529
  nextPageToken: any | null;
530
+ isPartial?: boolean;
526
531
  }>;
527
532
  type SlateWebhookRegisterHandler<ConfigType extends {}, AuthType extends {}> = (context: SlateContext<ConfigType, AuthType, {
528
533
  webhookTargetIdentifier: string;
@@ -536,18 +541,18 @@ type SlateWebhookUnregisterHandler<ConfigType extends {}, AuthType extends {}> =
536
541
  webhookRegistrationIdentifier: string;
537
542
  webhookRegistrationPayload: any;
538
543
  }>) => Promise<unknown>;
539
- type SlateWebhookManualSetupHandler<FullConfigSchema extends z.ZodType<any> = z.ZodType<any>> = (context: SlateContext<{}, {}, {
544
+ type SlateWebhookManualSetupHandler<FullConfigSchema extends z$1.ZodType<any> = z$1.ZodType<any>> = (context: SlateContext<{}, {}, {
540
545
  webhookUrl: string;
541
546
  }>) => Promise<{
542
547
  webhookSetupDocument: string;
543
- partialWebhookRegistrationPayload: Partial<z.infer<FullConfigSchema>>;
548
+ partialWebhookRegistrationPayload: Partial<z$1.infer<FullConfigSchema>>;
544
549
  }>;
545
- type SlateWebhookManualFinishHandler<UserConfigSchema extends z.ZodType<any> = z.ZodType<any>, FullConfigSchema extends z.ZodType<any> = z.ZodType<any>> = (context: SlateContext<{}, {}, {
550
+ type SlateWebhookManualFinishHandler<UserConfigSchema extends z$1.ZodType<any> = z$1.ZodType<any>, FullConfigSchema extends z$1.ZodType<any> = z$1.ZodType<any>> = (context: SlateContext<{}, {}, {
546
551
  webhookUrl: string;
547
- partialWebhookRegistrationPayload: Partial<z.infer<FullConfigSchema>>;
548
- userWebhookRegistrationPayload: z.infer<UserConfigSchema>;
552
+ partialWebhookRegistrationPayload: Partial<z$1.infer<FullConfigSchema>>;
553
+ userWebhookRegistrationPayload: z$1.infer<UserConfigSchema>;
549
554
  }>) => Promise<{
550
- webhookRegistrationPayload: z.infer<FullConfigSchema>;
555
+ webhookRegistrationPayload: z$1.infer<FullConfigSchema>;
551
556
  }>;
552
557
  type SlateWebhookProcessHandler = (context: SlateContext<{}, {}, {
553
558
  request: Request;
@@ -569,7 +574,7 @@ interface SlateTriggerGroupWebhookAutoRegistrationParameters<ConfigType extends
569
574
  webhookRegister: SlateWebhookRegisterHandler<ConfigType, AuthType>;
570
575
  webhookUnregister: SlateWebhookUnregisterHandler<ConfigType, AuthType>;
571
576
  }
572
- interface SlateTriggerGroupWebhookManualRegistrationParameters<UserConfigSchema extends z.ZodType<any> = z.ZodType<any>, FullConfigSchema extends z.ZodType<any> = z.ZodType<any>> {
577
+ interface SlateTriggerGroupWebhookManualRegistrationParameters<UserConfigSchema extends z$1.ZodType<any> = z$1.ZodType<any>, FullConfigSchema extends z$1.ZodType<any> = z$1.ZodType<any>> {
573
578
  userConfigSchema: UserConfigSchema;
574
579
  fullConfigSchema: FullConfigSchema;
575
580
  setup: SlateWebhookManualSetupHandler<FullConfigSchema>;
@@ -580,52 +585,54 @@ interface SlateTriggerGroupWebhookParameters<ConfigType extends {}, AuthType ext
580
585
  manualRegistration?: SlateTriggerGroupWebhookManualRegistrationParameters<any, any>;
581
586
  process: SlateWebhookProcessHandler;
582
587
  }
583
- interface SlateTriggerGroupCreateParameters {
588
+ interface SlateTriggerGroupCreateParameters<InputType extends {} = Record<string, unknown>> {
584
589
  key: string;
585
590
  name: string;
586
591
  description?: string;
587
592
  metadata?: Record<string, any>;
593
+ eventSchema?: z$1.ZodType<InputType>;
588
594
  }
589
- interface SlateTriggerGroupParameters<ConfigType extends {}, AuthType extends {}> extends SlateTriggerGroupCreateParameters {
595
+ interface SlateTriggerGroupParameters<ConfigType extends {}, AuthType extends {}, InputType extends {} = Record<string, unknown>> extends SlateTriggerGroupCreateParameters<InputType> {
590
596
  source: 'polling' | 'webhook';
591
597
  polling?: SlateTriggerGroupPollingParameters<ConfigType, AuthType>;
592
598
  webhook?: SlateTriggerGroupWebhookParameters<ConfigType, AuthType>;
593
599
  routingMatchers: SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType>;
594
600
  }
595
- declare class SlateTriggerGroup<ConfigType extends {}, AuthType extends {}> {
601
+ declare class SlateTriggerGroup<ConfigType extends {}, AuthType extends {}, InputType extends {} = Record<string, unknown>> {
596
602
  private readonly _spec;
597
603
  private readonly _params;
598
604
  private constructor();
599
- static create<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateTriggerGroupCreateParameters): SlateTriggerGroupBuilder<ConfigType, AuthType>;
605
+ static create<ConfigType extends {}, AuthType extends {}, InputType extends {} = Record<string, unknown>>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateTriggerGroupCreateParameters<InputType>): SlateTriggerGroupBuilder<ConfigType, AuthType, InputType>;
600
606
  get spec(): SlateSpecification<ConfigType, AuthType>;
601
607
  get key(): string;
602
608
  get name(): string;
603
609
  get description(): string | undefined;
604
610
  get metadata(): Record<string, any> | undefined;
611
+ get eventSchema(): z$1.ZodType<InputType, unknown, z$1.core.$ZodTypeInternals<InputType, unknown>>;
605
612
  get source(): "polling" | "webhook";
606
613
  get polling(): SlateTriggerGroupPollingParameters<ConfigType, AuthType> | undefined;
607
614
  get webhook(): SlateTriggerGroupWebhookParameters<ConfigType, AuthType> | undefined;
608
615
  get routingMatchers(): SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType>;
609
616
  }
610
- declare class SlateTriggerGroupBuilder<ConfigType extends {}, AuthType extends {}> {
617
+ declare class SlateTriggerGroupBuilder<ConfigType extends {}, AuthType extends {}, InputType extends {} = Record<string, unknown>> {
611
618
  #private;
612
619
  private readonly spec;
613
620
  private readonly params;
614
621
  private readonly factory;
615
- constructor(spec: SlateSpecification<ConfigType, AuthType>, params: SlateTriggerGroupCreateParameters, factory: (params: SlateTriggerGroupParameters<ConfigType, AuthType>) => SlateTriggerGroup<ConfigType, AuthType>);
622
+ constructor(spec: SlateSpecification<ConfigType, AuthType>, params: SlateTriggerGroupCreateParameters<InputType>, factory: (params: SlateTriggerGroupParameters<ConfigType, AuthType, InputType>) => SlateTriggerGroup<ConfigType, AuthType, InputType>);
616
623
  polling(props: {
617
624
  intervalSeconds?: number;
618
625
  pollEvents: SlateTriggerGroupPollHandler<ConfigType, AuthType>;
619
- }): SlateTriggerGroupBuilder<ConfigType, AuthType>;
620
- webhook<UserConfigSchema extends z.ZodType<any> = z.ZodType<any>, FullConfigSchema extends z.ZodType<any> = z.ZodType<any>>(props: {
626
+ }): SlateTriggerGroupBuilder<ConfigType, AuthType, InputType>;
627
+ webhook<UserConfigSchema extends z$1.ZodType<any> = z$1.ZodType<any>, FullConfigSchema extends z$1.ZodType<any> = z$1.ZodType<any>>(props: {
621
628
  autoRegistration?: SlateTriggerGroupWebhookAutoRegistrationParameters<ConfigType, AuthType>;
622
629
  manualRegistration?: SlateTriggerGroupWebhookManualRegistrationParameters<UserConfigSchema, FullConfigSchema>;
623
630
  process: SlateWebhookProcessHandler;
624
- }): SlateTriggerGroupBuilder<ConfigType, AuthType>;
625
- routingMatchers(handler: SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType>): SlateTriggerGroupBuilder<ConfigType, AuthType>;
626
- build(): SlateTriggerGroup<ConfigType, AuthType>;
631
+ }): SlateTriggerGroupBuilder<ConfigType, AuthType, InputType>;
632
+ routingMatchers(handler: SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType>): SlateTriggerGroupBuilder<ConfigType, AuthType, InputType>;
633
+ build(): SlateTriggerGroup<ConfigType, AuthType, InputType>;
627
634
  }
628
- declare let triggerGroup: <ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateTriggerGroupCreateParameters) => SlateTriggerGroupBuilder<ConfigType, AuthType>;
635
+ declare let triggerGroup: <ConfigType extends {}, AuthType extends {}, InputType extends {} = Record<string, unknown>>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateTriggerGroupCreateParameters<InputType>) => SlateTriggerGroupBuilder<ConfigType, AuthType, InputType>;
629
636
 
630
637
  type SlateActionType = 'tool' | 'trigger';
631
638
  interface SlateActionScopeClause {
@@ -805,7 +812,7 @@ declare class SlateTrigger<ConfigType extends {}, AuthType extends {}, InputType
805
812
  #private;
806
813
  private constructor();
807
814
  static create<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters): SlateActionBuilder<"trigger", ConfigType, AuthType, {}, {}, SlateTrigger<any, any, any, any>, false>;
808
- get triggerGroup(): SlateTriggerGroup<ConfigType, AuthType>;
815
+ get triggerGroup(): SlateTriggerGroup<ConfigType, AuthType, Record<string, unknown>>;
809
816
  get matches(): SlateTriggerMatchesHandler;
810
817
  get map(): SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
811
818
  }
@@ -1048,7 +1055,7 @@ declare class Slate<ConfigType extends {}, AuthType extends {}> {
1048
1055
  get spec(): SlateSpecification<ConfigType, AuthType>;
1049
1056
  get actions(): (SlateTrigger<ConfigType, AuthType, any, any> | SlateTool<ConfigType, AuthType, any, any>)[];
1050
1057
  get adapters(): SlateAdapter<ConfigType, AuthType>[];
1051
- get triggerGroups(): SlateTriggerGroup<ConfigType, AuthType>[];
1058
+ get triggerGroups(): SlateTriggerGroup<ConfigType, AuthType, Record<string, unknown>>[];
1052
1059
  }
1053
1060
 
1054
1061
  declare const graphWebhookHttp: {
@@ -1136,6 +1136,7 @@ var SlateTrigger = class _SlateTrigger extends SlateAction {
1136
1136
  var trigger = (spec2, params) => SlateTrigger.create(spec2, params);
1137
1137
 
1138
1138
  // src/action/triggerGroup.ts
1139
+ import { z as z2 } from "zod";
1139
1140
  var SlateDefaultPollingIntervalSeconds = 60 * 10;
1140
1141
  var SlateTriggerGroup = class _SlateTriggerGroup {
1141
1142
  constructor(_spec, _params) {
@@ -1162,6 +1163,9 @@ var SlateTriggerGroup = class _SlateTriggerGroup {
1162
1163
  get metadata() {
1163
1164
  return this._params.metadata;
1164
1165
  }
1166
+ get eventSchema() {
1167
+ return this._params.eventSchema ?? z2.object({}).passthrough();
1168
+ }
1165
1169
  get source() {
1166
1170
  return this._params.source;
1167
1171
  }
@@ -2735,7 +2739,7 @@ var Slate = class _Slate {
2735
2739
  };
2736
2740
 
2737
2741
  // src/specification/specification.ts
2738
- import z2 from "zod";
2742
+ import z3 from "zod";
2739
2743
  var SlateSpecification = class _SlateSpecification {
2740
2744
  constructor(_config, _auth, _params) {
2741
2745
  this._config = _config;
@@ -2752,7 +2756,7 @@ var SlateSpecification = class _SlateSpecification {
2752
2756
  return this._config.configSchema;
2753
2757
  }
2754
2758
  get authSchema() {
2755
- return "outputSchema" in this._auth ? this._auth.outputSchema : z2.object({});
2759
+ return "outputSchema" in this._auth ? this._auth.outputSchema : z3.object({});
2756
2760
  }
2757
2761
  get config() {
2758
2762
  return this._config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slates/provider",
3
- "version": "1.0.0-rc.23",
3
+ "version": "1.0.0-rc.25",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -43,4 +43,4 @@
43
43
  "typescript": "5.8.2",
44
44
  "vitest": "^3.1.2"
45
45
  }
46
- }
46
+ }
@@ -1,7 +1,7 @@
1
- import type z from 'zod';
1
+ import { z } from 'zod';
2
+ import type { SlateContext } from '../context';
2
3
  import { SlateDeclarationError } from '../error';
3
4
  import type { SlateSpecification } from '../specification/specification';
4
- import type { SlateContext } from '../context';
5
5
  import type { SlateWebhookHttpResponseInit } from './action';
6
6
 
7
7
  export let SlateDefaultPollingIntervalSeconds = 60 * 10;
@@ -19,9 +19,10 @@ export interface SlateWebhookTarget {
19
19
  targetOwnership: SlateWebhookTargetOwnership;
20
20
  }
21
21
 
22
- export type SlateTriggerGroupRoutingMatchersHandler<ConfigType extends {}, AuthType extends {}> = (
23
- context: SlateContext<ConfigType, AuthType, {}>
24
- ) => Promise<SlateTriggerRoutingMatcher[]>;
22
+ export type SlateTriggerGroupRoutingMatchersHandler<
23
+ ConfigType extends {},
24
+ AuthType extends {}
25
+ > = (context: SlateContext<ConfigType, AuthType, {}>) => Promise<SlateTriggerRoutingMatcher[]>;
25
26
 
26
27
  export type SlateTriggerGroupPollHandler<ConfigType extends {}, AuthType extends {}> = (
27
28
  context: SlateContext<ConfigType, AuthType, { state: any | null }>
@@ -35,6 +36,8 @@ export type SlateWebhookTargetListHandler<ConfigType extends {}, AuthType extend
35
36
  ) => Promise<{
36
37
  targets: SlateWebhookTarget[];
37
38
  nextPageToken: any | null;
39
+ // Set when targets were skipped for a limit rather than exhausted by pagination.
40
+ isPartial?: boolean;
38
41
  }>;
39
42
 
40
43
  export type SlateWebhookRegisterHandler<ConfigType extends {}, AuthType extends {}> = (
@@ -63,13 +66,12 @@ export type SlateWebhookUnregisterHandler<ConfigType extends {}, AuthType extend
63
66
  >
64
67
  ) => Promise<unknown>;
65
68
 
66
- export type SlateWebhookManualSetupHandler<FullConfigSchema extends z.ZodType<any> = z.ZodType<any>> =
67
- (
68
- context: SlateContext<{}, {}, { webhookUrl: string }>
69
- ) => Promise<{
70
- webhookSetupDocument: string;
71
- partialWebhookRegistrationPayload: Partial<z.infer<FullConfigSchema>>;
72
- }>;
69
+ export type SlateWebhookManualSetupHandler<
70
+ FullConfigSchema extends z.ZodType<any> = z.ZodType<any>
71
+ > = (context: SlateContext<{}, {}, { webhookUrl: string }>) => Promise<{
72
+ webhookSetupDocument: string;
73
+ partialWebhookRegistrationPayload: Partial<z.infer<FullConfigSchema>>;
74
+ }>;
73
75
 
74
76
  export type SlateWebhookManualFinishHandler<
75
77
  UserConfigSchema extends z.ZodType<any> = z.ZodType<any>,
@@ -106,7 +108,10 @@ export type SlateWebhookProcessHandler = (
106
108
  response?: Response | SlateWebhookHttpResponseInit;
107
109
  }>;
108
110
 
109
- export interface SlateTriggerGroupPollingParameters<ConfigType extends {}, AuthType extends {}> {
111
+ export interface SlateTriggerGroupPollingParameters<
112
+ ConfigType extends {},
113
+ AuthType extends {}
114
+ > {
110
115
  intervalSeconds: number;
111
116
  pollEvents: SlateTriggerGroupPollHandler<ConfigType, AuthType>;
112
117
  }
@@ -130,36 +135,53 @@ export interface SlateTriggerGroupWebhookManualRegistrationParameters<
130
135
  finish?: SlateWebhookManualFinishHandler<UserConfigSchema, FullConfigSchema>;
131
136
  }
132
137
 
133
- export interface SlateTriggerGroupWebhookParameters<ConfigType extends {}, AuthType extends {}> {
138
+ export interface SlateTriggerGroupWebhookParameters<
139
+ ConfigType extends {},
140
+ AuthType extends {}
141
+ > {
134
142
  autoRegistration?: SlateTriggerGroupWebhookAutoRegistrationParameters<ConfigType, AuthType>;
135
143
  manualRegistration?: SlateTriggerGroupWebhookManualRegistrationParameters<any, any>;
136
144
  process: SlateWebhookProcessHandler;
137
145
  }
138
146
 
139
- export interface SlateTriggerGroupCreateParameters {
147
+ export interface SlateTriggerGroupCreateParameters<
148
+ InputType extends {} = Record<string, unknown>
149
+ > {
140
150
  key: string;
141
151
  name: string;
142
152
  description?: string;
143
153
  metadata?: Record<string, any>;
154
+ eventSchema?: z.ZodType<InputType>;
144
155
  }
145
156
 
146
- export interface SlateTriggerGroupParameters<ConfigType extends {}, AuthType extends {}>
147
- extends SlateTriggerGroupCreateParameters {
157
+ export interface SlateTriggerGroupParameters<
158
+ ConfigType extends {},
159
+ AuthType extends {},
160
+ InputType extends {} = Record<string, unknown>
161
+ > extends SlateTriggerGroupCreateParameters<InputType> {
148
162
  source: 'polling' | 'webhook';
149
163
  polling?: SlateTriggerGroupPollingParameters<ConfigType, AuthType>;
150
164
  webhook?: SlateTriggerGroupWebhookParameters<ConfigType, AuthType>;
151
165
  routingMatchers: SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType>;
152
166
  }
153
167
 
154
- export class SlateTriggerGroup<ConfigType extends {}, AuthType extends {}> {
168
+ export class SlateTriggerGroup<
169
+ ConfigType extends {},
170
+ AuthType extends {},
171
+ InputType extends {} = Record<string, unknown>
172
+ > {
155
173
  private constructor(
156
174
  private readonly _spec: SlateSpecification<ConfigType, AuthType>,
157
- private readonly _params: SlateTriggerGroupParameters<ConfigType, AuthType>
175
+ private readonly _params: SlateTriggerGroupParameters<ConfigType, AuthType, InputType>
158
176
  ) {}
159
177
 
160
- static create<ConfigType extends {}, AuthType extends {}>(
178
+ static create<
179
+ ConfigType extends {},
180
+ AuthType extends {},
181
+ InputType extends {} = Record<string, unknown>
182
+ >(
161
183
  spec: SlateSpecification<ConfigType, AuthType>,
162
- params: SlateTriggerGroupCreateParameters
184
+ params: SlateTriggerGroupCreateParameters<InputType>
163
185
  ) {
164
186
  return new SlateTriggerGroupBuilder(spec, params, p => new SlateTriggerGroup(spec, p));
165
187
  }
@@ -184,6 +206,10 @@ export class SlateTriggerGroup<ConfigType extends {}, AuthType extends {}> {
184
206
  return this._params.metadata;
185
207
  }
186
208
 
209
+ get eventSchema() {
210
+ return this._params.eventSchema ?? (z.object({}).passthrough() as z.ZodType<InputType>);
211
+ }
212
+
187
213
  get source() {
188
214
  return this._params.source;
189
215
  }
@@ -201,24 +227,29 @@ export class SlateTriggerGroup<ConfigType extends {}, AuthType extends {}> {
201
227
  }
202
228
  }
203
229
 
204
- export class SlateTriggerGroupBuilder<ConfigType extends {}, AuthType extends {}> {
230
+ export class SlateTriggerGroupBuilder<
231
+ ConfigType extends {},
232
+ AuthType extends {},
233
+ InputType extends {} = Record<string, unknown>
234
+ > {
205
235
  #source: 'polling' | 'webhook' | null = null;
206
236
  #polling: SlateTriggerGroupPollingParameters<ConfigType, AuthType> | null = null;
207
237
  #webhook: SlateTriggerGroupWebhookParameters<ConfigType, AuthType> | null = null;
208
- #routingMatchers: SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType> | null = null;
238
+ #routingMatchers: SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType> | null =
239
+ null;
209
240
 
210
241
  constructor(
211
242
  private readonly spec: SlateSpecification<ConfigType, AuthType>,
212
- private readonly params: SlateTriggerGroupCreateParameters,
243
+ private readonly params: SlateTriggerGroupCreateParameters<InputType>,
213
244
  private readonly factory: (
214
- params: SlateTriggerGroupParameters<ConfigType, AuthType>
215
- ) => SlateTriggerGroup<ConfigType, AuthType>
245
+ params: SlateTriggerGroupParameters<ConfigType, AuthType, InputType>
246
+ ) => SlateTriggerGroup<ConfigType, AuthType, InputType>
216
247
  ) {}
217
248
 
218
249
  polling(props: {
219
250
  intervalSeconds?: number;
220
251
  pollEvents: SlateTriggerGroupPollHandler<ConfigType, AuthType>;
221
- }): SlateTriggerGroupBuilder<ConfigType, AuthType> {
252
+ }): SlateTriggerGroupBuilder<ConfigType, AuthType, InputType> {
222
253
  if (this.#source) {
223
254
  throw new SlateDeclarationError('Trigger group invocation is already defined');
224
255
  }
@@ -236,13 +267,16 @@ export class SlateTriggerGroupBuilder<ConfigType extends {}, AuthType extends {}
236
267
  UserConfigSchema extends z.ZodType<any> = z.ZodType<any>,
237
268
  FullConfigSchema extends z.ZodType<any> = z.ZodType<any>
238
269
  >(props: {
239
- autoRegistration?: SlateTriggerGroupWebhookAutoRegistrationParameters<ConfigType, AuthType>;
270
+ autoRegistration?: SlateTriggerGroupWebhookAutoRegistrationParameters<
271
+ ConfigType,
272
+ AuthType
273
+ >;
240
274
  manualRegistration?: SlateTriggerGroupWebhookManualRegistrationParameters<
241
275
  UserConfigSchema,
242
276
  FullConfigSchema
243
277
  >;
244
278
  process: SlateWebhookProcessHandler;
245
- }): SlateTriggerGroupBuilder<ConfigType, AuthType> {
279
+ }): SlateTriggerGroupBuilder<ConfigType, AuthType, InputType> {
246
280
  if (this.#source) {
247
281
  throw new SlateDeclarationError('Trigger group invocation is already defined');
248
282
  }
@@ -265,12 +299,12 @@ export class SlateTriggerGroupBuilder<ConfigType extends {}, AuthType extends {}
265
299
 
266
300
  routingMatchers(
267
301
  handler: SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType>
268
- ): SlateTriggerGroupBuilder<ConfigType, AuthType> {
302
+ ): SlateTriggerGroupBuilder<ConfigType, AuthType, InputType> {
269
303
  this.#routingMatchers = handler;
270
304
  return this;
271
305
  }
272
306
 
273
- build(): SlateTriggerGroup<ConfigType, AuthType> {
307
+ build(): SlateTriggerGroup<ConfigType, AuthType, InputType> {
274
308
  if (!this.#source) {
275
309
  throw new SlateDeclarationError(
276
310
  'Trigger group invocation (polling or webhook) is not defined'
@@ -290,7 +324,11 @@ export class SlateTriggerGroupBuilder<ConfigType extends {}, AuthType extends {}
290
324
  }
291
325
  }
292
326
 
293
- export let triggerGroup = <ConfigType extends {}, AuthType extends {}>(
327
+ export let triggerGroup = <
328
+ ConfigType extends {},
329
+ AuthType extends {},
330
+ InputType extends {} = Record<string, unknown>
331
+ >(
294
332
  spec: SlateSpecification<ConfigType, AuthType>,
295
- params: SlateTriggerGroupCreateParameters
333
+ params: SlateTriggerGroupCreateParameters<InputType>
296
334
  ) => SlateTriggerGroup.create(spec, params);
package/src/auth/types.ts CHANGED
@@ -22,6 +22,8 @@ export type SlateAuthWithOauth<
22
22
  scope: string;
23
23
  }[];
24
24
 
25
+ adapters?: string[];
26
+
25
27
  docs?: SlateAuthDocsReference[];
26
28
 
27
29
  inputSchema?: z.ZodType<InputType>;
@@ -92,6 +94,8 @@ export type SlateAuthWithToken<InputType extends {}, OutputType extends { token?
92
94
  name: string;
93
95
  key: string;
94
96
 
97
+ adapters?: string[];
98
+
95
99
  inputSchema?: z.ZodType<InputType>;
96
100
 
97
101
  docs?: SlateAuthDocsReference[];
@@ -124,6 +128,8 @@ export type SlateAuthWithServiceAccount<InputType extends {}, OutputType extends
124
128
  name: string;
125
129
  key: string;
126
130
 
131
+ adapters?: string[];
132
+
127
133
  inputSchema?: z.ZodType<InputType>;
128
134
 
129
135
  docs?: SlateAuthDocsReference[];
@@ -156,6 +162,8 @@ export type SlateAuthWithCustomData<InputType extends {}, OutputType extends {}>
156
162
  name: string;
157
163
  key: string;
158
164
 
165
+ adapters?: string[];
166
+
159
167
  inputSchema?: z.ZodType<InputType>;
160
168
 
161
169
  docs?: SlateAuthDocsReference[];
@@ -97,6 +97,9 @@ describe('Slate.create', () => {
97
97
  triggerGroups: [manual, auto]
98
98
  });
99
99
 
100
- expect(slate.triggerGroups.map(group => group.key)).toEqual(['manual_group', 'auto_group']);
100
+ expect(slate.triggerGroups.map(group => group.key)).toEqual([
101
+ 'manual_group',
102
+ 'auto_group'
103
+ ]);
101
104
  });
102
105
  });