@slates/provider 1.0.0-rc.17 → 1.0.0-rc.18
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 +244 -17
- package/dist/index.d.cts +108 -29
- package/dist/index.d.ts +108 -29
- package/dist/index.module.js +237 -17
- package/package.json +2 -2
- package/src/action/action.ts +19 -1
- package/src/action/builder.test.ts +136 -0
- package/src/action/builder.ts +68 -11
- package/src/action/index.ts +2 -1
- package/src/action/publicTool.ts +36 -0
- package/src/action/tool.ts +15 -3
- package/src/adapter/adapter.ts +38 -0
- package/src/adapter/index.test.ts +322 -0
- package/src/adapter/index.ts +2 -0
- package/src/adapter/spec.ts +154 -0
- package/src/axios/trace.ts +3 -3
- package/src/context/context.ts +31 -16
- package/src/context/hook.ts +5 -10
- package/src/index.ts +1 -0
- package/src/specification/slate.ts +38 -2
package/dist/index.d.cts
CHANGED
|
@@ -358,19 +358,17 @@ declare class SlateSpecification<ConfigType extends {}, AuthType extends {}> {
|
|
|
358
358
|
}
|
|
359
359
|
declare let spec: <ConfigType extends {}, AuthType extends {}>(params: SlateSpecificationCreateParameters<ConfigType, AuthType>) => SlateSpecification<ConfigType, AuthType>;
|
|
360
360
|
|
|
361
|
-
declare class
|
|
361
|
+
declare class SlatePublicContext<InputType extends {}> {
|
|
362
362
|
#private;
|
|
363
363
|
private readonly spec;
|
|
364
364
|
private readonly logger;
|
|
365
|
-
constructor(
|
|
366
|
-
get specification(): SlateSpecification<
|
|
367
|
-
get config(): Readonly<ConfigType>;
|
|
365
|
+
constructor(input: InputType, spec: SlateSpecification<any, any>, logger: SlateLogger);
|
|
366
|
+
get specification(): SlateSpecification<any, any>;
|
|
368
367
|
get input(): Readonly<InputType>;
|
|
369
368
|
get event(): Readonly<InputType>;
|
|
370
369
|
get state(): "state" extends keyof InputType ? InputType["state"] : never;
|
|
371
370
|
get request(): "request" extends keyof InputType ? InputType["request"] : never;
|
|
372
371
|
get registrationDetails(): "registrationDetails" extends keyof InputType ? InputType["registrationDetails"] : never;
|
|
373
|
-
get auth(): Readonly<AuthType>;
|
|
374
372
|
recordHttpTrace(trace: SlateHttpTrace): void;
|
|
375
373
|
getHttpTraces(): {
|
|
376
374
|
error?: {
|
|
@@ -397,8 +395,14 @@ declare class SlateContext<ConfigType extends {}, AuthType extends {}, InputType
|
|
|
397
395
|
error(message: SlateLogMessageInput): void;
|
|
398
396
|
progress(message: SlateLogMessageInput): void;
|
|
399
397
|
}
|
|
398
|
+
declare class SlateContext<ConfigType extends {}, AuthType extends {}, InputType extends {}> extends SlatePublicContext<InputType> {
|
|
399
|
+
#private;
|
|
400
|
+
constructor(config: ConfigType, input: InputType, auth: AuthType, spec: SlateSpecification<ConfigType, AuthType>, logger: SlateLogger);
|
|
401
|
+
get config(): Readonly<ConfigType>;
|
|
402
|
+
get auth(): Readonly<AuthType>;
|
|
403
|
+
}
|
|
400
404
|
|
|
401
|
-
declare let runWithContext: <
|
|
405
|
+
declare let runWithContext: <InputType extends {}, RV>(context: SlatePublicContext<InputType>, fn: () => Promise<RV>) => Promise<RV>;
|
|
402
406
|
declare let getCurrentContext: <ConfigType extends {}, AuthType extends {}, InputType extends {}>() => SlateContext<ConfigType, AuthType, InputType>;
|
|
403
407
|
|
|
404
408
|
interface SlateAttachmentUrlContent {
|
|
@@ -440,12 +444,19 @@ interface SlateActionParameters {
|
|
|
440
444
|
scopes?: SlateActionScopes;
|
|
441
445
|
authMethods?: string[];
|
|
442
446
|
docs?: SlateActionDocsReference[];
|
|
447
|
+
adapter?: string | null;
|
|
448
|
+
isPublic?: boolean;
|
|
443
449
|
}
|
|
444
450
|
type SlateToolInvocationHandler<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> = (context: SlateContext<ConfigType, AuthType, InputType>) => Promise<{
|
|
445
451
|
output: OutputType;
|
|
446
452
|
message: string;
|
|
447
453
|
attachments?: SlateAttachment[];
|
|
448
454
|
}>;
|
|
455
|
+
type SlatePublicToolInvocationHandler<InputType extends {}, OutputType extends {}> = (context: SlatePublicContext<InputType>) => Promise<{
|
|
456
|
+
output: OutputType;
|
|
457
|
+
message: string;
|
|
458
|
+
attachments?: SlateAttachment[];
|
|
459
|
+
}>;
|
|
449
460
|
type SlateTriggerMappingHandler<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> = (context: SlateContext<ConfigType, AuthType, InputType>) => Promise<{
|
|
450
461
|
type: string;
|
|
451
462
|
id: string;
|
|
@@ -554,36 +565,66 @@ declare abstract class SlateAction<Type extends SlateActionType, ConfigType exte
|
|
|
554
565
|
get scopes(): SlateActionScopes | undefined;
|
|
555
566
|
get authMethods(): string[] | undefined;
|
|
556
567
|
get docs(): SlateActionDocsReference[] | undefined;
|
|
568
|
+
get adapter(): string | null;
|
|
569
|
+
get isPublic(): boolean;
|
|
557
570
|
}
|
|
558
571
|
|
|
559
|
-
declare class SlateActionBuilder<Type extends SlateActionType, ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}, Result extends SlateAction<Type, ConfigType, AuthType, any, any
|
|
572
|
+
declare class SlateActionBuilder<Type extends SlateActionType, ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}, Result extends SlateAction<Type, ConfigType, AuthType, any, any>, IsPublic extends boolean = false> {
|
|
560
573
|
#private;
|
|
561
574
|
private readonly type;
|
|
562
575
|
readonly spec: SlateSpecification<ConfigType, AuthType>;
|
|
563
576
|
private readonly params;
|
|
564
577
|
private readonly factory;
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
578
|
+
private readonly isPublicTool;
|
|
579
|
+
constructor(type: Type, spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters, factory: (params: SlateActionCreateParameters<any, any, any, any>) => Result, isPublicTool?: IsPublic);
|
|
580
|
+
input<NewInputType extends {}>(schema: z.ZodType<NewInputType>): SlateActionBuilder<Type, ConfigType, AuthType, NewInputType, OutputType, Result, IsPublic>;
|
|
581
|
+
output<NewOutputType extends {}>(schema: z.ZodType<NewOutputType>): SlateActionBuilder<Type, ConfigType, AuthType, InputType, NewOutputType, Result, IsPublic>;
|
|
582
|
+
lockInterface(): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
|
|
583
|
+
scopes(scopes: SlateActionScopes): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
|
|
584
|
+
authMethods(authMethods: string[]): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
|
|
570
585
|
private validateAuthMethods;
|
|
571
|
-
handleInvocation(handler: SlateToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result>;
|
|
586
|
+
handleInvocation(handler: IsPublic extends true ? SlatePublicToolInvocationHandler<InputType, OutputType> : SlateToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
|
|
572
587
|
webhook(props: {
|
|
573
588
|
handleEvent: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
|
|
574
589
|
handleRequest: SlateTriggerWebhookRequestHandler<ConfigType, AuthType, InputType>;
|
|
575
590
|
autoRegisterWebhook?: SlateTriggerWebhookAutoRegistrationHandler<ConfigType, AuthType>;
|
|
576
591
|
autoUnregisterWebhook?: SlateTriggerWebhookAutoUnregistrationHandler<ConfigType, AuthType>;
|
|
577
592
|
http?: SlateWebhookHttpOptions;
|
|
578
|
-
}): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result>;
|
|
593
|
+
}): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
|
|
579
594
|
polling(props: {
|
|
580
595
|
options?: SlatePollingOptions;
|
|
581
596
|
pollEvents?: SlateTriggerPollingHandler<ConfigType, AuthType, InputType>;
|
|
582
597
|
handleEvent: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
|
|
583
|
-
}): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result>;
|
|
598
|
+
}): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
|
|
584
599
|
build(): Result;
|
|
585
600
|
}
|
|
586
601
|
|
|
602
|
+
interface SlateToolParameters<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> extends SlateActionParameters {
|
|
603
|
+
handleInvocation: SlateToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>;
|
|
604
|
+
}
|
|
605
|
+
declare class SlateTool<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> extends SlateAction<'tool', ConfigType, AuthType, InputType, OutputType> {
|
|
606
|
+
#private;
|
|
607
|
+
protected constructor(spec: SlateSpecification<ConfigType, AuthType>, inputSchema: z.ZodType<InputType>, outputSchema: z.ZodType<OutputType>, params: SlateToolParameters<ConfigType, AuthType, InputType, OutputType>);
|
|
608
|
+
static create<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters): SlateActionBuilder<"tool", ConfigType, AuthType, {}, {}, SlateTool<ConfigType, AuthType, any, any>, false>;
|
|
609
|
+
static fromCreateParameters<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: {
|
|
610
|
+
type: string;
|
|
611
|
+
inputSchema: z.ZodType<any>;
|
|
612
|
+
outputSchema: z.ZodType<any>;
|
|
613
|
+
handleInvocation?: SlateToolInvocationHandler<ConfigType, AuthType, any, any>;
|
|
614
|
+
} & SlateActionParameters): SlateTool<ConfigType, AuthType, any, any>;
|
|
615
|
+
get handleInvocation(): SlateToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>;
|
|
616
|
+
}
|
|
617
|
+
declare let tool: <ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters) => SlateActionBuilder<"tool", ConfigType, AuthType, {}, {}, SlateTool<ConfigType, AuthType, any, any>, false>;
|
|
618
|
+
|
|
619
|
+
interface SlatePublicToolParameters<InputType extends {}, OutputType extends {}> extends SlateActionParameters {
|
|
620
|
+
handleInvocation: SlatePublicToolInvocationHandler<InputType, OutputType>;
|
|
621
|
+
}
|
|
622
|
+
declare class SlatePublicTool {
|
|
623
|
+
private constructor();
|
|
624
|
+
static create<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters): SlateActionBuilder<"tool", ConfigType, AuthType, {}, {}, SlateTool<ConfigType, AuthType, any, any>, true>;
|
|
625
|
+
}
|
|
626
|
+
declare let publicTool: <ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters) => SlateActionBuilder<"tool", ConfigType, AuthType, {}, {}, SlateTool<ConfigType, AuthType, any, any>, true>;
|
|
627
|
+
|
|
587
628
|
type SlateActionScopeValue = string;
|
|
588
629
|
type SlateActionScopeClauseInput = SlateActionScopeValue | readonly SlateActionScopeValue[] | SlateActionScopeClause;
|
|
589
630
|
type SlateActionScopesInput = SlateActionScopeClauseInput | SlateActionScopes;
|
|
@@ -593,17 +634,6 @@ declare let allOf: (...inputs: SlateActionScopesInput[]) => SlateActionScopes;
|
|
|
593
634
|
declare let mergeScopes: (...inputs: Array<SlateActionScopes | null | undefined | false>) => SlateActionScopes | undefined;
|
|
594
635
|
declare let validateScopes: (scopes: SlateActionScopes) => SlateActionScopes;
|
|
595
636
|
|
|
596
|
-
interface SlateToolParameters<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> extends SlateActionParameters {
|
|
597
|
-
handleInvocation: SlateToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>;
|
|
598
|
-
}
|
|
599
|
-
declare class SlateTool<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> extends SlateAction<'tool', ConfigType, AuthType, InputType, OutputType> {
|
|
600
|
-
#private;
|
|
601
|
-
private constructor();
|
|
602
|
-
static create<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters): SlateActionBuilder<"tool", ConfigType, AuthType, {}, {}, SlateTool<any, any, any, any>>;
|
|
603
|
-
get handleInvocation(): SlateToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>;
|
|
604
|
-
}
|
|
605
|
-
declare let tool: <ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters) => SlateActionBuilder<"tool", ConfigType, AuthType, {}, {}, SlateTool<any, any, any, any>>;
|
|
606
|
-
|
|
607
637
|
declare let SlateDefaultPollingIntervalSeconds: number;
|
|
608
638
|
interface SlateTriggerParameters<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {
|
|
609
639
|
type: string;
|
|
@@ -623,7 +653,7 @@ declare class SlateTrigger<ConfigType extends {}, AuthType extends {}, InputType
|
|
|
623
653
|
}> extends SlateAction<'trigger', ConfigType, AuthType, InputType, OutputType> {
|
|
624
654
|
#private;
|
|
625
655
|
private constructor();
|
|
626
|
-
static create<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters): SlateActionBuilder<"trigger", ConfigType, AuthType, {}, {}, SlateTrigger<
|
|
656
|
+
static create<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters): SlateActionBuilder<"trigger", ConfigType, AuthType, {}, {}, SlateTrigger<ConfigType, AuthType, any, any>, false>;
|
|
627
657
|
get polling(): SlatePollingOptions;
|
|
628
658
|
get source(): "polling" | "webhook";
|
|
629
659
|
get handleEvent(): SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
|
|
@@ -633,7 +663,53 @@ declare class SlateTrigger<ConfigType extends {}, AuthType extends {}, InputType
|
|
|
633
663
|
get autoRegisterWebhook(): SlateTriggerWebhookAutoRegistrationHandler<ConfigType, AuthType> | undefined;
|
|
634
664
|
get autoUnregisterWebhook(): SlateTriggerWebhookAutoUnregistrationHandler<ConfigType, AuthType> | undefined;
|
|
635
665
|
}
|
|
636
|
-
declare let trigger: <ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters) => SlateActionBuilder<"trigger", ConfigType, AuthType, {}, {}, SlateTrigger<
|
|
666
|
+
declare let trigger: <ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters) => SlateActionBuilder<"trigger", ConfigType, AuthType, {}, {}, SlateTrigger<ConfigType, AuthType, any, any>, false>;
|
|
667
|
+
|
|
668
|
+
interface SlateAdapterCapability {
|
|
669
|
+
id: string;
|
|
670
|
+
value: any;
|
|
671
|
+
}
|
|
672
|
+
interface SlateAdapterSpecParameters {
|
|
673
|
+
id: string;
|
|
674
|
+
name: string;
|
|
675
|
+
capabilities?: SlateAdapterCapability[];
|
|
676
|
+
}
|
|
677
|
+
declare class SlateAdapterSpec {
|
|
678
|
+
private readonly _params;
|
|
679
|
+
private constructor();
|
|
680
|
+
static create(params: SlateAdapterSpecParameters): SlateAdapterSpec;
|
|
681
|
+
get id(): string;
|
|
682
|
+
get name(): string;
|
|
683
|
+
get capabilities(): SlateAdapterCapability[];
|
|
684
|
+
get parameters(): {
|
|
685
|
+
id: string;
|
|
686
|
+
name: string;
|
|
687
|
+
capabilities: SlateAdapterCapability[];
|
|
688
|
+
};
|
|
689
|
+
tool<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters): SlateActionBuilder<"tool", ConfigType, AuthType, {}, {}, SlateTool<ConfigType, AuthType, any, any>, false>;
|
|
690
|
+
publicTool<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters): SlateActionBuilder<"tool", ConfigType, AuthType, {}, {}, SlateTool<ConfigType, AuthType, any, any>, true>;
|
|
691
|
+
trigger<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters): SlateActionBuilder<"trigger", ConfigType, AuthType, {}, {}, SlateTrigger<ConfigType, AuthType, any, any>, false>;
|
|
692
|
+
register<ConfigType extends {}, AuthType extends {}>(params: {
|
|
693
|
+
tools: SlateTool<ConfigType, AuthType, any, any>[];
|
|
694
|
+
triggers: SlateTrigger<ConfigType, AuthType, any, any>[];
|
|
695
|
+
}): SlateAdapter<ConfigType, AuthType>;
|
|
696
|
+
private linkAction;
|
|
697
|
+
}
|
|
698
|
+
declare let adapterSpec: (params: SlateAdapterSpecParameters) => SlateAdapterSpec;
|
|
699
|
+
|
|
700
|
+
declare class SlateAdapter<ConfigType extends {}, AuthType extends {}> {
|
|
701
|
+
private readonly _spec;
|
|
702
|
+
private readonly _tools;
|
|
703
|
+
private readonly _triggers;
|
|
704
|
+
constructor(_spec: SlateAdapterSpec, _tools: SlateTool<ConfigType, AuthType, any, any>[], _triggers: SlateTrigger<ConfigType, AuthType, any, any>[]);
|
|
705
|
+
get spec(): SlateAdapterSpec;
|
|
706
|
+
get id(): string;
|
|
707
|
+
get name(): string;
|
|
708
|
+
get capabilities(): SlateAdapterCapability[];
|
|
709
|
+
get tools(): SlateTool<ConfigType, AuthType, any, any>[];
|
|
710
|
+
get triggers(): SlateTrigger<ConfigType, AuthType, any, any>[];
|
|
711
|
+
get actions(): (SlateTrigger<ConfigType, AuthType, any, any> | SlateTool<ConfigType, AuthType, any, any>)[];
|
|
712
|
+
}
|
|
637
713
|
|
|
638
714
|
type ApiErrorStatus = number | string;
|
|
639
715
|
type ApiServiceError = ServiceError<ErrorRecord<any, any>>;
|
|
@@ -813,14 +889,17 @@ declare let setIfDefined: (target: Record<string, unknown>, key: string, value:
|
|
|
813
889
|
declare class Slate<ConfigType extends {}, AuthType extends {}> {
|
|
814
890
|
private readonly _spec;
|
|
815
891
|
private readonly _actions;
|
|
892
|
+
private readonly _adapters;
|
|
816
893
|
private constructor();
|
|
817
894
|
static create<ConfigType extends {}, AuthType extends {}>(params: {
|
|
818
895
|
spec: SlateSpecification<ConfigType, AuthType>;
|
|
819
896
|
triggers: SlateTrigger<ConfigType, AuthType, any, any>[];
|
|
820
897
|
tools: SlateTool<ConfigType, AuthType, any, any>[];
|
|
898
|
+
adapters?: SlateAdapter<ConfigType, AuthType>[];
|
|
821
899
|
}): Slate<ConfigType, AuthType>;
|
|
822
900
|
get spec(): SlateSpecification<ConfigType, AuthType>;
|
|
823
901
|
get actions(): (SlateTrigger<ConfigType, AuthType, any, any> | SlateTool<ConfigType, AuthType, any, any>)[];
|
|
902
|
+
get adapters(): SlateAdapter<ConfigType, AuthType>[];
|
|
824
903
|
}
|
|
825
904
|
|
|
826
905
|
declare const graphWebhookHttp: {
|
|
@@ -846,4 +925,4 @@ declare const metaWebhookHttp: {
|
|
|
846
925
|
};
|
|
847
926
|
declare let getMetaWebhookVerificationResponse: (request: Request, expectedVerifyToken: string | undefined) => SlateWebhookHttpResponseInit | null;
|
|
848
927
|
|
|
849
|
-
export { type ApiErrorBuildHelpers, type ApiErrorDetailOptions, type ApiErrorResponse, type ApiErrorStatus, type ApiServiceError, type BuildApiServiceErrorOptions, type CreateHmacSignatureOptions, 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, type SlateAttachment, type SlateAttachmentInlineContent, 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 SlateDocsReference, SlateError, type SlateErrorInput, type SlateErrorIssue, type SlateErrorKind, type SlateErrorProviderInfo, type SlateErrorResponse, type SlateErrorUpstreamInfo, type SlateLogEntry, type SlateLogFields, type SlateLogListener, type SlateLogMessageInput, type SlateLogType, SlateLogger, type SlatePollingOptions, type SlateProviderDocsReference, type SlateServiceErrorData, SlateSpecification, type SlateSpecificationCreateParameters, type SlateSpecificationParameters, SlateTool, type SlateToolInvocationHandler, type SlateToolParameters, SlateTrigger, type SlateTriggerMappingHandler, type SlateTriggerParameters, type SlateTriggerPollingHandler, type SlateTriggerWebhookAutoRegistrationHandler, type SlateTriggerWebhookAutoUnregistrationHandler, type SlateTriggerWebhookRequestHandler, type SlateTypedDocsReference, type SlateWebhookHttpMethod, type SlateWebhookHttpOptions, type SlateWebhookHttpResponseInit, type SlateWebhookRequestMatcher, type VerifyHmacSignatureOptions, allOf, anyOf, auth, axios, buildApiServiceError, collectApiErrorDetails, config, createApiServiceError, createAuthenticatedAxios, createAxios, createBase64Attachment, createHmacSignature, createSlateError, createTextAttachment, createUrlAttachment, extractApiErrorMessage, getApiErrorResponse, getApiErrorStatus, getBase64ByteLength, getCurrentContext, getGraphWebhookValidationResponse, getMetaWebhookVerificationResponse, getOAuthExpiresAtFromExpiresIn, getResponseHeaderValue, getServiceErrorData, graphWebhookHttp, inferSlateErrorFromAxios, isApiErrorRecord, isAxiosErrorLike, isServiceErrorData, mapServiceErrorCode, mapServiceErrorToSlateErrorInput, mergeScopes, metaWebhookHttp, normalizeOAuthTokenResponse, pickDefined, requestAxios, requestAxiosData, runWithContext, scopeClause, setIfDefined, spec, statusLabelForApiError, tool, trigger, validateScopes, verifyHmacSignature };
|
|
928
|
+
export { type ApiErrorBuildHelpers, type ApiErrorDetailOptions, type ApiErrorResponse, type ApiErrorStatus, type ApiServiceError, type BuildApiServiceErrorOptions, type CreateHmacSignatureOptions, 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 SlateAttachment, type SlateAttachmentInlineContent, 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 SlateDocsReference, SlateError, type SlateErrorInput, type SlateErrorIssue, type SlateErrorKind, type SlateErrorProviderInfo, type SlateErrorResponse, type SlateErrorUpstreamInfo, type SlateLogEntry, type SlateLogFields, type SlateLogListener, type SlateLogMessageInput, type SlateLogType, SlateLogger, type SlatePollingOptions, type SlateProviderDocsReference, SlatePublicContext, SlatePublicTool, type SlatePublicToolInvocationHandler, type SlatePublicToolParameters, type SlateServiceErrorData, SlateSpecification, type SlateSpecificationCreateParameters, type SlateSpecificationParameters, SlateTool, type SlateToolInvocationHandler, type SlateToolParameters, SlateTrigger, type SlateTriggerMappingHandler, type SlateTriggerParameters, type SlateTriggerPollingHandler, type SlateTriggerWebhookAutoRegistrationHandler, type SlateTriggerWebhookAutoUnregistrationHandler, type SlateTriggerWebhookRequestHandler, type SlateTypedDocsReference, type SlateWebhookHttpMethod, type SlateWebhookHttpOptions, type SlateWebhookHttpResponseInit, type SlateWebhookRequestMatcher, type VerifyHmacSignatureOptions, adapterSpec, allOf, anyOf, auth, axios, buildApiServiceError, collectApiErrorDetails, config, createApiServiceError, createAuthenticatedAxios, createAxios, createBase64Attachment, createHmacSignature, createSlateError, createTextAttachment, createUrlAttachment, extractApiErrorMessage, getApiErrorResponse, getApiErrorStatus, getBase64ByteLength, getCurrentContext, getGraphWebhookValidationResponse, getMetaWebhookVerificationResponse, getOAuthExpiresAtFromExpiresIn, getResponseHeaderValue, getServiceErrorData, graphWebhookHttp, inferSlateErrorFromAxios, isApiErrorRecord, isAxiosErrorLike, isServiceErrorData, mapServiceErrorCode, mapServiceErrorToSlateErrorInput, mergeScopes, metaWebhookHttp, normalizeOAuthTokenResponse, pickDefined, publicTool, requestAxios, requestAxiosData, runWithContext, scopeClause, setIfDefined, spec, statusLabelForApiError, tool, trigger, validateScopes, verifyHmacSignature };
|
package/dist/index.d.ts
CHANGED
|
@@ -358,19 +358,17 @@ declare class SlateSpecification<ConfigType extends {}, AuthType extends {}> {
|
|
|
358
358
|
}
|
|
359
359
|
declare let spec: <ConfigType extends {}, AuthType extends {}>(params: SlateSpecificationCreateParameters<ConfigType, AuthType>) => SlateSpecification<ConfigType, AuthType>;
|
|
360
360
|
|
|
361
|
-
declare class
|
|
361
|
+
declare class SlatePublicContext<InputType extends {}> {
|
|
362
362
|
#private;
|
|
363
363
|
private readonly spec;
|
|
364
364
|
private readonly logger;
|
|
365
|
-
constructor(
|
|
366
|
-
get specification(): SlateSpecification<
|
|
367
|
-
get config(): Readonly<ConfigType>;
|
|
365
|
+
constructor(input: InputType, spec: SlateSpecification<any, any>, logger: SlateLogger);
|
|
366
|
+
get specification(): SlateSpecification<any, any>;
|
|
368
367
|
get input(): Readonly<InputType>;
|
|
369
368
|
get event(): Readonly<InputType>;
|
|
370
369
|
get state(): "state" extends keyof InputType ? InputType["state"] : never;
|
|
371
370
|
get request(): "request" extends keyof InputType ? InputType["request"] : never;
|
|
372
371
|
get registrationDetails(): "registrationDetails" extends keyof InputType ? InputType["registrationDetails"] : never;
|
|
373
|
-
get auth(): Readonly<AuthType>;
|
|
374
372
|
recordHttpTrace(trace: SlateHttpTrace): void;
|
|
375
373
|
getHttpTraces(): {
|
|
376
374
|
error?: {
|
|
@@ -397,8 +395,14 @@ declare class SlateContext<ConfigType extends {}, AuthType extends {}, InputType
|
|
|
397
395
|
error(message: SlateLogMessageInput): void;
|
|
398
396
|
progress(message: SlateLogMessageInput): void;
|
|
399
397
|
}
|
|
398
|
+
declare class SlateContext<ConfigType extends {}, AuthType extends {}, InputType extends {}> extends SlatePublicContext<InputType> {
|
|
399
|
+
#private;
|
|
400
|
+
constructor(config: ConfigType, input: InputType, auth: AuthType, spec: SlateSpecification<ConfigType, AuthType>, logger: SlateLogger);
|
|
401
|
+
get config(): Readonly<ConfigType>;
|
|
402
|
+
get auth(): Readonly<AuthType>;
|
|
403
|
+
}
|
|
400
404
|
|
|
401
|
-
declare let runWithContext: <
|
|
405
|
+
declare let runWithContext: <InputType extends {}, RV>(context: SlatePublicContext<InputType>, fn: () => Promise<RV>) => Promise<RV>;
|
|
402
406
|
declare let getCurrentContext: <ConfigType extends {}, AuthType extends {}, InputType extends {}>() => SlateContext<ConfigType, AuthType, InputType>;
|
|
403
407
|
|
|
404
408
|
interface SlateAttachmentUrlContent {
|
|
@@ -440,12 +444,19 @@ interface SlateActionParameters {
|
|
|
440
444
|
scopes?: SlateActionScopes;
|
|
441
445
|
authMethods?: string[];
|
|
442
446
|
docs?: SlateActionDocsReference[];
|
|
447
|
+
adapter?: string | null;
|
|
448
|
+
isPublic?: boolean;
|
|
443
449
|
}
|
|
444
450
|
type SlateToolInvocationHandler<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> = (context: SlateContext<ConfigType, AuthType, InputType>) => Promise<{
|
|
445
451
|
output: OutputType;
|
|
446
452
|
message: string;
|
|
447
453
|
attachments?: SlateAttachment[];
|
|
448
454
|
}>;
|
|
455
|
+
type SlatePublicToolInvocationHandler<InputType extends {}, OutputType extends {}> = (context: SlatePublicContext<InputType>) => Promise<{
|
|
456
|
+
output: OutputType;
|
|
457
|
+
message: string;
|
|
458
|
+
attachments?: SlateAttachment[];
|
|
459
|
+
}>;
|
|
449
460
|
type SlateTriggerMappingHandler<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> = (context: SlateContext<ConfigType, AuthType, InputType>) => Promise<{
|
|
450
461
|
type: string;
|
|
451
462
|
id: string;
|
|
@@ -554,36 +565,66 @@ declare abstract class SlateAction<Type extends SlateActionType, ConfigType exte
|
|
|
554
565
|
get scopes(): SlateActionScopes | undefined;
|
|
555
566
|
get authMethods(): string[] | undefined;
|
|
556
567
|
get docs(): SlateActionDocsReference[] | undefined;
|
|
568
|
+
get adapter(): string | null;
|
|
569
|
+
get isPublic(): boolean;
|
|
557
570
|
}
|
|
558
571
|
|
|
559
|
-
declare class SlateActionBuilder<Type extends SlateActionType, ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}, Result extends SlateAction<Type, ConfigType, AuthType, any, any
|
|
572
|
+
declare class SlateActionBuilder<Type extends SlateActionType, ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}, Result extends SlateAction<Type, ConfigType, AuthType, any, any>, IsPublic extends boolean = false> {
|
|
560
573
|
#private;
|
|
561
574
|
private readonly type;
|
|
562
575
|
readonly spec: SlateSpecification<ConfigType, AuthType>;
|
|
563
576
|
private readonly params;
|
|
564
577
|
private readonly factory;
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
578
|
+
private readonly isPublicTool;
|
|
579
|
+
constructor(type: Type, spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters, factory: (params: SlateActionCreateParameters<any, any, any, any>) => Result, isPublicTool?: IsPublic);
|
|
580
|
+
input<NewInputType extends {}>(schema: z.ZodType<NewInputType>): SlateActionBuilder<Type, ConfigType, AuthType, NewInputType, OutputType, Result, IsPublic>;
|
|
581
|
+
output<NewOutputType extends {}>(schema: z.ZodType<NewOutputType>): SlateActionBuilder<Type, ConfigType, AuthType, InputType, NewOutputType, Result, IsPublic>;
|
|
582
|
+
lockInterface(): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
|
|
583
|
+
scopes(scopes: SlateActionScopes): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
|
|
584
|
+
authMethods(authMethods: string[]): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
|
|
570
585
|
private validateAuthMethods;
|
|
571
|
-
handleInvocation(handler: SlateToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result>;
|
|
586
|
+
handleInvocation(handler: IsPublic extends true ? SlatePublicToolInvocationHandler<InputType, OutputType> : SlateToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
|
|
572
587
|
webhook(props: {
|
|
573
588
|
handleEvent: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
|
|
574
589
|
handleRequest: SlateTriggerWebhookRequestHandler<ConfigType, AuthType, InputType>;
|
|
575
590
|
autoRegisterWebhook?: SlateTriggerWebhookAutoRegistrationHandler<ConfigType, AuthType>;
|
|
576
591
|
autoUnregisterWebhook?: SlateTriggerWebhookAutoUnregistrationHandler<ConfigType, AuthType>;
|
|
577
592
|
http?: SlateWebhookHttpOptions;
|
|
578
|
-
}): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result>;
|
|
593
|
+
}): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
|
|
579
594
|
polling(props: {
|
|
580
595
|
options?: SlatePollingOptions;
|
|
581
596
|
pollEvents?: SlateTriggerPollingHandler<ConfigType, AuthType, InputType>;
|
|
582
597
|
handleEvent: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
|
|
583
|
-
}): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result>;
|
|
598
|
+
}): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
|
|
584
599
|
build(): Result;
|
|
585
600
|
}
|
|
586
601
|
|
|
602
|
+
interface SlateToolParameters<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> extends SlateActionParameters {
|
|
603
|
+
handleInvocation: SlateToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>;
|
|
604
|
+
}
|
|
605
|
+
declare class SlateTool<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> extends SlateAction<'tool', ConfigType, AuthType, InputType, OutputType> {
|
|
606
|
+
#private;
|
|
607
|
+
protected constructor(spec: SlateSpecification<ConfigType, AuthType>, inputSchema: z.ZodType<InputType>, outputSchema: z.ZodType<OutputType>, params: SlateToolParameters<ConfigType, AuthType, InputType, OutputType>);
|
|
608
|
+
static create<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters): SlateActionBuilder<"tool", ConfigType, AuthType, {}, {}, SlateTool<ConfigType, AuthType, any, any>, false>;
|
|
609
|
+
static fromCreateParameters<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: {
|
|
610
|
+
type: string;
|
|
611
|
+
inputSchema: z.ZodType<any>;
|
|
612
|
+
outputSchema: z.ZodType<any>;
|
|
613
|
+
handleInvocation?: SlateToolInvocationHandler<ConfigType, AuthType, any, any>;
|
|
614
|
+
} & SlateActionParameters): SlateTool<ConfigType, AuthType, any, any>;
|
|
615
|
+
get handleInvocation(): SlateToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>;
|
|
616
|
+
}
|
|
617
|
+
declare let tool: <ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters) => SlateActionBuilder<"tool", ConfigType, AuthType, {}, {}, SlateTool<ConfigType, AuthType, any, any>, false>;
|
|
618
|
+
|
|
619
|
+
interface SlatePublicToolParameters<InputType extends {}, OutputType extends {}> extends SlateActionParameters {
|
|
620
|
+
handleInvocation: SlatePublicToolInvocationHandler<InputType, OutputType>;
|
|
621
|
+
}
|
|
622
|
+
declare class SlatePublicTool {
|
|
623
|
+
private constructor();
|
|
624
|
+
static create<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters): SlateActionBuilder<"tool", ConfigType, AuthType, {}, {}, SlateTool<ConfigType, AuthType, any, any>, true>;
|
|
625
|
+
}
|
|
626
|
+
declare let publicTool: <ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters) => SlateActionBuilder<"tool", ConfigType, AuthType, {}, {}, SlateTool<ConfigType, AuthType, any, any>, true>;
|
|
627
|
+
|
|
587
628
|
type SlateActionScopeValue = string;
|
|
588
629
|
type SlateActionScopeClauseInput = SlateActionScopeValue | readonly SlateActionScopeValue[] | SlateActionScopeClause;
|
|
589
630
|
type SlateActionScopesInput = SlateActionScopeClauseInput | SlateActionScopes;
|
|
@@ -593,17 +634,6 @@ declare let allOf: (...inputs: SlateActionScopesInput[]) => SlateActionScopes;
|
|
|
593
634
|
declare let mergeScopes: (...inputs: Array<SlateActionScopes | null | undefined | false>) => SlateActionScopes | undefined;
|
|
594
635
|
declare let validateScopes: (scopes: SlateActionScopes) => SlateActionScopes;
|
|
595
636
|
|
|
596
|
-
interface SlateToolParameters<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> extends SlateActionParameters {
|
|
597
|
-
handleInvocation: SlateToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>;
|
|
598
|
-
}
|
|
599
|
-
declare class SlateTool<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> extends SlateAction<'tool', ConfigType, AuthType, InputType, OutputType> {
|
|
600
|
-
#private;
|
|
601
|
-
private constructor();
|
|
602
|
-
static create<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters): SlateActionBuilder<"tool", ConfigType, AuthType, {}, {}, SlateTool<any, any, any, any>>;
|
|
603
|
-
get handleInvocation(): SlateToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>;
|
|
604
|
-
}
|
|
605
|
-
declare let tool: <ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters) => SlateActionBuilder<"tool", ConfigType, AuthType, {}, {}, SlateTool<any, any, any, any>>;
|
|
606
|
-
|
|
607
637
|
declare let SlateDefaultPollingIntervalSeconds: number;
|
|
608
638
|
interface SlateTriggerParameters<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {
|
|
609
639
|
type: string;
|
|
@@ -623,7 +653,7 @@ declare class SlateTrigger<ConfigType extends {}, AuthType extends {}, InputType
|
|
|
623
653
|
}> extends SlateAction<'trigger', ConfigType, AuthType, InputType, OutputType> {
|
|
624
654
|
#private;
|
|
625
655
|
private constructor();
|
|
626
|
-
static create<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters): SlateActionBuilder<"trigger", ConfigType, AuthType, {}, {}, SlateTrigger<
|
|
656
|
+
static create<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters): SlateActionBuilder<"trigger", ConfigType, AuthType, {}, {}, SlateTrigger<ConfigType, AuthType, any, any>, false>;
|
|
627
657
|
get polling(): SlatePollingOptions;
|
|
628
658
|
get source(): "polling" | "webhook";
|
|
629
659
|
get handleEvent(): SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
|
|
@@ -633,7 +663,53 @@ declare class SlateTrigger<ConfigType extends {}, AuthType extends {}, InputType
|
|
|
633
663
|
get autoRegisterWebhook(): SlateTriggerWebhookAutoRegistrationHandler<ConfigType, AuthType> | undefined;
|
|
634
664
|
get autoUnregisterWebhook(): SlateTriggerWebhookAutoUnregistrationHandler<ConfigType, AuthType> | undefined;
|
|
635
665
|
}
|
|
636
|
-
declare let trigger: <ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters) => SlateActionBuilder<"trigger", ConfigType, AuthType, {}, {}, SlateTrigger<
|
|
666
|
+
declare let trigger: <ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters) => SlateActionBuilder<"trigger", ConfigType, AuthType, {}, {}, SlateTrigger<ConfigType, AuthType, any, any>, false>;
|
|
667
|
+
|
|
668
|
+
interface SlateAdapterCapability {
|
|
669
|
+
id: string;
|
|
670
|
+
value: any;
|
|
671
|
+
}
|
|
672
|
+
interface SlateAdapterSpecParameters {
|
|
673
|
+
id: string;
|
|
674
|
+
name: string;
|
|
675
|
+
capabilities?: SlateAdapterCapability[];
|
|
676
|
+
}
|
|
677
|
+
declare class SlateAdapterSpec {
|
|
678
|
+
private readonly _params;
|
|
679
|
+
private constructor();
|
|
680
|
+
static create(params: SlateAdapterSpecParameters): SlateAdapterSpec;
|
|
681
|
+
get id(): string;
|
|
682
|
+
get name(): string;
|
|
683
|
+
get capabilities(): SlateAdapterCapability[];
|
|
684
|
+
get parameters(): {
|
|
685
|
+
id: string;
|
|
686
|
+
name: string;
|
|
687
|
+
capabilities: SlateAdapterCapability[];
|
|
688
|
+
};
|
|
689
|
+
tool<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters): SlateActionBuilder<"tool", ConfigType, AuthType, {}, {}, SlateTool<ConfigType, AuthType, any, any>, false>;
|
|
690
|
+
publicTool<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters): SlateActionBuilder<"tool", ConfigType, AuthType, {}, {}, SlateTool<ConfigType, AuthType, any, any>, true>;
|
|
691
|
+
trigger<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters): SlateActionBuilder<"trigger", ConfigType, AuthType, {}, {}, SlateTrigger<ConfigType, AuthType, any, any>, false>;
|
|
692
|
+
register<ConfigType extends {}, AuthType extends {}>(params: {
|
|
693
|
+
tools: SlateTool<ConfigType, AuthType, any, any>[];
|
|
694
|
+
triggers: SlateTrigger<ConfigType, AuthType, any, any>[];
|
|
695
|
+
}): SlateAdapter<ConfigType, AuthType>;
|
|
696
|
+
private linkAction;
|
|
697
|
+
}
|
|
698
|
+
declare let adapterSpec: (params: SlateAdapterSpecParameters) => SlateAdapterSpec;
|
|
699
|
+
|
|
700
|
+
declare class SlateAdapter<ConfigType extends {}, AuthType extends {}> {
|
|
701
|
+
private readonly _spec;
|
|
702
|
+
private readonly _tools;
|
|
703
|
+
private readonly _triggers;
|
|
704
|
+
constructor(_spec: SlateAdapterSpec, _tools: SlateTool<ConfigType, AuthType, any, any>[], _triggers: SlateTrigger<ConfigType, AuthType, any, any>[]);
|
|
705
|
+
get spec(): SlateAdapterSpec;
|
|
706
|
+
get id(): string;
|
|
707
|
+
get name(): string;
|
|
708
|
+
get capabilities(): SlateAdapterCapability[];
|
|
709
|
+
get tools(): SlateTool<ConfigType, AuthType, any, any>[];
|
|
710
|
+
get triggers(): SlateTrigger<ConfigType, AuthType, any, any>[];
|
|
711
|
+
get actions(): (SlateTrigger<ConfigType, AuthType, any, any> | SlateTool<ConfigType, AuthType, any, any>)[];
|
|
712
|
+
}
|
|
637
713
|
|
|
638
714
|
type ApiErrorStatus = number | string;
|
|
639
715
|
type ApiServiceError = ServiceError<ErrorRecord<any, any>>;
|
|
@@ -813,14 +889,17 @@ declare let setIfDefined: (target: Record<string, unknown>, key: string, value:
|
|
|
813
889
|
declare class Slate<ConfigType extends {}, AuthType extends {}> {
|
|
814
890
|
private readonly _spec;
|
|
815
891
|
private readonly _actions;
|
|
892
|
+
private readonly _adapters;
|
|
816
893
|
private constructor();
|
|
817
894
|
static create<ConfigType extends {}, AuthType extends {}>(params: {
|
|
818
895
|
spec: SlateSpecification<ConfigType, AuthType>;
|
|
819
896
|
triggers: SlateTrigger<ConfigType, AuthType, any, any>[];
|
|
820
897
|
tools: SlateTool<ConfigType, AuthType, any, any>[];
|
|
898
|
+
adapters?: SlateAdapter<ConfigType, AuthType>[];
|
|
821
899
|
}): Slate<ConfigType, AuthType>;
|
|
822
900
|
get spec(): SlateSpecification<ConfigType, AuthType>;
|
|
823
901
|
get actions(): (SlateTrigger<ConfigType, AuthType, any, any> | SlateTool<ConfigType, AuthType, any, any>)[];
|
|
902
|
+
get adapters(): SlateAdapter<ConfigType, AuthType>[];
|
|
824
903
|
}
|
|
825
904
|
|
|
826
905
|
declare const graphWebhookHttp: {
|
|
@@ -846,4 +925,4 @@ declare const metaWebhookHttp: {
|
|
|
846
925
|
};
|
|
847
926
|
declare let getMetaWebhookVerificationResponse: (request: Request, expectedVerifyToken: string | undefined) => SlateWebhookHttpResponseInit | null;
|
|
848
927
|
|
|
849
|
-
export { type ApiErrorBuildHelpers, type ApiErrorDetailOptions, type ApiErrorResponse, type ApiErrorStatus, type ApiServiceError, type BuildApiServiceErrorOptions, type CreateHmacSignatureOptions, 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, type SlateAttachment, type SlateAttachmentInlineContent, 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 SlateDocsReference, SlateError, type SlateErrorInput, type SlateErrorIssue, type SlateErrorKind, type SlateErrorProviderInfo, type SlateErrorResponse, type SlateErrorUpstreamInfo, type SlateLogEntry, type SlateLogFields, type SlateLogListener, type SlateLogMessageInput, type SlateLogType, SlateLogger, type SlatePollingOptions, type SlateProviderDocsReference, type SlateServiceErrorData, SlateSpecification, type SlateSpecificationCreateParameters, type SlateSpecificationParameters, SlateTool, type SlateToolInvocationHandler, type SlateToolParameters, SlateTrigger, type SlateTriggerMappingHandler, type SlateTriggerParameters, type SlateTriggerPollingHandler, type SlateTriggerWebhookAutoRegistrationHandler, type SlateTriggerWebhookAutoUnregistrationHandler, type SlateTriggerWebhookRequestHandler, type SlateTypedDocsReference, type SlateWebhookHttpMethod, type SlateWebhookHttpOptions, type SlateWebhookHttpResponseInit, type SlateWebhookRequestMatcher, type VerifyHmacSignatureOptions, allOf, anyOf, auth, axios, buildApiServiceError, collectApiErrorDetails, config, createApiServiceError, createAuthenticatedAxios, createAxios, createBase64Attachment, createHmacSignature, createSlateError, createTextAttachment, createUrlAttachment, extractApiErrorMessage, getApiErrorResponse, getApiErrorStatus, getBase64ByteLength, getCurrentContext, getGraphWebhookValidationResponse, getMetaWebhookVerificationResponse, getOAuthExpiresAtFromExpiresIn, getResponseHeaderValue, getServiceErrorData, graphWebhookHttp, inferSlateErrorFromAxios, isApiErrorRecord, isAxiosErrorLike, isServiceErrorData, mapServiceErrorCode, mapServiceErrorToSlateErrorInput, mergeScopes, metaWebhookHttp, normalizeOAuthTokenResponse, pickDefined, requestAxios, requestAxiosData, runWithContext, scopeClause, setIfDefined, spec, statusLabelForApiError, tool, trigger, validateScopes, verifyHmacSignature };
|
|
928
|
+
export { type ApiErrorBuildHelpers, type ApiErrorDetailOptions, type ApiErrorResponse, type ApiErrorStatus, type ApiServiceError, type BuildApiServiceErrorOptions, type CreateHmacSignatureOptions, 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 SlateAttachment, type SlateAttachmentInlineContent, 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 SlateDocsReference, SlateError, type SlateErrorInput, type SlateErrorIssue, type SlateErrorKind, type SlateErrorProviderInfo, type SlateErrorResponse, type SlateErrorUpstreamInfo, type SlateLogEntry, type SlateLogFields, type SlateLogListener, type SlateLogMessageInput, type SlateLogType, SlateLogger, type SlatePollingOptions, type SlateProviderDocsReference, SlatePublicContext, SlatePublicTool, type SlatePublicToolInvocationHandler, type SlatePublicToolParameters, type SlateServiceErrorData, SlateSpecification, type SlateSpecificationCreateParameters, type SlateSpecificationParameters, SlateTool, type SlateToolInvocationHandler, type SlateToolParameters, SlateTrigger, type SlateTriggerMappingHandler, type SlateTriggerParameters, type SlateTriggerPollingHandler, type SlateTriggerWebhookAutoRegistrationHandler, type SlateTriggerWebhookAutoUnregistrationHandler, type SlateTriggerWebhookRequestHandler, type SlateTypedDocsReference, type SlateWebhookHttpMethod, type SlateWebhookHttpOptions, type SlateWebhookHttpResponseInit, type SlateWebhookRequestMatcher, type VerifyHmacSignatureOptions, adapterSpec, allOf, anyOf, auth, axios, buildApiServiceError, collectApiErrorDetails, config, createApiServiceError, createAuthenticatedAxios, createAxios, createBase64Attachment, createHmacSignature, createSlateError, createTextAttachment, createUrlAttachment, extractApiErrorMessage, getApiErrorResponse, getApiErrorStatus, getBase64ByteLength, getCurrentContext, getGraphWebhookValidationResponse, getMetaWebhookVerificationResponse, getOAuthExpiresAtFromExpiresIn, getResponseHeaderValue, getServiceErrorData, graphWebhookHttp, inferSlateErrorFromAxios, isApiErrorRecord, isAxiosErrorLike, isServiceErrorData, mapServiceErrorCode, mapServiceErrorToSlateErrorInput, mergeScopes, metaWebhookHttp, normalizeOAuthTokenResponse, pickDefined, publicTool, requestAxios, requestAxiosData, runWithContext, scopeClause, setIfDefined, spec, statusLabelForApiError, tool, trigger, validateScopes, verifyHmacSignature };
|