@dxos/functions 0.5.3-main.f1ddd61 → 0.5.3-main.f752aaa

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { type Client } from '@dxos/client';
2
2
  import { type FunctionHandler } from '../handler';
3
- import { type FunctionDef, type FunctionManifest } from '../manifest';
3
+ import { type FunctionManifest } from '../types';
4
4
  export type DevServerOptions = {
5
5
  port?: number;
6
6
  directory: string;
@@ -24,7 +24,12 @@ export declare class DevServer {
24
24
  get endpoint(): string;
25
25
  get proxy(): string | undefined;
26
26
  get functions(): {
27
- def: FunctionDef;
27
+ def: {
28
+ readonly id: string;
29
+ readonly handler: string;
30
+ readonly name: string;
31
+ readonly description?: string | undefined;
32
+ };
28
33
  handler: FunctionHandler<any>;
29
34
  }[];
30
35
  initialize(): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"dev-server.d.ts","sourceRoot":"","sources":["../../../../src/runtime/dev-server.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C,OAAO,EAAwB,KAAK,eAAe,EAAiB,MAAM,YAAY,CAAC;AACvF,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEtE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,qBAAa,SAAS;IAYlB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAX3B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA2E;IAErG,OAAO,CAAC,OAAO,CAAC,CAAc;IAC9B,OAAO,CAAC,KAAK,CAAC,CAAS;IACvB,OAAO,CAAC,eAAe,CAAC,CAAS;IACjC,OAAO,CAAC,MAAM,CAAC,CAAS;IACxB,OAAO,CAAC,IAAI,CAAK;gBAIE,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,gBAAgB;IAG7C,IAAI,QAAQ,WAGX;IAED,IAAI,KAAK,uBAER;IAED,IAAI,SAAS;;;QAEZ;IAEK,UAAU;IAUV,KAAK;IAyCL,IAAI;IAqBV;;OAEG;YACW,KAAK;IAqBnB;;OAEG;YACW,OAAO;CAyBtB"}
1
+ {"version":3,"file":"dev-server.d.ts","sourceRoot":"","sources":["../../../../src/runtime/dev-server.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C,OAAO,EAAwB,KAAK,eAAe,EAAiB,MAAM,YAAY,CAAC;AACvF,OAAO,EAAoB,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEnE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,qBAAa,SAAS;IAYlB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAX3B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA2E;IAErG,OAAO,CAAC,OAAO,CAAC,CAAc;IAC9B,OAAO,CAAC,KAAK,CAAC,CAAS;IACvB,OAAO,CAAC,eAAe,CAAC,CAAS;IACjC,OAAO,CAAC,MAAM,CAAC,CAAS;IACxB,OAAO,CAAC,IAAI,CAAK;gBAIE,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,gBAAgB;IAG7C,IAAI,QAAQ,WAGX;IAED,IAAI,KAAK,uBAER;IAED,IAAI,SAAS;;;;;;;;QAEZ;IAEK,UAAU;IAUV,KAAK;IAyCL,IAAI;IAqBV;;OAEG;YACW,KAAK;IAqBnB;;OAEG;YACW,OAAO;CAyBtB"}
@@ -1,13 +1,13 @@
1
1
  import { type Client } from '@dxos/client';
2
2
  import { type FunctionSubscriptionEvent } from '../handler';
3
- import { type FunctionManifest } from '../manifest';
4
- type Callback = (data: FunctionSubscriptionEvent) => Promise<number>;
5
- type SchedulerOptions = {
3
+ import { type FunctionManifest } from '../types';
4
+ type Callback = (data: FunctionSubscriptionEvent) => Promise<void>;
5
+ export type SchedulerOptions = {
6
6
  endpoint?: string;
7
7
  callback?: Callback;
8
8
  };
9
9
  /**
10
- * Functions scheduler.
10
+ * The scheduler triggers function exectuion based on various triggers.
11
11
  */
12
12
  export declare class Scheduler {
13
13
  private readonly _client;
@@ -19,9 +19,23 @@ export declare class Scheduler {
19
19
  stop(): Promise<void>;
20
20
  private mount;
21
21
  private unmount;
22
+ private _execFunction;
23
+ /**
24
+ * Cron timer.
25
+ */
22
26
  private _createTimer;
27
+ /**
28
+ * Webhook.
29
+ */
30
+ private _createWebhook;
31
+ /**
32
+ * Websocket.
33
+ */
34
+ private _createWebsocket;
35
+ /**
36
+ * ECHO subscription.
37
+ */
23
38
  private _createSubscription;
24
- private _execFunction;
25
39
  }
26
40
  export {};
27
41
  //# sourceMappingURL=scheduler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scheduler.d.ts","sourceRoot":"","sources":["../../../../src/runtime/scheduler.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,MAAM,EAAkB,MAAM,cAAc,CAAC;AAO3D,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAoB,KAAK,gBAAgB,EAAkD,MAAM,aAAa,CAAC;AAEtH,KAAK,QAAQ,GAAG,CAAC,IAAI,EAAE,yBAAyB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAErE,KAAK,gBAAgB,GAAG;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB,CAAC;AAEF;;GAEG;AAEH,qBAAa,SAAS;IAQlB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAR3B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAG6B;gBAGlC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,gBAAgB,EAC3B,QAAQ,GAAE,gBAAqB;IAG5C,KAAK;IAWL,IAAI;YAMI,KAAK;YA0BL,OAAO;IASrB,OAAO,CAAC,YAAY;IA8BpB,OAAO,CAAC,mBAAmB;YAwDb,aAAa;CA0B5B"}
1
+ {"version":3,"file":"scheduler.d.ts","sourceRoot":"","sources":["../../../../src/runtime/scheduler.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,MAAM,EAAkB,MAAM,cAAc,CAAC;AAO3D,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAEL,KAAK,gBAAgB,EAMtB,MAAM,UAAU,CAAC;AAElB,KAAK,QAAQ,GAAG,CAAC,IAAI,EAAE,yBAAyB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,qBAAa,SAAS;IAQlB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAR3B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAG6B;gBAGlC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,gBAAgB,EAC3B,QAAQ,GAAE,gBAAqB;IAG5C,KAAK;IAWL,IAAI;YAMI,KAAK;YAoCL,OAAO;YAUP,aAAa;IA4B3B;;OAEG;YACW,YAAY;IA8B1B;;OAEG;YACW,cAAc;IAkB5B;;OAEG;YACW,gBAAgB;IAmE9B;;OAEG;YACW,mBAAmB;CAqDlC"}
@@ -0,0 +1,160 @@
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
+ }>;
16
+ declare const SubscriptionTriggerSchema: S.struct<{
17
+ spaceKey: S.PropertySignature<"?:", string | undefined, never, "?:", string | undefined, never>;
18
+ filter: S.array<S.struct<{
19
+ type: S.$string;
20
+ props: S.PropertySignature<"?:", {
21
+ readonly [x: string]: any;
22
+ } | undefined, never, "?:", {
23
+ readonly [x: string]: any;
24
+ } | undefined, never>;
25
+ }>>;
26
+ options: S.PropertySignature<"?:", {
27
+ readonly deep?: boolean | undefined;
28
+ readonly delay?: number | undefined;
29
+ } | undefined, never, "?:", {
30
+ readonly deep?: boolean | undefined;
31
+ readonly delay?: number | undefined;
32
+ } | undefined, never>;
33
+ }>;
34
+ declare const FunctionTriggerSchema: S.struct<{
35
+ function: S.$string;
36
+ timer: S.PropertySignature<"?:", {
37
+ readonly cron: string;
38
+ } | undefined, never, "?:", {
39
+ readonly cron: string;
40
+ } | undefined, never>;
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<"?:", {
58
+ readonly filter: readonly {
59
+ readonly type: string;
60
+ readonly props?: {
61
+ readonly [x: string]: any;
62
+ } | undefined;
63
+ }[];
64
+ readonly spaceKey?: string | undefined;
65
+ readonly options?: {
66
+ readonly deep?: boolean | undefined;
67
+ readonly delay?: number | undefined;
68
+ } | undefined;
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;
80
+ } | undefined;
81
+ } | undefined, never>;
82
+ }>;
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>;
98
+ /**
99
+ * Function manifest file.
100
+ */
101
+ export declare const FunctionManifestSchema: S.struct<{
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<"?:", {
132
+ readonly filter: readonly {
133
+ readonly type: string;
134
+ readonly props?: {
135
+ readonly [x: string]: any;
136
+ } | undefined;
137
+ }[];
138
+ readonly spaceKey?: string | undefined;
139
+ readonly options?: {
140
+ readonly deep?: boolean | undefined;
141
+ readonly delay?: number | undefined;
142
+ } | undefined;
143
+ } | undefined, never, "?:", {
144
+ readonly filter: readonly {
145
+ readonly type: string;
146
+ readonly props?: {
147
+ readonly [x: string]: any;
148
+ } | undefined;
149
+ }[];
150
+ readonly spaceKey?: string | undefined;
151
+ readonly options?: {
152
+ readonly deep?: boolean | undefined;
153
+ readonly delay?: number | undefined;
154
+ } | undefined;
155
+ } | undefined, never>;
156
+ }>>>;
157
+ }>;
158
+ export type FunctionManifest = S.Schema.Type<typeof FunctionManifestSchema>;
159
+ export {};
160
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../tools/schema.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/functions",
3
- "version": "0.5.3-main.f1ddd61",
3
+ "version": "0.5.3-main.f752aaa",
4
4
  "description": "Functions SDK and runtime.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -16,27 +16,34 @@
16
16
  "types": "dist/types/src/index.d.ts",
17
17
  "files": [
18
18
  "dist",
19
+ "schema",
19
20
  "src"
20
21
  ],
21
22
  "dependencies": {
23
+ "@effect/schema": "0.64.7",
22
24
  "@preact/signals-core": "^1.6.0",
23
25
  "cron": "^3.1.6",
24
26
  "express": "^4.19.2",
25
27
  "get-port-please": "^3.1.1",
26
- "@dxos/async": "0.5.3-main.f1ddd61",
27
- "@braneframe/types": "0.5.3-main.f1ddd61",
28
- "@dxos/client": "0.5.3-main.f1ddd61",
29
- "@dxos/context": "0.5.3-main.f1ddd61",
30
- "@dxos/echo-schema": "0.5.3-main.f1ddd61",
31
- "@dxos/invariant": "0.5.3-main.f1ddd61",
32
- "@dxos/log": "0.5.3-main.f1ddd61",
33
- "@dxos/node-std": "0.5.3-main.f1ddd61",
34
- "@dxos/util": "0.5.3-main.f1ddd61"
28
+ "ws": "^8.14.2",
29
+ "@braneframe/types": "0.5.3-main.f752aaa",
30
+ "@dxos/async": "0.5.3-main.f752aaa",
31
+ "@dxos/client": "0.5.3-main.f752aaa",
32
+ "@dxos/echo-schema": "0.5.3-main.f752aaa",
33
+ "@dxos/invariant": "0.5.3-main.f752aaa",
34
+ "@dxos/context": "0.5.3-main.f752aaa",
35
+ "@dxos/log": "0.5.3-main.f752aaa",
36
+ "@dxos/node-std": "0.5.3-main.f752aaa",
37
+ "@dxos/util": "0.5.3-main.f752aaa"
35
38
  },
36
39
  "devDependencies": {
37
- "@types/express": "^4.17.17"
40
+ "@types/express": "^4.17.17",
41
+ "@types/ws": "^7.4.0"
38
42
  },
39
43
  "publishConfig": {
40
44
  "access": "public"
45
+ },
46
+ "scripts": {
47
+ "schema": "ts-node ./tools/schema.ts"
41
48
  }
42
49
  }
@@ -0,0 +1,170 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "required": [
5
+ "functions",
6
+ "triggers"
7
+ ],
8
+ "properties": {
9
+ "functions": {
10
+ "type": "array",
11
+ "items": {
12
+ "type": "object",
13
+ "required": [
14
+ "id",
15
+ "name",
16
+ "handler"
17
+ ],
18
+ "properties": {
19
+ "id": {
20
+ "type": "string",
21
+ "description": "a string",
22
+ "title": "string"
23
+ },
24
+ "name": {
25
+ "type": "string",
26
+ "description": "a string",
27
+ "title": "string"
28
+ },
29
+ "handler": {
30
+ "type": "string",
31
+ "description": "a string",
32
+ "title": "string"
33
+ },
34
+ "description": {
35
+ "type": "string",
36
+ "description": "a string",
37
+ "title": "string"
38
+ }
39
+ },
40
+ "additionalProperties": false
41
+ }
42
+ },
43
+ "triggers": {
44
+ "type": "array",
45
+ "items": {
46
+ "type": "object",
47
+ "required": [
48
+ "function"
49
+ ],
50
+ "properties": {
51
+ "function": {
52
+ "type": "string",
53
+ "description": "Function ID/URI.",
54
+ "title": "string"
55
+ },
56
+ "timer": {
57
+ "type": "object",
58
+ "required": [
59
+ "cron"
60
+ ],
61
+ "properties": {
62
+ "cron": {
63
+ "type": "string",
64
+ "description": "a string",
65
+ "title": "string"
66
+ }
67
+ },
68
+ "additionalProperties": false
69
+ },
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": {
96
+ "type": "object",
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
+ }
140
+ },
141
+ "additionalProperties": false
142
+ }
143
+ },
144
+ "options": {
145
+ "type": "object",
146
+ "required": [],
147
+ "properties": {
148
+ "deep": {
149
+ "type": "boolean",
150
+ "description": "a boolean",
151
+ "title": "boolean"
152
+ },
153
+ "delay": {
154
+ "type": "number",
155
+ "description": "a number",
156
+ "title": "number"
157
+ }
158
+ },
159
+ "additionalProperties": false
160
+ }
161
+ },
162
+ "additionalProperties": false
163
+ }
164
+ },
165
+ "additionalProperties": false
166
+ }
167
+ }
168
+ },
169
+ "additionalProperties": false
170
+ }
package/src/handler.ts CHANGED
@@ -8,6 +8,12 @@ import { type EchoReactiveObject } from '@dxos/echo-schema';
8
8
  import { log } from '@dxos/log';
