@slates/provider 1.0.0-rc.14 → 1.0.0-rc.16
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 +32 -0
- package/dist/index.d.cts +30 -14
- package/dist/index.d.ts +30 -14
- package/dist/index.module.js +32 -0
- package/package.json +2 -2
- package/src/action/action.ts +11 -0
- package/src/action/builder.ts +21 -0
- package/src/auth/types.ts +17 -16
- 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,12 @@ var SlateAction = class {
|
|
|
119
119
|
get scopes() {
|
|
120
120
|
return this._params.scopes;
|
|
121
121
|
}
|
|
122
|
+
get authMethods() {
|
|
123
|
+
return this._params.authMethods;
|
|
124
|
+
}
|
|
125
|
+
get docs() {
|
|
126
|
+
return this._params.docs;
|
|
127
|
+
}
|
|
122
128
|
};
|
|
123
129
|
|
|
124
130
|
// src/error/axios.ts
|
|
@@ -762,6 +768,7 @@ var SlateActionBuilder = class {
|
|
|
762
768
|
#inputSchema = null;
|
|
763
769
|
#outputSchema = null;
|
|
764
770
|
#scopes;
|
|
771
|
+
#authMethods;
|
|
765
772
|
#toolParams = null;
|
|
766
773
|
#triggerParams = null;
|
|
767
774
|
input(schema) {
|
|
@@ -777,6 +784,18 @@ var SlateActionBuilder = class {
|
|
|
777
784
|
this.#scopes = scopes;
|
|
778
785
|
return this;
|
|
779
786
|
}
|
|
787
|
+
authMethods(authMethods) {
|
|
788
|
+
this.#authMethods = this.validateAuthMethods(authMethods);
|
|
789
|
+
return this;
|
|
790
|
+
}
|
|
791
|
+
validateAuthMethods(authMethods) {
|
|
792
|
+
if (!authMethods) return void 0;
|
|
793
|
+
let normalized = [...new Set(authMethods.map((authMethod) => authMethod.trim()))];
|
|
794
|
+
if (normalized.some((authMethod) => !authMethod)) {
|
|
795
|
+
throw new SlateDeclarationError("Auth method IDs must be non-empty strings");
|
|
796
|
+
}
|
|
797
|
+
return normalized;
|
|
798
|
+
}
|
|
780
799
|
handleInvocation(handler) {
|
|
781
800
|
if (this.type !== "tool") {
|
|
782
801
|
throw new SlateDeclarationError("handleInvocation can only be set for tool actions");
|
|
@@ -819,6 +838,7 @@ var SlateActionBuilder = class {
|
|
|
819
838
|
if (scopes) {
|
|
820
839
|
validateScopes(scopes);
|
|
821
840
|
}
|
|
841
|
+
let authMethods = this.validateAuthMethods(this.#authMethods ?? this.params.authMethods);
|
|
822
842
|
if (!this.#inputSchema) {
|
|
823
843
|
throw new SlateDeclarationError("Input schema is not defined");
|
|
824
844
|
}
|
|
@@ -834,6 +854,7 @@ var SlateActionBuilder = class {
|
|
|
834
854
|
return this.factory({
|
|
835
855
|
...this.params,
|
|
836
856
|
scopes,
|
|
857
|
+
authMethods,
|
|
837
858
|
configSchema: this.#configSchema,
|
|
838
859
|
authSchema: this.#authSchema,
|
|
839
860
|
inputSchema: this.#inputSchema,
|
|
@@ -1585,6 +1606,7 @@ var axios = createAxios();
|
|
|
1585
1606
|
// src/config/config.ts
|
|
1586
1607
|
var SlateConfig = class _SlateConfig {
|
|
1587
1608
|
#configSchema;
|
|
1609
|
+
#docs;
|
|
1588
1610
|
#configChanged = null;
|
|
1589
1611
|
#getDefaultConfig = null;
|
|
1590
1612
|
constructor(schema) {
|
|
@@ -1597,6 +1619,10 @@ var SlateConfig = class _SlateConfig {
|
|
|
1597
1619
|
this.#configSchema = schema;
|
|
1598
1620
|
return this;
|
|
1599
1621
|
}
|
|
1622
|
+
docs(docs) {
|
|
1623
|
+
this.#docs = docs;
|
|
1624
|
+
return this;
|
|
1625
|
+
}
|
|
1600
1626
|
onConfigChanged(handler) {
|
|
1601
1627
|
this.#configChanged = handler;
|
|
1602
1628
|
return this;
|
|
@@ -1608,6 +1634,9 @@ var SlateConfig = class _SlateConfig {
|
|
|
1608
1634
|
get configSchema() {
|
|
1609
1635
|
return this.#configSchema;
|
|
1610
1636
|
}
|
|
1637
|
+
get docsReferences() {
|
|
1638
|
+
return this.#docs;
|
|
1639
|
+
}
|
|
1611
1640
|
get handlers() {
|
|
1612
1641
|
return {
|
|
1613
1642
|
configChanged: this.#configChanged,
|
|
@@ -1840,6 +1869,9 @@ var SlateSpecification = class _SlateSpecification {
|
|
|
1840
1869
|
get description() {
|
|
1841
1870
|
return this._params.description;
|
|
1842
1871
|
}
|
|
1872
|
+
get docs() {
|
|
1873
|
+
return this._params.docs;
|
|
1874
|
+
}
|
|
1843
1875
|
};
|
|
1844
1876
|
var spec = (params) => SlateSpecification.create(params);
|
|
1845
1877
|
// 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,13 +142,12 @@ 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<{
|
|
142
149
|
output: OutputType;
|
|
150
|
+
scopes?: string[];
|
|
143
151
|
}>;
|
|
144
152
|
onInputChanged?: (params: {
|
|
145
153
|
previousInput: InputType;
|
|
@@ -160,13 +168,12 @@ type SlateAuthWithServiceAccount<InputType extends {}, OutputType extends {}> =
|
|
|
160
168
|
name: string;
|
|
161
169
|
key: string;
|
|
162
170
|
inputSchema?: z.ZodType<InputType>;
|
|
163
|
-
docs?:
|
|
164
|
-
serviceAccountDocsLink?: string;
|
|
165
|
-
};
|
|
171
|
+
docs?: SlateAuthDocsReference[];
|
|
166
172
|
getOutput: (ctx: {
|
|
167
173
|
input: InputType;
|
|
168
174
|
}) => Promise<{
|
|
169
175
|
output: OutputType;
|
|
176
|
+
scopes?: string[];
|
|
170
177
|
}>;
|
|
171
178
|
onInputChanged?: (params: {
|
|
172
179
|
previousInput: InputType;
|
|
@@ -187,13 +194,12 @@ type SlateAuthWithCustomData<InputType extends {}, OutputType extends {}> = {
|
|
|
187
194
|
name: string;
|
|
188
195
|
key: string;
|
|
189
196
|
inputSchema?: z.ZodType<InputType>;
|
|
190
|
-
docs?:
|
|
191
|
-
customAuthDocsLink?: string;
|
|
192
|
-
};
|
|
197
|
+
docs?: SlateAuthDocsReference[];
|
|
193
198
|
getOutput: (ctx: {
|
|
194
199
|
input: InputType;
|
|
195
200
|
}) => Promise<{
|
|
196
201
|
output: OutputType;
|
|
202
|
+
scopes?: string[];
|
|
197
203
|
}>;
|
|
198
204
|
handleTokenRefresh?: (ctx: {
|
|
199
205
|
output: OutputType;
|
|
@@ -263,6 +269,7 @@ declare class SlateConfig<ConfigType extends {}> {
|
|
|
263
269
|
private constructor();
|
|
264
270
|
static create<ConfigType extends {}>(schema: z.ZodType<ConfigType>): SlateConfig<ConfigType>;
|
|
265
271
|
config<NewConfigType extends {}>(schema: z.ZodType<NewConfigType>): SlateConfig<NewConfigType>;
|
|
272
|
+
docs(docs: SlateConfigDocsReference[]): SlateConfig<ConfigType>;
|
|
266
273
|
onConfigChanged(handler: (params: {
|
|
267
274
|
previousConfig: ConfigType | null;
|
|
268
275
|
newConfig: ConfigType;
|
|
@@ -271,6 +278,7 @@ declare class SlateConfig<ConfigType extends {}> {
|
|
|
271
278
|
} | undefined): SlateConfig<ConfigType>;
|
|
272
279
|
getDefaultConfig(getter: () => ConfigType): SlateConfig<ConfigType>;
|
|
273
280
|
get configSchema(): z.ZodType<ConfigType, unknown, z.core.$ZodTypeInternals<ConfigType, unknown>>;
|
|
281
|
+
get docsReferences(): SlateConfigDocsReference[] | undefined;
|
|
274
282
|
get handlers(): {
|
|
275
283
|
configChanged: ((params: {
|
|
276
284
|
previousConfig: ConfigType | null;
|
|
@@ -287,6 +295,7 @@ interface SlateSpecificationParameters {
|
|
|
287
295
|
key: string;
|
|
288
296
|
name: string;
|
|
289
297
|
description?: string;
|
|
298
|
+
docs?: SlateProviderDocsReference[];
|
|
290
299
|
metadata?: Record<string, any>;
|
|
291
300
|
}
|
|
292
301
|
interface SlateSpecificationCreateParameters<ConfigType extends {}, AuthType extends {}> extends SlateSpecificationParameters {
|
|
@@ -307,6 +316,7 @@ declare class SlateSpecification<ConfigType extends {}, AuthType extends {}> {
|
|
|
307
316
|
get key(): string;
|
|
308
317
|
get name(): string;
|
|
309
318
|
get description(): string | undefined;
|
|
319
|
+
get docs(): SlateDocsReference[] | undefined;
|
|
310
320
|
}
|
|
311
321
|
declare let spec: <ConfigType extends {}, AuthType extends {}>(params: SlateSpecificationCreateParameters<ConfigType, AuthType>) => SlateSpecification<ConfigType, AuthType>;
|
|
312
322
|
|
|
@@ -389,6 +399,8 @@ interface SlateActionParameters {
|
|
|
389
399
|
};
|
|
390
400
|
metadata?: Record<string, any>;
|
|
391
401
|
scopes?: SlateActionScopes;
|
|
402
|
+
authMethods?: string[];
|
|
403
|
+
docs?: SlateActionDocsReference[];
|
|
392
404
|
}
|
|
393
405
|
type SlateToolInvocationHandler<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> = (context: SlateContext<ConfigType, AuthType, InputType>) => Promise<{
|
|
394
406
|
output: OutputType;
|
|
@@ -471,6 +483,8 @@ declare abstract class SlateAction<Type extends SlateActionType, ConfigType exte
|
|
|
471
483
|
get constraints(): string[] | undefined;
|
|
472
484
|
get metadata(): Record<string, any> | undefined;
|
|
473
485
|
get scopes(): SlateActionScopes | undefined;
|
|
486
|
+
get authMethods(): string[] | undefined;
|
|
487
|
+
get docs(): SlateActionDocsReference[] | undefined;
|
|
474
488
|
}
|
|
475
489
|
|
|
476
490
|
declare class SlateActionBuilder<Type extends SlateActionType, ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}, Result extends SlateAction<Type, ConfigType, AuthType, any, any>> {
|
|
@@ -483,6 +497,8 @@ declare class SlateActionBuilder<Type extends SlateActionType, ConfigType extend
|
|
|
483
497
|
input<NewInputType extends {}>(schema: z.ZodType<NewInputType>): SlateActionBuilder<Type, ConfigType, AuthType, NewInputType, OutputType, Result>;
|
|
484
498
|
output<NewOutputType extends {}>(schema: z.ZodType<NewOutputType>): SlateActionBuilder<Type, ConfigType, AuthType, InputType, NewOutputType, Result>;
|
|
485
499
|
scopes(scopes: SlateActionScopes): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result>;
|
|
500
|
+
authMethods(authMethods: string[]): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result>;
|
|
501
|
+
private validateAuthMethods;
|
|
486
502
|
handleInvocation(handler: SlateToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result>;
|
|
487
503
|
webhook(props: {
|
|
488
504
|
handleEvent: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
|
|
@@ -648,4 +664,4 @@ declare class Slate<ConfigType extends {}, AuthType extends {}> {
|
|
|
648
664
|
get actions(): (SlateTrigger<ConfigType, AuthType, any, any> | SlateTool<ConfigType, AuthType, any, any>)[];
|
|
649
665
|
}
|
|
650
666
|
|
|
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 };
|
|
667
|
+
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,13 +142,12 @@ 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<{
|
|
142
149
|
output: OutputType;
|
|
150
|
+
scopes?: string[];
|
|
143
151
|
}>;
|
|
144
152
|
onInputChanged?: (params: {
|
|
145
153
|
previousInput: InputType;
|
|
@@ -160,13 +168,12 @@ type SlateAuthWithServiceAccount<InputType extends {}, OutputType extends {}> =
|
|
|
160
168
|
name: string;
|
|
161
169
|
key: string;
|
|
162
170
|
inputSchema?: z.ZodType<InputType>;
|
|
163
|
-
docs?:
|
|
164
|
-
serviceAccountDocsLink?: string;
|
|
165
|
-
};
|
|
171
|
+
docs?: SlateAuthDocsReference[];
|
|
166
172
|
getOutput: (ctx: {
|
|
167
173
|
input: InputType;
|
|
168
174
|
}) => Promise<{
|
|
169
175
|
output: OutputType;
|
|
176
|
+
scopes?: string[];
|
|
170
177
|
}>;
|
|
171
178
|
onInputChanged?: (params: {
|
|
172
179
|
previousInput: InputType;
|
|
@@ -187,13 +194,12 @@ type SlateAuthWithCustomData<InputType extends {}, OutputType extends {}> = {
|
|
|
187
194
|
name: string;
|
|
188
195
|
key: string;
|
|
189
196
|
inputSchema?: z.ZodType<InputType>;
|
|
190
|
-
docs?:
|
|
191
|
-
customAuthDocsLink?: string;
|
|
192
|
-
};
|
|
197
|
+
docs?: SlateAuthDocsReference[];
|
|
193
198
|
getOutput: (ctx: {
|
|
194
199
|
input: InputType;
|
|
195
200
|
}) => Promise<{
|
|
196
201
|
output: OutputType;
|
|
202
|
+
scopes?: string[];
|
|
197
203
|
}>;
|
|
198
204
|
handleTokenRefresh?: (ctx: {
|
|
199
205
|
output: OutputType;
|
|
@@ -263,6 +269,7 @@ declare class SlateConfig<ConfigType extends {}> {
|
|
|
263
269
|
private constructor();
|
|
264
270
|
static create<ConfigType extends {}>(schema: z.ZodType<ConfigType>): SlateConfig<ConfigType>;
|
|
265
271
|
config<NewConfigType extends {}>(schema: z.ZodType<NewConfigType>): SlateConfig<NewConfigType>;
|
|
272
|
+
docs(docs: SlateConfigDocsReference[]): SlateConfig<ConfigType>;
|
|
266
273
|
onConfigChanged(handler: (params: {
|
|
267
274
|
previousConfig: ConfigType | null;
|
|
268
275
|
newConfig: ConfigType;
|
|
@@ -271,6 +278,7 @@ declare class SlateConfig<ConfigType extends {}> {
|
|
|
271
278
|
} | undefined): SlateConfig<ConfigType>;
|
|
272
279
|
getDefaultConfig(getter: () => ConfigType): SlateConfig<ConfigType>;
|
|
273
280
|
get configSchema(): z.ZodType<ConfigType, unknown, z.core.$ZodTypeInternals<ConfigType, unknown>>;
|
|
281
|
+
get docsReferences(): SlateConfigDocsReference[] | undefined;
|
|
274
282
|
get handlers(): {
|
|
275
283
|
configChanged: ((params: {
|
|
276
284
|
previousConfig: ConfigType | null;
|
|
@@ -287,6 +295,7 @@ interface SlateSpecificationParameters {
|
|
|
287
295
|
key: string;
|
|
288
296
|
name: string;
|
|
289
297
|
description?: string;
|
|
298
|
+
docs?: SlateProviderDocsReference[];
|
|
290
299
|
metadata?: Record<string, any>;
|
|
291
300
|
}
|
|
292
301
|
interface SlateSpecificationCreateParameters<ConfigType extends {}, AuthType extends {}> extends SlateSpecificationParameters {
|
|
@@ -307,6 +316,7 @@ declare class SlateSpecification<ConfigType extends {}, AuthType extends {}> {
|
|
|
307
316
|
get key(): string;
|
|
308
317
|
get name(): string;
|
|
309
318
|
get description(): string | undefined;
|
|
319
|
+
get docs(): SlateDocsReference[] | undefined;
|
|
310
320
|
}
|
|
311
321
|
declare let spec: <ConfigType extends {}, AuthType extends {}>(params: SlateSpecificationCreateParameters<ConfigType, AuthType>) => SlateSpecification<ConfigType, AuthType>;
|
|
312
322
|
|
|
@@ -389,6 +399,8 @@ interface SlateActionParameters {
|
|
|
389
399
|
};
|
|
390
400
|
metadata?: Record<string, any>;
|
|
391
401
|
scopes?: SlateActionScopes;
|
|
402
|
+
authMethods?: string[];
|
|
403
|
+
docs?: SlateActionDocsReference[];
|
|
392
404
|
}
|
|
393
405
|
type SlateToolInvocationHandler<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> = (context: SlateContext<ConfigType, AuthType, InputType>) => Promise<{
|
|
394
406
|
output: OutputType;
|
|
@@ -471,6 +483,8 @@ declare abstract class SlateAction<Type extends SlateActionType, ConfigType exte
|
|
|
471
483
|
get constraints(): string[] | undefined;
|
|
472
484
|
get metadata(): Record<string, any> | undefined;
|
|
473
485
|
get scopes(): SlateActionScopes | undefined;
|
|
486
|
+
get authMethods(): string[] | undefined;
|
|
487
|
+
get docs(): SlateActionDocsReference[] | undefined;
|
|
474
488
|
}
|
|
475
489
|
|
|
476
490
|
declare class SlateActionBuilder<Type extends SlateActionType, ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}, Result extends SlateAction<Type, ConfigType, AuthType, any, any>> {
|
|
@@ -483,6 +497,8 @@ declare class SlateActionBuilder<Type extends SlateActionType, ConfigType extend
|
|
|
483
497
|
input<NewInputType extends {}>(schema: z.ZodType<NewInputType>): SlateActionBuilder<Type, ConfigType, AuthType, NewInputType, OutputType, Result>;
|
|
484
498
|
output<NewOutputType extends {}>(schema: z.ZodType<NewOutputType>): SlateActionBuilder<Type, ConfigType, AuthType, InputType, NewOutputType, Result>;
|
|
485
499
|
scopes(scopes: SlateActionScopes): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result>;
|
|
500
|
+
authMethods(authMethods: string[]): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result>;
|
|
501
|
+
private validateAuthMethods;
|
|
486
502
|
handleInvocation(handler: SlateToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result>;
|
|
487
503
|
webhook(props: {
|
|
488
504
|
handleEvent: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
|
|
@@ -648,4 +664,4 @@ declare class Slate<ConfigType extends {}, AuthType extends {}> {
|
|
|
648
664
|
get actions(): (SlateTrigger<ConfigType, AuthType, any, any> | SlateTool<ConfigType, AuthType, any, any>)[];
|
|
649
665
|
}
|
|
650
666
|
|
|
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 };
|
|
667
|
+
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,12 @@ var SlateAction = class {
|
|
|
48
48
|
get scopes() {
|
|
49
49
|
return this._params.scopes;
|
|
50
50
|
}
|
|
51
|
+
get authMethods() {
|
|
52
|
+
return this._params.authMethods;
|
|
53
|
+
}
|
|
54
|
+
get docs() {
|
|
55
|
+
return this._params.docs;
|
|
56
|
+
}
|
|
51
57
|
};
|
|
52
58
|
|
|
53
59
|
// src/error/axios.ts
|
|
@@ -691,6 +697,7 @@ var SlateActionBuilder = class {
|
|
|
691
697
|
#inputSchema = null;
|
|
692
698
|
#outputSchema = null;
|
|
693
699
|
#scopes;
|
|
700
|
+
#authMethods;
|
|
694
701
|
#toolParams = null;
|
|
695
702
|
#triggerParams = null;
|
|
696
703
|
input(schema) {
|
|
@@ -706,6 +713,18 @@ var SlateActionBuilder = class {
|
|
|
706
713
|
this.#scopes = scopes;
|
|
707
714
|
return this;
|
|
708
715
|
}
|
|
716
|
+
authMethods(authMethods) {
|
|
717
|
+
this.#authMethods = this.validateAuthMethods(authMethods);
|
|
718
|
+
return this;
|
|
719
|
+
}
|
|
720
|
+
validateAuthMethods(authMethods) {
|
|
721
|
+
if (!authMethods) return void 0;
|
|
722
|
+
let normalized = [...new Set(authMethods.map((authMethod) => authMethod.trim()))];
|
|
723
|
+
if (normalized.some((authMethod) => !authMethod)) {
|
|
724
|
+
throw new SlateDeclarationError("Auth method IDs must be non-empty strings");
|
|
725
|
+
}
|
|
726
|
+
return normalized;
|
|
727
|
+
}
|
|
709
728
|
handleInvocation(handler) {
|
|
710
729
|
if (this.type !== "tool") {
|
|
711
730
|
throw new SlateDeclarationError("handleInvocation can only be set for tool actions");
|
|
@@ -748,6 +767,7 @@ var SlateActionBuilder = class {
|
|
|
748
767
|
if (scopes) {
|
|
749
768
|
validateScopes(scopes);
|
|
750
769
|
}
|
|
770
|
+
let authMethods = this.validateAuthMethods(this.#authMethods ?? this.params.authMethods);
|
|
751
771
|
if (!this.#inputSchema) {
|
|
752
772
|
throw new SlateDeclarationError("Input schema is not defined");
|
|
753
773
|
}
|
|
@@ -763,6 +783,7 @@ var SlateActionBuilder = class {
|
|
|
763
783
|
return this.factory({
|
|
764
784
|
...this.params,
|
|
765
785
|
scopes,
|
|
786
|
+
authMethods,
|
|
766
787
|
configSchema: this.#configSchema,
|
|
767
788
|
authSchema: this.#authSchema,
|
|
768
789
|
inputSchema: this.#inputSchema,
|
|
@@ -1514,6 +1535,7 @@ var axios = createAxios();
|
|
|
1514
1535
|
// src/config/config.ts
|
|
1515
1536
|
var SlateConfig = class _SlateConfig {
|
|
1516
1537
|
#configSchema;
|
|
1538
|
+
#docs;
|
|
1517
1539
|
#configChanged = null;
|
|
1518
1540
|
#getDefaultConfig = null;
|
|
1519
1541
|
constructor(schema) {
|
|
@@ -1526,6 +1548,10 @@ var SlateConfig = class _SlateConfig {
|
|
|
1526
1548
|
this.#configSchema = schema;
|
|
1527
1549
|
return this;
|
|
1528
1550
|
}
|
|
1551
|
+
docs(docs) {
|
|
1552
|
+
this.#docs = docs;
|
|
1553
|
+
return this;
|
|
1554
|
+
}
|
|
1529
1555
|
onConfigChanged(handler) {
|
|
1530
1556
|
this.#configChanged = handler;
|
|
1531
1557
|
return this;
|
|
@@ -1537,6 +1563,9 @@ var SlateConfig = class _SlateConfig {
|
|
|
1537
1563
|
get configSchema() {
|
|
1538
1564
|
return this.#configSchema;
|
|
1539
1565
|
}
|
|
1566
|
+
get docsReferences() {
|
|
1567
|
+
return this.#docs;
|
|
1568
|
+
}
|
|
1540
1569
|
get handlers() {
|
|
1541
1570
|
return {
|
|
1542
1571
|
configChanged: this.#configChanged,
|
|
@@ -1769,6 +1798,9 @@ var SlateSpecification = class _SlateSpecification {
|
|
|
1769
1798
|
get description() {
|
|
1770
1799
|
return this._params.description;
|
|
1771
1800
|
}
|
|
1801
|
+
get docs() {
|
|
1802
|
+
return this._params.docs;
|
|
1803
|
+
}
|
|
1772
1804
|
};
|
|
1773
1805
|
var spec = (params) => SlateSpecification.create(params);
|
|
1774
1806
|
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,8 @@ export interface SlateActionParameters {
|
|
|
26
27
|
};
|
|
27
28
|
metadata?: Record<string, any>;
|
|
28
29
|
scopes?: SlateActionScopes;
|
|
30
|
+
authMethods?: string[];
|
|
31
|
+
docs?: SlateActionDocsReference[];
|
|
29
32
|
}
|
|
30
33
|
|
|
31
34
|
export type SlateToolInvocationHandler<
|
|
@@ -203,4 +206,12 @@ export abstract class SlateAction<
|
|
|
203
206
|
get scopes() {
|
|
204
207
|
return this._params.scopes;
|
|
205
208
|
}
|
|
209
|
+
|
|
210
|
+
get authMethods() {
|
|
211
|
+
return this._params.authMethods;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
get docs() {
|
|
215
|
+
return this._params.docs;
|
|
216
|
+
}
|
|
206
217
|
}
|
package/src/action/builder.ts
CHANGED
|
@@ -32,6 +32,7 @@ export class SlateActionBuilder<
|
|
|
32
32
|
#inputSchema: z.ZodType<InputType> | null = null;
|
|
33
33
|
#outputSchema: z.ZodType<OutputType> | null = null;
|
|
34
34
|
#scopes: SlateActionScopes | undefined;
|
|
35
|
+
#authMethods: string[] | undefined;
|
|
35
36
|
|
|
36
37
|
#toolParams: SlateActionParametersTool<ConfigType, AuthType, InputType, OutputType> | null =
|
|
37
38
|
null;
|
|
@@ -76,6 +77,24 @@ export class SlateActionBuilder<
|
|
|
76
77
|
return this;
|
|
77
78
|
}
|
|
78
79
|
|
|
80
|
+
authMethods(
|
|
81
|
+
authMethods: string[]
|
|
82
|
+
): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result> {
|
|
83
|
+
this.#authMethods = this.validateAuthMethods(authMethods);
|
|
84
|
+
return this;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
private validateAuthMethods(authMethods: string[] | undefined) {
|
|
88
|
+
if (!authMethods) return undefined;
|
|
89
|
+
|
|
90
|
+
let normalized = [...new Set(authMethods.map(authMethod => authMethod.trim()))];
|
|
91
|
+
if (normalized.some(authMethod => !authMethod)) {
|
|
92
|
+
throw new SlateDeclarationError('Auth method IDs must be non-empty strings');
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return normalized;
|
|
96
|
+
}
|
|
97
|
+
|
|
79
98
|
handleInvocation(
|
|
80
99
|
handler: SlateToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>
|
|
81
100
|
): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result> {
|
|
@@ -138,6 +157,7 @@ export class SlateActionBuilder<
|
|
|
138
157
|
if (scopes) {
|
|
139
158
|
validateScopes(scopes);
|
|
140
159
|
}
|
|
160
|
+
let authMethods = this.validateAuthMethods(this.#authMethods ?? this.params.authMethods);
|
|
141
161
|
|
|
142
162
|
if (!this.#inputSchema) {
|
|
143
163
|
throw new SlateDeclarationError('Input schema is not defined');
|
|
@@ -155,6 +175,7 @@ export class SlateActionBuilder<
|
|
|
155
175
|
return this.factory({
|
|
156
176
|
...this.params,
|
|
157
177
|
scopes,
|
|
178
|
+
authMethods,
|
|
158
179
|
configSchema: this.#configSchema,
|
|
159
180
|
authSchema: this.#authSchema,
|
|
160
181
|
inputSchema: this.#inputSchema,
|
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,11 +95,12 @@ 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
|
-
getOutput: (ctx: { input: InputType }) => Promise<{
|
|
100
|
+
getOutput: (ctx: { input: InputType }) => Promise<{
|
|
101
|
+
output: OutputType;
|
|
102
|
+
scopes?: string[];
|
|
103
|
+
}>;
|
|
105
104
|
|
|
106
105
|
onInputChanged?: (params: {
|
|
107
106
|
previousInput: InputType;
|
|
@@ -123,11 +122,12 @@ export type SlateAuthWithServiceAccount<InputType extends {}, OutputType extends
|
|
|
123
122
|
|
|
124
123
|
inputSchema?: z.ZodType<InputType>;
|
|
125
124
|
|
|
126
|
-
docs?:
|
|
127
|
-
serviceAccountDocsLink?: string;
|
|
128
|
-
};
|
|
125
|
+
docs?: SlateAuthDocsReference[];
|
|
129
126
|
|
|
130
|
-
getOutput: (ctx: { input: InputType }) => Promise<{
|
|
127
|
+
getOutput: (ctx: { input: InputType }) => Promise<{
|
|
128
|
+
output: OutputType;
|
|
129
|
+
scopes?: string[];
|
|
130
|
+
}>;
|
|
131
131
|
|
|
132
132
|
onInputChanged?: (params: {
|
|
133
133
|
previousInput: InputType;
|
|
@@ -149,11 +149,12 @@ export type SlateAuthWithCustomData<InputType extends {}, OutputType extends {}>
|
|
|
149
149
|
|
|
150
150
|
inputSchema?: z.ZodType<InputType>;
|
|
151
151
|
|
|
152
|
-
docs?:
|
|
153
|
-
customAuthDocsLink?: string;
|
|
154
|
-
};
|
|
152
|
+
docs?: SlateAuthDocsReference[];
|
|
155
153
|
|
|
156
|
-
getOutput: (ctx: { input: InputType }) => Promise<{
|
|
154
|
+
getOutput: (ctx: { input: InputType }) => Promise<{
|
|
155
|
+
output: OutputType;
|
|
156
|
+
scopes?: string[];
|
|
157
|
+
}>;
|
|
157
158
|
|
|
158
159
|
handleTokenRefresh?: (ctx: {
|
|
159
160
|
output: OutputType;
|
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 {}>(
|