slates 0.0.2 → 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 (54) 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/index.d.ts +2 -0
  26. package/dist/context/index.d.ts.map +1 -0
  27. package/dist/error/base.d.ts +5 -0
  28. package/dist/error/base.d.ts.map +1 -0
  29. package/dist/error/declaration.d.ts +6 -0
  30. package/dist/error/declaration.d.ts.map +1 -0
  31. package/dist/error/index.d.ts +3 -0
  32. package/dist/error/index.d.ts.map +1 -0
  33. package/dist/index.cjs +2 -0
  34. package/dist/index.cjs.map +1 -0
  35. package/dist/index.d.ts +2 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.modern.js +2 -0
  38. package/dist/index.modern.js.map +1 -0
  39. package/dist/index.module.js +2 -0
  40. package/dist/index.module.js.map +1 -0
  41. package/dist/index.umd.js +2 -0
  42. package/dist/index.umd.js.map +1 -0
  43. package/dist/specification/index.d.ts +3 -0
  44. package/dist/specification/index.d.ts.map +1 -0
  45. package/dist/specification/specification.d.ts +31 -0
  46. package/dist/specification/specification.d.ts.map +1 -0
  47. package/dist/specification/zero.d.ts +13 -0
  48. package/dist/specification/zero.d.ts.map +1 -0
  49. package/dist/tokens.d.ts +34 -0
  50. package/dist/tokens.d.ts.map +1 -0
  51. package/package.json +36 -20
  52. package/src/index.ts +1 -0
  53. package/bin/slates.js +0 -8
  54. package/readme.md +0 -9