9
9
  import { nonNullable } from '@dxos/util';
10
10
 
11
+ // TODO(burdon): Context?
12
+ // Lambda-like function definitions.
13
+ // See: https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml/#functions
14
+ // https://www.npmjs.com/package/aws-lambda
15
+ // https://docs.aws.amazon.com/lambda/latest/dg/typescript-handler.html
16
+
11
17
  // TODO(burdon): No response?
12
18
  export interface Response {
13
19
  status(code: number): Response;
@@ -32,6 +38,7 @@ export type FunctionSubscriptionEvent = {
32
38
  objects?: string[];
33
39
  };
34
40
 
41
+ // TODO(burdon): ???
35
42
  export type FunctionSubscriptionEvent2 = {
36
43
  space?: Space;
37
44
  objects?: EchoReactiveObject<any>[];
package/src/index.ts CHANGED
@@ -3,5 +3,5 @@
3
3
  //
4
4
 
5
5
  export * from './handler';
6
- export * from './manifest';
7
6
  export * from './runtime';
7
+ export * from './types';
@@ -13,7 +13,7 @@ import { invariant } from '@dxos/invariant';
13
13
  import { log } from '@dxos/log';
14
14
 
15
15
  import { type FunctionContext, type FunctionHandler, type Response } from '../handler';
16
- import { type FunctionDef, type FunctionManifest } from '../manifest';
16
+ import { type FunctionDef, type FunctionManifest } from '../types';
17
17
 
18
18
  export type DevServerOptions = {
19
19
  port?: number;