@slates/provider 1.0.0-rc.14 → 1.0.0-rc.15
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 +14 -0
- package/dist/index.d.cts +23 -14
- package/dist/index.d.ts +23 -14
- package/dist/index.module.js +14 -0
- package/package.json +1 -1
- package/src/action/action.ts +6 -0
- package/src/auth/types.ts +5 -13
- package/src/config/config.ts +11 -0
- package/src/docs.ts +22 -0
- package/src/index.ts +1 -0
- package/src/specification/specification.ts +6 -0
package/dist/index.cjs
CHANGED
|
@@ -119,6 +119,9 @@ var SlateAction = class {
|
|
|
119
119
|
get scopes() {
|
|
120
120
|
return this._params.scopes;
|
|
121
121
|
}
|
|
122
|
+
get docs() {
|
|
123
|
+
return this._params.docs;
|
|
124
|
+
}
|
|
122
125
|
};
|
|
123
126
|
|
|
124
127
|
// src/error/axios.ts
|
|
@@ -1585,6 +1588,7 @@ var axios = createAxios();
|
|
|
1585
1588
|
// src/config/config.ts
|
|
1586
1589
|
var SlateConfig = class _SlateConfig {
|
|
1587
1590
|
#configSchema;
|
|
1591
|
+
#docs;
|
|
1588
1592
|
#configChanged = null;
|
|
1589
1593
|
#getDefaultConfig = null;
|
|
1590
1594
|
constructor(schema) {
|
|
@@ -1597,6 +1601,10 @@ var SlateConfig = class _SlateConfig {
|
|
|
1597
1601
|
this.#configSchema = schema;
|
|
1598
1602
|
return this;
|
|
1599
1603
|
}
|
|
1604
|
+
docs(docs) {
|
|
1605
|
+
this.#docs = docs;
|
|
1606
|
+
return this;
|
|
1607
|
+
}
|
|
1600
1608
|
onConfigChanged(handler) {
|
|
1601
1609
|
this.#configChanged = handler;
|
|
1602
1610
|
return this;
|
|
@@ -1608,6 +1616,9 @@ var SlateConfig = class _SlateConfig {
|
|
|
1608
1616
|
get configSchema() {
|
|
1609
1617
|
return this.#configSchema;
|
|
1610
1618
|
}
|
|
1619
|
+
get docsReferences() {
|
|
1620
|
+
return this.#docs;
|
|
1621
|
+
}
|
|
1611
1622
|
get handlers() {
|
|
1612
1623
|
return {
|
|
1613
1624
|
configChanged: this.#configChanged,
|
|
@@ -1840,6 +1851,9 @@ var SlateSpecification = class _SlateSpecification {
|
|
|
1840
1851
|
get description() {
|
|
1841
1852
|
return this._params.description;
|
|
1842
1853
|
}
|
|
1854
|
+
get docs() {
|
|
1855
|
+
return this._params.docs;
|
|
1856
|
+
}
|
|
1843
1857
|
};
|
|
1844
1858
|
var spec = (params) => SlateSpecification.create(params);
|
|
1845
1859
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.d.cts
CHANGED
|
@@ -50,6 +50,18 @@ declare class SlateLogger {
|
|
|
50
50
|
progress(...message: SlateLogMessageInput[]): void;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
interface SlateDocsReference {
|
|
54
|
+
name: string;
|
|
55
|
+
url: string;
|
|
56
|
+
}
|
|
57
|
+
interface SlateTypedDocsReference<Type extends string> extends SlateDocsReference {
|
|
58
|
+
type?: Type;
|
|
59
|
+
}
|
|
60
|
+
type SlateProviderDocsReference = SlateDocsReference;
|
|
61
|
+
type SlateConfigDocsReference = SlateTypedDocsReference<'docs.config.general'>;
|
|
62
|
+
type SlateActionDocsReference = SlateTypedDocsReference<'docs.action.general'>;
|
|
63
|
+
type SlateAuthDocsReference = SlateTypedDocsReference<'docs.auth.oauth' | 'docs.auth.oauth_scopes' | 'docs.auth.token' | 'docs.auth.service_account' | 'docs.auth.custom'>;
|
|
64
|
+
|
|
53
65
|
type SlateAuthCallbackConfig = Record<string, any>;
|
|
54
66
|
type SlateAuthWithOauth<InputType extends {}, OutputType extends {
|
|
55
67
|
token: string;
|
|
@@ -65,10 +77,7 @@ type SlateAuthWithOauth<InputType extends {}, OutputType extends {
|
|
|
65
77
|
defaultChecked?: boolean;
|
|
66
78
|
scope: string;
|
|
67
79
|
}[];
|
|
68
|
-
docs?:
|
|
69
|
-
oauthDocsLink?: string;
|
|
70
|
-
oauthScopesLink?: string;
|
|
71
|
-
};
|
|
80
|
+
docs?: SlateAuthDocsReference[];
|
|
72
81
|
inputSchema?: z.ZodType<InputType>;
|
|
73
82
|
onInputChanged?: (params: {
|
|
74
83
|
previousInput: InputType | null;
|
|
@@ -133,9 +142,7 @@ type SlateAuthWithToken<InputType extends {}, OutputType extends {
|
|
|
133
142
|
name: string;
|
|
134
143
|
key: string;
|
|
135
144
|
inputSchema?: z.ZodType<InputType>;
|
|
136
|
-
docs?:
|
|
137
|
-
tokenDocsLink?: string;
|
|
138
|
-
};
|
|
145
|
+
docs?: SlateAuthDocsReference[];
|
|
139
146
|
getOutput: (ctx: {
|
|
140
147
|
input: InputType;
|
|
141
148
|
}) => Promise<{
|
|
@@ -160,9 +167,7 @@ type SlateAuthWithServiceAccount<InputType extends {}, OutputType extends {}> =
|
|
|
160
167
|
name: string;
|
|
161
168
|
key: string;
|
|
162
169
|
inputSchema?: z.ZodType<InputType>;
|
|
163
|
-
docs?:
|
|
164
|
-
serviceAccountDocsLink?: string;
|
|
165
|
-
};
|
|
170
|
+
docs?: SlateAuthDocsReference[];
|
|
166
171
|
getOutput: (ctx: {
|
|
167
172
|
input: InputType;
|
|
168
173
|
}) => Promise<{
|
|
@@ -187,9 +192,7 @@ type SlateAuthWithCustomData<InputType extends {}, OutputType extends {}> = {
|
|
|
187
192
|
name: string;
|
|
188
193
|
key: string;
|
|
189
194
|
inputSchema?: z.ZodType<InputType>;
|
|
190
|
-
docs?:
|
|
191
|
-
customAuthDocsLink?: string;
|
|
192
|
-
};
|
|
195
|
+
docs?: SlateAuthDocsReference[];
|
|
193
196
|
getOutput: (ctx: {
|
|
194
197
|
input: InputType;
|
|
195
198
|
}) => Promise<{
|
|
@@ -263,6 +266,7 @@ declare class SlateConfig<ConfigType extends {}> {
|
|
|
263
266
|
private constructor();
|
|
264
267
|
static create<ConfigType extends {}>(schema: z.ZodType<ConfigType>): SlateConfig<ConfigType>;
|
|
265
268
|
config<NewConfigType extends {}>(schema: z.ZodType<NewConfigType>): SlateConfig<NewConfigType>;
|
|
269
|
+
docs(docs: SlateConfigDocsReference[]): SlateConfig<ConfigType>;
|
|
266
270
|
onConfigChanged(handler: (params: {
|
|
267
271
|
previousConfig: ConfigType | null;
|
|
268
272
|
newConfig: ConfigType;
|
|
@@ -271,6 +275,7 @@ declare class SlateConfig<ConfigType extends {}> {
|
|
|
271
275
|
} | undefined): SlateConfig<ConfigType>;
|
|
272
276
|
getDefaultConfig(getter: () => ConfigType): SlateConfig<ConfigType>;
|
|
273
277
|
get configSchema(): z.ZodType<ConfigType, unknown, z.core.$ZodTypeInternals<ConfigType, unknown>>;
|
|
278
|
+
get docsReferences(): SlateConfigDocsReference[] | undefined;
|
|
274
279
|
get handlers(): {
|
|
275
280
|
configChanged: ((params: {
|
|
276
281
|
previousConfig: ConfigType | null;
|
|
@@ -287,6 +292,7 @@ interface SlateSpecificationParameters {
|
|
|
287
292
|
key: string;
|
|
288
293
|
name: string;
|
|
289
294
|
description?: string;
|
|
295
|
+
docs?: SlateProviderDocsReference[];
|
|
290
296
|
metadata?: Record<string, any>;
|
|
291
297
|
}
|
|
292
298
|
interface SlateSpecificationCreateParameters<ConfigType extends {}, AuthType extends {}> extends SlateSpecificationParameters {
|
|
@@ -307,6 +313,7 @@ declare class SlateSpecification<ConfigType extends {}, AuthType extends {}> {
|
|
|
307
313
|
get key(): string;
|
|
308
314
|
get name(): string;
|
|
309
315
|
get description(): string | undefined;
|
|
316
|
+
get docs(): SlateDocsReference[] | undefined;
|
|
310
317
|
}
|
|
311
318
|
declare let spec: <ConfigType extends {}, AuthType extends {}>(params: SlateSpecificationCreateParameters<ConfigType, AuthType>) => SlateSpecification<ConfigType, AuthType>;
|
|
312
319
|
|
|
@@ -389,6 +396,7 @@ interface SlateActionParameters {
|
|
|
389
396
|
};
|
|
390
397
|
metadata?: Record<string, any>;
|
|
391
398
|
scopes?: SlateActionScopes;
|
|
399
|
+
docs?: SlateActionDocsReference[];
|
|
392
400
|
}
|
|
393
401
|
type SlateToolInvocationHandler<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> = (context: SlateContext<ConfigType, AuthType, InputType>) => Promise<{
|
|
394
402
|
output: OutputType;
|
|
@@ -471,6 +479,7 @@ declare abstract class SlateAction<Type extends SlateActionType, ConfigType exte
|
|
|
471
479
|
get constraints(): string[] | undefined;
|
|
472
480
|
get metadata(): Record<string, any> | undefined;
|
|
473
481
|
get scopes(): SlateActionScopes | undefined;
|
|
482
|
+
get docs(): SlateActionDocsReference[] | undefined;
|
|
474
483
|
}
|
|
475
484
|
|
|
476
485
|
declare class SlateActionBuilder<Type extends SlateActionType, ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}, Result extends SlateAction<Type, ConfigType, AuthType, any, any>> {
|
|
@@ -648,4 +657,4 @@ declare class Slate<ConfigType extends {}, AuthType extends {}> {
|
|
|
648
657
|
get actions(): (SlateTrigger<ConfigType, AuthType, any, any> | SlateTool<ConfigType, AuthType, any, any>)[];
|
|
649
658
|
}
|
|
650
659
|
|
|
651
|
-
export { Slate, SlateAction, SlateActionBuilder, type SlateActionCreateParameters, type SlateActionParameters, type SlateActionParametersAny, type SlateActionParametersTool, type SlateActionParametersTrigger, type SlateActionScopeClause, type SlateActionScopeClauseInput, type SlateActionScopeValue, type SlateActionScopes, type SlateActionScopesInput, type SlateActionType, type SlateAttachment, type SlateAttachmentInlineContent, type SlateAttachmentUrlContent, SlateAuth, type SlateAuthType, type SlateAuthWithCustomData, type SlateAuthWithNone, type SlateAuthWithOauth, type SlateAuthWithServiceAccount, type SlateAuthWithToken, type SlateAxiosDefaults, type SlateAxiosErrorOptions, SlateConfig, SlateContext, SlateDeclarationError, SlateDefaultPollingIntervalSeconds, SlateError, type SlateErrorInput, type SlateErrorIssue, type SlateErrorKind, type SlateErrorProviderInfo, type SlateErrorResponse, type SlateErrorUpstreamInfo, type SlateLogEntry, type SlateLogFields, type SlateLogListener, type SlateLogMessageInput, type SlateLogType, SlateLogger, type SlatePollingOptions, type SlateServiceErrorData, SlateSpecification, type SlateSpecificationCreateParameters, type SlateSpecificationParameters, SlateTool, type SlateToolInvocationHandler, type SlateToolParameters, SlateTrigger, type SlateTriggerMappingHandler, type SlateTriggerParameters, type SlateTriggerPollingHandler, type SlateTriggerWebhookAutoRegistrationHandler, type SlateTriggerWebhookAutoUnregistrationHandler, type SlateTriggerWebhookRequestHandler, allOf, anyOf, auth, axios, config, createAxios, createBase64Attachment, createSlateError, createTextAttachment, createUrlAttachment, getCurrentContext, getServiceErrorData, inferSlateErrorFromAxios, isAxiosErrorLike, isServiceErrorData, mapServiceErrorCode, mapServiceErrorToSlateErrorInput, mergeScopes, runWithContext, scopeClause, spec, tool, trigger, validateScopes };
|
|
660
|
+
export { Slate, SlateAction, SlateActionBuilder, type SlateActionCreateParameters, type SlateActionDocsReference, type SlateActionParameters, type SlateActionParametersAny, type SlateActionParametersTool, type SlateActionParametersTrigger, type SlateActionScopeClause, type SlateActionScopeClauseInput, type SlateActionScopeValue, type SlateActionScopes, type SlateActionScopesInput, type SlateActionType, type SlateAttachment, type SlateAttachmentInlineContent, type SlateAttachmentUrlContent, SlateAuth, type SlateAuthDocsReference, type SlateAuthType, type SlateAuthWithCustomData, type SlateAuthWithNone, type SlateAuthWithOauth, type SlateAuthWithServiceAccount, type SlateAuthWithToken, type SlateAxiosDefaults, type SlateAxiosErrorOptions, SlateConfig, type SlateConfigDocsReference, SlateContext, SlateDeclarationError, SlateDefaultPollingIntervalSeconds, type SlateDocsReference, SlateError, type SlateErrorInput, type SlateErrorIssue, type SlateErrorKind, type SlateErrorProviderInfo, type SlateErrorResponse, type SlateErrorUpstreamInfo, type SlateLogEntry, type SlateLogFields, type SlateLogListener, type SlateLogMessageInput, type SlateLogType, SlateLogger, type SlatePollingOptions, type SlateProviderDocsReference, type SlateServiceErrorData, SlateSpecification, type SlateSpecificationCreateParameters, type SlateSpecificationParameters, SlateTool, type SlateToolInvocationHandler, type SlateToolParameters, SlateTrigger, type SlateTriggerMappingHandler, type SlateTriggerParameters, type SlateTriggerPollingHandler, type SlateTriggerWebhookAutoRegistrationHandler, type SlateTriggerWebhookAutoUnregistrationHandler, type SlateTriggerWebhookRequestHandler, type SlateTypedDocsReference, allOf, anyOf, auth, axios, config, createAxios, createBase64Attachment, createSlateError, createTextAttachment, createUrlAttachment, getCurrentContext, getServiceErrorData, inferSlateErrorFromAxios, isAxiosErrorLike, isServiceErrorData, mapServiceErrorCode, mapServiceErrorToSlateErrorInput, mergeScopes, runWithContext, scopeClause, spec, tool, trigger, validateScopes };
|
package/dist/index.d.ts
CHANGED
|
@@ -50,6 +50,18 @@ declare class SlateLogger {
|
|
|
50
50
|
progress(...message: SlateLogMessageInput[]): void;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
interface SlateDocsReference {
|
|
54
|
+
name: string;
|
|
55
|
+
url: string;
|
|
56
|
+
}
|
|
57
|
+
interface SlateTypedDocsReference<Type extends string> extends SlateDocsReference {
|
|
58
|
+
type?: Type;
|
|
59
|
+
}
|
|
60
|
+
type SlateProviderDocsReference = SlateDocsReference;
|
|
61
|
+
type SlateConfigDocsReference = SlateTypedDocsReference<'docs.config.general'>;
|
|
62
|
+
type SlateActionDocsReference = SlateTypedDocsReference<'docs.action.general'>;
|
|
63
|
+
type SlateAuthDocsReference = SlateTypedDocsReference<'docs.auth.oauth' | 'docs.auth.oauth_scopes' | 'docs.auth.token' | 'docs.auth.service_account' | 'docs.auth.custom'>;
|
|
64
|
+
|
|
53
65
|
type SlateAuthCallbackConfig = Record<string, any>;
|
|
54
66
|
type SlateAuthWithOauth<InputType extends {}, OutputType extends {
|
|
55
67
|
token: string;
|
|
@@ -65,10 +77,7 @@ type SlateAuthWithOauth<InputType extends {}, OutputType extends {
|
|
|
65
77
|
defaultChecked?: boolean;
|
|
66
78
|
scope: string;
|
|
67
79
|
}[];
|
|
68
|
-
docs?:
|
|
69
|
-
oauthDocsLink?: string;
|
|
70
|
-
oauthScopesLink?: string;
|
|
71
|
-
};
|
|
80
|
+
docs?: SlateAuthDocsReference[];
|
|
72
81
|
inputSchema?: z.ZodType<InputType>;
|
|
73
82
|
onInputChanged?: (params: {
|
|
74
83
|
previousInput: InputType | null;
|
|
@@ -133,9 +142,7 @@ type SlateAuthWithToken<InputType extends {}, OutputType extends {
|
|
|
133
142
|
name: string;
|
|
134
143
|
key: string;
|
|
135
144
|
inputSchema?: z.ZodType<InputType>;
|
|
136
|
-
docs?:
|
|
137
|
-
tokenDocsLink?: string;
|
|
138
|
-
};
|
|
145
|
+
docs?: SlateAuthDocsReference[];
|
|
139
146
|
getOutput: (ctx: {
|
|
140
147
|
input: InputType;
|
|
141
148
|
}) => Promise<{
|
|
@@ -160,9 +167,7 @@ type SlateAuthWithServiceAccount<InputType extends {}, OutputType extends {}> =
|
|
|
160
167
|
name: string;
|
|
161
168
|
key: string;
|
|
162
169
|
inputSchema?: z.ZodType<InputType>;
|
|
163
|
-
docs?:
|
|
164
|
-
serviceAccountDocsLink?: string;
|
|
165
|
-
};
|
|
170
|
+
docs?: SlateAuthDocsReference[];
|
|
166
171
|
getOutput: (ctx: {
|
|
167
172
|
input: InputType;
|
|
168
173
|
}) => Promise<{
|
|
@@ -187,9 +192,7 @@ type SlateAuthWithCustomData<InputType extends {}, OutputType extends {}> = {
|
|
|
187
192
|
name: string;
|
|
188
193
|
key: string;
|
|
189
194
|
inputSchema?: z.ZodType<InputType>;
|
|
190
|
-
docs?:
|
|
191
|
-
customAuthDocsLink?: string;
|
|
192
|
-
};
|
|
195
|
+
docs?: SlateAuthDocsReference[];
|
|
193
196
|
getOutput: (ctx: {
|
|
194
197
|
input: InputType;
|
|
195
198
|
}) => Promise<{
|
|
@@ -263,6 +266,7 @@ declare class SlateConfig<ConfigType extends {}> {
|
|
|
263
266
|
private constructor();
|
|
264
267
|
static create<ConfigType extends {}>(schema: z.ZodType<ConfigType>): SlateConfig<ConfigType>;
|
|
265
268
|
config<NewConfigType extends {}>(schema: z.ZodType<NewConfigType>): SlateConfig<NewConfigType>;
|
|
269
|
+
docs(docs: SlateConfigDocsReference[]): SlateConfig<ConfigType>;
|
|
266
270
|
onConfigChanged(handler: (params: {
|
|
267
271
|
previousConfig: ConfigType | null;
|
|
268
272
|
newConfig: ConfigType;
|
|
@@ -271,6 +275,7 @@ declare class SlateConfig<ConfigType extends {}> {
|
|
|
271
275
|
} | undefined): SlateConfig<ConfigType>;
|
|
272
276
|
getDefaultConfig(getter: () => ConfigType): SlateConfig<ConfigType>;
|
|
273
277
|
get configSchema(): z.ZodType<ConfigType, unknown, z.core.$ZodTypeInternals<ConfigType, unknown>>;
|
|
278
|
+
get docsReferences(): SlateConfigDocsReference[] | undefined;
|
|
274
279
|
get handlers(): {
|
|
275
280
|
configChanged: ((params: {
|
|
276
281
|
previousConfig: ConfigType | null;
|
|
@@ -287,6 +292,7 @@ interface SlateSpecificationParameters {
|
|
|
287
292
|
key: string;
|
|
288
293
|
name: string;
|
|
289
294
|
description?: string;
|
|
295
|
+
docs?: SlateProviderDocsReference[];
|
|
290
296
|
metadata?: Record<string, any>;
|
|
291
297
|
}
|
|
292
298
|
interface SlateSpecificationCreateParameters<ConfigType extends {}, AuthType extends {}> extends SlateSpecificationParameters {
|
|
@@ -307,6 +313,7 @@ declare class SlateSpecification<ConfigType extends {}, AuthType extends {}> {
|
|
|
307
313
|
get key(): string;
|
|
308
314
|
get name(): string;
|
|
309
315
|
get description(): string | undefined;
|
|
316
|
+
get docs(): SlateDocsReference[] | undefined;
|
|
310
317
|
}
|
|
311
318
|
declare let spec: <ConfigType extends {}, AuthType extends {}>(params: SlateSpecificationCreateParameters<ConfigType, AuthType>) => SlateSpecification<ConfigType, AuthType>;
|
|
312
319
|
|
|
@@ -389,6 +396,7 @@ interface SlateActionParameters {
|
|
|
389
396
|
};
|
|
390
397
|
metadata?: Record<string, any>;
|
|
391
398
|
scopes?: SlateActionScopes;
|
|
399
|
+
docs?: SlateActionDocsReference[];
|
|
392
400
|
}
|
|
393
401
|
type SlateToolInvocationHandler<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> = (context: SlateContext<ConfigType, AuthType, InputType>) => Promise<{
|
|
394
402
|
output: OutputType;
|
|
@@ -471,6 +479,7 @@ declare abstract class SlateAction<Type extends SlateActionType, ConfigType exte
|
|
|
471
479
|
get constraints(): string[] | undefined;
|
|
472
480
|
get metadata(): Record<string, any> | undefined;
|
|
473
481
|
get scopes(): SlateActionScopes | undefined;
|
|
482
|
+
get docs(): SlateActionDocsReference[] | undefined;
|
|
474
483
|
}
|
|
475
484
|
|
|
476
485
|
declare class SlateActionBuilder<Type extends SlateActionType, ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}, Result extends SlateAction<Type, ConfigType, AuthType, any, any>> {
|
|
@@ -648,4 +657,4 @@ declare class Slate<ConfigType extends {}, AuthType extends {}> {
|
|
|
648
657
|
get actions(): (SlateTrigger<ConfigType, AuthType, any, any> | SlateTool<ConfigType, AuthType, any, any>)[];
|
|
649
658
|
}
|
|
650
659
|
|
|
651
|
-
export { Slate, SlateAction, SlateActionBuilder, type SlateActionCreateParameters, type SlateActionParameters, type SlateActionParametersAny, type SlateActionParametersTool, type SlateActionParametersTrigger, type SlateActionScopeClause, type SlateActionScopeClauseInput, type SlateActionScopeValue, type SlateActionScopes, type SlateActionScopesInput, type SlateActionType, type SlateAttachment, type SlateAttachmentInlineContent, type SlateAttachmentUrlContent, SlateAuth, type SlateAuthType, type SlateAuthWithCustomData, type SlateAuthWithNone, type SlateAuthWithOauth, type SlateAuthWithServiceAccount, type SlateAuthWithToken, type SlateAxiosDefaults, type SlateAxiosErrorOptions, SlateConfig, SlateContext, SlateDeclarationError, SlateDefaultPollingIntervalSeconds, SlateError, type SlateErrorInput, type SlateErrorIssue, type SlateErrorKind, type SlateErrorProviderInfo, type SlateErrorResponse, type SlateErrorUpstreamInfo, type SlateLogEntry, type SlateLogFields, type SlateLogListener, type SlateLogMessageInput, type SlateLogType, SlateLogger, type SlatePollingOptions, type SlateServiceErrorData, SlateSpecification, type SlateSpecificationCreateParameters, type SlateSpecificationParameters, SlateTool, type SlateToolInvocationHandler, type SlateToolParameters, SlateTrigger, type SlateTriggerMappingHandler, type SlateTriggerParameters, type SlateTriggerPollingHandler, type SlateTriggerWebhookAutoRegistrationHandler, type SlateTriggerWebhookAutoUnregistrationHandler, type SlateTriggerWebhookRequestHandler, allOf, anyOf, auth, axios, config, createAxios, createBase64Attachment, createSlateError, createTextAttachment, createUrlAttachment, getCurrentContext, getServiceErrorData, inferSlateErrorFromAxios, isAxiosErrorLike, isServiceErrorData, mapServiceErrorCode, mapServiceErrorToSlateErrorInput, mergeScopes, runWithContext, scopeClause, spec, tool, trigger, validateScopes };
|
|
660
|
+
export { Slate, SlateAction, SlateActionBuilder, type SlateActionCreateParameters, type SlateActionDocsReference, type SlateActionParameters, type SlateActionParametersAny, type SlateActionParametersTool, type SlateActionParametersTrigger, type SlateActionScopeClause, type SlateActionScopeClauseInput, type SlateActionScopeValue, type SlateActionScopes, type SlateActionScopesInput, type SlateActionType, type SlateAttachment, type SlateAttachmentInlineContent, type SlateAttachmentUrlContent, SlateAuth, type SlateAuthDocsReference, type SlateAuthType, type SlateAuthWithCustomData, type SlateAuthWithNone, type SlateAuthWithOauth, type SlateAuthWithServiceAccount, type SlateAuthWithToken, type SlateAxiosDefaults, type SlateAxiosErrorOptions, SlateConfig, type SlateConfigDocsReference, SlateContext, SlateDeclarationError, SlateDefaultPollingIntervalSeconds, type SlateDocsReference, SlateError, type SlateErrorInput, type SlateErrorIssue, type SlateErrorKind, type SlateErrorProviderInfo, type SlateErrorResponse, type SlateErrorUpstreamInfo, type SlateLogEntry, type SlateLogFields, type SlateLogListener, type SlateLogMessageInput, type SlateLogType, SlateLogger, type SlatePollingOptions, type SlateProviderDocsReference, type SlateServiceErrorData, SlateSpecification, type SlateSpecificationCreateParameters, type SlateSpecificationParameters, SlateTool, type SlateToolInvocationHandler, type SlateToolParameters, SlateTrigger, type SlateTriggerMappingHandler, type SlateTriggerParameters, type SlateTriggerPollingHandler, type SlateTriggerWebhookAutoRegistrationHandler, type SlateTriggerWebhookAutoUnregistrationHandler, type SlateTriggerWebhookRequestHandler, type SlateTypedDocsReference, allOf, anyOf, auth, axios, config, createAxios, createBase64Attachment, createSlateError, createTextAttachment, createUrlAttachment, getCurrentContext, getServiceErrorData, inferSlateErrorFromAxios, isAxiosErrorLike, isServiceErrorData, mapServiceErrorCode, mapServiceErrorToSlateErrorInput, mergeScopes, runWithContext, scopeClause, spec, tool, trigger, validateScopes };
|
package/dist/index.module.js
CHANGED
|
@@ -48,6 +48,9 @@ var SlateAction = class {
|
|
|
48
48
|
get scopes() {
|
|
49
49
|
return this._params.scopes;
|
|
50
50
|
}
|
|
51
|
+
get docs() {
|
|
52
|
+
return this._params.docs;
|
|
53
|
+
}
|
|
51
54
|
};
|
|
52
55
|
|
|
53
56
|
// src/error/axios.ts
|
|
@@ -1514,6 +1517,7 @@ var axios = createAxios();
|
|
|
1514
1517
|
// src/config/config.ts
|
|
1515
1518
|
var SlateConfig = class _SlateConfig {
|
|
1516
1519
|
#configSchema;
|
|
1520
|
+
#docs;
|
|
1517
1521
|
#configChanged = null;
|
|
1518
1522
|
#getDefaultConfig = null;
|
|
1519
1523
|
constructor(schema) {
|
|
@@ -1526,6 +1530,10 @@ var SlateConfig = class _SlateConfig {
|
|
|
1526
1530
|
this.#configSchema = schema;
|
|
1527
1531
|
return this;
|
|
1528
1532
|
}
|
|
1533
|
+
docs(docs) {
|
|
1534
|
+
this.#docs = docs;
|
|
1535
|
+
return this;
|
|
1536
|
+
}
|
|
1529
1537
|
onConfigChanged(handler) {
|
|
1530
1538
|
this.#configChanged = handler;
|
|
1531
1539
|
return this;
|
|
@@ -1537,6 +1545,9 @@ var SlateConfig = class _SlateConfig {
|
|
|
1537
1545
|
get configSchema() {
|
|
1538
1546
|
return this.#configSchema;
|
|
1539
1547
|
}
|
|
1548
|
+
get docsReferences() {
|
|
1549
|
+
return this.#docs;
|
|
1550
|
+
}
|
|
1540
1551
|
get handlers() {
|
|
1541
1552
|
return {
|
|
1542
1553
|
configChanged: this.#configChanged,
|
|
@@ -1769,6 +1780,9 @@ var SlateSpecification = class _SlateSpecification {
|
|
|
1769
1780
|
get description() {
|
|
1770
1781
|
return this._params.description;
|
|
1771
1782
|
}
|
|
1783
|
+
get docs() {
|
|
1784
|
+
return this._params.docs;
|
|
1785
|
+
}
|
|
1772
1786
|
};
|
|
1773
1787
|
var spec = (params) => SlateSpecification.create(params);
|
|
1774
1788
|
export {
|
package/package.json
CHANGED
package/src/action/action.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { z } from 'zod';
|
|
2
2
|
import type { SlateContext } from '../context';
|
|
3
|
+
import type { SlateActionDocsReference } from '../docs';
|
|
3
4
|
import type { SlateSpecification } from '../specification/specification';
|
|
4
5
|
import type { SlateAttachment } from './attachment';
|
|
5
6
|
|
|
@@ -26,6 +27,7 @@ export interface SlateActionParameters {
|
|
|
26
27
|
};
|
|
27
28
|
metadata?: Record<string, any>;
|
|
28
29
|
scopes?: SlateActionScopes;
|
|
30
|
+
docs?: SlateActionDocsReference[];
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
export type SlateToolInvocationHandler<
|
|
@@ -203,4 +205,8 @@ export abstract class SlateAction<
|
|
|
203
205
|
get scopes() {
|
|
204
206
|
return this._params.scopes;
|
|
205
207
|
}
|
|
208
|
+
|
|
209
|
+
get docs() {
|
|
210
|
+
return this._params.docs;
|
|
211
|
+
}
|
|
206
212
|
}
|
package/src/auth/types.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type z from 'zod';
|
|
2
|
+
import type { SlateAuthDocsReference } from '../docs';
|
|
2
3
|
|
|
3
4
|
type SlateAuthCallbackConfig = Record<string, any>;
|
|
4
5
|
|
|
@@ -22,10 +23,7 @@ export type SlateAuthWithOauth<
|
|
|
22
23
|
scope: string;
|
|
23
24
|
}[];
|
|
24
25
|
|
|
25
|
-
docs?:
|
|
26
|
-
oauthDocsLink?: string;
|
|
27
|
-
oauthScopesLink?: string;
|
|
28
|
-
};
|
|
26
|
+
docs?: SlateAuthDocsReference[];
|
|
29
27
|
|
|
30
28
|
inputSchema?: z.ZodType<InputType>;
|
|
31
29
|
|
|
@@ -97,9 +95,7 @@ export type SlateAuthWithToken<InputType extends {}, OutputType extends { token?
|
|
|
97
95
|
|
|
98
96
|
inputSchema?: z.ZodType<InputType>;
|
|
99
97
|
|
|
100
|
-
docs?:
|
|
101
|
-
tokenDocsLink?: string;
|
|
102
|
-
};
|
|
98
|
+
docs?: SlateAuthDocsReference[];
|
|
103
99
|
|
|
104
100
|
getOutput: (ctx: { input: InputType }) => Promise<{ output: OutputType }>;
|
|
105
101
|
|
|
@@ -123,9 +119,7 @@ export type SlateAuthWithServiceAccount<InputType extends {}, OutputType extends
|
|
|
123
119
|
|
|
124
120
|
inputSchema?: z.ZodType<InputType>;
|
|
125
121
|
|
|
126
|
-
docs?:
|
|
127
|
-
serviceAccountDocsLink?: string;
|
|
128
|
-
};
|
|
122
|
+
docs?: SlateAuthDocsReference[];
|
|
129
123
|
|
|
130
124
|
getOutput: (ctx: { input: InputType }) => Promise<{ output: OutputType }>;
|
|
131
125
|
|
|
@@ -149,9 +143,7 @@ export type SlateAuthWithCustomData<InputType extends {}, OutputType extends {}>
|
|
|
149
143
|
|
|
150
144
|
inputSchema?: z.ZodType<InputType>;
|
|
151
145
|
|
|
152
|
-
docs?:
|
|
153
|
-
customAuthDocsLink?: string;
|
|
154
|
-
};
|
|
146
|
+
docs?: SlateAuthDocsReference[];
|
|
155
147
|
|
|
156
148
|
getOutput: (ctx: { input: InputType }) => Promise<{ output: OutputType }>;
|
|
157
149
|
|
package/src/config/config.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type z from 'zod';
|
|
2
|
+
import type { SlateConfigDocsReference } from '../docs';
|
|
2
3
|
|
|
3
4
|
export class SlateConfig<ConfigType extends {}> {
|
|
4
5
|
#configSchema: z.ZodType<ConfigType>;
|
|
6
|
+
#docs: SlateConfigDocsReference[] | undefined;
|
|
5
7
|
#configChanged:
|
|
6
8
|
| ((params: {
|
|
7
9
|
previousConfig: ConfigType | null;
|
|
@@ -25,6 +27,11 @@ export class SlateConfig<ConfigType extends {}> {
|
|
|
25
27
|
return this as any as SlateConfig<NewConfigType>;
|
|
26
28
|
}
|
|
27
29
|
|
|
30
|
+
docs(docs: SlateConfigDocsReference[]): SlateConfig<ConfigType> {
|
|
31
|
+
this.#docs = docs;
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
|
|
28
35
|
onConfigChanged(
|
|
29
36
|
handler: (params: {
|
|
30
37
|
previousConfig: ConfigType | null;
|
|
@@ -44,6 +51,10 @@ export class SlateConfig<ConfigType extends {}> {
|
|
|
44
51
|
return this.#configSchema;
|
|
45
52
|
}
|
|
46
53
|
|
|
54
|
+
get docsReferences() {
|
|
55
|
+
return this.#docs;
|
|
56
|
+
}
|
|
57
|
+
|
|
47
58
|
get handlers() {
|
|
48
59
|
return {
|
|
49
60
|
configChanged: this.#configChanged,
|
package/src/docs.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface SlateDocsReference {
|
|
2
|
+
name: string;
|
|
3
|
+
url: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface SlateTypedDocsReference<Type extends string> extends SlateDocsReference {
|
|
7
|
+
type?: Type;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type SlateProviderDocsReference = SlateDocsReference;
|
|
11
|
+
|
|
12
|
+
export type SlateConfigDocsReference = SlateTypedDocsReference<'docs.config.general'>;
|
|
13
|
+
|
|
14
|
+
export type SlateActionDocsReference = SlateTypedDocsReference<'docs.action.general'>;
|
|
15
|
+
|
|
16
|
+
export type SlateAuthDocsReference = SlateTypedDocsReference<
|
|
17
|
+
| 'docs.auth.oauth'
|
|
18
|
+
| 'docs.auth.oauth_scopes'
|
|
19
|
+
| 'docs.auth.token'
|
|
20
|
+
| 'docs.auth.service_account'
|
|
21
|
+
| 'docs.auth.custom'
|
|
22
|
+
>;
|
package/src/index.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import z from 'zod';
|
|
2
2
|
import type { SlateAuth } from '../auth';
|
|
3
3
|
import type { SlateConfig } from '../config';
|
|
4
|
+
import type { SlateProviderDocsReference } from '../docs';
|
|
4
5
|
|
|
5
6
|
export interface SlateSpecificationParameters {
|
|
6
7
|
key: string;
|
|
7
8
|
name: string;
|
|
8
9
|
description?: string;
|
|
10
|
+
docs?: SlateProviderDocsReference[];
|
|
9
11
|
metadata?: Record<string, any>;
|
|
10
12
|
}
|
|
11
13
|
|
|
@@ -61,6 +63,10 @@ export class SlateSpecification<ConfigType extends {}, AuthType extends {}> {
|
|
|
61
63
|
get description() {
|
|
62
64
|
return this._params.description;
|
|
63
65
|
}
|
|
66
|
+
|
|
67
|
+
get docs() {
|
|
68
|
+
return this._params.docs;
|
|
69
|
+
}
|
|
64
70
|
}
|
|
65
71
|
|
|
66
72
|
export let spec = <ConfigType extends {}, AuthType extends {}>(
|