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

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 (92) hide show
  1. package/dist/lib/browser/chunk-4D4I3YMJ.mjs +86 -0
  2. package/dist/lib/browser/chunk-4D4I3YMJ.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +884 -457
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/types.mjs +14 -0
  7. package/dist/lib/browser/types.mjs.map +7 -0
  8. package/dist/lib/node/chunk-3UYUR5N5.cjs +103 -0
  9. package/dist/lib/node/chunk-3UYUR5N5.cjs.map +7 -0
  10. package/dist/lib/node/index.cjs +868 -447
  11. package/dist/lib/node/index.cjs.map +4 -4
  12. package/dist/lib/node/meta.json +1 -1
  13. package/dist/lib/node/types.cjs +35 -0
  14. package/dist/lib/node/types.cjs.map +7 -0
  15. package/dist/types/src/browser/index.d.ts +2 -0
  16. package/dist/types/src/browser/index.d.ts.map +1 -0
  17. package/dist/types/src/function/function-registry.d.ts +24 -0
  18. package/dist/types/src/function/function-registry.d.ts.map +1 -0
  19. package/dist/types/src/function/function-registry.test.d.ts +2 -0
  20. package/dist/types/src/function/function-registry.test.d.ts.map +1 -0
  21. package/dist/types/src/function/index.d.ts +2 -0
  22. package/dist/types/src/function/index.d.ts.map +1 -0
  23. package/dist/types/src/handler.d.ts +33 -12
  24. package/dist/types/src/handler.d.ts.map +1 -1
  25. package/dist/types/src/index.d.ts +2 -0
  26. package/dist/types/src/index.d.ts.map +1 -1
  27. package/dist/types/src/runtime/dev-server.d.ts +16 -13
  28. package/dist/types/src/runtime/dev-server.d.ts.map +1 -1
  29. package/dist/types/src/runtime/dev-server.test.d.ts +2 -0
  30. package/dist/types/src/runtime/dev-server.test.d.ts.map +1 -0
  31. package/dist/types/src/runtime/scheduler.d.ts +13 -27
  32. package/dist/types/src/runtime/scheduler.d.ts.map +1 -1
  33. package/dist/types/src/testing/functions-integration.test.d.ts +2 -0
  34. package/dist/types/src/testing/functions-integration.test.d.ts.map +1 -0
  35. package/dist/types/src/testing/index.d.ts +4 -0
  36. package/dist/types/src/testing/index.d.ts.map +1 -0
  37. package/dist/types/src/testing/setup.d.ts +5 -0
  38. package/dist/types/src/testing/setup.d.ts.map +1 -0
  39. package/dist/types/src/testing/test/handler.d.ts +4 -0
  40. package/dist/types/src/testing/test/handler.d.ts.map +1 -0
  41. package/dist/types/src/testing/test/index.d.ts +3 -0
  42. package/dist/types/src/testing/test/index.d.ts.map +1 -0
  43. package/dist/types/src/testing/types.d.ts +9 -0
  44. package/dist/types/src/testing/types.d.ts.map +1 -0
  45. package/dist/types/src/testing/util.d.ts +3 -0
  46. package/dist/types/src/testing/util.d.ts.map +1 -0
  47. package/dist/types/src/trigger/index.d.ts +2 -0
  48. package/dist/types/src/trigger/index.d.ts.map +1 -0
  49. package/dist/types/src/trigger/trigger-registry.d.ts +37 -0
  50. package/dist/types/src/trigger/trigger-registry.d.ts.map +1 -0
  51. package/dist/types/src/trigger/trigger-registry.test.d.ts +2 -0
  52. package/dist/types/src/trigger/trigger-registry.test.d.ts.map +1 -0
  53. package/dist/types/src/trigger/type/index.d.ts +5 -0
  54. package/dist/types/src/trigger/type/index.d.ts.map +1 -0
  55. package/dist/types/src/trigger/type/subscription-trigger.d.ts +4 -0
  56. package/dist/types/src/trigger/type/subscription-trigger.d.ts.map +1 -0
  57. package/dist/types/src/trigger/type/timer-trigger.d.ts +4 -0
  58. package/dist/types/src/trigger/type/timer-trigger.d.ts.map +1 -0
  59. package/dist/types/src/trigger/type/webhook-trigger.d.ts +4 -0
  60. package/dist/types/src/trigger/type/webhook-trigger.d.ts.map +1 -0
  61. package/dist/types/src/trigger/type/websocket-trigger.d.ts +13 -0
  62. package/dist/types/src/trigger/type/websocket-trigger.d.ts.map +1 -0
  63. package/dist/types/src/types.d.ts +162 -107
  64. package/dist/types/src/types.d.ts.map +1 -1
  65. package/package.json +33 -15
  66. package/schema/functions.json +144 -103
  67. package/src/browser/index.ts +5 -0
  68. package/src/function/function-registry.test.ts +105 -0
  69. package/src/function/function-registry.ts +90 -0
  70. package/src/function/index.ts +5 -0
  71. package/src/handler.ts +54 -31
  72. package/src/index.ts +2 -0
  73. package/src/runtime/dev-server.test.ts +60 -0
  74. package/src/runtime/dev-server.ts +104 -53
  75. package/src/runtime/scheduler.test.ts +61 -73
  76. package/src/runtime/scheduler.ts +91 -270
  77. package/src/testing/functions-integration.test.ts +100 -0
  78. package/src/testing/index.ts +7 -0
  79. package/src/testing/setup.ts +43 -0
  80. package/src/testing/test/handler.ts +15 -0
  81. package/src/testing/test/index.ts +7 -0
  82. package/src/testing/types.ts +9 -0
  83. package/src/testing/util.ts +16 -0
  84. package/src/trigger/index.ts +5 -0
  85. package/src/trigger/trigger-registry.test.ts +272 -0
  86. package/src/trigger/trigger-registry.ts +211 -0
  87. package/src/trigger/type/index.ts +8 -0
  88. package/src/trigger/type/subscription-trigger.ts +86 -0
  89. package/src/trigger/type/timer-trigger.ts +45 -0
  90. package/src/trigger/type/webhook-trigger.ts +48 -0
  91. package/src/trigger/type/websocket-trigger.ts +92 -0
  92. package/src/types.ts +87 -48
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dxos/functions",
3
- "version": "0.5.3-main.f752aaa",
4
- "description": "Functions SDK and runtime.",
3
+ "version": "0.5.3-main.fffc127",
4
+ "description": "Functions API and runtime.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
7
7
  "license": "MIT",
