@dxos/functions 0.8.4-main.9be5663bfe → 0.8.4-main.abd8ff62ef

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 (96) hide show
  1. package/dist/lib/neutral/index.mjs +126 -917
  2. package/dist/lib/neutral/index.mjs.map +4 -4
  3. package/dist/lib/neutral/meta.json +1 -1
  4. package/dist/types/src/index.d.ts +0 -6
  5. package/dist/types/src/index.d.ts.map +1 -1
  6. package/dist/types/src/protocol/functions-ai-http-client.d.ts.map +1 -1
  7. package/dist/types/src/protocol/protocol.d.ts +1 -1
  8. package/dist/types/src/protocol/protocol.d.ts.map +1 -1
  9. package/dist/types/src/sdk.d.ts +3 -7
  10. package/dist/types/src/sdk.d.ts.map +1 -1
  11. package/dist/types/src/services/credentials.d.ts +15 -38
  12. package/dist/types/src/services/credentials.d.ts.map +1 -1
  13. package/dist/types/src/services/function-invocation-service.d.ts +3 -5
  14. package/dist/types/src/services/function-invocation-service.d.ts.map +1 -1
  15. package/dist/types/src/services/index.d.ts +1 -4
  16. package/dist/types/src/services/index.d.ts.map +1 -1
  17. package/dist/types/src/services/queues.d.ts +1 -49
  18. package/dist/types/src/services/queues.d.ts.map +1 -1
  19. package/dist/types/src/services/tracing.d.ts +1 -107
  20. package/dist/types/src/services/tracing.d.ts.map +1 -1
  21. package/dist/types/src/types/index.d.ts +0 -3
  22. package/dist/types/src/types/index.d.ts.map +1 -1
  23. package/dist/types/src/types/url.d.ts +1 -1
  24. package/dist/types/src/types/url.d.ts.map +1 -1
  25. package/dist/types/tsconfig.tsbuildinfo +1 -1
  26. package/package.json +15 -20
  27. package/src/index.ts +0 -6
  28. package/src/protocol/protocol.test.ts +10 -10
  29. package/src/protocol/protocol.ts +37 -12
  30. package/src/sdk.ts +5 -15
  31. package/src/services/credentials.ts +75 -118
  32. package/src/services/function-invocation-service.ts +3 -9
  33. package/src/services/index.ts +1 -4
  34. package/src/services/queues.ts +1 -87
  35. package/src/services/tracing.ts +0 -192
  36. package/src/types/index.ts +0 -3
  37. package/src/types/url.ts +1 -1
  38. package/dist/lib/neutral/Trace.mjs +0 -38
  39. package/dist/lib/neutral/Trace.mjs.map +0 -7
  40. package/dist/lib/neutral/chunk-5T7GOX2V.mjs +0 -149
  41. package/dist/lib/neutral/chunk-5T7GOX2V.mjs.map +0 -7
  42. package/dist/lib/neutral/chunk-IVDUS56O.mjs +0 -49
  43. package/dist/lib/neutral/chunk-IVDUS56O.mjs.map +0 -7
  44. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +0 -10
  45. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +0 -7
  46. package/dist/lib/neutral/fib-N45KAC7C.mjs +0 -23
  47. package/dist/lib/neutral/fib-N45KAC7C.mjs.map +0 -7
  48. package/dist/lib/neutral/reply-EUEPKNJF.mjs +0 -19
  49. package/dist/lib/neutral/reply-EUEPKNJF.mjs.map +0 -7
  50. package/dist/lib/neutral/sleep-PUK3D4FF.mjs +0 -15
  51. package/dist/lib/neutral/sleep-PUK3D4FF.mjs.map +0 -7
  52. package/dist/types/src/Trace.d.ts +0 -155
  53. package/dist/types/src/Trace.d.ts.map +0 -1
  54. package/dist/types/src/errors.d.ts +0 -121
  55. package/dist/types/src/errors.d.ts.map +0 -1
  56. package/dist/types/src/example/definitions.d.ts +0 -11
  57. package/dist/types/src/example/definitions.d.ts.map +0 -1
  58. package/dist/types/src/example/fib.d.ts +0 -8
  59. package/dist/types/src/example/fib.d.ts.map +0 -1
  60. package/dist/types/src/example/forex-effect.d.ts +0 -3
  61. package/dist/types/src/example/forex-effect.d.ts.map +0 -1
  62. package/dist/types/src/example/index.d.ts +0 -4
  63. package/dist/types/src/example/index.d.ts.map +0 -1
  64. package/dist/types/src/example/reply.d.ts +0 -4
  65. package/dist/types/src/example/reply.d.ts.map +0 -1
  66. package/dist/types/src/example/sleep.d.ts +0 -6
  67. package/dist/types/src/example/sleep.d.ts.map +0 -1
  68. package/dist/types/src/process/Process.d.ts +0 -247
  69. package/dist/types/src/process/Process.d.ts.map +0 -1
  70. package/dist/types/src/process/ServiceResolver.d.ts +0 -74
  71. package/dist/types/src/process/ServiceResolver.d.ts.map +0 -1
  72. package/dist/types/src/process/StorageService.d.ts +0 -58
  73. package/dist/types/src/process/StorageService.d.ts.map +0 -1
  74. package/dist/types/src/services/event-logger.d.ts +0 -81
  75. package/dist/types/src/services/event-logger.d.ts.map +0 -1
  76. package/dist/types/src/types/Script.d.ts +0 -22
  77. package/dist/types/src/types/Script.d.ts.map +0 -1
  78. package/dist/types/src/types/Trigger.d.ts +0 -120
  79. package/dist/types/src/types/Trigger.d.ts.map +0 -1
  80. package/dist/types/src/types/TriggerEvent.d.ts +0 -75
  81. package/dist/types/src/types/TriggerEvent.d.ts.map +0 -1
  82. package/src/Trace.ts +0 -202
  83. package/src/errors.ts +0 -21
  84. package/src/example/definitions.ts +0 -49
  85. package/src/example/fib.ts +0 -23
  86. package/src/example/forex-effect.ts +0 -40
  87. package/src/example/index.ts +0 -12
  88. package/src/example/reply.ts +0 -19
  89. package/src/example/sleep.ts +0 -17
  90. package/src/process/Process.ts +0 -486
  91. package/src/process/ServiceResolver.ts +0 -174
  92. package/src/process/StorageService.ts +0 -99
  93. package/src/services/event-logger.ts +0 -127
  94. package/src/types/Script.ts +0 -38
  95. package/src/types/Trigger.ts +0 -154
  96. package/src/types/TriggerEvent.ts +0 -62
