@slates/provider 1.0.0-rc.22 → 1.0.0-rc.23
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 +174 -61
- package/dist/index.d.cts +154 -96
- package/dist/index.d.ts +154 -96
- package/dist/index.module.js +171 -61
- package/package.json +2 -2
- package/src/action/action.ts +6 -88
- package/src/action/builder.ts +50 -46
- package/src/action/index.ts +1 -0
- package/src/action/trigger.ts +17 -60
- package/src/action/triggerGroup.ts +296 -0
- package/src/adapter/index.test.ts +35 -14
- package/src/module/resolveDefaultExport.test.ts +3 -3
- package/src/specification/slate.test.ts +102 -0
- package/src/specification/slate.ts +31 -3
- package/src/webhook/graph.ts +2 -2
- package/src/webhook/meta.ts +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -497,6 +497,136 @@ declare class SlateContext<ConfigType extends {}, AuthType extends {}, InputType
|
|
|
497
497
|
declare let runWithContext: <InputType extends {}, RV>(context: SlatePublicContext<InputType>, fn: () => Promise<RV>) => Promise<RV>;
|
|
498
498
|
declare let getCurrentContext: <ConfigType extends {}, AuthType extends {}, InputType extends {}>() => SlateContext<ConfigType, AuthType, InputType>;
|
|
499
499
|
|
|
500
|
+
declare let SlateDefaultPollingIntervalSeconds: number;
|
|
501
|
+
type SlateTriggerRoutingMatcher = Record<string, any>;
|
|
502
|
+
type SlateWebhookTargetOwnership = 'single_user' | 'multi_user';
|
|
503
|
+
interface SlateWebhookTarget {
|
|
504
|
+
webhookTargetIdentifier: string;
|
|
505
|
+
name: string;
|
|
506
|
+
description?: string;
|
|
507
|
+
metadata: Record<string, any>;
|
|
508
|
+
webhookTargetPayload: any;
|
|
509
|
+
targetOwnership: SlateWebhookTargetOwnership;
|
|
510
|
+
}
|
|
511
|
+
type SlateTriggerGroupRoutingMatchersHandler<ConfigType extends {}, AuthType extends {}> = (context: SlateContext<ConfigType, AuthType, {}>) => Promise<SlateTriggerRoutingMatcher[]>;
|
|
512
|
+
type SlateTriggerGroupPollHandler<ConfigType extends {}, AuthType extends {}> = (context: SlateContext<ConfigType, AuthType, {
|
|
513
|
+
state: any | null;
|
|
514
|
+
}>) => Promise<{
|
|
515
|
+
events: {
|
|
516
|
+
payload: any;
|
|
517
|
+
idempotencyKey?: string;
|
|
518
|
+
}[];
|
|
519
|
+
updatedState?: any;
|
|
520
|
+
}>;
|
|
521
|
+
type SlateWebhookTargetListHandler<ConfigType extends {}, AuthType extends {}> = (context: SlateContext<ConfigType, AuthType, {
|
|
522
|
+
pageToken: any | null;
|
|
523
|
+
}>) => Promise<{
|
|
524
|
+
targets: SlateWebhookTarget[];
|
|
525
|
+
nextPageToken: any | null;
|
|
526
|
+
}>;
|
|
527
|
+
type SlateWebhookRegisterHandler<ConfigType extends {}, AuthType extends {}> = (context: SlateContext<ConfigType, AuthType, {
|
|
528
|
+
webhookTargetIdentifier: string;
|
|
529
|
+
webhookTargetPayload: any;
|
|
530
|
+
webhookUrl: string;
|
|
531
|
+
}>) => Promise<{
|
|
532
|
+
webhookRegistrationIdentifier: string;
|
|
533
|
+
webhookRegistrationPayload: any;
|
|
534
|
+
}>;
|
|
535
|
+
type SlateWebhookUnregisterHandler<ConfigType extends {}, AuthType extends {}> = (context: SlateContext<ConfigType, AuthType, {
|
|
536
|
+
webhookRegistrationIdentifier: string;
|
|
537
|
+
webhookRegistrationPayload: any;
|
|
538
|
+
}>) => Promise<unknown>;
|
|
539
|
+
type SlateWebhookManualSetupHandler<FullConfigSchema extends z.ZodType<any> = z.ZodType<any>> = (context: SlateContext<{}, {}, {
|
|
540
|
+
webhookUrl: string;
|
|
541
|
+
}>) => Promise<{
|
|
542
|
+
webhookSetupDocument: string;
|
|
543
|
+
partialWebhookRegistrationPayload: Partial<z.infer<FullConfigSchema>>;
|
|
544
|
+
}>;
|
|
545
|
+
type SlateWebhookManualFinishHandler<UserConfigSchema extends z.ZodType<any> = z.ZodType<any>, FullConfigSchema extends z.ZodType<any> = z.ZodType<any>> = (context: SlateContext<{}, {}, {
|
|
546
|
+
webhookUrl: string;
|
|
547
|
+
partialWebhookRegistrationPayload: Partial<z.infer<FullConfigSchema>>;
|
|
548
|
+
userWebhookRegistrationPayload: z.infer<UserConfigSchema>;
|
|
549
|
+
}>) => Promise<{
|
|
550
|
+
webhookRegistrationPayload: z.infer<FullConfigSchema>;
|
|
551
|
+
}>;
|
|
552
|
+
type SlateWebhookProcessHandler = (context: SlateContext<{}, {}, {
|
|
553
|
+
request: Request;
|
|
554
|
+
webhookRegistrationPayload: any;
|
|
555
|
+
}>) => Promise<{
|
|
556
|
+
events: {
|
|
557
|
+
matchers: SlateTriggerRoutingMatcher[];
|
|
558
|
+
payload: any;
|
|
559
|
+
idempotencyKey?: string;
|
|
560
|
+
}[];
|
|
561
|
+
response?: Response | SlateWebhookHttpResponseInit;
|
|
562
|
+
}>;
|
|
563
|
+
interface SlateTriggerGroupPollingParameters<ConfigType extends {}, AuthType extends {}> {
|
|
564
|
+
intervalSeconds: number;
|
|
565
|
+
pollEvents: SlateTriggerGroupPollHandler<ConfigType, AuthType>;
|
|
566
|
+
}
|
|
567
|
+
interface SlateTriggerGroupWebhookAutoRegistrationParameters<ConfigType extends {}, AuthType extends {}> {
|
|
568
|
+
webhookTargetList: SlateWebhookTargetListHandler<ConfigType, AuthType>;
|
|
569
|
+
webhookRegister: SlateWebhookRegisterHandler<ConfigType, AuthType>;
|
|
570
|
+
webhookUnregister: SlateWebhookUnregisterHandler<ConfigType, AuthType>;
|
|
571
|
+
}
|
|
572
|
+
interface SlateTriggerGroupWebhookManualRegistrationParameters<UserConfigSchema extends z.ZodType<any> = z.ZodType<any>, FullConfigSchema extends z.ZodType<any> = z.ZodType<any>> {
|
|
573
|
+
userConfigSchema: UserConfigSchema;
|
|
574
|
+
fullConfigSchema: FullConfigSchema;
|
|
575
|
+
setup: SlateWebhookManualSetupHandler<FullConfigSchema>;
|
|
576
|
+
finish?: SlateWebhookManualFinishHandler<UserConfigSchema, FullConfigSchema>;
|
|
577
|
+
}
|
|
578
|
+
interface SlateTriggerGroupWebhookParameters<ConfigType extends {}, AuthType extends {}> {
|
|
579
|
+
autoRegistration?: SlateTriggerGroupWebhookAutoRegistrationParameters<ConfigType, AuthType>;
|
|
580
|
+
manualRegistration?: SlateTriggerGroupWebhookManualRegistrationParameters<any, any>;
|
|
581
|
+
process: SlateWebhookProcessHandler;
|
|
582
|
+
}
|
|
583
|
+
interface SlateTriggerGroupCreateParameters {
|
|
584
|
+
key: string;
|
|
585
|
+
name: string;
|
|
586
|
+
description?: string;
|
|
587
|
+
metadata?: Record<string, any>;
|
|
588
|
+
}
|
|
589
|
+
interface SlateTriggerGroupParameters<ConfigType extends {}, AuthType extends {}> extends SlateTriggerGroupCreateParameters {
|
|
590
|
+
source: 'polling' | 'webhook';
|
|
591
|
+
polling?: SlateTriggerGroupPollingParameters<ConfigType, AuthType>;
|
|
592
|
+
webhook?: SlateTriggerGroupWebhookParameters<ConfigType, AuthType>;
|
|
593
|
+
routingMatchers: SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType>;
|
|
594
|
+
}
|
|
595
|
+
declare class SlateTriggerGroup<ConfigType extends {}, AuthType extends {}> {
|
|
596
|
+
private readonly _spec;
|
|
597
|
+
private readonly _params;
|
|
598
|
+
private constructor();
|
|
599
|
+
static create<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateTriggerGroupCreateParameters): SlateTriggerGroupBuilder<ConfigType, AuthType>;
|
|
600
|
+
get spec(): SlateSpecification<ConfigType, AuthType>;
|
|
601
|
+
get key(): string;
|
|
602
|
+
get name(): string;
|
|
603
|
+
get description(): string | undefined;
|
|
604
|
+
get metadata(): Record<string, any> | undefined;
|
|
605
|
+
get source(): "polling" | "webhook";
|
|
606
|
+
get polling(): SlateTriggerGroupPollingParameters<ConfigType, AuthType> | undefined;
|
|
607
|
+
get webhook(): SlateTriggerGroupWebhookParameters<ConfigType, AuthType> | undefined;
|
|
608
|
+
get routingMatchers(): SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType>;
|
|
609
|
+
}
|
|
610
|
+
declare class SlateTriggerGroupBuilder<ConfigType extends {}, AuthType extends {}> {
|
|
611
|
+
#private;
|
|
612
|
+
private readonly spec;
|
|
613
|
+
private readonly params;
|
|
614
|
+
private readonly factory;
|
|
615
|
+
constructor(spec: SlateSpecification<ConfigType, AuthType>, params: SlateTriggerGroupCreateParameters, factory: (params: SlateTriggerGroupParameters<ConfigType, AuthType>) => SlateTriggerGroup<ConfigType, AuthType>);
|
|
616
|
+
polling(props: {
|
|
617
|
+
intervalSeconds?: number;
|
|
618
|
+
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: {
|
|
621
|
+
autoRegistration?: SlateTriggerGroupWebhookAutoRegistrationParameters<ConfigType, AuthType>;
|
|
622
|
+
manualRegistration?: SlateTriggerGroupWebhookManualRegistrationParameters<UserConfigSchema, FullConfigSchema>;
|
|
623
|
+
process: SlateWebhookProcessHandler;
|
|
624
|
+
}): SlateTriggerGroupBuilder<ConfigType, AuthType>;
|
|
625
|
+
routingMatchers(handler: SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType>): SlateTriggerGroupBuilder<ConfigType, AuthType>;
|
|
626
|
+
build(): SlateTriggerGroup<ConfigType, AuthType>;
|
|
627
|
+
}
|
|
628
|
+
declare let triggerGroup: <ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateTriggerGroupCreateParameters) => SlateTriggerGroupBuilder<ConfigType, AuthType>;
|
|
629
|
+
|
|
500
630
|
type SlateActionType = 'tool' | 'trigger';
|
|
501
631
|
interface SlateActionScopeClause {
|
|
502
632
|
OR: string[];
|
|
@@ -532,81 +662,26 @@ type SlatePublicToolInvocationHandler<InputType extends {}, OutputType extends {
|
|
|
532
662
|
message: string;
|
|
533
663
|
attachments?: SlateAttachment[];
|
|
534
664
|
}>;
|
|
665
|
+
type SlateTriggerMatchesHandler = (payload: unknown) => boolean;
|
|
535
666
|
type SlateTriggerMappingHandler<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> = (context: SlateContext<ConfigType, AuthType, InputType>) => Promise<{
|
|
536
667
|
type: string;
|
|
537
668
|
id: string;
|
|
538
669
|
output: OutputType;
|
|
539
670
|
}>;
|
|
540
|
-
type SlateTriggerPollingHandler<ConfigType extends {}, AuthType extends {}, InputType extends {}> = (context: SlateContext<ConfigType, AuthType, {
|
|
541
|
-
state: any | null;
|
|
542
|
-
}>) => Promise<{
|
|
543
|
-
inputs: InputType[];
|
|
544
|
-
updatedState?: any;
|
|
545
|
-
}>;
|
|
546
671
|
interface SlateWebhookHttpResponseInit {
|
|
547
672
|
status?: number;
|
|
548
673
|
headers?: Record<string, string>;
|
|
549
674
|
body?: string | Uint8Array | null;
|
|
550
675
|
}
|
|
551
|
-
type SlateWebhookHttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
|
|
552
|
-
interface SlateWebhookRequestMatcher {
|
|
553
|
-
method?: string;
|
|
554
|
-
hasQueryParam?: string;
|
|
555
|
-
hasHeader?: string;
|
|
556
|
-
jsonBodyField?: {
|
|
557
|
-
path: string;
|
|
558
|
-
equals?: string;
|
|
559
|
-
};
|
|
560
|
-
formBodyField?: {
|
|
561
|
-
path: string;
|
|
562
|
-
equals?: string;
|
|
563
|
-
};
|
|
564
|
-
}
|
|
565
|
-
interface SlateWebhookHttpOptions {
|
|
566
|
-
methods?: SlateWebhookHttpMethod[];
|
|
567
|
-
sync?: {
|
|
568
|
-
mode: 'never' | 'match' | 'always';
|
|
569
|
-
match?: SlateWebhookRequestMatcher[];
|
|
570
|
-
timeoutMs?: number;
|
|
571
|
-
};
|
|
572
|
-
}
|
|
573
|
-
type SlateTriggerWebhookRequestHandler<ConfigType extends {}, AuthType extends {}, InputType extends {}> = (context: SlateContext<ConfigType, AuthType, {
|
|
574
|
-
request: Request;
|
|
575
|
-
state: any | null;
|
|
576
|
-
registrationDetails: any | null;
|
|
577
|
-
}>) => Promise<{
|
|
578
|
-
inputs: InputType[];
|
|
579
|
-
updatedState?: any;
|
|
580
|
-
response?: Response | SlateWebhookHttpResponseInit;
|
|
581
|
-
}>;
|
|
582
|
-
type SlateTriggerWebhookAutoRegistrationHandler<ConfigType extends {}, AuthType extends {}> = (context: SlateContext<ConfigType, AuthType, {
|
|
583
|
-
webhookBaseUrl: string;
|
|
584
|
-
}>) => Promise<{
|
|
585
|
-
registrationDetails: any;
|
|
586
|
-
state?: any;
|
|
587
|
-
}>;
|
|
588
|
-
type SlateTriggerWebhookAutoUnregistrationHandler<ConfigType extends {}, AuthType extends {}> = (context: SlateContext<ConfigType, AuthType, {
|
|
589
|
-
webhookBaseUrl: string;
|
|
590
|
-
registrationDetails: any;
|
|
591
|
-
state: any | null;
|
|
592
|
-
}>) => Promise<unknown>;
|
|
593
676
|
interface SlateActionParametersTool<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> {
|
|
594
677
|
type: 'tool';
|
|
595
678
|
handleInvocation: SlateToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>;
|
|
596
679
|
}
|
|
597
|
-
interface SlatePollingOptions {
|
|
598
|
-
intervalInSeconds?: number;
|
|
599
|
-
}
|
|
600
680
|
interface SlateActionParametersTrigger<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> {
|
|
601
681
|
type: 'trigger';
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
handleRequest?: SlateTriggerWebhookRequestHandler<ConfigType, AuthType, InputType>;
|
|
606
|
-
http?: SlateWebhookHttpOptions;
|
|
607
|
-
pollEvents?: SlateTriggerPollingHandler<ConfigType, AuthType, InputType>;
|
|
608
|
-
autoRegisterWebhook?: SlateTriggerWebhookAutoRegistrationHandler<ConfigType, AuthType>;
|
|
609
|
-
autoUnregisterWebhook?: SlateTriggerWebhookAutoUnregistrationHandler<ConfigType, AuthType>;
|
|
682
|
+
triggerGroup: SlateTriggerGroup<ConfigType, AuthType>;
|
|
683
|
+
matches: SlateTriggerMatchesHandler;
|
|
684
|
+
map: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
|
|
610
685
|
}
|
|
611
686
|
type SlateActionParametersAny<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> = SlateActionParametersTool<ConfigType, AuthType, InputType, OutputType> | SlateActionParametersTrigger<ConfigType, AuthType, InputType, OutputType>;
|
|
612
687
|
type SlateActionCreateParameters<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> = SlateActionParametersAny<ConfigType, AuthType, InputType, OutputType> & SlateActionParameters & {
|
|
@@ -659,18 +734,9 @@ declare class SlateActionBuilder<Type extends SlateActionType, ConfigType extend
|
|
|
659
734
|
authMethods(authMethods: string[]): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
|
|
660
735
|
private validateAuthMethods;
|
|
661
736
|
handleInvocation(handler: IsPublic extends true ? SlatePublicToolInvocationHandler<InputType, OutputType> : SlateToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
autoRegisterWebhook?: SlateTriggerWebhookAutoRegistrationHandler<ConfigType, AuthType>;
|
|
666
|
-
autoUnregisterWebhook?: SlateTriggerWebhookAutoUnregistrationHandler<ConfigType, AuthType>;
|
|
667
|
-
http?: SlateWebhookHttpOptions;
|
|
668
|
-
}): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
|
|
669
|
-
polling(props: {
|
|
670
|
-
options?: SlatePollingOptions;
|
|
671
|
-
pollEvents?: SlateTriggerPollingHandler<ConfigType, AuthType, InputType>;
|
|
672
|
-
handleEvent: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
|
|
673
|
-
}): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
|
|
737
|
+
triggerGroup(group: SlateTriggerGroup<ConfigType, AuthType>): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
|
|
738
|
+
matches(handler: SlateTriggerMatchesHandler): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
|
|
739
|
+
map(handler: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
|
|
674
740
|
build(): Result;
|
|
675
741
|
}
|
|
676
742
|
|
|
@@ -725,36 +791,25 @@ declare let allOf: (...inputs: SlateActionScopesInput[]) => SlateActionScopes;
|
|
|
725
791
|
declare let mergeScopes: (...inputs: Array<SlateActionScopes | null | undefined | false>) => SlateActionScopes | undefined;
|
|
726
792
|
declare let validateScopes: (scopes: SlateActionScopes) => SlateActionScopes;
|
|
727
793
|
|
|
728
|
-
declare let SlateDefaultPollingIntervalSeconds: number;
|
|
729
794
|
interface SlateTriggerParameters<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {
|
|
730
795
|
type: string;
|
|
731
796
|
}> extends SlateActionParameters {
|
|
732
797
|
type: 'trigger';
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
handleRequest?: SlateTriggerWebhookRequestHandler<ConfigType, AuthType, InputType>;
|
|
737
|
-
http?: SlateWebhookHttpOptions;
|
|
738
|
-
pollEvents?: SlateTriggerPollingHandler<ConfigType, AuthType, InputType>;
|
|
739
|
-
autoRegisterWebhook?: SlateTriggerWebhookAutoRegistrationHandler<ConfigType, AuthType>;
|
|
740
|
-
autoUnregisterWebhook?: SlateTriggerWebhookAutoUnregistrationHandler<ConfigType, AuthType>;
|
|
798
|
+
triggerGroup: SlateTriggerGroup<ConfigType, AuthType>;
|
|
799
|
+
matches: SlateTriggerMatchesHandler;
|
|
800
|
+
map: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
|
|
741
801
|
}
|
|
742
802
|
declare class SlateTrigger<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {
|
|
743
803
|
type: string;
|
|
744
804
|
}> extends SlateAction<'trigger', ConfigType, AuthType, InputType, OutputType> {
|
|
745
805
|
#private;
|
|
746
806
|
private constructor();
|
|
747
|
-
static create<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters): SlateActionBuilder<"trigger", ConfigType, AuthType, {}, {}, SlateTrigger<
|
|
748
|
-
get
|
|
749
|
-
get
|
|
750
|
-
get
|
|
751
|
-
get handleRequest(): SlateTriggerWebhookRequestHandler<ConfigType, AuthType, InputType> | undefined;
|
|
752
|
-
get http(): SlateWebhookHttpOptions | undefined;
|
|
753
|
-
get pollEvents(): SlateTriggerPollingHandler<ConfigType, AuthType, InputType> | undefined;
|
|
754
|
-
get autoRegisterWebhook(): SlateTriggerWebhookAutoRegistrationHandler<ConfigType, AuthType> | undefined;
|
|
755
|
-
get autoUnregisterWebhook(): SlateTriggerWebhookAutoUnregistrationHandler<ConfigType, AuthType> | undefined;
|
|
807
|
+
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>;
|
|
809
|
+
get matches(): SlateTriggerMatchesHandler;
|
|
810
|
+
get map(): SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
|
|
756
811
|
}
|
|
757
|
-
declare let trigger: <ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters) => SlateActionBuilder<"trigger", ConfigType, AuthType, {}, {}, SlateTrigger<
|
|
812
|
+
declare let trigger: <ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters) => SlateActionBuilder<"trigger", ConfigType, AuthType, {}, {}, SlateTrigger<any, any, any, any>, false>;
|
|
758
813
|
|
|
759
814
|
interface SlateAdapterCapability {
|
|
760
815
|
id: string;
|
|
@@ -779,7 +834,7 @@ declare class SlateAdapterSpec {
|
|
|
779
834
|
};
|
|
780
835
|
tool<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters): SlateActionBuilder<"tool", ConfigType, AuthType, {}, {}, SlateTool<ConfigType, AuthType, any, any>, false>;
|
|
781
836
|
publicTool<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters): SlateActionBuilder<"tool", ConfigType, AuthType, {}, {}, SlateTool<ConfigType, AuthType, any, any>, true>;
|
|
782
|
-
trigger<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters): SlateActionBuilder<"trigger", ConfigType, AuthType, {}, {}, SlateTrigger<
|
|
837
|
+
trigger<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters): SlateActionBuilder<"trigger", ConfigType, AuthType, {}, {}, SlateTrigger<any, any, any, any>, false>;
|
|
783
838
|
register<ConfigType extends {}, AuthType extends {}>(params: {
|
|
784
839
|
tools: SlateTool<ConfigType, AuthType, any, any>[];
|
|
785
840
|
triggers: SlateTrigger<ConfigType, AuthType, any, any>[];
|
|
@@ -981,22 +1036,25 @@ declare class Slate<ConfigType extends {}, AuthType extends {}> {
|
|
|
981
1036
|
private readonly _spec;
|
|
982
1037
|
private readonly _actions;
|
|
983
1038
|
private readonly _adapters;
|
|
1039
|
+
private readonly _triggerGroups;
|
|
984
1040
|
private constructor();
|
|
985
1041
|
static create<ConfigType extends {}, AuthType extends {}>(params: {
|
|
986
1042
|
spec: SlateSpecification<ConfigType, AuthType>;
|
|
987
1043
|
triggers: SlateTrigger<ConfigType, AuthType, any, any>[];
|
|
988
1044
|
tools: SlateTool<ConfigType, AuthType, any, any>[];
|
|
989
1045
|
adapters?: SlateAdapter<ConfigType, AuthType>[];
|
|
1046
|
+
triggerGroups?: SlateTriggerGroup<ConfigType, AuthType>[];
|
|
990
1047
|
}): Slate<ConfigType, AuthType>;
|
|
991
1048
|
get spec(): SlateSpecification<ConfigType, AuthType>;
|
|
992
1049
|
get actions(): (SlateTrigger<ConfigType, AuthType, any, any> | SlateTool<ConfigType, AuthType, any, any>)[];
|
|
993
1050
|
get adapters(): SlateAdapter<ConfigType, AuthType>[];
|
|
1051
|
+
get triggerGroups(): SlateTriggerGroup<ConfigType, AuthType>[];
|
|
994
1052
|
}
|
|
995
1053
|
|
|
996
1054
|
declare const graphWebhookHttp: {
|
|
997
|
-
methods:
|
|
1055
|
+
methods: string[];
|
|
998
1056
|
sync: {
|
|
999
|
-
mode:
|
|
1057
|
+
mode: string;
|
|
1000
1058
|
match: {
|
|
1001
1059
|
hasQueryParam: string;
|
|
1002
1060
|
}[];
|
|
@@ -1005,9 +1063,9 @@ declare const graphWebhookHttp: {
|
|
|
1005
1063
|
declare let getGraphWebhookValidationResponse: (request: Request) => SlateWebhookHttpResponseInit | null;
|
|
1006
1064
|
|
|
1007
1065
|
declare const metaWebhookHttp: {
|
|
1008
|
-
methods:
|
|
1066
|
+
methods: string[];
|
|
1009
1067
|
sync: {
|
|
1010
|
-
mode:
|
|
1068
|
+
mode: string;
|
|
1011
1069
|
match: {
|
|
1012
1070
|
method: string;
|
|
1013
1071
|
hasQueryParam: string;
|
|
@@ -1016,4 +1074,4 @@ declare const metaWebhookHttp: {
|
|
|
1016
1074
|
};
|
|
1017
1075
|
declare let getMetaWebhookVerificationResponse: (request: Request, expectedVerifyToken: string | undefined) => SlateWebhookHttpResponseInit | null;
|
|
1018
1076
|
|
|
1019
|
-
export { AUTH_CONFIG_SECRET_PLACEHOLDER_PREFIX, type ApiErrorBuildHelpers, type ApiErrorDetailOptions, type ApiErrorResponse, type ApiErrorStatus, type ApiServiceError, AuthConfigSecretRedactor, type BuildApiServiceErrorOptions, type CreateHmacSignatureOptions, GET_FILE_URL_TOOL_ID, type GetFileUrlHandler, type GetFileUrlToolInput, type GetFileUrlToolOutput, type NormalizeOAuthTokenResponseOptions, type OAuthExpiresAtOptions, type OAuthRefreshTokenFallbackMode, type OAuthTokenResponse, Slate, SlateAction, SlateActionBuilder, type SlateActionCreateParameters, type SlateActionDocsReference, type SlateActionParameters, type SlateActionParametersAny, type SlateActionParametersTool, type SlateActionParametersTrigger, type SlateActionScopeClause, type SlateActionScopeClauseInput, type SlateActionScopeValue, type SlateActionScopes, type SlateActionScopesInput, type SlateActionType, SlateAdapter, type SlateAdapterCapability, SlateAdapterSpec, type SlateAdapterSpecParameters, type SlateAddAttachmentContent, type SlateAddAttachmentInput, type SlateAttachment, type SlateAttachmentInlineContent, type SlateAttachmentUploadReferenceContent, type SlateAttachmentUrlContent, SlateAuth, type SlateAuthDocsReference, type SlateAuthType, type SlateAuthWithCustomData, type SlateAuthWithNone, type SlateAuthWithOauth, type SlateAuthWithServiceAccount, type SlateAuthWithToken, type SlateAuthenticatedAxiosDefaults, type SlateAxiosDefaults, type SlateAxiosErrorAdapter, type SlateAxiosErrorOptions, SlateConfig, type SlateConfigDocsReference, SlateContext, SlateDeclarationError, SlateDefaultPollingIntervalSeconds, type SlateDirectUploadInput, type SlateDocsReference, SlateError, type SlateErrorInput, type SlateErrorIssue, type SlateErrorKind, type SlateErrorProviderInfo, type SlateErrorResponse, type SlateErrorUpstreamInfo, type SlateLiveInvocationInfo, type SlateLogEntry, type SlateLogFields, type SlateLogListener, type SlateLogMessageInput, type SlateLogType, SlateLogger, type
|
|
1077
|
+
export { AUTH_CONFIG_SECRET_PLACEHOLDER_PREFIX, type ApiErrorBuildHelpers, type ApiErrorDetailOptions, type ApiErrorResponse, type ApiErrorStatus, type ApiServiceError, AuthConfigSecretRedactor, type BuildApiServiceErrorOptions, type CreateHmacSignatureOptions, GET_FILE_URL_TOOL_ID, type GetFileUrlHandler, type GetFileUrlToolInput, type GetFileUrlToolOutput, type NormalizeOAuthTokenResponseOptions, type OAuthExpiresAtOptions, type OAuthRefreshTokenFallbackMode, type OAuthTokenResponse, Slate, SlateAction, SlateActionBuilder, type SlateActionCreateParameters, type SlateActionDocsReference, type SlateActionParameters, type SlateActionParametersAny, type SlateActionParametersTool, type SlateActionParametersTrigger, type SlateActionScopeClause, type SlateActionScopeClauseInput, type SlateActionScopeValue, type SlateActionScopes, type SlateActionScopesInput, type SlateActionType, SlateAdapter, type SlateAdapterCapability, SlateAdapterSpec, type SlateAdapterSpecParameters, type SlateAddAttachmentContent, type SlateAddAttachmentInput, type SlateAttachment, type SlateAttachmentInlineContent, type SlateAttachmentUploadReferenceContent, type SlateAttachmentUrlContent, SlateAuth, type SlateAuthDocsReference, type SlateAuthType, type SlateAuthWithCustomData, type SlateAuthWithNone, type SlateAuthWithOauth, type SlateAuthWithServiceAccount, type SlateAuthWithToken, type SlateAuthenticatedAxiosDefaults, type SlateAxiosDefaults, type SlateAxiosErrorAdapter, type SlateAxiosErrorOptions, SlateConfig, type SlateConfigDocsReference, SlateContext, SlateDeclarationError, SlateDefaultPollingIntervalSeconds, type SlateDirectUploadInput, type SlateDocsReference, SlateError, type SlateErrorInput, type SlateErrorIssue, type SlateErrorKind, type SlateErrorProviderInfo, type SlateErrorResponse, type SlateErrorUpstreamInfo, type SlateLiveInvocationInfo, type SlateLogEntry, type SlateLogFields, type SlateLogListener, type SlateLogMessageInput, type SlateLogType, SlateLogger, type SlateProviderDocsReference, SlatePublicContext, SlatePublicTool, type SlatePublicToolInvocationHandler, type SlatePublicToolParameters, type SlateServiceErrorData, SlateSpecification, type SlateSpecificationCreateParameters, type SlateSpecificationParameters, SlateTool, type SlateToolInvocationHandler, type SlateToolParameters, SlateTrigger, SlateTriggerGroup, SlateTriggerGroupBuilder, type SlateTriggerGroupCreateParameters, type SlateTriggerGroupParameters, type SlateTriggerGroupPollHandler, type SlateTriggerGroupPollingParameters, type SlateTriggerGroupRoutingMatchersHandler, type SlateTriggerGroupWebhookAutoRegistrationParameters, type SlateTriggerGroupWebhookManualRegistrationParameters, type SlateTriggerGroupWebhookParameters, type SlateTriggerMappingHandler, type SlateTriggerMatchesHandler, type SlateTriggerParameters, type SlateTriggerRoutingMatcher, type SlateTypedDocsReference, type SlateWebhookHttpResponseInit, type SlateWebhookManualFinishHandler, type SlateWebhookManualSetupHandler, type SlateWebhookProcessHandler, type SlateWebhookRegisterHandler, type SlateWebhookTarget, type SlateWebhookTargetListHandler, type SlateWebhookTargetOwnership, type SlateWebhookUnregisterHandler, type VerifyHmacSignatureOptions, adapterSpec, allOf, anyOf, auth, axios, buildApiServiceError, collectApiErrorDetails, config, createApiServiceError, createAuthenticatedAxios, createAxios, createBase64Attachment, createHmacSignature, createSlateError, createTextAttachment, createUrlAttachment, extractApiErrorMessage, getApiErrorResponse, getApiErrorStatus, getBase64ByteLength, getCurrentContext, getFileUrlTool, getFileUrlToolInputSchema, getFileUrlToolOutputSchema, getGraphWebhookValidationResponse, getMetaWebhookVerificationResponse, getOAuthExpiresAtFromExpiresIn, getResponseHeaderValue, getServiceErrorData, graphWebhookHttp, inferSlateErrorFromAxios, isApiErrorRecord, isAxiosErrorLike, isServiceErrorData, mapServiceErrorCode, mapServiceErrorToSlateErrorInput, mergeScopes, metaWebhookHttp, normalizeOAuthTokenResponse, pickDefined, publicTool, redactUrlAttachmentSecrets, requestAxios, requestAxiosData, runWithContext, scopeClause, setIfDefined, spec, statusLabelForApiError, tool, trigger, triggerGroup, uploadAttachmentDirect, validateScopes, verifyHmacSignature };
|