@@ -10,40 +10,58 @@
10
10
  ".": {
11
11
  "browser": "./dist/lib/browser/index.mjs",
12
12
  "node": "./dist/lib/node/index.cjs",
13
- "default": "./dist/lib/node/index.cjs"
13
+ "default": "./dist/lib/node/index.cjs",
14
+ "types": "./dist/types/src/index.d.ts"
15
+ },
16
+ "./types": {
17
+ "browser": "./dist/lib/browser/types.mjs",
18
+ "node": "./dist/lib/node/types.cjs",
19
+ "default": "./dist/lib/node/types.cjs",
20
+ "types": "./dist/types/src/types.d.ts"
14
21
  }
15
22
  },
16
23
  "types": "dist/types/src/index.d.ts",
24
+ "typesVersions": {
25
+ "*": {
26
+ "types": [
27
+ "dist/types/src/types.d.ts"
28
+ ]
29
+ }
30
+ },
17
31
  "files": [
18
32
  "dist",
19
33
  "schema",
20
34
  "src"
21
35
  ],
22
36
  "dependencies": {
23
- "@effect/schema": "0.64.7",
24
37
  "@preact/signals-core": "^1.6.0",
25
38
  "cron": "^3.1.6",
39
+ "effect": "^2.4.19",
26
40
  "express": "^4.19.2",
27
41
  "get-port-please": "^3.1.1",
28
42
  "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"
43
+ "@braneframe/types": "0.5.3-main.fffc127",
44
+ "@dxos/async": "0.5.3-main.fffc127",
45
+ "@dxos/client": "0.5.3-main.fffc127",
46
+ "@dxos/context": "0.5.3-main.fffc127",
47
+ "@dxos/echo-schema": "0.5.3-main.fffc127",
48
+ "@dxos/invariant": "0.5.3-main.fffc127",
49
+ "@dxos/keys": "0.5.3-main.fffc127",
50
+ "@dxos/echo-db": "0.5.3-main.fffc127",
51
+ "@dxos/node-std": "0.5.3-main.fffc127",
52
+ "@dxos/log": "0.5.3-main.fffc127",
53
+ "@dxos/protocols": "0.5.3-main.fffc127",
54
+ "@dxos/util": "0.5.3-main.fffc127"
38
55
  },
39
56
  "devDependencies": {
40
57
  "@types/express": "^4.17.17",
41
- "@types/ws": "^7.4.0"
58
+ "@types/ws": "^7.4.0",
59
+ "@dxos/agent": "0.5.3-main.fffc127"
42
60
  },
