@dxos/functions 0.8.2-main.2f9c567 → 0.8.2-main.36232bc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/bundler/index.mjs +3 -0
- package/dist/lib/browser/bundler/index.mjs.map +1 -1
- package/dist/lib/browser/chunk-2YE6S7XY.mjs +360 -0
- package/dist/lib/browser/chunk-2YE6S7XY.mjs.map +7 -0
- package/dist/lib/browser/chunk-7CHDHCV3.mjs +482 -0
- package/dist/lib/browser/chunk-7CHDHCV3.mjs.map +7 -0
- package/dist/lib/browser/chunk-LT4LR4VU.mjs +72 -0
- package/dist/lib/browser/chunk-LT4LR4VU.mjs.map +7 -0
- package/dist/lib/browser/chunk-XRCXIG74.mjs +12 -0
- package/dist/lib/browser/chunk-XRCXIG74.mjs.map +7 -0
- package/dist/lib/browser/edge/index.mjs +7 -63
- package/dist/lib/browser/edge/index.mjs.map +4 -4
- package/dist/lib/browser/index.mjs +99 -367
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +670 -0
- package/dist/lib/browser/testing/index.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +51 -0
- package/dist/lib/browser/types/index.mjs.map +7 -0
- package/dist/lib/node/bundler/index.cjs +1 -0
- package/dist/lib/node/bundler/index.cjs.map +1 -1
- package/dist/lib/node/chunk-FBIUZ7SD.cjs +496 -0
- package/dist/lib/node/chunk-FBIUZ7SD.cjs.map +7 -0
- package/dist/lib/node/chunk-JEQ2X3Z6.cjs +34 -0
- package/dist/lib/node/chunk-JEQ2X3Z6.cjs.map +7 -0
- package/dist/lib/node/chunk-NXZNXVT3.cjs +94 -0
- package/dist/lib/node/chunk-NXZNXVT3.cjs.map +7 -0
- package/dist/lib/node/chunk-SV5NRE5L.cjs +395 -0
- package/dist/lib/node/chunk-SV5NRE5L.cjs.map +7 -0
- package/dist/lib/node/edge/index.cjs +5 -65
- package/dist/lib/node/edge/index.cjs.map +4 -4
- package/dist/lib/node/index.cjs +94 -382
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +687 -0
- package/dist/lib/node/testing/index.cjs.map +7 -0
- package/dist/lib/node/types/index.cjs +72 -0
- package/dist/lib/node/types/index.cjs.map +7 -0
- package/dist/lib/node-esm/bundler/index.mjs +1 -0
- package/dist/lib/node-esm/bundler/index.mjs.map +1 -1
- package/dist/lib/node-esm/chunk-3XMJFSID.mjs +360 -0
- package/dist/lib/node-esm/chunk-3XMJFSID.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-C6YINTWG.mjs +482 -0
- package/dist/lib/node-esm/chunk-C6YINTWG.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-DHGBFXSZ.mjs +12 -0
- package/dist/lib/node-esm/chunk-DHGBFXSZ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-O2SXVYU5.mjs +72 -0
- package/dist/lib/node-esm/chunk-O2SXVYU5.mjs.map +7 -0
- package/dist/lib/node-esm/edge/index.mjs +6 -64
- package/dist/lib/node-esm/edge/index.mjs.map +4 -4
- package/dist/lib/node-esm/index.mjs +97 -367
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +670 -0
- package/dist/lib/node-esm/testing/index.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +51 -0
- package/dist/lib/node-esm/types/index.mjs.map +7 -0
- package/dist/types/src/browser/index.d.ts +2 -0
- package/dist/types/src/browser/index.d.ts.map +1 -0
- package/dist/types/src/edge/index.d.ts.map +1 -1
- package/dist/types/src/function/function-registry.d.ts +25 -0
- package/dist/types/src/function/function-registry.d.ts.map +1 -0
- package/dist/types/src/function/function-registry.test.d.ts +2 -0
- package/dist/types/src/function/function-registry.test.d.ts.map +1 -0
- package/dist/types/src/function/index.d.ts +2 -0
- package/dist/types/src/function/index.d.ts.map +1 -0
- package/dist/types/src/handler.d.ts +61 -12
- package/dist/types/src/handler.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +3 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/runtime/dev-server.d.ts +52 -0
- package/dist/types/src/runtime/dev-server.d.ts.map +1 -0
- package/dist/types/src/runtime/dev-server.test.d.ts +2 -0
- package/dist/types/src/runtime/dev-server.test.d.ts.map +1 -0
- package/dist/types/src/runtime/index.d.ts +3 -0
- package/dist/types/src/runtime/index.d.ts.map +1 -0
- package/dist/types/src/runtime/scheduler.d.ts +34 -0
- package/dist/types/src/runtime/scheduler.d.ts.map +1 -0
- package/dist/types/src/runtime/scheduler.test.d.ts +2 -0
- package/dist/types/src/runtime/scheduler.test.d.ts.map +1 -0
- package/dist/types/src/testing/functions-integration.test.d.ts +2 -0
- package/dist/types/src/testing/functions-integration.test.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +5 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/testing/manifest.d.ts +3 -0
- package/dist/types/src/testing/manifest.d.ts.map +1 -0
- package/dist/types/src/testing/plugin-init.d.ts +6 -0
- package/dist/types/src/testing/plugin-init.d.ts.map +1 -0
- package/dist/types/src/testing/setup.d.ts +15 -0
- package/dist/types/src/testing/setup.d.ts.map +1 -0
- package/dist/types/src/testing/test/handler.d.ts +4 -0
- package/dist/types/src/testing/test/handler.d.ts.map +1 -0
- package/dist/types/src/testing/test/index.d.ts +3 -0
- package/dist/types/src/testing/test/index.d.ts.map +1 -0
- package/dist/types/src/testing/types.d.ts +10 -0
- package/dist/types/src/testing/types.d.ts.map +1 -0
- package/dist/types/src/testing/util.d.ts +5 -0
- package/dist/types/src/testing/util.d.ts.map +1 -0
- package/dist/types/src/trigger/index.d.ts +3 -0
- package/dist/types/src/trigger/index.d.ts.map +1 -0
- package/dist/types/src/trigger/trigger-registry.d.ts +38 -0
- package/dist/types/src/trigger/trigger-registry.d.ts.map +1 -0
- package/dist/types/src/trigger/trigger-registry.test.d.ts +2 -0
- package/dist/types/src/trigger/trigger-registry.test.d.ts.map +1 -0
- package/dist/types/src/trigger/type/index.d.ts +3 -0
- package/dist/types/src/trigger/type/index.d.ts.map +1 -0
- package/dist/types/src/trigger/type/subscription-trigger.d.ts +4 -0
- package/dist/types/src/trigger/type/subscription-trigger.d.ts.map +1 -0
- package/dist/types/src/trigger/type/timer-trigger.d.ts +4 -0
- package/dist/types/src/trigger/type/timer-trigger.d.ts.map +1 -0
- package/dist/types/src/trigger/type/webhook-trigger.d.ts +4 -0
- package/dist/types/src/trigger/type/webhook-trigger.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +5 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/types/schema.d.ts +53 -0
- package/dist/types/src/types/schema.d.ts.map +1 -0
- package/dist/types/src/types/trace.d.ts +146 -0
- package/dist/types/src/types/trace.d.ts.map +1 -0
- package/dist/types/src/{types.d.ts → types/types.d.ts} +49 -191
- package/dist/types/src/types/types.d.ts.map +1 -0
- package/dist/types/src/types/url.d.ts.map +1 -0
- package/dist/types/tools/schema.d.ts +2 -0
- package/dist/types/tools/schema.d.ts.map +1 -0
- package/package.json +36 -20
- package/schema/functions.json +211 -0
- package/src/browser/index.ts +5 -0
- package/src/edge/index.ts +0 -4
- package/src/function/function-registry.test.ts +118 -0
- package/src/function/function-registry.ts +104 -0
- package/src/function/index.ts +5 -0
- package/src/handler.ts +118 -14
- package/src/index.ts +5 -4
- package/src/runtime/dev-server.test.ts +79 -0
- package/src/runtime/dev-server.ts +240 -0
- package/src/runtime/index.ts +6 -0
- package/src/runtime/scheduler.test.ts +152 -0
- package/src/runtime/scheduler.ts +170 -0
- package/src/testing/functions-integration.test.ts +65 -0
- package/src/testing/index.ts +8 -0
- package/src/testing/manifest.ts +15 -0
- package/src/testing/plugin-init.ts +20 -0
- package/src/testing/setup.ts +109 -0
- package/src/testing/test/handler.ts +15 -0
- package/src/testing/test/index.ts +7 -0
- package/src/testing/types.ts +9 -0
- package/src/testing/util.ts +26 -0
- package/src/translations.ts +1 -1
- package/src/trigger/index.ts +6 -0
- package/src/trigger/trigger-registry.test.ts +278 -0
- package/src/trigger/trigger-registry.ts +218 -0
- package/src/trigger/type/index.ts +7 -0
- package/src/trigger/type/subscription-trigger.ts +84 -0
- package/src/trigger/type/timer-trigger.ts +48 -0
- package/src/trigger/type/webhook-trigger.ts +48 -0
- package/src/types/index.ts +8 -0
- package/src/types/schema.ts +46 -0
- package/src/{trace.ts → types/trace.ts} +31 -33
- package/src/types/types.ts +163 -0
- package/dist/types/src/schema.d.ts +0 -57
- package/dist/types/src/schema.d.ts.map +0 -1
- package/dist/types/src/trace.d.ts +0 -148
- package/dist/types/src/trace.d.ts.map +0 -1
- package/dist/types/src/types.d.ts.map +0 -1
- package/dist/types/src/url.d.ts.map +0 -1
- package/src/schema.ts +0 -53
- package/src/types.ts +0 -214
- /package/dist/types/src/{url.d.ts → types/url.d.ts} +0 -0
- /package/src/{url.ts → types/url.ts} +0 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { EchoObject, JsonSchemaType, LabelAnnotationId, Ref, S, TypedObject } from '@dxos/echo-schema';
|
|
6
|
+
import { TextType } from '@dxos/schema';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Source script.
|
|
10
|
+
*/
|
|
11
|
+
export const ScriptType = S.Struct({
|
|
12
|
+
name: S.optional(S.String),
|
|
13
|
+
description: S.optional(S.String),
|
|
14
|
+
// TODO(burdon): Change to hash of deployed content.
|
|
15
|
+
// Whether source has changed since last deploy.
|
|
16
|
+
changed: S.optional(S.Boolean),
|
|
17
|
+
source: Ref(TextType),
|
|
18
|
+
})
|
|
19
|
+
.annotations({ [LabelAnnotationId]: 'name' })
|
|
20
|
+
.pipe(EchoObject({ typename: 'dxos.org/type/Script', version: '0.1.0' }));
|
|
21
|
+
|
|
22
|
+
export type ScriptType = S.Schema.Type<typeof ScriptType>;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Function deployment.
|
|
26
|
+
*/
|
|
27
|
+
export class FunctionType extends TypedObject({
|
|
28
|
+
typename: 'dxos.org/type/Function',
|
|
29
|
+
version: '0.1.0',
|
|
30
|
+
})({
|
|
31
|
+
// TODO(burdon): Rename to id/uri?
|
|
32
|
+
name: S.NonEmptyString,
|
|
33
|
+
version: S.String,
|
|
34
|
+
|
|
35
|
+
description: S.optional(S.String),
|
|
36
|
+
|
|
37
|
+
// Reference to a source script if it exists within ECHO.
|
|
38
|
+
// TODO(burdon): Don't ref ScriptType directly (core).
|
|
39
|
+
source: S.optional(Ref(ScriptType)),
|
|
40
|
+
|
|
41
|
+
inputSchema: S.optional(JsonSchemaType),
|
|
42
|
+
outputSchema: S.optional(JsonSchemaType),
|
|
43
|
+
|
|
44
|
+
// Local binding to a function name.
|
|
45
|
+
binding: S.optional(S.String),
|
|
46
|
+
}) {}
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import { EchoObject, Expando, ObjectId, Ref } from '@dxos/echo-schema';
|
|
5
|
+
import { EchoObject, Expando, ObjectId, Ref, S } from '@dxos/echo-schema';
|
|
8
6
|
import { log } from '@dxos/log';
|
|
9
7
|
|
|
10
8
|
import { FunctionTrigger, type FunctionTriggerType } from './types';
|
|
@@ -21,20 +19,20 @@ export enum InvocationTraceEventType {
|
|
|
21
19
|
END = 'end',
|
|
22
20
|
}
|
|
23
21
|
|
|
24
|
-
export const TraceEventException =
|
|
25
|
-
timestampMs:
|
|
26
|
-
message:
|
|
27
|
-
name:
|
|
28
|
-
stack:
|
|
22
|
+
export const TraceEventException = S.Struct({
|
|
23
|
+
timestampMs: S.Number,
|
|
24
|
+
message: S.String,
|
|
25
|
+
name: S.String,
|
|
26
|
+
stack: S.optional(S.String),
|
|
29
27
|
});
|
|
30
|
-
export type TraceEventException =
|
|
28
|
+
export type TraceEventException = S.Schema.Type<typeof TraceEventException>;
|
|
31
29
|
|
|
32
|
-
export const InvocationTraceStartEvent =
|
|
30
|
+
export const InvocationTraceStartEvent = S.Struct({
|
|
33
31
|
/**
|
|
34
32
|
* Queue message id.
|
|
35
33
|
*/
|
|
36
34
|
id: ObjectId,
|
|
37
|
-
type:
|
|
35
|
+
type: S.Literal(InvocationTraceEventType.START),
|
|
38
36
|
/**
|
|
39
37
|
* Invocation id, the same for invocation start and end events.
|
|
40
38
|
*/
|
|
@@ -42,12 +40,12 @@ export const InvocationTraceStartEvent = Schema.Struct({
|
|
|
42
40
|
/**
|
|
43
41
|
* Event generation time.
|
|
44
42
|
*/
|
|
45
|
-
timestampMs:
|
|
43
|
+
timestampMs: S.Number,
|
|
46
44
|
/**
|
|
47
45
|
* Data passed to function / workflow as an argument.
|
|
48
46
|
*/
|
|
49
47
|
// TODO(burdon): Input schema?
|
|
50
|
-
input:
|
|
48
|
+
input: S.Object,
|
|
51
49
|
/**
|
|
52
50
|
* Queue DXN for function/workflow invocation events.
|
|
53
51
|
*/
|
|
@@ -60,17 +58,17 @@ export const InvocationTraceStartEvent = Schema.Struct({
|
|
|
60
58
|
/**
|
|
61
59
|
* Present for automatic invocations.
|
|
62
60
|
*/
|
|
63
|
-
trigger:
|
|
61
|
+
trigger: S.optional(Ref(FunctionTrigger)),
|
|
64
62
|
}).pipe(EchoObject({ typename: 'dxos.org/type/InvocationTraceStart', version: '0.1.0' }));
|
|
65
63
|
|
|
66
|
-
export type InvocationTraceStartEvent =
|
|
64
|
+
export type InvocationTraceStartEvent = S.Schema.Type<typeof InvocationTraceStartEvent>;
|
|
67
65
|
|
|
68
|
-
export const InvocationTraceEndEvent =
|
|
66
|
+
export const InvocationTraceEndEvent = S.Struct({
|
|
69
67
|
/**
|
|
70
68
|
* Trace event id.
|
|
71
69
|
*/
|
|
72
70
|
id: ObjectId,
|
|
73
|
-
type:
|
|
71
|
+
type: S.Literal(InvocationTraceEventType.END),
|
|
74
72
|
/**
|
|
75
73
|
* Invocation id, will be the same for invocation start and end.
|
|
76
74
|
*/
|
|
@@ -79,36 +77,36 @@ export const InvocationTraceEndEvent = Schema.Struct({
|
|
|
79
77
|
* Event generation time.
|
|
80
78
|
*/
|
|
81
79
|
// TODO(burdon): Remove ms suffix.
|
|
82
|
-
timestampMs:
|
|
83
|
-
outcome:
|
|
84
|
-
exception:
|
|
80
|
+
timestampMs: S.Number,
|
|
81
|
+
outcome: S.Enums(InvocationOutcome),
|
|
82
|
+
exception: S.optional(TraceEventException),
|
|
85
83
|
}).pipe(EchoObject({ typename: 'dxos.org/type/InvocationTraceEnd', version: '0.1.0' }));
|
|
86
84
|
|
|
87
|
-
export type InvocationTraceEndEvent =
|
|
85
|
+
export type InvocationTraceEndEvent = S.Schema.Type<typeof InvocationTraceEndEvent>;
|
|
88
86
|
|
|
89
87
|
export type InvocationTraceEvent = InvocationTraceStartEvent | InvocationTraceEndEvent;
|
|
90
88
|
|
|
91
|
-
export const TraceEventLog =
|
|
92
|
-
timestampMs:
|
|
93
|
-
level:
|
|
94
|
-
message:
|
|
95
|
-
context:
|
|
89
|
+
export const TraceEventLog = S.Struct({
|
|
90
|
+
timestampMs: S.Number,
|
|
91
|
+
level: S.String,
|
|
92
|
+
message: S.String,
|
|
93
|
+
context: S.optional(S.Object),
|
|
96
94
|
});
|
|
97
95
|
|
|
98
|
-
export const TraceEvent =
|
|
96
|
+
export const TraceEvent = S.Struct({
|
|
99
97
|
id: ObjectId,
|
|
100
98
|
// TODO(burdon): Need enum/numeric result (not string).
|
|
101
|
-
outcome:
|
|
102
|
-
truncated:
|
|
99
|
+
outcome: S.String,
|
|
100
|
+
truncated: S.Boolean,
|
|
103
101
|
/**
|
|
104
102
|
* Time when the event was persisted.
|
|
105
103
|
*/
|
|
106
|
-
ingestionTimestampMs:
|
|
107
|
-
logs:
|
|
108
|
-
exceptions:
|
|
104
|
+
ingestionTimestampMs: S.Number,
|
|
105
|
+
logs: S.Array(TraceEventLog),
|
|
106
|
+
exceptions: S.Array(TraceEventException),
|
|
109
107
|
}).pipe(EchoObject({ typename: 'dxos.org/type/TraceEvent', version: '0.1.0' }));
|
|
110
108
|
|
|
111
|
-
export type TraceEvent =
|
|
109
|
+
export type TraceEvent = S.Schema.Type<typeof TraceEvent>;
|
|
112
110
|
|
|
113
111
|
/**
|
|
114
112
|
* Deprecated InvocationTrace event format.
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { AST, OptionsAnnotationId, RawObject, S, TypedObject, DXN } from '@dxos/echo-schema';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Type discriminator for TriggerType.
|
|
9
|
+
* Every spec has a type field of type TriggerKind that we can use to understand which type we're working with.
|
|
10
|
+
* https://www.typescriptlang.org/docs/handbook/2/narrowing.html#discriminated-unions
|
|
11
|
+
*/
|
|
12
|
+
export enum TriggerKind {
|
|
13
|
+
Timer = 'timer',
|
|
14
|
+
Webhook = 'webhook',
|
|
15
|
+
Subscription = 'subscription',
|
|
16
|
+
Email = 'email',
|
|
17
|
+
Queue = 'queue',
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// TODO(burdon): Rename prop kind.
|
|
21
|
+
const typeLiteralAnnotations = { [AST.TitleAnnotationId]: 'Type' };
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Cron timer.
|
|
25
|
+
*/
|
|
26
|
+
const TimerTriggerSchema = S.Struct({
|
|
27
|
+
type: S.Literal(TriggerKind.Timer).annotations(typeLiteralAnnotations),
|
|
28
|
+
cron: S.String.annotations({
|
|
29
|
+
[AST.TitleAnnotationId]: 'Cron',
|
|
30
|
+
[AST.ExamplesAnnotationId]: ['0 0 * * *'],
|
|
31
|
+
}),
|
|
32
|
+
}).pipe(S.mutable);
|
|
33
|
+
|
|
34
|
+
export type TimerTrigger = S.Schema.Type<typeof TimerTriggerSchema>;
|
|
35
|
+
|
|
36
|
+
const EmailTriggerSchema = S.Struct({
|
|
37
|
+
type: S.Literal(TriggerKind.Email).annotations(typeLiteralAnnotations),
|
|
38
|
+
}).pipe(S.mutable);
|
|
39
|
+
|
|
40
|
+
export type EmailTrigger = S.Schema.Type<typeof EmailTriggerSchema>;
|
|
41
|
+
|
|
42
|
+
const QueueTriggerSchema = S.Struct({
|
|
43
|
+
type: S.Literal(TriggerKind.Queue).annotations(typeLiteralAnnotations),
|
|
44
|
+
queue: DXN,
|
|
45
|
+
}).pipe(S.mutable);
|
|
46
|
+
|
|
47
|
+
export type QueueTrigger = S.Schema.Type<typeof QueueTriggerSchema>;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Webhook.
|
|
51
|
+
*/
|
|
52
|
+
const WebhookTriggerSchema = S.Struct({
|
|
53
|
+
type: S.Literal(TriggerKind.Webhook).annotations(typeLiteralAnnotations),
|
|
54
|
+
method: S.optional(
|
|
55
|
+
S.String.annotations({
|
|
56
|
+
[AST.TitleAnnotationId]: 'Method',
|
|
57
|
+
[OptionsAnnotationId]: ['GET', 'POST'],
|
|
58
|
+
}),
|
|
59
|
+
),
|
|
60
|
+
port: S.optional(
|
|
61
|
+
S.Number.annotations({
|
|
62
|
+
[AST.TitleAnnotationId]: 'Port',
|
|
63
|
+
}),
|
|
64
|
+
),
|
|
65
|
+
}).pipe(S.mutable);
|
|
66
|
+
|
|
67
|
+
export type WebhookTrigger = S.Schema.Type<typeof WebhookTriggerSchema>;
|
|
68
|
+
|
|
69
|
+
// TODO(burdon): Use ECHO definition (from https://github.com/dxos/dxos/pull/8233).
|
|
70
|
+
const QuerySchema = S.Struct({
|
|
71
|
+
type: S.optional(S.String.annotations({ [AST.TitleAnnotationId]: 'Type' })),
|
|
72
|
+
props: S.optional(S.Record({ key: S.String, value: S.Any })),
|
|
73
|
+
}).annotations({ [AST.TitleAnnotationId]: 'Query' });
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Subscription.
|
|
77
|
+
*/
|
|
78
|
+
const SubscriptionTriggerSchema = S.Struct({
|
|
79
|
+
type: S.Literal(TriggerKind.Subscription).annotations(typeLiteralAnnotations),
|
|
80
|
+
// TODO(burdon): Define query DSL (from ECHO). Reconcile with Table.Query.
|
|
81
|
+
filter: QuerySchema,
|
|
82
|
+
options: S.optional(
|
|
83
|
+
S.Struct({
|
|
84
|
+
// Watch changes to object (not just creation).
|
|
85
|
+
deep: S.optional(S.Boolean.annotations({ [AST.TitleAnnotationId]: 'Nested' })),
|
|
86
|
+
// Debounce changes (delay in ms).
|
|
87
|
+
delay: S.optional(S.Number.annotations({ [AST.TitleAnnotationId]: 'Delay' })),
|
|
88
|
+
}).annotations({ [AST.TitleAnnotationId]: 'Options' }),
|
|
89
|
+
),
|
|
90
|
+
}).pipe(S.mutable);
|
|
91
|
+
|
|
92
|
+
export type SubscriptionTrigger = S.Schema.Type<typeof SubscriptionTriggerSchema>;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Trigger schema (discriminated union).
|
|
96
|
+
*/
|
|
97
|
+
export const TriggerSchema = S.Union(
|
|
98
|
+
TimerTriggerSchema,
|
|
99
|
+
WebhookTriggerSchema,
|
|
100
|
+
SubscriptionTriggerSchema,
|
|
101
|
+
EmailTriggerSchema,
|
|
102
|
+
QueueTriggerSchema,
|
|
103
|
+
).annotations({
|
|
104
|
+
[AST.TitleAnnotationId]: 'Trigger',
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
export type TriggerType = S.Schema.Type<typeof TriggerSchema>;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Function trigger.
|
|
111
|
+
*/
|
|
112
|
+
export const FunctionTriggerSchema = S.Struct({
|
|
113
|
+
// TODO(burdon): What type does this reference.
|
|
114
|
+
// TODO(wittjosiah): This should probably be a Ref?
|
|
115
|
+
function: S.optional(S.String.annotations({ [AST.TitleAnnotationId]: 'Function' })),
|
|
116
|
+
|
|
117
|
+
enabled: S.optional(S.Boolean.annotations({ [AST.TitleAnnotationId]: 'Enabled' })),
|
|
118
|
+
|
|
119
|
+
// TODO(burdon): Flatten entire schema.
|
|
120
|
+
spec: S.optional(TriggerSchema),
|
|
121
|
+
|
|
122
|
+
// TODO(burdon): Get schema as partial from function.
|
|
123
|
+
// TODO(wittjosiah): Rename to payload.
|
|
124
|
+
// The `meta` property is merged into the event data passed to the function.
|
|
125
|
+
meta: S.optional(S.mutable(S.Record({ key: S.String, value: S.Any }))),
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
export type FunctionTriggerType = S.Schema.Type<typeof FunctionTriggerSchema>;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Function trigger.
|
|
132
|
+
*/
|
|
133
|
+
export class FunctionTrigger extends TypedObject({
|
|
134
|
+
typename: 'dxos.org/type/FunctionTrigger',
|
|
135
|
+
version: '0.1.0',
|
|
136
|
+
})(FunctionTriggerSchema.fields) {}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Function definition.
|
|
140
|
+
* @deprecated (Use dxos.org/type/Function)
|
|
141
|
+
*/
|
|
142
|
+
// TODO(burdon): Reconcile with FunctionType.
|
|
143
|
+
export class FunctionDef extends TypedObject({
|
|
144
|
+
typename: 'dxos.org/type/FunctionDef',
|
|
145
|
+
version: '0.1.0',
|
|
146
|
+
})({
|
|
147
|
+
uri: S.String,
|
|
148
|
+
description: S.optional(S.String),
|
|
149
|
+
route: S.String,
|
|
150
|
+
handler: S.String,
|
|
151
|
+
}) {}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Function manifest file.
|
|
155
|
+
*/
|
|
156
|
+
export const FunctionManifestSchema = S.Struct({
|
|
157
|
+
functions: S.optional(S.mutable(S.Array(RawObject(FunctionDef)))),
|
|
158
|
+
triggers: S.optional(S.mutable(S.Array(RawObject(FunctionTrigger)))),
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
export type FunctionManifest = S.Schema.Type<typeof FunctionManifestSchema>;
|
|
162
|
+
|
|
163
|
+
export const FUNCTION_TYPES = [FunctionDef, FunctionTrigger];
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { Schema } from 'effect';
|
|
2
|
-
import { JsonSchemaType, Ref } from '@dxos/echo-schema';
|
|
3
|
-
/**
|
|
4
|
-
* Source script.
|
|
5
|
-
*/
|
|
6
|
-
export declare const ScriptType: import("@dxos/echo-schema").EchoTypeSchema<Schema.Struct<{
|
|
7
|
-
name: Schema.optional<typeof Schema.String>;
|
|
8
|
-
description: Schema.optional<typeof Schema.String>;
|
|
9
|
-
changed: Schema.optional<typeof Schema.Boolean>;
|
|
10
|
-
source: import("@dxos/echo-schema").Ref$<{
|
|
11
|
-
readonly id: string;
|
|
12
|
-
content: string;
|
|
13
|
-
}>;
|
|
14
|
-
}>, {}>;
|
|
15
|
-
export type ScriptType = Schema.Schema.Type<typeof ScriptType>;
|
|
16
|
-
declare const FunctionType_base: import("@dxos/echo-schema").TypedObjectPrototype<import("@dxos/echo-schema").TypedObjectFields<{
|
|
17
|
-
name: typeof Schema.NonEmptyString;
|
|
18
|
-
version: typeof Schema.String;
|
|
19
|
-
description: Schema.optional<typeof Schema.String>;
|
|
20
|
-
source: Schema.optional<import("@dxos/echo-schema").Ref$<{
|
|
21
|
-
readonly id: string;
|
|
22
|
-
name?: string | undefined;
|
|
23
|
-
description?: string | undefined;
|
|
24
|
-
changed?: boolean | undefined;
|
|
25
|
-
source: Ref<{
|
|
26
|
-
readonly id: string;
|
|
27
|
-
content: string;
|
|
28
|
-
}>;
|
|
29
|
-
}>>;
|
|
30
|
-
inputSchema: Schema.optional<Schema.Schema<JsonSchemaType, JsonSchemaType, never>>;
|
|
31
|
-
outputSchema: Schema.optional<Schema.Schema<JsonSchemaType, JsonSchemaType, never>>;
|
|
32
|
-
binding: Schema.optional<typeof Schema.String>;
|
|
33
|
-
}, import("@dxos/echo-schema").TypedObjectOptions>, Schema.Struct.Encoded<{
|
|
34
|
-
name: typeof Schema.NonEmptyString;
|
|
35
|
-
version: typeof Schema.String;
|
|
36
|
-
description: Schema.optional<typeof Schema.String>;
|
|
37
|
-
source: Schema.optional<import("@dxos/echo-schema").Ref$<{
|
|
38
|
-
readonly id: string;
|
|
39
|
-
name?: string | undefined;
|
|
40
|
-
description?: string | undefined;
|
|
41
|
-
changed?: boolean | undefined;
|
|
42
|
-
source: Ref<{
|
|
43
|
-
readonly id: string;
|
|
44
|
-
content: string;
|
|
45
|
-
}>;
|
|
46
|
-
}>>;
|
|
47
|
-
inputSchema: Schema.optional<Schema.Schema<JsonSchemaType, JsonSchemaType, never>>;
|
|
48
|
-
outputSchema: Schema.optional<Schema.Schema<JsonSchemaType, JsonSchemaType, never>>;
|
|
49
|
-
binding: Schema.optional<typeof Schema.String>;
|
|
50
|
-
}>>;
|
|
51
|
-
/**
|
|
52
|
-
* Function deployment.
|
|
53
|
-
*/
|
|
54
|
-
export declare class FunctionType extends FunctionType_base {
|
|
55
|
-
}
|
|
56
|
-
export {};
|
|
57
|
-
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/schema.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAc,cAAc,EAAqB,GAAG,EAAe,MAAM,mBAAmB,CAAC;AAGpG;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;;OAcpB,CAAC;AAEJ,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,UAAU,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE/D;;GAEG;AACH,qBAAa,YAAa,SAAQ,iBAmBhC;CAAG"}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { Schema } from 'effect';
|
|
2
|
-
import { Expando, Ref } from '@dxos/echo-schema';
|
|
3
|
-
import { type FunctionTriggerType } from './types';
|
|
4
|
-
export declare enum InvocationOutcome {
|
|
5
|
-
SUCCESS = "success",
|
|
6
|
-
FAILURE = "failure",
|
|
7
|
-
PENDING = "pending"
|
|
8
|
-
}
|
|
9
|
-
export declare enum InvocationTraceEventType {
|
|
10
|
-
START = "start",
|
|
11
|
-
END = "end"
|
|
12
|
-
}
|
|
13
|
-
export declare const TraceEventException: Schema.Struct<{
|
|
14
|
-
timestampMs: typeof Schema.Number;
|
|
15
|
-
message: typeof Schema.String;
|
|
16
|
-
name: typeof Schema.String;
|
|
17
|
-
stack: Schema.optional<typeof Schema.String>;
|
|
18
|
-
}>;
|
|
19
|
-
export type TraceEventException = Schema.Schema.Type<typeof TraceEventException>;
|
|
20
|
-
export declare const InvocationTraceStartEvent: import("@dxos/echo-schema").EchoTypeSchema<Schema.Struct<{
|
|
21
|
-
/**
|
|
22
|
-
* Queue message id.
|
|
23
|
-
*/
|
|
24
|
-
id: import("@dxos/echo-schema").ObjectIdClass;
|
|
25
|
-
type: Schema.Literal<[InvocationTraceEventType.START]>;
|
|
26
|
-
/**
|
|
27
|
-
* Invocation id, the same for invocation start and end events.
|
|
28
|
-
*/
|
|
29
|
-
invocationId: import("@dxos/echo-schema").ObjectIdClass;
|
|
30
|
-
/**
|
|
31
|
-
* Event generation time.
|
|
32
|
-
*/
|
|
33
|
-
timestampMs: typeof Schema.Number;
|
|
34
|
-
/**
|
|
35
|
-
* Data passed to function / workflow as an argument.
|
|
36
|
-
*/
|
|
37
|
-
input: typeof Schema.Object;
|
|
38
|
-
/**
|
|
39
|
-
* Queue DXN for function/workflow invocation events.
|
|
40
|
-
*/
|
|
41
|
-
invocationTraceQueue: import("@dxos/echo-schema").Ref$<Expando>;
|
|
42
|
-
/**
|
|
43
|
-
* DXN of the invoked function/workflow.
|
|
44
|
-
*/
|
|
45
|
-
invocationTarget: import("@dxos/echo-schema").Ref$<Expando>;
|
|
46
|
-
/**
|
|
47
|
-
* Present for automatic invocations.
|
|
48
|
-
*/
|
|
49
|
-
trigger: Schema.optional<import("@dxos/echo-schema").Ref$<import("@dxos/echo-schema").TypedObjectFields<Readonly<{
|
|
50
|
-
function: Schema.optional<Schema.SchemaClass<Ref<Expando>, import("@dxos/echo-protocol").EncodedReference, never>>;
|
|
51
|
-
inputNodeId: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
52
|
-
enabled: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
53
|
-
spec: Schema.optional<Schema.Union<[Schema.mutable<Schema.Struct<{
|
|
54
|
-
type: Schema.Literal<[import("./types").TriggerKind.Timer]>;
|
|
55
|
-
cron: Schema.SchemaClass<string, string, never>;
|
|
56
|
-
}>>, Schema.mutable<Schema.Struct<{
|
|
57
|
-
type: Schema.Literal<[import("./types").TriggerKind.Webhook]>;
|
|
58
|
-
method: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
59
|
-
port: Schema.optional<Schema.SchemaClass<number, number, never>>;
|
|
60
|
-
}>>, Schema.mutable<Schema.Struct<{
|
|
61
|
-
type: Schema.Literal<[import("./types").TriggerKind.Subscription]>;
|
|
62
|
-
filter: Schema.Struct<{
|
|
63
|
-
type: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
64
|
-
props: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Any>>;
|
|
65
|
-
}>;
|
|
66
|
-
options: Schema.optional<Schema.Struct<{
|
|
67
|
-
deep: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
68
|
-
delay: Schema.optional<Schema.SchemaClass<number, number, never>>;
|
|
69
|
-
}>>;
|
|
70
|
-
}>>, Schema.mutable<Schema.Struct<{
|
|
71
|
-
type: Schema.Literal<[import("./types").TriggerKind.Email]>;
|
|
72
|
-
}>>, Schema.mutable<Schema.Struct<{
|
|
73
|
-
type: Schema.Literal<[import("./types").TriggerKind.Queue]>;
|
|
74
|
-
queue: Schema.refine<string, typeof Schema.NonEmptyString>;
|
|
75
|
-
}>>]>>;
|
|
76
|
-
input: Schema.optional<Schema.mutable<Schema.Record$<typeof Schema.String, typeof Schema.Any>>>;
|
|
77
|
-
}>, import("@dxos/echo-schema").TypedObjectOptions>>>;
|
|
78
|
-
}>, {}>;
|
|
79
|
-
export type InvocationTraceStartEvent = Schema.Schema.Type<typeof InvocationTraceStartEvent>;
|
|
80
|
-
export declare const InvocationTraceEndEvent: import("@dxos/echo-schema").EchoTypeSchema<Schema.Struct<{
|
|
81
|
-
/**
|
|
82
|
-
* Trace event id.
|
|
83
|
-
*/
|
|
84
|
-
id: import("@dxos/echo-schema").ObjectIdClass;
|
|
85
|
-
type: Schema.Literal<[InvocationTraceEventType.END]>;
|
|
86
|
-
/**
|
|
87
|
-
* Invocation id, will be the same for invocation start and end.
|
|
88
|
-
*/
|
|
89
|
-
invocationId: import("@dxos/echo-schema").ObjectIdClass;
|
|
90
|
-
/**
|
|
91
|
-
* Event generation time.
|
|
92
|
-
*/
|
|
93
|
-
timestampMs: typeof Schema.Number;
|
|
94
|
-
outcome: Schema.Enums<typeof InvocationOutcome>;
|
|
95
|
-
exception: Schema.optional<Schema.Struct<{
|
|
96
|
-
timestampMs: typeof Schema.Number;
|
|
97
|
-
message: typeof Schema.String;
|
|
98
|
-
name: typeof Schema.String;
|
|
99
|
-
stack: Schema.optional<typeof Schema.String>;
|
|
100
|
-
}>>;
|
|
101
|
-
}>, {}>;
|
|
102
|
-
export type InvocationTraceEndEvent = Schema.Schema.Type<typeof InvocationTraceEndEvent>;
|
|
103
|
-
export type InvocationTraceEvent = InvocationTraceStartEvent | InvocationTraceEndEvent;
|
|
104
|
-
export declare const TraceEventLog: Schema.Struct<{
|
|
105
|
-
timestampMs: typeof Schema.Number;
|
|
106
|
-
level: typeof Schema.String;
|
|
107
|
-
message: typeof Schema.String;
|
|
108
|
-
context: Schema.optional<typeof Schema.Object>;
|
|
109
|
-
}>;
|
|
110
|
-
export declare const TraceEvent: import("@dxos/echo-schema").EchoTypeSchema<Schema.Struct<{
|
|
111
|
-
id: import("@dxos/echo-schema").ObjectIdClass;
|
|
112
|
-
outcome: typeof Schema.String;
|
|
113
|
-
truncated: typeof Schema.Boolean;
|
|
114
|
-
/**
|
|
115
|
-
* Time when the event was persisted.
|
|
116
|
-
*/
|
|
117
|
-
ingestionTimestampMs: typeof Schema.Number;
|
|
118
|
-
logs: Schema.Array$<Schema.Struct<{
|
|
119
|
-
timestampMs: typeof Schema.Number;
|
|
120
|
-
level: typeof Schema.String;
|
|
121
|
-
message: typeof Schema.String;
|
|
122
|
-
context: Schema.optional<typeof Schema.Object>;
|
|
123
|
-
}>>;
|
|
124
|
-
exceptions: Schema.Array$<Schema.Struct<{
|
|
125
|
-
timestampMs: typeof Schema.Number;
|
|
126
|
-
message: typeof Schema.String;
|
|
127
|
-
name: typeof Schema.String;
|
|
128
|
-
stack: Schema.optional<typeof Schema.String>;
|
|
129
|
-
}>>;
|
|
130
|
-
}>, {}>;
|
|
131
|
-
export type TraceEvent = Schema.Schema.Type<typeof TraceEvent>;
|
|
132
|
-
/**
|
|
133
|
-
* Deprecated InvocationTrace event format.
|
|
134
|
-
* @deprecated
|
|
135
|
-
*/
|
|
136
|
-
export type InvocationSpan = {
|
|
137
|
-
id: string;
|
|
138
|
-
timestampMs: number;
|
|
139
|
-
outcome: InvocationOutcome;
|
|
140
|
-
input: object;
|
|
141
|
-
durationMs: number;
|
|
142
|
-
invocationTraceQueue: Ref<Expando>;
|
|
143
|
-
invocationTarget: Ref<Expando>;
|
|
144
|
-
trigger?: Ref<FunctionTriggerType>;
|
|
145
|
-
exception?: TraceEventException;
|
|
146
|
-
};
|
|
147
|
-
export declare const createInvocationSpans: (items?: InvocationTraceEvent[]) => InvocationSpan[];
|
|
148
|
-
//# sourceMappingURL=trace.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-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BAAyB,qCAAqC,CAAC;AAM5E,eAAO,MAAM,4BAA4B,SAAU,UAAU,uBAE5D,CAAC;AAEF,eAAO,MAAM,4BAA4B,SAAU,UAAU,eAAe,MAAM,SASjF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,YAAa,OAAO,MAAM;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,WAAmC,CAAC;AAEhH,eAAO,MAAM,gBAAgB,gBAAiB,MAAM,WAAW,MAAM,YAAW,iBAAiB,WAUhG,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC"}
|
package/src/schema.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Schema } from 'effect';
|
|
6
|
-
|
|
7
|
-
import { EchoObject, JsonSchemaType, LabelAnnotationId, Ref, TypedObject } from '@dxos/echo-schema';
|
|
8
|
-
import { DataType } from '@dxos/schema';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Source script.
|
|
12
|
-
*/
|
|
13
|
-
export const ScriptType = Schema.Struct({
|
|
14
|
-
name: Schema.optional(Schema.String),
|
|
15
|
-
description: Schema.optional(Schema.String),
|
|
16
|
-
// TODO(burdon): Change to hash of deployed content.
|
|
17
|
-
// Whether source has changed since last deploy.
|
|
18
|
-
changed: Schema.optional(Schema.Boolean),
|
|
19
|
-
source: Ref(DataType.Text),
|
|
20
|
-
})
|
|
21
|
-
.annotations({ [LabelAnnotationId]: 'name' })
|
|
22
|
-
.pipe(
|
|
23
|
-
EchoObject({
|
|
24
|
-
typename: 'dxos.org/type/Script',
|
|
25
|
-
version: '0.1.0',
|
|
26
|
-
}),
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
export type ScriptType = Schema.Schema.Type<typeof ScriptType>;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Function deployment.
|
|
33
|
-
*/
|
|
34
|
-
export class FunctionType extends TypedObject({
|
|
35
|
-
typename: 'dxos.org/type/Function',
|
|
36
|
-
version: '0.1.0',
|
|
37
|
-
})({
|
|
38
|
-
// TODO(burdon): Rename to id/uri?
|
|
39
|
-
name: Schema.NonEmptyString,
|
|
40
|
-
version: Schema.String,
|
|
41
|
-
|
|
42
|
-
description: Schema.optional(Schema.String),
|
|
43
|
-
|
|
44
|
-
// Reference to a source script if it exists within ECHO.
|
|
45
|
-
// TODO(burdon): Don't ref ScriptType directly (core).
|
|
46
|
-
source: Schema.optional(Ref(ScriptType)),
|
|
47
|
-
|
|
48
|
-
inputSchema: Schema.optional(JsonSchemaType),
|
|
49
|
-
outputSchema: Schema.optional(JsonSchemaType),
|
|
50
|
-
|
|
51
|
-
// Local binding to a function name.
|
|
52
|
-
binding: Schema.optional(Schema.String),
|
|
53
|
-
}) {}
|