@slates/provider 1.0.0-rc.2 → 1.0.0-rc.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/dist/index.cjs +2847 -2
  2. package/dist/index.d.cts +1019 -0
  3. package/dist/index.d.ts +1019 -9
  4. package/dist/index.module.js +2737 -2
  5. package/package.json +9 -6
  6. package/src/action/action.ts +92 -4
  7. package/src/action/attachment.ts +87 -0
  8. package/src/action/builder.test.ts +136 -0
  9. package/src/action/builder.ts +113 -15
  10. package/src/action/directUpload.ts +59 -0
  11. package/src/action/getFileUrlTool.ts +41 -0
  12. package/src/action/index.ts +4 -2
  13. package/src/action/publicTool.ts +36 -0
  14. package/src/action/scopes.test.ts +76 -0
  15. package/src/action/scopes.ts +103 -0
  16. package/src/action/tool.ts +22 -6
  17. package/src/action/trigger.ts +19 -11
  18. package/src/adapter/adapter.ts +38 -0
  19. package/src/adapter/index.test.ts +322 -0
  20. package/src/adapter/index.ts +2 -0
  21. package/src/adapter/spec.ts +154 -0
  22. package/src/auth/auth.ts +3 -3
  23. package/src/auth/index.ts +2 -0
  24. package/src/auth/oauth.test.ts +83 -0
  25. package/src/auth/oauth.ts +150 -0
  26. package/src/auth/redact.test.ts +103 -0
  27. package/src/auth/redact.ts +111 -0
  28. package/src/auth/types.ts +72 -13
  29. package/src/axios/http.test.ts +83 -0
  30. package/src/axios/index.ts +116 -10
  31. package/src/axios/trace.test.ts +377 -0
  32. package/src/axios/trace.ts +803 -0
  33. package/src/config/config.ts +14 -3
  34. package/src/context/context.ts +264 -17
  35. package/src/context/hook.test.ts +46 -0
  36. package/src/context/hook.ts +15 -6
  37. package/src/context/index.ts +1 -0
  38. package/src/context/pQueue.ts +4 -0
  39. package/src/crypto/hmac.test.ts +40 -0
  40. package/src/crypto/hmac.ts +32 -0
  41. package/src/crypto/index.ts +1 -0
  42. package/src/docs.ts +22 -0
  43. package/src/error/api.test.ts +114 -0
  44. package/src/error/api.ts +236 -0
  45. package/src/error/axios.ts +220 -0
  46. package/src/error/base.test.ts +178 -0
  47. package/src/error/base.ts +108 -2
  48. package/src/error/declaration.ts +7 -2
  49. package/src/error/defaults.ts +50 -0
  50. package/src/error/index.ts +4 -0
  51. package/src/error/service.ts +170 -0
  52. package/src/error/types.ts +75 -0
  53. package/src/error/utils.ts +157 -0
  54. package/src/file/index.test.ts +36 -0
  55. package/src/file/index.ts +27 -0
  56. package/src/index.ts +8 -0
  57. package/src/logger/logger.test.ts +57 -0
  58. package/src/logger/logger.ts +72 -11
  59. package/src/module/resolveDefaultExport.test.ts +32 -0
  60. package/src/module/resolveDefaultExport.ts +14 -0
  61. package/src/object/index.test.ts +38 -0
  62. package/src/object/index.ts +12 -0
  63. package/src/specification/slate.ts +40 -4
  64. package/src/specification/specification.ts +10 -6
  65. package/src/webhook/graph.test.ts +37 -0
  66. package/src/webhook/graph.ts +22 -0
  67. package/src/webhook/index.ts +2 -0
  68. package/src/webhook/meta.test.ts +52 -0
  69. package/src/webhook/meta.ts +43 -0
  70. package/dist/action/action.d.ts +0 -98
  71. package/dist/action/action.d.ts.map +0 -1
  72. package/dist/action/builder.d.ts +0 -27
  73. package/dist/action/builder.d.ts.map +0 -1
  74. package/dist/action/index.d.ts +0 -5
  75. package/dist/action/index.d.ts.map +0 -1
  76. package/dist/action/tool.d.ts +0 -14
  77. package/dist/action/tool.d.ts.map +0 -1
  78. package/dist/action/trigger.d.ts +0 -32
  79. package/dist/action/trigger.d.ts.map +0 -1
  80. package/dist/auth/auth.d.ts +0 -30
  81. package/dist/auth/auth.d.ts.map +0 -1
  82. package/dist/auth/index.d.ts +0 -3
  83. package/dist/auth/index.d.ts.map +0 -1
  84. package/dist/auth/types.d.ts +0 -148
  85. package/dist/auth/types.d.ts.map +0 -1
  86. package/dist/axios/index.d.ts +0 -4
  87. package/dist/axios/index.d.ts.map +0 -1
  88. package/dist/config/config.d.ts +0 -26
  89. package/dist/config/config.d.ts.map +0 -1
  90. package/dist/config/index.d.ts +0 -2
  91. package/dist/config/index.d.ts.map +0 -1
  92. package/dist/context/context.d.ts +0 -20
  93. package/dist/context/context.d.ts.map +0 -1
  94. package/dist/context/hook.d.ts +0 -4
  95. package/dist/context/hook.d.ts.map +0 -1
  96. package/dist/context/index.d.ts +0 -2
  97. package/dist/context/index.d.ts.map +0 -1
  98. package/dist/error/base.d.ts +0 -5
  99. package/dist/error/base.d.ts.map +0 -1
  100. package/dist/error/declaration.d.ts +0 -6
  101. package/dist/error/declaration.d.ts.map +0 -1
  102. package/dist/error/index.d.ts +0 -3
  103. package/dist/error/index.d.ts.map +0 -1
  104. package/dist/index.cjs.map +0 -1
  105. package/dist/index.d.ts.map +0 -1
  106. package/dist/index.modern.js +0 -2
  107. package/dist/index.modern.js.map +0 -1
  108. package/dist/index.module.js.map +0 -1
  109. package/dist/index.umd.js +0 -2
  110. package/dist/index.umd.js.map +0 -1
  111. package/dist/logger/index.d.ts +0 -2
  112. package/dist/logger/index.d.ts.map +0 -1
  113. package/dist/logger/logger.d.ts +0 -20
  114. package/dist/logger/logger.d.ts.map +0 -1
  115. package/dist/specification/index.d.ts +0 -3
  116. package/dist/specification/index.d.ts.map +0 -1
  117. package/dist/specification/slate.d.ts +0 -15
  118. package/dist/specification/slate.d.ts.map +0 -1
  119. package/dist/specification/specification.d.ts +0 -30
  120. package/dist/specification/specification.d.ts.map +0 -1
  121. package/dist/specification/zero.d.ts +0 -13
  122. package/dist/specification/zero.d.ts.map +0 -1
  123. package/dist/tokens.d.ts +0 -34
  124. package/dist/tokens.d.ts.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.module.js","sources":["../src/action/action.ts","../src/error/base.ts","../src/error/declaration.ts","../src/action/builder.ts","../src/action/tool.ts","../src/action/trigger.ts","../src/auth/auth.ts","../src/context/hook.ts","../src/axios/index.ts","../src/config/config.ts","../src/context/context.ts","../src/logger/logger.ts","../src/specification/slate.ts","../src/specification/specification.ts"],"sourcesContent":["import { z } from 'zod';\nimport { SlateContext } from '../context';\nimport { SlateSpecification } from '../specification/specification';\n\nexport type SlateActionType = 'tool' | 'trigger';\n\nexport interface SlateActionParameters {\n key: string;\n name: string;\n description?: string;\n instructions?: string[];\n constraints?: string[];\n tags?: {\n destructive?: boolean;\n readOnly?: boolean;\n [key: string]: boolean | undefined;\n };\n metadata?: Record<string, any>;\n}\n\nexport type SlateToolInvocationHandler<\n ConfigType extends {},\n AuthType extends {},\n InputType extends {},\n OutputType extends {}\n> = (context: SlateContext<ConfigType, AuthType, InputType>) => Promise<{\n output: OutputType;\n message: string;\n}>;\n\nexport type SlateTriggerMappingHandler<\n ConfigType extends {},\n AuthType extends {},\n InputType extends {},\n OutputType extends {}\n> = (context: SlateContext<ConfigType, AuthType, InputType>) => Promise<{\n type: string;\n id: string;\n output: OutputType;\n}>;\n\nexport type SlateTriggerPollingHandler<\n ConfigType extends {},\n AuthType extends {},\n InputType extends {}\n> = (context: SlateContext<ConfigType, AuthType, { state: any | null }>) => Promise<{\n inputs: InputType[];\n updatedState?: any;\n}>;\n\nexport type SlateTriggerWebhookRequestHandler<\n ConfigType extends {},\n AuthType extends {},\n InputType extends {}\n> = (\n context: SlateContext<ConfigType, AuthType, { request: Request; state: any | null }>\n) => Promise<{\n inputs: InputType[];\n updatedState?: any;\n}>;\n\nexport type SlateTriggerWebhookAutoRegistrationHandler<\n ConfigType extends {},\n AuthType extends {}\n> = (context: SlateContext<ConfigType, AuthType, { webhookBaseUrl: string }>) => Promise<{\n registrationDetails: any;\n state?: any;\n}>;\n\nexport type SlateTriggerWebhookAutoUnregistrationHandler<\n ConfigType extends {},\n AuthType extends {}\n> = (\n context: SlateContext<\n ConfigType,\n AuthType,\n { webhookBaseUrl: string; registrationDetails: any; state: any | null }\n >\n) => Promise<unknown>;\n\nexport interface SlateActionParametersTool<\n ConfigType extends {},\n AuthType extends {},\n InputType extends {},\n OutputType extends {}\n> {\n type: 'tool';\n handleInvocation: SlateToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>;\n}\n\nexport interface SlatePollingOptions {\n intervalInSeconds?: number;\n}\n\nexport interface SlateActionParametersTrigger<\n ConfigType extends {},\n AuthType extends {},\n InputType extends {},\n OutputType extends {}\n> {\n type: 'trigger';\n source: 'polling' | 'webhook';\n polling?: SlatePollingOptions;\n handleEvent: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;\n handleRequest?: SlateTriggerWebhookRequestHandler<ConfigType, AuthType, InputType>;\n pollEvents?: SlateTriggerPollingHandler<ConfigType, AuthType, InputType>;\n autoRegisterWebhook?: SlateTriggerWebhookAutoRegistrationHandler<ConfigType, AuthType>;\n autoUnregisterWebhook?: SlateTriggerWebhookAutoUnregistrationHandler<ConfigType, AuthType>;\n}\n\nexport type SlateActionParametersAny<\n ConfigType extends {},\n AuthType extends {},\n InputType extends {},\n OutputType extends {}\n> =\n | SlateActionParametersTool<ConfigType, AuthType, InputType, OutputType>\n | SlateActionParametersTrigger<ConfigType, AuthType, InputType, OutputType>;\n\nexport type SlateActionCreateParameters<\n ConfigType extends {},\n AuthType extends {},\n InputType extends {},\n OutputType extends {}\n> = SlateActionParametersAny<ConfigType, AuthType, InputType, OutputType> &\n SlateActionParameters & {\n configSchema: z.ZodType<ConfigType>;\n authSchema: z.ZodType<AuthType>;\n inputSchema: z.ZodType<InputType>;\n outputSchema: z.ZodType<OutputType>;\n };\n\nexport abstract class SlateAction<\n Type extends SlateActionType,\n ConfigType extends {},\n AuthType extends {},\n InputType extends {},\n OutputType extends {}\n> {\n constructor(\n public readonly type: Type,\n protected readonly _spec: SlateSpecification<ConfigType, AuthType>,\n protected readonly _inputSchema: z.ZodType<InputType>,\n protected readonly _outputSchema: z.ZodType<OutputType>,\n protected readonly _params: SlateActionParameters\n ) {}\n\n get configSchema() {\n return this._spec.configSchema;\n }\n\n get inputSchema() {\n return this._inputSchema;\n }\n\n get outputSchema() {\n return this._outputSchema;\n }\n\n get parameters() {\n return this._params;\n }\n\n get key() {\n return this._params.key;\n }\n\n get name() {\n return this._params.name;\n }\n\n get description() {\n return this._params.description;\n }\n\n get tags() {\n return this._params.tags;\n }\n\n get instructions() {\n return this._params.instructions;\n }\n\n get constraints() {\n return this._params.constraints;\n }\n\n get metadata() {\n return this._params.metadata;\n }\n}\n","export class SlateError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'SlateError';\n }\n\n static is(error: unknown): error is SlateError {\n return error instanceof SlateError;\n }\n}\n","import { SlateError } from './base';\n\nexport class SlateDeclarationError extends SlateError {\n constructor(message: string) {\n super(`[Declaration Error]: ${message}`);\n this.name = 'SlateError.DeclarationError';\n }\n\n static is(error: unknown): error is SlateDeclarationError {\n return error instanceof SlateDeclarationError;\n }\n}\n","import z from 'zod';\nimport { SlateDeclarationError } from '../error';\nimport { SlateSpecification } from '../specification/specification';\nimport {\n SlateAction,\n SlateActionCreateParameters,\n SlateActionParameters,\n SlateActionParametersTool,\n SlateActionParametersTrigger,\n SlateActionType,\n SlatePollingOptions,\n SlateToolInvocationHandler,\n SlateTriggerMappingHandler,\n SlateTriggerPollingHandler,\n SlateTriggerWebhookAutoRegistrationHandler,\n SlateTriggerWebhookAutoUnregistrationHandler,\n SlateTriggerWebhookRequestHandler\n} from './action';\n\nexport class SlateActionBuilder<\n Type extends SlateActionType,\n ConfigType extends {},\n AuthType extends {},\n InputType extends {},\n OutputType extends {},\n Result extends SlateAction<Type, ConfigType, AuthType, any, any>\n> {\n #configSchema: z.ZodType<ConfigType>;\n #authSchema: z.ZodType<AuthType>;\n #inputSchema: z.ZodType<InputType> | null = null;\n #outputSchema: z.ZodType<OutputType> | null = null;\n\n #toolParams: SlateActionParametersTool<ConfigType, AuthType, InputType, OutputType> | null =\n null;\n #triggerParams: SlateActionParametersTrigger<\n ConfigType,\n AuthType,\n InputType,\n OutputType\n > | null = null;\n\n constructor(\n private readonly type: Type,\n private readonly spec: SlateSpecification<ConfigType, AuthType>,\n private readonly params: SlateActionParameters,\n private readonly factory: (\n params: SlateActionCreateParameters<any, any, any, any>\n ) => Result\n ) {\n this.#configSchema = spec.configSchema;\n this.#authSchema = spec.authSchema;\n }\n\n input<NewInputType extends {}>(\n schema: z.ZodType<NewInputType>\n ): SlateActionBuilder<Type, ConfigType, AuthType, NewInputType, OutputType, Result> {\n this.#inputSchema = schema as any;\n return this as any;\n }\n\n output<NewOutputType extends {}>(\n schema: z.ZodType<NewOutputType>\n ): SlateActionBuilder<Type, ConfigType, AuthType, InputType, NewOutputType, Result> {\n this.#outputSchema = schema as any;\n return this as any;\n }\n\n handleInvocation(\n handler: SlateToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>\n ): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result> {\n if (this.type !== 'tool') {\n throw new SlateDeclarationError('handleInvocation can only be set for tool actions');\n }\n\n this.#toolParams = {\n type: 'tool',\n handleInvocation: handler\n };\n\n return this;\n }\n\n webhook(props: {\n handleEvent: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;\n handleRequest: SlateTriggerWebhookRequestHandler<ConfigType, AuthType, InputType>;\n autoRegisterWebhook?: SlateTriggerWebhookAutoRegistrationHandler<ConfigType, AuthType>;\n autoUnregisterWebhook?: SlateTriggerWebhookAutoUnregistrationHandler<ConfigType, AuthType>;\n }): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result> {\n if (this.type !== 'trigger') {\n throw new SlateDeclarationError('handleEvent can only be set for trigger actions');\n }\n\n this.#triggerParams = {\n type: 'trigger',\n source: 'webhook',\n handleEvent: props.handleEvent,\n handleRequest: props.handleRequest,\n autoRegisterWebhook: props.autoRegisterWebhook,\n autoUnregisterWebhook: props.autoUnregisterWebhook\n };\n\n return this;\n }\n\n polling(props: {\n options?: SlatePollingOptions;\n pollEvents?: SlateTriggerPollingHandler<ConfigType, AuthType, InputType>;\n handleEvent: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;\n }): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result> {\n if (this.type !== 'trigger') {\n throw new SlateDeclarationError('handleEvent can only be set for trigger actions');\n }\n\n this.#triggerParams = {\n type: 'trigger',\n source: 'polling',\n polling: props.options,\n pollEvents: props.pollEvents,\n handleEvent: props.handleEvent\n };\n\n return this;\n }\n\n build() {\n if (!this.#inputSchema) {\n throw new SlateDeclarationError('Input schema is not defined');\n }\n if (!this.#outputSchema) {\n throw new SlateDeclarationError('Output schema is not defined');\n }\n if (this.type === 'tool' && !this.#toolParams) {\n throw new SlateDeclarationError('Tool invocation handler is not defined');\n }\n if (this.type === 'trigger' && !this.#triggerParams) {\n throw new SlateDeclarationError('Trigger event handlers are not defined');\n }\n\n return this.factory({\n ...this.params,\n configSchema: this.#configSchema,\n authSchema: this.#authSchema,\n inputSchema: this.#inputSchema,\n outputSchema: this.#outputSchema,\n\n ...this.#toolParams!,\n ...this.#triggerParams!\n }) as Result;\n }\n}\n","import z from 'zod';\nimport { SlateSpecification } from '../specification/specification';\nimport { SlateAction, SlateActionParameters, SlateToolInvocationHandler } from './action';\nimport { SlateActionBuilder } from './builder';\n\nexport interface SlateToolParameters<\n ConfigType extends {},\n AuthType extends {},\n InputType extends {},\n OutputType extends {}\n> extends SlateActionParameters {\n handleInvocation: SlateToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>;\n}\n\nexport class SlateTool<\n ConfigType extends {},\n AuthType extends {},\n InputType extends {},\n OutputType extends {}\n> extends SlateAction<'tool', ConfigType, AuthType, InputType, OutputType> {\n #handleInvocation: SlateToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>;\n\n private constructor(\n spec: SlateSpecification<ConfigType, AuthType>,\n inputSchema: z.ZodType<InputType>,\n outputSchema: z.ZodType<OutputType>,\n params: SlateToolParameters<ConfigType, AuthType, InputType, OutputType>\n ) {\n super('tool', spec, inputSchema, outputSchema, params);\n\n this.#handleInvocation = params.handleInvocation;\n }\n\n static create<ConfigType extends {}, AuthType extends {}>(\n spec: SlateSpecification<ConfigType, AuthType>,\n params: SlateActionParameters\n ) {\n return new SlateActionBuilder('tool', spec, params, params => {\n if (params.type != 'tool') throw new Error('Invalid action type for tool');\n return new SlateTool(spec, params.inputSchema, params.outputSchema, params);\n });\n }\n\n get handleInvocation() {\n return this.#handleInvocation;\n }\n}\n\nexport let tool = <ConfigType extends {}, AuthType extends {}>(\n spec: SlateSpecification<ConfigType, AuthType>,\n params: SlateActionParameters\n) => SlateTool.create(spec, params);\n","import z from 'zod';\nimport { SlateSpecification } from '../specification/specification';\nimport {\n SlateAction,\n SlateActionParameters,\n SlatePollingOptions,\n SlateTriggerMappingHandler,\n SlateTriggerPollingHandler,\n SlateTriggerWebhookAutoRegistrationHandler,\n SlateTriggerWebhookAutoUnregistrationHandler,\n SlateTriggerWebhookRequestHandler\n} from './action';\nimport { SlateActionBuilder } from './builder';\n\nexport const SlateDefaultPollingIntervalSeconds = 60 * 10;\n\nexport interface SlateTriggerParameters<\n ConfigType extends {},\n AuthType extends {},\n InputType extends {},\n OutputType extends {\n type: string;\n }\n> extends SlateActionParameters {\n type: 'trigger';\n source: 'polling' | 'webhook';\n polling?: SlatePollingOptions;\n handleEvent: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;\n handleRequest?: SlateTriggerWebhookRequestHandler<ConfigType, AuthType, InputType>;\n pollEvents?: SlateTriggerPollingHandler<ConfigType, AuthType, InputType>;\n autoRegisterWebhook?: SlateTriggerWebhookAutoRegistrationHandler<ConfigType, AuthType>;\n autoUnregisterWebhook?: SlateTriggerWebhookAutoUnregistrationHandler<ConfigType, AuthType>;\n}\n\nexport class SlateTrigger<\n ConfigType extends {},\n AuthType extends {},\n InputType extends {},\n OutputType extends {\n type: string;\n }\n> extends SlateAction<'trigger', ConfigType, AuthType, InputType, OutputType> {\n #source: 'polling' | 'webhook';\n #polling: SlatePollingOptions;\n #handleEvent: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;\n #handleRequest?: SlateTriggerWebhookRequestHandler<ConfigType, AuthType, InputType>;\n #pollEvents?: SlateTriggerPollingHandler<ConfigType, AuthType, InputType>;\n #autoRegisterWebhook?: SlateTriggerWebhookAutoRegistrationHandler<ConfigType, AuthType>;\n #autoUnregisterWebhook?: SlateTriggerWebhookAutoUnregistrationHandler<ConfigType, AuthType>;\n\n private constructor(\n spec: SlateSpecification<ConfigType, AuthType>,\n inputSchema: z.ZodType<InputType>,\n outputSchema: z.ZodType<OutputType>,\n params: SlateTriggerParameters<ConfigType, AuthType, InputType, OutputType>\n ) {\n super('trigger', spec, inputSchema, outputSchema, params);\n\n this.#source = params.source;\n this.#polling = params.polling || {\n intervalInSeconds: SlateDefaultPollingIntervalSeconds\n };\n this.#handleEvent = params.handleEvent;\n this.#handleRequest = params.handleRequest;\n this.#pollEvents = params.pollEvents;\n this.#autoRegisterWebhook = params.autoRegisterWebhook;\n this.#autoUnregisterWebhook = params.autoUnregisterWebhook;\n }\n\n static create<ConfigType extends {}, AuthType extends {}>(\n spec: SlateSpecification<ConfigType, AuthType>,\n params: SlateActionParameters\n ) {\n return new SlateActionBuilder('trigger', spec, params, params => {\n if (params.type != 'trigger') throw new Error('Invalid action type for trigger');\n return new SlateTrigger(spec, params.inputSchema, params.outputSchema, params);\n });\n }\n\n get polling() {\n return this.#polling;\n }\n\n get source() {\n return this.#source;\n }\n\n get handleEvent() {\n return this.#handleEvent;\n }\n\n get handleRequest() {\n return this.#handleRequest;\n }\n\n get pollEvents() {\n return this.#pollEvents;\n }\n\n get autoRegisterWebhook() {\n return this.#autoRegisterWebhook;\n }\n\n get autoUnregisterWebhook() {\n return this.#autoUnregisterWebhook;\n }\n}\n\nexport let trigger = <ConfigType extends {}, AuthType extends {}>(\n spec: SlateSpecification<ConfigType, AuthType>,\n params: SlateActionParameters\n) => SlateTrigger.create(spec, params);\n","import z from 'zod';\nimport { SlateAuthType } from './types';\n\nexport class SlateAuth<OutputType extends {} = {}> {\n #outputSchema: z.ZodType<OutputType> | null = null;\n #authStack: SlateAuthType<any, OutputType>[] = [];\n\n private constructor() {}\n\n static create<OutputType extends {}>() {\n return new SlateAuth<OutputType>();\n }\n\n output<NewOutputType extends {}>(\n schema: z.ZodType<NewOutputType>\n ): SlateAuth<NewOutputType> {\n this.#outputSchema = schema as any;\n return this as any as SlateAuth<NewOutputType>;\n }\n\n private addAuth<InputType extends {}>(\n auth: SlateAuthType<InputType, OutputType>\n ): SlateAuth<OutputType> {\n let existingKeys = this.#authStack.map(a => a.key);\n if (existingKeys.includes(auth.key)) {\n throw new Error(`Auth with key \"${auth.key}\" already exists in the auth stack`);\n }\n\n this.#authStack.push(auth);\n return this;\n }\n\n addOauth<InputType extends {}>(\n auth: SlateAuthType<InputType, OutputType> & { type: 'auth.oauth' }\n ): SlateAuth<OutputType> {\n this.addAuth(auth as any);\n return this;\n }\n\n addTokenAuth<InputType extends {}>(\n auth: SlateAuthType<InputType, OutputType> & { type: 'auth.token' }\n ): SlateAuth<OutputType> {\n this.addAuth(auth as any);\n return this;\n }\n\n addServiceAccountAuth<InputType extends {}>(\n auth: SlateAuthType<InputType, OutputType> & { type: 'auth.service_account' }\n ): SlateAuth<OutputType> {\n this.addAuth(auth as any);\n return this;\n }\n\n addCustomAuth<InputType extends {}>(\n auth: SlateAuthType<InputType, OutputType> & { type: 'auth.custom' }\n ): SlateAuth<OutputType> {\n this.addAuth(auth as any);\n return this;\n }\n\n addNone(): SlateAuth<OutputType> {\n this.addAuth({\n type: 'auth.none',\n name: 'No Authentication',\n key: 'none'\n });\n return this;\n }\n\n get authStack() {\n return this.#authStack.filter(a => a.type != 'auth.none');\n }\n\n get outputSchema() {\n if (!this.#outputSchema) {\n throw new Error('Output schema is not defined for this auth');\n }\n return this.#outputSchema;\n }\n}\n\nexport let auth = <OutputType extends {} = {}>() => SlateAuth.create<OutputType>();\n","import { AsyncLocalStorage } from 'async_hooks';\nimport { SlateContext } from './context';\n\nlet asyncLocalStorage = new AsyncLocalStorage<SlateContext<any, any, any>>();\n\nexport let runWithContext = <ConfigType extends {}, AuthType extends {}, InputType extends {}>(\n context: SlateContext<ConfigType, AuthType, InputType>,\n fn: () => Promise<void>\n) => {\n return asyncLocalStorage.run(context, fn);\n};\n\nexport let getCurrentContext = <\n ConfigType extends {},\n AuthType extends {},\n InputType extends {}\n>(): SlateContext<ConfigType, AuthType, InputType> => {\n let context = asyncLocalStorage.getStore();\n if (!context) {\n throw new Error('No Slate context is available');\n }\n return context as SlateContext<ConfigType, AuthType, InputType>;\n};\n","import baseAxios, { CreateAxiosDefaults } from 'axios';\nimport { getCurrentContext } from '../context/hook';\n\nexport let createAxios = (config?: CreateAxiosDefaults) => {\n let instance = baseAxios.create({\n ...config,\n headers: {\n ...config?.headers\n }\n });\n\n instance.interceptors.request.use(\n request => {\n // Has to be called in the context of an action execution\n let ctx = getCurrentContext();\n let spec = ctx.specification;\n\n request.headers.set('User-Agent', `slates.dev@1.0.0/${spec.key}`);\n\n return request;\n },\n error => Promise.reject(error)\n );\n\n return instance;\n};\n\nexport let axios = createAxios();\n","import z from 'zod';\n\nexport class SlateConfig<ConfigType extends {}> {\n #configSchema: z.ZodType<ConfigType>;\n #configChanged:\n | ((params: {\n previousConfig: ConfigType | null;\n newConfig: ConfigType;\n }) => { config: ConfigType | undefined } | void)\n | null = null;\n #getDefaultConfig: (() => ConfigType) | null = null;\n\n private constructor(schema: z.ZodType<ConfigType>) {\n this.#configSchema = schema;\n }\n\n static create<ConfigType extends {}>(schema: z.ZodType<ConfigType>) {\n return new SlateConfig<ConfigType>(schema);\n }\n\n config<NewConfigType extends {}>(\n schema: z.ZodType<NewConfigType>\n ): SlateConfig<NewConfigType> {\n this.#configSchema = schema as any;\n return this as any as SlateConfig<NewConfigType>;\n }\n\n onConfigChanged(\n handler: (params: {\n previousConfig: ConfigType | null;\n newConfig: ConfigType;\n }) => { config: ConfigType | undefined } | void\n ): SlateConfig<ConfigType> {\n this.#configChanged = handler;\n return this;\n }\n\n getDefaultConfig(getter: () => ConfigType): SlateConfig<ConfigType> {\n this.#getDefaultConfig = getter;\n return this;\n }\n\n get configSchema() {\n return this.#configSchema;\n }\n\n get handlers() {\n return {\n configChanged: this.#configChanged,\n getDefaultConfig: this.#getDefaultConfig\n };\n }\n}\n\nexport let config = <ConfigType extends {}>(schema: z.ZodType<ConfigType>) =>\n SlateConfig.create<ConfigType>(schema);\n","import { SlateLogger, SlateLogMessageInput } from '../logger';\nimport { SlateSpecification } from '../specification/specification';\n\nexport class SlateContext<ConfigType extends {}, AuthType extends {}, InputType extends {}> {\n #config: ConfigType;\n #input: InputType;\n #auth: AuthType;\n\n constructor(\n config: ConfigType,\n input: InputType,\n auth: AuthType,\n private readonly spec: SlateSpecification<ConfigType, AuthType>,\n private readonly logger: SlateLogger\n ) {\n this.#config = config;\n this.#input = input;\n this.#auth = auth;\n }\n\n get specification() {\n return this.spec;\n }\n\n get config() {\n return Object.freeze(this.#config);\n }\n\n get input() {\n return Object.freeze(this.#input);\n }\n\n get event() {\n return Object.freeze(this.#input);\n }\n\n get state() {\n return Object.freeze((this.#input as any).state) as 'state' extends keyof InputType\n ? InputType['state']\n : never;\n }\n\n get request() {\n return Object.freeze((this.#input as any).request) as 'request' extends keyof InputType\n ? InputType['request']\n : never;\n }\n\n get auth() {\n return Object.freeze(this.#auth);\n }\n\n info(message: SlateLogMessageInput) {\n this.logger.info(message);\n }\n\n warn(message: SlateLogMessageInput) {\n this.logger.warn(message);\n }\n\n error(message: SlateLogMessageInput) {\n this.logger.error(message);\n }\n\n progress(message: SlateLogMessageInput) {\n this.logger.progress(message);\n }\n}\n","import { encode } from '@toon-format/toon';\n\nexport type SlateLogType = 'info' | 'warn' | 'error' | 'progress';\n\nexport type SlateLogMessageInput =\n | string\n | Error\n | boolean\n | number\n | null\n | undefined\n | object\n | SlateLogMessageInput[];\n\nlet formatMessage = (message: SlateLogMessageInput): string => {\n if (typeof message === 'object') {\n if (message === null) return 'null';\n if (message instanceof Error) {\n return `[ERROR]: ${message.name}: ${message.message}\\n${message.stack}`;\n }\n return encode(message);\n }\n\n return String(message);\n};\n\nexport interface SlateLogEntry {\n type: SlateLogType;\n message: string;\n timestamp: Date;\n}\n\nexport type SlateLogListener = (entries: SlateLogEntry[]) => void;\n\nexport class SlateLogger {\n #logs: SlateLogEntry[] = [];\n #listeners: SlateLogListener[] = [];\n #timer: NodeJS.Timeout | null = null;\n\n constructor(listeners: SlateLogListener[] = []) {\n this.#listeners.push(...listeners);\n }\n\n private flush() {\n if (this.#timer) clearTimeout(this.#timer);\n if (this.#logs.length === 0) return;\n\n for (let listener of this.#listeners) {\n listener(this.#logs);\n }\n }\n\n private scheduleFlush() {\n if (this.#timer) return;\n this.#timer = setTimeout(() => {\n this.flush();\n this.#timer = null;\n }, 10);\n }\n\n log(type: SlateLogType, message: SlateLogMessageInput) {\n this.#logs.push({\n type,\n timestamp: new Date(),\n message: formatMessage(message)\n });\n this.scheduleFlush();\n }\n\n info(...message: SlateLogMessageInput[]) {\n this.log('info', message.flat());\n }\n\n warn(...message: SlateLogMessageInput[]) {\n this.log('warn', message.flat());\n }\n\n error(...message: SlateLogMessageInput[]) {\n this.log('error', message.flat());\n }\n\n progress(...message: SlateLogMessageInput[]) {\n this.log('progress', message.flat());\n }\n}\n","import { SlateTool, SlateTrigger } from '../action';\nimport { SlateSpecification } from './specification';\n\nexport class Slate<ConfigType extends {}, AuthType extends {}> {\n private constructor(\n private readonly _spec: SlateSpecification<ConfigType, AuthType>,\n private readonly _actions: (\n | SlateTrigger<ConfigType, AuthType, any, any>\n | SlateTool<ConfigType, AuthType, any, any>\n )[]\n ) {}\n\n static create<ConfigType extends {}, AuthType extends {}>(params: {\n spec: SlateSpecification<ConfigType, AuthType>;\n triggers: SlateTrigger<ConfigType, AuthType, any, any>[];\n tools: SlateTool<ConfigType, AuthType, any, any>[];\n }) {\n return new Slate(params.spec, [...params.triggers, ...params.tools]);\n }\n\n get spec() {\n return this._spec;\n }\n\n get actions() {\n return this._actions;\n }\n}\n","import z from 'zod';\nimport { SlateAuth } from '../auth';\nimport { SlateConfig } from '../config';\n\nexport interface SlateSpecificationParameters {\n key: string;\n name: string;\n description?: string;\n metadata?: Record<string, any>;\n}\n\nexport interface SlateSpecificationCreateParameters<\n ConfigType extends {},\n AuthType extends {}\n> extends SlateSpecificationParameters {\n config: SlateConfig<ConfigType>;\n auth: SlateAuth<AuthType>;\n}\n\nexport class SlateSpecification<ConfigType extends {}, AuthType extends {}> {\n private constructor(\n private readonly _config: SlateConfig<ConfigType>,\n private readonly _auth: SlateAuth<AuthType>,\n private readonly _params: SlateSpecificationParameters\n ) {}\n\n static create<ConfigType extends {}, AuthType extends {}>(\n params: SlateSpecificationCreateParameters<ConfigType, AuthType>\n ): SlateSpecification<ConfigType, AuthType> {\n return new SlateSpecification(params.config, params.auth, params);\n }\n\n get configSchema() {\n return this._config.configSchema;\n }\n\n get authSchema() {\n return (\n 'outputSchema' in this._auth ? this._auth.outputSchema : z.object({})\n ) as z.ZodType<AuthType>;\n }\n\n get config() {\n return this._config;\n }\n\n get auth() {\n return this._auth;\n }\n\n get parameters() {\n return this._params;\n }\n\n get key() {\n return this._params.key;\n }\n\n get name() {\n return this._params.name;\n }\n\n get description() {\n return this._params.description;\n }\n}\n\nexport let spec = <ConfigType extends {}, AuthType extends {}>(\n params: SlateSpecificationCreateParameters<ConfigType, AuthType>\n): SlateSpecification<ConfigType, AuthType> => SlateSpecification.create(params);\n"],"names":["SlateAction","_createClass","type","_spec","_inputSchema","_outputSchema","_params","this","key","get","configSchema","name","description","tags","instructions","constraints","metadata","SlateError","_Error","message","_this","call","_inheritsLoose","is","error","_wrapNativeSuper","Error","SlateDeclarationError","_SlateError","_configSchema","_classPrivateFieldLooseKey","_authSchema","_toolParams","_triggerParams","SlateActionBuilder","spec","params","factory","Object","defineProperty","writable","value","_classPrivateFieldLooseBase","authSchema","_proto","prototype","input","schema","output","handleInvocation","handler","webhook","props","source","handleEvent","handleRequest","autoRegisterWebhook","autoUnregisterWebhook","polling","options","pollEvents","build","_extends","inputSchema","outputSchema","_handleInvocation","SlateTool","_SlateAction","create","tool","SlateDefaultPollingIntervalSeconds","_source","_polling","_handleEvent","_handleRequest","_pollEvents","_autoRegisterWebhook","_autoUnregisterWebhook","SlateTrigger","intervalInSeconds","trigger","_authStack","SlateAuth","addAuth","auth","map","a","includes","push","addOauth","addTokenAuth","addServiceAccountAuth","addCustomAuth","addNone","filter","asyncLocalStorage","AsyncLocalStorage","createAxios","config","instance","baseAxios","headers","interceptors","request","use","ctx","context","getStore","getCurrentContext","set","specification","Promise","reject","axios","SlateConfig","_configChanged","_getDefaultConfig","onConfigChanged","getDefaultConfig","getter","configChanged","_config","_input","_auth","SlateContext","logger","info","warn","progress","freeze","state","formatMessage","stack","encode","String","_logs","_listeners","_timer","SlateLogger","listeners","_classPrivateFieldLoo","apply","flush","clearTimeout","length","_step","_iterator","_createForOfIteratorHelperLoose","done","listener","scheduleFlush","setTimeout","log","timestamp","Date","slice","arguments","flat","Slate","_actions","concat","triggers","tools","SlateSpecification","z","object"],"mappings":"u1EAoIsB,IAAAA,eAAW,WAa3B,OAAAC,EANJ,SACkBC,EACGC,EACAC,EACAC,EACAC,GAJHJ,KAAAA,UACGC,EAAAA,KAAAA,WACAC,EAAAA,KAAAA,kBACAC,EAAAA,KAAAA,mBACAC,EAAAA,KAAAA,aAJH,EAAAC,KAAIL,KAAJA,EACGK,KAAKJ,MAALA,EACAI,KAAYH,aAAZA,EACAG,KAAaF,cAAbA,EACAE,KAAOD,QAAPA,CAClB,EAAC,CAAA,CAAAE,IAAA,eAAAC,IAEJ,WACE,YAAYN,MAAMO,YACpB,GAAC,CAAAF,IAAA,cAAAC,IAED,WACE,OAAWF,KAACH,YACd,GAACI,CAAAA,mBAAAC,IAED,WACE,OAAWF,KAACF,aACd,GAACG,CAAAA,IAAAC,aAAAA,IAED,WACE,YAAYH,OACd,GAAC,CAAAE,IAAA,MAAAC,IAED,WACE,YAAYH,QAAQE,GACtB,GAAC,CAAAA,IAAA,OAAAC,IAED,WACE,OAAWF,KAACD,QAAQK,IACtB,IAACH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,IAAC,CAvBe,GCgBLI,gBACX,WAAA,SAAAA,EACmB1C,EACAE,EACArH,GAFAmH,KAAAA,oBACAE,WAAA,EAAApH,KACAD,aAAA,EAFAC,KAAOkH,QAAPA,EACAlH,KAAKoH,MAALA,EACApH,KAAOD,QAAPA,CAChB,QAAC6J,EAEG/F,OAAP,SACEhC,GAEA,OAAO,IAAI+H,EAAmB/H,EAAO8D,OAAQ9D,EAAOgD,KAAMhD,EAC5D,EAACnC,EAAAkK,EAAA,CAAA,CAAA3J,IAAA,eAAAC,IAED,WACE,OAAOF,KAAKkH,QAAQ/G,YACtB,GAACF,CAAAA,iBAAAC,IAED,WACE,MACE,iBAAsBF,KAACoH,MAAQpH,KAAKoH,MAAM3D,aAAeoG,EAAEC,OAAO,CAAE,EAExE,GAAC,CAAA7J,IAAAC,SAAAA,IAED,WACE,OAAOF,KAAKkH,OACd,GAAC,CAAAjH,IAAA,OAAAC,IAED,WACE,OAAWF,KAACoH,KACd,GAACnH,CAAAA,iBAAAC,IAED,WACE,OAAWF,KAACD,OACd,GAACE,CAAAA,IAAAC,MAAAA,IAED,WACE,YAAYH,QAAQE,GACtB,GAAC,CAAAA,IAAAC,OAAAA,IAED,WACE,OAAOF,KAAKD,QAAQK,IACtB,GAAC,CAAAH,IAAA,cAAAC,IAED,WACE,OAAWF,KAACD,QAAQM,WACtB,IAAC,CA5CD,GA+CSuB,GAAO,SAChBC,GAAgE,OACnB+H,GAAmB/F,OAAOhC,EAAO"}
package/dist/index.umd.js DELETED
@@ -1,2 +0,0 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("axios"),require("async_hooks"),require("@toon-format/toon"),require("zod")):"function"==typeof define&&define.amd?define(["exports","axios","async_hooks","@toon-format/toon","zod"],e):e((t||self).provider={},t.axios,t.async_hooks,t.toon,t.zod)}(this,function(t,e,n,r,i){function o(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var u=/*#__PURE__*/o(e),a=/*#__PURE__*/o(i);function c(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function s(t,e){if(!{}.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var h=0;function f(t){return"__private_"+h+++"_"+t}function l(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,m(r.key),r)}}function p(t,e,n){return e&&l(t.prototype,e),n&&l(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function d(){return d=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},d.apply(null,arguments)}function g(t){return g=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},g(t)}function y(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,b(t,e)}function v(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(v=function(){return!!t})()}function b(t,e){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},b(t,e)}function m(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}function w(t){var e="function"==typeof Map?new Map:void 0;return w=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return function(t,e,n){if(v())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var i=new(t.bind.apply(t,r));return n&&b(i,n.prototype),i}(t,arguments,g(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),b(n,t)},w(t)}var k=/*#__PURE__*/function(){return p(function(t,e,n,r,i){this.type=void 0,this._spec=void 0,this._inputSchema=void 0,this._outputSchema=void 0,this._params=void 0,this.type=t,this._spec=e,this._inputSchema=n,this._outputSchema=r,this._params=i},[{key:"configSchema",get:function(){return this._spec.configSchema}},{key:"inputSchema",get:function(){return this._inputSchema}},{key:"outputSchema",get:function(){return this._outputSchema}},{key:"parameters",get:function(){return this._params}},{key:"key",get:function(){return this._params.key}},{key:"name",get:function(){return this._params.name}},{key:"description",get:function(){return this._params.description}},{key:"tags",get:function(){return this._params.tags}},{key:"instructions",get:function(){return this._params.instructions}},{key:"constraints",get:function(){return this._params.constraints}},{key:"metadata",get:function(){return this._params.metadata}}])}(),S=/*#__PURE__*/function(t){function e(e){var n;return(n=t.call(this,e)||this).name="SlateError",n}return y(e,t),e.is=function(t){return t instanceof e},e}(/*#__PURE__*/w(Error)),O=/*#__PURE__*/function(t){function e(e){var n;return(n=t.call(this,"[Declaration Error]: "+e)||this).name="SlateError.DeclarationError",n}return y(e,t),e.is=function(t){return t instanceof e},e}(S),_=/*#__PURE__*/f("configSchema"),j=/*#__PURE__*/f("authSchema"),P=/*#__PURE__*/f("inputSchema"),E=/*#__PURE__*/f("outputSchema"),A=/*#__PURE__*/f("toolParams"),R=/*#__PURE__*/f("triggerParams"),x=/*#__PURE__*/function(){function t(t,e,n,r){this.type=void 0,this.spec=void 0,this.params=void 0,this.factory=void 0,Object.defineProperty(this,_,{writable:!0,value:void 0}),Object.defineProperty(this,j,{writable:!0,value:void 0}),Object.defineProperty(this,P,{writable:!0,value:null}),Object.defineProperty(this,E,{writable:!0,value:null}),Object.defineProperty(this,A,{writable:!0,value:null}),Object.defineProperty(this,R,{writable:!0,value:null}),this.type=t,this.spec=e,this.params=n,this.factory=r,s(this,_)[_]=e.configSchema,s(this,j)[j]=e.authSchema}var e=t.prototype;return e.input=function(t){return s(this,P)[P]=t,this},e.output=function(t){return s(this,E)[E]=t,this},e.handleInvocation=function(t){if("tool"!==this.type)throw new O("handleInvocation can only be set for tool actions");return s(this,A)[A]={type:"tool",handleInvocation:t},this},e.webhook=function(t){if("trigger"!==this.type)throw new O("handleEvent can only be set for trigger actions");return s(this,R)[R]={type:"trigger",source:"webhook",handleEvent:t.handleEvent,handleRequest:t.handleRequest,autoRegisterWebhook:t.autoRegisterWebhook,autoUnregisterWebhook:t.autoUnregisterWebhook},this},e.polling=function(t){if("trigger"!==this.type)throw new O("handleEvent can only be set for trigger actions");return s(this,R)[R]={type:"trigger",source:"polling",polling:t.options,pollEvents:t.pollEvents,handleEvent:t.handleEvent},this},e.build=function(){if(!s(this,P)[P])throw new O("Input schema is not defined");if(!s(this,E)[E])throw new O("Output schema is not defined");if("tool"===this.type&&!s(this,A)[A])throw new O("Tool invocation handler is not defined");if("trigger"===this.type&&!s(this,R)[R])throw new O("Trigger event handlers are not defined");return this.factory(d({},this.params,{configSchema:s(this,_)[_],authSchema:s(this,j)[j],inputSchema:s(this,P)[P],outputSchema:s(this,E)[E]},s(this,A)[A],s(this,R)[R]))},t}(),I=/*#__PURE__*/f("handleInvocation"),T=/*#__PURE__*/function(t){function e(e,n,r,i){var o;return o=t.call(this,"tool",e,n,r,i)||this,Object.defineProperty(o,I,{writable:!0,value:void 0}),s(o,I)[I]=i.handleInvocation,o}return y(e,t),e.create=function(t,n){return new x("tool",t,n,function(n){if("tool"!=n.type)throw new Error("Invalid action type for tool");return new e(t,n.inputSchema,n.outputSchema,n)})},p(e,[{key:"handleInvocation",get:function(){return s(this,I)[I]}}])}(k),q=/*#__PURE__*/f("source"),C=/*#__PURE__*/f("polling"),W=/*#__PURE__*/f("handleEvent"),z=/*#__PURE__*/f("handleRequest"),D=/*#__PURE__*/f("pollEvents"),U=/*#__PURE__*/f("autoRegisterWebhook"),F=/*#__PURE__*/f("autoUnregisterWebhook"),M=/*#__PURE__*/function(t){function e(e,n,r,i){var o;return o=t.call(this,"trigger",e,n,r,i)||this,Object.defineProperty(o,q,{writable:!0,value:void 0}),Object.defineProperty(o,C,{writable:!0,value:void 0}),Object.defineProperty(o,W,{writable:!0,value:void 0}),Object.defineProperty(o,z,{writable:!0,value:void 0}),Object.defineProperty(o,D,{writable:!0,value:void 0}),Object.defineProperty(o,U,{writable:!0,value:void 0}),Object.defineProperty(o,F,{writable:!0,value:void 0}),s(o,q)[q]=i.source,s(o,C)[C]=i.polling||{intervalInSeconds:600},s(o,W)[W]=i.handleEvent,s(o,z)[z]=i.handleRequest,s(o,D)[D]=i.pollEvents,s(o,U)[U]=i.autoRegisterWebhook,s(o,F)[F]=i.autoUnregisterWebhook,o}return y(e,t),e.create=function(t,n){return new x("trigger",t,n,function(n){if("trigger"!=n.type)throw new Error("Invalid action type for trigger");return new e(t,n.inputSchema,n.outputSchema,n)})},p(e,[{key:"polling",get:function(){return s(this,C)[C]}},{key:"source",get:function(){return s(this,q)[q]}},{key:"handleEvent",get:function(){return s(this,W)[W]}},{key:"handleRequest",get:function(){return s(this,z)[z]}},{key:"pollEvents",get:function(){return s(this,D)[D]}},{key:"autoRegisterWebhook",get:function(){return s(this,U)[U]}},{key:"autoUnregisterWebhook",get:function(){return s(this,F)[F]}}])}(k),N=/*#__PURE__*/f("outputSchema"),B=/*#__PURE__*/f("authStack"),L=/*#__PURE__*/function(){function t(){Object.defineProperty(this,N,{writable:!0,value:null}),Object.defineProperty(this,B,{writable:!0,value:[]})}t.create=function(){return new t};var e=t.prototype;return e.output=function(t){return s(this,N)[N]=t,this},e.addAuth=function(t){if(s(this,B)[B].map(function(t){return t.key}).includes(t.key))throw new Error('Auth with key "'+t.key+'" already exists in the auth stack');return s(this,B)[B].push(t),this},e.addOauth=function(t){return this.addAuth(t),this},e.addTokenAuth=function(t){return this.addAuth(t),this},e.addServiceAccountAuth=function(t){return this.addAuth(t),this},e.addCustomAuth=function(t){return this.addAuth(t),this},e.addNone=function(){return this.addAuth({type:"auth.none",name:"No Authentication",key:"none"}),this},p(t,[{key:"authStack",get:function(){return s(this,B)[B].filter(function(t){return"auth.none"!=t.type})}},{key:"outputSchema",get:function(){if(!s(this,N)[N])throw new Error("Output schema is not defined for this auth");return s(this,N)[N]}}])}(),$=new n.AsyncLocalStorage,G=function(t){var e=u.default.create(d({},t,{headers:d({},null==t?void 0:t.headers)}));return e.interceptors.request.use(function(t){var e=function(){var t=$.getStore();if(!t)throw new Error("No Slate context is available");return t}();return t.headers.set("User-Agent","slates.dev@1.0.0/"+e.specification.key),t},function(t){return Promise.reject(t)}),e},H=G(),J=/*#__PURE__*/f("configSchema"),K=/*#__PURE__*/f("configChanged"),Q=/*#__PURE__*/f("getDefaultConfig"),V=/*#__PURE__*/function(){function t(t){Object.defineProperty(this,J,{writable:!0,value:void 0}),Object.defineProperty(this,K,{writable:!0,value:null}),Object.defineProperty(this,Q,{writable:!0,value:null}),s(this,J)[J]=t}t.create=function(e){return new t(e)};var e=t.prototype;return e.config=function(t){return s(this,J)[J]=t,this},e.onConfigChanged=function(t){return s(this,K)[K]=t,this},e.getDefaultConfig=function(t){return s(this,Q)[Q]=t,this},p(t,[{key:"configSchema",get:function(){return s(this,J)[J]}},{key:"handlers",get:function(){return{configChanged:s(this,K)[K],getDefaultConfig:s(this,Q)[Q]}}}])}(),X=/*#__PURE__*/f("config"),Y=/*#__PURE__*/f("input"),Z=/*#__PURE__*/f("auth"),tt=/*#__PURE__*/function(){function t(t,e,n,r,i){this.spec=void 0,this.logger=void 0,Object.defineProperty(this,X,{writable:!0,value:void 0}),Object.defineProperty(this,Y,{writable:!0,value:void 0}),Object.defineProperty(this,Z,{writable:!0,value:void 0}),this.spec=r,this.logger=i,s(this,X)[X]=t,s(this,Y)[Y]=e,s(this,Z)[Z]=n}var e=t.prototype;return e.info=function(t){this.logger.info(t)},e.warn=function(t){this.logger.warn(t)},e.error=function(t){this.logger.error(t)},e.progress=function(t){this.logger.progress(t)},p(t,[{key:"specification",get:function(){return this.spec}},{key:"config",get:function(){return Object.freeze(s(this,X)[X])}},{key:"input",get:function(){return Object.freeze(s(this,Y)[Y])}},{key:"event",get:function(){return Object.freeze(s(this,Y)[Y])}},{key:"state",get:function(){return Object.freeze(s(this,Y)[Y].state)}},{key:"request",get:function(){return Object.freeze(s(this,Y)[Y].request)}},{key:"auth",get:function(){return Object.freeze(s(this,Z)[Z])}}])}(),et=function(t){return"object"==typeof t?null===t?"null":t instanceof Error?"[ERROR]: "+t.name+": "+t.message+"\n"+t.stack:r.encode(t):String(t)},nt=/*#__PURE__*/f("logs"),rt=/*#__PURE__*/f("listeners"),it=/*#__PURE__*/f("timer"),ot=/*#__PURE__*/function(){function t(t){var e;void 0===t&&(t=[]),Object.defineProperty(this,nt,{writable:!0,value:[]}),Object.defineProperty(this,rt,{writable:!0,value:[]}),Object.defineProperty(this,it,{writable:!0,value:null}),(e=s(this,rt)[rt]).push.apply(e,t)}var e=t.prototype;return e.flush=function(){if(s(this,it)[it]&&clearTimeout(s(this,it)[it]),0!==s(this,nt)[nt].length)for(var t,e=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(e)return(e=e.call(t)).next.bind(e);if(Array.isArray(t)||(e=function(t,e){if(t){if("string"==typeof t)return c(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(t,e):void 0}}(t))){e&&(t=e);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(s(this,rt)[rt]);!(t=e()).done;)(0,t.value)(s(this,nt)[nt])},e.scheduleFlush=function(){var t=this;s(this,it)[it]||(s(this,it)[it]=setTimeout(function(){t.flush(),s(t,it)[it]=null},10))},e.log=function(t,e){s(this,nt)[nt].push({type:t,timestamp:new Date,message:et(e)}),this.scheduleFlush()},e.info=function(){this.log("info",[].slice.call(arguments).flat())},e.warn=function(){this.log("warn",[].slice.call(arguments).flat())},e.error=function(){this.log("error",[].slice.call(arguments).flat())},e.progress=function(){this.log("progress",[].slice.call(arguments).flat())},t}(),ut=/*#__PURE__*/function(){function t(t,e){this._spec=void 0,this._actions=void 0,this._spec=t,this._actions=e}return t.create=function(e){return new t(e.spec,[].concat(e.triggers,e.tools))},p(t,[{key:"spec",get:function(){return this._spec}},{key:"actions",get:function(){return this._actions}}])}(),at=/*#__PURE__*/function(){function t(t,e,n){this._config=void 0,this._auth=void 0,this._params=void 0,this._config=t,this._auth=e,this._params=n}return t.create=function(e){return new t(e.config,e.auth,e)},p(t,[{key:"configSchema",get:function(){return this._config.configSchema}},{key:"authSchema",get:function(){return"outputSchema"in this._auth?this._auth.outputSchema:a.default.object({})}},{key:"config",get:function(){return this._config}},{key:"auth",get:function(){return this._auth}},{key:"parameters",get:function(){return this._params}},{key:"key",get:function(){return this._params.key}},{key:"name",get:function(){return this._params.name}},{key:"description",get:function(){return this._params.description}}])}();t.Slate=ut,t.SlateAction=k,t.SlateAuth=L,t.SlateConfig=V,t.SlateContext=tt,t.SlateDeclarationError=O,t.SlateDefaultPollingIntervalSeconds=600,t.SlateError=S,t.SlateLogger=ot,t.SlateSpecification=at,t.SlateTool=T,t.SlateTrigger=M,t.auth=function(){return L.create()},t.axios=H,t.config=function(t){return V.create(t)},t.createAxios=G,t.spec=function(t){return at.create(t)},t.tool=function(t,e){return T.create(t,e)},t.trigger=function(t,e){return M.create(t,e)}});
2
- //# sourceMappingURL=index.umd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.umd.js","sources":["../src/action/action.ts","../src/error/base.ts","../src/error/declaration.ts","../src/action/builder.ts","../src/action/tool.ts","../src/action/trigger.ts","../src/auth/auth.ts","../src/context/hook.ts","../src/axios/index.ts","../src/config/config.ts","../src/context/context.ts","../src/logger/logger.ts","../src/specification/slate.ts","../src/specification/specification.ts"],"sourcesContent":["import { z } from 'zod';\nimport { SlateContext } from '../context';\nimport { SlateSpecification } from '../specification/specification';\n\nexport type SlateActionType = 'tool' | 'trigger';\n\nexport interface SlateActionParameters {\n key: string;\n name: string;\n description?: string;\n instructions?: string[];\n constraints?: string[];\n tags?: {\n destructive?: boolean;\n readOnly?: boolean;\n [key: string]: boolean | undefined;\n };\n metadata?: Record<string, any>;\n}\n\nexport type SlateToolInvocationHandler<\n ConfigType extends {},\n AuthType extends {},\n InputType extends {},\n OutputType extends {}\n> = (context: SlateContext<ConfigType, AuthType, InputType>) => Promise<{\n output: OutputType;\n message: string;\n}>;\n\nexport type SlateTriggerMappingHandler<\n ConfigType extends {},\n AuthType extends {},\n InputType extends {},\n OutputType extends {}\n> = (context: SlateContext<ConfigType, AuthType, InputType>) => Promise<{\n type: string;\n id: string;\n output: OutputType;\n}>;\n\nexport type SlateTriggerPollingHandler<\n ConfigType extends {},\n AuthType extends {},\n InputType extends {}\n> = (context: SlateContext<ConfigType, AuthType, { state: any | null }>) => Promise<{\n inputs: InputType[];\n updatedState?: any;\n}>;\n\nexport type SlateTriggerWebhookRequestHandler<\n ConfigType extends {},\n AuthType extends {},\n InputType extends {}\n> = (\n context: SlateContext<ConfigType, AuthType, { request: Request; state: any | null }>\n) => Promise<{\n inputs: InputType[];\n updatedState?: any;\n}>;\n\nexport type SlateTriggerWebhookAutoRegistrationHandler<\n ConfigType extends {},\n AuthType extends {}\n> = (context: SlateContext<ConfigType, AuthType, { webhookBaseUrl: string }>) => Promise<{\n registrationDetails: any;\n state?: any;\n}>;\n\nexport type SlateTriggerWebhookAutoUnregistrationHandler<\n ConfigType extends {},\n AuthType extends {}\n> = (\n context: SlateContext<\n ConfigType,\n AuthType,\n { webhookBaseUrl: string; registrationDetails: any; state: any | null }\n >\n) => Promise<unknown>;\n\nexport interface SlateActionParametersTool<\n ConfigType extends {},\n AuthType extends {},\n InputType extends {},\n OutputType extends {}\n> {\n type: 'tool';\n handleInvocation: SlateToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>;\n}\n\nexport interface SlatePollingOptions {\n intervalInSeconds?: number;\n}\n\nexport interface SlateActionParametersTrigger<\n ConfigType extends {},\n AuthType extends {},\n InputType extends {},\n OutputType extends {}\n> {\n type: 'trigger';\n source: 'polling' | 'webhook';\n polling?: SlatePollingOptions;\n handleEvent: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;\n handleRequest?: SlateTriggerWebhookRequestHandler<ConfigType, AuthType, InputType>;\n pollEvents?: SlateTriggerPollingHandler<ConfigType, AuthType, InputType>;\n autoRegisterWebhook?: SlateTriggerWebhookAutoRegistrationHandler<ConfigType, AuthType>;\n autoUnregisterWebhook?: SlateTriggerWebhookAutoUnregistrationHandler<ConfigType, AuthType>;\n}\n\nexport type SlateActionParametersAny<\n ConfigType extends {},\n AuthType extends {},\n InputType extends {},\n OutputType extends {}\n> =\n | SlateActionParametersTool<ConfigType, AuthType, InputType, OutputType>\n | SlateActionParametersTrigger<ConfigType, AuthType, InputType, OutputType>;\n\nexport type SlateActionCreateParameters<\n ConfigType extends {},\n AuthType extends {},\n InputType extends {},\n OutputType extends {}\n> = SlateActionParametersAny<ConfigType, AuthType, InputType, OutputType> &\n SlateActionParameters & {\n configSchema: z.ZodType<ConfigType>;\n authSchema: z.ZodType<AuthType>;\n inputSchema: z.ZodType<InputType>;\n outputSchema: z.ZodType<OutputType>;\n };\n\nexport abstract class SlateAction<\n Type extends SlateActionType,\n ConfigType extends {},\n AuthType extends {},\n InputType extends {},\n OutputType extends {}\n> {\n constructor(\n public readonly type: Type,\n protected readonly _spec: SlateSpecification<ConfigType, AuthType>,\n protected readonly _inputSchema: z.ZodType<InputType>,\n protected readonly _outputSchema: z.ZodType<OutputType>,\n protected readonly _params: SlateActionParameters\n ) {}\n\n get configSchema() {\n return this._spec.configSchema;\n }\n\n get inputSchema() {\n return this._inputSchema;\n }\n\n get outputSchema() {\n return this._outputSchema;\n }\n\n get parameters() {\n return this._params;\n }\n\n get key() {\n return this._params.key;\n }\n\n get name() {\n return this._params.name;\n }\n\n get description() {\n return this._params.description;\n }\n\n get tags() {\n return this._params.tags;\n }\n\n get instructions() {\n return this._params.instructions;\n }\n\n get constraints() {\n return this._params.constraints;\n }\n\n get metadata() {\n return this._params.metadata;\n }\n}\n","export class SlateError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'SlateError';\n }\n\n static is(error: unknown): error is SlateError {\n return error instanceof SlateError;\n }\n}\n","import { SlateError } from './base';\n\nexport class SlateDeclarationError extends SlateError {\n constructor(message: string) {\n super(`[Declaration Error]: ${message}`);\n this.name = 'SlateError.DeclarationError';\n }\n\n static is(error: unknown): error is SlateDeclarationError {\n return error instanceof SlateDeclarationError;\n }\n}\n","import z from 'zod';\nimport { SlateDeclarationError } from '../error';\nimport { SlateSpecification } from '../specification/specification';\nimport {\n SlateAction,\n SlateActionCreateParameters,\n SlateActionParameters,\n SlateActionParametersTool,\n SlateActionParametersTrigger,\n SlateActionType,\n SlatePollingOptions,\n SlateToolInvocationHandler,\n SlateTriggerMappingHandler,\n SlateTriggerPollingHandler,\n SlateTriggerWebhookAutoRegistrationHandler,\n SlateTriggerWebhookAutoUnregistrationHandler,\n SlateTriggerWebhookRequestHandler\n} from './action';\n\nexport class SlateActionBuilder<\n Type extends SlateActionType,\n ConfigType extends {},\n AuthType extends {},\n InputType extends {},\n OutputType extends {},\n Result extends SlateAction<Type, ConfigType, AuthType, any, any>\n> {\n #configSchema: z.ZodType<ConfigType>;\n #authSchema: z.ZodType<AuthType>;\n #inputSchema: z.ZodType<InputType> | null = null;\n #outputSchema: z.ZodType<OutputType> | null = null;\n\n #toolParams: SlateActionParametersTool<ConfigType, AuthType, InputType, OutputType> | null =\n null;\n #triggerParams: SlateActionParametersTrigger<\n ConfigType,\n AuthType,\n InputType,\n OutputType\n > | null = null;\n\n constructor(\n private readonly type: Type,\n private readonly spec: SlateSpecification<ConfigType, AuthType>,\n private readonly params: SlateActionParameters,\n private readonly factory: (\n params: SlateActionCreateParameters<any, any, any, any>\n ) => Result\n ) {\n this.#configSchema = spec.configSchema;\n this.#authSchema = spec.authSchema;\n }\n\n input<NewInputType extends {}>(\n schema: z.ZodType<NewInputType>\n ): SlateActionBuilder<Type, ConfigType, AuthType, NewInputType, OutputType, Result> {\n this.#inputSchema = schema as any;\n return this as any;\n }\n\n output<NewOutputType extends {}>(\n schema: z.ZodType<NewOutputType>\n ): SlateActionBuilder<Type, ConfigType, AuthType, InputType, NewOutputType, Result> {\n this.#outputSchema = schema as any;\n return this as any;\n }\n\n handleInvocation(\n handler: SlateToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>\n ): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result> {\n if (this.type !== 'tool') {\n throw new SlateDeclarationError('handleInvocation can only be set for tool actions');\n }\n\n this.#toolParams = {\n type: 'tool',\n handleInvocation: handler\n };\n\n return this;\n }\n\n webhook(props: {\n handleEvent: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;\n handleRequest: SlateTriggerWebhookRequestHandler<ConfigType, AuthType, InputType>;\n autoRegisterWebhook?: SlateTriggerWebhookAutoRegistrationHandler<ConfigType, AuthType>;\n autoUnregisterWebhook?: SlateTriggerWebhookAutoUnregistrationHandler<ConfigType, AuthType>;\n }): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result> {\n if (this.type !== 'trigger') {\n throw new SlateDeclarationError('handleEvent can only be set for trigger actions');\n }\n\n this.#triggerParams = {\n type: 'trigger',\n source: 'webhook',\n handleEvent: props.handleEvent,\n handleRequest: props.handleRequest,\n autoRegisterWebhook: props.autoRegisterWebhook,\n autoUnregisterWebhook: props.autoUnregisterWebhook\n };\n\n return this;\n }\n\n polling(props: {\n options?: SlatePollingOptions;\n pollEvents?: SlateTriggerPollingHandler<ConfigType, AuthType, InputType>;\n handleEvent: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;\n }): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result> {\n if (this.type !== 'trigger') {\n throw new SlateDeclarationError('handleEvent can only be set for trigger actions');\n }\n\n this.#triggerParams = {\n type: 'trigger',\n source: 'polling',\n polling: props.options,\n pollEvents: props.pollEvents,\n handleEvent: props.handleEvent\n };\n\n return this;\n }\n\n build() {\n if (!this.#inputSchema) {\n throw new SlateDeclarationError('Input schema is not defined');\n }\n if (!this.#outputSchema) {\n throw new SlateDeclarationError('Output schema is not defined');\n }\n if (this.type === 'tool' && !this.#toolParams) {\n throw new SlateDeclarationError('Tool invocation handler is not defined');\n }\n if (this.type === 'trigger' && !this.#triggerParams) {\n throw new SlateDeclarationError('Trigger event handlers are not defined');\n }\n\n return this.factory({\n ...this.params,\n configSchema: this.#configSchema,\n authSchema: this.#authSchema,\n inputSchema: this.#inputSchema,\n outputSchema: this.#outputSchema,\n\n ...this.#toolParams!,\n ...this.#triggerParams!\n }) as Result;\n }\n}\n","import z from 'zod';\nimport { SlateSpecification } from '../specification/specification';\nimport { SlateAction, SlateActionParameters, SlateToolInvocationHandler } from './action';\nimport { SlateActionBuilder } from './builder';\n\nexport interface SlateToolParameters<\n ConfigType extends {},\n AuthType extends {},\n InputType extends {},\n OutputType extends {}\n> extends SlateActionParameters {\n handleInvocation: SlateToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>;\n}\n\nexport class SlateTool<\n ConfigType extends {},\n AuthType extends {},\n InputType extends {},\n OutputType extends {}\n> extends SlateAction<'tool', ConfigType, AuthType, InputType, OutputType> {\n #handleInvocation: SlateToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>;\n\n private constructor(\n spec: SlateSpecification<ConfigType, AuthType>,\n inputSchema: z.ZodType<InputType>,\n outputSchema: z.ZodType<OutputType>,\n params: SlateToolParameters<ConfigType, AuthType, InputType, OutputType>\n ) {\n super('tool', spec, inputSchema, outputSchema, params);\n\n this.#handleInvocation = params.handleInvocation;\n }\n\n static create<ConfigType extends {}, AuthType extends {}>(\n spec: SlateSpecification<ConfigType, AuthType>,\n params: SlateActionParameters\n ) {\n return new SlateActionBuilder('tool', spec, params, params => {\n if (params.type != 'tool') throw new Error('Invalid action type for tool');\n return new SlateTool(spec, params.inputSchema, params.outputSchema, params);\n });\n }\n\n get handleInvocation() {\n return this.#handleInvocation;\n }\n}\n\nexport let tool = <ConfigType extends {}, AuthType extends {}>(\n spec: SlateSpecification<ConfigType, AuthType>,\n params: SlateActionParameters\n) => SlateTool.create(spec, params);\n","import z from 'zod';\nimport { SlateSpecification } from '../specification/specification';\nimport {\n SlateAction,\n SlateActionParameters,\n SlatePollingOptions,\n SlateTriggerMappingHandler,\n SlateTriggerPollingHandler,\n SlateTriggerWebhookAutoRegistrationHandler,\n SlateTriggerWebhookAutoUnregistrationHandler,\n SlateTriggerWebhookRequestHandler\n} from './action';\nimport { SlateActionBuilder } from './builder';\n\nexport const SlateDefaultPollingIntervalSeconds = 60 * 10;\n\nexport interface SlateTriggerParameters<\n ConfigType extends {},\n AuthType extends {},\n InputType extends {},\n OutputType extends {\n type: string;\n }\n> extends SlateActionParameters {\n type: 'trigger';\n source: 'polling' | 'webhook';\n polling?: SlatePollingOptions;\n handleEvent: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;\n handleRequest?: SlateTriggerWebhookRequestHandler<ConfigType, AuthType, InputType>;\n pollEvents?: SlateTriggerPollingHandler<ConfigType, AuthType, InputType>;\n autoRegisterWebhook?: SlateTriggerWebhookAutoRegistrationHandler<ConfigType, AuthType>;\n autoUnregisterWebhook?: SlateTriggerWebhookAutoUnregistrationHandler<ConfigType, AuthType>;\n}\n\nexport class SlateTrigger<\n ConfigType extends {},\n AuthType extends {},\n InputType extends {},\n OutputType extends {\n type: string;\n }\n> extends SlateAction<'trigger', ConfigType, AuthType, InputType, OutputType> {\n #source: 'polling' | 'webhook';\n #polling: SlatePollingOptions;\n #handleEvent: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;\n #handleRequest?: SlateTriggerWebhookRequestHandler<ConfigType, AuthType, InputType>;\n #pollEvents?: SlateTriggerPollingHandler<ConfigType, AuthType, InputType>;\n #autoRegisterWebhook?: SlateTriggerWebhookAutoRegistrationHandler<ConfigType, AuthType>;\n #autoUnregisterWebhook?: SlateTriggerWebhookAutoUnregistrationHandler<ConfigType, AuthType>;\n\n private constructor(\n spec: SlateSpecification<ConfigType, AuthType>,\n inputSchema: z.ZodType<InputType>,\n outputSchema: z.ZodType<OutputType>,\n params: SlateTriggerParameters<ConfigType, AuthType, InputType, OutputType>\n ) {\n super('trigger', spec, inputSchema, outputSchema, params);\n\n this.#source = params.source;\n this.#polling = params.polling || {\n intervalInSeconds: SlateDefaultPollingIntervalSeconds\n };\n this.#handleEvent = params.handleEvent;\n this.#handleRequest = params.handleRequest;\n this.#pollEvents = params.pollEvents;\n this.#autoRegisterWebhook = params.autoRegisterWebhook;\n this.#autoUnregisterWebhook = params.autoUnregisterWebhook;\n }\n\n static create<ConfigType extends {}, AuthType extends {}>(\n spec: SlateSpecification<ConfigType, AuthType>,\n params: SlateActionParameters\n ) {\n return new SlateActionBuilder('trigger', spec, params, params => {\n if (params.type != 'trigger') throw new Error('Invalid action type for trigger');\n return new SlateTrigger(spec, params.inputSchema, params.outputSchema, params);\n });\n }\n\n get polling() {\n return this.#polling;\n }\n\n get source() {\n return this.#source;\n }\n\n get handleEvent() {\n return this.#handleEvent;\n }\n\n get handleRequest() {\n return this.#handleRequest;\n }\n\n get pollEvents() {\n return this.#pollEvents;\n }\n\n get autoRegisterWebhook() {\n return this.#autoRegisterWebhook;\n }\n\n get autoUnregisterWebhook() {\n return this.#autoUnregisterWebhook;\n }\n}\n\nexport let trigger = <ConfigType extends {}, AuthType extends {}>(\n spec: SlateSpecification<ConfigType, AuthType>,\n params: SlateActionParameters\n) => SlateTrigger.create(spec, params);\n","import z from 'zod';\nimport { SlateAuthType } from './types';\n\nexport class SlateAuth<OutputType extends {} = {}> {\n #outputSchema: z.ZodType<OutputType> | null = null;\n #authStack: SlateAuthType<any, OutputType>[] = [];\n\n private constructor() {}\n\n static create<OutputType extends {}>() {\n return new SlateAuth<OutputType>();\n }\n\n output<NewOutputType extends {}>(\n schema: z.ZodType<NewOutputType>\n ): SlateAuth<NewOutputType> {\n this.#outputSchema = schema as any;\n return this as any as SlateAuth<NewOutputType>;\n }\n\n private addAuth<InputType extends {}>(\n auth: SlateAuthType<InputType, OutputType>\n ): SlateAuth<OutputType> {\n let existingKeys = this.#authStack.map(a => a.key);\n if (existingKeys.includes(auth.key)) {\n throw new Error(`Auth with key \"${auth.key}\" already exists in the auth stack`);\n }\n\n this.#authStack.push(auth);\n return this;\n }\n\n addOauth<InputType extends {}>(\n auth: SlateAuthType<InputType, OutputType> & { type: 'auth.oauth' }\n ): SlateAuth<OutputType> {\n this.addAuth(auth as any);\n return this;\n }\n\n addTokenAuth<InputType extends {}>(\n auth: SlateAuthType<InputType, OutputType> & { type: 'auth.token' }\n ): SlateAuth<OutputType> {\n this.addAuth(auth as any);\n return this;\n }\n\n addServiceAccountAuth<InputType extends {}>(\n auth: SlateAuthType<InputType, OutputType> & { type: 'auth.service_account' }\n ): SlateAuth<OutputType> {\n this.addAuth(auth as any);\n return this;\n }\n\n addCustomAuth<InputType extends {}>(\n auth: SlateAuthType<InputType, OutputType> & { type: 'auth.custom' }\n ): SlateAuth<OutputType> {\n this.addAuth(auth as any);\n return this;\n }\n\n addNone(): SlateAuth<OutputType> {\n this.addAuth({\n type: 'auth.none',\n name: 'No Authentication',\n key: 'none'\n });\n return this;\n }\n\n get authStack() {\n return this.#authStack.filter(a => a.type != 'auth.none');\n }\n\n get outputSchema() {\n if (!this.#outputSchema) {\n throw new Error('Output schema is not defined for this auth');\n }\n return this.#outputSchema;\n }\n}\n\nexport let auth = <OutputType extends {} = {}>() => SlateAuth.create<OutputType>();\n","import { AsyncLocalStorage } from 'async_hooks';\nimport { SlateContext } from './context';\n\nlet asyncLocalStorage = new AsyncLocalStorage<SlateContext<any, any, any>>();\n\nexport let runWithContext = <ConfigType extends {}, AuthType extends {}, InputType extends {}>(\n context: SlateContext<ConfigType, AuthType, InputType>,\n fn: () => Promise<void>\n) => {\n return asyncLocalStorage.run(context, fn);\n};\n\nexport let getCurrentContext = <\n ConfigType extends {},\n AuthType extends {},\n InputType extends {}\n>(): SlateContext<ConfigType, AuthType, InputType> => {\n let context = asyncLocalStorage.getStore();\n if (!context) {\n throw new Error('No Slate context is available');\n }\n return context as SlateContext<ConfigType, AuthType, InputType>;\n};\n","import baseAxios, { CreateAxiosDefaults } from 'axios';\nimport { getCurrentContext } from '../context/hook';\n\nexport let createAxios = (config?: CreateAxiosDefaults) => {\n let instance = baseAxios.create({\n ...config,\n headers: {\n ...config?.headers\n }\n });\n\n instance.interceptors.request.use(\n request => {\n // Has to be called in the context of an action execution\n let ctx = getCurrentContext();\n let spec = ctx.specification;\n\n request.headers.set('User-Agent', `slates.dev@1.0.0/${spec.key}`);\n\n return request;\n },\n error => Promise.reject(error)\n );\n\n return instance;\n};\n\nexport let axios = createAxios();\n","import z from 'zod';\n\nexport class SlateConfig<ConfigType extends {}> {\n #configSchema: z.ZodType<ConfigType>;\n #configChanged:\n | ((params: {\n previousConfig: ConfigType | null;\n newConfig: ConfigType;\n }) => { config: ConfigType | undefined } | void)\n | null = null;\n #getDefaultConfig: (() => ConfigType) | null = null;\n\n private constructor(schema: z.ZodType<ConfigType>) {\n this.#configSchema = schema;\n }\n\n static create<ConfigType extends {}>(schema: z.ZodType<ConfigType>) {\n return new SlateConfig<ConfigType>(schema);\n }\n\n config<NewConfigType extends {}>(\n schema: z.ZodType<NewConfigType>\n ): SlateConfig<NewConfigType> {\n this.#configSchema = schema as any;\n return this as any as SlateConfig<NewConfigType>;\n }\n\n onConfigChanged(\n handler: (params: {\n previousConfig: ConfigType | null;\n newConfig: ConfigType;\n }) => { config: ConfigType | undefined } | void\n ): SlateConfig<ConfigType> {\n this.#configChanged = handler;\n return this;\n }\n\n getDefaultConfig(getter: () => ConfigType): SlateConfig<ConfigType> {\n this.#getDefaultConfig = getter;\n return this;\n }\n\n get configSchema() {\n return this.#configSchema;\n }\n\n get handlers() {\n return {\n configChanged: this.#configChanged,\n getDefaultConfig: this.#getDefaultConfig\n };\n }\n}\n\nexport let config = <ConfigType extends {}>(schema: z.ZodType<ConfigType>) =>\n SlateConfig.create<ConfigType>(schema);\n","import { SlateLogger, SlateLogMessageInput } from '../logger';\nimport { SlateSpecification } from '../specification/specification';\n\nexport class SlateContext<ConfigType extends {}, AuthType extends {}, InputType extends {}> {\n #config: ConfigType;\n #input: InputType;\n #auth: AuthType;\n\n constructor(\n config: ConfigType,\n input: InputType,\n auth: AuthType,\n private readonly spec: SlateSpecification<ConfigType, AuthType>,\n private readonly logger: SlateLogger\n ) {\n this.#config = config;\n this.#input = input;\n this.#auth = auth;\n }\n\n get specification() {\n return this.spec;\n }\n\n get config() {\n return Object.freeze(this.#config);\n }\n\n get input() {\n return Object.freeze(this.#input);\n }\n\n get event() {\n return Object.freeze(this.#input);\n }\n\n get state() {\n return Object.freeze((this.#input as any).state) as 'state' extends keyof InputType\n ? InputType['state']\n : never;\n }\n\n get request() {\n return Object.freeze((this.#input as any).request) as 'request' extends keyof InputType\n ? InputType['request']\n : never;\n }\n\n get auth() {\n return Object.freeze(this.#auth);\n }\n\n info(message: SlateLogMessageInput) {\n this.logger.info(message);\n }\n\n warn(message: SlateLogMessageInput) {\n this.logger.warn(message);\n }\n\n error(message: SlateLogMessageInput) {\n this.logger.error(message);\n }\n\n progress(message: SlateLogMessageInput) {\n this.logger.progress(message);\n }\n}\n","import { encode } from '@toon-format/toon';\n\nexport type SlateLogType = 'info' | 'warn' | 'error' | 'progress';\n\nexport type SlateLogMessageInput =\n | string\n | Error\n | boolean\n | number\n | null\n | undefined\n | object\n | SlateLogMessageInput[];\n\nlet formatMessage = (message: SlateLogMessageInput): string => {\n if (typeof message === 'object') {\n if (message === null) return 'null';\n if (message instanceof Error) {\n return `[ERROR]: ${message.name}: ${message.message}\\n${message.stack}`;\n }\n return encode(message);\n }\n\n return String(message);\n};\n\nexport interface SlateLogEntry {\n type: SlateLogType;\n message: string;\n timestamp: Date;\n}\n\nexport type SlateLogListener = (entries: SlateLogEntry[]) => void;\n\nexport class SlateLogger {\n #logs: SlateLogEntry[] = [];\n #listeners: SlateLogListener[] = [];\n #timer: NodeJS.Timeout | null = null;\n\n constructor(listeners: SlateLogListener[] = []) {\n this.#listeners.push(...listeners);\n }\n\n private flush() {\n if (this.#timer) clearTimeout(this.#timer);\n if (this.#logs.length === 0) return;\n\n for (let listener of this.#listeners) {\n listener(this.#logs);\n }\n }\n\n private scheduleFlush() {\n if (this.#timer) return;\n this.#timer = setTimeout(() => {\n this.flush();\n this.#timer = null;\n }, 10);\n }\n\n log(type: SlateLogType, message: SlateLogMessageInput) {\n this.#logs.push({\n type,\n timestamp: new Date(),\n message: formatMessage(message)\n });\n this.scheduleFlush();\n }\n\n info(...message: SlateLogMessageInput[]) {\n this.log('info', message.flat());\n }\n\n warn(...message: SlateLogMessageInput[]) {\n this.log('warn', message.flat());\n }\n\n error(...message: SlateLogMessageInput[]) {\n this.log('error', message.flat());\n }\n\n progress(...message: SlateLogMessageInput[]) {\n this.log('progress', message.flat());\n }\n}\n","import { SlateTool, SlateTrigger } from '../action';\nimport { SlateSpecification } from './specification';\n\nexport class Slate<ConfigType extends {}, AuthType extends {}> {\n private constructor(\n private readonly _spec: SlateSpecification<ConfigType, AuthType>,\n private readonly _actions: (\n | SlateTrigger<ConfigType, AuthType, any, any>\n | SlateTool<ConfigType, AuthType, any, any>\n )[]\n ) {}\n\n static create<ConfigType extends {}, AuthType extends {}>(params: {\n spec: SlateSpecification<ConfigType, AuthType>;\n triggers: SlateTrigger<ConfigType, AuthType, any, any>[];\n tools: SlateTool<ConfigType, AuthType, any, any>[];\n }) {\n return new Slate(params.spec, [...params.triggers, ...params.tools]);\n }\n\n get spec() {\n return this._spec;\n }\n\n get actions() {\n return this._actions;\n }\n}\n","import z from 'zod';\nimport { SlateAuth } from '../auth';\nimport { SlateConfig } from '../config';\n\nexport interface SlateSpecificationParameters {\n key: string;\n name: string;\n description?: string;\n metadata?: Record<string, any>;\n}\n\nexport interface SlateSpecificationCreateParameters<\n ConfigType extends {},\n AuthType extends {}\n> extends SlateSpecificationParameters {\n config: SlateConfig<ConfigType>;\n auth: SlateAuth<AuthType>;\n}\n\nexport class SlateSpecification<ConfigType extends {}, AuthType extends {}> {\n private constructor(\n private readonly _config: SlateConfig<ConfigType>,\n private readonly _auth: SlateAuth<AuthType>,\n private readonly _params: SlateSpecificationParameters\n ) {}\n\n static create<ConfigType extends {}, AuthType extends {}>(\n params: SlateSpecificationCreateParameters<ConfigType, AuthType>\n ): SlateSpecification<ConfigType, AuthType> {\n return new SlateSpecification(params.config, params.auth, params);\n }\n\n get configSchema() {\n return this._config.configSchema;\n }\n\n get authSchema() {\n return (\n 'outputSchema' in this._auth ? this._auth.outputSchema : z.object({})\n ) as z.ZodType<AuthType>;\n }\n\n get config() {\n return this._config;\n }\n\n get auth() {\n return this._auth;\n }\n\n get parameters() {\n return this._params;\n }\n\n get key() {\n return this._params.key;\n }\n\n get name() {\n return this._params.name;\n }\n\n get description() {\n return this._params.description;\n }\n}\n\nexport let spec = <ConfigType extends {}, AuthType extends {}>(\n params: SlateSpecificationCreateParameters<ConfigType, AuthType>\n): SlateSpecification<ConfigType, AuthType> => SlateSpecification.create(params);\n"],"names":["SlateAction","_createClass","type","_spec","_inputSchema","_outputSchema","_params","this","key","get","configSchema","name","description","tags","instructions","constraints","metadata","SlateError","_Error","message","_this","call","_inheritsLoose","is","error","_wrapNativeSuper","Error","SlateDeclarationError","_SlateError","_configSchema","_classPrivateFieldLooseKey","_authSchema","_toolParams","_triggerParams","SlateActionBuilder","spec","params","factory","Object","defineProperty","writable","value","_classPrivateFieldLooseBase","authSchema","_proto","prototype","input","schema","output","handleInvocation","handler","webhook","props","source","handleEvent","handleRequest","autoRegisterWebhook","autoUnregisterWebhook","polling","options","pollEvents","build","_extends","inputSchema","outputSchema","_handleInvocation","SlateTool","_SlateAction","create","_source","_polling","_handleEvent","_handleRequest","_pollEvents","_autoRegisterWebhook","_autoUnregisterWebhook","SlateTrigger","intervalInSeconds","_authStack","SlateAuth","addAuth","auth","map","a","includes","push","addOauth","addTokenAuth","addServiceAccountAuth","addCustomAuth","addNone","filter","asyncLocalStorage","AsyncLocalStorage","createAxios","config","instance","baseAxios","headers","interceptors","request","use","ctx","context","getStore","getCurrentContext","set","specification","Promise","reject","axios","SlateConfig","_configChanged","_getDefaultConfig","onConfigChanged","getDefaultConfig","getter","configChanged","_config","_input","_auth","SlateContext","logger","info","warn","progress","freeze","state","formatMessage","stack","encode","String","_logs","_listeners","_timer","SlateLogger","listeners","_classPrivateFieldLoo","apply","flush","clearTimeout","length","_step","_iterator","_createForOfIteratorHelperLoose","done","listener","scheduleFlush","setTimeout","log","timestamp","Date","slice","arguments","flat","Slate","_actions","concat","triggers","tools","SlateSpecification","z","object"],"mappings":"ytFAoIsB,IAAAA,eAAW,WAa3B,OAAAC,EANJ,SACkBC,EACGC,EACAC,EACAC,EACAC,GAJHJ,KAAAA,UACGC,EAAAA,KAAAA,WACAC,EAAAA,KAAAA,kBACAC,EAAAA,KAAAA,mBACAC,EAAAA,KAAAA,aAJH,EAAAC,KAAIL,KAAJA,EACGK,KAAKJ,MAALA,EACAI,KAAYH,aAAZA,EACAG,KAAaF,cAAbA,EACAE,KAAOD,QAAPA,CAClB,EAAC,CAAA,CAAAE,IAAA,eAAAC,IAEJ,WACE,YAAYN,MAAMO,YACpB,GAAC,CAAAF,IAAA,cAAAC,IAED,WACE,OAAWF,KAACH,YACd,GAACI,CAAAA,mBAAAC,IAED,WACE,OAAWF,KAACF,aACd,GAACG,CAAAA,IAAAC,aAAAA,IAED,WACE,YAAYH,OACd,GAAC,CAAAE,IAAA,MAAAC,IAED,WACE,YAAYH,QAAQE,GACtB,GAAC,CAAAA,IAAA,OAAAC,IAED,WACE,OAAWF,KAACD,QAAQ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mB5H,EAAO2D,OAAQ3D,EAAO6C,KAAM7C,EAC5D,EAACnC,EAAA+J,EAAA,CAAA,CAAAxJ,IAAA,eAAAC,IAED,WACE,OAAOF,KAAK+G,QAAQ5G,YACtB,GAACF,CAAAA,iBAAAC,IAED,WACE,MACE,iBAAsBF,KAACiH,MAAQjH,KAAKiH,MAAMxD,aAAeiG,EAAAA,QAAEC,OAAO,CAAE,EAExE,GAAC,CAAA1J,IAAAC,SAAAA,IAED,WACE,OAAOF,KAAK+G,OACd,GAAC,CAAA9G,IAAA,OAAAC,IAED,WACE,OAAWF,KAACiH,KACd,GAAChH,CAAAA,iBAAAC,IAED,WACE,OAAWF,KAACD,OACd,GAACE,CAAAA,IAAAC,MAAAA,IAED,WACE,YAAYH,QAAQE,GACtB,GAAC,CAAAA,IAAAC,OAAAA,IAED,WACE,OAAOF,KAAKD,QAAQK,IACtB,GAAC,CAAAH,IAAA,cAAAC,IAED,WACE,OAAWF,KAACD,QAAQM,WACtB,IAAC,CA5CD,6IRNgD,kGCmEhC,WAAkC,OAAAmE,EAAUX,QAAoB,qBG3B9D,SAAwBrB,GAC1C,OAAAgE,EAAY3C,OAAmBrB,EAAO,yBIYtB,SAChBX,GAAgE,OACnB4H,GAAmB5F,OAAOhC,EAAO,STrB9D,SAChBD,EACAC,GAA6B,OAC1B8B,EAAUE,OAAOjC,EAAMC,EAAO,YCyDd,SACnBD,EACAC,GAA6B,OAC1BwC,EAAaR,OAAOjC,EAAMC,EAAO"}
@@ -1,2 +0,0 @@
1
- export * from './logger';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logger/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -1,20 +0,0 @@
1
- export type SlateLogType = 'info' | 'warn' | 'error' | 'progress';
2
- export type SlateLogMessageInput = string | Error | boolean | number | null | undefined | object | SlateLogMessageInput[];
3
- export interface SlateLogEntry {
4
- type: SlateLogType;
5
- message: string;
6
- timestamp: Date;
7
- }
8
- export type SlateLogListener = (entries: SlateLogEntry[]) => void;
9
- export declare class SlateLogger {
10
- #private;
11
- constructor(listeners?: SlateLogListener[]);
12
- private flush;
13
- private scheduleFlush;
14
- log(type: SlateLogType, message: SlateLogMessageInput): void;
15
- info(...message: SlateLogMessageInput[]): void;
16
- warn(...message: SlateLogMessageInput[]): void;
17
- error(...message: SlateLogMessageInput[]): void;
18
- progress(...message: SlateLogMessageInput[]): void;
19
- }
20
- //# sourceMappingURL=logger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger/logger.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC;AAElE,MAAM,MAAM,oBAAoB,GAC5B,MAAM,GACN,KAAK,GACL,OAAO,GACP,MAAM,GACN,IAAI,GACJ,SAAS,GACT,MAAM,GACN,oBAAoB,EAAE,CAAC;AAc3B,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,aAAa,EAAE,KAAK,IAAI,CAAC;AAElE,qBAAa,WAAW;;gBAKV,SAAS,GAAE,gBAAgB,EAAO;IAI9C,OAAO,CAAC,KAAK;IASb,OAAO,CAAC,aAAa;IAQrB,GAAG,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,oBAAoB;IASrD,IAAI,CAAC,GAAG,OAAO,EAAE,oBAAoB,EAAE;IAIvC,IAAI,CAAC,GAAG,OAAO,EAAE,oBAAoB,EAAE;IAIvC,KAAK,CAAC,GAAG,OAAO,EAAE,oBAAoB,EAAE;IAIxC,QAAQ,CAAC,GAAG,OAAO,EAAE,oBAAoB,EAAE;CAG5C"}
@@ -1,3 +0,0 @@
1
- export * from './slate';
2
- export * from './specification';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/specification/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC"}
@@ -1,15 +0,0 @@
1
- import { SlateTool, SlateTrigger } from '../action';
2
- import { SlateSpecification } from './specification';
3
- export declare class Slate<ConfigType extends {}, AuthType extends {}> {
4
- private readonly _spec;
5
- private readonly _actions;
6
- private constructor();
7
- static create<ConfigType extends {}, AuthType extends {}>(params: {
8
- spec: SlateSpecification<ConfigType, AuthType>;
9
- triggers: SlateTrigger<ConfigType, AuthType, any, any>[];
10
- tools: SlateTool<ConfigType, AuthType, any, any>[];
11
- }): Slate<ConfigType, AuthType>;
12
- get spec(): SlateSpecification<ConfigType, AuthType>;
13
- get actions(): (SlateTrigger<ConfigType, AuthType, any, any> | SlateTool<ConfigType, AuthType, any, any>)[];
14
- }
15
- //# sourceMappingURL=slate.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"slate.d.ts","sourceRoot":"","sources":["../../src/specification/slate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,qBAAa,KAAK,CAAC,UAAU,SAAS,EAAE,EAAE,QAAQ,SAAS,EAAE;IAEzD,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAF3B,OAAO;IAQP,MAAM,CAAC,MAAM,CAAC,UAAU,SAAS,EAAE,EAAE,QAAQ,SAAS,EAAE,EAAE,MAAM,EAAE;QAChE,IAAI,EAAE,kBAAkB,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAC/C,QAAQ,EAAE,YAAY,CAAC,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;QACzD,KAAK,EAAE,SAAS,CAAC,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;KACpD;IAID,IAAI,IAAI,6CAEP;IAED,IAAI,OAAO,iGAEV;CACF"}
@@ -1,30 +0,0 @@
1
- import z from 'zod';
2
- import { SlateAuth } from '../auth';
3
- import { SlateConfig } from '../config';
4
- export interface SlateSpecificationParameters {
5
- key: string;
6
- name: string;
7
- description?: string;
8
- metadata?: Record<string, any>;
9
- }
10
- export interface SlateSpecificationCreateParameters<ConfigType extends {}, AuthType extends {}> extends SlateSpecificationParameters {
11
- config: SlateConfig<ConfigType>;
12
- auth: SlateAuth<AuthType>;
13
- }
14
- export declare class SlateSpecification<ConfigType extends {}, AuthType extends {}> {
15
- private readonly _config;
16
- private readonly _auth;
17
- private readonly _params;
18
- private constructor();
19
- static create<ConfigType extends {}, AuthType extends {}>(params: SlateSpecificationCreateParameters<ConfigType, AuthType>): SlateSpecification<ConfigType, AuthType>;
20
- get configSchema(): z.ZodType<ConfigType, unknown, z.core.$ZodTypeInternals<ConfigType, unknown>>;
21
- get authSchema(): z.ZodType<AuthType>;
22
- get config(): SlateConfig<ConfigType>;
23
- get auth(): SlateAuth<AuthType>;
24
- get parameters(): SlateSpecificationParameters;
25
- get key(): string;
26
- get name(): string;
27
- get description(): string | undefined;
28
- }
29
- export declare let spec: <ConfigType extends {}, AuthType extends {}>(params: SlateSpecificationCreateParameters<ConfigType, AuthType>) => SlateSpecification<ConfigType, AuthType>;
30
- //# sourceMappingURL=specification.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"specification.d.ts","sourceRoot":"","sources":["../../src/specification/specification.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CA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../action';
2
- import { ZeroSpecification } from './specification';
3
- export declare class Zero<ConfigType extends {}, AuthType extends {}> {
4
- private readonly _spec;
5
- private readonly _actions;
6
- private constructor();
7
- static create<ConfigType extends {}, AuthType extends {}>(params: {
8
- spec: ZeroSpecification<ConfigType, AuthType>;
9
- triggers: ZeroAction<'trigger', ConfigType, AuthType, any, any>[];
10
- tools: ZeroAction<'tool', ConfigType, AuthType, any, any>[];
11
- }): Zero<ConfigType, AuthType>;
12
- }
13
- //# sourceMappingURL=zero.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"zero.d.ts","sourceRoot":"","sources":["../../src/specification/zero.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAkB,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,qBAAa,IAAI,CAAC,UAAU,SAAS,EAAE,EAAE,QAAQ,SAAS,EAAE;IAExD,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAF3B,OAAO;IAKP,MAAM,CAAC,MAAM,CAAC,UAAU,SAAS,EAAE,EAAE,QAAQ,SAAS,EAAE,EAAE,MAAM,EAAE;QAChE,IAAI,EAAE,iBAAiB,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAC9C,QAAQ,EAAE,UAAU,CAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;QAClE,KAAK,EAAE,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;KAC7D;CAGF"}
package/dist/tokens.d.ts DELETED
@@ -1,34 +0,0 @@
1
- export type TokenKeys = {
2
- privateKey: string | (() => Promise<CryptoKey> | CryptoKey);
3
- publicKey: string | (() => Promise<CryptoKey> | CryptoKey);
4
- } | {
5
- secret: string;
6
- };
7
- export declare class Tokens {
8
- readonly keys: TokenKeys;
9
- private signer;
10
- constructor(keys: TokenKeys);
11
- sign({ type, data, expiresAt }: {
12
- type: string;
13
- data: any;
14
- expiresAt?: Date;
15
- }): Promise<string>;
16
- verify({ token, expectedType }: {
17
- expectedType: string;
18
- token: string;
19
- }): Promise<{
20
- verified: false;
21
- type?: undefined;
22
- expiresAt?: undefined;
23
- createdAt?: undefined;
24
- data?: undefined;
25
- } | {
26
- verified: true;
27
- type: string;
28
- expiresAt: Date | null;
29
- createdAt: Date;
30
- data: any;
31
- }>;
32
- static decode(token: string): any;
33
- }
34
- //# sourceMappingURL=tokens.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,SAAS,GACjB;IACE,UAAU,EAAE,MAAM,GAAG,CAAC,MAAM,OAAO,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC,CAAC;IAC5D,SAAS,EAAE,MAAM,GAAG,CAAC,MAAM,OAAO,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC,CAAC;CAC5D,GACD;IACE,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAiGN,qBAAa,MAAM;IAEL,QAAQ,CAAC,IAAI,EAAE,SAAS;IADpC,OAAO,CAAC,MAAM,CAAS;gBACF,IAAI,EAAE,SAAS;IAI9B,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,GAAG,CAAC;QAAC,SAAS,CAAC,EAAE,IAAI,CAAA;KAAE;IAa7E,MAAM,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;;;IAiC7E,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM;CAO5B"}