@slates/provider-handler 1.0.0-rc.1 → 1.0.0-rc.2

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.
Files changed (62) hide show
  1. package/dist/action/action.d.ts +90 -0
  2. package/dist/action/action.d.ts.map +1 -0
  3. package/dist/action/builder.d.ts +27 -0
  4. package/dist/action/builder.d.ts.map +1 -0
  5. package/dist/action/index.d.ts +5 -0
  6. package/dist/action/index.d.ts.map +1 -0
  7. package/dist/action/tool.d.ts +11 -0
  8. package/dist/action/tool.d.ts.map +1 -0
  9. package/dist/action/trigger.d.ts +14 -0
  10. package/dist/action/trigger.d.ts.map +1 -0
  11. package/dist/auth/auth.d.ts +26 -0
  12. package/dist/auth/auth.d.ts.map +1 -0
  13. package/dist/auth/index.d.ts +3 -0
  14. package/dist/auth/index.d.ts.map +1 -0
  15. package/dist/auth/types.d.ts +148 -0
  16. package/dist/auth/types.d.ts.map +1 -0
  17. package/dist/axios/index.d.ts +4 -0
  18. package/dist/axios/index.d.ts.map +1 -0
  19. package/dist/config/config.d.ts +22 -0
  20. package/dist/config/config.d.ts.map +1 -0
  21. package/dist/config/index.d.ts +2 -0
  22. package/dist/config/index.d.ts.map +1 -0
  23. package/dist/context/context.d.ts +20 -0
  24. package/dist/context/context.d.ts.map +1 -0
  25. package/dist/context/hook.d.ts +4 -0
  26. package/dist/context/hook.d.ts.map +1 -0
  27. package/dist/context/index.d.ts +2 -0
  28. package/dist/context/index.d.ts.map +1 -0
  29. package/dist/error/base.d.ts +5 -0
  30. package/dist/error/base.d.ts.map +1 -0
  31. package/dist/error/declaration.d.ts +6 -0
  32. package/dist/error/declaration.d.ts.map +1 -0
  33. package/dist/error/index.d.ts +3 -0
  34. package/dist/error/index.d.ts.map +1 -0
  35. package/dist/index.cjs +2 -0
  36. package/dist/index.cjs.map +1 -0
  37. package/dist/index.d.ts +5 -0
  38. package/dist/index.d.ts.map +1 -0
  39. package/dist/index.modern.js +2 -0
  40. package/dist/index.modern.js.map +1 -0
  41. package/dist/index.module.js +2 -0
  42. package/dist/index.module.js.map +1 -0
  43. package/dist/index.umd.js +2 -0
  44. package/dist/index.umd.js.map +1 -0
  45. package/dist/spec.d.ts +14 -0
  46. package/dist/spec.d.ts.map +1 -0
  47. package/dist/specification/index.d.ts +3 -0
  48. package/dist/specification/index.d.ts.map +1 -0
  49. package/dist/specification/slate.d.ts +15 -0
  50. package/dist/specification/slate.d.ts.map +1 -0
  51. package/dist/specification/specification.d.ts +30 -0
  52. package/dist/specification/specification.d.ts.map +1 -0
  53. package/dist/specification/zero.d.ts +13 -0
  54. package/dist/specification/zero.d.ts.map +1 -0
  55. package/dist/state.d.ts +8 -0
  56. package/dist/state.d.ts.map +1 -0
  57. package/dist/tokens.d.ts +34 -0
  58. package/dist/tokens.d.ts.map +1 -0
  59. package/dist/validation.d.ts +4 -0
  60. package/dist/validation.d.ts.map +1 -0
  61. package/package.json +10 -4
  62. package/tsconfig.json +0 -8