@@ -1,99 +0,0 @@
1
- //
2
- // Copyright 2026 DXOS.org
3
- //
4
-
5
- import * as Context from 'effect/Context';
6
- import * as Effect from 'effect/Effect';
7
- import * as Option from 'effect/Option';
8
- import * as Pipeable from 'effect/Pipeable';
9
- import * as Schema from 'effect/Schema';
10
-
11
- export interface Service {
12
- /** Read a value by key. Returns `None` if key does not exist. */
13
- get<S extends Schema.Schema<any, string, any>>(
14
- schema: S,
15
- key: string,
16
- ): Effect.Effect<Option.Option<Schema.Schema.Type<S>>, never, Schema.Schema.Context<S>>;
17
-
18
- /** Write a value for the given key. */
19
- set<S extends Schema.Schema<any, string, any>>(
20
- schema: S,
21
- key: string,
22
- value: Schema.Schema.Type<S>,
23
- ): Effect.Effect<void, never, Schema.Schema.Context<S>>;
24
-
25
- /** Remove a key. */
26
- delete(key: string): Effect.Effect<void>;
27
-
28
- /** List all keys, optionally filtered by prefix. */
29
- list(prefix?: string): Effect.Effect<readonly string[]>;
30
-
31
- /** Remove all keys managed by this scoped store. */
32
- clear(): Effect.Effect<void>;
33
- }
34
-
35
- /**
36
- * Scoped key-value storage service for processes.
37
- * Each process receives its own namespaced instance via the process manager.
38
- * Construct a live implementation with `StorageService.layer` from `@dxos/functions-runtime`.
39
- */
40
- export class StorageService extends Context.Tag('@dxos/functions/StorageService')<StorageService, Service>() {}
41
-
42
- export const get = Effect.serviceFunctionEffect(StorageService, (_) => _.get);
43
- export const set = Effect.serviceFunctionEffect(StorageService, (_) => _.set);
44
- export const deleteKey = Effect.serviceFunctionEffect(StorageService, (_) => _.delete);
45
- export const list = Effect.serviceFunctionEffect(StorageService, (_) => _.list);
46
- export const clear = Effect.serviceFunctionEffect(StorageService, (_) => _.clear);
47
-
48
- /**
49
- * Typed key in a storage service.
50
- */
51
- export interface Key<T> extends Pipeable.Pipeable {
52
- readonly key: string;
53
-
54
- get: Effect.Effect<Option.Option<T>, never, StorageService>;
55
- set(value: T): Effect.Effect<void, never, StorageService>;
56
- delete(): Effect.Effect<void, never, StorageService>;
57
- }
58
-
59
- /**
60
- * Create a typed key in a storage service.
61
- */
62
- export const key = <S extends Schema.Schema<any, string, any>>(schema: S, key: string): Key<Schema.Schema.Type<S>> => {
63
- return {
64
- key,
65
- get: get(schema, key),
66
- set: (value: Schema.Schema.Type<S>) => set(schema, key, value),
67
- delete: () => deleteKey(key),
68
- pipe(...args: any) {
69
- return Pipeable.pipeArguments(this, arguments);
70
- },
71
- };
72
- };
73
-
74
- /**
75
- * Typed key in a storage service with a default value.
76
- */
77
- export interface KeyWithDefault<T, U> extends Pipeable.Pipeable {
78
- readonly key: string;
79
- get: Effect.Effect<T | U, never, StorageService>;
80
- set(value: U): Effect.Effect<void, never, StorageService>;
81
- delete(): Effect.Effect<void, never, StorageService>;
82
- }
83
-
84
- /**
85
- * Assign a default value to a key if it is not present.
86
- */
87
- export const withDefault =
88
- <T>(getDefault: () => NoInfer<T>) =>
89
- (key: Key<T>): KeyWithDefault<T, T> => {
90
- return {
91
- key: key.key,
92
- get: key.get.pipe(Effect.map(Option.getOrElse(() => getDefault()))),
93
- set: (value) => key.set(value),
94
- delete: () => key.delete(),
95
- pipe(...args: any) {
96
- return Pipeable.pipeArguments(this, arguments);
97
- },
98
- };
99
- };
@@ -1,127 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import * as Context from 'effect/Context';
6
- import * as Effect from 'effect/Effect';
7
- import * as Layer from 'effect/Layer';
8
- import * as Schema from 'effect/Schema';
9
-
10
- import { Obj, Type } from '@dxos/echo';
11
- import { invariant } from '@dxos/invariant';
12
- import { LogLevel, log } from '@dxos/log';
13
-
14
- import { TracingService } from './tracing';
15
-
16
- export const ComputeEventPayload = Schema.Union(
17
- Schema.Struct({
18
- type: Schema.Literal('begin-compute'),
19
- nodeId: Schema.String,
20
- /**
21
- * Names of the inputs begin computed.
22
- */
23
- inputs: Schema.Array(Schema.String),
24
- }),
25
- Schema.Struct({
26
- type: Schema.Literal('end-compute'),
27
- nodeId: Schema.String,
28
- /**
29
- * Names of the outputs computed.
30
- */
31
- outputs: Schema.Array(Schema.String),
32
- }),
33
- Schema.Struct({
34
- type: Schema.Literal('compute-input'),
35
- nodeId: Schema.String,
36
- property: Schema.String,
37
- value: Schema.Any,
38
- }),
39
- Schema.Struct({
40
- type: Schema.Literal('compute-output'),
41
- nodeId: Schema.String,
42
- property: Schema.String,
43
- value: Schema.Any,
44
- }),
45
- Schema.Struct({
46
- type: Schema.Literal('custom'),
47
- nodeId: Schema.String,
48
- event: Schema.Any,
49
- }),
50
- );
51
- export type ComputeEventPayload = Schema.Schema.Type<typeof ComputeEventPayload>;
52
-
53
- export const ComputeEvent = Schema.Struct({
54
- payload: ComputeEventPayload,
55
- }).pipe(Type.object({ typename: 'org.dxos.type.computeEvent', version: '0.1.0' }));
56
-
57
- /**
58
- * Logs event for the compute workflows.
59
- */
60
- export class ComputeEventLogger extends Context.Tag('@dxos/functions/ComputeEventLogger')<
61
- ComputeEventLogger,
62
- { readonly log: (event: ComputeEventPayload) => void; readonly nodeId: string | undefined }
63
- >() {
64
- static noop: Context.Tag.Service<ComputeEventLogger> = {
65
- log: () => {},
66
- nodeId: undefined,
67
- };
68
-
69
- /**
70
- * Implements ComputeEventLogger using TracingService.
71
- */
72
- static layerFromTracing = Layer.effect(
73
- ComputeEventLogger,
74
- Effect.gen(function* () {
75
- const tracing = yield* TracingService;
76
- return {
77
- log: (event: ComputeEventPayload) => {
78
- tracing.write(Obj.make(ComputeEvent, { payload: event }), tracing.getTraceContext());
79
- },
80
- nodeId: undefined,
81
- };
82
- }),
83
- );
84
- }
85
-
86
- export const logCustomEvent = (data: any) =>
87
- Effect.gen(function* () {
88
- const logger = yield* ComputeEventLogger;
89
- if (!logger.nodeId) {
90
- throw new Error('logCustomEvent must be called within a node compute function');
91
- }
92
- logger.log({
93
- type: 'custom',
94
- nodeId: logger.nodeId,
95
- event: data,
96
- });
97
- });
98
-
99
- export const createDefectLogger = <A, E, R>(): ((self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>) =>
100
- Effect.catchAll((error) =>
101
- Effect.gen(function* () {
102
- log.error('unhandled effect error', { error });
103
- throw error;
104
- }),
105
- );
106
-
107
- export const createEventLogger = (
108
- level: LogLevel,
109
- message: string = 'event',
110
- ): Context.Tag.Service<ComputeEventLogger> => {
111
- const logFunction = (
112
- {
113
- [LogLevel.WARN]: log.warn,
114
- [LogLevel.VERBOSE]: log.verbose,
115
- [LogLevel.DEBUG]: log.debug,
116
- [LogLevel.INFO]: log.info,
117
- [LogLevel.ERROR]: log.error,
118
- } as any
119
- )[level];
120
- invariant(logFunction);
121
- return {
122
- log: (event: ComputeEventPayload) => {
123
- logFunction(message, event);
124
- },
125
- nodeId: undefined,
126
- };
127
- };
@@ -1,38 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import * as Schema from 'effect/Schema';
6
-
7
- import { Annotation, Obj, Ref, Type } from '@dxos/echo';
8
- import { FormInputAnnotation } from '@dxos/echo/internal';
9
- import { Text } from '@dxos/schema';
10
-
11
- /**
12
- * Source script.
13
- */
14
- export const Script = Schema.Struct({
15
- name: Schema.String.pipe(Schema.optional),
16
- description: Schema.String.pipe(Schema.optional),
17
- // TODO(burdon): Change to hash of deployed content.
18
- // Whether source has changed since last deploy.
19
- changed: Schema.Boolean.pipe(FormInputAnnotation.set(false), Schema.optional),
20
- source: Ref.Ref(Text.Text).pipe(FormInputAnnotation.set(false)),
21
- }).pipe(
22
- Type.object({
23
- typename: 'org.dxos.type.script',
24
- version: '0.1.0',
25
- }),
26
- Annotation.LabelAnnotation.set(['name']),
27
- Annotation.IconAnnotation.set({
28
- icon: 'ph--code--regular',
29
- hue: 'sky',
30
- }),
31
- );
32
-
33
- export interface Script extends Schema.Schema.Type<typeof Script> {}
34
-
35
- type Props = Omit<Obj.MakeProps<typeof Script>, 'source'> & { source?: string };
36
-
37
- export const make = ({ source = '', ...props }: Props = {}): Script =>
38
- Obj.make(Script, { ...props, source: Ref.make(Text.make({ content: source })) });
@@ -1,154 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- import * as Schema from 'effect/Schema';
6
- import * as SchemaAST from 'effect/SchemaAST';
7
-
8
- import { Annotation, Obj, QueryAST, Ref, Type } from '@dxos/echo';
9
- import { OptionsAnnotationId, SystemTypeAnnotation } from '@dxos/echo/internal';
10
- import { DXN } from '@dxos/keys';
11
-
12
- /**
13
- * Type discriminator for TriggerType.
14
- * Every spec has a type field of type TriggerKind that we can use to understand which type we're working with.
15
- * https://www.typescriptlang.org/docs/handbook/2/narrowing.html#discriminated-unions
16
- */
17
- export const Kinds = ['email', 'queue', 'subscription', 'timer', 'webhook'] as const;
18
- export type Kind = (typeof Kinds)[number];
19
-
20
- const kindLiteralAnnotations = { title: 'Kind' };
21
-
22
- export const EmailSpec = Schema.Struct({
23
- kind: Schema.Literal('email').annotations(kindLiteralAnnotations),
24
- });
25
- export type EmailSpec = Schema.Schema.Type<typeof EmailSpec>;
26
-
27
- // TODO(burdon): Change to Feed.
28
- // TODO(wittjosiah): Remove. Migrate to Subscription triggers once EDGE supports them for feed queries.
29
- export const QueueSpec = Schema.Struct({
30
- kind: Schema.Literal('queue').annotations(kindLiteralAnnotations),
31
-
32
- // TODO(dmaretskyi): Rename to `feed` and change to a reference.
33
- queue: DXN.Schema,
34
- });
35
- export type QueueSpec = Schema.Schema.Type<typeof QueueSpec>;
36
-
37
- /**
38
- * Subscription.
39
- */
40
- export const SubscriptionSpec = Schema.Struct({
41
- kind: Schema.Literal('subscription').annotations(kindLiteralAnnotations),
42
- query: Schema.Struct({
43
- raw: Schema.optional(Schema.String.annotations({ title: 'Query' })),
44
- ast: QueryAST.Query,
45
- }),
46
- options: Schema.optional(
47
- Schema.Struct({
48
- // Watch changes to object (not just creation).
49
- deep: Schema.optional(Schema.Boolean.annotations({ title: 'Nested' })),
50
- // Debounce changes (delay in ms).
51
- delay: Schema.optional(Schema.Number.annotations({ title: 'Delay' })),
52
- }).annotations({ title: 'Options' }),
53
- ),
54
- });
55
- export type SubscriptionSpec = Schema.Schema.Type<typeof SubscriptionSpec>;
56
-
57
- /**
58
- * Cron timer.
59
- */
60
- export const TimerSpec = Schema.Struct({
61
- kind: Schema.Literal('timer').annotations(kindLiteralAnnotations),
62
- cron: Schema.String.annotations({
63
- title: 'Cron',
64
- [SchemaAST.ExamplesAnnotationId]: ['0 0 * * *'],
65
- }),
66
- });
67
- export type TimerSpec = Schema.Schema.Type<typeof TimerSpec>;
68
-
69
- /**
70
- * Webhook.
71
- */
72
- export const WebhookSpec = Schema.Struct({
73
- kind: Schema.Literal('webhook').annotations(kindLiteralAnnotations),
74
- method: Schema.optional(
75
- Schema.String.annotations({
76
- title: 'Method',
77
- [OptionsAnnotationId]: ['GET', 'POST'],
78
- }),
79
- ),
80
- port: Schema.optional(
81
- Schema.Number.annotations({
82
- title: 'Port',
83
- }),
84
- ),
85
- });
86
- export type WebhookSpec = Schema.Schema.Type<typeof WebhookSpec>;
87
-
88
- /**
89
- * Trigger schema.
90
- */
91
- export const Spec = Schema.Union(EmailSpec, QueueSpec, SubscriptionSpec, TimerSpec, WebhookSpec).annotations({
92
- title: 'Trigger',
93
- });
94
- export type Spec = Schema.Schema.Type<typeof Spec>;
95
-
96
- /**
97
- * Function trigger.
98
- * Function is invoked with the `payload` passed as input data.
99
- * The event that triggers the function is available in the function context.
100
- */
101
- const TriggerSchema = Schema.Struct({
102
- /**
103
- * Function or workflow to invoke.
104
- */
105
- // TODO(dmaretskyi): Can be a Ref(FunctionType) or Ref(ComputeGraphType).
106
- function: Schema.optional(Ref.Ref(Obj.Unknown).annotations({ title: 'Function' })),
107
-
108
- /**
109
- * Only used for workflowSchema.
110
- * Specifies the input node in the circuit.
111
- * @deprecated Remove and enforce a single input node in all compute graphSchema.
112
- */
113
- inputNodeId: Schema.optional(Schema.String.annotations({ title: 'Input Node ID' })),
114
-
115
- // TODO(burdon): NO BOOLEAN PROPERTIES (enabld/disabled/paused, etc.)
116
- // Need lint rule; or agent rule to require PR review for "boolean" key word.
117
- enabled: Schema.optional(Schema.Boolean.annotations({ title: 'Enabled' })),
118
-
119
- spec: Schema.optional(Spec),
120
-
121
- concurrency: Schema.optional(
122
- Schema.Number.annotations({
123
- title: 'Concurrency',
124
- default: 1,
125
- description:
126
- 'Maximum number of concurrent invocations of the trigger. For Feed triggers, this will process Feed items in parallel.',
127
- }),
128
- ),
129
-
130
- /**
131
- * Passed as the input data to the function.
132
- * Must match the function's input schema.
133
- *
134
- * @example
135
- * {
136
- * item: '{{event.item}}',
137
- * instructions: 'Summarize and perform entity-extraction'
138
- * mailbox: { '/': 'dxn:echo:AAA:ZZZ' }
139
- * }
140
- */
141
- input: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),
142
- }).pipe(
143
- Type.object({
144
- typename: 'org.dxos.type.trigger',
145
- version: '0.1.0',
146
- }),
147
- Annotation.IconAnnotation.set({ icon: 'ph--lightning--regular', hue: 'yellow' }),
148
- SystemTypeAnnotation.set(true),
149
- );
150
-
151
- export interface Trigger extends Schema.Schema.Type<typeof TriggerSchema> {}
152
- export const Trigger: Type.Obj<Trigger> = TriggerSchema as any;
153
-
154
- export const make = (props: Obj.MakeProps<typeof Trigger>) => Obj.make(Trigger, props);
@@ -1,62 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import * as Schema from 'effect/Schema';
6
-
7
- import { DXN, Obj, Ref } from '@dxos/echo';
8
-
9
- // TODO(wittjosiah): Review this type.
10
- // - Should be discriminated union.
11
- // - Should be more consistent (e.g. subject vs item).
12
- // - Should re-use schemas if possible.
13
-
14
- // TODO(burdon): Reuse trigger schema from @dxos/functions (TriggerType).
15
- export const EmailEvent = Schema.Struct({
16
- from: Schema.String,
17
- to: Schema.String,
18
- subject: Schema.String,
19
- created: Schema.String,
20
- body: Schema.String,
21
- });
22
- export type EmailEvent = Schema.Schema.Type<typeof EmailEvent>;
23
-
24
- export const QueueEvent = Schema.Struct({
25
- queue: DXN.Schema,
26
- item: Schema.Any,
27
- cursor: Schema.String,
28
- });
29
- export type QueueEvent = Schema.Schema.Type<typeof QueueEvent>;
30
-
31
- export const SubscriptionEvent = Schema.Struct({
32
- /**
33
- * Type of the mutation.
34
- */
35
- // TODO(dmaretskyi): Specify enum.
36
- type: Schema.String,
37
-
38
- /**
39
- * Reference to the object that was changed or created.
40
- */
41
- subject: Ref.Ref(Obj.Unknown),
42
-
43
- /**
44
- * @deprecated
45
- */
46
- changedObjectId: Schema.optional(Schema.String),
47
- });
48
- export type SubscriptionEvent = Schema.Schema.Type<typeof SubscriptionEvent>;
49
-
50
- export const TimerEvent = Schema.Struct({ tick: Schema.Number });
51
- export type TimerEvent = Schema.Schema.Type<typeof TimerEvent>;
52
-
53
- export const WebhookEvent = Schema.Struct({
54
- url: Schema.String,
55
- method: Schema.Literal('GET', 'POST'),
56
- headers: Schema.Record({ key: Schema.String, value: Schema.String }),
57
- bodyText: Schema.String,
58
- });
59
- export type WebhookEvent = Schema.Schema.Type<typeof WebhookEvent>;
60
-
61
- export const TriggerEvent = Schema.Union(EmailEvent, QueueEvent, SubscriptionEvent, TimerEvent, WebhookEvent);
62
- export type TriggerEvent = Schema.Schema.Type<typeof TriggerEvent>;