43
61
  "publishConfig": {
44
62
  "access": "public"
45
63
  },
46
64
  "scripts": {
47
- "schema": "ts-node ./tools/schema.ts"
65
+ "gen-schema": "ts-node ./tools/schema.ts"
48
66
  }
49
67
  }
@@ -1,27 +1,24 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
3
  "type": "object",
4
- "required": [
5
- "functions",
6
- "triggers"
7
- ],
4
+ "required": [],
8
5
  "properties": {
9
6
  "functions": {
10
7
  "type": "array",
11
8
  "items": {
12
9
  "type": "object",
13
10
  "required": [
14
- "id",
15
- "name",
11
+ "uri",
12
+ "route",
16
13
  "handler"
17
14
  ],
18
15
  "properties": {
19
- "id": {
16
+ "uri": {
20
17
  "type": "string",
21
18
  "description": "a string",
22
19
  "title": "string"
23
20
  },
24
- "name": {
21
+ "route": {
25
22
  "type": "string",
26
23
  "description": "a string",
27
24
  "title": "string"
@@ -45,126 +42,170 @@
45
42
  "items": {
46
43
  "type": "object",
47
44
  "required": [
48
- "function"
45
+ "function",
46
+ "spec"
49
47
  ],
50
48
  "properties": {
51
49
  "function": {
52
50
  "type": "string",
53
- "description": "Function ID/URI.",
51
+ "description": "Function URI.",
54
52
  "title": "string"
55
53
  },
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
54
+ "enabled": {
55
+ "type": "boolean",
56
+ "description": "a boolean",
57
+ "title": "boolean"
69
58
  },
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
59
+ "meta": {
60
+ "$ref": "#/$defs/object"
83
61
  },
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": {
62
+ "spec": {
63
+ "anyOf": [
64
+ {
96
65
  "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
- }
66
+ "required": [
67
+ "type",
68
+ "cron"
69
+ ],
70
+ "properties": {
71
+ "type": {
72
+ "const": "timer"
140
73
  },
141
- "additionalProperties": false
142
- }
74
+ "cron": {
75
+ "type": "string",
76
+ "description": "a string",
77
+ "title": "string"
78
+ }
79
+ },
80
+ "additionalProperties": false
143
81
  },
144
- "options": {
82
+ {
145
83
  "type": "object",
146
- "required": [],
84
+ "required": [
85
+ "type",
86
+ "method"
87
+ ],
147
88
  "properties": {
148
- "deep": {
149
- "type": "boolean",
150
- "description": "a boolean",
151
- "title": "boolean"
89
+ "type": {
90
+ "const": "webhook"
91
+ },
92
+ "method": {
93
+ "type": "string",
94
+ "description": "a string",
95
+ "title": "string"
152
96
  },
153
- "delay": {
97
+ "port": {
154
98
  "type": "number",
155
99
  "description": "a number",
156
100
  "title": "number"
157
101
  }
158
102
  },
159
103
  "additionalProperties": false
104
+ },
105
+ {
106
+ "type": "object",
107
+ "required": [
108
+ "type",
109
+ "url"
110
+ ],
111
+ "properties": {
112
+ "type": {
113
+ "const": "websocket"
114
+ },
115
+ "url": {
116
+ "type": "string",
117
+ "description": "a string",
118
+ "title": "string"
119
+ },
120
+ "init": {
121
+ "type": "object",
122
+ "required": [],
123
+ "properties": {},
124
+ "additionalProperties": {
125
+ "$id": "/schemas/any",
126
+ "title": "any"
127
+ }
128
+ }
129
+ },
130
+ "additionalProperties": false
131
+ },
132
+ {
133
+ "type": "object",
134
+ "required": [
135
+ "type",
136
+ "filter"
137
+ ],
138
+ "properties": {
139
+ "type": {
140
+ "const": "subscription"
141
+ },
142
+ "filter": {
143
+ "type": "array",
144
+ "items": {
145
+ "type": "object",
146
+ "required": [
147
+ "type"
148
+ ],
149
+ "properties": {
150
+ "type": {
151
+ "type": "string",
152
+ "description": "a string",
153
+ "title": "string"
154
+ },
155
+ "props": {
156
+ "type": "object",
157
+ "required": [],
158
+ "properties": {},
159
+ "additionalProperties": {
160
+ "$id": "/schemas/any",
161
+ "title": "any"
162
+ }
163
+ }
164
+ },
165
+ "additionalProperties": false
166
+ }
167
+ },
168
+ "options": {
169
+ "type": "object",
170
+ "required": [],
171
+ "properties": {
172
+ "deep": {
173
+ "type": "boolean",
174
+ "description": "a boolean",
175
+ "title": "boolean"
176
+ },
177
+ "delay": {
178
+ "type": "number",
179
+ "description": "a number",
180
+ "title": "number"
181
+ }
182
+ },
183
+ "additionalProperties": false
184
+ }
185
+ },
186
+ "additionalProperties": false
160
187
  }
161
- },
162
- "additionalProperties": false
188
+ ]
163
189
  }
164
190
  },
165
191
  "additionalProperties": false
166
192
  }
167
193
  }
168
194
  },
169
- "additionalProperties": false
195
+ "additionalProperties": false,
196
+ "$defs": {
197
+ "object": {
198
+ "$id": "/schemas/object",
199
+ "oneOf": [
200
+ {
201
+ "type": "object"
202
+ },
203
+ {
204
+ "type": "array"
205
+ }
206
+ ],
207
+ "description": "an object in the TypeScript meaning, i.e. the `object` type",
208
+ "title": "object"
209
+ }
210
+ }
170
211
  }
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ export * from '../types';
@@ -0,0 +1,105 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { expect } from 'chai';
6
+
7
+ import { Trigger } from '@dxos/async';
8
+ import { type Client } from '@dxos/client';
9
+ import { TestBuilder } from '@dxos/client/testing';
10
+ import { Context } from '@dxos/context';
11
+ import { Filter } from '@dxos/echo-db';
12
+ import { create } from '@dxos/echo-schema';
13
+ import { describe, test } from '@dxos/test';
14
+ import { range } from '@dxos/util';
15
+
16
+ import { FunctionRegistry } from './function-registry';
17
+ import { createInitializedClients } from '../testing';
18
+ import { FunctionDef, type FunctionManifest } from '../types';
19
+
20
+ const testManifest: FunctionManifest = {
21
+ functions: [
22
+ {
23
+ uri: 'dxos.functions.test/hello',
24
+ route: '/hello',
25
+ handler: 'test',
26
+ },
27
+ ],
28
+ };
29
+
30
+ describe('function registry', () => {
31
+ let ctx: Context;
32
+ let testBuilder: TestBuilder;
33
+ beforeEach(async () => {
34
+ ctx = new Context();
35
+ testBuilder = new TestBuilder();
36
+ });
37
+ afterEach(async () => {
38
+ await ctx.dispose();
39
+ await testBuilder.destroy();
40
+ });
41
+
42
+ describe('register', () => {
43
+ test('creates new functions', async () => {
44
+ const client = (await createInitializedClients(testBuilder))[0];
45
+ const registry = createRegistry(client);
46
+ const space = await client.spaces.create();
47
+ await registry.register(space, testManifest.functions);
48
+ const { objects: definitions } = await space.db.query(Filter.schema(FunctionDef)).run();
49
+ expect(definitions.length).to.eq(1);
50
+ expect(definitions[0].uri).to.eq(testManifest.functions?.[0]?.uri);
51
+ });
52
+
53
+ test('de-duplicates by function URI', async () => {
54
+ const client = (await createInitializedClients(testBuilder))[0];
55
+ const registry = createRegistry(client);
56
+ const space = await client.spaces.create();
57
+ const existing = space.db.add(create(FunctionDef, testManifest.functions![0]));
58
+ await registry.register(space, testManifest.functions);
59
+ const { objects: definitions } = await space.db.query(Filter.schema(FunctionDef)).run();
60
+ expect(definitions.length).to.eq(1);
61
+ expect(definitions[0].uri).to.eq(existing.uri);
62
+ });
63
+ });
64
+
65
+ describe('onFunctionsRegistered', () => {
66
+ test('called with all registered when opened', async () => {
67
+ const client = (await createInitializedClients(testBuilder))[0];
68
+ const registry = createRegistry(client);
69
+ const space = await client.spaces.create();
70
+ const definitions = range(3, () => create(FunctionDef, testManifest.functions![0]));
71
+ definitions.forEach((def) => space.db.add(def));
72
+
73
+ const functionRegistered = new Trigger<FunctionDef[]>();
74
+ registry.registered.on((fn) => {
75
+ functionRegistered.wake(fn.added);
76
+ });
77
+ void registry.open(ctx);
78
+ const functions = await functionRegistered.wait();
79
+ const expected = definitions.map((def) => def.uri).sort();
80
+ expect(functions.map((fn) => fn.uri).sort()).to.deep.eq(expected);
81
+ });
82
+
83
+ test('called when a new functions is added', async () => {
84
+ const client = (await createInitializedClients(testBuilder))[0];
85
+ const registry = createRegistry(client);
86
+ const space = await client.spaces.create();
87
+
88
+ const functionRegistered = new Trigger<FunctionDef>();
89
+ registry.registered.on((fn) => {
90
+ expect(fn.added.length).to.eq(1);
91
+ functionRegistered.wake(fn.added[0]);
92
+ });
93
+ await registry.open(ctx);
94
+ await registry.register(space, testManifest.functions);
95
+ const registered = await functionRegistered.wait();
96
+ expect(registered.uri).to.eq(testManifest.functions![0].uri);
97
+ });
98
+ });
99
+
100
+ const createRegistry = (client: Client) => {
101
+ const registry = new FunctionRegistry(client);
102
+ ctx.onDispose(() => registry.close());
103
+ return registry;
104
+ };
105
+ });
@@ -0,0 +1,90 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import { Event } from '@dxos/async';
6
+ import { type Client } from '@dxos/client';
7
+ import { create, Filter, type Space } from '@dxos/client/echo';
8
+ import { type Context, Resource } from '@dxos/context';
9
+ import { PublicKey } from '@dxos/keys';
10
+ import { log } from '@dxos/log';
11
+ import { ComplexMap, diff } from '@dxos/util';
12
+
13
+ import { FunctionDef, type FunctionManifest } from '../types';
14
+
15
+ export type FunctionsRegisteredEvent = {
16
+ space: Space;
17
+ added: FunctionDef[];
18
+ };
19
+
20
+ export class FunctionRegistry extends Resource {
21
+ private readonly _functionBySpaceKey = new ComplexMap<PublicKey, FunctionDef[]>(PublicKey.hash);
22
+
23
+ public readonly registered = new Event<FunctionsRegisteredEvent>();
24
+
25
+ constructor(private readonly _client: Client) {
26
+ super();
27
+ }
28
+
29
+ public getFunctions(space: Space): FunctionDef[] {
30
+ return this._functionBySpaceKey.get(space.key) ?? [];
31
+ }
32
+
33
+ /**
34
+ * Loads function definitions from the manifest into the space.
35
+ * We first load all the definitions from the space to deduplicate by functionId.
36
+ */
37
+ public async register(space: Space, functions: FunctionManifest['functions']): Promise<void> {
38
+ log('register', { space: space.key, functions: functions?.length ?? 0 });
39
+ if (!functions?.length) {
40
+ return;
41
+ }
42
+ if (!space.db.graph.runtimeSchemaRegistry.hasSchema(FunctionDef)) {
43
+ space.db.graph.runtimeSchemaRegistry.registerSchema(FunctionDef);
44
+ }
45
+
46
+ // Sync definitions.
47
+ const { objects: existing } = await space.db.query(Filter.schema(FunctionDef)).run();
48
+ const { added } = diff(existing, functions, (a, b) => a.uri === b.uri);
49
+ // TODO(burdon): Update existing templates.
50
+ added.forEach((def) => space.db.add(create(FunctionDef, def)));
51
+ }
52
+
53
+ protected override async _open(): Promise<void> {
54
+ log.info('opening...');
55
+ const spacesSubscription = this._client.spaces.subscribe(async (spaces) => {
56
+ for (const space of spaces) {
57
+ if (this._functionBySpaceKey.has(space.key)) {
58
+ continue;
59
+ }
60
+
61
+ const registered: FunctionDef[] = [];
62
+ this._functionBySpaceKey.set(space.key, registered);
63
+ await space.waitUntilReady();
64
+ if (this._ctx.disposed) {
65
+ break;
66
+ }
67
+
68
+ // Subscribe to updates.
69
+ this._ctx.onDispose(
70
+ space.db.query(Filter.schema(FunctionDef)).subscribe(({ objects }) => {
71
+ const { added } = diff(registered, objects, (a, b) => a.uri === b.uri);
72
+ // TODO(burdon): Update and remove.
73
+ if (added.length > 0) {
74
+ registered.push(...added);
75
+ this.registered.emit({ space, added });
76
+ }
77
+ }),
78
+ );
79
+ }
80
+ });
81
+
82
+ // TODO(burdon): API: Normalize unsubscribe methods.
83
+ this._ctx.onDispose(() => spacesSubscription.unsubscribe());
84
+ }
85
+
86
+ protected override async _close(_: Context): Promise<void> {
87
+ log.info('closing...');
88
+ this._functionBySpaceKey.clear();
89
+ }
90
+ }
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ export * from './function-registry';