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

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: {
@@ -536,18 +540,18 @@ type SlateWebhookUnregisterHandler<ConfigType extends {}, AuthType extends {}> =
536
540
  webhookRegistrationIdentifier: string;
537
541
  webhookRegistrationPayload: any;
538
542
  }>) => Promise<unknown>;
539
- type SlateWebhookManualSetupHandler<FullConfigSchema extends z.ZodType<any> = z.ZodType<any>> = (context: SlateContext<{}, {}, {
543
+ type SlateWebhookManualSetupHandler<FullConfigSchema extends z$1.ZodType<any> = z$1.ZodType<any>> = (context: SlateContext<{}, {}, {
540
544
  webhookUrl: string;
541
545
  }>) => Promise<{
542
546
  webhookSetupDocument: string;
543
- partialWebhookRegistrationPayload: Partial<z.infer<FullConfigSchema>>;
547
+ partialWebhookRegistrationPayload: Partial<z$1.infer<FullConfigSchema>>;
544
548
  }>;
545
- type SlateWebhookManualFinishHandler<UserConfigSchema extends z.ZodType<any> = z.ZodType<any>, FullConfigSchema extends z.ZodType<any> = z.ZodType<any>> = (context: SlateContext<{}, {}, {
549
+ 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
550
  webhookUrl: string;
547
- partialWebhookRegistrationPayload: Partial<z.infer<FullConfigSchema>>;
548
- userWebhookRegistrationPayload: z.infer<UserConfigSchema>;
551
+ partialWebhookRegistrationPayload: Partial<z$1.infer<FullConfigSchema>>;
552
+ userWebhookRegistrationPayload: z$1.infer<UserConfigSchema>;
549
553
  }>) => Promise<{
550
- webhookRegistrationPayload: z.infer<FullConfigSchema>;
554
+ webhookRegistrationPayload: z$1.infer<FullConfigSchema>;
551
555
  }>;
552
556
  type SlateWebhookProcessHandler = (context: SlateContext<{}, {}, {
553
557
  request: Request;
@@ -569,7 +573,7 @@ interface SlateTriggerGroupWebhookAutoRegistrationParameters<ConfigType extends
569
573
  webhookRegister: SlateWebhookRegisterHandler<ConfigType, AuthType>;
570
574
  webhookUnregister: SlateWebhookUnregisterHandler<ConfigType, AuthType>;
571
575
  }
572
- interface SlateTriggerGroupWebhookManualRegistrationParameters<UserConfigSchema extends z.ZodType<any> = z.ZodType<any>, FullConfigSchema extends z.ZodType<any> = z.ZodType<any>> {
576
+ interface SlateTriggerGroupWebhookManualRegistrationParameters<UserConfigSchema extends z$1.ZodType<any> = z$1.ZodType<any>, FullConfigSchema extends z$1.ZodType<any> = z$1.ZodType<any>> {
573
577
  userConfigSchema: UserConfigSchema;
574
578
  fullConfigSchema: FullConfigSchema;
575
579
  setup: SlateWebhookManualSetupHandler<FullConfigSchema>;
@@ -580,52 +584,54 @@ interface SlateTriggerGroupWebhookParameters<ConfigType extends {}, AuthType ext
580
584
  manualRegistration?: SlateTriggerGroupWebhookManualRegistrationParameters<any, any>;
581
585
  process: SlateWebhookProcessHandler;
582
586
  }
583
- interface SlateTriggerGroupCreateParameters {
587
+ interface SlateTriggerGroupCreateParameters<InputType extends {} = Record<string, unknown>> {
584
588
  key: string;
585
589
  name: string;
586
590
  description?: string;
587
591
  metadata?: Record<string, any>;
592
+ eventSchema?: z$1.ZodType<InputType>;
588
593
  }
589
- interface SlateTriggerGroupParameters<ConfigType extends {}, AuthType extends {}> extends SlateTriggerGroupCreateParameters {
594
+ interface SlateTriggerGroupParameters<ConfigType extends {}, AuthType extends {}, InputType extends {} = Record<string, unknown>> extends SlateTriggerGroupCreateParameters<InputType> {
590
595
  source: 'polling' | 'webhook';
591
596
  polling?: SlateTriggerGroupPollingParameters<ConfigType, AuthType>;
592
597
  webhook?: SlateTriggerGroupWebhookParameters<ConfigType, AuthType>;
593
598
  routingMatchers: SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType>;
594
599
  }
595
- declare class SlateTriggerGroup<ConfigType extends {}, AuthType extends {}> {
600
+ declare class SlateTriggerGroup<ConfigType extends {}, AuthType extends {}, InputType extends {} = Record<string, unknown>> {
596
601
  private readonly _spec;
597
602
  private readonly _params;
598
603
  private constructor();
599
- static create<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateTriggerGroupCreateParameters): SlateTriggerGroupBuilder<ConfigType, AuthType>;
604
+ static create<ConfigType extends {}, AuthType extends {}, InputType extends {} = Record<string, unknown>>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateTriggerGroupCreateParameters<InputType>): SlateTriggerGroupBuilder<ConfigType, AuthType, InputType>;
600
605
  get spec(): SlateSpecification<ConfigType, AuthType>;
601
606
  get key(): string;
602
607
  get name(): string;
603
608
  get description(): string | undefined;
604
609
  get metadata(): Record<string, any> | undefined;
610
+ get eventSchema(): z$1.ZodType<InputType, unknown, z$1.core.$ZodTypeInternals<InputType, unknown>>;
605
611
  get source(): "polling" | "webhook";
606
612
  get polling(): SlateTriggerGroupPollingParameters<ConfigType, AuthType> | undefined;
607
613
  get webhook(): SlateTriggerGroupWebhookParameters<ConfigType, AuthType> | undefined;
608
614
  get routingMatchers(): SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType>;
609
615
  }
610
- declare class SlateTriggerGroupBuilder<ConfigType extends {}, AuthType extends {}> {
616
+ declare class SlateTriggerGroupBuilder<ConfigType extends {}, AuthType extends {}, InputType extends {} = Record<string, unknown>> {
611
617
  #private;
612
618
  private readonly spec;
613
619
  private readonly params;
614
620
  private readonly factory;
615
- constructor(spec: SlateSpecification<ConfigType, AuthType>, params: SlateTriggerGroupCreateParameters, factory: (params: SlateTriggerGroupParameters<ConfigType, AuthType>) => SlateTriggerGroup<ConfigType, AuthType>);
621
+ constructor(spec: SlateSpecification<ConfigType, AuthType>, params: SlateTriggerGroupCreateParameters<InputType>, factory: (params: SlateTriggerGroupParameters<ConfigType, AuthType, InputType>) => SlateTriggerGroup<ConfigType, AuthType, InputType>);
616
622
  polling(props: {
617
623
  intervalSeconds?: number;
618
624
  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: {
625
+ }): SlateTriggerGroupBuilder<ConfigType, AuthType, InputType>;
626
+ webhook<UserConfigSchema extends z$1.ZodType<any> = z$1.ZodType<any>, FullConfigSchema extends z$1.ZodType<any> = z$1.ZodType<any>>(props: {
621
627
  autoRegistration?: SlateTriggerGroupWebhookAutoRegistrationParameters<ConfigType, AuthType>;
622
628
  manualRegistration?: SlateTriggerGroupWebhookManualRegistrationParameters<UserConfigSchema, FullConfigSchema>;
623
629
  process: SlateWebhookProcessHandler;
624
- }): SlateTriggerGroupBuilder<ConfigType, AuthType>;
625
- routingMatchers(handler: SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType>): SlateTriggerGroupBuilder<ConfigType, AuthType>;
626
- build(): SlateTriggerGroup<ConfigType, AuthType>;
630
+ }): SlateTriggerGroupBuilder<ConfigType, AuthType, InputType>;
631
+ routingMatchers(handler: SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType>): SlateTriggerGroupBuilder<ConfigType, AuthType, InputType>;
632
+ build(): SlateTriggerGroup<ConfigType, AuthType, InputType>;
627
633
  }
628
- declare let triggerGroup: <ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateTriggerGroupCreateParameters) => SlateTriggerGroupBuilder<ConfigType, AuthType>;
634
+ declare let triggerGroup: <ConfigType extends {}, AuthType extends {}, InputType extends {} = Record<string, unknown>>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateTriggerGroupCreateParameters<InputType>) => SlateTriggerGroupBuilder<ConfigType, AuthType, InputType>;
629
635
 
630
636
  type SlateActionType = 'tool' | 'trigger';
631
637
  interface SlateActionScopeClause {
@@ -805,7 +811,7 @@ declare class SlateTrigger<ConfigType extends {}, AuthType extends {}, InputType
805
811
  #private;
806
812
  private constructor();
807
813
  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>;
814
+ get triggerGroup(): SlateTriggerGroup<ConfigType, AuthType, Record<string, unknown>>;
809
815
  get matches(): SlateTriggerMatchesHandler;
810
816
  get map(): SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
811
817
  }
@@ -1048,7 +1054,7 @@ declare class Slate<ConfigType extends {}, AuthType extends {}> {
1048
1054
  get spec(): SlateSpecification<ConfigType, AuthType>;
1049
1055
  get actions(): (SlateTrigger<ConfigType, AuthType, any, any> | SlateTool<ConfigType, AuthType, any, any>)[];
1050
1056
  get adapters(): SlateAdapter<ConfigType, AuthType>[];
1051
- get triggerGroups(): SlateTriggerGroup<ConfigType, AuthType>[];
1057
+ get triggerGroups(): SlateTriggerGroup<ConfigType, AuthType, Record<string, unknown>>[];
1052
1058
  }
1053
1059
 
1054
1060
  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: {
@@ -536,18 +540,18 @@ type SlateWebhookUnregisterHandler<ConfigType extends {}, AuthType extends {}> =
536
540
  webhookRegistrationIdentifier: string;
537
541
  webhookRegistrationPayload: any;
538
542
  }>) => Promise<unknown>;
539
- type SlateWebhookManualSetupHandler<FullConfigSchema extends z.ZodType<any> = z.ZodType<any>> = (context: SlateContext<{}, {}, {
543
+ type SlateWebhookManualSetupHandler<FullConfigSchema extends z$1.ZodType<any> = z$1.ZodType<any>> = (context: SlateContext<{}, {}, {
540
544
  webhookUrl: string;
541
545
  }>) => Promise<{
542
546
  webhookSetupDocument: string;
543
- partialWebhookRegistrationPayload: Partial<z.infer<FullConfigSchema>>;
547
+ partialWebhookRegistrationPayload: Partial<z$1.infer<FullConfigSchema>>;
544
548
  }>;
545
- type SlateWebhookManualFinishHandler<UserConfigSchema extends z.ZodType<any> = z.ZodType<any>, FullConfigSchema extends z.ZodType<any> = z.ZodType<any>> = (context: SlateContext<{}, {}, {
549
+ 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
550
  webhookUrl: string;
547
- partialWebhookRegistrationPayload: Partial<z.infer<FullConfigSchema>>;
548
- userWebhookRegistrationPayload: z.infer<UserConfigSchema>;
551
+ partialWebhookRegistrationPayload: Partial<z$1.infer<FullConfigSchema>>;
552
+ userWebhookRegistrationPayload: z$1.infer<UserConfigSchema>;
549
553
  }>) => Promise<{
550
- webhookRegistrationPayload: z.infer<FullConfigSchema>;
554
+ webhookRegistrationPayload: z$1.infer<FullConfigSchema>;
551
555
  }>;
552
556
  type SlateWebhookProcessHandler = (context: SlateContext<{}, {}, {
553
557
  request: Request;
@@ -569,7 +573,7 @@ interface SlateTriggerGroupWebhookAutoRegistrationParameters<ConfigType extends
569
573
  webhookRegister: SlateWebhookRegisterHandler<ConfigType, AuthType>;
570
574
  webhookUnregister: SlateWebhookUnregisterHandler<ConfigType, AuthType>;
571
575
  }
572
- interface SlateTriggerGroupWebhookManualRegistrationParameters<UserConfigSchema extends z.ZodType<any> = z.ZodType<any>, FullConfigSchema extends z.ZodType<any> = z.ZodType<any>> {
576
+ interface SlateTriggerGroupWebhookManualRegistrationParameters<UserConfigSchema extends z$1.ZodType<any> = z$1.ZodType<any>, FullConfigSchema extends z$1.ZodType<any> = z$1.ZodType<any>> {
573
577
  userConfigSchema: UserConfigSchema;
574
578
  fullConfigSchema: FullConfigSchema;
575
579
  setup: SlateWebhookManualSetupHandler<FullConfigSchema>;
@@ -580,52 +584,54 @@ interface SlateTriggerGroupWebhookParameters<ConfigType extends {}, AuthType ext
580
584
  manualRegistration?: SlateTriggerGroupWebhookManualRegistrationParameters<any, any>;
581
585
  process: SlateWebhookProcessHandler;
582
586
  }
583
- interface SlateTriggerGroupCreateParameters {
587
+ interface SlateTriggerGroupCreateParameters<InputType extends {} = Record<string, unknown>> {
584
588
  key: string;
585
589
  name: string;
586
590
  description?: string;
587
591
  metadata?: Record<string, any>;
592
+ eventSchema?: z$1.ZodType<InputType>;
588
593
  }
589
- interface SlateTriggerGroupParameters<ConfigType extends {}, AuthType extends {}> extends SlateTriggerGroupCreateParameters {
594
+ interface SlateTriggerGroupParameters<ConfigType extends {}, AuthType extends {}, InputType extends {} = Record<string, unknown>> extends SlateTriggerGroupCreateParameters<InputType> {
590
595
  source: 'polling' | 'webhook';
591
596
  polling?: SlateTriggerGroupPollingParameters<ConfigType, AuthType>;
592
597
  webhook?: SlateTriggerGroupWebhookParameters<ConfigType, AuthType>;
593
598
  routingMatchers: SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType>;
594
599
  }
595
- declare class SlateTriggerGroup<ConfigType extends {}, AuthType extends {}> {
600
+ declare class SlateTriggerGroup<ConfigType extends {}, AuthType extends {}, InputType extends {} = Record<string, unknown>> {
596
601
  private readonly _spec;
597
602
  private readonly _params;
598
603
  private constructor();
599
- static create<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateTriggerGroupCreateParameters): SlateTriggerGroupBuilder<ConfigType, AuthType>;
604
+ static create<ConfigType extends {}, AuthType extends {}, InputType extends {} = Record<string, unknown>>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateTriggerGroupCreateParameters<InputType>): SlateTriggerGroupBuilder<ConfigType, AuthType, InputType>;
600
605
  get spec(): SlateSpecification<ConfigType, AuthType>;
601
606
  get key(): string;
602
607
  get name(): string;
603
608
  get description(): string | undefined;
604
609
  get metadata(): Record<string, any> | undefined;
610
+ get eventSchema(): z$1.ZodType<InputType, unknown, z$1.core.$ZodTypeInternals<InputType, unknown>>;
605
611
  get source(): "polling" | "webhook";
606
612
  get polling(): SlateTriggerGroupPollingParameters<ConfigType, AuthType> | undefined;
607
613
  get webhook(): SlateTriggerGroupWebhookParameters<ConfigType, AuthType> | undefined;
608
614
  get routingMatchers(): SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType>;
609
615
  }
610
- declare class SlateTriggerGroupBuilder<ConfigType extends {}, AuthType extends {}> {
616
+ declare class SlateTriggerGroupBuilder<ConfigType extends {}, AuthType extends {}, InputType extends {} = Record<string, unknown>> {
611
617
  #private;
612
618
  private readonly spec;
613
619
  private readonly params;
614
620
  private readonly factory;
615
- constructor(spec: SlateSpecification<ConfigType, AuthType>, params: SlateTriggerGroupCreateParameters, factory: (params: SlateTriggerGroupParameters<ConfigType, AuthType>) => SlateTriggerGroup<ConfigType, AuthType>);
621
+ constructor(spec: SlateSpecification<ConfigType, AuthType>, params: SlateTriggerGroupCreateParameters<InputType>, factory: (params: SlateTriggerGroupParameters<ConfigType, AuthType, InputType>) => SlateTriggerGroup<ConfigType, AuthType, InputType>);
616
622
  polling(props: {
617
623
  intervalSeconds?: number;
618
624
  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: {
625
+ }): SlateTriggerGroupBuilder<ConfigType, AuthType, InputType>;
626
+ webhook<UserConfigSchema extends z$1.ZodType<any> = z$1.ZodType<any>, FullConfigSchema extends z$1.ZodType<any> = z$1.ZodType<any>>(props: {
621
627
  autoRegistration?: SlateTriggerGroupWebhookAutoRegistrationParameters<ConfigType, AuthType>;
622
628
  manualRegistration?: SlateTriggerGroupWebhookManualRegistrationParameters<UserConfigSchema, FullConfigSchema>;
623
629
  process: SlateWebhookProcessHandler;
624
- }): SlateTriggerGroupBuilder<ConfigType, AuthType>;
625
- routingMatchers(handler: SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType>): SlateTriggerGroupBuilder<ConfigType, AuthType>;
626
- build(): SlateTriggerGroup<ConfigType, AuthType>;
630
+ }): SlateTriggerGroupBuilder<ConfigType, AuthType, InputType>;
631
+ routingMatchers(handler: SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType>): SlateTriggerGroupBuilder<ConfigType, AuthType, InputType>;
632
+ build(): SlateTriggerGroup<ConfigType, AuthType, InputType>;
627
633
  }
628
- declare let triggerGroup: <ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateTriggerGroupCreateParameters) => SlateTriggerGroupBuilder<ConfigType, AuthType>;
634
+ declare let triggerGroup: <ConfigType extends {}, AuthType extends {}, InputType extends {} = Record<string, unknown>>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateTriggerGroupCreateParameters<InputType>) => SlateTriggerGroupBuilder<ConfigType, AuthType, InputType>;
629
635
 
630
636
  type SlateActionType = 'tool' | 'trigger';
631
637
  interface SlateActionScopeClause {
@@ -805,7 +811,7 @@ declare class SlateTrigger<ConfigType extends {}, AuthType extends {}, InputType
805
811
  #private;
806
812
  private constructor();
807
813
  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>;
814
+ get triggerGroup(): SlateTriggerGroup<ConfigType, AuthType, Record<string, unknown>>;
809
815
  get matches(): SlateTriggerMatchesHandler;
810
816
  get map(): SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
811
817
  }
@@ -1048,7 +1054,7 @@ declare class Slate<ConfigType extends {}, AuthType extends {}> {
1048
1054
  get spec(): SlateSpecification<ConfigType, AuthType>;
1049
1055
  get actions(): (SlateTrigger<ConfigType, AuthType, any, any> | SlateTool<ConfigType, AuthType, any, any>)[];
1050
1056
  get adapters(): SlateAdapter<ConfigType, AuthType>[];
1051
- get triggerGroups(): SlateTriggerGroup<ConfigType, AuthType>[];
1057
+ get triggerGroups(): SlateTriggerGroup<ConfigType, AuthType, Record<string, unknown>>[];
1052
1058
  }
1053
1059
 
1054
1060
  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.24",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -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 }>
@@ -63,13 +64,12 @@ export type SlateWebhookUnregisterHandler<ConfigType extends {}, AuthType extend
63
64
  >
64
65
  ) => Promise<unknown>;
65
66
 
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
- }>;
67
+ export type SlateWebhookManualSetupHandler<
68
+ FullConfigSchema extends z.ZodType<any> = z.ZodType<any>
69
+ > = (context: SlateContext<{}, {}, { webhookUrl: string }>) => Promise<{
70
+ webhookSetupDocument: string;
71
+ partialWebhookRegistrationPayload: Partial<z.infer<FullConfigSchema>>;
72
+ }>;
73
73
 
74
74
  export type SlateWebhookManualFinishHandler<
75
75
  UserConfigSchema extends z.ZodType<any> = z.ZodType<any>,
@@ -106,7 +106,10 @@ export type SlateWebhookProcessHandler = (
106
106
  response?: Response | SlateWebhookHttpResponseInit;
107
107
  }>;
108
108
 
109
- export interface SlateTriggerGroupPollingParameters<ConfigType extends {}, AuthType extends {}> {
109
+ export interface SlateTriggerGroupPollingParameters<
110
+ ConfigType extends {},
111
+ AuthType extends {}
112
+ > {
110
113
  intervalSeconds: number;
111
114
  pollEvents: SlateTriggerGroupPollHandler<ConfigType, AuthType>;
112
115
  }
@@ -130,36 +133,53 @@ export interface SlateTriggerGroupWebhookManualRegistrationParameters<
130
133
  finish?: SlateWebhookManualFinishHandler<UserConfigSchema, FullConfigSchema>;
131
134
  }
132
135
 
133
- export interface SlateTriggerGroupWebhookParameters<ConfigType extends {}, AuthType extends {}> {
136
+ export interface SlateTriggerGroupWebhookParameters<
137
+ ConfigType extends {},
138
+ AuthType extends {}
139
+ > {
134
140
  autoRegistration?: SlateTriggerGroupWebhookAutoRegistrationParameters<ConfigType, AuthType>;
135
141
  manualRegistration?: SlateTriggerGroupWebhookManualRegistrationParameters<any, any>;
136
142
  process: SlateWebhookProcessHandler;
137
143
  }
138
144
 
139
- export interface SlateTriggerGroupCreateParameters {
145
+ export interface SlateTriggerGroupCreateParameters<
146
+ InputType extends {} = Record<string, unknown>
147
+ > {
140
148
  key: string;
141
149
  name: string;
142
150
  description?: string;
143
151
  metadata?: Record<string, any>;
152
+ eventSchema?: z.ZodType<InputType>;
144
153
  }
145
154
 
146
- export interface SlateTriggerGroupParameters<ConfigType extends {}, AuthType extends {}>
147
- extends SlateTriggerGroupCreateParameters {
155
+ export interface SlateTriggerGroupParameters<
156
+ ConfigType extends {},
157
+ AuthType extends {},
158
+ InputType extends {} = Record<string, unknown>
159
+ > extends SlateTriggerGroupCreateParameters<InputType> {
148
160
  source: 'polling' | 'webhook';
149
161
  polling?: SlateTriggerGroupPollingParameters<ConfigType, AuthType>;
150
162
  webhook?: SlateTriggerGroupWebhookParameters<ConfigType, AuthType>;
151
163
  routingMatchers: SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType>;
152
164
  }
153
165
 
154
- export class SlateTriggerGroup<ConfigType extends {}, AuthType extends {}> {
166
+ export class SlateTriggerGroup<
167
+ ConfigType extends {},
168
+ AuthType extends {},
169
+ InputType extends {} = Record<string, unknown>
170
+ > {
155
171
  private constructor(
156
172
  private readonly _spec: SlateSpecification<ConfigType, AuthType>,
157
- private readonly _params: SlateTriggerGroupParameters<ConfigType, AuthType>
173
+ private readonly _params: SlateTriggerGroupParameters<ConfigType, AuthType, InputType>
158
174
  ) {}
159
175
 
160
- static create<ConfigType extends {}, AuthType extends {}>(
176
+ static create<
177
+ ConfigType extends {},
178
+ AuthType extends {},
179
+ InputType extends {} = Record<string, unknown>
180
+ >(
161
181
  spec: SlateSpecification<ConfigType, AuthType>,
162
- params: SlateTriggerGroupCreateParameters
182
+ params: SlateTriggerGroupCreateParameters<InputType>
163
183
  ) {
164
184
  return new SlateTriggerGroupBuilder(spec, params, p => new SlateTriggerGroup(spec, p));
165
185
  }
@@ -184,6 +204,10 @@ export class SlateTriggerGroup<ConfigType extends {}, AuthType extends {}> {
184
204
  return this._params.metadata;
185
205
  }
186
206
 
207
+ get eventSchema() {
208
+ return this._params.eventSchema ?? (z.object({}).passthrough() as z.ZodType<InputType>);
209
+ }
210
+
187
211
  get source() {
188
212
  return this._params.source;
189
213
  }
@@ -201,24 +225,29 @@ export class SlateTriggerGroup<ConfigType extends {}, AuthType extends {}> {
201
225
  }
202
226
  }
203
227
 
204
- export class SlateTriggerGroupBuilder<ConfigType extends {}, AuthType extends {}> {
228
+ export class SlateTriggerGroupBuilder<
229
+ ConfigType extends {},
230
+ AuthType extends {},
231
+ InputType extends {} = Record<string, unknown>
232
+ > {
205
233
  #source: 'polling' | 'webhook' | null = null;
206
234
  #polling: SlateTriggerGroupPollingParameters<ConfigType, AuthType> | null = null;
207
235
  #webhook: SlateTriggerGroupWebhookParameters<ConfigType, AuthType> | null = null;
208
- #routingMatchers: SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType> | null = null;
236
+ #routingMatchers: SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType> | null =
237
+ null;
209
238
 
210
239
  constructor(
211
240
  private readonly spec: SlateSpecification<ConfigType, AuthType>,
212
- private readonly params: SlateTriggerGroupCreateParameters,
241
+ private readonly params: SlateTriggerGroupCreateParameters<InputType>,
213
242
  private readonly factory: (
214
- params: SlateTriggerGroupParameters<ConfigType, AuthType>
215
- ) => SlateTriggerGroup<ConfigType, AuthType>
243
+ params: SlateTriggerGroupParameters<ConfigType, AuthType, InputType>
244
+ ) => SlateTriggerGroup<ConfigType, AuthType, InputType>
216
245
  ) {}
217
246
 
218
247
  polling(props: {
219
248
  intervalSeconds?: number;
220
249
  pollEvents: SlateTriggerGroupPollHandler<ConfigType, AuthType>;
221
- }): SlateTriggerGroupBuilder<ConfigType, AuthType> {
250
+ }): SlateTriggerGroupBuilder<ConfigType, AuthType, InputType> {
222
251
  if (this.#source) {
223
252
  throw new SlateDeclarationError('Trigger group invocation is already defined');
224
253
  }
@@ -236,13 +265,16 @@ export class SlateTriggerGroupBuilder<ConfigType extends {}, AuthType extends {}
236
265
  UserConfigSchema extends z.ZodType<any> = z.ZodType<any>,
237
266
  FullConfigSchema extends z.ZodType<any> = z.ZodType<any>
238
267
  >(props: {
239
- autoRegistration?: SlateTriggerGroupWebhookAutoRegistrationParameters<ConfigType, AuthType>;
268
+ autoRegistration?: SlateTriggerGroupWebhookAutoRegistrationParameters<
269
+ ConfigType,
270
+ AuthType
271
+ >;
240
272
  manualRegistration?: SlateTriggerGroupWebhookManualRegistrationParameters<
241
273
  UserConfigSchema,
242
274
  FullConfigSchema
243
275
  >;
244
276
  process: SlateWebhookProcessHandler;
245
- }): SlateTriggerGroupBuilder<ConfigType, AuthType> {
277
+ }): SlateTriggerGroupBuilder<ConfigType, AuthType, InputType> {
246
278
  if (this.#source) {
247
279
  throw new SlateDeclarationError('Trigger group invocation is already defined');
248
280
  }
@@ -265,12 +297,12 @@ export class SlateTriggerGroupBuilder<ConfigType extends {}, AuthType extends {}
265
297
 
266
298
  routingMatchers(
267
299
  handler: SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType>
268
- ): SlateTriggerGroupBuilder<ConfigType, AuthType> {
300
+ ): SlateTriggerGroupBuilder<ConfigType, AuthType, InputType> {
269
301
  this.#routingMatchers = handler;
270
302
  return this;
271
303
  }
272
304
 
273
- build(): SlateTriggerGroup<ConfigType, AuthType> {
305
+ build(): SlateTriggerGroup<ConfigType, AuthType, InputType> {
274
306
  if (!this.#source) {
275
307
  throw new SlateDeclarationError(
276
308
  'Trigger group invocation (polling or webhook) is not defined'
@@ -290,7 +322,11 @@ export class SlateTriggerGroupBuilder<ConfigType extends {}, AuthType extends {}
290
322
  }
291
323
  }
292
324
 
293
- export let triggerGroup = <ConfigType extends {}, AuthType extends {}>(
325
+ export let triggerGroup = <
326
+ ConfigType extends {},
327
+ AuthType extends {},
328
+ InputType extends {} = Record<string, unknown>
329
+ >(
294
330
  spec: SlateSpecification<ConfigType, AuthType>,
295
- params: SlateTriggerGroupCreateParameters
331
+ params: SlateTriggerGroupCreateParameters<InputType>
296
332
  ) => 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
  });