@slates/provider 1.0.0-rc.33 → 1.0.0-rc.35
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 +289 -19
- package/dist/index.d.cts +168 -2
- package/dist/index.d.ts +168 -2
- package/dist/index.module.js +279 -19
- package/package.json +1 -1
- package/src/action/action.ts +1 -0
- package/src/action/builder.ts +73 -1
- package/src/action/index.ts +1 -0
- package/src/action/optionList.ts +94 -0
- package/src/action/trigger.test.ts +132 -0
- package/src/action/trigger.ts +7 -0
- package/src/action/triggerGroup.test.ts +172 -0
- package/src/action/triggerGroup.ts +248 -5
- package/src/crypto/hmac.test.ts +17 -1
- package/src/crypto/hmac.ts +11 -6
- package/src/dedup/index.test.ts +47 -0
- package/src/dedup/index.ts +25 -0
- package/src/error/api.test.ts +22 -0
- package/src/error/api.ts +8 -0
- package/src/error/index.ts +1 -0
- package/src/error/parse.test.ts +29 -0
- package/src/error/parse.ts +14 -0
- package/src/index.ts +2 -0
- package/src/pagination/index.test.ts +21 -0
- package/src/pagination/index.ts +15 -0
- package/src/specification/slate.test.ts +123 -3
- package/src/specification/slate.ts +33 -7
package/dist/index.d.cts
CHANGED
|
@@ -535,8 +535,43 @@ declare let runWithContext: <InputType extends {}, RV>(context: SlatePublicConte
|
|
|
535
535
|
declare let getCurrentContext: <ConfigType extends {}, AuthType extends {}, InputType extends {}>() => SlateContext<ConfigType, AuthType, InputType>;
|
|
536
536
|
declare let getRuntimeInfo: () => Readonly<SlateRuntimeInfo> | null;
|
|
537
537
|
|
|
538
|
+
interface SlateOption {
|
|
539
|
+
value: string | number;
|
|
540
|
+
label: string;
|
|
541
|
+
description?: string;
|
|
542
|
+
}
|
|
543
|
+
interface SlateOptionListPage {
|
|
544
|
+
options: SlateOption[];
|
|
545
|
+
nextPageToken?: any | null;
|
|
546
|
+
}
|
|
547
|
+
type SlateOptionListHandler<ConfigType extends {}, AuthType extends {}, ParamsType extends {} = {}> = (context: SlateContext<ConfigType, AuthType, {
|
|
548
|
+
query: string | null;
|
|
549
|
+
pageToken: any | null;
|
|
550
|
+
params: ParamsType;
|
|
551
|
+
}>) => Promise<SlateOptionListPage>;
|
|
552
|
+
interface SlateOptionListParameters<ConfigType extends {}, AuthType extends {}, ParamsSchema extends z$1.ZodObject<any> = z$1.ZodObject<{}>> {
|
|
553
|
+
key: string;
|
|
554
|
+
/** Made strict when declared, so params with a key the schema does not name are rejected. */
|
|
555
|
+
paramsSchema?: ParamsSchema;
|
|
556
|
+
list: SlateOptionListHandler<ConfigType, AuthType, z$1.output<ParamsSchema>>;
|
|
557
|
+
}
|
|
558
|
+
/** A list of options other integrations can link their selection fields to. */
|
|
559
|
+
declare class SlateOptionList<ConfigType extends {}, AuthType extends {}, ParamsSchema extends z$1.ZodObject<any> = z$1.ZodObject<{}>> {
|
|
560
|
+
private readonly _spec;
|
|
561
|
+
private readonly _params;
|
|
562
|
+
private readonly _paramsSchema;
|
|
563
|
+
private constructor();
|
|
564
|
+
static create<ConfigType extends {}, AuthType extends {}, ParamsSchema extends z$1.ZodObject<any> = z$1.ZodObject<{}>>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateOptionListParameters<ConfigType, AuthType, ParamsSchema>): SlateOptionList<ConfigType, AuthType, ParamsSchema>;
|
|
565
|
+
get spec(): SlateSpecification<ConfigType, AuthType>;
|
|
566
|
+
get key(): string;
|
|
567
|
+
get paramsSchema(): z$1.ZodObject<any, z$1.core.$strip>;
|
|
568
|
+
get list(): SlateOptionListHandler<ConfigType, AuthType, z$1.core.output<ParamsSchema>>;
|
|
569
|
+
}
|
|
570
|
+
declare let optionList: <ConfigType extends {}, AuthType extends {}, ParamsSchema extends z$1.ZodObject<any> = z$1.ZodObject<{}>>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateOptionListParameters<ConfigType, AuthType, ParamsSchema>) => SlateOptionList<ConfigType, AuthType, ParamsSchema>;
|
|
571
|
+
|
|
538
572
|
declare let SlateDefaultPollingIntervalSeconds: number;
|
|
539
573
|
type SlateTriggerRoutingMatcher = Record<string, any>;
|
|
574
|
+
type SlateTriggerGroupSelection = Record<string, any>;
|
|
540
575
|
type SlateWebhookTargetOwnership = 'single_user' | 'multi_user';
|
|
541
576
|
interface SlateWebhookTarget {
|
|
542
577
|
webhookTargetIdentifier: string;
|
|
@@ -547,8 +582,26 @@ interface SlateWebhookTarget {
|
|
|
547
582
|
targetOwnership: SlateWebhookTargetOwnership;
|
|
548
583
|
}
|
|
549
584
|
type SlateTriggerGroupRoutingMatchersHandler<ConfigType extends {}, AuthType extends {}> = (context: SlateContext<ConfigType, AuthType, {}>) => Promise<SlateTriggerRoutingMatcher[]>;
|
|
585
|
+
/** Lists the values an account can pick for one selection field. `selection` holds what is entered so far and may be incomplete. */
|
|
586
|
+
type SlateTriggerGroupSelectionOptionsHandler<ConfigType extends {}, AuthType extends {}> = (context: SlateContext<ConfigType, AuthType, {
|
|
587
|
+
query: string | null;
|
|
588
|
+
pageToken: any | null;
|
|
589
|
+
selection: SlateTriggerGroupSelection;
|
|
590
|
+
}>) => Promise<SlateOptionListPage>;
|
|
591
|
+
/** An option list exported by another integration, run with that integration's connection for the same account. */
|
|
592
|
+
interface SlateLinkedOptionList {
|
|
593
|
+
/** Registry name of the integration, as `<scope>/<name>`. */
|
|
594
|
+
slate: string;
|
|
595
|
+
optionList: string;
|
|
596
|
+
params?: Record<string, any>;
|
|
597
|
+
}
|
|
598
|
+
interface SlateTriggerGroupSelectionOptionsSources<ConfigType extends {}, AuthType extends {}> {
|
|
599
|
+
list?: SlateTriggerGroupSelectionOptionsHandler<ConfigType, AuthType>;
|
|
600
|
+
linked?: SlateLinkedOptionList;
|
|
601
|
+
}
|
|
550
602
|
type SlateTriggerGroupPollHandler<ConfigType extends {}, AuthType extends {}> = (context: SlateContext<ConfigType, AuthType, {
|
|
551
603
|
state: any | null;
|
|
604
|
+
selection?: SlateTriggerGroupSelection;
|
|
552
605
|
}>) => Promise<{
|
|
553
606
|
events: {
|
|
554
607
|
payload: any;
|
|
@@ -593,6 +646,7 @@ type SlateTriggerGroupGatewayReceiveHandler<ConfigType extends {}, AuthType exte
|
|
|
593
646
|
}>;
|
|
594
647
|
type SlateWebhookTargetListHandler<ConfigType extends {}, AuthType extends {}> = (context: SlateContext<ConfigType, AuthType, {
|
|
595
648
|
pageToken: any | null;
|
|
649
|
+
selection?: SlateTriggerGroupSelection;
|
|
596
650
|
}>) => Promise<{
|
|
597
651
|
targets: SlateWebhookTarget[];
|
|
598
652
|
nextPageToken: any | null;
|
|
@@ -602,9 +656,40 @@ type SlateWebhookRegisterHandler<ConfigType extends {}, AuthType extends {}> = (
|
|
|
602
656
|
webhookTargetIdentifier: string;
|
|
603
657
|
webhookTargetPayload: any;
|
|
604
658
|
webhookUrl: string;
|
|
605
|
-
|
|
659
|
+
operationId?: string;
|
|
660
|
+
selection?: SlateTriggerGroupSelection;
|
|
661
|
+
deliveryConfig?: unknown;
|
|
662
|
+
}>) => Promise<SlateWebhookRegistrationResult>;
|
|
663
|
+
interface SlateWebhookRegistrationResult {
|
|
664
|
+
webhookRegistrationIdentifier: string;
|
|
665
|
+
webhookRegistrationPayload: any;
|
|
666
|
+
expiresAt?: string | null;
|
|
667
|
+
renewAfter?: string | null;
|
|
668
|
+
/** Identities of this registration on a delivery channel shared with other registrations. */
|
|
669
|
+
routingKeys?: string[];
|
|
670
|
+
}
|
|
671
|
+
type SlateWebhookRenewHandler<ConfigType extends {}, AuthType extends {}> = (context: SlateContext<ConfigType, AuthType, {
|
|
606
672
|
webhookRegistrationIdentifier: string;
|
|
607
673
|
webhookRegistrationPayload: any;
|
|
674
|
+
webhookUrl: string;
|
|
675
|
+
webhookTargetIdentifier: string;
|
|
676
|
+
webhookTargetPayload: any;
|
|
677
|
+
operationId: string;
|
|
678
|
+
selection?: SlateTriggerGroupSelection;
|
|
679
|
+
deliveryConfig?: unknown;
|
|
680
|
+
}>) => Promise<SlateWebhookRegistrationResult>;
|
|
681
|
+
type SlateWebhookExpandHandler<ConfigType extends {}, AuthType extends {}> = (context: SlateContext<ConfigType, AuthType, {
|
|
682
|
+
payload: unknown | null;
|
|
683
|
+
state: any | null;
|
|
684
|
+
selection?: SlateTriggerGroupSelection;
|
|
685
|
+
deliveryId: string;
|
|
686
|
+
webhookRegistrationPayload: any;
|
|
687
|
+
}>) => Promise<{
|
|
688
|
+
events: {
|
|
689
|
+
payload: any;
|
|
690
|
+
idempotencyKey?: string;
|
|
691
|
+
}[];
|
|
692
|
+
updatedState?: any;
|
|
608
693
|
}>;
|
|
609
694
|
type SlateWebhookUnregisterHandler<ConfigType extends {}, AuthType extends {}> = (context: SlateContext<ConfigType, AuthType, {
|
|
610
695
|
webhookRegistrationIdentifier: string;
|
|
@@ -638,6 +723,23 @@ type SlateWebhookProcessHandler = (context: SlateContext<{}, {}, {
|
|
|
638
723
|
interface SlateWebhookSkipped {
|
|
639
724
|
reason: string;
|
|
640
725
|
}
|
|
726
|
+
/**
|
|
727
|
+
* Routing keys name the registrations a request addresses; an empty list acknowledges it
|
|
728
|
+
* without handing it to any. A rejection answers the sender with its status.
|
|
729
|
+
*/
|
|
730
|
+
type SlateWebhookDeliveryAuthentication = {
|
|
731
|
+
routingKeys: string[];
|
|
732
|
+
rejected?: undefined;
|
|
733
|
+
} | {
|
|
734
|
+
rejected: {
|
|
735
|
+
status: number;
|
|
736
|
+
};
|
|
737
|
+
routingKeys?: undefined;
|
|
738
|
+
};
|
|
739
|
+
type SlateWebhookDeliveryAuthenticateHandler = (context: SlateContext<{}, {}, {
|
|
740
|
+
request: Request;
|
|
741
|
+
deliveryConfig: unknown;
|
|
742
|
+
}>) => Promise<SlateWebhookDeliveryAuthentication>;
|
|
641
743
|
interface SlateTriggerGroupPollingParameters<ConfigType extends {}, AuthType extends {}> {
|
|
642
744
|
intervalSeconds: number;
|
|
643
745
|
pollEvents: SlateTriggerGroupPollHandler<ConfigType, AuthType>;
|
|
@@ -649,6 +751,7 @@ interface SlateTriggerGroupGatewayParameters<ConfigType extends {}, AuthType ext
|
|
|
649
751
|
interface SlateTriggerGroupWebhookAutoRegistrationParameters<ConfigType extends {}, AuthType extends {}> {
|
|
650
752
|
webhookTargetList: SlateWebhookTargetListHandler<ConfigType, AuthType>;
|
|
651
753
|
webhookRegister: SlateWebhookRegisterHandler<ConfigType, AuthType>;
|
|
754
|
+
webhookRenew?: SlateWebhookRenewHandler<ConfigType, AuthType>;
|
|
652
755
|
webhookUnregister: SlateWebhookUnregisterHandler<ConfigType, AuthType>;
|
|
653
756
|
}
|
|
654
757
|
interface SlateTriggerGroupWebhookManualRegistrationParameters<UserConfigSchema extends z$1.ZodType<any> = z$1.ZodType<any>, FullConfigSchema extends z$1.ZodType<any> = z$1.ZodType<any>> {
|
|
@@ -657,10 +760,18 @@ interface SlateTriggerGroupWebhookManualRegistrationParameters<UserConfigSchema
|
|
|
657
760
|
setup: SlateWebhookManualSetupHandler<FullConfigSchema>;
|
|
658
761
|
finish?: SlateWebhookManualFinishHandler<UserConfigSchema, FullConfigSchema>;
|
|
659
762
|
}
|
|
763
|
+
/** A delivery setup a person completes once for an automatically registered group. */
|
|
764
|
+
type SlateTriggerGroupWebhookDeliveryConfigParameters<UserConfigSchema extends z$1.ZodType<any> = z$1.ZodType<any>, FullConfigSchema extends z$1.ZodType<any> = z$1.ZodType<any>> = SlateTriggerGroupWebhookManualRegistrationParameters<UserConfigSchema, FullConfigSchema> & {
|
|
765
|
+
finish: SlateWebhookManualFinishHandler<UserConfigSchema, FullConfigSchema>;
|
|
766
|
+
authenticate: SlateWebhookDeliveryAuthenticateHandler;
|
|
767
|
+
};
|
|
660
768
|
interface SlateTriggerGroupWebhookParameters<ConfigType extends {}, AuthType extends {}> {
|
|
661
769
|
autoRegistration?: SlateTriggerGroupWebhookAutoRegistrationParameters<ConfigType, AuthType>;
|
|
662
770
|
manualRegistration?: SlateTriggerGroupWebhookManualRegistrationParameters<any, any>;
|
|
771
|
+
deliveryConfig?: SlateTriggerGroupWebhookDeliveryConfigParameters<any, any>;
|
|
663
772
|
process: SlateWebhookProcessHandler;
|
|
773
|
+
expandWebhook?: SlateWebhookExpandHandler<ConfigType, AuthType>;
|
|
774
|
+
reconcileIntervalSeconds?: number;
|
|
664
775
|
}
|
|
665
776
|
interface SlateTriggerGroupCreateParameters<InputType extends {} = Record<string, unknown>> {
|
|
666
777
|
key: string;
|
|
@@ -668,6 +779,7 @@ interface SlateTriggerGroupCreateParameters<InputType extends {} = Record<string
|
|
|
668
779
|
description?: string;
|
|
669
780
|
metadata?: Record<string, any>;
|
|
670
781
|
eventSchema?: z$1.ZodType<InputType>;
|
|
782
|
+
selectionSchema?: z$1.ZodType<SlateTriggerGroupSelection>;
|
|
671
783
|
}
|
|
672
784
|
interface SlateTriggerGroupParameters<ConfigType extends {}, AuthType extends {}, InputType extends {} = Record<string, unknown>> extends SlateTriggerGroupCreateParameters<InputType> {
|
|
673
785
|
source: 'polling' | 'webhook' | 'gateway';
|
|
@@ -675,6 +787,7 @@ interface SlateTriggerGroupParameters<ConfigType extends {}, AuthType extends {}
|
|
|
675
787
|
webhook?: SlateTriggerGroupWebhookParameters<ConfigType, AuthType>;
|
|
676
788
|
gateway?: SlateTriggerGroupGatewayParameters<ConfigType, AuthType>;
|
|
677
789
|
routingMatchers: SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType>;
|
|
790
|
+
selectionOptions?: Record<string, SlateTriggerGroupSelectionOptionsSources<ConfigType, AuthType>>;
|
|
678
791
|
}
|
|
679
792
|
declare class SlateTriggerGroup<ConfigType extends {}, AuthType extends {}, InputType extends {} = Record<string, unknown>> {
|
|
680
793
|
private readonly _spec;
|
|
@@ -688,10 +801,12 @@ declare class SlateTriggerGroup<ConfigType extends {}, AuthType extends {}, Inpu
|
|
|
688
801
|
get metadata(): Record<string, any> | undefined;
|
|
689
802
|
get eventSchema(): z$1.ZodType<InputType, unknown, z$1.core.$ZodTypeInternals<InputType, unknown>>;
|
|
690
803
|
get source(): "polling" | "webhook" | "gateway";
|
|
804
|
+
get selectionSchema(): z$1.ZodType<SlateTriggerGroupSelection, unknown, z$1.core.$ZodTypeInternals<SlateTriggerGroupSelection, unknown>> | undefined;
|
|
691
805
|
get polling(): SlateTriggerGroupPollingParameters<ConfigType, AuthType> | undefined;
|
|
692
806
|
get webhook(): SlateTriggerGroupWebhookParameters<ConfigType, AuthType> | undefined;
|
|
693
807
|
get gateway(): SlateTriggerGroupGatewayParameters<ConfigType, AuthType> | undefined;
|
|
694
808
|
get routingMatchers(): SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType>;
|
|
809
|
+
get selectionOptions(): Record<string, SlateTriggerGroupSelectionOptionsSources<ConfigType, AuthType>>;
|
|
695
810
|
}
|
|
696
811
|
declare class SlateTriggerGroupBuilder<ConfigType extends {}, AuthType extends {}, InputType extends {} = Record<string, unknown>> {
|
|
697
812
|
#private;
|
|
@@ -706,11 +821,20 @@ declare class SlateTriggerGroupBuilder<ConfigType extends {}, AuthType extends {
|
|
|
706
821
|
webhook<UserConfigSchema extends z$1.ZodType<any> = z$1.ZodType<any>, FullConfigSchema extends z$1.ZodType<any> = z$1.ZodType<any>>(props: {
|
|
707
822
|
autoRegistration?: SlateTriggerGroupWebhookAutoRegistrationParameters<ConfigType, AuthType>;
|
|
708
823
|
manualRegistration?: SlateTriggerGroupWebhookManualRegistrationParameters<UserConfigSchema, FullConfigSchema>;
|
|
824
|
+
deliveryConfig?: SlateTriggerGroupWebhookDeliveryConfigParameters<UserConfigSchema, FullConfigSchema>;
|
|
709
825
|
process: SlateWebhookProcessHandler;
|
|
826
|
+
expandWebhook?: SlateWebhookExpandHandler<ConfigType, AuthType>;
|
|
827
|
+
reconcileIntervalSeconds?: number;
|
|
710
828
|
}): SlateTriggerGroupBuilder<ConfigType, AuthType, InputType>;
|
|
711
829
|
/** Receive events over a platform-managed persistent connection (e.g. a WebSocket gateway). */
|
|
712
830
|
gateway(props: SlateTriggerGroupGatewayParameters<ConfigType, AuthType>): SlateTriggerGroupBuilder<ConfigType, AuthType, InputType>;
|
|
713
831
|
routingMatchers(handler: SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType>): SlateTriggerGroupBuilder<ConfigType, AuthType, InputType>;
|
|
832
|
+
/**
|
|
833
|
+
* Lets the dashboard offer a list for these selection fields instead of a typed-in value.
|
|
834
|
+
* Each field must be a top-level property of the selection schema, which must be a zod object.
|
|
835
|
+
* For an array property the listed options are values for its items.
|
|
836
|
+
*/
|
|
837
|
+
selectionOptions(declarations: Record<string, SlateTriggerGroupSelectionOptionsSources<ConfigType, AuthType>>): SlateTriggerGroupBuilder<ConfigType, AuthType, InputType>;
|
|
714
838
|
build(): SlateTriggerGroup<ConfigType, AuthType, InputType>;
|
|
715
839
|
}
|
|
716
840
|
declare let triggerGroup: <ConfigType extends {}, AuthType extends {}, InputType extends {} = Record<string, unknown>>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateTriggerGroupCreateParameters<InputType>) => SlateTriggerGroupBuilder<ConfigType, AuthType, InputType>;
|
|
@@ -770,6 +894,7 @@ interface SlateActionParametersTrigger<ConfigType extends {}, AuthType extends {
|
|
|
770
894
|
triggerGroup: SlateTriggerGroup<ConfigType, AuthType>;
|
|
771
895
|
matches: SlateTriggerMatchesHandler;
|
|
772
896
|
map: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
|
|
897
|
+
eventAttributes?: string[];
|
|
773
898
|
}
|
|
774
899
|
type SlateActionParametersAny<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> = SlateActionParametersTool<ConfigType, AuthType, InputType, OutputType> | SlateActionParametersTrigger<ConfigType, AuthType, InputType, OutputType>;
|
|
775
900
|
type SlateActionCreateParameters<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> = SlateActionParametersAny<ConfigType, AuthType, InputType, OutputType> & SlateActionParameters & {
|
|
@@ -825,6 +950,11 @@ declare class SlateActionBuilder<Type extends SlateActionType, ConfigType extend
|
|
|
825
950
|
triggerGroup(group: SlateTriggerGroup<ConfigType, AuthType>): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
|
|
826
951
|
matches(handler: SlateTriggerMatchesHandler): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
|
|
827
952
|
map(handler: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
|
|
953
|
+
/**
|
|
954
|
+
* Returns the values of these top-level output fields with every mapped event, so events
|
|
955
|
+
* can be filtered by them. Strings, finite numbers, booleans and arrays of those are used.
|
|
956
|
+
*/
|
|
957
|
+
eventAttributes(fields: (keyof OutputType & string)[]): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
|
|
828
958
|
build(): Result;
|
|
829
959
|
}
|
|
830
960
|
|
|
@@ -905,6 +1035,7 @@ interface SlateTriggerParameters<ConfigType extends {}, AuthType extends {}, Inp
|
|
|
905
1035
|
triggerGroup: SlateTriggerGroup<ConfigType, AuthType>;
|
|
906
1036
|
matches: SlateTriggerMatchesHandler;
|
|
907
1037
|
map: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
|
|
1038
|
+
eventAttributes?: string[];
|
|
908
1039
|
}
|
|
909
1040
|
declare class SlateTrigger<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {
|
|
910
1041
|
type: string;
|
|
@@ -915,6 +1046,7 @@ declare class SlateTrigger<ConfigType extends {}, AuthType extends {}, InputType
|
|
|
915
1046
|
get triggerGroup(): SlateTriggerGroup<ConfigType, AuthType, Record<string, unknown>>;
|
|
916
1047
|
get matches(): SlateTriggerMatchesHandler;
|
|
917
1048
|
get map(): SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
|
|
1049
|
+
get eventAttributes(): string[];
|
|
918
1050
|
}
|
|
919
1051
|
declare let trigger: <ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters) => SlateActionBuilder<"trigger", ConfigType, AuthType, {}, {}, SlateTrigger<any, any, any, any>, false>;
|
|
920
1052
|
|
|
@@ -1009,6 +1141,8 @@ declare let isApiErrorRecord: (value: unknown) => value is Record<string, unknow
|
|
|
1009
1141
|
declare let collectApiErrorDetails: (value: unknown, details: string[], options?: ApiErrorDetailOptions) => void;
|
|
1010
1142
|
declare let getApiErrorResponse: (error: unknown) => ApiErrorResponse | undefined;
|
|
1011
1143
|
declare let getApiErrorStatus: (error: unknown) => ApiErrorStatus | undefined;
|
|
1144
|
+
/** Upstream HTTP status of an HTTP client error or a ServiceError with `upstreamStatus`. */
|
|
1145
|
+
declare let getUpstreamErrorStatus: (error: unknown) => number | undefined;
|
|
1012
1146
|
declare let getApiErrorResponseWithBody: (error: unknown) => ApiErrorResponse | undefined;
|
|
1013
1147
|
declare let API_ERROR_MAX_DETAILS: number;
|
|
1014
1148
|
declare let API_ERROR_MAX_MESSAGE_LENGTH: number;
|
|
@@ -1118,6 +1252,11 @@ declare class SlateDeclarationError extends SlateError {
|
|
|
1118
1252
|
static is(error: unknown): error is SlateDeclarationError;
|
|
1119
1253
|
}
|
|
1120
1254
|
|
|
1255
|
+
/** Parses a saved or received value, throwing a user-facing `ServiceError` on mismatch. */
|
|
1256
|
+
declare let parseWithServiceError: <T extends z$1.ZodType>(schema: T, value: unknown, message: string, options?: {
|
|
1257
|
+
reason?: string;
|
|
1258
|
+
}) => z$1.output<T>;
|
|
1259
|
+
|
|
1121
1260
|
declare let mapServiceErrorCode: (code: string, status?: number) => string;
|
|
1122
1261
|
declare let isServiceErrorData: (value: unknown) => value is SlateServiceErrorData;
|
|
1123
1262
|
declare let getServiceErrorData: (error: unknown) => SlateServiceErrorData | null;
|
|
@@ -1152,14 +1291,38 @@ interface VerifyHmacSignatureOptions extends CreateHmacSignatureOptions {
|
|
|
1152
1291
|
signature: string;
|
|
1153
1292
|
}
|
|
1154
1293
|
declare let createHmacSignature: ({ secret, payload, algorithm, digest, prefix }: CreateHmacSignatureOptions) => string;
|
|
1294
|
+
/** Constant-time secret comparison; an empty expected secret matches nothing. */
|
|
1295
|
+
declare let timingSafeStringEqual: (expected: string, received: string | null | undefined) => boolean;
|
|
1155
1296
|
declare let verifyHmacSignature: (options: VerifyHmacSignatureOptions) => boolean;
|
|
1156
1297
|
|
|
1298
|
+
/** An event a poller already reported, saved so an overlapping read can skip it. */
|
|
1299
|
+
declare let seenEntrySchema: z$1.ZodObject<{
|
|
1300
|
+
key: z$1.ZodString;
|
|
1301
|
+
at: z$1.ZodNumber;
|
|
1302
|
+
}, z$1.core.$strip>;
|
|
1303
|
+
type SeenEntry = z$1.infer<typeof seenEntrySchema>;
|
|
1304
|
+
/** A short stable key for an idempotency key, so remembered events cost little state. */
|
|
1305
|
+
declare let seenEntryKey: (idempotencyKey: string) => string;
|
|
1306
|
+
/** Keeps entries at or after `cutoff` (or `retain`), newest first, at most `maxEntries`. */
|
|
1307
|
+
declare let pruneSeenEntries: (entries: Iterable<SeenEntry & {
|
|
1308
|
+
retain?: boolean;
|
|
1309
|
+
}>, options: {
|
|
1310
|
+
cutoff: number;
|
|
1311
|
+
maxEntries: number;
|
|
1312
|
+
onOverflow?: (dropped: number) => void;
|
|
1313
|
+
}) => SeenEntry[];
|
|
1314
|
+
|
|
1157
1315
|
declare let getResponseHeaderValue: (headers: unknown, name: string) => string | undefined;
|
|
1158
1316
|
declare let getBase64ByteLength: (contentBase64: string) => number;
|
|
1159
1317
|
|
|
1160
1318
|
declare let pickDefined: <T extends object>(value: T) => Partial<T> & Record<string, unknown>;
|
|
1161
1319
|
declare let setIfDefined: (target: Record<string, unknown>, key: string, value: unknown) => Record<string, unknown>;
|
|
1162
1320
|
|
|
1321
|
+
/** Records a page token in `seen`; `false` means it repeated and following it would loop. */
|
|
1322
|
+
declare let rememberPageToken: (seen: Set<string>, token: string) => boolean;
|
|
1323
|
+
/** Throws `repeated()` when a listing returns a page token it already returned. */
|
|
1324
|
+
declare let assertNewPageToken: (seen: Set<string>, token: string | null | undefined, repeated: () => unknown) => void;
|
|
1325
|
+
|
|
1163
1326
|
declare class Slate<ConfigType extends {}, AuthType extends {}> {
|
|
1164
1327
|
private readonly _spec;
|
|
1165
1328
|
private readonly _actions;
|
|
@@ -1167,6 +1330,7 @@ declare class Slate<ConfigType extends {}, AuthType extends {}> {
|
|
|
1167
1330
|
private readonly _triggerGroups;
|
|
1168
1331
|
private readonly _toolCategories;
|
|
1169
1332
|
private readonly _toolCategoryKeysByActionKey;
|
|
1333
|
+
private readonly _optionLists;
|
|
1170
1334
|
private constructor();
|
|
1171
1335
|
static create<ConfigType extends {}, AuthType extends {}>(params: {
|
|
1172
1336
|
spec: SlateSpecification<ConfigType, AuthType>;
|
|
@@ -1175,12 +1339,14 @@ declare class Slate<ConfigType extends {}, AuthType extends {}> {
|
|
|
1175
1339
|
adapters?: SlateAdapter<ConfigType, AuthType>[];
|
|
1176
1340
|
triggerGroups?: SlateTriggerGroup<ConfigType, AuthType>[];
|
|
1177
1341
|
toolCategories?: SlateToolCategory[];
|
|
1342
|
+
optionLists?: SlateOptionList<ConfigType, AuthType, any>[];
|
|
1178
1343
|
}): Slate<ConfigType, AuthType>;
|
|
1179
1344
|
get spec(): SlateSpecification<ConfigType, AuthType>;
|
|
1180
1345
|
get actions(): (SlateTrigger<ConfigType, AuthType, any, any> | SlateTool<ConfigType, AuthType, any, any>)[];
|
|
1181
1346
|
get adapters(): SlateAdapter<ConfigType, AuthType>[];
|
|
1182
1347
|
get triggerGroups(): SlateTriggerGroup<ConfigType, AuthType, Record<string, unknown>>[];
|
|
1183
1348
|
get toolCategories(): SlateToolCategory[];
|
|
1349
|
+
get optionLists(): SlateOptionList<ConfigType, AuthType, any>[];
|
|
1184
1350
|
getToolCategoryKeys(actionKey: string): string[];
|
|
1185
1351
|
}
|
|
1186
1352
|
|
|
@@ -1215,4 +1381,4 @@ declare let skipWebhook: (reason: string, response?: Response | SlateWebhookHttp
|
|
|
1215
1381
|
response: Response | SlateWebhookHttpResponseInit;
|
|
1216
1382
|
};
|
|
1217
1383
|
|
|
1218
|
-
export { API_ERROR_MAX_DETAILS, API_ERROR_MAX_MESSAGE_LENGTH, API_ERROR_TRUNCATED_PLACEHOLDER, AUTH_CONFIG_SECRET_PLACEHOLDER_PREFIX, type ApiErrorBuildHelpers, type ApiErrorDetailOptions, type ApiErrorResponse, type ApiErrorStatus, type ApiErrorTextOptions, type ApiServiceError, type AuthConfigSecretFilter, AuthConfigSecretRedactor, type BoundedApiErrorDetailOptions, type BuildApiServiceErrorOptions, type CreateHmacSignatureOptions, type DecodeApiErrorBodyOptions, 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 SlateGatewayEvent, type SlateLiveInvocationInfo, type SlateLogEntry, type SlateLogFields, type SlateLogListener, type SlateLogMessageInput, type SlateLogType, SlateLogger, type SlateProviderDocsReference, SlatePublicContext, SlatePublicTool, type SlatePublicToolInvocationHandler, type SlatePublicToolParameters, type SlateRuntimeInfo, type SlateServiceErrorData, SlateSpecification, type SlateSpecificationCreateParameters, type SlateSpecificationParameters, SlateTool, SlateToolCategory, type SlateToolCategoryParameters, type SlateToolInvocationHandler, type SlateToolParameters, SlateTrigger, SlateTriggerGroup, SlateTriggerGroupBuilder, type SlateTriggerGroupCreateParameters, type SlateTriggerGroupGatewayConnectHandler, type SlateTriggerGroupGatewayParameters, type SlateTriggerGroupGatewayReceiveHandler, 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 SlateWebhookSkipped, 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, decodeApiErrorBody, extractApiErrorMessage, getApiErrorResponse, getApiErrorResponseWithBody, getApiErrorStatus, getBase64ByteLength, getCurrentContext, getFileUrlTool, getFileUrlToolInputSchema, getFileUrlToolOutputSchema, getGraphWebhookValidationResponse, getMetaWebhookVerificationResponse, getOAuthExpiresAtFromExpiresIn, getResponseHeaderValue, getRuntimeInfo, getServiceErrorData, graphWebhookHttp, inferSlateErrorFromAxios, isApiErrorRecord, isAxiosErrorLike, isServiceErrorData, isUrlEmbeddedCredential, looksLikeHtmlErrorBody, mapServiceErrorCode, mapServiceErrorToSlateErrorInput, mergeScopes, metaWebhookHttp, normalizeOAuthTokenResponse, pickDefined, publicTool, pushBoundedApiErrorDetail, readApiErrorText, redactUrlAttachmentSecrets, requestAxios, requestAxiosData, runWithContext, scopeClause, setIfDefined, skipWebhook, spec, statusLabelForApiError, tool, toolCategory, trigger, triggerGroup, truncateApiErrorMessage, uploadAttachmentDirect, validateScopes, verifyHmacSignature };
|
|
1384
|
+
export { API_ERROR_MAX_DETAILS, API_ERROR_MAX_MESSAGE_LENGTH, API_ERROR_TRUNCATED_PLACEHOLDER, AUTH_CONFIG_SECRET_PLACEHOLDER_PREFIX, type ApiErrorBuildHelpers, type ApiErrorDetailOptions, type ApiErrorResponse, type ApiErrorStatus, type ApiErrorTextOptions, type ApiServiceError, type AuthConfigSecretFilter, AuthConfigSecretRedactor, type BoundedApiErrorDetailOptions, type BuildApiServiceErrorOptions, type CreateHmacSignatureOptions, type DecodeApiErrorBodyOptions, GET_FILE_URL_TOOL_ID, type GetFileUrlHandler, type GetFileUrlToolInput, type GetFileUrlToolOutput, type NormalizeOAuthTokenResponseOptions, type OAuthExpiresAtOptions, type OAuthRefreshTokenFallbackMode, type OAuthTokenResponse, type SeenEntry, 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 SlateGatewayEvent, type SlateLinkedOptionList, type SlateLiveInvocationInfo, type SlateLogEntry, type SlateLogFields, type SlateLogListener, type SlateLogMessageInput, type SlateLogType, SlateLogger, type SlateOption, SlateOptionList, type SlateOptionListHandler, type SlateOptionListPage, type SlateOptionListParameters, type SlateProviderDocsReference, SlatePublicContext, SlatePublicTool, type SlatePublicToolInvocationHandler, type SlatePublicToolParameters, type SlateRuntimeInfo, type SlateServiceErrorData, SlateSpecification, type SlateSpecificationCreateParameters, type SlateSpecificationParameters, SlateTool, SlateToolCategory, type SlateToolCategoryParameters, type SlateToolInvocationHandler, type SlateToolParameters, SlateTrigger, SlateTriggerGroup, SlateTriggerGroupBuilder, type SlateTriggerGroupCreateParameters, type SlateTriggerGroupGatewayConnectHandler, type SlateTriggerGroupGatewayParameters, type SlateTriggerGroupGatewayReceiveHandler, type SlateTriggerGroupParameters, type SlateTriggerGroupPollHandler, type SlateTriggerGroupPollingParameters, type SlateTriggerGroupRoutingMatchersHandler, type SlateTriggerGroupSelection, type SlateTriggerGroupSelectionOptionsHandler, type SlateTriggerGroupSelectionOptionsSources, type SlateTriggerGroupWebhookAutoRegistrationParameters, type SlateTriggerGroupWebhookDeliveryConfigParameters, type SlateTriggerGroupWebhookManualRegistrationParameters, type SlateTriggerGroupWebhookParameters, type SlateTriggerMappingHandler, type SlateTriggerMatchesHandler, type SlateTriggerParameters, type SlateTriggerRoutingMatcher, type SlateTypedDocsReference, type SlateWebhookDeliveryAuthenticateHandler, type SlateWebhookDeliveryAuthentication, type SlateWebhookExpandHandler, type SlateWebhookHttpResponseInit, type SlateWebhookManualFinishHandler, type SlateWebhookManualSetupHandler, type SlateWebhookProcessHandler, type SlateWebhookRegisterHandler, type SlateWebhookRegistrationResult, type SlateWebhookRenewHandler, type SlateWebhookSkipped, type SlateWebhookTarget, type SlateWebhookTargetListHandler, type SlateWebhookTargetOwnership, type SlateWebhookUnregisterHandler, type VerifyHmacSignatureOptions, adapterSpec, allOf, anyOf, assertNewPageToken, auth, axios, buildApiServiceError, collectApiErrorDetails, config, createApiServiceError, createAuthenticatedAxios, createAxios, createBase64Attachment, createHmacSignature, createSlateError, createTextAttachment, createUrlAttachment, decodeApiErrorBody, extractApiErrorMessage, getApiErrorResponse, getApiErrorResponseWithBody, getApiErrorStatus, getBase64ByteLength, getCurrentContext, getFileUrlTool, getFileUrlToolInputSchema, getFileUrlToolOutputSchema, getGraphWebhookValidationResponse, getMetaWebhookVerificationResponse, getOAuthExpiresAtFromExpiresIn, getResponseHeaderValue, getRuntimeInfo, getServiceErrorData, getUpstreamErrorStatus, graphWebhookHttp, inferSlateErrorFromAxios, isApiErrorRecord, isAxiosErrorLike, isServiceErrorData, isUrlEmbeddedCredential, looksLikeHtmlErrorBody, mapServiceErrorCode, mapServiceErrorToSlateErrorInput, mergeScopes, metaWebhookHttp, normalizeOAuthTokenResponse, optionList, parseWithServiceError, pickDefined, pruneSeenEntries, publicTool, pushBoundedApiErrorDetail, readApiErrorText, redactUrlAttachmentSecrets, rememberPageToken, requestAxios, requestAxiosData, runWithContext, scopeClause, seenEntryKey, seenEntrySchema, setIfDefined, skipWebhook, spec, statusLabelForApiError, timingSafeStringEqual, tool, toolCategory, trigger, triggerGroup, truncateApiErrorMessage, uploadAttachmentDirect, validateScopes, verifyHmacSignature };
|