@slates/provider 1.0.0-rc.28 → 1.0.0-rc.30
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 +2417 -1897
- package/dist/index.d.cts +59 -6
- package/dist/index.d.ts +59 -6
- package/dist/index.module.js +2406 -1897
- package/package.json +1 -1
- package/src/action/index.ts +1 -0
- package/src/action/toolCategory.ts +40 -0
- package/src/auth/redact.test.ts +29 -0
- package/src/auth/redact.ts +44 -21
- package/src/axios/trace.test.ts +305 -1
- package/src/axios/trace.ts +330 -16
- package/src/error/api.test.ts +123 -1
- package/src/error/api.ts +148 -0
- package/src/error/axios.ts +48 -13
- package/src/error/utils.test.ts +654 -0
- package/src/error/utils.ts +268 -13
- package/src/specification/slate.test.ts +153 -1
- package/src/specification/slate.ts +105 -3
package/dist/index.d.cts
CHANGED
|
@@ -41,17 +41,26 @@ declare let createTextAttachment: (content: string, mimeType?: string, attachmen
|
|
|
41
41
|
* the hub resolves these placeholders back to live secret values when it proxies an attachment.
|
|
42
42
|
*/
|
|
43
43
|
declare let AUTH_CONFIG_SECRET_PLACEHOLDER_PREFIX: string;
|
|
44
|
+
/** Decides whether an auth-config value (with its dotted path) may be replaced. */
|
|
45
|
+
type AuthConfigSecretFilter = (secret: string, path: string) => boolean;
|
|
44
46
|
/**
|
|
45
47
|
* Maps auth-config string leaves to `$$MT$secret$authConfig$<path>` placeholders.
|
|
46
48
|
* `redact` preserves whole-value substitution for HTTP traces; `redactEmbedded` also
|
|
47
49
|
* replaces embedded values in attachment credentials, terminating those placeholders with `$$`.
|
|
50
|
+
* Both accept a `wholeValue` filter so diagnostics (traces, error text) can skip
|
|
51
|
+
* non-secret fields such as account IDs, emails, or subdomains; attachment callers keep
|
|
52
|
+
* the default, because the hub resolves every placeholder back to its value.
|
|
48
53
|
*/
|
|
49
54
|
declare class AuthConfigSecretRedactor {
|
|
50
|
-
private readonly
|
|
55
|
+
private readonly secretToPaths;
|
|
51
56
|
constructor(authConfig: Record<string, unknown> | undefined);
|
|
52
|
-
redact<T>(value: T): T;
|
|
53
|
-
/**
|
|
54
|
-
|
|
57
|
+
redact<T>(value: T, wholeValue?: AuthConfigSecretFilter): T;
|
|
58
|
+
/**
|
|
59
|
+
* `embeddable` limits which secrets are also replaced inside longer strings;
|
|
60
|
+
* `wholeValue` limits which secrets replace a string that equals them exactly.
|
|
61
|
+
*/
|
|
62
|
+
redactEmbedded<T>(value: T, embeddable?: AuthConfigSecretFilter, wholeValue?: AuthConfigSecretFilter): T;
|
|
63
|
+
private placeholderFor;
|
|
55
64
|
private buildSecretMap;
|
|
56
65
|
private transform;
|
|
57
66
|
private isPlainObject;
|
|
@@ -848,6 +857,25 @@ declare let allOf: (...inputs: SlateActionScopesInput[]) => SlateActionScopes;
|
|
|
848
857
|
declare let mergeScopes: (...inputs: Array<SlateActionScopes | null | undefined | false>) => SlateActionScopes | undefined;
|
|
849
858
|
declare let validateScopes: (scopes: SlateActionScopes) => SlateActionScopes;
|
|
850
859
|
|
|
860
|
+
interface SlateToolCategoryParameters {
|
|
861
|
+
key: string;
|
|
862
|
+
name: string;
|
|
863
|
+
description?: string;
|
|
864
|
+
imageUrl?: string;
|
|
865
|
+
tools: SlateTool<any, any, any, any>[];
|
|
866
|
+
}
|
|
867
|
+
declare class SlateToolCategory {
|
|
868
|
+
private readonly _params;
|
|
869
|
+
private constructor();
|
|
870
|
+
static create(params: SlateToolCategoryParameters): SlateToolCategory;
|
|
871
|
+
get key(): string;
|
|
872
|
+
get name(): string;
|
|
873
|
+
get description(): string | undefined;
|
|
874
|
+
get imageUrl(): string | undefined;
|
|
875
|
+
get tools(): SlateTool<any, any, any, any>[];
|
|
876
|
+
}
|
|
877
|
+
declare let toolCategory: (params: SlateToolCategoryParameters) => SlateToolCategory;
|
|
878
|
+
|
|
851
879
|
interface SlateTriggerParameters<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {
|
|
852
880
|
type: string;
|
|
853
881
|
}> extends SlateActionParameters {
|
|
@@ -932,6 +960,7 @@ type ApiErrorBuildHelpers = {
|
|
|
932
960
|
collectDetails: (value: unknown, details: string[], options?: ApiErrorDetailOptions) => void;
|
|
933
961
|
extractMessage: (error: unknown, options?: ApiErrorDetailOptions) => string;
|
|
934
962
|
getResponse: (error: unknown) => ApiErrorResponse | undefined;
|
|
963
|
+
getResponseWithBody: (error: unknown) => ApiErrorResponse | undefined;
|
|
935
964
|
getStatus: (error: unknown) => ApiErrorStatus | undefined;
|
|
936
965
|
isRecord: (value: unknown) => value is Record<string, unknown>;
|
|
937
966
|
statusLabelFor: (status?: ApiErrorStatus, statusText?: string) => string;
|
|
@@ -958,6 +987,25 @@ declare let isApiErrorRecord: (value: unknown) => value is Record<string, unknow
|
|
|
958
987
|
declare let collectApiErrorDetails: (value: unknown, details: string[], options?: ApiErrorDetailOptions) => void;
|
|
959
988
|
declare let getApiErrorResponse: (error: unknown) => ApiErrorResponse | undefined;
|
|
960
989
|
declare let getApiErrorStatus: (error: unknown) => ApiErrorStatus | undefined;
|
|
990
|
+
declare let getApiErrorResponseWithBody: (error: unknown) => ApiErrorResponse | undefined;
|
|
991
|
+
declare let API_ERROR_MAX_DETAILS: number;
|
|
992
|
+
declare let API_ERROR_MAX_MESSAGE_LENGTH: number;
|
|
993
|
+
declare let API_ERROR_TRUNCATED_PLACEHOLDER: string;
|
|
994
|
+
declare let looksLikeHtmlErrorBody: (value: string) => boolean;
|
|
995
|
+
declare let truncateApiErrorMessage: (value: string, maxLength?: number) => string;
|
|
996
|
+
type ApiErrorTextOptions = {
|
|
997
|
+
includeNumbers?: boolean;
|
|
998
|
+
};
|
|
999
|
+
declare let readApiErrorText: (value: unknown, options?: ApiErrorTextOptions) => string | undefined;
|
|
1000
|
+
type BoundedApiErrorDetailOptions = ApiErrorTextOptions & {
|
|
1001
|
+
maxDetails?: number;
|
|
1002
|
+
field?: string;
|
|
1003
|
+
};
|
|
1004
|
+
declare let pushBoundedApiErrorDetail: (details: string[], value: unknown, options?: BoundedApiErrorDetailOptions) => void;
|
|
1005
|
+
type DecodeApiErrorBodyOptions = {
|
|
1006
|
+
maxBytes?: number;
|
|
1007
|
+
};
|
|
1008
|
+
declare let decodeApiErrorBody: (data: unknown, options?: DecodeApiErrorBodyOptions) => unknown;
|
|
961
1009
|
declare let statusLabelForApiError: (status?: ApiErrorStatus, statusText?: string) => string;
|
|
962
1010
|
declare let extractApiErrorMessage: (error: unknown, options?: ApiErrorDetailOptions & {
|
|
963
1011
|
response?: ApiErrorResponse;
|
|
@@ -968,7 +1016,7 @@ declare let createApiServiceError: (message: string, options?: {
|
|
|
968
1016
|
upstreamCode?: string;
|
|
969
1017
|
parent?: unknown;
|
|
970
1018
|
}) => ServiceError<ErrorRecord<"bad_request", 400>>;
|
|
971
|
-
declare let buildApiServiceError: (error: unknown, options: BuildApiServiceErrorOptions) => ServiceError<
|
|
1019
|
+
declare let buildApiServiceError: (error: unknown, options: BuildApiServiceErrorOptions) => ServiceError<any>;
|
|
972
1020
|
|
|
973
1021
|
declare class SlateError extends Error {
|
|
974
1022
|
cause?: unknown;
|
|
@@ -1094,6 +1142,8 @@ declare class Slate<ConfigType extends {}, AuthType extends {}> {
|
|
|
1094
1142
|
private readonly _actions;
|
|
1095
1143
|
private readonly _adapters;
|
|
1096
1144
|
private readonly _triggerGroups;
|
|
1145
|
+
private readonly _toolCategories;
|
|
1146
|
+
private readonly _toolCategoryKeysByActionKey;
|
|
1097
1147
|
private constructor();
|
|
1098
1148
|
static create<ConfigType extends {}, AuthType extends {}>(params: {
|
|
1099
1149
|
spec: SlateSpecification<ConfigType, AuthType>;
|
|
@@ -1101,11 +1151,14 @@ declare class Slate<ConfigType extends {}, AuthType extends {}> {
|
|
|
1101
1151
|
tools: SlateTool<ConfigType, AuthType, any, any>[];
|
|
1102
1152
|
adapters?: SlateAdapter<ConfigType, AuthType>[];
|
|
1103
1153
|
triggerGroups?: SlateTriggerGroup<ConfigType, AuthType>[];
|
|
1154
|
+
toolCategories?: SlateToolCategory[];
|
|
1104
1155
|
}): Slate<ConfigType, AuthType>;
|
|
1105
1156
|
get spec(): SlateSpecification<ConfigType, AuthType>;
|
|
1106
1157
|
get actions(): (SlateTrigger<ConfigType, AuthType, any, any> | SlateTool<ConfigType, AuthType, any, any>)[];
|
|
1107
1158
|
get adapters(): SlateAdapter<ConfigType, AuthType>[];
|
|
1108
1159
|
get triggerGroups(): SlateTriggerGroup<ConfigType, AuthType, Record<string, unknown>>[];
|
|
1160
|
+
get toolCategories(): SlateToolCategory[];
|
|
1161
|
+
getToolCategoryKeys(actionKey: string): string[];
|
|
1109
1162
|
}
|
|
1110
1163
|
|
|
1111
1164
|
declare const graphWebhookHttp: {
|
|
@@ -1139,4 +1192,4 @@ declare let skipWebhook: (reason: string, response?: Response | SlateWebhookHttp
|
|
|
1139
1192
|
response: Response | SlateWebhookHttpResponseInit;
|
|
1140
1193
|
};
|
|
1141
1194
|
|
|
1142
|
-
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 SlateGatewayEvent, 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 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, extractApiErrorMessage, getApiErrorResponse, getApiErrorStatus, getBase64ByteLength, getCurrentContext, getFileUrlTool, getFileUrlToolInputSchema, getFileUrlToolOutputSchema, getGraphWebhookValidationResponse, getMetaWebhookVerificationResponse, getOAuthExpiresAtFromExpiresIn, getResponseHeaderValue, getServiceErrorData, graphWebhookHttp, inferSlateErrorFromAxios, isApiErrorRecord, isAxiosErrorLike, isServiceErrorData, isUrlEmbeddedCredential, mapServiceErrorCode, mapServiceErrorToSlateErrorInput, mergeScopes, metaWebhookHttp, normalizeOAuthTokenResponse, pickDefined, publicTool, redactUrlAttachmentSecrets, requestAxios, requestAxiosData, runWithContext, scopeClause, setIfDefined, skipWebhook, spec, statusLabelForApiError, tool, trigger, triggerGroup, uploadAttachmentDirect, validateScopes, verifyHmacSignature };
|
|
1195
|
+
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 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, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -41,17 +41,26 @@ declare let createTextAttachment: (content: string, mimeType?: string, attachmen
|
|
|
41
41
|
* the hub resolves these placeholders back to live secret values when it proxies an attachment.
|
|
42
42
|
*/
|
|
43
43
|
declare let AUTH_CONFIG_SECRET_PLACEHOLDER_PREFIX: string;
|
|
44
|
+
/** Decides whether an auth-config value (with its dotted path) may be replaced. */
|
|
45
|
+
type AuthConfigSecretFilter = (secret: string, path: string) => boolean;
|
|
44
46
|
/**
|
|
45
47
|
* Maps auth-config string leaves to `$$MT$secret$authConfig$<path>` placeholders.
|
|
46
48
|
* `redact` preserves whole-value substitution for HTTP traces; `redactEmbedded` also
|
|
47
49
|
* replaces embedded values in attachment credentials, terminating those placeholders with `$$`.
|
|
50
|
+
* Both accept a `wholeValue` filter so diagnostics (traces, error text) can skip
|
|
51
|
+
* non-secret fields such as account IDs, emails, or subdomains; attachment callers keep
|
|
52
|
+
* the default, because the hub resolves every placeholder back to its value.
|
|
48
53
|
*/
|
|
49
54
|
declare class AuthConfigSecretRedactor {
|
|
50
|
-
private readonly
|
|
55
|
+
private readonly secretToPaths;
|
|
51
56
|
constructor(authConfig: Record<string, unknown> | undefined);
|
|
52
|
-
redact<T>(value: T): T;
|
|
53
|
-
/**
|
|
54
|
-
|
|
57
|
+
redact<T>(value: T, wholeValue?: AuthConfigSecretFilter): T;
|
|
58
|
+
/**
|
|
59
|
+
* `embeddable` limits which secrets are also replaced inside longer strings;
|
|
60
|
+
* `wholeValue` limits which secrets replace a string that equals them exactly.
|
|
61
|
+
*/
|
|
62
|
+
redactEmbedded<T>(value: T, embeddable?: AuthConfigSecretFilter, wholeValue?: AuthConfigSecretFilter): T;
|
|
63
|
+
private placeholderFor;
|
|
55
64
|
private buildSecretMap;
|
|
56
65
|
private transform;
|
|
57
66
|
private isPlainObject;
|
|
@@ -848,6 +857,25 @@ declare let allOf: (...inputs: SlateActionScopesInput[]) => SlateActionScopes;
|
|
|
848
857
|
declare let mergeScopes: (...inputs: Array<SlateActionScopes | null | undefined | false>) => SlateActionScopes | undefined;
|
|
849
858
|
declare let validateScopes: (scopes: SlateActionScopes) => SlateActionScopes;
|
|
850
859
|
|
|
860
|
+
interface SlateToolCategoryParameters {
|
|
861
|
+
key: string;
|
|
862
|
+
name: string;
|
|
863
|
+
description?: string;
|
|
864
|
+
imageUrl?: string;
|
|
865
|
+
tools: SlateTool<any, any, any, any>[];
|
|
866
|
+
}
|
|
867
|
+
declare class SlateToolCategory {
|
|
868
|
+
private readonly _params;
|
|
869
|
+
private constructor();
|
|
870
|
+
static create(params: SlateToolCategoryParameters): SlateToolCategory;
|
|
871
|
+
get key(): string;
|
|
872
|
+
get name(): string;
|
|
873
|
+
get description(): string | undefined;
|
|
874
|
+
get imageUrl(): string | undefined;
|
|
875
|
+
get tools(): SlateTool<any, any, any, any>[];
|
|
876
|
+
}
|
|
877
|
+
declare let toolCategory: (params: SlateToolCategoryParameters) => SlateToolCategory;
|
|
878
|
+
|
|
851
879
|
interface SlateTriggerParameters<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {
|
|
852
880
|
type: string;
|
|
853
881
|
}> extends SlateActionParameters {
|
|
@@ -932,6 +960,7 @@ type ApiErrorBuildHelpers = {
|
|
|
932
960
|
collectDetails: (value: unknown, details: string[], options?: ApiErrorDetailOptions) => void;
|
|
933
961
|
extractMessage: (error: unknown, options?: ApiErrorDetailOptions) => string;
|
|
934
962
|
getResponse: (error: unknown) => ApiErrorResponse | undefined;
|
|
963
|
+
getResponseWithBody: (error: unknown) => ApiErrorResponse | undefined;
|
|
935
964
|
getStatus: (error: unknown) => ApiErrorStatus | undefined;
|
|
936
965
|
isRecord: (value: unknown) => value is Record<string, unknown>;
|
|
937
966
|
statusLabelFor: (status?: ApiErrorStatus, statusText?: string) => string;
|
|
@@ -958,6 +987,25 @@ declare let isApiErrorRecord: (value: unknown) => value is Record<string, unknow
|
|
|
958
987
|
declare let collectApiErrorDetails: (value: unknown, details: string[], options?: ApiErrorDetailOptions) => void;
|
|
959
988
|
declare let getApiErrorResponse: (error: unknown) => ApiErrorResponse | undefined;
|
|
960
989
|
declare let getApiErrorStatus: (error: unknown) => ApiErrorStatus | undefined;
|
|
990
|
+
declare let getApiErrorResponseWithBody: (error: unknown) => ApiErrorResponse | undefined;
|
|
991
|
+
declare let API_ERROR_MAX_DETAILS: number;
|
|
992
|
+
declare let API_ERROR_MAX_MESSAGE_LENGTH: number;
|
|
993
|
+
declare let API_ERROR_TRUNCATED_PLACEHOLDER: string;
|
|
994
|
+
declare let looksLikeHtmlErrorBody: (value: string) => boolean;
|
|
995
|
+
declare let truncateApiErrorMessage: (value: string, maxLength?: number) => string;
|
|
996
|
+
type ApiErrorTextOptions = {
|
|
997
|
+
includeNumbers?: boolean;
|
|
998
|
+
};
|
|
999
|
+
declare let readApiErrorText: (value: unknown, options?: ApiErrorTextOptions) => string | undefined;
|
|
1000
|
+
type BoundedApiErrorDetailOptions = ApiErrorTextOptions & {
|
|
1001
|
+
maxDetails?: number;
|
|
1002
|
+
field?: string;
|
|
1003
|
+
};
|
|
1004
|
+
declare let pushBoundedApiErrorDetail: (details: string[], value: unknown, options?: BoundedApiErrorDetailOptions) => void;
|
|
1005
|
+
type DecodeApiErrorBodyOptions = {
|
|
1006
|
+
maxBytes?: number;
|
|
1007
|
+
};
|
|
1008
|
+
declare let decodeApiErrorBody: (data: unknown, options?: DecodeApiErrorBodyOptions) => unknown;
|
|
961
1009
|
declare let statusLabelForApiError: (status?: ApiErrorStatus, statusText?: string) => string;
|
|
962
1010
|
declare let extractApiErrorMessage: (error: unknown, options?: ApiErrorDetailOptions & {
|
|
963
1011
|
response?: ApiErrorResponse;
|
|
@@ -968,7 +1016,7 @@ declare let createApiServiceError: (message: string, options?: {
|
|
|
968
1016
|
upstreamCode?: string;
|
|
969
1017
|
parent?: unknown;
|
|
970
1018
|
}) => ServiceError<ErrorRecord<"bad_request", 400>>;
|
|
971
|
-
declare let buildApiServiceError: (error: unknown, options: BuildApiServiceErrorOptions) => ServiceError<
|
|
1019
|
+
declare let buildApiServiceError: (error: unknown, options: BuildApiServiceErrorOptions) => ServiceError<any>;
|
|
972
1020
|
|
|
973
1021
|
declare class SlateError extends Error {
|
|
974
1022
|
cause?: unknown;
|
|
@@ -1094,6 +1142,8 @@ declare class Slate<ConfigType extends {}, AuthType extends {}> {
|
|
|
1094
1142
|
private readonly _actions;
|
|
1095
1143
|
private readonly _adapters;
|
|
1096
1144
|
private readonly _triggerGroups;
|
|
1145
|
+
private readonly _toolCategories;
|
|
1146
|
+
private readonly _toolCategoryKeysByActionKey;
|
|
1097
1147
|
private constructor();
|
|
1098
1148
|
static create<ConfigType extends {}, AuthType extends {}>(params: {
|
|
1099
1149
|
spec: SlateSpecification<ConfigType, AuthType>;
|
|
@@ -1101,11 +1151,14 @@ declare class Slate<ConfigType extends {}, AuthType extends {}> {
|
|
|
1101
1151
|
tools: SlateTool<ConfigType, AuthType, any, any>[];
|
|
1102
1152
|
adapters?: SlateAdapter<ConfigType, AuthType>[];
|
|
1103
1153
|
triggerGroups?: SlateTriggerGroup<ConfigType, AuthType>[];
|
|
1154
|
+
toolCategories?: SlateToolCategory[];
|
|
1104
1155
|
}): Slate<ConfigType, AuthType>;
|
|
1105
1156
|
get spec(): SlateSpecification<ConfigType, AuthType>;
|
|
1106
1157
|
get actions(): (SlateTrigger<ConfigType, AuthType, any, any> | SlateTool<ConfigType, AuthType, any, any>)[];
|
|
1107
1158
|
get adapters(): SlateAdapter<ConfigType, AuthType>[];
|
|
1108
1159
|
get triggerGroups(): SlateTriggerGroup<ConfigType, AuthType, Record<string, unknown>>[];
|
|
1160
|
+
get toolCategories(): SlateToolCategory[];
|
|
1161
|
+
getToolCategoryKeys(actionKey: string): string[];
|
|
1109
1162
|
}
|
|
1110
1163
|
|
|
1111
1164
|
declare const graphWebhookHttp: {
|
|
@@ -1139,4 +1192,4 @@ declare let skipWebhook: (reason: string, response?: Response | SlateWebhookHttp
|
|
|
1139
1192
|
response: Response | SlateWebhookHttpResponseInit;
|
|
1140
1193
|
};
|
|
1141
1194
|
|
|
1142
|
-
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 SlateGatewayEvent, 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 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, extractApiErrorMessage, getApiErrorResponse, getApiErrorStatus, getBase64ByteLength, getCurrentContext, getFileUrlTool, getFileUrlToolInputSchema, getFileUrlToolOutputSchema, getGraphWebhookValidationResponse, getMetaWebhookVerificationResponse, getOAuthExpiresAtFromExpiresIn, getResponseHeaderValue, getServiceErrorData, graphWebhookHttp, inferSlateErrorFromAxios, isApiErrorRecord, isAxiosErrorLike, isServiceErrorData, isUrlEmbeddedCredential, mapServiceErrorCode, mapServiceErrorToSlateErrorInput, mergeScopes, metaWebhookHttp, normalizeOAuthTokenResponse, pickDefined, publicTool, redactUrlAttachmentSecrets, requestAxios, requestAxiosData, runWithContext, scopeClause, setIfDefined, skipWebhook, spec, statusLabelForApiError, tool, trigger, triggerGroup, uploadAttachmentDirect, validateScopes, verifyHmacSignature };
|
|
1195
|
+
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 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, 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 };
|