@dxos/functions 0.5.3-main.d7fe7b5 → 0.5.3-main.e76d664

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 (81) hide show
  1. package/dist/lib/browser/index.mjs +429 -802
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node/index.cjs +426 -787
  5. package/dist/lib/node/index.cjs.map +4 -4
  6. package/dist/lib/node/meta.json +1 -1
  7. package/dist/types/src/handler.d.ts +12 -33
  8. package/dist/types/src/handler.d.ts.map +1 -1
  9. package/dist/types/src/index.d.ts +0 -2
  10. package/dist/types/src/index.d.ts.map +1 -1
  11. package/dist/types/src/runtime/dev-server.d.ts +13 -16
  12. package/dist/types/src/runtime/dev-server.d.ts.map +1 -1
  13. package/dist/types/src/runtime/scheduler.d.ts +27 -12
  14. package/dist/types/src/runtime/scheduler.d.ts.map +1 -1
  15. package/dist/types/src/types.d.ts +101 -129
  16. package/dist/types/src/types.d.ts.map +1 -1
  17. package/package.json +13 -18
  18. package/schema/functions.json +101 -128
  19. package/src/handler.ts +31 -54
  20. package/src/index.ts +0 -2
  21. package/src/runtime/dev-server.ts +52 -104
  22. package/src/runtime/scheduler.test.ts +73 -56
  23. package/src/runtime/scheduler.ts +271 -79
  24. package/src/types.ts +32 -57
  25. package/dist/types/src/registry/function-registry.d.ts +0 -24
  26. package/dist/types/src/registry/function-registry.d.ts.map +0 -1
  27. package/dist/types/src/registry/function-registry.test.d.ts +0 -2
  28. package/dist/types/src/registry/function-registry.test.d.ts.map +0 -1
  29. package/dist/types/src/registry/index.d.ts +0 -2
  30. package/dist/types/src/registry/index.d.ts.map +0 -1
  31. package/dist/types/src/runtime/dev-server.test.d.ts +0 -2
  32. package/dist/types/src/runtime/dev-server.test.d.ts.map +0 -1
  33. package/dist/types/src/testing/functions-integration.test.d.ts +0 -2
  34. package/dist/types/src/testing/functions-integration.test.d.ts.map +0 -1
  35. package/dist/types/src/testing/index.d.ts +0 -4
  36. package/dist/types/src/testing/index.d.ts.map +0 -1
  37. package/dist/types/src/testing/setup.d.ts +0 -5
  38. package/dist/types/src/testing/setup.d.ts.map +0 -1
  39. package/dist/types/src/testing/test/handler.d.ts +0 -4
  40. package/dist/types/src/testing/test/handler.d.ts.map +0 -1
  41. package/dist/types/src/testing/test/index.d.ts +0 -3
  42. package/dist/types/src/testing/test/index.d.ts.map +0 -1
  43. package/dist/types/src/testing/types.d.ts +0 -9
  44. package/dist/types/src/testing/types.d.ts.map +0 -1
  45. package/dist/types/src/testing/util.d.ts +0 -3
  46. package/dist/types/src/testing/util.d.ts.map +0 -1
  47. package/dist/types/src/trigger/index.d.ts +0 -2
  48. package/dist/types/src/trigger/index.d.ts.map +0 -1
  49. package/dist/types/src/trigger/trigger-registry.d.ts +0 -40
  50. package/dist/types/src/trigger/trigger-registry.d.ts.map +0 -1
  51. package/dist/types/src/trigger/trigger-registry.test.d.ts +0 -2
  52. package/dist/types/src/trigger/trigger-registry.test.d.ts.map +0 -1
  53. package/dist/types/src/trigger/type/index.d.ts +0 -5
  54. package/dist/types/src/trigger/type/index.d.ts.map +0 -1
  55. package/dist/types/src/trigger/type/subscription-trigger.d.ts +0 -4
  56. package/dist/types/src/trigger/type/subscription-trigger.d.ts.map +0 -1
  57. package/dist/types/src/trigger/type/timer-trigger.d.ts +0 -4
  58. package/dist/types/src/trigger/type/timer-trigger.d.ts.map +0 -1
  59. package/dist/types/src/trigger/type/webhook-trigger.d.ts +0 -4
  60. package/dist/types/src/trigger/type/webhook-trigger.d.ts.map +0 -1
  61. package/dist/types/src/trigger/type/websocket-trigger.d.ts +0 -13
  62. package/dist/types/src/trigger/type/websocket-trigger.d.ts.map +0 -1
  63. package/src/registry/function-registry.test.ts +0 -105
  64. package/src/registry/function-registry.ts +0 -84
  65. package/src/registry/index.ts +0 -5
  66. package/src/runtime/dev-server.test.ts +0 -60
  67. package/src/testing/functions-integration.test.ts +0 -99
  68. package/src/testing/index.ts +0 -7
  69. package/src/testing/setup.ts +0 -45
  70. package/src/testing/test/handler.ts +0 -15
  71. package/src/testing/test/index.ts +0 -7
  72. package/src/testing/types.ts +0 -9
  73. package/src/testing/util.ts +0 -16
  74. package/src/trigger/index.ts +0 -5
  75. package/src/trigger/trigger-registry.test.ts +0 -229
  76. package/src/trigger/trigger-registry.ts +0 -176
  77. package/src/trigger/type/index.ts +0 -8
  78. package/src/trigger/type/subscription-trigger.ts +0 -73
  79. package/src/trigger/type/timer-trigger.ts +0 -44
  80. package/src/trigger/type/webhook-trigger.ts +0 -47
  81. package/src/trigger/type/websocket-trigger.ts +0 -91
