@slates/provider 1.0.0-rc.8 → 1.0.0-rc.9

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 CHANGED
@@ -48,7 +48,10 @@ __export(index_exports, {
48
48
  axios: () => axios,
49
49
  config: () => config,
50
50
  createAxios: () => createAxios,
51
+ createBase64Attachment: () => createBase64Attachment,
51
52
  createSlateError: () => createSlateError,
53
+ createTextAttachment: () => createTextAttachment,
54
+ createUrlAttachment: () => createUrlAttachment,
52
55
  getCurrentContext: () => getCurrentContext,
53
56
  getServiceErrorData: () => getServiceErrorData,
54
57
  inferSlateErrorFromAxios: () => inferSlateErrorFromAxios,
@@ -902,6 +905,31 @@ var SlateTrigger = class _SlateTrigger extends SlateAction {
902
905
  };
903
906
  var trigger = (spec2, params) => SlateTrigger.create(spec2, params);
904
907
 
908
+ // src/action/attachment.ts
909
+ var createUrlAttachment = (url, mimeType) => ({
910
+ mimeType,
911
+ content: {
912
+ type: "url",
913
+ url
914
+ }
915
+ });
916
+ var createBase64Attachment = (content, mimeType) => ({
917
+ mimeType,
918
+ content: {
919
+ type: "content",
920
+ encoding: "base64",
921
+ content
922
+ }
923
+ });
924
+ var createTextAttachment = (content, mimeType) => ({
925
+ mimeType,
926
+ content: {
927
+ type: "content",
928
+ encoding: "utf-8",
929
+ content
930
+ }
931
+ });
932
+
905
933
  // src/auth/auth.ts
906
934
  var SlateAuth = class _SlateAuth {
907
935
  #outputSchema = null;
@@ -1570,7 +1598,10 @@ var spec = (params) => SlateSpecification.create(params);
1570
1598
  axios,
1571
1599
  config,
1572
1600
  createAxios,
1601
+ createBase64Attachment,
1573
1602
  createSlateError,
1603
+ createTextAttachment,
1604
+ createUrlAttachment,
1574
1605
  getCurrentContext,
1575
1606
  getServiceErrorData,
1576
1607
  inferSlateErrorFromAxios,
package/dist/index.d.cts CHANGED
@@ -322,6 +322,23 @@ declare class SlateContext<ConfigType extends {}, AuthType extends {}, InputType
322
322
  declare let runWithContext: <ConfigType extends {}, AuthType extends {}, InputType extends {}, RV>(context: SlateContext<ConfigType, AuthType, InputType>, fn: () => Promise<RV>) => Promise<RV>;
323
323
  declare let getCurrentContext: <ConfigType extends {}, AuthType extends {}, InputType extends {}>() => SlateContext<ConfigType, AuthType, InputType>;
324
324
 
325
+ interface SlateAttachmentUrlContent {
326
+ type: 'url';
327
+ url: string;
328
+ }
329
+ interface SlateAttachmentInlineContent {
330
+ type: 'content';
331
+ encoding: 'base64' | 'utf-8';
332
+ content: string;
333
+ }
334
+ interface SlateAttachment {
335
+ mimeType?: string;
336
+ content: SlateAttachmentUrlContent | SlateAttachmentInlineContent;
337
+ }
338
+ declare let createUrlAttachment: (url: string, mimeType?: string) => SlateAttachment;
339
+ declare let createBase64Attachment: (content: string, mimeType?: string) => SlateAttachment;
340
+ declare let createTextAttachment: (content: string, mimeType?: string) => SlateAttachment;
341
+
325
342
  type SlateActionType = 'tool' | 'trigger';
326
343
  interface SlateActionScopeClause {
327
344
  OR: string[];
@@ -346,6 +363,7 @@ interface SlateActionParameters {
346
363
  type SlateToolInvocationHandler<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> = (context: SlateContext<ConfigType, AuthType, InputType>) => Promise<{
347
364
  output: OutputType;
348
365
  message: string;
366
+ attachments?: SlateAttachment[];
349
367
  }>;
350
368
  type SlateTriggerMappingHandler<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> = (context: SlateContext<ConfigType, AuthType, InputType>) => Promise<{
351
369
  type: string;
@@ -599,4 +617,4 @@ declare class Slate<ConfigType extends {}, AuthType extends {}> {
599
617
  get actions(): (SlateTrigger<ConfigType, AuthType, any, any> | SlateTool<ConfigType, AuthType, any, any>)[];
600
618
  }
601
619
 
602
- 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, 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, createSlateError, getCurrentContext, getServiceErrorData, inferSlateErrorFromAxios, isAxiosErrorLike, isServiceErrorData, mapServiceErrorCode, mapServiceErrorToSlateErrorInput, mergeScopes, runWithContext, scopeClause, spec, tool, trigger, validateScopes };
620
+ 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 };
package/dist/index.d.ts CHANGED
@@ -322,6 +322,23 @@ declare class SlateContext<ConfigType extends {}, AuthType extends {}, InputType
322
322
  declare let runWithContext: <ConfigType extends {}, AuthType extends {}, InputType extends {}, RV>(context: SlateContext<ConfigType, AuthType, InputType>, fn: () => Promise<RV>) => Promise<RV>;
323
323
  declare let getCurrentContext: <ConfigType extends {}, AuthType extends {}, InputType extends {}>() => SlateContext<ConfigType, AuthType, InputType>;
324
324
 
325
+ interface SlateAttachmentUrlContent {
326
+ type: 'url';
327
+ url: string;
328
+ }
329
+ interface SlateAttachmentInlineContent {
330
+ type: 'content';
331
+ encoding: 'base64' | 'utf-8';
332
+ content: string;
333
+ }
334
+ interface SlateAttachment {
335
+ mimeType?: string;
336
+ content: SlateAttachmentUrlContent | SlateAttachmentInlineContent;
337
+ }
338
+ declare let createUrlAttachment: (url: string, mimeType?: string) => SlateAttachment;
339
+ declare let createBase64Attachment: (content: string, mimeType?: string) => SlateAttachment;
340
+ declare let createTextAttachment: (content: string, mimeType?: string) => SlateAttachment;
341
+
325
342
  type SlateActionType = 'tool' | 'trigger';
326
343
  interface SlateActionScopeClause {
327
344
  OR: string[];
@@ -346,6 +363,7 @@ interface SlateActionParameters {
346
363
  type SlateToolInvocationHandler<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> = (context: SlateContext<ConfigType, AuthType, InputType>) => Promise<{
347
364
  output: OutputType;
348
365
  message: string;
366
+ attachments?: SlateAttachment[];
349
367
  }>;
350
368
  type SlateTriggerMappingHandler<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> = (context: SlateContext<ConfigType, AuthType, InputType>) => Promise<{
351
369
  type: string;
@@ -599,4 +617,4 @@ declare class Slate<ConfigType extends {}, AuthType extends {}> {
599
617
  get actions(): (SlateTrigger<ConfigType, AuthType, any, any> | SlateTool<ConfigType, AuthType, any, any>)[];
600
618
  }
601
619
 
602
- 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, 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, createSlateError, getCurrentContext, getServiceErrorData, inferSlateErrorFromAxios, isAxiosErrorLike, isServiceErrorData, mapServiceErrorCode, mapServiceErrorToSlateErrorInput, mergeScopes, runWithContext, scopeClause, spec, tool, trigger, validateScopes };
620
+ 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 };
@@ -834,6 +834,31 @@ var SlateTrigger = class _SlateTrigger extends SlateAction {
834
834
  };
835
835
  var trigger = (spec2, params) => SlateTrigger.create(spec2, params);
836
836
 
837
+ // src/action/attachment.ts
838
+ var createUrlAttachment = (url, mimeType) => ({
839
+ mimeType,
840
+ content: {
841
+ type: "url",
842
+ url
843
+ }
844
+ });
845
+ var createBase64Attachment = (content, mimeType) => ({
846
+ mimeType,
847
+ content: {
848
+ type: "content",
849
+ encoding: "base64",
850
+ content
851
+ }
852
+ });
853
+ var createTextAttachment = (content, mimeType) => ({
854
+ mimeType,
855
+ content: {
856
+ type: "content",
857
+ encoding: "utf-8",
858
+ content
859
+ }
860
+ });
861
+
837
862
  // src/auth/auth.ts
838
863
  var SlateAuth = class _SlateAuth {
839
864
  #outputSchema = null;
@@ -1501,7 +1526,10 @@ export {
1501
1526
  axios,
1502
1527
  config,
1503
1528
  createAxios,
1529
+ createBase64Attachment,
1504
1530
  createSlateError,
1531
+ createTextAttachment,
1532
+ createUrlAttachment,
1505
1533
  getCurrentContext,
1506
1534
  getServiceErrorData,
1507
1535
  inferSlateErrorFromAxios,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slates/provider",
3
- "version": "1.0.0-rc.8",
3
+ "version": "1.0.0-rc.9",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -42,4 +42,4 @@
42
42
  "typescript": "5.8.2",
43
43
  "vitest": "^3.1.2"
44
44
  }
45
- }
45
+ }
@@ -1,6 +1,7 @@
1
1
  import type { z } from 'zod';
2
2
  import type { SlateContext } from '../context';
3
3
  import type { SlateSpecification } from '../specification/specification';
4
+ import type { SlateAttachment } from './attachment';
4
5
 
5
6
  export type SlateActionType = 'tool' | 'trigger';
6
7
 
@@ -35,6 +36,7 @@ export type SlateToolInvocationHandler<
35
36
  > = (context: SlateContext<ConfigType, AuthType, InputType>) => Promise<{
36
37
  output: OutputType;
37
38
  message: string;
39
+ attachments?: SlateAttachment[];
38
40
  }>;
39
41
 
40
42
  export type SlateTriggerMappingHandler<
@@ -0,0 +1,41 @@
1
+ export interface SlateAttachmentUrlContent {
2
+ type: 'url';
3
+ url: string;
4
+ }
5
+
6
+ export interface SlateAttachmentInlineContent {
7
+ type: 'content';
8
+ encoding: 'base64' | 'utf-8';
9
+ content: string;
10
+ }
11
+
12
+ export interface SlateAttachment {
13
+ mimeType?: string;
14
+ content: SlateAttachmentUrlContent | SlateAttachmentInlineContent;
15
+ }
16
+
17
+ export let createUrlAttachment = (url: string, mimeType?: string): SlateAttachment => ({
18
+ mimeType,
19
+ content: {
20
+ type: 'url',
21
+ url
22
+ }
23
+ });
24
+
25
+ export let createBase64Attachment = (content: string, mimeType?: string): SlateAttachment => ({
26
+ mimeType,
27
+ content: {
28
+ type: 'content',
29
+ encoding: 'base64',
30
+ content
31
+ }
32
+ });
33
+
34
+ export let createTextAttachment = (content: string, mimeType?: string): SlateAttachment => ({
35
+ mimeType,
36
+ content: {
37
+ type: 'content',
38
+ encoding: 'utf-8',
39
+ content
40
+ }
41
+ });
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './action';
2
+ export * from './action/attachment';
2
3
  export * from './auth';
3
4
  export * from './axios';
4
5
  export * from './config';