@@ -0,0 +1,90 @@
1
+ import { z } from 'zod';
2
+ import { ZeroContext } from '../context';
3
+ import { ZeroSpecification } from '../specification/specification';
4
+ export type ZeroActionType = 'tool' | 'trigger';
5
+ export interface ZeroActionParameters {
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 ZeroToolInvocationHandler<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> = (context: ZeroContext<ConfigType, AuthType, InputType>) => Promise<{
18
+ output: OutputType;
19
+ message: string;
20
+ }>;
21
+ export type ZeroTriggerMappingHandler<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> = (context: ZeroContext<ConfigType, AuthType, InputType>) => Promise<{
22
+ type: string;
23
+ id: string;
24
+ output: OutputType;
25
+ }>;
26
+ export type ZeroTriggerPollingHandler<ConfigType extends {}, AuthType extends {}, InputType extends {}> = (context: ZeroContext<ConfigType, AuthType, {
27
+ state: any;
28
+ }>) => Promise<{
29
+ inputs: InputType[];
30
+ updatedState?: any;
31
+ }>;
32
+ export type ZeroTriggerWebhookRequestHandler<ConfigType extends {}, AuthType extends {}, InputType extends {}> = (context: ZeroContext<ConfigType, AuthType, {
33
+ request: Request;
34
+ state: any;
35
+ }>) => Promise<{
36
+ inputs: InputType[];
37
+ updatedState?: any;
38
+ }>;
39
+ export type ZeroTriggerWebhookAutoRegistrationHandler<ConfigType extends {}, AuthType extends {}> = (context: ZeroContext<ConfigType, AuthType, {
40
+ webhookBaseUrl: string;
41
+ }>) => Promise<{
42
+ registrationDetails: any;
43
+ }>;
44
+ export type ZeroTriggerWebhookAutoUnregistrationHandler<ConfigType extends {}, AuthType extends {}> = (context: ZeroContext<ConfigType, AuthType, {
45
+ webhookBaseUrl: string;
46
+ registrationDetails: any;
47
+ }>) => Promise<unknown>;
48
+ export interface ZeroActionParametersTool<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> {
49
+ handlerInvocation: ZeroToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>;
50
+ }
51
+ export interface ZeroPollingOptions {
52
+ intervalInSeconds?: number;
53
+ }
54
+ export interface ZeroActionParametersTrigger<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> {
55
+ source: 'polling' | 'webhook';
56
+ polling?: ZeroPollingOptions;
57
+ handleEvent: ZeroTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
58
+ handleRequest?: ZeroTriggerWebhookRequestHandler<ConfigType, AuthType, InputType>;
59
+ pollEvents?: ZeroTriggerPollingHandler<ConfigType, AuthType, InputType>;
60
+ autoRegisterWebhook?: ZeroTriggerWebhookAutoRegistrationHandler<ConfigType, AuthType>;
61
+ autoUnregisterWebhook?: ZeroTriggerWebhookAutoUnregistrationHandler<ConfigType, AuthType>;
62
+ }
63
+ export type ZeroActionParametersAny<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> = ZeroActionParametersTool<ConfigType, AuthType, InputType, OutputType> | ZeroActionParametersTrigger<ConfigType, AuthType, InputType, OutputType>;
64
+ export type ZeroActionCreateParameters<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> = ZeroActionParametersAny<ConfigType, AuthType, InputType, OutputType> & ZeroActionParameters & {
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 ZeroAction<Type extends ZeroActionType, ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> {
71
+ readonly type: Type;
72
+ protected readonly _spec: ZeroSpecification<ConfigType, AuthType>;
73
+ protected readonly _inputSchema: z.ZodType<InputType>;
74
+ protected readonly _outputSchema: z.ZodType<OutputType>;
75
+ protected readonly _params: ZeroActionParameters;
76
+ constructor(type: Type, _spec: ZeroSpecification<ConfigType, AuthType>, _inputSchema: z.ZodType<InputType>, _outputSchema: z.ZodType<OutputType>, _params: ZeroActionParameters);
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(): ZeroActionParameters;
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,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,SAAS,CAAC;AAEhD,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,W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,8BAAsB,UAAU,CAC9B,IAAI,SAAS,cAAc,EAC3B,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,iBAAiB,CAAC,UAAU,EAAE,QAAQ,CAAC;IACjE,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,oBAAoB;gBAJhC,IAAI,EAAE,IAAI,EACP,KAAK,EAAE,iBAAiB,CAAC,UAAU,EAAE,QAAQ,CAAC,EAC9C,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EAClC,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,EACpC,OAAO,EAAE,oBAAoB;IAGlD,IAAI,YAAY,kFAEf;IAED,IAAI,WAAW,gFAEd;IAED,IAAI,YAAY,kFAEf;IAED,IAAI,UAAU,yBAEb;IAED,IAAI,GAAG,WAEN;IAED,IAAI,IAAI,WAEP;IAED,IAAI,WAAW,uBAEd;IAED,IAAI,IAAI;;sBA5JQ,OAAO;mBACV,OAAO;kBA6JnB;CACF"}
@@ -0,0 +1,27 @@
1
+ import z from 'zod';
2
+ import { ZeroSpecification } from '../specification/specification';
3
+ import { ZeroAction, ZeroActionCreateParameters, ZeroActionParameters, ZeroActionType, ZeroPollingOptions, ZeroToolInvocationHandler, ZeroTriggerMappingHandler, ZeroTriggerPollingHandler, ZeroTriggerWebhookAutoRegistrationHandler, ZeroTriggerWebhookAutoUnregistrationHandler, ZeroTriggerWebhookRequestHandler } from './action';
4
+ export declare class ZeroActionBuilder<Type extends ZeroActionType, 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: ZeroSpecification<ConfigType, AuthType>, params: ZeroActionParameters, factory: (params: ZeroActionCreateParameters<any, any, any, any>) => ZeroAction<Type, any, any, any, any>);
11
+ input<NewInputType extends {}>(schema: z.ZodType<NewInputType>): ZeroActionBuilder<Type, ConfigType, AuthType, NewInputType, OutputType>;
12
+ output<NewOutputType extends {}>(schema: z.ZodType<NewOutputType>): ZeroActionBuilder<Type, ConfigType, AuthType, InputType, NewOutputType>;
13
+ handleInvocation(handler: ZeroToolInvocationHandler<ConfigType, AuthType, InputType, OutputType>): ZeroActionBuilder<Type, ConfigType, AuthType, InputType, OutputType>;
14
+ webhook(props: {
15
+ handleEvent: ZeroTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
16
+ handleRequest: ZeroTriggerWebhookRequestHandler<ConfigType, AuthType, InputType>;
17
+ autoRegisterWebhook?: ZeroTriggerWebhookAutoRegistrationHandler<ConfigType, AuthType>;
18
+ autoUnregisterWebhook?: ZeroTriggerWebhookAutoUnregistrationHandler<ConfigType, AuthType>;
19
+ }): ZeroActionBuilder<Type, ConfigType, AuthType, InputType, OutputType>;
20
+ polling(props: {
21
+ options?: ZeroPollingOptions;
22
+ pollEvents?: ZeroTriggerPollingHandler<ConfigType, AuthType, InputType>;
23
+ handleEvent: ZeroTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
24
+ }): ZeroActionBuilder<Type, ConfigType, AuthType, InputType, OutputType>;
25
+ build(): ZeroAction<Type, ConfigType, AuthType, InputType, OutputType>;
26
+ }
27
+ //# sourceMappingURL=builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/action/builder.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,OAAO,EAAE,iBAAiB,E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AAE,UAAU,CAAC,GAC9E,iBAAiB,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC;IAYvE,OAAO,CAAC,KAAK,EAAE;QACb,WAAW,EAAE,yBAAyB,CAAC,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;QACpF,aAAa,EAAE,gCAAgC,CAAC,UAAU,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;QACjF,mBAAmB,CAAC,EAAE,yCAAyC,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QACtF,qBAAqB,CAAC,EAAE,2CAA2C,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;KAC3F,GAAG,iBAAiB,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC;IAgBxE,OAAO,CAAC,KAAK,EAAE;QACb,OAAO,CAAC,EAAE,kBAAkB,CAAC;QAC7B,UAAU,CAAC,EAAE,yBAAyB,CAAC,UAAU,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;QACxE,WAAW,EAAE,yBAAyB,CAAC,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;KACrF,GAAG,iBAAiB,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC;IAexE,KAAK,IAuBG,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC;CAEtE"}
@@ -0,0 +1,5 @@
1
+ export * from './action';
2
+ export * from './tool';
3
+ export * from './trigger';
4
+ export type * from './builder';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -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 { ZeroSpecification } from '../specification/specification';
2
+ import { ZeroAction, ZeroActionParameters } from './action';
3
+ import { ZeroActionBuilder } from './builder';
4
+ export interface ZeroToolParameters extends ZeroActionParameters {
5
+ }
6
+ export declare class ZeroTool<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> extends ZeroAction<'tool', ConfigType, AuthType, InputType, OutputType> {
7
+ private constructor();
8
+ static create<ConfigType extends {}, AuthType extends {}>(spec: ZeroSpecification<ConfigType, AuthType>, params: ZeroToolParameters): ZeroActionBuilder<"tool", ConfigType, AuthType, {}, {}>;
9
+ }
10
+ export declare let tool: <ConfigType extends {}, AuthType extends {}>(spec: ZeroSpecification<ConfigType, AuthType>, params: ZeroToolParameters) => ZeroActionBuilder<"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,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,MAAM,WAAW,kBAAmB,SAAQ,oBAAoB;CAAG;AAEnE,qBAAa,QAAQ,CACnB,UAAU,SAAS,EAAE,EACrB,QAAQ,SAAS,EAAE,EACnB,SAAS,SAAS,EAAE,EACpB,UAAU,SAAS,EAAE,CACrB,SAAQ,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC;IACvE,OAAO;IASP,MAAM,CAAC,MAAM,CAAC,UAAU,SAAS,EAAE,EAAE,QAAQ,SAAS,EAAE,EACtD,IAAI,EAAE,iBAAiB,CAAC,UAAU,EAAE,QAAQ,CAAC,EAC7C,MAAM,EAAE,kBAAkB;CAS7B;AAED,eAAO,IAAI,IAAI,GAAI,UAAU,SAAS,EAAE,EAAE,QAAQ,SAAS,EAAE,EAC3D,MAAM,iBAAiB,CAAC,UAAU,EAAE,QAAQ,CAAC,EAC7C,QAAQ,kBAAkB,4DACM,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { ZeroSpecification } from '../specification/specification';
2
+ import { ZeroAction, ZeroActionParameters } from './action';
3
+ import { ZeroActionBuilder } from './builder';
4
+ export declare const ZeroDefaultPollingIntervalSeconds: number;
5
+ export interface ZeroTriggerParameters extends ZeroActionParameters {
6
+ }
7
+ export declare class ZeroTrigger<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {
8
+ type: string;
9
+ }> extends ZeroAction<'trigger', ConfigType, AuthType, InputType, OutputType> {
10
+ private constructor();
11
+ static create<ConfigType extends {}, AuthType extends {}>(spec: ZeroSpecification<ConfigType, AuthType>, params: ZeroTriggerParameters): ZeroActionBuilder<"trigger", ConfigType, AuthType, {}, {}>;
12
+ }
13
+ export declare let Trigger: <ConfigType extends {}, AuthType extends {}>(spec: ZeroSpecification<ConfigType, AuthType>, params: ZeroTriggerParameters) => ZeroActionBuilder<"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,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,eAAO,MAAM,iCAAiC,QAAU,CAAC;AAEzD,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;CAAG;AAEtE,qBAAa,WAAW,CACtB,UAAU,SAAS,EAAE,EACrB,QAAQ,SAAS,EAAE,EACnB,SAAS,SAAS,EAAE,EACpB,UAAU,SAAS;IACjB,IAAI,EAAE,MAAM,CAAC;CACd,CACD,SAAQ,UAAU,CAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC;IAC1E,OAAO;IASP,MAAM,CAAC,MAAM,CAAC,UAAU,SAAS,EAAE,EAAE,QAAQ,SAAS,EAAE,EACtD,IAAI,EAAE,iBAAiB,CAAC,UAAU,EAAE,QAAQ,CAAC,EAC7C,MAAM,EAAE,qBAAqB;CAShC;AAED,eAAO,IAAI,OAAO,GAAI,UAAU,SAAS,EAAE,EAAE,QAAQ,SAAS,EAAE,EAC9D,MAAM,iBAAiB,CAAC,UAAU,EAAE,QAAQ,CAAC,EAC7C,QAAQ,qBAAqB,+DACM,CAAC"}
@@ -0,0 +1,26 @@
1
+ import z from 'zod';
2
+ import { ZeroAuthType } from './types';
3
+ export declare class ZeroAuth<OutputType extends {} = {}> {
4
+ #private;
5
+ private constructor();
6
+ static create<OutputType extends {}>(): ZeroAuth<OutputType>;
7
+ output<NewOutputType extends {}>(schema: z.ZodType<NewOutputType>): ZeroAuth<NewOutputType>;
8
+ private addAuth;
9
+ addOauth<InputType extends {}>(auth: ZeroAuthType<InputType, OutputType> & {
10
+ type: 'auth.oauth';
11
+ }): ZeroAuth<OutputType>;
12
+ addTokenAuth<InputType extends {}>(auth: ZeroAuthType<InputType, OutputType> & {
13
+ type: 'auth.token';
14
+ }): ZeroAuth<OutputType>;
15
+ addServiceAccountAuth<InputType extends {}>(auth: ZeroAuthType<InputType, OutputType> & {
16
+ type: 'auth.service_account';
17
+ }): ZeroAuth<OutputType>;
18
+ addCustomAuth<InputType extends {}>(auth: ZeroAuthType<InputType, OutputType> & {
19
+ type: 'auth.custom';
20
+ }): ZeroAuth<OutputType>;
21
+ addNone(): ZeroAuth<OutputType>;
22
+ get authStack(): import("./types").ZeroAuthWithNone<any, OutputType>[];
23
+ get outputSchema(): z.ZodType<OutputType, unknown, z.core.$ZodTypeInternals<OutputType, unknown>>;
24
+ }
25
+ export declare let auth: <OutputType extends {} = {}>() => ZeroAuth<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,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,qBAAa,QAAQ,CAAC,UAAU,SAAS,EAAE,GAAG,EAAE;;IAI9C,OAAO;IAEP,MAAM,CAAC,MAAM,CAAC,UAAU,SAAS,EAAE;IAInC,MAAM,CAAC,aAAa,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC;IAK3F,OAAO,CAAC,OAAO;IAYf,QAAQ,CAAC,SAAS,SAAS,EAAE,EAC3B,IAAI,EAAE,YAAY,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG;QAAE,IAAI,EAAE,YAAY,CAAA;KAAE,GACjE,QAAQ,CAAC,UAAU,CAAC;IAKvB,YAAY,CAAC,SAAS,SAAS,EAAE,EAC/B,IAAI,EAAE,YAAY,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG;QAAE,IAAI,EAAE,YAAY,CAAA;KAAE,GACjE,QAAQ,CAAC,UAAU,CAAC;IAKvB,qBAAqB,CAAC,SAAS,SAAS,EAAE,EACxC,IAAI,EAAE,YAAY,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG;QAAE,IAAI,EAAE,sBAAsB,CAAA;KAAE,GAC3E,QAAQ,CAAC,UAAU,CAAC;IAKvB,aAAa,CAAC,SAAS,SAAS,EAAE,EAChC,IAAI,EAAE,YAAY,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG;QAAE,IAAI,EAAE,aAAa,CAAA;KAAE,GAClE,QAAQ,CAAC,UAAU,CAAC;IAKvB,OAAO,IAAI,QAAQ,CAAC,UAAU,CAAC;IAS/B,IAAI,SAAS,0DAEZ;IAED,IAAI,YAAY,kFAKf;CACF;AAED,eAAO,IAAI,IAAI,GAAI,UAAU,SAAS,EAAE,GAAG,EAAE,2BAAoC,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 ZeroAuthWithOauth<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 ZeroAuthWithToken<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 ZeroAuthWithServiceAccount<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 ZeroAuthWithCustomData<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 ZeroAuthWithNone<InputType extends {}, OutputType extends {}> = {
139
+ type: 'auth.none';
140
+ name: string;
141
+ key: string;
142
+ };
143
+ export type ZeroAuthType<InputType extends {}, OutputType extends {}> = ZeroAuthWithOauth<InputType, OutputType & {
144
+ token: string;
145
+ }> | ZeroAuthWithToken<InputType, OutputType & {
146
+ token?: string;
147
+ }> | ZeroAuthWithServiceAccount<InputType, OutputType> | ZeroAuthWithCustomData<InputType, OutputType> | ZeroAuthWithNone<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,iBAAiB,CAC3B,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,CAAC,MAAM,EAAE;QACxB,aAAa,EAAE,SAAS,GAAG,IAAI,CAAC;QAChC,QAAQ,EAAE,SAAS,CAAC;K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;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,gBAAgB,CAAC,SAAS,SAAS,EAAE,EAAE,UAAU,SAAS,EAAE,IAAI;IAC1E,IAAI,EAAE,WAAW,CAAC;IAElB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,YAAY,CAAC,SAAS,SAAS,EAAE,EAAE,UAAU,SAAS,EAAE,IAChE,iBAAiB,CAAC,SAAS,EAAE,UAAU,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,GAC5D,iBAAiB,CAAC,SAAS,EAAE,UAAU,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GAC7D,0BAA0B,CAAC,SAAS,EAAE,UAAU,CAAC,GACjD,sBAAsB,CAAC,SAAS,EAAE,UAAU,CAAC,GAC7C,gBAAgB,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 ZeroConfig<ConfigType extends {}> {
3
+ #private;
4
+ private constructor();
5
+ static create<ConfigType extends {}>(schema: z.ZodType<ConfigType>): ZeroConfig<ConfigType>;
6
+ config<NewConfigType extends {}>(schema: z.ZodType<NewConfigType>): ZeroConfig<NewConfigType>;
7
+ onConfigChanged(handler: (params: {
8
+ previousConfig: ConfigType | null;
9
+ newConfig: ConfigType;
10
+ }) => void): ZeroConfig<ConfigType>;
11
+ getDefaultConfig(getter: () => ConfigType): ZeroConfig<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>) => ZeroConfig<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,UAAU,CAAC,UAAU,SAAS,EAAE;;IAO3C,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,UAAU,CAAC,aAAa,CAAC;IAK5B,eAAe,CACb,OAAO,EAAE,CAAC,MAAM,EAAE;QAAE,cAAc,EAAE,UAAU,GAAG,IAAI,CAAC;QAAC,SAAS,EAAE,UAAU,CAAA;KAAE,KAAK,IAAI,GACtF,UAAU,CAAC,UAAU,CAAC;IAKzB,gBAAgB,CAAC,MAAM,EAAE,MAAM,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;IAKlE,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,2BAClC,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 { ZeroLogger, ZeroLogMessageInput } from '../logger';
2
+ import { ZeroSpecification } from '../specification/specification';
3
+ export declare class ZeroContext<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: ZeroSpecification<ConfigType, AuthType>, logger: ZeroLogger);
8
+ get specification(): ZeroSpecification<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: ZeroLogMessageInput): void;
16
+ warn(message: ZeroLogMessageInput): void;
17
+ error(message: ZeroLogMessageInput): void;
18
+ progress(message: ZeroLogMessageInput): 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,UAAU,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,qBAAa,WAAW,CAAC,UAAU,SAAS,EAAE,EAAE,QAAQ,SAAS,EAAE,EAAE,SAAS,SAAS,EAAE;;IASrF,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,iBAAiB,CAAC,UAAU,EAAE,QAAQ,CAAC,EAC7C,MAAM,EAAE,UAAU;IAOrC,IAAI,aAAa,4CAEhB;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,mBAAmB;IAIjC,IAAI,CAAC,OAAO,EAAE,mBAAmB;IAIjC,KAAK,CAAC,OAAO,EAAE,mBAAmB;IAIlC,QAAQ,CAAC,OAAO,EAAE,mBAAmB;CAGtC"}
@@ -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 ZeroError extends Error {
2
+ constructor(message: string);
3
+ static is(error: unknown): error is ZeroError;
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,SAAU,SAAQ,KAAK;gBACtB,OAAO,EAAE,MAAM;IAK3B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS;CAG9C"}
@@ -0,0 +1,6 @@
1
+ import { ZeroError } from './base';
2
+ export declare class ZeroDeclarationError extends ZeroError {
3
+ constructor(message: string);
4
+ static is(error: unknown): error is ZeroDeclarationError;
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,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,qBAAa,oBAAqB,SAAQ,SAAS;gBACrC,OAAO,EAAE,MAAM;IAK3B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,oBAAoB;CAGzD"}
@@ -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("@slates/provider");Object.keys(e).forEach(function(r){"default"===r||exports.hasOwnProperty(r)||Object.defineProperty(exports,r,{enumerable:!0,get:function(){return e[r]}})});
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from '@slates/provider';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import{base62 as e}from"@lowerdeck/base62";import{memo as t}from"@lowerdeck/memo";class r{constructor(r){this.keys=void 0,this.signer=void 0,this.keys=r,this.signer=(r=>{if("secret"in r){let n=t(()=>crypto.subtle.importKey("raw",(new TextEncoder).encode(r.secret),{name:"HMAC",hash:{name:"SHA-384"}},!1,["sign","verify"]));return{async sign(t){let r=await crypto.subtle.sign({name:"HMAC",hash:{name:"SHA-384"}},await n(),(new TextEncoder).encode(t));return e.encode(new Uint8Array(r))},verify:async(t,r)=>crypto.subtle.verify({name:"HMAC",hash:{name:"SHA-384"}},await n(),new Uint8Array(e.decodeRaw(r)),(new TextEncoder).encode(t))}}{let n=t(async()=>{if("string"==typeof r.privateKey){let e=JSON.parse(r.privateKey);return await crypto.subtle.importKey("jwk",e,{name:"EC"==e.kty?"ECDSA":e.kty,namedCurve:e.crv},!0,["sign"])}return await r.privateKey()}),i=t(async()=>{if("string"==typeof r.publicKey){let e=JSON.parse(r.publicKey);return await crypto.subtle.importKey("jwk",JSON.parse(r.publicKey),{name:"EC"==e.kty?"ECDSA":e.kty,namedCurve:e.crv},!0,["verify"])}return await r.publicKey()});return{async sign(t){let r=await n(),i=await crypto.subtle.sign({name:r.algorithm.name,hash:{name:"SHA-384"}},r,(new TextEncoder).encode(t));return e.encode(new Uint8Array(i))},verify:async(t,r)=>crypto.subtle.verify({name:"ECDSA",hash:{name:"SHA-384"}},await i(),new Uint8Array(e.decodeRaw(r)),(new TextEncoder).encode(t))}}})(r)}async sign({type:t,data:r,expiresAt:n}){let i=`${t}_v1_${e.encode(JSON.stringify({d:r,e:null==n?void 0:n.getTime(),c:Date.now()}))}`;return`${i}_${await this.signer.sign(i)}`}async verify({token:t,expectedType:r}){let n=t.split("_");if(n.length<4)return{verified:!1};let i=n.pop(),a=n.pop(),s=n.pop(),c=n.join("_");if(c!=r)return{verified:!1};if("v1"!=s)return{verified:!1};let o=`${c}_${s}_${a}`;if(!await this.signer.verify(o,i))return{verified:!1};let y=JSON.parse(e.decode(a)),d=y.e?new Date(y.e):null;return d&&d<new Date?{verified:!1}:{verified:!0,type:c,expiresAt:d,createdAt:new Date(y.c),data:y.d}}static decode(t){let r=t.split("_");return r.length<4?null:JSON.parse(e.decode(r[r.length-2]))}}export{r as Tokens};
2
+ //# sourceMappingURL=index.modern.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.modern.js","sources":["../src/tokens.ts"],"sourcesContent":["import { base62 } from '@lowerdeck/base62';\nimport { memo } from '@lowerdeck/memo';\n\nexport type TokenKeys =\n | {\n privateKey: string | (() => Promise<CryptoKey> | CryptoKey);\n publicKey: string | (() => Promise<CryptoKey> | CryptoKey);\n }\n | {\n secret: string;\n };\n\ntype Signer = {\n sign: (data: string) => Promise<string>;\n verify: (data: string, signature: string) => Promise<boolean>;\n};\n\nlet getSigner = (keys: TokenKeys): Signer => {\n if ('secret' in keys) {\n let keyMemo = memo(() =>\n crypto.subtle.importKey(\n 'raw',\n new TextEncoder().encode(keys.secret),\n { name: 'HMAC', hash: { name: 'SHA-384' } },\n false,\n ['sign', 'verify']\n )\n );\n\n return {\n async sign(data) {\n let signature = await crypto.subtle.sign(\n { name: 'HMAC', hash: { name: 'SHA-384' } },\n await keyMemo(),\n new TextEncoder().encode(data)\n );\n\n return base62.encode(new Uint8Array(signature));\n },\n\n async verify(data, signature) {\n return crypto.subtle.verify(\n { name: 'HMAC', hash: { name: 'SHA-384' } },\n await keyMemo(),\n new Uint8Array(base62.decodeRaw(signature)),\n new TextEncoder().encode(data)\n );\n }\n };\n } else {\n let privateKeyMemo = memo(async () => {\n if (typeof keys.privateKey == 'string') {\n let data = JSON.parse(keys.privateKey) as any;\n\n return await crypto.subtle.importKey(\n 'jwk',\n data,\n { name: data.kty == 'EC' ? 'ECDSA' : data.kty, namedCurve: data.crv },\n true,\n ['sign']\n );\n } else {\n return (await keys.privateKey()) as CryptoKey;\n }\n });\n\n let publicKeyMemo = memo(async () => {\n if (typeof keys.publicKey == 'string') {\n let data = JSON.parse(keys.publicKey) as any;\n\n return await crypto.subtle.importKey(\n 'jwk',\n JSON.parse(keys.publicKey) as any,\n { name: data.kty == 'EC' ? 'ECDSA' : data.kty, namedCurve: data.crv },\n true,\n ['verify']\n );\n } else {\n return (await keys.publicKey()) as CryptoKey;\n }\n });\n\n return {\n async sign(data) {\n let key = await privateKeyMemo();\n\n let signature = await crypto.subtle.sign(\n { name: key.algorithm.name, hash: { name: 'SHA-384' } },\n key,\n new TextEncoder().encode(data)\n );\n\n return base62.encode(new Uint8Array(signature));\n },\n\n async verify(data, signature) {\n return crypto.subtle.verify(\n { name: 'ECDSA', hash: { name: 'SHA-384' } },\n await publicKeyMemo(),\n new Uint8Array(base62.decodeRaw(signature)),\n new TextEncoder().encode(data)\n );\n }\n };\n }\n};\n\nexport class Tokens {\n private signer: Signer;\n constructor(readonly keys: TokenKeys) {\n this.signer = getSigner(keys);\n }\n\n async sign({ type, data, expiresAt }: { type: string; data: any; expiresAt?: Date }) {\n let token = `${type}_v1_${base62.encode(\n JSON.stringify({\n d: data,\n e: expiresAt?.getTime(),\n c: Date.now()\n })\n )}`;\n\n let signature = await this.signer.sign(token);\n return `${token}_${signature}`;\n }\n\n async verify({ token, expectedType }: { expectedType: string; token: string }) {\n let parts = token.split('_');\n if (parts.length < 4) return { verified: false as const };\n\n let signatureBase62 = parts.pop()!;\n let dataBase62 = parts.pop()!;\n let version = parts.pop()!;\n let type = parts.join('_');\n if (type != expectedType) return { verified: false as const };\n\n if (version != 'v1') return { verified: false as const };\n\n let main = `${type}_${version}_${dataBase62}`;\n\n let verified = await this.signer.verify(main, signatureBase62);\n if (!verified) return { verified: false as const };\n\n let data = JSON.parse(base62.decode(dataBase62));\n let expiresAt = data.e ? new Date(data.e) : null;\n if (expiresAt && expiresAt < new Date()) return { verified: false as const };\n\n let createdAt = new Date(data.c);\n\n return {\n verified: true as const,\n\n type,\n expiresAt,\n createdAt,\n data: data.d\n };\n }\n\n static decode(token: string) {\n let parts = token.split('_');\n if (parts.length < 4) return null;\n\n let dataBase62 = parts[parts.length - 2];\n return JSON.parse(base62.decode(dataBase62));\n }\n}\n"],"names":["Tokens","constructor","keys","this","signer","keyMemo","memo","crypto","subtle","importKey","TextEncoder","encode","secret","name","hash","sign","data","signature","base62","Uint8Array","async","verify","decodeRaw","privateKeyMemo","privateKey","JSON","parse","kty","namedCurve","crv","publicKeyMemo","publicKey","key","algorithm","getSigner","type","expiresAt","token","stringify","d","e","getTime","c","Date","now","expectedType","parts","split","length","verified","signatureBase62","pop","dataBase62","version","join","main","decode","createdAt"],"mappings":"kFA2Ga,MAAAA,EAEXC,WAAAA,CAAqBC,GAAeC,KAAfD,UADbE,EAAAA,KAAAA,YACa,EAAAD,KAAID,KAAJA,EACnBC,KAAKC,OA7FQF,KACf,GAAI,WAAYA,EAAM,CACpB,IAAIG,EAAUC,EAAK,IACjBC,OAAOC,OAAOC,UACZ,OACA,IAAIC,aAAcC,OAAOT,EAAKU,QAC9B,CAAEC,KAAM,OAAQC,KAAM,CAAED,KAAM,aAC9B,EACA,CAAC,OAAQ,YAIb,MAAO,CACL,UAAME,CAAKC,GACT,IAAIC,QAAkBV,OAAOC,OAAOO,KAClC,CAAEF,KAAM,OAAQC,KAAM,CAAED,KAAM,kBACxBR,KACN,IAAIK,aAAcC,OAAOK,IAG3B,OAAOE,EAAOP,OAAO,IAAIQ,WAAWF,GACtC,EAEAG,OAAYC,MAACL,EAAMC,IACVV,OAAOC,OAAOa,OACnB,CAAER,KAAM,OAAQC,KAAM,CAAED,KAAM,kBACxBR,IACN,IAAIc,WAAWD,EAAOI,UAAUL,KAChC,IAAIP,aAAcC,OAAOK,IAIjC,CAAO,CACL,IAAIO,EAAiBjB,EAAKc,UACxB,GAA8B,iBAAnBlB,EAA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EA,EAAKQ,aAAEA,IACpB,IAAIC,EAAQT,EAAMU,MAAM,KACxB,GAAID,EAAME,OAAS,EAAG,MAAO,CAAEC,UAAU,GAEzC,IAAIC,EAAkBJ,EAAMK,MACxBC,EAAaN,EAAMK,MACnBE,EAAUP,EAAMK,MAChBhB,EAAOW,EAAMQ,KAAK,KACtB,GAAInB,GAAQU,EAAc,MAAO,CAAEI,UAAU,GAE7C,GAAe,MAAXI,EAAiB,MAAO,CAAEJ,UAAU,GAExC,IAAIM,EAAO,GAAGpB,KAAQkB,KAAWD,IAGjC,UADyBjD,KAACC,OAAOiB,OAAOkC,EAAML,GAC/B,MAAO,CAAED,UAAU,GAElC,IAAIjC,EAAOS,KAAKC,MAAMR,EAAOsC,OAAOJ,IAChChB,EAAYpB,EAAKwB,EAAI,IAAIG,KAAK3B,EAAKwB,GAAK,KAC5C,OAAIJ,GAAaA,EAAY,IAAIO,KAAe,CAAEM,UAAU,GAIrD,CACLA,UAAU,EAEVd,OACAC,YACAqB,UAPc,IAAId,KAAK3B,EAAK0B,GAQ5B1B,KAAMA,EAAKuB,EAEf,CAEA,aAAOiB,CAAOnB,GACZ,IAAIS,EAAQT,EAAMU,MAAM,KACxB,OAAID,EAAME,OAAS,EAAU,KAGtBvB,KAAKC,MAAMR,EAAOsC,OADRV,EAAMA,EAAME,OAAS,IAExC"}
@@ -0,0 +1,2 @@
1
+ export*from"@slates/provider";
2
+ //# sourceMappingURL=index.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.module.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@slates/provider")):"function"==typeof define&&define.amd?define(["exports","@slates/provider"],t):t((e||self).slates={},e.provider)}(this,function(e,t){Object.keys(t).forEach(function(o){"default"===o||e.hasOwnProperty(o)||Object.defineProperty(e,o,{enumerable:!0,get:function(){return t[o]}})})});
2
+ //# sourceMappingURL=index.umd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.umd.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export * from './specification';
2
+ export * from './zero';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/specification/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,31 @@
1
+ import z from 'zod';
2
+ import { ZeroAuth } from '../auth';
3
+ import { ZeroConfig } from '../config';
4
+ export interface ZeroSpecificationParameters {
5
+ key: string;
6
+ name: string;
7
+ description?: string;
8
+ metadata?: Record<string, any>;
9
+ }
10
+ export interface ZeroSpecificationCreateParameters<ConfigType extends {}, AuthType extends {}> extends ZeroSpecificationParameters {
11
+ config: ZeroConfig<ConfigType>;
12
+ auth: ZeroAuth<AuthType>;
13
+ }
14
+ export declare let getZeroCurrentSpecification: () => ZeroSpecification<any, any>;
15
+ export declare class ZeroSpecification<ConfigType extends {}, AuthType extends {}> {
16
+ private readonly _config;
17
+ private readonly _auth;
18
+ private readonly _params;
19
+ private constructor();
20
+ static create<ConfigType extends {}, AuthType extends {}>(params: ZeroSpecificationCreateParameters<ConfigType, AuthType>): ZeroSpecification<ConfigType, AuthType>;
21
+ get configSchema(): z.ZodType<ConfigType, unknown, z.core.$ZodTypeInternals<ConfigType, unknown>>;
22
+ get authSchema(): z.ZodType<AuthType>;
23
+ get config(): ZeroConfig<ConfigType>;
24
+ get auth(): ZeroAuth<AuthType>;
25
+ get parameters(): ZeroSpecificationParameters;
26
+ get key(): string;
27
+ get name(): string;
28
+ get description(): string | undefined;
29
+ }
30
+ export declare let spec: <ConfigType extends {}, AuthType extends {}>(params: ZeroSpecificationCreateParameters<ConfigType, AuthType>) => ZeroSpecification<ConfigType, AuthType>;
31
+ //# sourceMappingURL=specification.d.ts.map
@@ -0,0 +1 @@
1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ED,IAAI,WAAW,uBAEd;CACF;AAED,eAAO,IAAI,IAAI,GAAI,UAAU,SAAS,EAAE,EAAE,QAAQ,SAAS,EAAE,EAC3D,QAAQ,iCAAiC,CAAC,UAAU,EAAE,QAAQ,CAAC,KAC9D,iBAAiB,CAAC,UAAU,EAAE,QAAQ,CAAqC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { ZeroAction } from '../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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,34 @@
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
@@ -0,0 +1 @@
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"}
package/package.json CHANGED
@@ -1,25 +1,41 @@
1
1
  {
2
2
  "name": "slates",
3
- "version": "0.0.2",
4
- "description": "Slates coming soon.",
5
- "main": "index.js",
6
- "scripts": {
7
- "postinstall": "echo Slates is coming soon."
3
+ "version": "1.0.0-rc.2",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "author": "Tobias Herber",
8
+ "license": "Apache 2",
9
+ "type": "module",
10
+ "source": "src/index.ts",
11
+ "files": [
12
+ "src/**",
13
+ "dist/**",
14
+ "README.md",
15
+ "package.json"
16
+ ],
17
+ "exports": {
18
+ "types": "./dist/index.d.ts",
19
+ "require": "./dist/index.cjs",
20
+ "import": "./dist/index.module.js",
21
+ "default": "./dist/index.module.js"
8
22
  },
9
- "repository": {
10
- "type": "git",
11
- "url": "git+https://github.com/slateshq/slates.git"
23
+ "main": "./dist/index.cjs",
24
+ "module": "./dist/index.module.js",
25
+ "types": "dist/index.d.ts",
26
+ "unpkg": "./dist/index.umd.js",
27
+ "scripts": {
28
+ "test": "vitest run --passWithNoTests",
29
+ "lint": "prettier src/**/*.ts --check",
30
+ "build": "microbundle"
12
31
  },
13
- "keywords": [
14
- "slates"
15
- ],
16
- "bin": {
17
- "slates": "./bin/slates.js"
18
- },
19
- "author": "tobihrbr @ slates",
20
- "license": "MIT",
21
- "bugs": {
22
- "url": "https://github.com/slateshq/slates/issues"
32
+ "dependencies": {
33
+ "@slates/provider": "^1.0.0-rc.2"
23
34
  },
24
- "homepage": "https://github.com/slateshq/slates#readme"
25
- }
35
+ "devDependencies": {
36
+ "microbundle": "^0.15.1",
37
+ "@slates/tsconfig": "^1.0.0",
38
+ "typescript": "5.8.2",
39
+ "vitest": "^3.1.2"
40
+ }
41
+ }
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from '@slates/provider';
package/bin/slates.js DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /*
4
- slates is coming very soon
5
- follow @slateshq to be the first to know
6
- */
7
- console.log('\n', '\x1b[7m', '\x1b[105m', 'Slates is coming soon', '\x1b[0m');
8
- console.log(' \x1b[7m', '\x1b[105m', 'Slates.ml', '\x1b[0m');
package/readme.md DELETED
@@ -1,9 +0,0 @@
1
- # Slates
2
-
3
- Slates is coming very soon, stay tuned! 🍿
4
-
5
- [Slates](https://slates.ml)
6
-
7
- ```bash
8
- npm install -g slates
9
- ```