@dxos/functions 0.5.5-main.6a9d10e → 0.5.5-main.6dd4e95
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/{chunk-4D4I3YMJ.mjs → chunk-ERWZ4JUZ.mjs} +31 -31
- package/dist/lib/browser/{chunk-4D4I3YMJ.mjs.map → chunk-ERWZ4JUZ.mjs.map} +2 -2
- package/dist/lib/browser/{chunk-MI74IGED.mjs → chunk-SXZ5DYJG.mjs} +2 -2
- package/dist/lib/browser/index.mjs +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +4 -3
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/browser/types.mjs +1 -1
- package/dist/lib/node/{chunk-3UYUR5N5.cjs → chunk-BLLSDTKZ.cjs} +34 -34
- package/dist/lib/node/{chunk-3UYUR5N5.cjs.map → chunk-BLLSDTKZ.cjs.map} +2 -2
- package/dist/lib/node/{chunk-4QALPMYS.cjs → chunk-RPHL3ORN.cjs} +18 -18
- package/dist/lib/node/index.cjs +10 -10
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +10 -9
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/lib/node/types.cjs +5 -5
- package/dist/lib/node/types.cjs.map +1 -1
- package/dist/types/src/testing/setup.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +27 -38
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +15 -15
- package/src/testing/setup.ts +1 -0
- package/src/testing/types.ts +1 -1
- package/src/types.ts +31 -31
- /package/dist/lib/browser/{chunk-MI74IGED.mjs.map → chunk-SXZ5DYJG.mjs.map} +0 -0
- /package/dist/lib/node/{chunk-4QALPMYS.cjs.map → chunk-RPHL3ORN.cjs.map} +0 -0
package/src/types.ts
CHANGED
|
@@ -13,21 +13,21 @@ import { RawObject, S, TypedObject } from '@dxos/echo-schema';
|
|
|
13
13
|
export type FunctionTriggerType = 'subscription' | 'timer' | 'webhook' | 'websocket';
|
|
14
14
|
|
|
15
15
|
const SubscriptionTriggerSchema = S.mutable(
|
|
16
|
-
S.
|
|
17
|
-
type: S.
|
|
16
|
+
S.Struct({
|
|
17
|
+
type: S.Literal('subscription'),
|
|
18
18
|
// TODO(burdon): Define query DSL (from ECHO).
|
|
19
|
-
filter: S.
|
|
20
|
-
S.
|
|
21
|
-
type: S.
|
|
22
|
-
props: S.optional(S.
|
|
19
|
+
filter: S.Array(
|
|
20
|
+
S.Struct({
|
|
21
|
+
type: S.String,
|
|
22
|
+
props: S.optional(S.Record(S.String, S.Any)),
|
|
23
23
|
}),
|
|
24
24
|
),
|
|
25
25
|
options: S.optional(
|
|
26
|
-
S.
|
|
26
|
+
S.Struct({
|
|
27
27
|
// Watch changes to object (not just creation).
|
|
28
|
-
deep: S.optional(S.
|
|
28
|
+
deep: S.optional(S.Boolean),
|
|
29
29
|
// Debounce changes (delay in ms).
|
|
30
|
-
delay: S.optional(S.
|
|
30
|
+
delay: S.optional(S.Number),
|
|
31
31
|
}),
|
|
32
32
|
),
|
|
33
33
|
}),
|
|
@@ -36,36 +36,36 @@ const SubscriptionTriggerSchema = S.mutable(
|
|
|
36
36
|
export type SubscriptionTrigger = S.Schema.Type<typeof SubscriptionTriggerSchema>;
|
|
37
37
|
|
|
38
38
|
const TimerTriggerSchema = S.mutable(
|
|
39
|
-
S.
|
|
40
|
-
type: S.
|
|
41
|
-
cron: S.
|
|
39
|
+
S.Struct({
|
|
40
|
+
type: S.Literal('timer'),
|
|
41
|
+
cron: S.String,
|
|
42
42
|
}),
|
|
43
43
|
);
|
|
44
44
|
|
|
45
45
|
export type TimerTrigger = S.Schema.Type<typeof TimerTriggerSchema>;
|
|
46
46
|
|
|
47
47
|
const WebhookTriggerSchema = S.mutable(
|
|
48
|
-
S.
|
|
49
|
-
type: S.
|
|
50
|
-
method: S.
|
|
48
|
+
S.Struct({
|
|
49
|
+
type: S.Literal('webhook'),
|
|
50
|
+
method: S.String,
|
|
51
51
|
// Assigned port.
|
|
52
|
-
port: S.optional(S.
|
|
52
|
+
port: S.optional(S.Number),
|
|
53
53
|
}),
|
|
54
54
|
);
|
|
55
55
|
|
|
56
56
|
export type WebhookTrigger = S.Schema.Type<typeof WebhookTriggerSchema>;
|
|
57
57
|
|
|
58
58
|
const WebsocketTriggerSchema = S.mutable(
|
|
59
|
-
S.
|
|
60
|
-
type: S.
|
|
61
|
-
url: S.
|
|
62
|
-
init: S.optional(S.
|
|
59
|
+
S.Struct({
|
|
60
|
+
type: S.Literal('websocket'),
|
|
61
|
+
url: S.String,
|
|
62
|
+
init: S.optional(S.Record(S.String, S.Any)),
|
|
63
63
|
}),
|
|
64
64
|
);
|
|
65
65
|
|
|
66
66
|
export type WebsocketTrigger = S.Schema.Type<typeof WebsocketTriggerSchema>;
|
|
67
67
|
|
|
68
|
-
const TriggerSpecSchema = S.
|
|
68
|
+
const TriggerSpecSchema = S.Union(
|
|
69
69
|
TimerTriggerSchema,
|
|
70
70
|
WebhookTriggerSchema,
|
|
71
71
|
WebsocketTriggerSchema,
|
|
@@ -81,10 +81,10 @@ export class FunctionDef extends TypedObject({
|
|
|
81
81
|
typename: 'dxos.org/type/FunctionDef',
|
|
82
82
|
version: '0.1.0',
|
|
83
83
|
})({
|
|
84
|
-
uri: S.
|
|
85
|
-
description: S.optional(S.
|
|
86
|
-
route: S.
|
|
87
|
-
handler: S.
|
|
84
|
+
uri: S.String,
|
|
85
|
+
description: S.optional(S.String),
|
|
86
|
+
route: S.String,
|
|
87
|
+
handler: S.String,
|
|
88
88
|
}) {}
|
|
89
89
|
|
|
90
90
|
/**
|
|
@@ -94,19 +94,19 @@ export class FunctionTrigger extends TypedObject({
|
|
|
94
94
|
typename: 'dxos.org/type/FunctionTrigger',
|
|
95
95
|
version: '0.1.0',
|
|
96
96
|
})({
|
|
97
|
-
enabled: S.optional(S.
|
|
98
|
-
function: S.
|
|
97
|
+
enabled: S.optional(S.Boolean),
|
|
98
|
+
function: S.String.pipe(S.description('Function URI.')),
|
|
99
99
|
// The `meta` property is merged into the event data passed to the function.
|
|
100
|
-
meta: S.optional(S.mutable(S.
|
|
100
|
+
meta: S.optional(S.mutable(S.Any)),
|
|
101
101
|
spec: TriggerSpecSchema,
|
|
102
102
|
}) {}
|
|
103
103
|
|
|
104
104
|
/**
|
|
105
105
|
* Function manifest file.
|
|
106
106
|
*/
|
|
107
|
-
export const FunctionManifestSchema = S.
|
|
108
|
-
functions: S.optional(S.mutable(S.
|
|
109
|
-
triggers: S.optional(S.mutable(S.
|
|
107
|
+
export const FunctionManifestSchema = S.Struct({
|
|
108
|
+
functions: S.optional(S.mutable(S.Array(RawObject(FunctionDef)))),
|
|
109
|
+
triggers: S.optional(S.mutable(S.Array(RawObject(FunctionTrigger)))),
|
|
110
110
|
});
|
|
111
111
|
|
|
112
112
|
export type FunctionManifest = S.Schema.Type<typeof FunctionManifestSchema>;
|
|
File without changes
|
|
File without changes
|