@slates/provider 1.0.0-rc.2 → 1.0.0-rc.20
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 +2847 -2
- package/dist/index.d.cts +1019 -0
- package/dist/index.d.ts +1019 -9
- package/dist/index.module.js +2737 -2
- package/package.json +9 -6
- package/src/action/action.ts +92 -4
- package/src/action/attachment.ts +87 -0
- package/src/action/builder.test.ts +136 -0
- package/src/action/builder.ts +113 -15
- package/src/action/directUpload.ts +59 -0
- package/src/action/getFileUrlTool.ts +41 -0
- package/src/action/index.ts +4 -2
- package/src/action/publicTool.ts +36 -0
- package/src/action/scopes.test.ts +76 -0
- package/src/action/scopes.ts +103 -0
- package/src/action/tool.ts +22 -6
- package/src/action/trigger.ts +19 -11
- 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/auth/auth.ts +3 -3
- package/src/auth/index.ts +2 -0
- package/src/auth/oauth.test.ts +83 -0
- package/src/auth/oauth.ts +150 -0
- package/src/auth/redact.test.ts +103 -0
- package/src/auth/redact.ts +111 -0
- package/src/auth/types.ts +72 -13
- package/src/axios/http.test.ts +83 -0
- package/src/axios/index.ts +116 -10
- package/src/axios/trace.test.ts +377 -0
- package/src/axios/trace.ts +803 -0
- package/src/config/config.ts +14 -3
- package/src/context/context.ts +264 -17
- package/src/context/hook.test.ts +46 -0
- package/src/context/hook.ts +15 -6
- package/src/context/index.ts +1 -0
- package/src/context/pQueue.ts +4 -0
- package/src/crypto/hmac.test.ts +40 -0
- package/src/crypto/hmac.ts +32 -0
- package/src/crypto/index.ts +1 -0
- package/src/docs.ts +22 -0
- package/src/error/api.test.ts +114 -0
- package/src/error/api.ts +236 -0
- package/src/error/axios.ts +220 -0
- package/src/error/base.test.ts +178 -0
- package/src/error/base.ts +108 -2
- package/src/error/declaration.ts +7 -2
- package/src/error/defaults.ts +50 -0
- package/src/error/index.ts +4 -0
- package/src/error/service.ts +170 -0
- package/src/error/types.ts +75 -0
- package/src/error/utils.ts +157 -0
- package/src/file/index.test.ts +36 -0
- package/src/file/index.ts +27 -0
- package/src/index.ts +8 -0
- package/src/logger/logger.test.ts +57 -0
- package/src/logger/logger.ts +72 -11
- package/src/module/resolveDefaultExport.test.ts +32 -0
- package/src/module/resolveDefaultExport.ts +14 -0
- package/src/object/index.test.ts +38 -0
- package/src/object/index.ts +12 -0
- package/src/specification/slate.ts +40 -4
- package/src/specification/specification.ts +10 -6
- package/src/webhook/graph.test.ts +37 -0
- package/src/webhook/graph.ts +22 -0
- package/src/webhook/index.ts +2 -0
- package/src/webhook/meta.test.ts +52 -0
- package/src/webhook/meta.ts +43 -0
- package/dist/action/action.d.ts +0 -98
- package/dist/action/action.d.ts.map +0 -1
- package/dist/action/builder.d.ts +0 -27
- package/dist/action/builder.d.ts.map +0 -1
- package/dist/action/index.d.ts +0 -5
- package/dist/action/index.d.ts.map +0 -1
- package/dist/action/tool.d.ts +0 -14
- package/dist/action/tool.d.ts.map +0 -1
- package/dist/action/trigger.d.ts +0 -32
- package/dist/action/trigger.d.ts.map +0 -1
- package/dist/auth/auth.d.ts +0 -30
- package/dist/auth/auth.d.ts.map +0 -1
- package/dist/auth/index.d.ts +0 -3
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/auth/types.d.ts +0 -148
- package/dist/auth/types.d.ts.map +0 -1
- package/dist/axios/index.d.ts +0 -4
- package/dist/axios/index.d.ts.map +0 -1
- package/dist/config/config.d.ts +0 -26
- package/dist/config/config.d.ts.map +0 -1
- package/dist/config/index.d.ts +0 -2
- package/dist/config/index.d.ts.map +0 -1
- package/dist/context/context.d.ts +0 -20
- package/dist/context/context.d.ts.map +0 -1
- package/dist/context/hook.d.ts +0 -4
- package/dist/context/hook.d.ts.map +0 -1
- package/dist/context/index.d.ts +0 -2
- package/dist/context/index.d.ts.map +0 -1
- package/dist/error/base.d.ts +0 -5
- package/dist/error/base.d.ts.map +0 -1
- package/dist/error/declaration.d.ts +0 -6
- package/dist/error/declaration.d.ts.map +0 -1
- package/dist/error/index.d.ts +0 -3
- package/dist/error/index.d.ts.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.modern.js +0 -2
- package/dist/index.modern.js.map +0 -1
- package/dist/index.module.js.map +0 -1
- package/dist/index.umd.js +0 -2
- package/dist/index.umd.js.map +0 -1
- package/dist/logger/index.d.ts +0 -2
- package/dist/logger/index.d.ts.map +0 -1
- package/dist/logger/logger.d.ts +0 -20
- package/dist/logger/logger.d.ts.map +0 -1
- package/dist/specification/index.d.ts +0 -3
- package/dist/specification/index.d.ts.map +0 -1
- package/dist/specification/slate.d.ts +0 -15
- package/dist/specification/slate.d.ts.map +0 -1
- package/dist/specification/specification.d.ts +0 -30
- package/dist/specification/specification.d.ts.map +0 -1
- package/dist/specification/zero.d.ts +0 -13
- package/dist/specification/zero.d.ts.map +0 -1
- package/dist/tokens.d.ts +0 -34
- package/dist/tokens.d.ts.map +0 -1
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,1019 @@
|
|
|
1
|
+
import z, { z as z$1 } from 'zod';
|
|
2
|
+
import { AxiosResponse, AxiosError, CreateAxiosDefaults, AxiosInstance } from 'axios';
|
|
3
|
+
import { ServiceError, ErrorRecord, ErrorData } from '@lowerdeck/error';
|
|
4
|
+
|
|
5
|
+
interface SlateAttachmentUrlContent {
|
|
6
|
+
type: 'url';
|
|
7
|
+
url: string;
|
|
8
|
+
headers?: Record<string, string>;
|
|
9
|
+
query?: Record<string, string>;
|
|
10
|
+
refreshReference?: unknown;
|
|
11
|
+
refreshAt?: string;
|
|
12
|
+
}
|
|
13
|
+
interface SlateAttachmentInlineContent {
|
|
14
|
+
type: 'content';
|
|
15
|
+
encoding: 'base64' | 'utf-8';
|
|
16
|
+
content: string;
|
|
17
|
+
}
|
|
18
|
+
interface SlateAttachmentUploadReferenceContent {
|
|
19
|
+
type: 'upload_reference';
|
|
20
|
+
referenceId: string;
|
|
21
|
+
}
|
|
22
|
+
interface SlateAttachment {
|
|
23
|
+
mimeType?: string;
|
|
24
|
+
attachmentHash?: string;
|
|
25
|
+
content: SlateAttachmentUrlContent | SlateAttachmentInlineContent | SlateAttachmentUploadReferenceContent;
|
|
26
|
+
}
|
|
27
|
+
declare let createUrlAttachment: (url: string, opts?: {
|
|
28
|
+
mimeType?: string;
|
|
29
|
+
attachmentHash?: string;
|
|
30
|
+
headers?: Record<string, string>;
|
|
31
|
+
query?: Record<string, string>;
|
|
32
|
+
refreshReference?: unknown;
|
|
33
|
+
refreshAt?: string;
|
|
34
|
+
}) => SlateAttachment;
|
|
35
|
+
declare let createBase64Attachment: (content: string, mimeType?: string, attachmentHash?: string) => SlateAttachment;
|
|
36
|
+
declare let createTextAttachment: (content: string, mimeType?: string, attachmentHash?: string) => SlateAttachment;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Placeholder prefix used to mark a redacted auth-config secret. Must match the hub's
|
|
40
|
+
* AuthConfigSecretSerializer (oss/src/slates/apps/hub/src/lib/secretSerializer.ts) exactly --
|
|
41
|
+
* the hub resolves these placeholders back to live secret values when it proxies an attachment.
|
|
42
|
+
*/
|
|
43
|
+
declare let AUTH_CONFIG_SECRET_PLACEHOLDER_PREFIX: string;
|
|
44
|
+
/**
|
|
45
|
+
* Walks an auth config object and replaces any string value that exactly matches one of its
|
|
46
|
+
* leaf values with a `$$MT$secret$authConfig$<path>` placeholder. Literal, whole-value
|
|
47
|
+
* substitution only -- not a substring scan, and not a heuristic key-name/value-shape guess
|
|
48
|
+
* like the http trace redactor in '../axios/trace'.
|
|
49
|
+
*/
|
|
50
|
+
declare class AuthConfigSecretRedactor {
|
|
51
|
+
private readonly secretToPlaceholder;
|
|
52
|
+
constructor(authConfig: Record<string, unknown> | undefined);
|
|
53
|
+
redact<T>(value: T): T;
|
|
54
|
+
private buildSecretMap;
|
|
55
|
+
private transform;
|
|
56
|
+
private isPlainObject;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Applied to every finalized attachment list right before it's sent over
|
|
60
|
+
* `slates/action.tool.invoke` (see @slates/provider-handler). Only `type: 'url'` attachments
|
|
61
|
+
* carry headers/query -- content/upload_reference attachments pass through untouched.
|
|
62
|
+
*/
|
|
63
|
+
declare let redactUrlAttachmentSecrets: (attachments: SlateAttachment[] | undefined, authConfig: Record<string, unknown> | undefined) => SlateAttachment[] | undefined;
|
|
64
|
+
|
|
65
|
+
interface SlateHttpTraceTextBody {
|
|
66
|
+
contentType?: string;
|
|
67
|
+
text: string;
|
|
68
|
+
truncated?: boolean;
|
|
69
|
+
}
|
|
70
|
+
interface SlateHttpTrace {
|
|
71
|
+
startedAt: string;
|
|
72
|
+
durationMs: number;
|
|
73
|
+
request: {
|
|
74
|
+
method: string;
|
|
75
|
+
url: string;
|
|
76
|
+
headers?: Record<string, string>;
|
|
77
|
+
body?: SlateHttpTraceTextBody;
|
|
78
|
+
};
|
|
79
|
+
response?: {
|
|
80
|
+
status: number;
|
|
81
|
+
statusText?: string;
|
|
82
|
+
headers?: Record<string, string>;
|
|
83
|
+
body?: SlateHttpTraceTextBody;
|
|
84
|
+
};
|
|
85
|
+
error?: {
|
|
86
|
+
code?: string;
|
|
87
|
+
message: string;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
interface SlateLiveInvocationInfo {
|
|
92
|
+
token: string;
|
|
93
|
+
baseUrl: string;
|
|
94
|
+
maxAttachmentSizeBytes: number;
|
|
95
|
+
}
|
|
96
|
+
interface SlateDirectUploadInput {
|
|
97
|
+
live: SlateLiveInvocationInfo;
|
|
98
|
+
mimeType?: string;
|
|
99
|
+
filename?: string;
|
|
100
|
+
body: ReadableStream<Uint8Array> | Uint8Array;
|
|
101
|
+
}
|
|
102
|
+
declare let uploadAttachmentDirect: (d: SlateDirectUploadInput) => Promise<SlateAttachment>;
|
|
103
|
+
|
|
104
|
+
type SlateLogType = 'info' | 'warn' | 'error' | 'progress';
|
|
105
|
+
type SlateLogFields = Record<string, unknown>;
|
|
106
|
+
type SlateLogMessageInput = string | Error | boolean | number | null | undefined | object | SlateLogMessageInput[];
|
|
107
|
+
interface SlateLogEntry {
|
|
108
|
+
type: SlateLogType;
|
|
109
|
+
message: string;
|
|
110
|
+
timestamp: Date;
|
|
111
|
+
data?: SlateLogFields;
|
|
112
|
+
}
|
|
113
|
+
type SlateLogListener = (entries: SlateLogEntry[]) => void;
|
|
114
|
+
declare class SlateLogger {
|
|
115
|
+
#private;
|
|
116
|
+
constructor(listeners?: SlateLogListener[]);
|
|
117
|
+
private flush;
|
|
118
|
+
private scheduleFlush;
|
|
119
|
+
log(type: SlateLogType, message: SlateLogMessageInput): void;
|
|
120
|
+
info(...message: SlateLogMessageInput[]): void;
|
|
121
|
+
warn(...message: SlateLogMessageInput[]): void;
|
|
122
|
+
error(...message: SlateLogMessageInput[]): void;
|
|
123
|
+
progress(...message: SlateLogMessageInput[]): void;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
interface SlateDocsReference {
|
|
127
|
+
name: string;
|
|
128
|
+
url: string;
|
|
129
|
+
}
|
|
130
|
+
interface SlateTypedDocsReference<Type extends string> extends SlateDocsReference {
|
|
131
|
+
type?: Type;
|
|
132
|
+
}
|
|
133
|
+
type SlateProviderDocsReference = SlateDocsReference;
|
|
134
|
+
type SlateConfigDocsReference = SlateTypedDocsReference<'docs.config.general'>;
|
|
135
|
+
type SlateActionDocsReference = SlateTypedDocsReference<'docs.action.general'>;
|
|
136
|
+
type SlateAuthDocsReference = SlateTypedDocsReference<'docs.auth.oauth' | 'docs.auth.oauth_scopes' | 'docs.auth.token' | 'docs.auth.service_account' | 'docs.auth.custom'>;
|
|
137
|
+
|
|
138
|
+
type SlateAuthCallbackConfig = Record<string, any>;
|
|
139
|
+
type SlateAuthWithOauth<InputType extends {}, OutputType extends {
|
|
140
|
+
token: string;
|
|
141
|
+
refreshToken?: string;
|
|
142
|
+
expiresAt?: number | string | Date;
|
|
143
|
+
}> = {
|
|
144
|
+
type: 'auth.oauth';
|
|
145
|
+
name: string;
|
|
146
|
+
key: string;
|
|
147
|
+
scopes: {
|
|
148
|
+
title: string;
|
|
149
|
+
description?: string;
|
|
150
|
+
scope: string;
|
|
151
|
+
}[];
|
|
152
|
+
docs?: SlateAuthDocsReference[];
|
|
153
|
+
inputSchema?: z.ZodType<InputType>;
|
|
154
|
+
onInputChanged?: (params: {
|
|
155
|
+
previousInput: InputType | null;
|
|
156
|
+
newInput: InputType;
|
|
157
|
+
}) => Promise<{
|
|
158
|
+
input?: InputType;
|
|
159
|
+
} | undefined>;
|
|
160
|
+
getDefaultInput?: () => Promise<InputType>;
|
|
161
|
+
getAuthorizationUrl: (ctx: {
|
|
162
|
+
redirectUri: string;
|
|
163
|
+
state: string;
|
|
164
|
+
input: InputType;
|
|
165
|
+
clientId: string;
|
|
166
|
+
clientSecret: string;
|
|
167
|
+
scopes: string[];
|
|
168
|
+
config?: SlateAuthCallbackConfig;
|
|
169
|
+
}) => Promise<{
|
|
170
|
+
url: string;
|
|
171
|
+
input?: InputType;
|
|
172
|
+
callbackState?: Record<string, any>;
|
|
173
|
+
}>;
|
|
174
|
+
handleCallback: (ctx: {
|
|
175
|
+
code: string;
|
|
176
|
+
state: string;
|
|
177
|
+
redirectUri: string;
|
|
178
|
+
input: InputType;
|
|
179
|
+
clientId: string;
|
|
180
|
+
clientSecret: string;
|
|
181
|
+
scopes: string[];
|
|
182
|
+
callbackParams?: Record<string, string>;
|
|
183
|
+
callbackState: Record<string, any>;
|
|
184
|
+
config?: SlateAuthCallbackConfig;
|
|
185
|
+
}) => Promise<{
|
|
186
|
+
output: OutputType;
|
|
187
|
+
input?: InputType;
|
|
188
|
+
scopes?: string[];
|
|
189
|
+
}>;
|
|
190
|
+
handleTokenRefresh?: (ctx: {
|
|
191
|
+
output: OutputType;
|
|
192
|
+
input: InputType;
|
|
193
|
+
clientId: string;
|
|
194
|
+
clientSecret: string;
|
|
195
|
+
scopes: string[];
|
|
196
|
+
config?: SlateAuthCallbackConfig;
|
|
197
|
+
}) => Promise<{
|
|
198
|
+
output: OutputType;
|
|
199
|
+
input?: InputType;
|
|
200
|
+
}>;
|
|
201
|
+
getProfile?: (ctx: {
|
|
202
|
+
output: OutputType;
|
|
203
|
+
input: InputType;
|
|
204
|
+
scopes: string[];
|
|
205
|
+
config?: SlateAuthCallbackConfig;
|
|
206
|
+
}) => Promise<{
|
|
207
|
+
profile: Record<string, any>;
|
|
208
|
+
}>;
|
|
209
|
+
};
|
|
210
|
+
type SlateAuthWithToken<InputType extends {}, OutputType extends {
|
|
211
|
+
token?: string;
|
|
212
|
+
}> = {
|
|
213
|
+
type: 'auth.token';
|
|
214
|
+
name: string;
|
|
215
|
+
key: string;
|
|
216
|
+
inputSchema?: z.ZodType<InputType>;
|
|
217
|
+
docs?: SlateAuthDocsReference[];
|
|
218
|
+
getOutput: (ctx: {
|
|
219
|
+
input: InputType;
|
|
220
|
+
config?: SlateAuthCallbackConfig;
|
|
221
|
+
}) => Promise<{
|
|
222
|
+
output: OutputType;
|
|
223
|
+
scopes?: string[];
|
|
224
|
+
}>;
|
|
225
|
+
onInputChanged?: (params: {
|
|
226
|
+
previousInput: InputType;
|
|
227
|
+
newInput: InputType;
|
|
228
|
+
}) => Promise<{
|
|
229
|
+
input?: InputType;
|
|
230
|
+
} | undefined>;
|
|
231
|
+
getDefaultInput?: () => Promise<InputType>;
|
|
232
|
+
getProfile?: (ctx: {
|
|
233
|
+
output: OutputType;
|
|
234
|
+
input: InputType;
|
|
235
|
+
scopes: string[];
|
|
236
|
+
config?: SlateAuthCallbackConfig;
|
|
237
|
+
}) => Promise<{
|
|
238
|
+
profile: Record<string, any>;
|
|
239
|
+
}>;
|
|
240
|
+
};
|
|
241
|
+
type SlateAuthWithServiceAccount<InputType extends {}, OutputType extends {}> = {
|
|
242
|
+
type: 'auth.service_account';
|
|
243
|
+
name: string;
|
|
244
|
+
key: string;
|
|
245
|
+
inputSchema?: z.ZodType<InputType>;
|
|
246
|
+
docs?: SlateAuthDocsReference[];
|
|
247
|
+
getOutput: (ctx: {
|
|
248
|
+
input: InputType;
|
|
249
|
+
config?: SlateAuthCallbackConfig;
|
|
250
|
+
}) => Promise<{
|
|
251
|
+
output: OutputType;
|
|
252
|
+
scopes?: string[];
|
|
253
|
+
}>;
|
|
254
|
+
onInputChanged?: (params: {
|
|
255
|
+
previousInput: InputType;
|
|
256
|
+
newInput: InputType;
|
|
257
|
+
}) => Promise<{
|
|
258
|
+
input?: InputType;
|
|
259
|
+
} | undefined>;
|
|
260
|
+
getDefaultInput?: () => Promise<InputType>;
|
|
261
|
+
getProfile?: (ctx: {
|
|
262
|
+
output: OutputType;
|
|
263
|
+
input: InputType;
|
|
264
|
+
scopes: string[];
|
|
265
|
+
config?: SlateAuthCallbackConfig;
|
|
266
|
+
}) => Promise<{
|
|
267
|
+
profile: Record<string, any>;
|
|
268
|
+
}>;
|
|
269
|
+
};
|
|
270
|
+
type SlateAuthWithCustomData<InputType extends {}, OutputType extends {}> = {
|
|
271
|
+
type: 'auth.custom';
|
|
272
|
+
name: string;
|
|
273
|
+
key: string;
|
|
274
|
+
inputSchema?: z.ZodType<InputType>;
|
|
275
|
+
docs?: SlateAuthDocsReference[];
|
|
276
|
+
getOutput: (ctx: {
|
|
277
|
+
input: InputType;
|
|
278
|
+
config?: SlateAuthCallbackConfig;
|
|
279
|
+
}) => Promise<{
|
|
280
|
+
output: OutputType;
|
|
281
|
+
scopes?: string[];
|
|
282
|
+
}>;
|
|
283
|
+
handleTokenRefresh?: (ctx: {
|
|
284
|
+
output: OutputType;
|
|
285
|
+
input: InputType;
|
|
286
|
+
clientId: string;
|
|
287
|
+
clientSecret: string;
|
|
288
|
+
scopes: string[];
|
|
289
|
+
config?: SlateAuthCallbackConfig;
|
|
290
|
+
}) => Promise<{
|
|
291
|
+
output: OutputType;
|
|
292
|
+
input?: InputType;
|
|
293
|
+
}>;
|
|
294
|
+
onInputChanged?: (params: {
|
|
295
|
+
previousInput: InputType;
|
|
296
|
+
newInput: InputType;
|
|
297
|
+
}) => Promise<{
|
|
298
|
+
input?: InputType;
|
|
299
|
+
} | undefined>;
|
|
300
|
+
getDefaultInput?: () => Promise<InputType>;
|
|
301
|
+
getProfile?: (ctx: {
|
|
302
|
+
output: OutputType;
|
|
303
|
+
input: InputType;
|
|
304
|
+
scopes: string[];
|
|
305
|
+
config?: SlateAuthCallbackConfig;
|
|
306
|
+
}) => Promise<{
|
|
307
|
+
profile: Record<string, any>;
|
|
308
|
+
}>;
|
|
309
|
+
};
|
|
310
|
+
type SlateAuthWithNone<_InputType extends {}, _OutputType extends {}> = {
|
|
311
|
+
type: 'auth.none';
|
|
312
|
+
name: string;
|
|
313
|
+
key: string;
|
|
314
|
+
};
|
|
315
|
+
type SlateAuthType<InputType extends {}, OutputType extends {}> = SlateAuthWithOauth<InputType, OutputType & {
|
|
316
|
+
token: string;
|
|
317
|
+
}> | SlateAuthWithToken<InputType, OutputType & {
|
|
318
|
+
token?: string;
|
|
319
|
+
}> | SlateAuthWithServiceAccount<InputType, OutputType> | SlateAuthWithCustomData<InputType, OutputType> | SlateAuthWithNone<InputType, OutputType>;
|
|
320
|
+
|
|
321
|
+
declare class SlateAuth<OutputType extends {} = {}> {
|
|
322
|
+
#private;
|
|
323
|
+
private constructor();
|
|
324
|
+
static create<OutputType extends {}>(): SlateAuth<OutputType>;
|
|
325
|
+
output<NewOutputType extends {}>(schema: z.ZodType<NewOutputType>): SlateAuth<NewOutputType>;
|
|
326
|
+
private addAuth;
|
|
327
|
+
addOauth<InputType extends {}>(auth: SlateAuthType<InputType, OutputType> & {
|
|
328
|
+
type: 'auth.oauth';
|
|
329
|
+
}): SlateAuth<OutputType>;
|
|
330
|
+
addTokenAuth<InputType extends {}>(auth: SlateAuthType<InputType, OutputType> & {
|
|
331
|
+
type: 'auth.token';
|
|
332
|
+
}): SlateAuth<OutputType>;
|
|
333
|
+
addServiceAccountAuth<InputType extends {}>(auth: SlateAuthType<InputType, OutputType> & {
|
|
334
|
+
type: 'auth.service_account';
|
|
335
|
+
}): SlateAuth<OutputType>;
|
|
336
|
+
addCustomAuth<InputType extends {}>(auth: SlateAuthType<InputType, OutputType> & {
|
|
337
|
+
type: 'auth.custom';
|
|
338
|
+
}): SlateAuth<OutputType>;
|
|
339
|
+
addNone(): SlateAuth<OutputType>;
|
|
340
|
+
get authStack(): (SlateAuthWithOauth<any, OutputType & {
|
|
341
|
+
token: string;
|
|
342
|
+
}> | SlateAuthWithToken<any, OutputType & {
|
|
343
|
+
token?: string;
|
|
344
|
+
}> | SlateAuthWithServiceAccount<any, OutputType> | SlateAuthWithCustomData<any, OutputType>)[];
|
|
345
|
+
get outputSchema(): z.ZodType<OutputType, unknown, z.core.$ZodTypeInternals<OutputType, unknown>>;
|
|
346
|
+
}
|
|
347
|
+
declare let auth: <OutputType extends {} = {}>() => SlateAuth<OutputType>;
|
|
348
|
+
|
|
349
|
+
type OAuthTokenResponse = {
|
|
350
|
+
access_token?: unknown;
|
|
351
|
+
refresh_token?: unknown;
|
|
352
|
+
expires_in?: unknown;
|
|
353
|
+
[key: string]: unknown;
|
|
354
|
+
};
|
|
355
|
+
type OAuthRefreshTokenFallbackMode = 'nullish' | 'falsy';
|
|
356
|
+
type OAuthExpiresAtOptions = {
|
|
357
|
+
nowMs?: number;
|
|
358
|
+
providerLabel?: string;
|
|
359
|
+
operation?: string;
|
|
360
|
+
required?: boolean;
|
|
361
|
+
expiresInType?: 'number' | 'numberLike';
|
|
362
|
+
message?: string;
|
|
363
|
+
};
|
|
364
|
+
type NormalizeOAuthTokenResponseOptions = OAuthExpiresAtOptions & {
|
|
365
|
+
previousRefreshToken?: string;
|
|
366
|
+
refreshTokenFallbackMode?: OAuthRefreshTokenFallbackMode;
|
|
367
|
+
accessTokenMessage?: string;
|
|
368
|
+
expiresInMessage?: string;
|
|
369
|
+
};
|
|
370
|
+
declare let getOAuthExpiresAtFromExpiresIn: (expiresIn: unknown, options?: OAuthExpiresAtOptions) => string | undefined;
|
|
371
|
+
declare let normalizeOAuthTokenResponse: (data: unknown, options?: NormalizeOAuthTokenResponseOptions) => {
|
|
372
|
+
token: string;
|
|
373
|
+
refreshToken: string | undefined;
|
|
374
|
+
expiresAt: string | undefined;
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
declare class SlateConfig<ConfigType extends {}> {
|
|
378
|
+
#private;
|
|
379
|
+
private constructor();
|
|
380
|
+
static create<ConfigType extends {}>(schema: z.ZodType<ConfigType>): SlateConfig<ConfigType>;
|
|
381
|
+
config<NewConfigType extends {}>(schema: z.ZodType<NewConfigType>): SlateConfig<NewConfigType>;
|
|
382
|
+
docs(docs: SlateConfigDocsReference[]): SlateConfig<ConfigType>;
|
|
383
|
+
onConfigChanged(handler: (params: {
|
|
384
|
+
previousConfig: ConfigType | null;
|
|
385
|
+
newConfig: ConfigType;
|
|
386
|
+
}) => {
|
|
387
|
+
config: ConfigType | undefined;
|
|
388
|
+
} | undefined): SlateConfig<ConfigType>;
|
|
389
|
+
getDefaultConfig(getter: () => ConfigType): SlateConfig<ConfigType>;
|
|
390
|
+
get configSchema(): z.ZodType<ConfigType, unknown, z.core.$ZodTypeInternals<ConfigType, unknown>>;
|
|
391
|
+
get docsReferences(): SlateConfigDocsReference[] | undefined;
|
|
392
|
+
get handlers(): {
|
|
393
|
+
configChanged: ((params: {
|
|
394
|
+
previousConfig: ConfigType | null;
|
|
395
|
+
newConfig: ConfigType;
|
|
396
|
+
}) => {
|
|
397
|
+
config: ConfigType | undefined;
|
|
398
|
+
} | undefined) | null;
|
|
399
|
+
getDefaultConfig: (() => ConfigType) | null;
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
declare let config: <ConfigType extends {}>(schema: z.ZodType<ConfigType>) => SlateConfig<ConfigType>;
|
|
403
|
+
|
|
404
|
+
interface SlateSpecificationParameters {
|
|
405
|
+
key: string;
|
|
406
|
+
name: string;
|
|
407
|
+
description?: string;
|
|
408
|
+
docs?: SlateProviderDocsReference[];
|
|
409
|
+
metadata?: Record<string, any>;
|
|
410
|
+
}
|
|
411
|
+
interface SlateSpecificationCreateParameters<ConfigType extends {}, AuthType extends {}> extends SlateSpecificationParameters {
|
|
412
|
+
config: SlateConfig<ConfigType>;
|
|
413
|
+
auth: SlateAuth<AuthType>;
|
|
414
|
+
}
|
|
415
|
+
declare class SlateSpecification<ConfigType extends {}, AuthType extends {}> {
|
|
416
|
+
private readonly _config;
|
|
417
|
+
private readonly _auth;
|
|
418
|
+
private readonly _params;
|
|
419
|
+
private constructor();
|
|
420
|
+
static create<ConfigType extends {}, AuthType extends {}>(params: SlateSpecificationCreateParameters<ConfigType, AuthType>): SlateSpecification<ConfigType, AuthType>;
|
|
421
|
+
get configSchema(): z.ZodType<ConfigType, unknown, z.core.$ZodTypeInternals<ConfigType, unknown>>;
|
|
422
|
+
get authSchema(): z.ZodType<AuthType>;
|
|
423
|
+
get config(): SlateConfig<ConfigType>;
|
|
424
|
+
get auth(): SlateAuth<AuthType>;
|
|
425
|
+
get parameters(): SlateSpecificationParameters;
|
|
426
|
+
get key(): string;
|
|
427
|
+
get name(): string;
|
|
428
|
+
get description(): string | undefined;
|
|
429
|
+
get docs(): SlateDocsReference[] | undefined;
|
|
430
|
+
}
|
|
431
|
+
declare let spec: <ConfigType extends {}, AuthType extends {}>(params: SlateSpecificationCreateParameters<ConfigType, AuthType>) => SlateSpecification<ConfigType, AuthType>;
|
|
432
|
+
|
|
433
|
+
type SlateAddAttachmentContent = Buffer | Uint8Array | ArrayBuffer | ReadableStream<Uint8Array> | NodeJS.ReadableStream | Response;
|
|
434
|
+
type SlateAddAttachmentInput = {
|
|
435
|
+
type: 'url';
|
|
436
|
+
url: string | URL;
|
|
437
|
+
mimeType?: string;
|
|
438
|
+
filename?: string;
|
|
439
|
+
headers?: Record<string, string>;
|
|
440
|
+
query?: Record<string, string>;
|
|
441
|
+
refreshReference?: unknown;
|
|
442
|
+
refreshAt?: string;
|
|
443
|
+
} | {
|
|
444
|
+
type: 'content';
|
|
445
|
+
content: SlateAddAttachmentContent;
|
|
446
|
+
mimeType?: string;
|
|
447
|
+
filename?: string;
|
|
448
|
+
};
|
|
449
|
+
declare class SlatePublicContext<InputType extends {}> {
|
|
450
|
+
#private;
|
|
451
|
+
private readonly spec;
|
|
452
|
+
private readonly logger;
|
|
453
|
+
constructor(input: InputType, spec: SlateSpecification<any, any>, logger: SlateLogger, liveInvocation?: SlateLiveInvocationInfo | null);
|
|
454
|
+
get specification(): SlateSpecification<any, any>;
|
|
455
|
+
get input(): Readonly<InputType>;
|
|
456
|
+
get event(): Readonly<InputType>;
|
|
457
|
+
get state(): "state" extends keyof InputType ? InputType["state"] : never;
|
|
458
|
+
get request(): "request" extends keyof InputType ? InputType["request"] : never;
|
|
459
|
+
get registrationDetails(): "registrationDetails" extends keyof InputType ? InputType["registrationDetails"] : never;
|
|
460
|
+
recordHttpTrace(trace: SlateHttpTrace): void;
|
|
461
|
+
getHttpTraces(): {
|
|
462
|
+
error?: {
|
|
463
|
+
code?: string;
|
|
464
|
+
message: string;
|
|
465
|
+
};
|
|
466
|
+
response?: {
|
|
467
|
+
status: number;
|
|
468
|
+
statusText?: string;
|
|
469
|
+
headers?: Record<string, string>;
|
|
470
|
+
body?: SlateHttpTraceTextBody;
|
|
471
|
+
};
|
|
472
|
+
request: {
|
|
473
|
+
body?: SlateHttpTraceTextBody;
|
|
474
|
+
headers?: Record<string, string>;
|
|
475
|
+
method: string;
|
|
476
|
+
url: string;
|
|
477
|
+
};
|
|
478
|
+
startedAt: string;
|
|
479
|
+
durationMs: number;
|
|
480
|
+
}[];
|
|
481
|
+
info(message: SlateLogMessageInput): void;
|
|
482
|
+
warn(message: SlateLogMessageInput): void;
|
|
483
|
+
error(message: SlateLogMessageInput): void;
|
|
484
|
+
progress(message: SlateLogMessageInput): void;
|
|
485
|
+
addAttachment(input: SlateAddAttachmentInput): Promise<void>;
|
|
486
|
+
_finalizeAttachments(): Promise<SlateAttachment[]>;
|
|
487
|
+
_getAuthConfigForRedaction(): Record<string, unknown> | undefined;
|
|
488
|
+
}
|
|
489
|
+
declare class SlateContext<ConfigType extends {}, AuthType extends {}, InputType extends {}> extends SlatePublicContext<InputType> {
|
|
490
|
+
#private;
|
|
491
|
+
constructor(config: ConfigType, input: InputType, auth: AuthType, spec: SlateSpecification<ConfigType, AuthType>, logger: SlateLogger, liveInvocation?: SlateLiveInvocationInfo | null);
|
|
492
|
+
get config(): Readonly<ConfigType>;
|
|
493
|
+
get auth(): Readonly<AuthType>;
|
|
494
|
+
_getAuthConfigForRedaction(): Record<string, unknown> | undefined;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
declare let runWithContext: <InputType extends {}, RV>(context: SlatePublicContext<InputType>, fn: () => Promise<RV>) => Promise<RV>;
|
|
498
|
+
declare let getCurrentContext: <ConfigType extends {}, AuthType extends {}, InputType extends {}>() => SlateContext<ConfigType, AuthType, InputType>;
|
|
499
|
+
|
|
500
|
+
type SlateActionType = 'tool' | 'trigger';
|
|
501
|
+
interface SlateActionScopeClause {
|
|
502
|
+
OR: string[];
|
|
503
|
+
}
|
|
504
|
+
interface SlateActionScopes {
|
|
505
|
+
AND: SlateActionScopeClause[];
|
|
506
|
+
}
|
|
507
|
+
interface SlateActionParameters {
|
|
508
|
+
key: string;
|
|
509
|
+
name: string;
|
|
510
|
+
description?: string;
|
|
511
|
+
instructions?: string[];
|
|
512
|
+
constraints?: string[];
|
|
513
|
+
tags?: {
|
|
514
|
+
destructive?: boolean;
|
|
515
|
+
readOnly?: boolean;
|
|
516
|
+
[key: string]: boolean | undefined;
|
|
517
|
+
};
|
|
518
|
+
metadata?: Record<string, any>;
|
|
519
|
+
scopes?: SlateActionScopes;
|
|
520
|
+
authMethods?: string[];
|
|
521
|
+
docs?: SlateActionDocsReference[];
|
|
522
|
+
adapter?: string | null;
|
|
523
|
+
isPublic?: boolean;
|
|
524
|
+
}
|
|
525
|
+
type SlateToolInvocationHandler<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> = (context: SlateContext<ConfigType, AuthType, InputType>) => Promise<{
|
|
526
|
+
output: OutputType;
|
|
527
|
+
message: string;
|
|
528
|
+
attachments?: SlateAttachment[];
|
|
529
|
+
}>;
|
|
530
|
+
type SlatePublicToolInvocationHandler<InputType extends {}, OutputType extends {}> = (context: SlatePublicContext<InputType>) => Promise<{
|
|
531
|
+
output: OutputType;
|
|
532
|
+
message: string;
|
|
533
|
+
attachments?: SlateAttachment[];
|
|
534
|
+
}>;
|
|
535
|
+
type SlateTriggerMappingHandler<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> = (context: SlateContext<ConfigType, AuthType, InputType>) => Promise<{
|
|
536
|
+
type: string;
|
|
537
|
+
id: string;
|
|
538
|
+
output: OutputType;
|
|
539
|
+
}>;
|
|
540
|
+
type SlateTriggerPollingHandler<ConfigType extends {}, AuthType extends {}, InputType extends {}> = (context: SlateContext<ConfigType, AuthType, {
|
|
541
|
+
state: any | null;
|
|
542
|
+
}>) => Promise<{
|
|
543
|
+
inputs: InputType[];
|
|
544
|
+
updatedState?: any;
|
|
545
|
+
}>;
|
|
546
|
+
interface SlateWebhookHttpResponseInit {
|
|
547
|
+
status?: number;
|
|
548
|
+
headers?: Record<string, string>;
|
|
549
|
+
body?: string | Uint8Array | null;
|
|
550
|
+
}
|
|
551
|
+
type SlateWebhookHttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
|
|
552
|
+
interface SlateWebhookRequestMatcher {
|
|
553
|
+
method?: string;
|
|
554
|
+
hasQueryParam?: string;
|
|
555
|
+
hasHeader?: string;
|
|
556
|
+
jsonBodyField?: {
|
|
557
|
+
path: string;
|
|
558
|
+
equals?: string;
|
|
559
|
+
};
|
|
560
|
+
formBodyField?: {
|
|
561
|
+
path: string;
|
|
562
|
+
equals?: string;
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
interface SlateWebhookHttpOptions {
|
|
566
|
+
methods?: SlateWebhookHttpMethod[];
|
|
567
|
+
sync?: {
|
|
568
|
+
mode: 'never' | 'match' | 'always';
|
|
569
|
+
match?: SlateWebhookRequestMatcher[];
|
|
570
|
+
timeoutMs?: number;
|
|
571
|
+
};
|
|
572
|
+
}
|
|
573
|
+
type SlateTriggerWebhookRequestHandler<ConfigType extends {}, AuthType extends {}, InputType extends {}> = (context: SlateContext<ConfigType, AuthType, {
|
|
574
|
+
request: Request;
|
|
575
|
+
state: any | null;
|
|
576
|
+
registrationDetails: any | null;
|
|
577
|
+
}>) => Promise<{
|
|
578
|
+
inputs: InputType[];
|
|
579
|
+
updatedState?: any;
|
|
580
|
+
response?: Response | SlateWebhookHttpResponseInit;
|
|
581
|
+
}>;
|
|
582
|
+
type SlateTriggerWebhookAutoRegistrationHandler<ConfigType extends {}, AuthType extends {}> = (context: SlateContext<ConfigType, AuthType, {
|
|
583
|
+
webhookBaseUrl: string;
|
|
584
|
+
}>) => Promise<{
|
|
585
|
+
registrationDetails: any;
|
|
586
|
+
state?: any;
|
|
587
|
+
}>;
|
|
588
|
+
type SlateTriggerWebhookAutoUnregistrationHandler<ConfigType extends {}, AuthType extends {}> = (context: SlateContext<ConfigType, AuthType, {
|
|
589
|
+
webhookBaseUrl: string;
|
|
590
|
+
registrationDetails: any;
|
|
591
|
+
state: any | null;
|
|
592
|
+
}>) => Promise<unknown>;
|
|
593
|
+
interface SlateActionParametersTool<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> {
|
|
594
|
+
type: 'tool';
|
|
595
|
+
handleInvocation: SlateToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>;
|
|
596
|
+
}
|
|
597
|
+
interface SlatePollingOptions {
|
|
598
|
+
intervalInSeconds?: number;
|
|
599
|
+
}
|
|
600
|
+
interface SlateActionParametersTrigger<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> {
|
|
601
|
+
type: 'trigger';
|
|
602
|
+
source: 'polling' | 'webhook';
|
|
603
|
+
polling?: SlatePollingOptions;
|
|
604
|
+
handleEvent: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
|
|
605
|
+
handleRequest?: SlateTriggerWebhookRequestHandler<ConfigType, AuthType, InputType>;
|
|
606
|
+
http?: SlateWebhookHttpOptions;
|
|
607
|
+
pollEvents?: SlateTriggerPollingHandler<ConfigType, AuthType, InputType>;
|
|
608
|
+
autoRegisterWebhook?: SlateTriggerWebhookAutoRegistrationHandler<ConfigType, AuthType>;
|
|
609
|
+
autoUnregisterWebhook?: SlateTriggerWebhookAutoUnregistrationHandler<ConfigType, AuthType>;
|
|
610
|
+
}
|
|
611
|
+
type SlateActionParametersAny<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> = SlateActionParametersTool<ConfigType, AuthType, InputType, OutputType> | SlateActionParametersTrigger<ConfigType, AuthType, InputType, OutputType>;
|
|
612
|
+
type SlateActionCreateParameters<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> = SlateActionParametersAny<ConfigType, AuthType, InputType, OutputType> & SlateActionParameters & {
|
|
613
|
+
configSchema: z$1.ZodType<ConfigType>;
|
|
614
|
+
authSchema: z$1.ZodType<AuthType>;
|
|
615
|
+
inputSchema: z$1.ZodType<InputType>;
|
|
616
|
+
outputSchema: z$1.ZodType<OutputType>;
|
|
617
|
+
};
|
|
618
|
+
declare abstract class SlateAction<Type extends SlateActionType, ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> {
|
|
619
|
+
readonly type: Type;
|
|
620
|
+
protected readonly _spec: SlateSpecification<ConfigType, AuthType>;
|
|
621
|
+
protected readonly _inputSchema: z$1.ZodType<InputType>;
|
|
622
|
+
protected readonly _outputSchema: z$1.ZodType<OutputType>;
|
|
623
|
+
protected readonly _params: SlateActionParameters;
|
|
624
|
+
constructor(type: Type, _spec: SlateSpecification<ConfigType, AuthType>, _inputSchema: z$1.ZodType<InputType>, _outputSchema: z$1.ZodType<OutputType>, _params: SlateActionParameters);
|
|
625
|
+
get configSchema(): z$1.ZodType<ConfigType, unknown, z$1.core.$ZodTypeInternals<ConfigType, unknown>>;
|
|
626
|
+
get inputSchema(): z$1.ZodType<InputType, unknown, z$1.core.$ZodTypeInternals<InputType, unknown>>;
|
|
627
|
+
get outputSchema(): z$1.ZodType<OutputType, unknown, z$1.core.$ZodTypeInternals<OutputType, unknown>>;
|
|
628
|
+
get parameters(): SlateActionParameters;
|
|
629
|
+
get key(): string;
|
|
630
|
+
get name(): string;
|
|
631
|
+
get description(): string | undefined;
|
|
632
|
+
get tags(): {
|
|
633
|
+
[key: string]: boolean | undefined;
|
|
634
|
+
destructive?: boolean;
|
|
635
|
+
readOnly?: boolean;
|
|
636
|
+
} | undefined;
|
|
637
|
+
get instructions(): string[] | undefined;
|
|
638
|
+
get constraints(): string[] | undefined;
|
|
639
|
+
get metadata(): Record<string, any> | undefined;
|
|
640
|
+
get scopes(): SlateActionScopes | undefined;
|
|
641
|
+
get authMethods(): string[] | undefined;
|
|
642
|
+
get docs(): SlateActionDocsReference[] | undefined;
|
|
643
|
+
get adapter(): string | null;
|
|
644
|
+
get isPublic(): boolean;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
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> {
|
|
648
|
+
#private;
|
|
649
|
+
private readonly type;
|
|
650
|
+
readonly spec: SlateSpecification<ConfigType, AuthType>;
|
|
651
|
+
private readonly params;
|
|
652
|
+
private readonly factory;
|
|
653
|
+
private readonly isPublicTool;
|
|
654
|
+
constructor(type: Type, spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters, factory: (params: SlateActionCreateParameters<any, any, any, any>) => Result, isPublicTool?: IsPublic);
|
|
655
|
+
input<NewInputType extends {}>(schema: z.ZodType<NewInputType>): SlateActionBuilder<Type, ConfigType, AuthType, NewInputType, OutputType, Result, IsPublic>;
|
|
656
|
+
output<NewOutputType extends {}>(schema: z.ZodType<NewOutputType>): SlateActionBuilder<Type, ConfigType, AuthType, InputType, NewOutputType, Result, IsPublic>;
|
|
657
|
+
lockInterface(): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
|
|
658
|
+
scopes(scopes: SlateActionScopes): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
|
|
659
|
+
authMethods(authMethods: string[]): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
|
|
660
|
+
private validateAuthMethods;
|
|
661
|
+
handleInvocation(handler: IsPublic extends true ? SlatePublicToolInvocationHandler<InputType, OutputType> : SlateToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
|
|
662
|
+
webhook(props: {
|
|
663
|
+
handleEvent: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
|
|
664
|
+
handleRequest: SlateTriggerWebhookRequestHandler<ConfigType, AuthType, InputType>;
|
|
665
|
+
autoRegisterWebhook?: SlateTriggerWebhookAutoRegistrationHandler<ConfigType, AuthType>;
|
|
666
|
+
autoUnregisterWebhook?: SlateTriggerWebhookAutoUnregistrationHandler<ConfigType, AuthType>;
|
|
667
|
+
http?: SlateWebhookHttpOptions;
|
|
668
|
+
}): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
|
|
669
|
+
polling(props: {
|
|
670
|
+
options?: SlatePollingOptions;
|
|
671
|
+
pollEvents?: SlateTriggerPollingHandler<ConfigType, AuthType, InputType>;
|
|
672
|
+
handleEvent: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
|
|
673
|
+
}): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
|
|
674
|
+
build(): Result;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
interface SlateToolParameters<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> extends SlateActionParameters {
|
|
678
|
+
handleInvocation: SlateToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>;
|
|
679
|
+
}
|
|
680
|
+
declare class SlateTool<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> extends SlateAction<'tool', ConfigType, AuthType, InputType, OutputType> {
|
|
681
|
+
#private;
|
|
682
|
+
protected constructor(spec: SlateSpecification<ConfigType, AuthType>, inputSchema: z.ZodType<InputType>, outputSchema: z.ZodType<OutputType>, params: SlateToolParameters<ConfigType, AuthType, InputType, OutputType>);
|
|
683
|
+
static create<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters): SlateActionBuilder<"tool", ConfigType, AuthType, {}, {}, SlateTool<ConfigType, AuthType, any, any>, false>;
|
|
684
|
+
static fromCreateParameters<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: {
|
|
685
|
+
type: string;
|
|
686
|
+
inputSchema: z.ZodType<any>;
|
|
687
|
+
outputSchema: z.ZodType<any>;
|
|
688
|
+
handleInvocation?: SlateToolInvocationHandler<ConfigType, AuthType, any, any>;
|
|
689
|
+
} & SlateActionParameters): SlateTool<ConfigType, AuthType, any, any>;
|
|
690
|
+
get handleInvocation(): SlateToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>;
|
|
691
|
+
}
|
|
692
|
+
declare let tool: <ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters) => SlateActionBuilder<"tool", ConfigType, AuthType, {}, {}, SlateTool<ConfigType, AuthType, any, any>, false>;
|
|
693
|
+
|
|
694
|
+
declare let GET_FILE_URL_TOOL_ID: string;
|
|
695
|
+
declare let getFileUrlToolInputSchema: z$1.ZodObject<{
|
|
696
|
+
url: z$1.ZodString;
|
|
697
|
+
reference: z$1.ZodNullable<z$1.ZodAny>;
|
|
698
|
+
}, z$1.core.$strip>;
|
|
699
|
+
type GetFileUrlToolInput = z$1.infer<typeof getFileUrlToolInputSchema>;
|
|
700
|
+
declare let getFileUrlToolOutputSchema: z$1.ZodObject<{
|
|
701
|
+
url: z$1.ZodString;
|
|
702
|
+
expiresAt: z$1.ZodString;
|
|
703
|
+
headers: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
|
|
704
|
+
query: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
|
|
705
|
+
}, z$1.core.$strip>;
|
|
706
|
+
type GetFileUrlToolOutput = z$1.infer<typeof getFileUrlToolOutputSchema>;
|
|
707
|
+
type GetFileUrlHandler<ConfigType extends {}, AuthType extends {}> = (context: SlateContext<ConfigType, AuthType, GetFileUrlToolInput>) => Promise<GetFileUrlToolOutput>;
|
|
708
|
+
declare let getFileUrlTool: <ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, handleGetFileUrl: GetFileUrlHandler<ConfigType, AuthType>) => SlateTool<ConfigType, AuthType, any, any>;
|
|
709
|
+
|
|
710
|
+
interface SlatePublicToolParameters<InputType extends {}, OutputType extends {}> extends SlateActionParameters {
|
|
711
|
+
handleInvocation: SlatePublicToolInvocationHandler<InputType, OutputType>;
|
|
712
|
+
}
|
|
713
|
+
declare class SlatePublicTool {
|
|
714
|
+
private constructor();
|
|
715
|
+
static create<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters): SlateActionBuilder<"tool", ConfigType, AuthType, {}, {}, SlateTool<ConfigType, AuthType, any, any>, true>;
|
|
716
|
+
}
|
|
717
|
+
declare let publicTool: <ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters) => SlateActionBuilder<"tool", ConfigType, AuthType, {}, {}, SlateTool<ConfigType, AuthType, any, any>, true>;
|
|
718
|
+
|
|
719
|
+
type SlateActionScopeValue = string;
|
|
720
|
+
type SlateActionScopeClauseInput = SlateActionScopeValue | readonly SlateActionScopeValue[] | SlateActionScopeClause;
|
|
721
|
+
type SlateActionScopesInput = SlateActionScopeClauseInput | SlateActionScopes;
|
|
722
|
+
declare let scopeClause: (...scopes: SlateActionScopeValue[]) => SlateActionScopeClause;
|
|
723
|
+
declare let anyOf: (...scopes: SlateActionScopeValue[]) => SlateActionScopes;
|
|
724
|
+
declare let allOf: (...inputs: SlateActionScopesInput[]) => SlateActionScopes;
|
|
725
|
+
declare let mergeScopes: (...inputs: Array<SlateActionScopes | null | undefined | false>) => SlateActionScopes | undefined;
|
|
726
|
+
declare let validateScopes: (scopes: SlateActionScopes) => SlateActionScopes;
|
|
727
|
+
|
|
728
|
+
declare let SlateDefaultPollingIntervalSeconds: number;
|
|
729
|
+
interface SlateTriggerParameters<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {
|
|
730
|
+
type: string;
|
|
731
|
+
}> extends SlateActionParameters {
|
|
732
|
+
type: 'trigger';
|
|
733
|
+
source: 'polling' | 'webhook';
|
|
734
|
+
polling?: SlatePollingOptions;
|
|
735
|
+
handleEvent: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
|
|
736
|
+
handleRequest?: SlateTriggerWebhookRequestHandler<ConfigType, AuthType, InputType>;
|
|
737
|
+
http?: SlateWebhookHttpOptions;
|
|
738
|
+
pollEvents?: SlateTriggerPollingHandler<ConfigType, AuthType, InputType>;
|
|
739
|
+
autoRegisterWebhook?: SlateTriggerWebhookAutoRegistrationHandler<ConfigType, AuthType>;
|
|
740
|
+
autoUnregisterWebhook?: SlateTriggerWebhookAutoUnregistrationHandler<ConfigType, AuthType>;
|
|
741
|
+
}
|
|
742
|
+
declare class SlateTrigger<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {
|
|
743
|
+
type: string;
|
|
744
|
+
}> extends SlateAction<'trigger', ConfigType, AuthType, InputType, OutputType> {
|
|
745
|
+
#private;
|
|
746
|
+
private constructor();
|
|
747
|
+
static create<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters): SlateActionBuilder<"trigger", ConfigType, AuthType, {}, {}, SlateTrigger<ConfigType, AuthType, any, any>, false>;
|
|
748
|
+
get polling(): SlatePollingOptions;
|
|
749
|
+
get source(): "polling" | "webhook";
|
|
750
|
+
get handleEvent(): SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
|
|
751
|
+
get handleRequest(): SlateTriggerWebhookRequestHandler<ConfigType, AuthType, InputType> | undefined;
|
|
752
|
+
get http(): SlateWebhookHttpOptions | undefined;
|
|
753
|
+
get pollEvents(): SlateTriggerPollingHandler<ConfigType, AuthType, InputType> | undefined;
|
|
754
|
+
get autoRegisterWebhook(): SlateTriggerWebhookAutoRegistrationHandler<ConfigType, AuthType> | undefined;
|
|
755
|
+
get autoUnregisterWebhook(): SlateTriggerWebhookAutoUnregistrationHandler<ConfigType, AuthType> | undefined;
|
|
756
|
+
}
|
|
757
|
+
declare let trigger: <ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters) => SlateActionBuilder<"trigger", ConfigType, AuthType, {}, {}, SlateTrigger<ConfigType, AuthType, any, any>, false>;
|
|
758
|
+
|
|
759
|
+
interface SlateAdapterCapability {
|
|
760
|
+
id: string;
|
|
761
|
+
value: any;
|
|
762
|
+
}
|
|
763
|
+
interface SlateAdapterSpecParameters {
|
|
764
|
+
id: string;
|
|
765
|
+
name: string;
|
|
766
|
+
capabilities?: SlateAdapterCapability[];
|
|
767
|
+
}
|
|
768
|
+
declare class SlateAdapterSpec {
|
|
769
|
+
private readonly _params;
|
|
770
|
+
private constructor();
|
|
771
|
+
static create(params: SlateAdapterSpecParameters): SlateAdapterSpec;
|
|
772
|
+
get id(): string;
|
|
773
|
+
get name(): string;
|
|
774
|
+
get capabilities(): SlateAdapterCapability[];
|
|
775
|
+
get parameters(): {
|
|
776
|
+
id: string;
|
|
777
|
+
name: string;
|
|
778
|
+
capabilities: SlateAdapterCapability[];
|
|
779
|
+
};
|
|
780
|
+
tool<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters): SlateActionBuilder<"tool", ConfigType, AuthType, {}, {}, SlateTool<ConfigType, AuthType, any, any>, false>;
|
|
781
|
+
publicTool<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters): SlateActionBuilder<"tool", ConfigType, AuthType, {}, {}, SlateTool<ConfigType, AuthType, any, any>, true>;
|
|
782
|
+
trigger<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters): SlateActionBuilder<"trigger", ConfigType, AuthType, {}, {}, SlateTrigger<ConfigType, AuthType, any, any>, false>;
|
|
783
|
+
register<ConfigType extends {}, AuthType extends {}>(params: {
|
|
784
|
+
tools: SlateTool<ConfigType, AuthType, any, any>[];
|
|
785
|
+
triggers: SlateTrigger<ConfigType, AuthType, any, any>[];
|
|
786
|
+
}): SlateAdapter<ConfigType, AuthType>;
|
|
787
|
+
private linkAction;
|
|
788
|
+
}
|
|
789
|
+
declare let adapterSpec: (params: SlateAdapterSpecParameters) => SlateAdapterSpec;
|
|
790
|
+
|
|
791
|
+
declare class SlateAdapter<ConfigType extends {}, AuthType extends {}> {
|
|
792
|
+
private readonly _spec;
|
|
793
|
+
private readonly _tools;
|
|
794
|
+
private readonly _triggers;
|
|
795
|
+
constructor(_spec: SlateAdapterSpec, _tools: SlateTool<ConfigType, AuthType, any, any>[], _triggers: SlateTrigger<ConfigType, AuthType, any, any>[]);
|
|
796
|
+
get spec(): SlateAdapterSpec;
|
|
797
|
+
get id(): string;
|
|
798
|
+
get name(): string;
|
|
799
|
+
get capabilities(): SlateAdapterCapability[];
|
|
800
|
+
get tools(): SlateTool<ConfigType, AuthType, any, any>[];
|
|
801
|
+
get triggers(): SlateTrigger<ConfigType, AuthType, any, any>[];
|
|
802
|
+
get actions(): (SlateTrigger<ConfigType, AuthType, any, any> | SlateTool<ConfigType, AuthType, any, any>)[];
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
type ApiErrorStatus = number | string;
|
|
806
|
+
type ApiServiceError = ServiceError<ErrorRecord<any, any>>;
|
|
807
|
+
type ApiErrorResponse = {
|
|
808
|
+
status?: ApiErrorStatus;
|
|
809
|
+
statusText?: string;
|
|
810
|
+
data?: unknown;
|
|
811
|
+
};
|
|
812
|
+
type ApiErrorDetailOptions = {
|
|
813
|
+
detailKeys?: readonly string[];
|
|
814
|
+
nestedKeys?: readonly string[];
|
|
815
|
+
includeNumbers?: boolean;
|
|
816
|
+
separator?: string;
|
|
817
|
+
fallbackMessage?: string;
|
|
818
|
+
};
|
|
819
|
+
type ApiErrorBuildHelpers = {
|
|
820
|
+
collectDetails: (value: unknown, details: string[], options?: ApiErrorDetailOptions) => void;
|
|
821
|
+
extractMessage: (error: unknown, options?: ApiErrorDetailOptions) => string;
|
|
822
|
+
getResponse: (error: unknown) => ApiErrorResponse | undefined;
|
|
823
|
+
getStatus: (error: unknown) => ApiErrorStatus | undefined;
|
|
824
|
+
isRecord: (value: unknown) => value is Record<string, unknown>;
|
|
825
|
+
statusLabelFor: (status?: ApiErrorStatus, statusText?: string) => string;
|
|
826
|
+
};
|
|
827
|
+
type BuildApiServiceErrorOptions = ApiErrorDetailOptions & {
|
|
828
|
+
providerLabel: string;
|
|
829
|
+
reason: string;
|
|
830
|
+
operation?: string;
|
|
831
|
+
extractMessage?: (error: unknown, helpers: ApiErrorBuildHelpers) => string | undefined;
|
|
832
|
+
extractResponse?: (error: unknown, helpers: ApiErrorBuildHelpers) => ApiErrorResponse | undefined;
|
|
833
|
+
extractStatus?: (error: unknown, response: ApiErrorResponse | undefined, helpers: ApiErrorBuildHelpers) => ApiErrorStatus | undefined;
|
|
834
|
+
extractUpstreamCode?: (error: unknown, response: ApiErrorResponse | undefined, helpers: ApiErrorBuildHelpers) => string | undefined;
|
|
835
|
+
formatMessage?: (parts: {
|
|
836
|
+
providerLabel: string;
|
|
837
|
+
operation: string;
|
|
838
|
+
statusLabel: string;
|
|
839
|
+
message: string;
|
|
840
|
+
response?: ApiErrorResponse;
|
|
841
|
+
status?: ApiErrorStatus;
|
|
842
|
+
}) => string;
|
|
843
|
+
parent?: unknown;
|
|
844
|
+
};
|
|
845
|
+
declare let isApiErrorRecord: (value: unknown) => value is Record<string, unknown>;
|
|
846
|
+
declare let collectApiErrorDetails: (value: unknown, details: string[], options?: ApiErrorDetailOptions) => void;
|
|
847
|
+
declare let getApiErrorResponse: (error: unknown) => ApiErrorResponse | undefined;
|
|
848
|
+
declare let getApiErrorStatus: (error: unknown) => ApiErrorStatus | undefined;
|
|
849
|
+
declare let statusLabelForApiError: (status?: ApiErrorStatus, statusText?: string) => string;
|
|
850
|
+
declare let extractApiErrorMessage: (error: unknown, options?: ApiErrorDetailOptions & {
|
|
851
|
+
response?: ApiErrorResponse;
|
|
852
|
+
}) => string;
|
|
853
|
+
declare let createApiServiceError: (message: string, options?: {
|
|
854
|
+
reason?: string;
|
|
855
|
+
upstreamStatus?: ApiErrorStatus;
|
|
856
|
+
upstreamCode?: string;
|
|
857
|
+
parent?: unknown;
|
|
858
|
+
}) => ServiceError<ErrorRecord<"bad_request", 400>>;
|
|
859
|
+
declare let buildApiServiceError: (error: unknown, options: BuildApiServiceErrorOptions) => ServiceError<ErrorRecord<"bad_request", 400>>;
|
|
860
|
+
|
|
861
|
+
declare class SlateError extends Error {
|
|
862
|
+
cause?: unknown;
|
|
863
|
+
data: SlateErrorResponse;
|
|
864
|
+
constructor(input: SlateErrorInput);
|
|
865
|
+
get code(): string;
|
|
866
|
+
get kind(): SlateErrorKind;
|
|
867
|
+
get status(): number | undefined;
|
|
868
|
+
get retryable(): boolean | undefined;
|
|
869
|
+
toResponse(): SlateErrorResponse;
|
|
870
|
+
toJSON(): SlateErrorResponse;
|
|
871
|
+
static is(error: unknown): error is SlateError;
|
|
872
|
+
static fromUnknown(error: unknown, defaults?: Partial<SlateErrorResponse>): SlateError;
|
|
873
|
+
static fromServiceError(error: unknown, defaults?: Partial<SlateErrorInput>): SlateError;
|
|
874
|
+
static fromAxios(error: unknown, options?: SlateAxiosErrorOptions): SlateError;
|
|
875
|
+
}
|
|
876
|
+
declare let createSlateError: (input: SlateErrorInput) => SlateError;
|
|
877
|
+
|
|
878
|
+
type SlateErrorKind = 'declaration' | 'validation' | 'request' | 'auth' | 'config' | 'resource' | 'payment' | 'upstream' | 'transport' | 'internal';
|
|
879
|
+
interface SlateErrorIssue {
|
|
880
|
+
path?: string[];
|
|
881
|
+
code?: string;
|
|
882
|
+
message: string;
|
|
883
|
+
[key: string]: unknown;
|
|
884
|
+
}
|
|
885
|
+
interface SlateErrorProviderInfo {
|
|
886
|
+
key?: string;
|
|
887
|
+
service?: string;
|
|
888
|
+
operation?: string;
|
|
889
|
+
}
|
|
890
|
+
interface SlateErrorUpstreamInfo {
|
|
891
|
+
status?: number;
|
|
892
|
+
code?: string;
|
|
893
|
+
type?: string;
|
|
894
|
+
requestId?: string;
|
|
895
|
+
method?: string;
|
|
896
|
+
url?: string;
|
|
897
|
+
}
|
|
898
|
+
interface SlateErrorResponse {
|
|
899
|
+
code: string;
|
|
900
|
+
message: string;
|
|
901
|
+
kind: SlateErrorKind;
|
|
902
|
+
retryable?: boolean;
|
|
903
|
+
status?: number;
|
|
904
|
+
issues?: SlateErrorIssue[];
|
|
905
|
+
provider?: SlateErrorProviderInfo;
|
|
906
|
+
upstream?: SlateErrorUpstreamInfo;
|
|
907
|
+
baggage?: Record<string, unknown>;
|
|
908
|
+
requestTraces?: SlateHttpTrace[];
|
|
909
|
+
}
|
|
910
|
+
interface SlateErrorInput extends Omit<SlateErrorResponse, 'kind'> {
|
|
911
|
+
kind?: SlateErrorKind;
|
|
912
|
+
cause?: unknown;
|
|
913
|
+
}
|
|
914
|
+
interface SlateAxiosErrorOptions {
|
|
915
|
+
defaults?: Partial<SlateErrorResponse>;
|
|
916
|
+
extractResponseData?: (response: AxiosResponse) => unknown;
|
|
917
|
+
mapAxiosError?: (error: AxiosError, inferred: SlateErrorResponse) => SlateError | Partial<SlateErrorResponse> | undefined;
|
|
918
|
+
}
|
|
919
|
+
interface SlateServiceErrorData {
|
|
920
|
+
status: number;
|
|
921
|
+
code: string;
|
|
922
|
+
message: string;
|
|
923
|
+
hint?: string;
|
|
924
|
+
description?: string;
|
|
925
|
+
reason?: string;
|
|
926
|
+
errors?: unknown;
|
|
927
|
+
[key: string]: unknown;
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
declare let isAxiosErrorLike: (error: unknown) => error is AxiosError;
|
|
931
|
+
declare let inferSlateErrorFromAxios: (error: AxiosError, options?: SlateAxiosErrorOptions) => SlateErrorResponse;
|
|
932
|
+
|
|
933
|
+
declare class SlateDeclarationError extends SlateError {
|
|
934
|
+
constructor(message: string, input?: Partial<SlateError['data']>);
|
|
935
|
+
static is(error: unknown): error is SlateDeclarationError;
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
declare let mapServiceErrorCode: (code: string, status?: number) => string;
|
|
939
|
+
declare let isServiceErrorData: (value: unknown) => value is SlateServiceErrorData;
|
|
940
|
+
declare let getServiceErrorData: (error: unknown) => SlateServiceErrorData | null;
|
|
941
|
+
declare let mapServiceErrorToSlateErrorInput: (error: ServiceError<ErrorRecord<any, any>> | ErrorRecord<any, any> | ErrorData<any, any> | SlateServiceErrorData, defaults?: Partial<SlateErrorInput>) => SlateErrorInput;
|
|
942
|
+
|
|
943
|
+
interface SlateAxiosDefaults extends CreateAxiosDefaults {
|
|
944
|
+
errorMapping?: SlateAxiosErrorOptions;
|
|
945
|
+
}
|
|
946
|
+
type SlateAxiosErrorAdapter = (error: unknown, operation: string) => unknown;
|
|
947
|
+
interface SlateAuthenticatedAxiosDefaults extends SlateAxiosDefaults {
|
|
948
|
+
authHeader?: {
|
|
949
|
+
name?: string;
|
|
950
|
+
value: string;
|
|
951
|
+
};
|
|
952
|
+
contentType?: string | false;
|
|
953
|
+
errorAdapter?: (error: unknown) => unknown;
|
|
954
|
+
}
|
|
955
|
+
declare let createAxios: (config?: SlateAxiosDefaults) => AxiosInstance;
|
|
956
|
+
declare let createAuthenticatedAxios: (config: SlateAuthenticatedAxiosDefaults) => AxiosInstance;
|
|
957
|
+
declare let requestAxios: <T = unknown>(operation: string, request: () => Promise<AxiosResponse<T>>, errorAdapter: SlateAxiosErrorAdapter) => Promise<AxiosResponse<T, any, {}>>;
|
|
958
|
+
declare let requestAxiosData: <T = unknown>(operation: string, request: () => Promise<AxiosResponse<T>>, errorAdapter: SlateAxiosErrorAdapter) => Promise<T>;
|
|
959
|
+
declare let axios: AxiosInstance;
|
|
960
|
+
|
|
961
|
+
interface CreateHmacSignatureOptions {
|
|
962
|
+
secret: string | Uint8Array;
|
|
963
|
+
payload: string | Uint8Array;
|
|
964
|
+
algorithm?: string;
|
|
965
|
+
digest: 'hex' | 'base64';
|
|
966
|
+
prefix?: string;
|
|
967
|
+
}
|
|
968
|
+
interface VerifyHmacSignatureOptions extends CreateHmacSignatureOptions {
|
|
969
|
+
signature: string;
|
|
970
|
+
}
|
|
971
|
+
declare let createHmacSignature: ({ secret, payload, algorithm, digest, prefix }: CreateHmacSignatureOptions) => string;
|
|
972
|
+
declare let verifyHmacSignature: (options: VerifyHmacSignatureOptions) => boolean;
|
|
973
|
+
|
|
974
|
+
declare let getResponseHeaderValue: (headers: unknown, name: string) => string | undefined;
|
|
975
|
+
declare let getBase64ByteLength: (contentBase64: string) => number;
|
|
976
|
+
|
|
977
|
+
declare let pickDefined: <T extends object>(value: T) => Partial<T> & Record<string, unknown>;
|
|
978
|
+
declare let setIfDefined: (target: Record<string, unknown>, key: string, value: unknown) => Record<string, unknown>;
|
|
979
|
+
|
|
980
|
+
declare class Slate<ConfigType extends {}, AuthType extends {}> {
|
|
981
|
+
private readonly _spec;
|
|
982
|
+
private readonly _actions;
|
|
983
|
+
private readonly _adapters;
|
|
984
|
+
private constructor();
|
|
985
|
+
static create<ConfigType extends {}, AuthType extends {}>(params: {
|
|
986
|
+
spec: SlateSpecification<ConfigType, AuthType>;
|
|
987
|
+
triggers: SlateTrigger<ConfigType, AuthType, any, any>[];
|
|
988
|
+
tools: SlateTool<ConfigType, AuthType, any, any>[];
|
|
989
|
+
adapters?: SlateAdapter<ConfigType, AuthType>[];
|
|
990
|
+
}): Slate<ConfigType, AuthType>;
|
|
991
|
+
get spec(): SlateSpecification<ConfigType, AuthType>;
|
|
992
|
+
get actions(): (SlateTrigger<ConfigType, AuthType, any, any> | SlateTool<ConfigType, AuthType, any, any>)[];
|
|
993
|
+
get adapters(): SlateAdapter<ConfigType, AuthType>[];
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
declare const graphWebhookHttp: {
|
|
997
|
+
methods: "POST"[];
|
|
998
|
+
sync: {
|
|
999
|
+
mode: "match";
|
|
1000
|
+
match: {
|
|
1001
|
+
hasQueryParam: string;
|
|
1002
|
+
}[];
|
|
1003
|
+
};
|
|
1004
|
+
};
|
|
1005
|
+
declare let getGraphWebhookValidationResponse: (request: Request) => SlateWebhookHttpResponseInit | null;
|
|
1006
|
+
|
|
1007
|
+
declare const metaWebhookHttp: {
|
|
1008
|
+
methods: ("POST" | "GET")[];
|
|
1009
|
+
sync: {
|
|
1010
|
+
mode: "match";
|
|
1011
|
+
match: {
|
|
1012
|
+
method: string;
|
|
1013
|
+
hasQueryParam: string;
|
|
1014
|
+
}[];
|
|
1015
|
+
};
|
|
1016
|
+
};
|
|
1017
|
+
declare let getMetaWebhookVerificationResponse: (request: Request, expectedVerifyToken: string | undefined) => SlateWebhookHttpResponseInit | null;
|
|
1018
|
+
|
|
1019
|
+
export { AUTH_CONFIG_SECRET_PLACEHOLDER_PREFIX, type ApiErrorBuildHelpers, type ApiErrorDetailOptions, type ApiErrorResponse, type ApiErrorStatus, type ApiServiceError, AuthConfigSecretRedactor, type BuildApiServiceErrorOptions, type CreateHmacSignatureOptions, GET_FILE_URL_TOOL_ID, type GetFileUrlHandler, type GetFileUrlToolInput, type GetFileUrlToolOutput, type NormalizeOAuthTokenResponseOptions, type OAuthExpiresAtOptions, type OAuthRefreshTokenFallbackMode, type OAuthTokenResponse, Slate, SlateAction, SlateActionBuilder, type SlateActionCreateParameters, type SlateActionDocsReference, type SlateActionParameters, type SlateActionParametersAny, type SlateActionParametersTool, type SlateActionParametersTrigger, type SlateActionScopeClause, type SlateActionScopeClauseInput, type SlateActionScopeValue, type SlateActionScopes, type SlateActionScopesInput, type SlateActionType, SlateAdapter, type SlateAdapterCapability, SlateAdapterSpec, type SlateAdapterSpecParameters, type SlateAddAttachmentContent, type SlateAddAttachmentInput, type SlateAttachment, type SlateAttachmentInlineContent, type SlateAttachmentUploadReferenceContent, type SlateAttachmentUrlContent, SlateAuth, type SlateAuthDocsReference, type SlateAuthType, type SlateAuthWithCustomData, type SlateAuthWithNone, type SlateAuthWithOauth, type SlateAuthWithServiceAccount, type SlateAuthWithToken, type SlateAuthenticatedAxiosDefaults, type SlateAxiosDefaults, type SlateAxiosErrorAdapter, type SlateAxiosErrorOptions, SlateConfig, type SlateConfigDocsReference, SlateContext, SlateDeclarationError, SlateDefaultPollingIntervalSeconds, type SlateDirectUploadInput, type SlateDocsReference, SlateError, type SlateErrorInput, type SlateErrorIssue, type SlateErrorKind, type SlateErrorProviderInfo, type SlateErrorResponse, type SlateErrorUpstreamInfo, type SlateLiveInvocationInfo, type SlateLogEntry, type SlateLogFields, type SlateLogListener, type SlateLogMessageInput, type SlateLogType, SlateLogger, type 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, getFileUrlTool, getFileUrlToolInputSchema, getFileUrlToolOutputSchema, getGraphWebhookValidationResponse, getMetaWebhookVerificationResponse, getOAuthExpiresAtFromExpiresIn, getResponseHeaderValue, getServiceErrorData, graphWebhookHttp, inferSlateErrorFromAxios, isApiErrorRecord, isAxiosErrorLike, isServiceErrorData, mapServiceErrorCode, mapServiceErrorToSlateErrorInput, mergeScopes, metaWebhookHttp, normalizeOAuthTokenResponse, pickDefined, publicTool, redactUrlAttachmentSecrets, requestAxios, requestAxiosData, runWithContext, scopeClause, setIfDefined, spec, statusLabelForApiError, tool, trigger, uploadAttachmentDirect, validateScopes, verifyHmacSignature };
|