@@ -1,13 +1,20 @@
1
- import { S } from '@dxos/echo-schema';
2
- /**
3
- * Type discriminator for TriggerSpec.
4
- * Every spec has a type field of type FunctionTriggerType that we can use to understand which
5
- * type we're working with.
6
- * https://www.typescriptlang.org/docs/handbook/2/narrowing.html#discriminated-unions
7
- */
8
- export type FunctionTriggerType = 'subscription' | 'timer' | 'webhook' | 'websocket';
1
+ import * as S from '@effect/schema/Schema';
2
+ declare const TimerTriggerSchema: S.struct<{
3
+ cron: S.$string;
4
+ }>;
5
+ declare const WebhookTriggerSchema: S.struct<{
6
+ port: S.$number;
7
+ }>;
8
+ declare const WebsocketTriggerSchema: S.struct<{
9
+ url: S.$string;
10
+ init: S.PropertySignature<"?:", {
11
+ readonly [x: string]: any;
12
+ } | undefined, never, "?:", {
13
+ readonly [x: string]: any;
14
+ } | undefined, never>;
15
+ }>;
9
16
  declare const SubscriptionTriggerSchema: S.struct<{
10
- type: S.literal<["subscription"]>;
17
+ spaceKey: S.PropertySignature<"?:", string | undefined, never, "?:", string | undefined, never>;
11
18
  filter: S.array<S.struct<{
12
19
  type: S.$string;
13
20
  props: S.PropertySignature<"?:", {
@@ -24,164 +31,129 @@ declare const SubscriptionTriggerSchema: S.struct<{
24
31
  readonly delay?: number | undefined;
25
32
  } | undefined, never>;
26
33
  }>;
27
- export type SubscriptionTrigger = S.Schema.Type<typeof SubscriptionTriggerSchema>;
28
- declare const TimerTriggerSchema: S.struct<{
29
- type: S.literal<["timer"]>;
30
- cron: S.$string;
31
- }>;
32
- export type TimerTrigger = S.Schema.Type<typeof TimerTriggerSchema>;
33
- declare const WebhookTriggerSchema: S.mutable<S.struct<{
34
- type: S.literal<["webhook"]>;
35
- method: S.$string;
36
- port: S.PropertySignature<"?:", number | undefined, never, "?:", number | undefined, never>;
37
- }>>;
38
- export type WebhookTrigger = S.Schema.Type<typeof WebhookTriggerSchema>;
39
- declare const WebsocketTriggerSchema: S.struct<{
40
- type: S.literal<["websocket"]>;
41
- url: S.$string;
42
- init: S.PropertySignature<"?:", {
43
- readonly [x: string]: any;
34
+ declare const FunctionTriggerSchema: S.struct<{
35
+ function: S.$string;
36
+ timer: S.PropertySignature<"?:", {
37
+ readonly cron: string;
44
38
  } | undefined, never, "?:", {
45
- readonly [x: string]: any;
39
+ readonly cron: string;
46
40
  } | undefined, never>;
47
- }>;
48
- export type WebsocketTrigger = S.Schema.Type<typeof WebsocketTriggerSchema>;
49
- export type TriggerSpec = TimerTrigger | WebhookTrigger | WebsocketTrigger | SubscriptionTrigger;
50
- declare const FunctionDef_base: import("@dxos/echo-schema").EchoSchemaClass<{
51
- handler: string;
52
- uri: string;
53
- description?: string | undefined;
54
- route: string;
55
- } & {
56
- id: string;
57
- }>;
58
- /**
59
- * Function definition.
60
- */
61
- export declare class FunctionDef extends FunctionDef_base {
62
- }
63
- declare const FunctionTrigger_base: import("@dxos/echo-schema").EchoSchemaClass<{
64
- function: string;
65
- meta?: {
66
- readonly [x: string]: any;
67
- } | undefined;
68
- spec: {
41
+ webhook: S.PropertySignature<"?:", {
42
+ readonly port: number;
43
+ } | undefined, never, "?:", {
44
+ readonly port: number;
45
+ } | undefined, never>;
46
+ websocket: S.PropertySignature<"?:", {
47
+ readonly url: string;
48
+ readonly init?: {
49
+ readonly [x: string]: any;
50
+ } | undefined;
51
+ } | undefined, never, "?:", {
52
+ readonly url: string;
53
+ readonly init?: {
54
+ readonly [x: string]: any;
55
+ } | undefined;
56
+ } | undefined, never>;
57
+ subscription: S.PropertySignature<"?:", {
69
58
  readonly filter: readonly {
70
59
  readonly type: string;
71
60
  readonly props?: {
72
61
  readonly [x: string]: any;
73
62
  } | undefined;
74
63
  }[];
75
- readonly type: "subscription";
64
+ readonly spaceKey?: string | undefined;
76
65
  readonly options?: {
77
66
  readonly deep?: boolean | undefined;
78
67
  readonly delay?: number | undefined;
79
68
  } | undefined;
80
- } | {
81
- readonly type: "timer";
82
- readonly cron: string;
83
- } | {
84
- port?: number | undefined;
85
- type: "webhook";
86
- method: string;
87
- } | {
88
- readonly type: "websocket";
89
- readonly url: string;
90
- readonly init?: {
91
- readonly [x: string]: any;
69
+ } | undefined, never, "?:", {
70
+ readonly filter: readonly {
71
+ readonly type: string;
72
+ readonly props?: {
73
+ readonly [x: string]: any;
74
+ } | undefined;
75
+ }[];
76
+ readonly spaceKey?: string | undefined;
77
+ readonly options?: {
78
+ readonly deep?: boolean | undefined;
79
+ readonly delay?: number | undefined;
92
80
  } | undefined;
93
- };
94
- } & {
95
- id: string;
81
+ } | undefined, never>;
96
82
  }>;
97
- export declare class FunctionTrigger extends FunctionTrigger_base {
98
- }
83
+ export type TimerTrigger = S.Schema.Type<typeof TimerTriggerSchema>;
84
+ export type WebhookTrigger = S.Schema.Type<typeof WebhookTriggerSchema>;
85
+ export type WebsocketTrigger = S.Schema.Type<typeof WebsocketTriggerSchema>;
86
+ export type SubscriptionTrigger = S.Schema.Type<typeof SubscriptionTriggerSchema>;
87
+ export type FunctionTrigger = S.Schema.Type<typeof FunctionTriggerSchema>;
88
+ /**
89
+ * Function definition.
90
+ */
91
+ declare const FunctionDefSchema: S.struct<{
92
+ id: S.$string;
93
+ description: S.PropertySignature<"?:", string | undefined, never, "?:", string | undefined, never>;
94
+ name: S.$string;
95
+ handler: S.$string;
96
+ }>;
97
+ export type FunctionDef = S.Schema.Type<typeof FunctionDefSchema>;
99
98
  /**
100
99
  * Function manifest file.
101
100
  */
102
101
  export declare const FunctionManifestSchema: S.struct<{
103
- functions: S.PropertySignature<"?:", Omit<{
104
- handler: string;
105
- uri: string;
106
- description?: string | undefined;
107
- route: string;
108
- } & {
109
- id: string;
110
- }, "id">[] | undefined, never, "?:", Omit<{
111
- handler: string;
112
- uri: string;
113
- description?: string | undefined;
114
- route: string;
115
- } & {
116
- id: string;
117
- }, "id">[] | undefined, never>;
118
- triggers: S.PropertySignature<"?:", Omit<{
119
- function: string;
120
- meta?: {
121
- readonly [x: string]: any;
122
- } | undefined;
123
- spec: {
102
+ functions: S.mutable<S.array<S.struct<{
103
+ id: S.$string;
104
+ description: S.PropertySignature<"?:", string | undefined, never, "?:", string | undefined, never>;
105
+ name: S.$string;
106
+ handler: S.$string;
107
+ }>>>;
108
+ triggers: S.mutable<S.array<S.struct<{
109
+ function: S.$string;
110
+ timer: S.PropertySignature<"?:", {
111
+ readonly cron: string;
112
+ } | undefined, never, "?:", {
113
+ readonly cron: string;
114
+ } | undefined, never>;
115
+ webhook: S.PropertySignature<"?:", {
116
+ readonly port: number;
117
+ } | undefined, never, "?:", {
118
+ readonly port: number;
119
+ } | undefined, never>;
120
+ websocket: S.PropertySignature<"?:", {
121
+ readonly url: string;
122
+ readonly init?: {
123
+ readonly [x: string]: any;
124
+ } | undefined;
125
+ } | undefined, never, "?:", {
126
+ readonly url: string;
127
+ readonly init?: {
128
+ readonly [x: string]: any;
129
+ } | undefined;
130
+ } | undefined, never>;
131
+ subscription: S.PropertySignature<"?:", {
124
132
  readonly filter: readonly {
125
133
  readonly type: string;
126
134
  readonly props?: {
127
135
  readonly [x: string]: any;
128
136
  } | undefined;
129
137
  }[];
130
- readonly type: "subscription";
138
+ readonly spaceKey?: string | undefined;
131
139
  readonly options?: {
132
140
  readonly deep?: boolean | undefined;
133
141
  readonly delay?: number | undefined;
134
142
  } | undefined;
135
- } | {
136
- readonly type: "timer";
137
- readonly cron: string;
138
- } | {
139
- port?: number | undefined;
140
- type: "webhook";
141
- method: string;
142
- } | {
143
- readonly type: "websocket";
144
- readonly url: string;
145
- readonly init?: {
146
- readonly [x: string]: any;
147
- } | undefined;
148
- };
149
- } & {
150
- id: string;
151
- }, "id">[] | undefined, never, "?:", Omit<{
152
- function: string;
153
- meta?: {
154
- readonly [x: string]: any;
155
- } | undefined;
156
- spec: {
143
+ } | undefined, never, "?:", {
157
144
  readonly filter: readonly {
158
145
  readonly type: string;
159
146
  readonly props?: {
160
147
  readonly [x: string]: any;
161
148
  } | undefined;
162
149
  }[];
163
- readonly type: "subscription";
150
+ readonly spaceKey?: string | undefined;
164
151
  readonly options?: {
165
152
  readonly deep?: boolean | undefined;
166
153
  readonly delay?: number | undefined;
167
154
  } | undefined;
168
- } | {
169
- readonly type: "timer";
170
- readonly cron: string;
171
- } | {
172
- port?: number | undefined;
173
- type: "webhook";
174
- method: string;
175
- } | {
176
- readonly type: "websocket";
177
- readonly url: string;
178
- readonly init?: {
179
- readonly [x: string]: any;
180
- } | undefined;
181
- };
182
- } & {
183
- id: string;
184
- }, "id">[] | undefined, never>;
155
+ } | undefined, never>;
156
+ }>>>;
185
157
  }>;
186
158
  export type FunctionManifest = S.Schema.Type<typeof FunctionManifestSchema>;
187
159
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAO,CAAC,EAAe,MAAM,mBAAmB,CAAC;AAKxD;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,WAAW,CAAC;AAErF,QAAA,MAAM,yBAAyB;;;;;;;;;;;;;;;;;EAiB7B,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAElF,QAAA,MAAM,kBAAkB;;;EAGtB,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEpE,QAAA,MAAM,oBAAoB;;;;GAOzB,CAAC;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAExE,QAAA,MAAM,sBAAsB;;;;;;;;EAI1B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAQ5E,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,cAAc,GAAG,gBAAgB,GAAG,mBAAmB,CAAC;;;;;;;;;AAEjG;;GAEG;AACH,qBAAa,WAAY,SAAQ,gBAS/B;CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEL,qBAAa,eAAgB,SAAQ,oBAQnC;CAAG;AAEL;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,uBAAuB,CAAC;AAE3C,QAAA,MAAM,kBAAkB;;EAEtB,CAAC;AAEH,QAAA,MAAM,oBAAoB;;EAExB,CAAC;AAEH,QAAA,MAAM,sBAAsB;;;;;;;EAG1B,CAAC;AAEH,QAAA,MAAM,yBAAyB;;;;;;;;;;;;;;;;;EAiB7B,CAAC;AAEH,QAAA,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOzB,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,kBAAkB,CAAC,CAAC;AACpE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACxE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAC5E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAClF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE1E;;GAEG;AAEH,QAAA,MAAM,iBAAiB;;;;;EAMrB,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/functions",
3
- "version": "0.5.3-main.d7fe7b5",
3
+ "version": "0.5.3-main.e76d664",
4
4
  "description": "Functions SDK and runtime.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -20,35 +20,30 @@
20
20
  "src"
21
21
  ],
22
22
  "dependencies": {
23
+ "@effect/schema": "0.64.7",
23
24
  "@preact/signals-core": "^1.6.0",
24
25
  "cron": "^3.1.6",
25
- "effect": "^2.4.19",
26
26
  "express": "^4.19.2",
27
27
  "get-port-please": "^3.1.1",
28
28
  "ws": "^8.14.2",
29
- "@braneframe/types": "0.5.3-main.d7fe7b5",
30
- "@dxos/async": "0.5.3-main.d7fe7b5",
31
- "@dxos/context": "0.5.3-main.d7fe7b5",
32
- "@dxos/client": "0.5.3-main.d7fe7b5",
33
- "@dxos/echo-db": "0.5.3-main.d7fe7b5",
34
- "@dxos/invariant": "0.5.3-main.d7fe7b5",
35
- "@dxos/keys": "0.5.3-main.d7fe7b5",
36
- "@dxos/echo-schema": "0.5.3-main.d7fe7b5",
37
- "@dxos/log": "0.5.3-main.d7fe7b5",
38
- "@dxos/node-std": "0.5.3-main.d7fe7b5",
39
- "@dxos/util": "0.5.3-main.d7fe7b5",
40
- "@dxos/protocols": "0.5.3-main.d7fe7b5"
29
+ "@dxos/async": "0.5.3-main.e76d664",
30
+ "@braneframe/types": "0.5.3-main.e76d664",
31
+ "@dxos/client": "0.5.3-main.e76d664",
32
+ "@dxos/invariant": "0.5.3-main.e76d664",
33
+ "@dxos/echo-schema": "0.5.3-main.e76d664",
34
+ "@dxos/log": "0.5.3-main.e76d664",
35
+ "@dxos/context": "0.5.3-main.e76d664",
36
+ "@dxos/util": "0.5.3-main.e76d664",
37
+ "@dxos/node-std": "0.5.3-main.e76d664"
41
38
  },
42
39
  "devDependencies": {
43
40
  "@types/express": "^4.17.17",
44
- "@types/ws": "^7.4.0",
45
- "@dxos/agent": "0.5.3-main.d7fe7b5"
41
+ "@types/ws": "^7.4.0"
46
42
  },
47
43
  "publishConfig": {
48
44
  "access": "public"
49
45
  },
50
46
  "scripts": {
51
- "gen-schema": "ts-node ./tools/schema.ts",
52
- "prebuild": "pnpm gen-schema"
47
+ "schema": "ts-node ./tools/schema.ts"
53
48
  }
54
49
  }
@@ -1,24 +1,27 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
3
  "type": "object",
4
- "required": [],
4
+ "required": [
5
+ "functions",
6
+ "triggers"
7
+ ],
5
8
  "properties": {
6
9
  "functions": {
7
10
  "type": "array",
8
11
  "items": {
9
12
  "type": "object",
10
13
  "required": [
11
- "uri",
12
- "route",
14
+ "id",
15
+ "name",
13
16
  "handler"
14
17
  ],
15
18
  "properties": {
16
- "uri": {
19
+ "id": {
17
20
  "type": "string",
18
21
  "description": "a string",
19
22
  "title": "string"
20
23
  },
21
- "route": {
24
+ "name": {
22
25
  "type": "string",
23
26
  "description": "a string",
24
27
  "title": "string"
@@ -42,8 +45,7 @@
42
45
  "items": {
43
46
  "type": "object",
44
47
  "required": [
45
- "function",
46
- "spec"
48
+ "function"
47
49
  ],
48
50
  "properties": {
49
51
  "function": {
@@ -51,142 +53,113 @@
51
53
  "description": "Function ID/URI.",
52
54
  "title": "string"
53
55
  },
54
- "meta": {
56
+ "timer": {
55
57
  "type": "object",
56
- "required": [],
57
- "properties": {},
58
- "additionalProperties": {
59
- "$id": "/schemas/any",
60
- "title": "any"
61
- }
58
+ "required": [
59
+ "cron"
60
+ ],
61
+ "properties": {
62
+ "cron": {
63
+ "type": "string",
64
+ "description": "a string",
65
+ "title": "string"
66
+ }
67
+ },
68
+ "additionalProperties": false
62
69
  },
63
- "spec": {
64
- "anyOf": [
65
- {
70
+ "webhook": {
71
+ "type": "object",
72
+ "required": [
73
+ "port"
74
+ ],
75
+ "properties": {
76
+ "port": {
77
+ "type": "number",
78
+ "description": "a number",
79
+ "title": "number"
80
+ }
81
+ },
82
+ "additionalProperties": false
83
+ },
84
+ "websocket": {
85
+ "type": "object",
86
+ "required": [
87
+ "url"
88
+ ],
89
+ "properties": {
90
+ "url": {
91
+ "type": "string",
92
+ "description": "a string",
93
+ "title": "string"
94
+ },
95
+ "init": {
66
96
  "type": "object",
67
- "required": [
68
- "type",
69
- "cron"
70
- ],
71
- "properties": {
72
- "type": {
73
- "const": "timer"
97
+ "required": [],
98
+ "properties": {},
99
+ "additionalProperties": {
100
+ "$id": "/schemas/any",
101
+ "title": "any"
102
+ }
103
+ }
104
+ },
105
+ "additionalProperties": false
106
+ },
107
+ "subscription": {
108
+ "type": "object",
109
+ "required": [
110
+ "filter"
111
+ ],
112
+ "properties": {
113
+ "spaceKey": {
114
+ "type": "string",
115
+ "description": "a string",
116
+ "title": "string"
117
+ },
118
+ "filter": {
119
+ "type": "array",
120
+ "items": {
121
+ "type": "object",
122
+ "required": [
123
+ "type"
124
+ ],
125
+ "properties": {
126
+ "type": {
127
+ "type": "string",
128
+ "description": "a string",
129
+ "title": "string"
130
+ },
131
+ "props": {
132
+ "type": "object",
133
+ "required": [],
134
+ "properties": {},
135
+ "additionalProperties": {
136
+ "$id": "/schemas/any",
137
+ "title": "any"
138
+ }
139
+ }
74
140
  },
75
- "cron": {
76
- "type": "string",
77
- "description": "a string",
78
- "title": "string"
79
- }
80
- },
81
- "additionalProperties": false
141
+ "additionalProperties": false
142
+ }
82
143
  },
83
- {
144
+ "options": {
84
145
  "type": "object",
85
- "required": [
86
- "type",
87
- "method"
88
- ],
146
+ "required": [],
89
147
  "properties": {
90
- "type": {
91
- "const": "webhook"
148
+ "deep": {
149
+ "type": "boolean",
150
+ "description": "a boolean",
151
+ "title": "boolean"
92
152
  },
93
- "method": {
94
- "type": "string",
95
- "description": "a string",
96
- "title": "string"
97
- },
98
- "port": {
153
+ "delay": {
99
154
  "type": "number",
100
155
  "description": "a number",
101
156
  "title": "number"
102
157
  }
103
158
  },
104
159
  "additionalProperties": false
105
- },
106
- {
107
- "type": "object",
108
- "required": [
109
- "type",
110
- "url"
111
- ],
112
- "properties": {
113
- "type": {
114
- "const": "websocket"
115
- },
116
- "url": {
117
- "type": "string",
118
- "description": "a string",
119
- "title": "string"
120
- },
121
- "init": {
122
- "type": "object",
123
- "required": [],
124
- "properties": {},
125
- "additionalProperties": {
126
- "$id": "/schemas/any",
127
- "title": "any"
128
- }
129
- }
130
- },
131
- "additionalProperties": false
132
- },
133
- {
134
- "type": "object",
135
- "required": [
136
- "type",
137
- "filter"
138
- ],
139
- "properties": {
140
- "type": {
141
- "const": "subscription"
142
- },
143
- "filter": {
144
- "type": "array",
145
- "items": {
146
- "type": "object",
147
- "required": [
148
- "type"
149
- ],
150
- "properties": {
151
- "type": {
152
- "type": "string",
153
- "description": "a string",
154
- "title": "string"
155
- },
156
- "props": {
157
- "type": "object",
158
- "required": [],
159
- "properties": {},
160
- "additionalProperties": {
161
- "$id": "/schemas/any",
162
- "title": "any"
163
- }
164
- }
165
- },
166
- "additionalProperties": false
167
- }
168
- },
169
- "options": {
170
- "type": "object",
171
- "required": [],
172
- "properties": {
173
- "deep": {
174
- "type": "boolean",
175
- "description": "a boolean",
176
- "title": "boolean"
177
- },
178
- "delay": {
179
- "type": "number",
180
- "description": "a number",
181
- "title": "number"
182
- }
183
- },
184
- "additionalProperties": false
185
- }
186
- },
187
- "additionalProperties": false
188
160
  }
189
- ]
161
+ },
162
+ "additionalProperties": false
190
163
  }
191
164
  },
192
165
  "additionalProperties": false