@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
|
@@ -26,15 +26,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_RPHL3ORN_exports = {};
|
|
30
|
+
__export(chunk_RPHL3ORN_exports, {
|
|
31
31
|
DevServer: () => DevServer,
|
|
32
32
|
FunctionRegistry: () => FunctionRegistry,
|
|
33
33
|
Scheduler: () => Scheduler,
|
|
34
34
|
TriggerRegistry: () => TriggerRegistry
|
|
35
35
|
});
|
|
36
|
-
module.exports = __toCommonJS(
|
|
37
|
-
var
|
|
36
|
+
module.exports = __toCommonJS(chunk_RPHL3ORN_exports);
|
|
37
|
+
var import_chunk_BLLSDTKZ = require("./chunk-BLLSDTKZ.cjs");
|
|
38
38
|
var import_async = require("@dxos/async");
|
|
39
39
|
var import_echo = require("@dxos/client/echo");
|
|
40
40
|
var import_context = require("@dxos/context");
|
|
@@ -113,12 +113,12 @@ var FunctionRegistry = class extends import_context.Resource {
|
|
|
113
113
|
if (!functions?.length) {
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
|
-
if (!space.db.graph.runtimeSchemaRegistry.hasSchema(
|
|
117
|
-
space.db.graph.runtimeSchemaRegistry.registerSchema(
|
|
116
|
+
if (!space.db.graph.runtimeSchemaRegistry.hasSchema(import_chunk_BLLSDTKZ.FunctionDef)) {
|
|
117
|
+
space.db.graph.runtimeSchemaRegistry.registerSchema(import_chunk_BLLSDTKZ.FunctionDef);
|
|
118
118
|
}
|
|
119
|
-
const { objects: existing } = await space.db.query(import_echo.Filter.schema(
|
|
119
|
+
const { objects: existing } = await space.db.query(import_echo.Filter.schema(import_chunk_BLLSDTKZ.FunctionDef)).run();
|
|
120
120
|
const { added } = (0, import_util.diff)(existing, functions, (a, b) => a.uri === b.uri);
|
|
121
|
-
added.forEach((def) => space.db.add((0, import_echo.create)(
|
|
121
|
+
added.forEach((def) => space.db.add((0, import_echo.create)(import_chunk_BLLSDTKZ.FunctionDef, def)));
|
|
122
122
|
}
|
|
123
123
|
async _open() {
|
|
124
124
|
import_log.log.info("opening...", void 0, {
|
|
@@ -138,7 +138,7 @@ var FunctionRegistry = class extends import_context.Resource {
|
|
|
138
138
|
if (this._ctx.disposed) {
|
|
139
139
|
break;
|
|
140
140
|
}
|
|
141
|
-
this._ctx.onDispose(space.db.query(import_echo.Filter.schema(
|
|
141
|
+
this._ctx.onDispose(space.db.query(import_echo.Filter.schema(import_chunk_BLLSDTKZ.FunctionDef)).subscribe(({ objects }) => {
|
|
142
142
|
const { added } = (0, import_util.diff)(registered, objects, (a, b) => a.uri === b.uri);
|
|
143
143
|
if (added.length > 0) {
|
|
144
144
|
registered.push(...added);
|
|
@@ -368,11 +368,11 @@ var DevServer = class {
|
|
|
368
368
|
C: (f, a) => f(...a)
|
|
369
369
|
});
|
|
370
370
|
if (force) {
|
|
371
|
-
Object.keys(
|
|
372
|
-
delete
|
|
371
|
+
Object.keys(import_chunk_BLLSDTKZ.__require.cache).filter((key) => key.startsWith(filePath)).forEach((key) => {
|
|
372
|
+
delete import_chunk_BLLSDTKZ.__require.cache[key];
|
|
373
373
|
});
|
|
374
374
|
}
|
|
375
|
-
const module2 = (0,
|
|
375
|
+
const module2 = (0, import_chunk_BLLSDTKZ.__require)(filePath);
|
|
376
376
|
if (typeof module2.default !== "function") {
|
|
377
377
|
throw new Error(`Handler must export default function: ${uri}`);
|
|
378
378
|
}
|
|
@@ -945,8 +945,8 @@ var TriggerRegistry = class extends import_context4.Resource {
|
|
|
945
945
|
if (!manifest.triggers?.length) {
|
|
946
946
|
return;
|
|
947
947
|
}
|
|
948
|
-
if (!space.db.graph.runtimeSchemaRegistry.hasSchema(
|
|
949
|
-
space.db.graph.runtimeSchemaRegistry.registerSchema(
|
|
948
|
+
if (!space.db.graph.runtimeSchemaRegistry.hasSchema(import_chunk_BLLSDTKZ.FunctionTrigger)) {
|
|
949
|
+
space.db.graph.runtimeSchemaRegistry.registerSchema(import_chunk_BLLSDTKZ.FunctionTrigger);
|
|
950
950
|
}
|
|
951
951
|
const manifestTriggers = manifest.triggers.map((trigger) => {
|
|
952
952
|
let keys = trigger[import_echo_schema.ECHO_ATTR_META]?.keys;
|
|
@@ -959,11 +959,11 @@ var TriggerRegistry = class extends import_context4.Resource {
|
|
|
959
959
|
].join(":"))
|
|
960
960
|
];
|
|
961
961
|
}
|
|
962
|
-
return (0, import_echo2.create)(
|
|
962
|
+
return (0, import_echo2.create)(import_chunk_BLLSDTKZ.FunctionTrigger, trigger, {
|
|
963
963
|
keys
|
|
964
964
|
});
|
|
965
965
|
});
|
|
966
|
-
const { objects: existing } = await space.db.query(import_echo2.Filter.schema(
|
|
966
|
+
const { objects: existing } = await space.db.query(import_echo2.Filter.schema(import_chunk_BLLSDTKZ.FunctionTrigger)).run();
|
|
967
967
|
const { added } = (0, import_util2.diff)(existing, manifestTriggers, import_echo_schema.compareForeignKeys);
|
|
968
968
|
added.forEach((trigger) => {
|
|
969
969
|
space.db.add(trigger);
|
|
@@ -998,7 +998,7 @@ var TriggerRegistry = class extends import_context4.Resource {
|
|
|
998
998
|
if (this._ctx.disposed) {
|
|
999
999
|
break;
|
|
1000
1000
|
}
|
|
1001
|
-
this._ctx.onDispose(space.db.query(import_echo2.Filter.schema(
|
|
1001
|
+
this._ctx.onDispose(space.db.query(import_echo2.Filter.schema(import_chunk_BLLSDTKZ.FunctionTrigger)).subscribe(async ({ objects: current }) => {
|
|
1002
1002
|
import_log4.log.info("update", {
|
|
1003
1003
|
space: space.key,
|
|
1004
1004
|
registered: registered.length,
|
|
@@ -1099,4 +1099,4 @@ var TriggerRegistry = class extends import_context4.Resource {
|
|
|
1099
1099
|
Scheduler,
|
|
1100
1100
|
TriggerRegistry
|
|
1101
1101
|
});
|
|
1102
|
-
//# sourceMappingURL=chunk-
|
|
1102
|
+
//# sourceMappingURL=chunk-RPHL3ORN.cjs.map
|
package/dist/lib/node/index.cjs
CHANGED
|
@@ -18,19 +18,19 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var node_exports = {};
|
|
20
20
|
__export(node_exports, {
|
|
21
|
-
DevServer: () =>
|
|
22
|
-
FUNCTION_SCHEMA: () =>
|
|
23
|
-
FunctionDef: () =>
|
|
24
|
-
FunctionManifestSchema: () =>
|
|
25
|
-
FunctionRegistry: () =>
|
|
26
|
-
FunctionTrigger: () =>
|
|
27
|
-
Scheduler: () =>
|
|
28
|
-
TriggerRegistry: () =>
|
|
21
|
+
DevServer: () => import_chunk_RPHL3ORN.DevServer,
|
|
22
|
+
FUNCTION_SCHEMA: () => import_chunk_BLLSDTKZ.FUNCTION_SCHEMA,
|
|
23
|
+
FunctionDef: () => import_chunk_BLLSDTKZ.FunctionDef,
|
|
24
|
+
FunctionManifestSchema: () => import_chunk_BLLSDTKZ.FunctionManifestSchema,
|
|
25
|
+
FunctionRegistry: () => import_chunk_RPHL3ORN.FunctionRegistry,
|
|
26
|
+
FunctionTrigger: () => import_chunk_BLLSDTKZ.FunctionTrigger,
|
|
27
|
+
Scheduler: () => import_chunk_RPHL3ORN.Scheduler,
|
|
28
|
+
TriggerRegistry: () => import_chunk_RPHL3ORN.TriggerRegistry,
|
|
29
29
|
subscriptionHandler: () => subscriptionHandler
|
|
30
30
|
});
|
|
31
31
|
module.exports = __toCommonJS(node_exports);
|
|
32
|
-
var
|
|
33
|
-
var
|
|
32
|
+
var import_chunk_RPHL3ORN = require("./chunk-RPHL3ORN.cjs");
|
|
33
|
+
var import_chunk_BLLSDTKZ = require("./chunk-BLLSDTKZ.cjs");
|
|
34
34
|
var import_types = require("@braneframe/types");
|
|
35
35
|
var import_client = require("@dxos/client");
|
|
36
36
|
var import_log = require("@dxos/log");
|
package/dist/lib/node/meta.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/core/functions/src/types.ts":{"bytes":9711,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/function/function-registry.ts":{"bytes":12532,"imports":[{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/core/functions/src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/core/functions/src/function/index.ts":{"bytes":529,"imports":[{"path":"packages/core/functions/src/function/function-registry.ts","kind":"import-statement","original":"./function-registry"}],"format":"esm"},"packages/core/functions/src/handler.ts":{"bytes":9375,"imports":[{"path":"@braneframe/types","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/runtime/dev-server.ts":{"bytes":28578,"imports":[{"path":"express","kind":"import-statement","external":true},{"path":"get-port-please","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/runtime/scheduler.ts":{"bytes":18003,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/runtime/index.ts":{"bytes":598,"imports":[{"path":"packages/core/functions/src/runtime/dev-server.ts","kind":"import-statement","original":"./dev-server"},{"path":"packages/core/functions/src/runtime/scheduler.ts","kind":"import-statement","original":"./scheduler"}],"format":"esm"},"packages/core/functions/src/trigger/type/subscription-trigger.ts":{"bytes":10741,"imports":[{"path":"@braneframe/types","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/trigger/type/timer-trigger.ts":{"bytes":4173,"imports":[{"path":"cron","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/trigger/type/webhook-trigger.ts":{"bytes":4388,"imports":[{"path":"get-port-please","kind":"import-statement","external":true},{"path":"node:http","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/trigger/type/websocket-trigger.ts":{"bytes":11002,"imports":[{"path":"ws","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/trigger/type/index.ts":{"bytes":865,"imports":[{"path":"packages/core/functions/src/trigger/type/subscription-trigger.ts","kind":"import-statement","original":"./subscription-trigger"},{"path":"packages/core/functions/src/trigger/type/timer-trigger.ts","kind":"import-statement","original":"./timer-trigger"},{"path":"packages/core/functions/src/trigger/type/webhook-trigger.ts","kind":"import-statement","original":"./webhook-trigger"},{"path":"packages/core/functions/src/trigger/type/websocket-trigger.ts","kind":"import-statement","original":"./websocket-trigger"}],"format":"esm"},"packages/core/functions/src/trigger/trigger-registry.ts":{"bytes":27381,"imports":[{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/core/functions/src/trigger/type/index.ts","kind":"import-statement","original":"./type"},{"path":"packages/core/functions/src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/core/functions/src/trigger/index.ts":{"bytes":523,"imports":[{"path":"packages/core/functions/src/trigger/trigger-registry.ts","kind":"import-statement","original":"./trigger-registry"}],"format":"esm"},"packages/core/functions/src/index.ts":{"bytes":837,"imports":[{"path":"packages/core/functions/src/function/index.ts","kind":"import-statement","original":"./function"},{"path":"packages/core/functions/src/handler.ts","kind":"import-statement","original":"./handler"},{"path":"packages/core/functions/src/runtime/index.ts","kind":"import-statement","original":"./runtime"},{"path":"packages/core/functions/src/trigger/index.ts","kind":"import-statement","original":"./trigger"},{"path":"packages/core/functions/src/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/core/functions/src/testing/types.ts":{"bytes":1131,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/testing/setup.ts":{"bytes":12412,"imports":[{"path":"get-port-please","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/core/functions/src/testing/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/core/functions/src/function/index.ts","kind":"import-statement","original":"../function"},{"path":"packages/core/functions/src/runtime/index.ts","kind":"import-statement","original":"../runtime"},{"path":"packages/core/functions/src/trigger/index.ts","kind":"import-statement","original":"../trigger"},{"path":"packages/core/functions/src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/core/functions/src/testing/util.ts":{"bytes":4292,"imports":[{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/client/testing","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/client/services","kind":"import-statement","external":true},{"path":"packages/core/functions/src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/core/functions/src/testing/manifest.ts":{"bytes":1139,"imports":[],"format":"esm"},"packages/core/functions/src/testing/index.ts":{"bytes":749,"imports":[{"path":"packages/core/functions/src/testing/setup.ts","kind":"import-statement","original":"./setup"},{"path":"packages/core/functions/src/testing/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/core/functions/src/testing/util.ts","kind":"import-statement","original":"./util"},{"path":"packages/core/functions/src/testing/manifest.ts","kind":"import-statement","original":"./manifest"}],"format":"esm"}},"outputs":{"packages/core/functions/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4963},"packages/core/functions/dist/lib/node/index.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-4QALPMYS.cjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node/chunk-3UYUR5N5.cjs","kind":"import-statement"},{"path":"@braneframe/types","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["DevServer","FUNCTION_SCHEMA","FunctionDef","FunctionManifestSchema","FunctionRegistry","FunctionTrigger","Scheduler","TriggerRegistry","subscriptionHandler"],"entryPoint":"packages/core/functions/src/index.ts","inputs":{"packages/core/functions/src/index.ts":{"bytesInOutput":0},"packages/core/functions/src/handler.ts":{"bytesInOutput":1694}},"bytes":2172},"packages/core/functions/dist/lib/node/testing/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":9617},"packages/core/functions/dist/lib/node/testing/index.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-4QALPMYS.cjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node/chunk-3UYUR5N5.cjs","kind":"import-statement"},{"path":"get-port-please","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/client/testing","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/client/services","kind":"import-statement","external":true}],"exports":["TestType","createFunctionRuntime","createInitializedClients","inviteMember","startFunctionsHost","testFunctionManifest","triggerWebhook"],"entryPoint":"packages/core/functions/src/testing/index.ts","inputs":{"packages/core/functions/src/testing/setup.ts":{"bytesInOutput":2716},"packages/core/functions/src/testing/types.ts":{"bytesInOutput":182},"packages/core/functions/src/testing/index.ts":{"bytesInOutput":0},"packages/core/functions/src/testing/util.ts":{"bytesInOutput":1034},"packages/core/functions/src/testing/manifest.ts":{"bytesInOutput":146}},"bytes":4695},"packages/core/functions/dist/lib/node/chunk-4QALPMYS.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":54818},"packages/core/functions/dist/lib/node/chunk-4QALPMYS.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-3UYUR5N5.cjs","kind":"import-statement"},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"express","kind":"import-statement","external":true},{"path":"get-port-please","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@braneframe/types","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"cron","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"get-port-please","kind":"import-statement","external":true},{"path":"node:http","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"ws","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["DevServer","FunctionRegistry","Scheduler","TriggerRegistry"],"inputs":{"packages/core/functions/src/function/function-registry.ts":{"bytesInOutput":2928},"packages/core/functions/src/function/index.ts":{"bytesInOutput":0},"packages/core/functions/src/runtime/dev-server.ts":{"bytesInOutput":7851},"packages/core/functions/src/runtime/scheduler.ts":{"bytesInOutput":4602},"packages/core/functions/src/runtime/index.ts":{"bytesInOutput":0},"packages/core/functions/src/trigger/trigger-registry.ts":{"bytesInOutput":6996},"packages/core/functions/src/trigger/type/subscription-trigger.ts":{"bytesInOutput":2371},"packages/core/functions/src/trigger/type/index.ts":{"bytesInOutput":0},"packages/core/functions/src/trigger/type/timer-trigger.ts":{"bytesInOutput":898},"packages/core/functions/src/trigger/type/webhook-trigger.ts":{"bytesInOutput":829},"packages/core/functions/src/trigger/type/websocket-trigger.ts":{"bytesInOutput":2942},"packages/core/functions/src/trigger/index.ts":{"bytesInOutput":0}},"bytes":30174},"packages/core/functions/dist/lib/node/types.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/node/types.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-3UYUR5N5.cjs","kind":"import-statement"}],"exports":["FUNCTION_SCHEMA","FunctionDef","FunctionManifestSchema","FunctionTrigger"],"entryPoint":"packages/core/functions/src/types.ts","inputs":{},"bytes":243},"packages/core/functions/dist/lib/node/chunk-3UYUR5N5.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5388},"packages/core/functions/dist/lib/node/chunk-3UYUR5N5.cjs":{"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"exports":["FUNCTION_SCHEMA","FunctionDef","FunctionManifestSchema","FunctionTrigger","__require"],"inputs":{"packages/core/functions/src/types.ts":{"bytesInOutput":1848}},"bytes":2406}}}
|
|
1
|
+
{"inputs":{"packages/core/functions/src/types.ts":{"bytes":9711,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/function/function-registry.ts":{"bytes":12532,"imports":[{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/core/functions/src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/core/functions/src/function/index.ts":{"bytes":529,"imports":[{"path":"packages/core/functions/src/function/function-registry.ts","kind":"import-statement","original":"./function-registry"}],"format":"esm"},"packages/core/functions/src/handler.ts":{"bytes":9375,"imports":[{"path":"@braneframe/types","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/runtime/dev-server.ts":{"bytes":28578,"imports":[{"path":"express","kind":"import-statement","external":true},{"path":"get-port-please","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/runtime/scheduler.ts":{"bytes":18003,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/runtime/index.ts":{"bytes":598,"imports":[{"path":"packages/core/functions/src/runtime/dev-server.ts","kind":"import-statement","original":"./dev-server"},{"path":"packages/core/functions/src/runtime/scheduler.ts","kind":"import-statement","original":"./scheduler"}],"format":"esm"},"packages/core/functions/src/trigger/type/subscription-trigger.ts":{"bytes":10741,"imports":[{"path":"@braneframe/types","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/trigger/type/timer-trigger.ts":{"bytes":4173,"imports":[{"path":"cron","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/trigger/type/webhook-trigger.ts":{"bytes":4388,"imports":[{"path":"get-port-please","kind":"import-statement","external":true},{"path":"node:http","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/trigger/type/websocket-trigger.ts":{"bytes":11002,"imports":[{"path":"ws","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/trigger/type/index.ts":{"bytes":865,"imports":[{"path":"packages/core/functions/src/trigger/type/subscription-trigger.ts","kind":"import-statement","original":"./subscription-trigger"},{"path":"packages/core/functions/src/trigger/type/timer-trigger.ts","kind":"import-statement","original":"./timer-trigger"},{"path":"packages/core/functions/src/trigger/type/webhook-trigger.ts","kind":"import-statement","original":"./webhook-trigger"},{"path":"packages/core/functions/src/trigger/type/websocket-trigger.ts","kind":"import-statement","original":"./websocket-trigger"}],"format":"esm"},"packages/core/functions/src/trigger/trigger-registry.ts":{"bytes":27381,"imports":[{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/core/functions/src/trigger/type/index.ts","kind":"import-statement","original":"./type"},{"path":"packages/core/functions/src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/core/functions/src/trigger/index.ts":{"bytes":523,"imports":[{"path":"packages/core/functions/src/trigger/trigger-registry.ts","kind":"import-statement","original":"./trigger-registry"}],"format":"esm"},"packages/core/functions/src/index.ts":{"bytes":837,"imports":[{"path":"packages/core/functions/src/function/index.ts","kind":"import-statement","original":"./function"},{"path":"packages/core/functions/src/handler.ts","kind":"import-statement","original":"./handler"},{"path":"packages/core/functions/src/runtime/index.ts","kind":"import-statement","original":"./runtime"},{"path":"packages/core/functions/src/trigger/index.ts","kind":"import-statement","original":"./trigger"},{"path":"packages/core/functions/src/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/core/functions/src/testing/types.ts":{"bytes":1131,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/testing/setup.ts":{"bytes":12569,"imports":[{"path":"get-port-please","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/core/functions/src/testing/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/core/functions/src/function/index.ts","kind":"import-statement","original":"../function"},{"path":"packages/core/functions/src/runtime/index.ts","kind":"import-statement","original":"../runtime"},{"path":"packages/core/functions/src/trigger/index.ts","kind":"import-statement","original":"../trigger"},{"path":"packages/core/functions/src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/core/functions/src/testing/util.ts":{"bytes":4292,"imports":[{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/client/testing","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/client/services","kind":"import-statement","external":true},{"path":"packages/core/functions/src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/core/functions/src/testing/manifest.ts":{"bytes":1139,"imports":[],"format":"esm"},"packages/core/functions/src/testing/index.ts":{"bytes":749,"imports":[{"path":"packages/core/functions/src/testing/setup.ts","kind":"import-statement","original":"./setup"},{"path":"packages/core/functions/src/testing/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/core/functions/src/testing/util.ts","kind":"import-statement","original":"./util"},{"path":"packages/core/functions/src/testing/manifest.ts","kind":"import-statement","original":"./manifest"}],"format":"esm"}},"outputs":{"packages/core/functions/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4963},"packages/core/functions/dist/lib/node/index.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-RPHL3ORN.cjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node/chunk-BLLSDTKZ.cjs","kind":"import-statement"},{"path":"@braneframe/types","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["DevServer","FUNCTION_SCHEMA","FunctionDef","FunctionManifestSchema","FunctionRegistry","FunctionTrigger","Scheduler","TriggerRegistry","subscriptionHandler"],"entryPoint":"packages/core/functions/src/index.ts","inputs":{"packages/core/functions/src/index.ts":{"bytesInOutput":0},"packages/core/functions/src/handler.ts":{"bytesInOutput":1694}},"bytes":2172},"packages/core/functions/dist/lib/node/testing/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":9698},"packages/core/functions/dist/lib/node/testing/index.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-RPHL3ORN.cjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node/chunk-BLLSDTKZ.cjs","kind":"import-statement"},{"path":"get-port-please","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/client/testing","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/client/services","kind":"import-statement","external":true}],"exports":["TestType","createFunctionRuntime","createInitializedClients","inviteMember","startFunctionsHost","testFunctionManifest","triggerWebhook"],"entryPoint":"packages/core/functions/src/testing/index.ts","inputs":{"packages/core/functions/src/testing/setup.ts":{"bytesInOutput":2749},"packages/core/functions/src/testing/types.ts":{"bytesInOutput":182},"packages/core/functions/src/testing/index.ts":{"bytesInOutput":0},"packages/core/functions/src/testing/util.ts":{"bytesInOutput":1034},"packages/core/functions/src/testing/manifest.ts":{"bytesInOutput":146}},"bytes":4728},"packages/core/functions/dist/lib/node/chunk-RPHL3ORN.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":54818},"packages/core/functions/dist/lib/node/chunk-RPHL3ORN.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-BLLSDTKZ.cjs","kind":"import-statement"},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"express","kind":"import-statement","external":true},{"path":"get-port-please","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@braneframe/types","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"cron","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"get-port-please","kind":"import-statement","external":true},{"path":"node:http","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"ws","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["DevServer","FunctionRegistry","Scheduler","TriggerRegistry"],"inputs":{"packages/core/functions/src/function/function-registry.ts":{"bytesInOutput":2928},"packages/core/functions/src/function/index.ts":{"bytesInOutput":0},"packages/core/functions/src/runtime/dev-server.ts":{"bytesInOutput":7851},"packages/core/functions/src/runtime/scheduler.ts":{"bytesInOutput":4602},"packages/core/functions/src/runtime/index.ts":{"bytesInOutput":0},"packages/core/functions/src/trigger/trigger-registry.ts":{"bytesInOutput":6996},"packages/core/functions/src/trigger/type/subscription-trigger.ts":{"bytesInOutput":2371},"packages/core/functions/src/trigger/type/index.ts":{"bytesInOutput":0},"packages/core/functions/src/trigger/type/timer-trigger.ts":{"bytesInOutput":898},"packages/core/functions/src/trigger/type/webhook-trigger.ts":{"bytesInOutput":829},"packages/core/functions/src/trigger/type/websocket-trigger.ts":{"bytesInOutput":2942},"packages/core/functions/src/trigger/index.ts":{"bytesInOutput":0}},"bytes":30174},"packages/core/functions/dist/lib/node/types.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/node/types.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-BLLSDTKZ.cjs","kind":"import-statement"}],"exports":["FUNCTION_SCHEMA","FunctionDef","FunctionManifestSchema","FunctionTrigger"],"entryPoint":"packages/core/functions/src/types.ts","inputs":{},"bytes":243},"packages/core/functions/dist/lib/node/chunk-BLLSDTKZ.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5388},"packages/core/functions/dist/lib/node/chunk-BLLSDTKZ.cjs":{"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"exports":["FUNCTION_SCHEMA","FunctionDef","FunctionManifestSchema","FunctionTrigger","__require"],"inputs":{"packages/core/functions/src/types.ts":{"bytesInOutput":1848}},"bytes":2406}}}
|
|
@@ -37,8 +37,8 @@ __export(testing_exports, {
|
|
|
37
37
|
triggerWebhook: () => triggerWebhook
|
|
38
38
|
});
|
|
39
39
|
module.exports = __toCommonJS(testing_exports);
|
|
40
|
-
var
|
|
41
|
-
var
|
|
40
|
+
var import_chunk_RPHL3ORN = require("../chunk-RPHL3ORN.cjs");
|
|
41
|
+
var import_chunk_BLLSDTKZ = require("../chunk-BLLSDTKZ.cjs");
|
|
42
42
|
var import_get_port_please = require("get-port-please");
|
|
43
43
|
var import_node_path = __toESM(require("node:path"));
|
|
44
44
|
var import_async = require("@dxos/async");
|
|
@@ -53,7 +53,7 @@ var TestType = class extends (0, import_echo_schema.TypedObject)({
|
|
|
53
53
|
typename: "example.com/type/Test",
|
|
54
54
|
version: "0.1.0"
|
|
55
55
|
})({
|
|
56
|
-
title: import_echo_schema.S.
|
|
56
|
+
title: import_echo_schema.S.String
|
|
57
57
|
}) {
|
|
58
58
|
};
|
|
59
59
|
var createInitializedClients = async (testBuilder, count = 1, config) => {
|
|
@@ -67,7 +67,8 @@ var createInitializedClients = async (testBuilder, count = 1, config) => {
|
|
|
67
67
|
await client.halo.createIdentity({
|
|
68
68
|
displayName: `Peer ${index}`
|
|
69
69
|
});
|
|
70
|
-
client.
|
|
70
|
+
await client.spaces.isReady;
|
|
71
|
+
client.addSchema(import_chunk_BLLSDTKZ.FunctionDef, import_chunk_BLLSDTKZ.FunctionTrigger, TestType);
|
|
71
72
|
return client;
|
|
72
73
|
}));
|
|
73
74
|
};
|
|
@@ -94,7 +95,7 @@ var createFunctionRuntime = async (testBuilder, pluginInitializer) => {
|
|
|
94
95
|
};
|
|
95
96
|
var startFunctionsHost = async (testBuilder, pluginInitializer, options) => {
|
|
96
97
|
const functionRuntime = await createFunctionRuntime(testBuilder, pluginInitializer);
|
|
97
|
-
const functionsRegistry = new
|
|
98
|
+
const functionsRegistry = new import_chunk_RPHL3ORN.FunctionRegistry(functionRuntime);
|
|
98
99
|
const devServer = await startDevServer(testBuilder, functionRuntime, functionsRegistry, options);
|
|
99
100
|
const scheduler = await startScheduler(testBuilder, functionRuntime, devServer, functionsRegistry);
|
|
100
101
|
return {
|
|
@@ -108,8 +109,8 @@ var startFunctionsHost = async (testBuilder, pluginInitializer, options) => {
|
|
|
108
109
|
};
|
|
109
110
|
};
|
|
110
111
|
var startScheduler = async (testBuilder, client, devServer, functionRegistry) => {
|
|
111
|
-
const triggerRegistry = new
|
|
112
|
-
const scheduler = new
|
|
112
|
+
const triggerRegistry = new import_chunk_RPHL3ORN.TriggerRegistry(client);
|
|
113
|
+
const scheduler = new import_chunk_RPHL3ORN.Scheduler(functionRegistry, triggerRegistry, {
|
|
113
114
|
endpoint: devServer.endpoint
|
|
114
115
|
});
|
|
115
116
|
await scheduler.start();
|
|
@@ -117,7 +118,7 @@ var startScheduler = async (testBuilder, client, devServer, functionRegistry) =>
|
|
|
117
118
|
return scheduler;
|
|
118
119
|
};
|
|
119
120
|
var startDevServer = async (testBuilder, client, functionRegistry, options) => {
|
|
120
|
-
const server = new
|
|
121
|
+
const server = new import_chunk_RPHL3ORN.DevServer(client, functionRegistry, {
|
|
121
122
|
baseDir: import_node_path.default.join(__dirname, "../testing"),
|
|
122
123
|
port: await (0, import_get_port_please.getRandomPort)("127.0.0.1"),
|
|
123
124
|
...options
|
|
@@ -128,7 +129,7 @@ var startDevServer = async (testBuilder, client, functionRegistry, options) => {
|
|
|
128
129
|
};
|
|
129
130
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/functions/src/testing/util.ts";
|
|
130
131
|
var triggerWebhook = async (space, uri) => {
|
|
131
|
-
const trigger = (await space.db.query(import_echo.Filter.schema(
|
|
132
|
+
const trigger = (await space.db.query(import_echo.Filter.schema(import_chunk_BLLSDTKZ.FunctionTrigger, (t) => t.function === uri)).run()).objects[0];
|
|
132
133
|
(0, import_invariant.invariant)(trigger.spec.type === "webhook", void 0, {
|
|
133
134
|
F: __dxlog_file,
|
|
134
135
|
L: 17,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/testing/setup.ts", "../../../../src/testing/types.ts", "../../../../src/testing/util.ts", "../../../../src/testing/manifest.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { getRandomPort } from 'get-port-please';\nimport path from 'node:path';\n\nimport { waitForCondition } from '@dxos/async';\nimport { Client, Config } from '@dxos/client';\nimport { type Space } from '@dxos/client/echo';\nimport { type TestBuilder } from '@dxos/client/testing';\nimport { range } from '@dxos/util';\n\nimport { TestType } from './types';\nimport { FunctionRegistry } from '../function';\nimport { DevServer, type DevServerOptions, Scheduler } from '../runtime';\nimport { TriggerRegistry } from '../trigger';\nimport { FunctionDef, FunctionTrigger } from '../types';\n\nexport type FunctionsPluginInitializer = (client: Client) => Promise<{ close: () => Promise<void> }>;\n\n// TODO(burdon): Extend/wrap TestBuilder.\n\nexport const createInitializedClients = async (testBuilder: TestBuilder, count: number = 1, config?: Config) => {\n const clients = range(count).map(() => new Client({ config, services: testBuilder.createLocalClientServices() }));\n testBuilder.ctx.onDispose(() => Promise.all(clients.map((client) => client.destroy())));\n return Promise.all(\n clients.map(async (client, index) => {\n await client.initialize();\n await client.halo.createIdentity({ displayName: `Peer ${index}` });\n client.addSchema(FunctionDef, FunctionTrigger, TestType);\n return client;\n }),\n );\n};\n\nexport const createFunctionRuntime = async (\n testBuilder: TestBuilder,\n pluginInitializer: FunctionsPluginInitializer,\n): Promise<Client> => {\n const functionsPort = await getRandomPort('127.0.0.1');\n const config = new Config({\n runtime: {\n agent: {\n plugins: [{ id: 'dxos.org/agent/plugin/functions', config: { port: functionsPort } }],\n },\n },\n });\n\n const [client] = await createInitializedClients(testBuilder, 1, config);\n const plugin = await pluginInitializer(client);\n testBuilder.ctx.onDispose(() => plugin.close());\n return client;\n};\n\nexport const startFunctionsHost = async (\n testBuilder: TestBuilder,\n pluginInitializer: FunctionsPluginInitializer,\n options?: DevServerOptions,\n) => {\n const functionRuntime = await createFunctionRuntime(testBuilder, pluginInitializer);\n const functionsRegistry = new FunctionRegistry(functionRuntime);\n const devServer = await startDevServer(testBuilder, functionRuntime, functionsRegistry, options);\n const scheduler = await startScheduler(testBuilder, functionRuntime, devServer, functionsRegistry);\n return {\n scheduler,\n client: functionRuntime,\n waitHasActiveTriggers: async (space: Space) => {\n await waitForCondition({ condition: () => scheduler.triggers.getActiveTriggers(space).length > 0 });\n },\n };\n};\n\nconst startScheduler = async (\n testBuilder: TestBuilder,\n client: Client,\n devServer: DevServer,\n functionRegistry: FunctionRegistry,\n) => {\n const triggerRegistry = new TriggerRegistry(client);\n const scheduler = new Scheduler(functionRegistry, triggerRegistry, { endpoint: devServer.endpoint });\n await scheduler.start();\n testBuilder.ctx.onDispose(() => scheduler.stop());\n return scheduler;\n};\n\nconst startDevServer = async (\n testBuilder: TestBuilder,\n client: Client,\n functionRegistry: FunctionRegistry,\n options?: { baseDir?: string },\n) => {\n const server = new DevServer(client, functionRegistry, {\n baseDir: path.join(__dirname, '../testing'),\n port: await getRandomPort('127.0.0.1'),\n ...options,\n });\n await server.start();\n testBuilder.ctx.onDispose(() => server.stop());\n return server;\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { S, TypedObject } from '@dxos/echo-schema';\n\nexport class TestType extends TypedObject({ typename: 'example.com/type/Test', version: '0.1.0' })({\n title: S.
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,6BAA8B;AAC9B,uBAAiB;AAEjB,mBAAiC;AACjC,oBAA+B;AAG/B,kBAAsB;ACPtB,yBAA+B;ACC/B,kBAAmC;AACnC,qBAAkC;AAClC,uBAA0B;AAC1B,sBAA2B;ADFpB,IAAMA,WAAN,kBAAuBC,gCAAY;EAAEC,UAAU;EAAyBC,SAAS;AAAQ,CAAA,EAAG;EACjGC,OAAOC,qBAAEC;AACX,CAAA,EAAA;AAAI;ADeG,IAAMC,2BAA2B,OAAOC,aAA0BC,QAAgB,GAAGC,WAAAA;AAC1F,QAAMC,cAAUC,mBAAMH,KAAAA,EAAOI,IAAI,MAAM,IAAIC,qBAAO;IAAEJ;IAAQK,UAAUP,YAAYQ,0BAAyB;EAAG,CAAA,CAAA;AAC9GR,cAAYS,IAAIC,UAAU,MAAMC,QAAQC,IAAIT,QAAQE,IAAI,CAACQ,WAAWA,OAAOC,QAAO,CAAA,CAAA,CAAA;AAClF,SAAOH,QAAQC,IACbT,QAAQE,IAAI,OAAOQ,QAAQE,UAAAA;AACzB,UAAMF,OAAOG,WAAU;AACvB,UAAMH,OAAOI,KAAKC,eAAe;MAAEC,aAAa,QAAQJ,KAAAA;IAAQ,CAAA;
|
|
6
|
-
"names": ["TestType", "TypedObject", "typename", "version", "title", "S", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { getRandomPort } from 'get-port-please';\nimport path from 'node:path';\n\nimport { waitForCondition } from '@dxos/async';\nimport { Client, Config } from '@dxos/client';\nimport { type Space } from '@dxos/client/echo';\nimport { type TestBuilder } from '@dxos/client/testing';\nimport { range } from '@dxos/util';\n\nimport { TestType } from './types';\nimport { FunctionRegistry } from '../function';\nimport { DevServer, type DevServerOptions, Scheduler } from '../runtime';\nimport { TriggerRegistry } from '../trigger';\nimport { FunctionDef, FunctionTrigger } from '../types';\n\nexport type FunctionsPluginInitializer = (client: Client) => Promise<{ close: () => Promise<void> }>;\n\n// TODO(burdon): Extend/wrap TestBuilder.\n\nexport const createInitializedClients = async (testBuilder: TestBuilder, count: number = 1, config?: Config) => {\n const clients = range(count).map(() => new Client({ config, services: testBuilder.createLocalClientServices() }));\n testBuilder.ctx.onDispose(() => Promise.all(clients.map((client) => client.destroy())));\n return Promise.all(\n clients.map(async (client, index) => {\n await client.initialize();\n await client.halo.createIdentity({ displayName: `Peer ${index}` });\n await client.spaces.isReady;\n client.addSchema(FunctionDef, FunctionTrigger, TestType);\n return client;\n }),\n );\n};\n\nexport const createFunctionRuntime = async (\n testBuilder: TestBuilder,\n pluginInitializer: FunctionsPluginInitializer,\n): Promise<Client> => {\n const functionsPort = await getRandomPort('127.0.0.1');\n const config = new Config({\n runtime: {\n agent: {\n plugins: [{ id: 'dxos.org/agent/plugin/functions', config: { port: functionsPort } }],\n },\n },\n });\n\n const [client] = await createInitializedClients(testBuilder, 1, config);\n const plugin = await pluginInitializer(client);\n testBuilder.ctx.onDispose(() => plugin.close());\n return client;\n};\n\nexport const startFunctionsHost = async (\n testBuilder: TestBuilder,\n pluginInitializer: FunctionsPluginInitializer,\n options?: DevServerOptions,\n) => {\n const functionRuntime = await createFunctionRuntime(testBuilder, pluginInitializer);\n const functionsRegistry = new FunctionRegistry(functionRuntime);\n const devServer = await startDevServer(testBuilder, functionRuntime, functionsRegistry, options);\n const scheduler = await startScheduler(testBuilder, functionRuntime, devServer, functionsRegistry);\n return {\n scheduler,\n client: functionRuntime,\n waitHasActiveTriggers: async (space: Space) => {\n await waitForCondition({ condition: () => scheduler.triggers.getActiveTriggers(space).length > 0 });\n },\n };\n};\n\nconst startScheduler = async (\n testBuilder: TestBuilder,\n client: Client,\n devServer: DevServer,\n functionRegistry: FunctionRegistry,\n) => {\n const triggerRegistry = new TriggerRegistry(client);\n const scheduler = new Scheduler(functionRegistry, triggerRegistry, { endpoint: devServer.endpoint });\n await scheduler.start();\n testBuilder.ctx.onDispose(() => scheduler.stop());\n return scheduler;\n};\n\nconst startDevServer = async (\n testBuilder: TestBuilder,\n client: Client,\n functionRegistry: FunctionRegistry,\n options?: { baseDir?: string },\n) => {\n const server = new DevServer(client, functionRegistry, {\n baseDir: path.join(__dirname, '../testing'),\n port: await getRandomPort('127.0.0.1'),\n ...options,\n });\n await server.start();\n testBuilder.ctx.onDispose(() => server.stop());\n return server;\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { S, TypedObject } from '@dxos/echo-schema';\n\nexport class TestType extends TypedObject({ typename: 'example.com/type/Test', version: '0.1.0' })({\n title: S.String,\n}) {}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport type { Client } from '@dxos/client';\nimport { Filter, type Space } from '@dxos/client/echo';\nimport { performInvitation } from '@dxos/client/testing';\nimport { invariant } from '@dxos/invariant';\nimport { Invitation } from '@dxos/protocols/proto/dxos/client/services';\n\nimport { FunctionTrigger } from '../types';\n\nexport const triggerWebhook = async (space: Space, uri: string) => {\n const trigger = (\n await space.db.query(Filter.schema(FunctionTrigger, (t: FunctionTrigger) => t.function === uri)).run()\n ).objects[0];\n invariant(trigger.spec.type === 'webhook');\n void fetch(`http://localhost:${trigger.spec.port}`);\n};\n\nexport const inviteMember = async (host: Space, guest: Client) => {\n const [{ invitation: hostInvitation }] = await Promise.all(performInvitation({ host, guest: guest.spaces }));\n if (hostInvitation?.state !== Invitation.State.SUCCESS) {\n throw new Error(`Expected ${hostInvitation?.state} to be ${Invitation.State.SUCCESS}.`);\n }\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport type { FunctionManifest } from '../types';\n\nexport const testFunctionManifest: FunctionManifest = {\n functions: [\n {\n uri: 'example.com/function/test',\n route: 'test',\n handler: 'test',\n },\n ],\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,6BAA8B;AAC9B,uBAAiB;AAEjB,mBAAiC;AACjC,oBAA+B;AAG/B,kBAAsB;ACPtB,yBAA+B;ACC/B,kBAAmC;AACnC,qBAAkC;AAClC,uBAA0B;AAC1B,sBAA2B;ADFpB,IAAMA,WAAN,kBAAuBC,gCAAY;EAAEC,UAAU;EAAyBC,SAAS;AAAQ,CAAA,EAAG;EACjGC,OAAOC,qBAAEC;AACX,CAAA,EAAA;AAAI;ADeG,IAAMC,2BAA2B,OAAOC,aAA0BC,QAAgB,GAAGC,WAAAA;AAC1F,QAAMC,cAAUC,mBAAMH,KAAAA,EAAOI,IAAI,MAAM,IAAIC,qBAAO;IAAEJ;IAAQK,UAAUP,YAAYQ,0BAAyB;EAAG,CAAA,CAAA;AAC9GR,cAAYS,IAAIC,UAAU,MAAMC,QAAQC,IAAIT,QAAQE,IAAI,CAACQ,WAAWA,OAAOC,QAAO,CAAA,CAAA,CAAA;AAClF,SAAOH,QAAQC,IACbT,QAAQE,IAAI,OAAOQ,QAAQE,UAAAA;AACzB,UAAMF,OAAOG,WAAU;AACvB,UAAMH,OAAOI,KAAKC,eAAe;MAAEC,aAAa,QAAQJ,KAAAA;IAAQ,CAAA;AAChE,UAAMF,OAAOO,OAAOC;AACpBR,WAAOS,UAAUC,mCAAaC,uCAAiBhC,QAAAA;AAC/C,WAAOqB;EACT,CAAA,CAAA;AAEJ;AAEO,IAAMY,wBAAwB,OACnCzB,aACA0B,sBAAAA;AAEA,QAAMC,gBAAgB,UAAMC,sCAAc,WAAA;AAC1C,QAAM1B,SAAS,IAAI2B,qBAAO;IACxBC,SAAS;MACPC,OAAO;QACLC,SAAS;UAAC;YAAEC,IAAI;YAAmC/B,QAAQ;cAAEgC,MAAMP;YAAc;UAAE;;MACrF;IACF;EACF,CAAA;AAEA,QAAM,CAACd,MAAAA,IAAU,MAAMd,yBAAyBC,aAAa,GAAGE,MAAAA;AAChE,QAAMiC,SAAS,MAAMT,kBAAkBb,MAAAA;AACvCb,cAAYS,IAAIC,UAAU,MAAMyB,OAAOC,MAAK,CAAA;AAC5C,SAAOvB;AACT;AAEO,IAAMwB,qBAAqB,OAChCrC,aACA0B,mBACAY,YAAAA;AAEA,QAAMC,kBAAkB,MAAMd,sBAAsBzB,aAAa0B,iBAAAA;AACjE,QAAMc,oBAAoB,IAAIC,uCAAiBF,eAAAA;AAC/C,QAAMG,YAAY,MAAMC,eAAe3C,aAAauC,iBAAiBC,mBAAmBF,OAAAA;AACxF,QAAMM,YAAY,MAAMC,eAAe7C,aAAauC,iBAAiBG,WAAWF,iBAAAA;AAChF,SAAO;IACLI;IACA/B,QAAQ0B;IACRO,uBAAuB,OAAOC,UAAAA;AAC5B,gBAAMC,+BAAiB;QAAEC,WAAW,MAAML,UAAUM,SAASC,kBAAkBJ,KAAAA,EAAOK,SAAS;MAAE,CAAA;IACnG;EACF;AACF;AAEA,IAAMP,iBAAiB,OACrB7C,aACAa,QACA6B,WACAW,qBAAAA;AAEA,QAAMC,kBAAkB,IAAIC,sCAAgB1C,MAAAA;AAC5C,QAAM+B,YAAY,IAAIY,gCAAUH,kBAAkBC,iBAAiB;IAAEG,UAAUf,UAAUe;EAAS,CAAA;AAClG,QAAMb,UAAUc,MAAK;AACrB1D,cAAYS,IAAIC,UAAU,MAAMkC,UAAUe,KAAI,CAAA;AAC9C,SAAOf;AACT;AAEA,IAAMD,iBAAiB,OACrB3C,aACAa,QACAwC,kBACAf,YAAAA;AAEA,QAAMsB,SAAS,IAAIC,gCAAUhD,QAAQwC,kBAAkB;IACrDS,SAASC,iBAAAA,QAAKC,KAAKC,WAAW,YAAA;IAC9B/B,MAAM,UAAMN,sCAAc,WAAA;IAC1B,GAAGU;EACL,CAAA;AACA,QAAMsB,OAAOF,MAAK;AAClB1D,cAAYS,IAAIC,UAAU,MAAMkD,OAAOD,KAAI,CAAA;AAC3C,SAAOC;AACT;;AEzFO,IAAMM,iBAAiB,OAAOnB,OAAcoB,QAAAA;AACjD,QAAMC,WACJ,MAAMrB,MAAMsB,GAAGC,MAAMC,mBAAOC,OAAOhD,uCAAiB,CAACiD,MAAuBA,EAAEC,aAAaP,GAAAA,CAAAA,EAAMQ,IAAG,GACpGC,QAAQ,CAAA;AACVC,kCAAUT,QAAQU,KAAKC,SAAS,WAAA,QAAA;;;;;;;;;AAChC,OAAKC,MAAM,oBAAoBZ,QAAQU,KAAK5C,IAAI,EAAE;AACpD;AAEO,IAAM+C,eAAe,OAAOC,MAAaC,UAAAA;AAC9C,QAAM,CAAC,EAAEC,YAAYC,eAAc,CAAE,IAAI,MAAM1E,QAAQC,QAAI0E,kCAAkB;IAAEJ;IAAMC,OAAOA,MAAM/D;EAAO,CAAA,CAAA;AACzG,MAAIiE,gBAAgBE,UAAUC,2BAAWC,MAAMC,SAAS;AACtD,UAAM,IAAIC,MAAM,YAAYN,gBAAgBE,KAAAA,UAAeC,2BAAWC,MAAMC,OAAO,GAAG;EACxF;AACF;ACnBO,IAAME,uBAAyC;EACpDC,WAAW;IACT;MACE1B,KAAK;MACL2B,OAAO;MACPC,SAAS;IACX;;AAEJ;",
|
|
6
|
+
"names": ["TestType", "TypedObject", "typename", "version", "title", "S", "String", "createInitializedClients", "testBuilder", "count", "config", "clients", "range", "map", "Client", "services", "createLocalClientServices", "ctx", "onDispose", "Promise", "all", "client", "destroy", "index", "initialize", "halo", "createIdentity", "displayName", "spaces", "isReady", "addSchema", "FunctionDef", "FunctionTrigger", "createFunctionRuntime", "pluginInitializer", "functionsPort", "getRandomPort", "Config", "runtime", "agent", "plugins", "id", "port", "plugin", "close", "startFunctionsHost", "options", "functionRuntime", "functionsRegistry", "FunctionRegistry", "devServer", "startDevServer", "scheduler", "startScheduler", "waitHasActiveTriggers", "space", "waitForCondition", "condition", "triggers", "getActiveTriggers", "length", "functionRegistry", "triggerRegistry", "TriggerRegistry", "Scheduler", "endpoint", "start", "stop", "server", "DevServer", "baseDir", "path", "join", "__dirname", "triggerWebhook", "uri", "trigger", "db", "query", "Filter", "schema", "t", "function", "run", "objects", "invariant", "spec", "type", "fetch", "inviteMember", "host", "guest", "invitation", "hostInvitation", "performInvitation", "state", "Invitation", "State", "SUCCESS", "Error", "testFunctionManifest", "functions", "route", "handler"]
|
|
7
7
|
}
|
package/dist/lib/node/types.cjs
CHANGED
|
@@ -18,13 +18,13 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var types_exports = {};
|
|
20
20
|
__export(types_exports, {
|
|
21
|
-
FUNCTION_SCHEMA: () =>
|
|
22
|
-
FunctionDef: () =>
|
|
23
|
-
FunctionManifestSchema: () =>
|
|
24
|
-
FunctionTrigger: () =>
|
|
21
|
+
FUNCTION_SCHEMA: () => import_chunk_BLLSDTKZ.FUNCTION_SCHEMA,
|
|
22
|
+
FunctionDef: () => import_chunk_BLLSDTKZ.FunctionDef,
|
|
23
|
+
FunctionManifestSchema: () => import_chunk_BLLSDTKZ.FunctionManifestSchema,
|
|
24
|
+
FunctionTrigger: () => import_chunk_BLLSDTKZ.FunctionTrigger
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(types_exports);
|
|
27
|
-
var
|
|
27
|
+
var import_chunk_BLLSDTKZ = require("./chunk-BLLSDTKZ.cjs");
|
|
28
28
|
// Annotate the CommonJS export names for ESM import in node:
|
|
29
29
|
0 && (module.exports = {
|
|
30
30
|
FUNCTION_SCHEMA,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["types.cjs"],
|
|
4
|
-
"sourcesContent": ["import {\n FUNCTION_SCHEMA,\n FunctionDef,\n FunctionManifestSchema,\n FunctionTrigger\n} from \"./chunk-
|
|
4
|
+
"sourcesContent": ["import {\n FUNCTION_SCHEMA,\n FunctionDef,\n FunctionManifestSchema,\n FunctionTrigger\n} from \"./chunk-BLLSDTKZ.cjs\";\nexport {\n FUNCTION_SCHEMA,\n FunctionDef,\n FunctionManifestSchema,\n FunctionTrigger\n};\n//# sourceMappingURL=types.cjs.map\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAKO;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../../../src/testing/setup.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAKxD,OAAO,EAAa,KAAK,gBAAgB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIzE,MAAM,MAAM,0BAA0B,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAAC,CAAC;AAIrG,eAAO,MAAM,wBAAwB,gBAAuB,WAAW,UAAS,MAAM,WAAe,MAAM,
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../../../src/testing/setup.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAKxD,OAAO,EAAa,KAAK,gBAAgB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIzE,MAAM,MAAM,0BAA0B,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAAC,CAAC;AAIrG,eAAO,MAAM,wBAAwB,gBAAuB,WAAW,UAAS,MAAM,WAAe,MAAM,sBAY1G,CAAC;AAEF,eAAO,MAAM,qBAAqB,gBACnB,WAAW,qBACL,0BAA0B,KAC5C,QAAQ,MAAM,CAchB,CAAC;AAEF,eAAO,MAAM,kBAAkB,gBAChB,WAAW,qBACL,0BAA0B,YACnC,gBAAgB;;;mCASa,KAAK;EAI7C,CAAC"}
|
|
@@ -6,44 +6,33 @@ import { S } from '@dxos/echo-schema';
|
|
|
6
6
|
* https://www.typescriptlang.org/docs/handbook/2/narrowing.html#discriminated-unions
|
|
7
7
|
*/
|
|
8
8
|
export type FunctionTriggerType = 'subscription' | 'timer' | 'webhook' | 'websocket';
|
|
9
|
-
declare const SubscriptionTriggerSchema: S.mutable<S.
|
|
10
|
-
type: S.
|
|
11
|
-
filter: S.
|
|
12
|
-
type: S
|
|
13
|
-
props: S.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
declare const SubscriptionTriggerSchema: S.mutable<S.Struct<{
|
|
10
|
+
type: S.Literal<["subscription"]>;
|
|
11
|
+
filter: S.Array$<S.Struct<{
|
|
12
|
+
type: typeof S.String;
|
|
13
|
+
props: S.optional<S.Record$<typeof S.String, typeof S.Any>>;
|
|
14
|
+
}>>;
|
|
15
|
+
options: S.optional<S.Struct<{
|
|
16
|
+
deep: S.optional<typeof S.Boolean>;
|
|
17
|
+
delay: S.optional<typeof S.Number>;
|
|
18
18
|
}>>;
|
|
19
|
-
options: S.PropertySignature<"?:", {
|
|
20
|
-
readonly deep?: boolean | undefined;
|
|
21
|
-
readonly delay?: number | undefined;
|
|
22
|
-
} | undefined, never, "?:", {
|
|
23
|
-
readonly deep?: boolean | undefined;
|
|
24
|
-
readonly delay?: number | undefined;
|
|
25
|
-
} | undefined, never>;
|
|
26
19
|
}>>;
|
|
27
20
|
export type SubscriptionTrigger = S.Schema.Type<typeof SubscriptionTriggerSchema>;
|
|
28
|
-
declare const TimerTriggerSchema: S.mutable<S.
|
|
29
|
-
type: S.
|
|
30
|
-
cron: S
|
|
21
|
+
declare const TimerTriggerSchema: S.mutable<S.Struct<{
|
|
22
|
+
type: S.Literal<["timer"]>;
|
|
23
|
+
cron: typeof S.String;
|
|
31
24
|
}>>;
|
|
32
25
|
export type TimerTrigger = S.Schema.Type<typeof TimerTriggerSchema>;
|
|
33
|
-
declare const WebhookTriggerSchema: S.mutable<S.
|
|
34
|
-
type: S.
|
|
35
|
-
method: S
|
|
36
|
-
port: S.
|
|
26
|
+
declare const WebhookTriggerSchema: S.mutable<S.Struct<{
|
|
27
|
+
type: S.Literal<["webhook"]>;
|
|
28
|
+
method: typeof S.String;
|
|
29
|
+
port: S.optional<typeof S.Number>;
|
|
37
30
|
}>>;
|
|
38
31
|
export type WebhookTrigger = S.Schema.Type<typeof WebhookTriggerSchema>;
|
|
39
|
-
declare const WebsocketTriggerSchema: S.mutable<S.
|
|
40
|
-
type: S.
|
|
41
|
-
url: S
|
|
42
|
-
init: S.
|
|
43
|
-
readonly [x: string]: any;
|
|
44
|
-
} | undefined, never, "?:", {
|
|
45
|
-
readonly [x: string]: any;
|
|
46
|
-
} | undefined, never>;
|
|
32
|
+
declare const WebsocketTriggerSchema: S.mutable<S.Struct<{
|
|
33
|
+
type: S.Literal<["websocket"]>;
|
|
34
|
+
url: typeof S.String;
|
|
35
|
+
init: S.optional<S.Record$<typeof S.String, typeof S.Any>>;
|
|
47
36
|
}>>;
|
|
48
37
|
export type WebsocketTrigger = S.Schema.Type<typeof WebsocketTriggerSchema>;
|
|
49
38
|
export type TriggerSpec = TimerTrigger | WebhookTrigger | WebsocketTrigger | SubscriptionTrigger;
|
|
@@ -103,8 +92,8 @@ export declare class FunctionTrigger extends FunctionTrigger_base {
|
|
|
103
92
|
/**
|
|
104
93
|
* Function manifest file.
|
|
105
94
|
*/
|
|
106
|
-
export declare const FunctionManifestSchema: S.
|
|
107
|
-
functions: S.
|
|
95
|
+
export declare const FunctionManifestSchema: S.Struct<{
|
|
96
|
+
functions: S.optional<S.mutable<S.Array$<S.Schema<{
|
|
108
97
|
handler: string;
|
|
109
98
|
uri: string;
|
|
110
99
|
description?: string | undefined;
|
|
@@ -116,7 +105,7 @@ export declare const FunctionManifestSchema: S.struct<{
|
|
|
116
105
|
readonly source: string;
|
|
117
106
|
}[];
|
|
118
107
|
} | undefined;
|
|
119
|
-
}
|
|
108
|
+
}, {
|
|
120
109
|
handler: string;
|
|
121
110
|
uri: string;
|
|
122
111
|
description?: string | undefined;
|
|
@@ -128,8 +117,8 @@ export declare const FunctionManifestSchema: S.struct<{
|
|
|
128
117
|
readonly source: string;
|
|
129
118
|
}[];
|
|
130
119
|
} | undefined;
|
|
131
|
-
}
|
|
132
|
-
triggers: S.
|
|
120
|
+
}, never>>>>;
|
|
121
|
+
triggers: S.optional<S.mutable<S.Array$<S.Schema<{
|
|
133
122
|
function: string;
|
|
134
123
|
enabled?: boolean | undefined;
|
|
135
124
|
meta?: {
|
|
@@ -168,7 +157,7 @@ export declare const FunctionManifestSchema: S.struct<{
|
|
|
168
157
|
readonly source: string;
|
|
169
158
|
}[];
|
|
170
159
|
} | undefined;
|
|
171
|
-
}
|
|
160
|
+
}, {
|
|
172
161
|
function: string;
|
|
173
162
|
enabled?: boolean | undefined;
|
|
174
163
|
meta?: {
|
|
@@ -207,7 +196,7 @@ export declare const FunctionManifestSchema: S.struct<{
|
|
|
207
196
|
readonly source: string;
|
|
208
197
|
}[];
|
|
209
198
|
} | undefined;
|
|
210
|
-
}
|
|
199
|
+
}, never>>>>;
|
|
211
200
|
}>;
|
|
212
201
|
export type FunctionManifest = S.Schema.Type<typeof FunctionManifestSchema>;
|
|
213
202
|
export declare const FUNCTION_SCHEMA: (typeof FunctionDef | typeof FunctionTrigger)[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAa,CAAC,EAAe,MAAM,mBAAmB,CAAC;AAE9D;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,WAAW,CAAC;AAErF,QAAA,MAAM,yBAAyB
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAa,CAAC,EAAe,MAAM,mBAAmB,CAAC;AAE9D;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,WAAW,CAAC;AAErF,QAAA,MAAM,yBAAyB;;;;;;;;;;GAmB9B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAElF,QAAA,MAAM,kBAAkB;;;GAKvB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEpE,QAAA,MAAM,oBAAoB;;;;GAOzB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAExE,QAAA,MAAM,sBAAsB;;;;GAM3B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAS5E,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,cAAc,GAAG,gBAAgB,GAAG,mBAAmB,CAAC;;;;;;;;;AAEjG;;GAEG;AACH,qBAAa,WAAY,SAAQ,gBAQ/B;CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEL;;GAEG;AACH,qBAAa,eAAgB,SAAQ,oBASnC;CAAG;AAEL;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAG5E,eAAO,MAAM,eAAe,iDAAiC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/functions",
|
|
3
|
-
"version": "0.5.5-main.
|
|
3
|
+
"version": "0.5.5-main.6dd4e95",
|
|
4
4
|
"description": "Functions API and runtime.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -45,27 +45,27 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@preact/signals-core": "^1.6.0",
|
|
47
47
|
"cron": "^3.1.6",
|
|
48
|
-
"effect": "^2.
|
|
48
|
+
"effect": "^3.2.7",
|
|
49
49
|
"express": "^4.19.2",
|
|
50
50
|
"get-port-please": "^3.1.1",
|
|
51
51
|
"ws": "^8.14.2",
|
|
52
|
-
"@
|
|
53
|
-
"@dxos/async": "0.5.5-main.
|
|
54
|
-
"@dxos/context": "0.5.5-main.
|
|
55
|
-
"@dxos/
|
|
56
|
-
"@dxos/echo-
|
|
57
|
-
"@dxos/invariant": "0.5.5-main.
|
|
58
|
-
"@dxos/keys": "0.5.5-main.
|
|
59
|
-
"@dxos/
|
|
60
|
-
"@
|
|
61
|
-
"@dxos/node-std": "0.5.5-main.
|
|
62
|
-
"@dxos/protocols": "0.5.5-main.
|
|
63
|
-
"@dxos/util": "0.5.5-main.
|
|
52
|
+
"@braneframe/types": "0.5.5-main.6dd4e95",
|
|
53
|
+
"@dxos/async": "0.5.5-main.6dd4e95",
|
|
54
|
+
"@dxos/context": "0.5.5-main.6dd4e95",
|
|
55
|
+
"@dxos/client": "0.5.5-main.6dd4e95",
|
|
56
|
+
"@dxos/echo-db": "0.5.5-main.6dd4e95",
|
|
57
|
+
"@dxos/invariant": "0.5.5-main.6dd4e95",
|
|
58
|
+
"@dxos/keys": "0.5.5-main.6dd4e95",
|
|
59
|
+
"@dxos/echo-schema": "0.5.5-main.6dd4e95",
|
|
60
|
+
"@dxos/log": "0.5.5-main.6dd4e95",
|
|
61
|
+
"@dxos/node-std": "0.5.5-main.6dd4e95",
|
|
62
|
+
"@dxos/protocols": "0.5.5-main.6dd4e95",
|
|
63
|
+
"@dxos/util": "0.5.5-main.6dd4e95"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@types/express": "^4.17.17",
|
|
67
67
|
"@types/ws": "^7.4.0",
|
|
68
|
-
"@dxos/agent": "0.5.5-main.
|
|
68
|
+
"@dxos/agent": "0.5.5-main.6dd4e95"
|
|
69
69
|
},
|
|
70
70
|
"publishConfig": {
|
|
71
71
|
"access": "public"
|
package/src/testing/setup.ts
CHANGED
|
@@ -28,6 +28,7 @@ export const createInitializedClients = async (testBuilder: TestBuilder, count:
|
|
|
28
28
|
clients.map(async (client, index) => {
|
|
29
29
|
await client.initialize();
|
|
30
30
|
await client.halo.createIdentity({ displayName: `Peer ${index}` });
|
|
31
|
+
await client.spaces.isReady;
|
|
31
32
|
client.addSchema(FunctionDef, FunctionTrigger, TestType);
|
|
32
33
|
return client;
|
|
33
34
|
}),
|
package/src/testing/types.ts
CHANGED