@@ -0,0 +1,90 @@
1
+ import { z } from 'zod';
2
+ import { SlateContext } from '../context';
3
+ import { SlateSpecification } from '../specification/specification';
4
+ export type SlateActionType = 'tool' | 'trigger';
5
+ export interface SlateActionParameters {
6
+ key: string;
7
+ name: string;
8
+ description?: string;
9
+ instructions?: string[];
10
+ constraints?: string[];
11
+ tags?: {
12
+ destructive?: boolean;
13
+ readOnly?: boolean;
14
+ [key: string]: boolean | undefined;
15
+ };
16
+ }
17
+ export type SlateToolInvocationHandler<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> = (context: SlateContext<ConfigType, AuthType, InputType>) => Promise<{
18
+ output: OutputType;
19
+ message: string;
20
+ }>;
21
+ export type SlateTriggerMappingHandler<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> = (context: SlateContext<ConfigType, AuthType, InputType>) => Promise<{
22
+ type: string;
23
+ id: string;
24
+ output: OutputType;
25
+ }>;
26
+ export type SlateTriggerPollingHandler<ConfigType extends {}, AuthType extends {}, InputType extends {}> = (context: SlateContext<ConfigType, AuthType, {
27
+ state: any;
28
+ }>) => Promise<{
29
+ inputs: InputType[];
30
+ updatedState?: any;
31
+ }>;
32
+ export type SlateTriggerWebhookRequestHandler<ConfigType extends {}, AuthType extends {}, InputType extends {}> = (context: SlateContext<ConfigType, AuthType, {
33
+ request: Request;
34
+ state: any;
35
+ }>) => Promise<{
36
+ inputs: InputType[];
37
+ updatedState?: any;
38
+ }>;
39
+ export type SlateTriggerWebhookAutoRegistrationHandler<ConfigType extends {}, AuthType extends {}> = (context: SlateContext<ConfigType, AuthType, {
40
+ webhookBaseUrl: string;
41
+ }>) => Promise<{
42
+ registrationDetails: any;
43
+ }>;
44
+ export type SlateTriggerWebhookAutoUnregistrationHandler<ConfigType extends {}, AuthType extends {}> = (context: SlateContext<ConfigType, AuthType, {
45
+ webhookBaseUrl: string;
46
+ registrationDetails: any;
47
+ }>) => Promise<unknown>;
48
+ export interface SlateActionParametersTool<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> {
49
+ handlerInvocation: SlateToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>;
50
+ }
51
+ export interface SlatePollingOptions {
52
+ intervalInSeconds?: number;
53
+ }
54
+ export interface SlateActionParametersTrigger<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> {
55
+ source: 'polling' | 'webhook';
56
+ polling?: SlatePollingOptions;
57
+ handleEvent: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
58
+ handleRequest?: SlateTriggerWebhookRequestHandler<ConfigType, AuthType, InputType>;
59
+ pollEvents?: SlateTriggerPollingHandler<ConfigType, AuthType, InputType>;
60
+ autoRegisterWebhook?: SlateTriggerWebhookAutoRegistrationHandler<ConfigType, AuthType>;
61
+ autoUnregisterWebhook?: SlateTriggerWebhookAutoUnregistrationHandler<ConfigType, AuthType>;
62
+ }
63
+ export type SlateActionParametersAny<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> = SlateActionParametersTool<ConfigType, AuthType, InputType, OutputType> | SlateActionParametersTrigger<ConfigType, AuthType, InputType, OutputType>;
64
+ export type SlateActionCreateParameters<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> = SlateActionParametersAny<ConfigType, AuthType, InputType, OutputType> & SlateActionParameters & {
65
+ configSchema: z.ZodType<ConfigType>;
66
+ authSchema: z.ZodType<AuthType>;
67
+ inputSchema: z.ZodType<InputType>;
68
+ outputSchema: z.ZodType<OutputType>;
69
+ };
70
+ export declare abstract class SlateAction<Type extends SlateActionType, ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> {
71
+ readonly type: Type;
72
+ protected readonly _spec: SlateSpecification<ConfigType, AuthType>;
73
+ protected readonly _inputSchema: z.ZodType<InputType>;
74
+ protected readonly _outputSchema: z.ZodType<OutputType>;
75
+ protected readonly _params: SlateActionParameters;
76
+ constructor(type: Type, _spec: SlateSpecification<ConfigType, AuthType>, _inputSchema: z.ZodType<InputType>, _outputSchema: z.ZodType<OutputType>, _params: SlateActionParameters);
77
+ get configSchema(): z.ZodType<ConfigType, unknown, z.core.$ZodTypeInternals<ConfigType, unknown>>;
78
+ get inputSchema(): z.ZodType<InputType, unknown, z.core.$ZodTypeInternals<InputType, unknown>>;
79
+ get outputSchema(): z.ZodType<OutputType, unknown, z.core.$ZodTypeInternals<OutputType, unknown>>;
80
+ get parameters(): SlateActionParameters;
81
+ get key(): string;
82
+ get name(): string;
83
+ get description(): string | undefined;
84
+ get tags(): {
85
+ [key: string]: boolean | undefined;
86
+ destructive?: boolean;
87
+ readOnly?: boolean;
88
+ } | undefined;
89
+ }
90
+ //# sourceMappingURL=action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../src/action/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC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AC;IACpC,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAChC,WAAW,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAClC,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;CACrC,CAAC;AAEJ,8BAAsB,WAAW,CAC/B,IAAI,SAAS,eAAe,EAC5B,UAAU,SAAS,EAAE,EACrB,QAAQ,SAAS,EAAE,EACnB,SAAS,SAAS,EAAE,EACpB,UAAU,SAAS,EAAE;aAGH,IAAI,EAAE,IAAI;IAC1B,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAC,UAAU,EAAE,QAAQ,CAAC;IAClE,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;IACrD,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;IACvD,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,qBAAqB;gBAJjC,IAAI,EAAE,IAAI,EACP,KAAK,EAAE,kBAAkB,CAAC,UAAU,EAAE,QAAQ,CAAC,EAC/C,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EAClC,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,EACpC,OAAO,EAAE,qBAAqB;IAGnD,IAAI,YAAY,kFAEf;IAED,IAAI,WAAW,gFAEd;IAED,IAAI,YAAY,kFAEf;IAED,IAAI,UAAU,0BAEb;IAED,IAAI,GAAG,WAEN;IAED,IAAI,IAAI,WAEP;IAED,IAAI,WAAW,uBAEd;IAED,IAAI,IAAI;;sBA9JQ,OAAO;mBACV,OAAO;kBA+JnB;CACF"}
@@ -0,0 +1,27 @@
1
+ import z from 'zod';
2
+ import { SlateSpecification } from '../specification/specification';
3
+ import { SlateAction, SlateActionCreateParameters, SlateActionParameters, SlateActionType, SlatePollingOptions, SlateToolInvocationHandler, SlateTriggerMappingHandler, SlateTriggerPollingHandler, SlateTriggerWebhookAutoRegistrationHandler, SlateTriggerWebhookAutoUnregistrationHandler, SlateTriggerWebhookRequestHandler } from './action';
4
+ export declare class SlateActionBuilder<Type extends SlateActionType, ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> {
5
+ #private;
6
+ private readonly type;
7
+ private readonly spec;
8
+ private readonly params;
9
+ private readonly factory;
10
+ constructor(type: Type, spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters, factory: (params: SlateActionCreateParameters<any, any, any, any>) => SlateAction<Type, any, any, any, any>);
11
+ input<NewInputType extends {}>(schema: z.ZodType<NewInputType>): SlateActionBuilder<Type, ConfigType, AuthType, NewInputType, OutputType>;
12
+ output<NewOutputType extends {}>(schema: z.ZodType<NewOutputType>): SlateActionBuilder<Type, ConfigType, AuthType, InputType, NewOutputType>;
13
+ handleInvocation(handler: SlateToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType>;
14
+ webhook(props: {
15
+ handleEvent: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
16
+ handleRequest: SlateTriggerWebhookRequestHandler<ConfigType, AuthType, InputType>;
17
+ autoRegisterWebhook?: SlateTriggerWebhookAutoRegistrationHandler<ConfigType, AuthType>;
18
+ autoUnregisterWebhook?: SlateTriggerWebhookAutoUnregistrationHandler<ConfigType, AuthType>;
19
+ }): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType>;
20
+ polling(props: {
21
+ options?: SlatePollingOptions;
22
+ pollEvents?: SlateTriggerPollingHandler<ConfigType, AuthType, InputType>;
23
+ handleEvent: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
24
+ }): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType>;
25
+ build(): SlateAction<Type, ConfigType, AuthType, InputType, OutputType>;
26
+ }
27
+ //# sourceMappingURL=buil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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/action/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAE1B,mBAAmB,WAAW,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { SlateSpecification } from '../specification/specification';
2
+ import { SlateAction, SlateActionParameters } from './action';
3
+ import { SlateActionBuilder } from './builder';
4
+ export interface SlateToolParameters extends SlateActionParameters {
5
+ }
6
+ export declare class SlateTool<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> extends SlateAction<'tool', ConfigType, AuthType, InputType, OutputType> {
7
+ private constructor();
8
+ static create<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateToolParameters): SlateActionBuilder<"tool", ConfigType, AuthType, {}, {}>;
9
+ }
10
+ export declare let tool: <ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateToolParameters) => SlateActionBuilder<"tool", ConfigType, AuthType, {}, {}>;
11
+ //# sourceMappingURL=tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../src/action/tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,MAAM,WAAW,mBAAoB,SAAQ,qBAAqB;CAAG;AAErE,qBAAa,SAAS,CACpB,UAAU,SAAS,EAAE,EACrB,QAAQ,SAAS,EAAE,EACnB,SAAS,SAAS,EAAE,EACpB,UAAU,SAAS,EAAE,CACrB,SAAQ,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC;IACxE,OAAO;IASP,MAAM,CAAC,MAAM,CAAC,UAAU,SAAS,EAAE,EAAE,QAAQ,SAAS,EAAE,EACtD,IAAI,EAAE,kBAAkB,CAAC,UAAU,EAAE,QAAQ,CAAC,EAC9C,MAAM,EAAE,mBAAmB;CAS9B;AAED,eAAO,IAAI,IAAI,GAAI,UAAU,SAAS,EAAE,EAAE,QAAQ,SAAS,EAAE,EAC3D,MAAM,kBAAkB,CAAC,UAAU,EAAE,QAAQ,CAAC,EAC9C,QAAQ,mBAAmB,6DACM,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { SlateSpecification } from '../specification/specification';
2
+ import { SlateAction, SlateActionParameters } from './action';
3
+ import { SlateActionBuilder } from './builder';
4
+ export declare const SlateDefaultPollingIntervalSeconds: number;
5
+ export interface SlateTriggerParameters extends SlateActionParameters {
6
+ }
7
+ export declare class SlateTrigger<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {
8
+ type: string;
9
+ }> extends SlateAction<'trigger', ConfigType, AuthType, InputType, OutputType> {
10
+ private constructor();
11
+ static create<ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateTriggerParameters): SlateActionBuilder<"trigger", ConfigType, AuthType, {}, {}>;
12
+ }
13
+ export declare let Trigger: <ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateTriggerParameters) => SlateActionBuilder<"trigger", ConfigType, AuthType, {}, {}>;
14
+ //# sourceMappingURL=trigger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trigger.d.ts","sourceRoot":"","sources":["../../src/action/trigger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,eAAO,MAAM,kCAAkC,QAAU,CAAC;AAE1D,MAAM,WAAW,sBAAuB,SAAQ,qBAAqB;CAAG;AAExE,qBAAa,YAAY,CACvB,UAAU,SAAS,EAAE,EACrB,QAAQ,SAAS,EAAE,EACnB,SAAS,SAAS,EAAE,EACpB,UAAU,SAAS;IACjB,IAAI,EAAE,MAAM,CAAC;CACd,CACD,SAAQ,WAAW,CAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC;IAC3E,OAAO;IASP,MAAM,CAAC,MAAM,CAAC,UAAU,SAAS,EAAE,EAAE,QAAQ,SAAS,EAAE,EACtD,IAAI,EAAE,kBAAkB,CAAC,UAAU,EAAE,QAAQ,CAAC,EAC9C,MAAM,EAAE,sBAAsB;CASjC;AAED,eAAO,IAAI,OAAO,GAAI,UAAU,SAAS,EAAE,EAAE,QAAQ,SAAS,EAAE,EAC9D,MAAM,kBAAkB,CAAC,UAAU,EAAE,QAAQ,CAAC,EAC9C,QAAQ,sBAAsB,gEACM,CAAC"}
@@ -0,0 +1,26 @@
1
+ import z from 'zod';
2
+ import { SlateAuthType } from './types';
3
+ export declare class SlateAuth<OutputType extends {} = {}> {
4
+ #private;
5
+ private constructor();
6
+ static create<OutputType extends {}>(): SlateAuth<OutputType>;
7
+ output<NewOutputType extends {}>(schema: z.ZodType<NewOutputType>): SlateAuth<NewOutputType>;
8
+ private addAuth;
9
+ addOauth<InputType extends {}>(auth: SlateAuthType<InputType, OutputType> & {
10
+ type: 'auth.oauth';
11
+ }): SlateAuth<OutputType>;
12
+ addTokenAuth<InputType extends {}>(auth: SlateAuthType<InputType, OutputType> & {
13
+ type: 'auth.token';
14
+ }): SlateAuth<OutputType>;
15
+ addServiceAccountAuth<InputType extends {}>(auth: SlateAuthType<InputType, OutputType> & {
16
+ type: 'auth.service_account';
17
+ }): SlateAuth<OutputType>;
18
+ addCustomAuth<InputType extends {}>(auth: SlateAuthType<InputType, OutputType> & {
19
+ type: 'auth.custom';
20
+ }): SlateAuth<OutputType>;
21
+ addNone(): SlateAuth<OutputType>;
22
+ get authStack(): import("./types").SlateAuthWithNone<any, OutputType>[];
23
+ get outputSchema(): z.ZodType<OutputType, unknown, z.core.$ZodTypeInternals<OutputType, unknown>>;
24
+ }
25
+ export declare let auth: <OutputType extends {} = {}>() => SlateAuth<OutputType>;
26
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/auth/auth.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,qBAAa,SAAS,CAAC,UAAU,SAAS,EAAE,GAAG,EAAE;;IAI/C,OAAO;IAEP,MAAM,CAAC,MAAM,CAAC,UAAU,SAAS,EAAE;IAInC,MAAM,CAAC,aAAa,SAAS,EAAE,EAC7B,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,GAC/B,SAAS,CAAC,aAAa,CAAC;IAK3B,OAAO,CAAC,OAAO;IAYf,QAAQ,CAAC,SAAS,SAAS,EAAE,EAC3B,IAAI,EAAE,aAAa,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG;QAAE,IAAI,EAAE,YAAY,CAAA;KAAE,GAClE,SAAS,CAAC,UAAU,CAAC;IAKxB,YAAY,CAAC,SAAS,SAAS,EAAE,EAC/B,IAAI,EAAE,aAAa,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG;QAAE,IAAI,EAAE,YAAY,CAAA;KAAE,GAClE,SAAS,CAAC,UAAU,CAAC;IAKxB,qBAAqB,CAAC,SAAS,SAAS,EAAE,EACxC,IAAI,EAAE,aAAa,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG;QAAE,IAAI,EAAE,sBAAsB,CAAA;KAAE,GAC5E,SAAS,CAAC,UAAU,CAAC;IAKxB,aAAa,CAAC,SAAS,SAAS,EAAE,EAChC,IAAI,EAAE,aAAa,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG;QAAE,IAAI,EAAE,aAAa,CAAA;KAAE,GACnE,SAAS,CAAC,UAAU,CAAC;IAKxB,OAAO,IAAI,SAAS,CAAC,UAAU,CAAC;IAShC,IAAI,SAAS,2DAEZ;IAED,IAAI,YAAY,kFAKf;CACF;AAED,eAAO,IAAI,IAAI,GAAI,UAAU,SAAS,EAAE,GAAG,EAAE,4BAAqC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './auth';
2
+ export * from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
@@ -0,0 +1,148 @@
1
+ import z from 'zod';
2
+ export type SlateAuthWithOauth<InputType extends {}, OutputType extends {
3
+ token: string;
4
+ refreshToken?: string;
5
+ expiresAt?: number | string | Date;
6
+ }> = {
7
+ type: 'auth.oauth';
8
+ name: string;
9
+ key: string;
10
+ scopes: {
11
+ title: string;
12
+ description?: string;
13
+ scope: string;
14
+ }[];
15
+ inputSchema?: z.ZodType<InputType>;
16
+ onInputChanged?: (params: {
17
+ previousInput: InputType | null;
18
+ newInput: InputType;
19
+ }) => Promise<{
20
+ input?: InputType;
21
+ } | void>;
22
+ getDefaultInput?: () => Promise<InputType>;
23
+ getAuthorizationUrl: (ctx: {
24
+ redirectUri: string;
25
+ state: string;
26
+ input: InputType;
27
+ clientId: string;
28
+ clientSecret: string;
29
+ scopes: string[];
30
+ }) => Promise<{
31
+ url: string;
32
+ input?: InputType;
33
+ }>;
34
+ handleCallback: (ctx: {
35
+ code: string;
36
+ state: string;
37
+ redirectUri: string;
38
+ input: InputType;
39
+ clientId: string;
40
+ clientSecret: string;
41
+ scopes: string[];
42
+ }) => Promise<{
43
+ output: OutputType;
44
+ input?: InputType;
45
+ }>;
46
+ handleTokenRefresh?: (ctx: {
47
+ output: OutputType;
48
+ input: InputType;
49
+ clientId: string;
50
+ clientSecret: string;
51
+ scopes: string[];
52
+ }) => Promise<{
53
+ output: OutputType;
54
+ input?: InputType;
55
+ }>;
56
+ getProfile?: (ctx: {
57
+ output: OutputType;
58
+ input: InputType;
59
+ scopes: string[];
60
+ }) => Promise<{
61
+ profile: Record<string, any>;
62
+ }>;
63
+ };
64
+ export type SlateAuthWithToken<InputType extends {}, OutputType extends {
65
+ token?: string;
66
+ }> = {
67
+ type: 'auth.token';
68
+ name: string;
69
+ key: string;
70
+ inputSchema?: z.ZodType<InputType>;
71
+ getOutput: (ctx: {
72
+ input: InputType;
73
+ }) => Promise<{
74
+ output: OutputType;
75
+ }>;
76
+ onInputChanged?: (params: {
77
+ previousInput: InputType;
78
+ newInput: InputType;
79
+ }) => Promise<{
80
+ input?: InputType;
81
+ } | void>;
82
+ getDefaultInput?: () => Promise<InputType>;
83
+ getProfile?: (ctx: {
84
+ output: OutputType;
85
+ input: InputType;
86
+ }) => Promise<{
87
+ profile: Record<string, any>;
88
+ }>;
89
+ };
90
+ export type SlateAuthWithServiceAccount<InputType extends {}, OutputType extends {}> = {
91
+ type: 'auth.service_account';
92
+ name: string;
93
+ key: string;
94
+ inputSchema?: z.ZodType<InputType>;
95
+ getOutput: (ctx: {
96
+ input: InputType;
97
+ }) => Promise<{
98
+ output: OutputType;
99
+ }>;
100
+ onInputChanged?: (params: {
101
+ previousInput: InputType;
102
+ newInput: InputType;
103
+ }) => Promise<{
104
+ input?: InputType;
105
+ } | void>;
106
+ getDefaultInput?: () => Promise<InputType>;
107
+ getProfile?: (ctx: {
108
+ output: OutputType;
109
+ input: InputType;
110
+ }) => Promise<{
111
+ profile: Record<string, any>;
112
+ }>;
113
+ };
114
+ export type SlateAuthWithCustomData<InputType extends {}, OutputType extends {}> = {
115
+ type: 'auth.custom';
116
+ name: string;
117
+ key: string;
118
+ inputSchema?: z.ZodType<InputType>;
119
+ getOutput: (ctx: {
120
+ input: InputType;
121
+ }) => Promise<{
122
+ output: OutputType;
123
+ }>;
124
+ onInputChanged?: (params: {
125
+ previousInput: InputType;
126
+ newInput: InputType;
127
+ }) => Promise<{
128
+ input?: InputType;
129
+ } | void>;
130
+ getDefaultInput?: () => Promise<InputType>;
131
+ getProfile?: (ctx: {
132
+ output: OutputType;
133
+ input: InputType;
134
+ }) => Promise<{
135
+ profile: Record<string, any>;
136
+ }>;
137
+ };
138
+ export type SlateAuthWithNone<InputType extends {}, OutputType extends {}> = {
139
+ type: 'auth.none';
140
+ name: string;
141
+ key: string;
142
+ };
143
+ export type SlateAuthType<InputType extends {}, OutputType extends {}> = SlateAuthWithOauth<InputType, OutputType & {
144
+ token: string;
145
+ }> | SlateAuthWithToken<InputType, OutputType & {
146
+ token?: string;
147
+ }> | SlateAuthWithServiceAccount<InputType, OutputType> | SlateAuthWithCustomData<InputType, OutputType> | SlateAuthWithNone<InputType, OutputType>;
148
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/auth/types.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,MAAM,kBAAkB,CAC5B,SAAS,SAAS,EAAE,EACpB,UAAU,SAAS;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CACpC,IACC;IACF,IAAI,EAAE,YAAY,CAAC;IAEnB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IAEZ,MAAM,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;KACf,EAAE,CAAC;IAEJ,WAAW,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEnC,cAAc,CAAC,EAAE,CA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QACzB,QAAQ,EAAE,SAAS,CAAC;KACrB,KAAK,OAAO,CAAC;QAAE,KAAK,CAAC,EAAE,SAAS,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;IAE5C,eAAe,CAAC,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC;IAE3C,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE;QAAE,MAAM,EAAE,UAAU,CAAC;QAAC,KAAK,EAAE,SAAS,CAAA;KAAE,KAAK,OAAO,CAAC;QACtE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC9B,CAAC,CAAC;CACJ,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAAC,SAAS,SAAS,EAAE,EAAE,UAAU,SAAS,EAAE,IAAI;IAC3E,IAAI,EAAE,WAAW,CAAC;IAElB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,aAAa,CAAC,SAAS,SAAS,EAAE,EAAE,UAAU,SAAS,EAAE,IACjE,kBAAkB,CAAC,SAAS,EAAE,UAAU,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,GAC7D,kBAAkB,CAAC,SAAS,EAAE,UAAU,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GAC9D,2BAA2B,CAAC,SAAS,EAAE,UAAU,CAAC,GAClD,uBAAuB,CAAC,SAAS,EAAE,UAAU,CAAC,GAC9C,iBAAiB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { CreateAxiosDefaults } from 'axios';
2
+ export declare let createAxios: (config?: CreateAxiosDefaults) => import("axios").AxiosInstance;
3
+ export declare let axios: import("axios").AxiosInstance;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/axios/index.ts"],"names":[],"mappings":"AAAA,OAAkB,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAGvD,eAAO,IAAI,WAAW,GAAI,SAAS,mBAAmB,kCAsBrD,CAAC;AAEF,eAAO,IAAI,KAAK,+BAAgB,CAAC"}
@@ -0,0 +1,22 @@
1
+ import z from 'zod';
2
+ export declare class SlateConfig<ConfigType extends {}> {
3
+ #private;
4
+ private constructor();
5
+ static create<ConfigType extends {}>(schema: z.ZodType<ConfigType>): SlateConfig<ConfigType>;
6
+ config<NewConfigType extends {}>(schema: z.ZodType<NewConfigType>): SlateConfig<NewConfigType>;
7
+ onConfigChanged(handler: (params: {
8
+ previousConfig: ConfigType | null;
9
+ newConfig: ConfigType;
10
+ }) => void): SlateConfig<ConfigType>;
11
+ getDefaultConfig(getter: () => ConfigType): SlateConfig<ConfigType>;
12
+ get configSchema(): z.ZodType<ConfigType, unknown, z.core.$ZodTypeInternals<ConfigType, unknown>>;
13
+ get handlers(): {
14
+ configChanged: ((params: {
15
+ previousConfig: ConfigType | null;
16
+ newConfig: ConfigType;
17
+ }) => void) | null;
18
+ getDefaultConfig: (() => ConfigType) | null;
19
+ };
20
+ }
21
+ export declare let config: <ConfigType extends {}>(schema: z.ZodType<ConfigType>) => SlateConfig<ConfigType>;
22
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,qBAAa,WAAW,CAAC,UAAU,SAAS,EAAE;;IAO5C,OAAO;IAIP,MAAM,CAAC,MAAM,CAAC,UAAU,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;IAIlE,MAAM,CAAC,aAAa,SAAS,EAAE,EAC7B,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,GAC/B,WAAW,CAAC,aAAa,CAAC;IAK7B,eAAe,CACb,OAAO,EAAE,CAAC,MAAM,EAAE;QAAE,cAAc,EAAE,UAAU,GAAG,IAAI,CAAC;QAAC,SAAS,EAAE,UAAU,CAAA;KAAE,KAAK,IAAI,GACtF,WAAW,CAAC,UAAU,CAAC;IAK1B,gBAAgB,CAAC,MAAM,EAAE,MAAM,UAAU,GAAG,WAAW,CAAC,UAAU,CAAC;IAKnE,IAAI,YAAY,kFAEf;IAED,IAAI,QAAQ;iCAnCE;YAAE,cAAc,EAAE,UAAU,GAAG,IAAI,CAAC;YAAC,SAAS,EAAE,UAAU,CAAA;SAAE,KAAK,IAAI;iCAEzD,UAAU;MAsCnC;CACF;AAED,eAAO,IAAI,MAAM,GAAI,UAAU,SAAS,EAAE,EAAE,QAAQ,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,4BACjC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './config';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { SlateLogger, SlateLogMessageInput } from '../logger';
2
+ import { SlateSpecification } from '../specification/specification';
3
+ export declare class SlateContext<ConfigType extends {}, AuthType extends {}, InputType extends {}> {
4
+ #private;
5
+ private readonly spec;
6
+ private readonly logger;
7
+ constructor(config: ConfigType, input: InputType, auth: AuthType, spec: SlateSpecification<ConfigType, AuthType>, logger: SlateLogger);
8
+ get specification(): SlateSpecification<ConfigType, AuthType>;
9
+ get config(): Readonly<ConfigType>;
10
+ get input(): Readonly<InputType>;
11
+ get event(): Readonly<InputType>;
12
+ get state(): "state" extends keyof InputType ? InputType["state"] : never;
13
+ get request(): "request" extends keyof InputType ? InputType["request"] : never;
14
+ get auth(): Readonly<AuthType>;
15
+ info(message: SlateLogMessageInput): void;
16
+ warn(message: SlateLogMessageInput): void;
17
+ error(message: SlateLogMessageInput): void;
18
+ progress(message: SlateLogMessageInput): void;
19
+ }
20
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/context/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,qBAAa,YAAY,CAAC,UAAU,SAAS,EAAE,EAAE,QAAQ,SAAS,EAAE,EAAE,SAAS,SAAS,EAAE;;IAStF,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAJvB,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,SAAS,EAChB,IAAI,EAAE,QAAQ,EACG,IAAI,EAAE,kBAAkB,CAAC,UAAU,EAAE,QAAQ,CAAC,EAC9C,MAAM,EAAE,WAAW;IAOtC,IAAI,aAAa,6CAEhB;IAED,IAAI,MAAM,yBAET;IAED,IAAI,KAAK,wBAER;IAED,IAAI,KAAK,wBAER;IAED,IAAI,KAAK,IAC6C,OAAO,SAAS,MAAM,SAAS,GAC/E,SAAS,CAAC,OAAO,CAAC,GAClB,KAAK,CACV;IAED,IAAI,OAAO,IAC6C,SAAS,SAAS,MAAM,SAAS,GACnF,SAAS,CAAC,SAAS,CAAC,GACpB,KAAK,CACV;IAED,IAAI,IAAI,uBAEP;IAED,IAAI,CAAC,OAAO,EAAE,oBAAoB;IAIlC,IAAI,CAAC,OAAO,EAAE,oBAAoB;IAIlC,KAAK,CAAC,OAAO,EAAE,oBAAoB;IAInC,QAAQ,CAAC,OAAO,EAAE,oBAAoB;CAGvC"}
@@ -0,0 +1,4 @@
1
+ import { SlateContext } from './context';
2
+ export declare let runWithContext: <ConfigType extends {}, AuthType extends {}, InputType extends {}>(context: SlateContext<ConfigType, AuthType, InputType>, fn: () => Promise<void>) => Promise<void>;
3
+ export declare let getCurrentContext: <ConfigType extends {}, AuthType extends {}, InputType extends {}>() => SlateContext<ConfigType, AuthType, InputType>;
4
+ //# sourceMappingURL=hook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../src/context/hook.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAIzC,eAAO,IAAI,cAAc,GAAI,UAAU,SAAS,EAAE,EAAE,QAAQ,SAAS,EAAE,EAAE,SAAS,SAAS,EAAE,EAC3F,SAAS,YAAY,CAAC,UAAU,EAAE,QAAQ,EAAE,SAAS,CAAC,EACtD,IAAI,MAAM,OAAO,CAAC,IAAI,CAAC,kBAGxB,CAAC;AAEF,eAAO,IAAI,iBAAiB,GAC1B,UAAU,SAAS,EAAE,EACrB,QAAQ,SAAS,EAAE,EACnB,SAAS,SAAS,EAAE,OACjB,YAAY,CAAC,UAAU,EAAE,QAAQ,EAAE,SAAS,CAMhD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './context';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare class SlateError extends Error {
2
+ constructor(message: string);
3
+ static is(error: unknown): error is SlateError;
4
+ }
5
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/error/base.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAW,SAAQ,KAAK;gBACvB,OAAO,EAAE,MAAM;IAK3B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU;CAG/C"}
@@ -0,0 +1,6 @@
1
+ import { SlateError } from './base';
2
+ export declare class SlateDeclarationError extends SlateError {
3
+ constructor(message: string);
4
+ static is(error: unknown): error is SlateDeclarationError;
5
+ }
6
+ //# sourceMappingURL=declaration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declaration.d.ts","sourceRoot":"","sources":["../../src/error/declaration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,qBAAa,qBAAsB,SAAQ,UAAU;gBACvC,OAAO,EAAE,MAAM;IAK3B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,qBAAqB;CAG1D"}
@@ -0,0 +1,3 @@
1
+ export * from './base';
2
+ export * from './declaration';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/error/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC"}
package/dist/index.cjs ADDED
@@ -0,0 +1,2 @@
1
+ var e=require("@lowerdeck/error"),t=require("@slates/proto"),r=require("@slates/provider");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=/*#__PURE__*/n(require("zod"));function i(e,t){if(!{}.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var a=0;function u(e){return"__private_"+a+++"_"+e}function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s.apply(null,arguments)}function c(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}var l=function(t,r){var n=t.spec.auth.authStack.find(function(e){return e.key==r});if(!n)throw new e.ServiceError(e.badRequestError({message:"Invalid authentication method ID: "+r}));return n},h=function(e,t){var r;return{id:t.key,name:t.name,type:t.type,scopes:"scopes"in t?t.scopes.map(function(e){return{id:e.scope,title:e.title,description:e.description}}):void 0,inputSchema:(null!=(r=t.inputSchema)?r:o.default.object({})).toJSONSchema(),outputSchema:e.spec.auth.outputSchema.toJSONSchema(),capabilities:{getDefaultInput:{enabled:!(!("getDefaultInput"in t)||!t.getDefaultInput)},handleTokenRefresh:{enabled:!(!("handleTokenRefresh"in t)||!t.handleTokenRefresh)},handleChangedInput:{enabled:!!t.onInputChanged},getProfile:{enabled:!!t.getProfile}}}},p=function(t,r){var n=t.actions.find(function(e){return e.key==r});if(!n)throw new e.ServiceError(e.notFoundError("action",r));return n},d=function(t,r,n){var o=p(t,n);if(o.type!=r)throw new e.ServiceError(e.badRequestError({message:"Action with ID "+n+" is not of type "+r}));return o},f=function(e,t){var n;return s({},{id:t.key,name:t.name,description:t.description,instructions:t.instructions,constraints:t.constraints,tags:t.tags,metadata:t.metadata,inputSchema:t.inputSchema.toJSONSchema(),outputSchema:t.outputSchema.toJSONSchema()},"tool"==t.type?{type:"action.tool",capabilities:{}}:{type:"action.trigger",capabilities:{},invocation:"polling"==t.source?{type:"polling",intervalSeconds:null!=(n=t.polling.intervalInSeconds)?n:r.SlateDefaultPollingIntervalSeconds}:{type:"webhook",autoRegistration:!!t.autoRegisterWebhook,autoUnregistration:!!t.autoUnregisterWebhook}})},v=/*#__PURE__*/u("value"),m=/*#__PURE__*/function(){function e(e){Object.defineProperty(this,v,{writable:!0,value:void 0}),i(this,v)[v]=e}var t,r,n=e.prototype;return n.get=function(){return i(this,v)[v]},n.set=function(e){i(this,v)[v]=e},t=e,(r=[{key:"value",get:function(){return i(this,v)[v]}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,c(n.key),n)}}(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),t}(),g=function(t,r,n,o){var i=t.safeParse(r);if(!i.success)throw new e.ServiceError(function(t,r,n){return e.validationError({message:r,entity:t,errors:n.issues.map(function(e){return s({},e,{path:e.path.map(function(e){return String(e)})})})})}(n,o,i.error));return i.data};exports.createProviderHandler=function(n,o){return t.createSlatesProviderProtoHandler(function(t){try{var i=new m(null),a=new m(null),u=new m(null),c=new m(null),v=new m(null),P=new r.SlateLogger(o),w=function(){var t=i.get(),r=a.get();if(!t||!r)throw new e.ServiceError(e.preconditionFailedError({message:"Connection context has not been initialized"}));return{protocol:t,participants:r}},S=function(){var t=w(),r=c.get(),o=v.get(),i=u.get();if(!r||!o||!i&&n.spec.auth.authStack.length>0)throw new e.ServiceError(e.preconditionFailedError({message:"Session context has not been initialized"}));return s({},t,{config:r.value,session:o,auth:i})};return t.onNotification("slates/hello",function(e){var t=e.params;try{return i.set(t.protocol),Promise.resolve()}catch(e){return Promise.reject(e)}}),t.onNotification("slates/participant.set",function(t){var r=t.params;try{if(!i.get())throw new e.ServiceError(e.preconditionFailedError({message:"Connection protocol has not been initialized"}));return a.set(r.participants),Promise.resolve()}catch(e){return Promise.reject(e)}}),t.onNotification("slates/auth.set",function(e){var t=e.params;try{w(),l(n,t.authenticationMethodId);var r=g(n.spec.authSchema,t.output,"auth","Invalid authentication output for method ID: "+t.authenticationMethodId);return u.set({authenticationMethodId:t.authenticationMethodId,output:r}),Promise.resolve()}catch(e){return Promise.reject(e)}}),t.onNotification("slates/config.set",function(e){var t=e.params;try{w();var r=g(n.spec.configSchema,t.config,"config","Invalid configuration");return c.set({value:r}),Promise.resolve()}catch(e){return Promise.reject(e)}}),t.onNotification("slates/session.start",function(e){var t=e.params;try{return w(),v.set({id:t.sessionId,state:t.state}),Promise.resolve()}catch(e){return Promise.reject(e)}}),t.onRequest("slates/config.changed",function(e){var t=e.params;try{w();var r=g(n.spec.config.configSchema,t.newConfig,"config","Invalid configuration"),o=n.spec.config.handlers.configChanged;return o?Promise.resolve(o({previousConfig:t.previousConfig,newConfig:r})).then(function(e){var t;return{success:!0,config:null!=(t=null==e?void 0:e.config)?t:r}}):Promise.resolve({success:!0,config:r})}catch(e){return Promise.reject(e)}}),t.onRequest("slates/config.get_default",function(e){try{w();var t=n.spec.config.handlers.getDefaultConfig;return t?Promise.resolve(t()).then(function(e){return{config:e}}):Promise.resolve({config:null})}catch(e){return Promise.reject(e)}}),t.onRequest("slates/config.schema.get",function(e){try{return w(),Promise.resolve({schema:n.spec.configSchema.toJSONSchema()})}catch(e){return Promise.reject(e)}}),t.onRequest("slates/provider.identify",function(e){try{return w(),Promise.resolve({protocol:"slates@2026-01-01",provider:{type:"provider",id:n.spec.key,name:n.spec.name,description:n.spec.description,metadata:n.spec.parameters.metadata}})}catch(e){return Promise.reject(e)}}),t.onRequest("slates/auth.methods.list",function(e){try{return w(),Promise.resolve({authenticationMethods:n.spec.auth.authStack.map(function(e){return h(n,e)})})}catch(e){return Promise.reject(e)}}),t.onRequest("slates/auth.method.get",function(e){var t=e.params;try{w();var r=l(n,t.authenticationMethodId);return Promise.resolve({authenticationMethod:h(n,r)})}catch(e){return Promise.reject(e)}}),t.onRequest("slates/auth.input.get_default",function(e){var t=e.params;try{w();var r=l(n,t.authenticationMethodId);return r.getDefaultInput?Promise.resolve(r.getDefaultInput()).then(function(e){return{input:e}}):Promise.resolve({input:null})}catch(e){return Promise.reject(e)}}),t.onRequest("slates/auth.input.changed",function(e){var t=e.params;try{w();var r=l(n,t.authenticationMethodId);return r.onInputChanged?Promise.resolve(r.onInputChanged({previousInput:t.previousInput,newInput:t.newInput})).then(function(e){var r;return{success:!0,input:null!=(r=null==e?void 0:e.input)?r:t.newInput}}):Promise.resolve({success:!0,input:t.newInput})}catch(e){return Promise.reject(e)}}),t.onRequest("slates/auth.output.get",function(e){var t=e.params;try{var r,o=function(e){return r?e:{output:a}};w();var i=l(n,t.authenticationMethodId),a=t.input;i.inputSchema&&(a=g(i.inputSchema,a,"auth","Invalid authentication input for method ID: "+t.authenticationMethodId));var u=function(){if("getOutput"in i)return Promise.resolve(i.getOutput({input:a})).then(function(e){return r=1,{output:e.output}})}();return Promise.resolve(u&&u.then?u.then(o):o(u))}catch(e){return Promise.reject(e)}}),t.onRequest("slates/auth.authorization_callback.handle",function(t){var r=t.params;try{var o,i=function(t){if(o)return t;throw new e.ServiceError(e.preconditionFailedError({message:"Authentication method does not support authorization callback handling: "+r.authenticationMethodId}))};w();var a=l(n,r.authenticationMethodId),u=function(){if("handleCallback"in a)return Promise.resolve(a.handleCallback({code:r.code,state:r.state,redirectUri:r.redirectUri,input:r.input,clientId:r.clientId,clientSecret:r.clientSecret,scopes:r.scopes})).then(function(e){return o=1,{output:e.output,input:e.input}})}();return Promise.resolve(u&&u.then?u.then(i):i(u))}catch(e){return Promise.reject(e)}}),t.onRequest("slates/auth.authorization_url.get",function(t){var r=t.params;try{var o,i=function(t){if(o)return t;throw new e.ServiceError(e.preconditionFailedError({message:"Authentication method does not support authorization URL retrieval: "+r.authenticationMethodId}))};w();var a=l(n,r.authenticationMethodId),u=function(){if("getAuthorizationUrl"in a)return Promise.resolve(a.getAuthorizationUrl({redirectUri:r.redirectUri,state:r.state,input:r.input,clientId:r.clientId,clientSecret:r.clientSecret,scopes:r.scopes})).then(function(e){return o=1,{authorizationUrl:e.url,input:e.input}})}();return Promise.resolve(u&&u.then?u.then(i):i(u))}catch(e){return Promise.reject(e)}}),t.onRequest("slates/auth.profile.get",function(t){var r=t.params;try{var o,i=function(t){if(o)return t;throw new e.ServiceError(e.preconditionFailedError({message:"Authentication method does not support profile retrieval: "+r.authenticationMethodId}))};w();var a=l(n,r.authenticationMethodId),u=function(){if(a.getProfile)return Promise.resolve(a.getProfile({output:r.output,input:r.input,scopes:r.scopes})).then(function(e){return o=1,{profile:e.profile}})}();return Promise.resolve(u&&u.then?u.then(i):i(u))}catch(e){return Promise.reject(e)}}),t.onRequest("slates/auth.token_refresh.handle",function(t){var r=t.params;try{var o,i=function(t){if(o)return t;throw new e.ServiceError(e.preconditionFailedError({message:"Authentication method does not support token refresh handling: "+r.authenticationMethodId}))};w();var a=l(n,r.authenticationMethodId),u=function(){if("handleTokenRefresh"in a&&a.handleTokenRefresh)return Promise.resolve(a.handleTokenRefresh({output:r.output,input:r.input,clientId:r.clientId,clientSecret:r.clientSecret,scopes:r.scopes})).then(function(e){return o=1,{output:e.output,input:e.input}})}();return Promise.resolve(u&&u.then?u.then(i):i(u))}catch(e){return Promise.reject(e)}}),t.onRequest("slates/actions.list",function(e){try{return w(),Promise.resolve({actions:n.actions.map(function(e){return f(0,e)})})}catch(e){return Promise.reject(e)}}),t.onRequest("slates/action.get",function(e){var t=e.params;try{w();var r=p(n,t.actionId);return Promise.resolve({action:f(0,r)})}catch(e){return Promise.reject(e)}}),t.onRequest("slates/action.tool.invoke",function(e){var t=e.params;try{var o,i=S(),a=d(n,"tool",t.actionId),u=g(a.inputSchema,t.input,"input","Invalid input for tool ID: "+t.actionId);return Promise.resolve(a.handleInvocation(new r.SlateContext(i.config,u,null==(o=i.auth)?void 0:o.output,n.spec,P))).then(function(e){return{output:e.output,message:e.message}})}catch(e){return Promise.reject(e)}}),t.onRequest("slates/action.trigger.map_event",function(e){var t=e.params;try{var o,i=S(),a=d(n,"trigger",t.actionId),u=g(a.inputSchema,t.input,"input","Invalid event for trigger ID: "+t.actionId);return Promise.resolve(a.handleEvent(new r.SlateContext(i.config,u,null==(o=i.auth)?void 0:o.output,n.spec,P))).then(function(e){return{id:e.id,type:e.type,output:e.output}})}catch(e){return Promise.reject(e)}}),t.onRequest("slates/action.trigger.poll_events",function(t){var o=t.params;try{var i,a=S(),u=d(n,"trigger",o.actionId);if(!u.pollEvents)throw new e.ServiceError(e.badRequestError({message:"Trigger action does not support polling: "+o.actionId}));return Promise.resolve(u.pollEvents(new r.SlateContext(a.config,{state:o.state},null==(i=a.auth)?void 0:i.output,n.spec,P))).then(function(e){return{inputs:e.inputs,updatedState:e.updatedState}})}catch(e){return Promise.reject(e)}}),t.onRequest("slates/action.trigger.webhook_handle",function(t){var o=t.params;try{var i,a=S(),u=d(n,"trigger",o.actionId);if(!u.handleRequest)throw new e.ServiceError(e.badRequestError({message:"Trigger action does not support webhook requests: "+o.actionId}));var s=new Request(o.url,{method:o.method,headers:o.headers,body:o.body?Uint8Array.from(atob(o.body.content),function(e){return e.charCodeAt(0)}):null});return Promise.resolve(u.handleRequest(new r.SlateContext(a.config,{request:s,state:o.state},null==(i=a.auth)?void 0:i.output,n.spec,P))).then(function(e){return{inputs:e.inputs,updatedState:e.updatedState}})}catch(e){return Promise.reject(e)}}),t.onRequest("slates/action.trigger.webhook_register",function(t){var o=t.params;try{var i,a=S(),u=d(n,"trigger",o.actionId);if(!u.autoRegisterWebhook)throw new e.ServiceError(e.badRequestError({message:"Trigger action does not support webhook auto-registration: "+o.actionId}));return Promise.resolve(u.autoRegisterWebhook(new r.SlateContext(a.config,{webhookBaseUrl:o.webhookBaseUrl},null==(i=a.auth)?void 0:i.output,n.spec,P))).then(function(e){return{registrationDetails:e.registrationDetails,state:e.state}})}catch(e){return Promise.reject(e)}}),t.onRequest("slates/action.trigger.webhook_unregister",function(t){var o=t.params;try{var i,a=S(),u=d(n,"trigger",o.actionId);if(!u.autoUnregisterWebhook)throw new e.ServiceError(e.badRequestError({message:"Trigger action does not support webhook auto-unregistration: "+o.actionId}));return Promise.resolve(u.autoUnregisterWebhook(new r.SlateContext(a.config,{webhookBaseUrl:o.webhookBaseUrl,registrationDetails:o.registrationDetails,state:o.state},null==(i=a.auth)?void 0:i.output,n.spec,P))).then(function(){return{}})}catch(e){return Promise.reject(e)}}),Promise.resolve()}catch(e){return Promise.reject(e)}})};
2
+ //# sourceMappingURL=index.cjs.map