@dxos/functions 0.5.3-main.a3ea5f1 → 0.5.3-main.ac34611
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-366QG6IX.mjs → chunk-HRU7VDYL.mjs} +14 -8
- package/dist/lib/browser/chunk-HRU7VDYL.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +85 -49
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/types.mjs +3 -1
- package/dist/lib/node/{chunk-3VSJ57ZZ.cjs → chunk-R5JUDLSN.cjs} +17 -10
- package/dist/lib/node/chunk-R5JUDLSN.cjs.map +7 -0
- package/dist/lib/node/index.cjs +100 -60
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/types.cjs +6 -4
- package/dist/lib/node/types.cjs.map +2 -2
- package/dist/types/src/browser/index.d.ts +2 -0
- package/dist/types/src/browser/index.d.ts.map +1 -0
- package/dist/types/src/function/function-registry.d.ts.map +1 -1
- package/dist/types/src/handler.d.ts.map +1 -1
- package/dist/types/src/runtime/scheduler.d.ts +1 -1
- package/dist/types/src/runtime/scheduler.d.ts.map +1 -1
- package/dist/types/src/trigger/trigger-registry.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +34 -30
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +14 -14
- package/src/browser/index.ts +5 -0
- package/src/function/function-registry.ts +5 -5
- package/src/runtime/scheduler.ts +7 -2
- package/src/trigger/trigger-registry.ts +23 -11
- package/src/types.ts +37 -27
- package/dist/lib/browser/chunk-366QG6IX.mjs.map +0 -7
- package/dist/lib/node/chunk-3VSJ57ZZ.cjs.map +0 -7
- package/dist/types/src/util.d.ts +0 -15
- package/dist/types/src/util.d.ts.map +0 -1
- package/dist/types/src/util.test.d.ts +0 -2
- package/dist/types/src/util.test.d.ts.map +0 -1
- package/src/util.test.ts +0 -43
- package/src/util.ts +0 -48
package/dist/lib/node/meta.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/core/functions/src/types.ts":{"bytes":8855,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/util.ts":{"bytes":3615,"imports":[],"format":"esm"},"packages/core/functions/src/function/function-registry.ts":{"bytes":11110,"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"},{"path":"packages/core/functions/src/util.ts","kind":"import-statement","original":"../util"}],"format":"esm"},"packages/core/functions/src/function/index.ts":{"bytes":497,"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":6874,"imports":[{"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":27347,"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":16335,"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":566,"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":9970,"imports":[{"path":"@braneframe/types","kind":"import-statement","external":true},{"path":"@dxos/async","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":4169,"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":4272,"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":10377,"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":829,"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":24636,"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"},{"path":"packages/core/functions/src/util.ts","kind":"import-statement","original":"../util"}],"format":"esm"},"packages/core/functions/src/trigger/index.ts":{"bytes":495,"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":801,"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"}},"outputs":{"packages/core/functions/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":57570},"packages/core/functions/dist/lib/node/index.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-3VSJ57ZZ.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":"@dxos/client","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/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","FunctionDef","FunctionManifestSchema","FunctionRegistry","FunctionTrigger","Scheduler","TriggerRegistry","subscriptionHandler"],"entryPoint":"packages/core/functions/src/index.ts","inputs":{"packages/core/functions/src/function/function-registry.ts":{"bytesInOutput":2464},"packages/core/functions/src/util.ts":{"bytesInOutput":558},"packages/core/functions/src/function/index.ts":{"bytesInOutput":0},"packages/core/functions/src/index.ts":{"bytesInOutput":0},"packages/core/functions/src/handler.ts":{"bytesInOutput":1152},"packages/core/functions/src/runtime/dev-server.ts":{"bytesInOutput":7758},"packages/core/functions/src/runtime/index.ts":{"bytesInOutput":0},"packages/core/functions/src/runtime/scheduler.ts":{"bytesInOutput":4085},"packages/core/functions/src/trigger/trigger-registry.ts":{"bytesInOutput":5817},"packages/core/functions/src/trigger/type/subscription-trigger.ts":{"bytesInOutput":2241},"packages/core/functions/src/trigger/type/index.ts":{"bytesInOutput":0},"packages/core/functions/src/trigger/type/timer-trigger.ts":{"bytesInOutput":922},"packages/core/functions/src/trigger/type/webhook-trigger.ts":{"bytesInOutput":825},"packages/core/functions/src/trigger/type/websocket-trigger.ts":{"bytesInOutput":2847},"packages/core/functions/src/trigger/index.ts":{"bytesInOutput":0}},"bytes":29670},"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-3VSJ57ZZ.cjs","kind":"import-statement"}],"exports":["FunctionDef","FunctionManifestSchema","FunctionTrigger"],"entryPoint":"packages/core/functions/src/types.ts","inputs":{},"bytes":205},"packages/core/functions/dist/lib/node/chunk-3VSJ57ZZ.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4997},"packages/core/functions/dist/lib/node/chunk-3VSJ57ZZ.cjs":{"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"exports":["FunctionDef","FunctionManifestSchema","FunctionTrigger","__require"],"inputs":{"packages/core/functions/src/types.ts":{"bytesInOutput":1746}},"bytes":2285}}}
|
|
1
|
+
{"inputs":{"packages/core/functions/src/types.ts":{"bytes":9577,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/function/function-registry.ts":{"bytes":11223,"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":497,"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":6874,"imports":[{"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":27347,"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":17832,"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":566,"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":9970,"imports":[{"path":"@braneframe/types","kind":"import-statement","external":true},{"path":"@dxos/async","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":4169,"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":4272,"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":10377,"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":829,"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":26200,"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":495,"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":801,"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"}},"outputs":{"packages/core/functions/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":56779},"packages/core/functions/dist/lib/node/index.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-R5JUDLSN.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":"@dxos/client","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/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","FUNCTION_SCHEMA","FunctionDef","FunctionManifestSchema","FunctionRegistry","FunctionTrigger","Scheduler","TriggerRegistry","subscriptionHandler"],"entryPoint":"packages/core/functions/src/index.ts","inputs":{"packages/core/functions/src/function/function-registry.ts":{"bytesInOutput":2655},"packages/core/functions/src/function/index.ts":{"bytesInOutput":0},"packages/core/functions/src/index.ts":{"bytesInOutput":0},"packages/core/functions/src/handler.ts":{"bytesInOutput":1152},"packages/core/functions/src/runtime/dev-server.ts":{"bytesInOutput":7758},"packages/core/functions/src/runtime/index.ts":{"bytesInOutput":0},"packages/core/functions/src/runtime/scheduler.ts":{"bytesInOutput":4633},"packages/core/functions/src/trigger/trigger-registry.ts":{"bytesInOutput":6515},"packages/core/functions/src/trigger/type/subscription-trigger.ts":{"bytesInOutput":2241},"packages/core/functions/src/trigger/type/index.ts":{"bytesInOutput":0},"packages/core/functions/src/trigger/type/timer-trigger.ts":{"bytesInOutput":922},"packages/core/functions/src/trigger/type/webhook-trigger.ts":{"bytesInOutput":825},"packages/core/functions/src/trigger/type/websocket-trigger.ts":{"bytesInOutput":2847},"packages/core/functions/src/trigger/index.ts":{"bytesInOutput":0}},"bytes":30485},"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-R5JUDLSN.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-R5JUDLSN.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5377},"packages/core/functions/dist/lib/node/chunk-R5JUDLSN.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":1873}},"bytes":2431}}}
|
package/dist/lib/node/types.cjs
CHANGED
|
@@ -18,14 +18,16 @@ 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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
FUNCTION_SCHEMA: () => import_chunk_R5JUDLSN.FUNCTION_SCHEMA,
|
|
22
|
+
FunctionDef: () => import_chunk_R5JUDLSN.FunctionDef,
|
|
23
|
+
FunctionManifestSchema: () => import_chunk_R5JUDLSN.FunctionManifestSchema,
|
|
24
|
+
FunctionTrigger: () => import_chunk_R5JUDLSN.FunctionTrigger
|
|
24
25
|
});
|
|
25
26
|
module.exports = __toCommonJS(types_exports);
|
|
26
|
-
var
|
|
27
|
+
var import_chunk_R5JUDLSN = require("./chunk-R5JUDLSN.cjs");
|
|
27
28
|
// Annotate the CommonJS export names for ESM import in node:
|
|
28
29
|
0 && (module.exports = {
|
|
30
|
+
FUNCTION_SCHEMA,
|
|
29
31
|
FunctionDef,
|
|
30
32
|
FunctionManifestSchema,
|
|
31
33
|
FunctionTrigger
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["types.cjs"],
|
|
4
|
-
"sourcesContent": ["import {\n FunctionDef,\n FunctionManifestSchema,\n FunctionTrigger\n} from \"./chunk-
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
4
|
+
"sourcesContent": ["import {\n FUNCTION_SCHEMA,\n FunctionDef,\n FunctionManifestSchema,\n FunctionTrigger\n} from \"./chunk-R5JUDLSN.cjs\";\nexport {\n FUNCTION_SCHEMA,\n FunctionDef,\n FunctionManifestSchema,\n FunctionTrigger\n};\n//# sourceMappingURL=types.cjs.map\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAKO;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/browser/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"function-registry.d.ts","sourceRoot":"","sources":["../../../../src/function/function-registry.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAkB,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,KAAK,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAKvD,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"function-registry.d.ts","sourceRoot":"","sources":["../../../../src/function/function-registry.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAA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private _ctx;
|
|
18
|
-
private readonly
|
|
18
|
+
private readonly _functionUriToCallMutex;
|
|
19
19
|
constructor(functions: FunctionRegistry, triggers: TriggerRegistry, _options?: SchedulerOptions);
|
|
20
20
|
start(): Promise<void>;
|
|
21
21
|
stop(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduler.d.ts","sourceRoot":"","sources":["../../../../src/runtime/scheduler.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAI/C,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAoB,KAAK,gBAAgB,EAAwB,MAAM,UAAU,CAAC;AAEzF,MAAM,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;AAE7D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,qBAAa,SAAS;aAMF,SAAS,EAAE,gBAAgB;aAC3B,QAAQ,EAAE,eAAe;IACzC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAP3B,OAAO,CAAC,IAAI,CAAmB;IAE/B,OAAO,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"scheduler.d.ts","sourceRoot":"","sources":["../../../../src/runtime/scheduler.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAI/C,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAoB,KAAK,gBAAgB,EAAwB,MAAM,UAAU,CAAC;AAEzF,MAAM,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;AAE7D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,qBAAa,SAAS;aAMF,SAAS,EAAE,gBAAgB;aAC3B,QAAQ,EAAE,eAAe;IACzC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAP3B,OAAO,CAAC,IAAI,CAAmB;IAE/B,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAA4B;gBAGlD,SAAS,EAAE,gBAAgB,EAC3B,QAAQ,EAAE,eAAe,EACxB,QAAQ,GAAE,gBAAqB;IAU5C,KAAK;IAOL,IAAI;IAOG,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,gBAAgB;YAKhD,qBAAqB;YAWrB,QAAQ;YAwBR,aAAa;CA2C5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger-registry.d.ts","sourceRoot":"","sources":["../../../../src/trigger/trigger-registry.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAA2B,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAQlD,OAAO,EAAE,KAAK,gBAAgB,EAAE,eAAe,EAAE,KAAK,mBAAmB,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"trigger-registry.d.ts","sourceRoot":"","sources":["../../../../src/trigger/trigger-registry.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAA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BAAmB;IAKxC,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,eAAe,EAAE;IAIlD,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,eAAe,EAAE;IAIrD,QAAQ,CAAC,UAAU,EAAE,cAAc,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAmB9G;;OAEG;IACU,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;cAyBrD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;cA6BtB,MAAM,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAK1D,OAAO,CAAC,kBAAkB;YAgBZ,sBAAsB;IA2BpC,OAAO,CAAC,YAAY;CAIrB"}
|
|
@@ -6,7 +6,7 @@ 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.struct<{
|
|
9
|
+
declare const SubscriptionTriggerSchema: S.mutable<S.struct<{
|
|
10
10
|
type: S.literal<["subscription"]>;
|
|
11
11
|
filter: S.array<S.struct<{
|
|
12
12
|
type: S.$string;
|
|
@@ -23,12 +23,12 @@ declare const SubscriptionTriggerSchema: S.struct<{
|
|
|
23
23
|
readonly deep?: boolean | undefined;
|
|
24
24
|
readonly delay?: number | undefined;
|
|
25
25
|
} | undefined, never>;
|
|
26
|
-
}
|
|
26
|
+
}>>;
|
|
27
27
|
export type SubscriptionTrigger = S.Schema.Type<typeof SubscriptionTriggerSchema>;
|
|
28
|
-
declare const TimerTriggerSchema: S.struct<{
|
|
28
|
+
declare const TimerTriggerSchema: S.mutable<S.struct<{
|
|
29
29
|
type: S.literal<["timer"]>;
|
|
30
30
|
cron: S.$string;
|
|
31
|
-
}
|
|
31
|
+
}>>;
|
|
32
32
|
export type TimerTrigger = S.Schema.Type<typeof TimerTriggerSchema>;
|
|
33
33
|
declare const WebhookTriggerSchema: S.mutable<S.struct<{
|
|
34
34
|
type: S.literal<["webhook"]>;
|
|
@@ -36,7 +36,7 @@ declare const WebhookTriggerSchema: S.mutable<S.struct<{
|
|
|
36
36
|
port: S.PropertySignature<"?:", number | undefined, never, "?:", number | undefined, never>;
|
|
37
37
|
}>>;
|
|
38
38
|
export type WebhookTrigger = S.Schema.Type<typeof WebhookTriggerSchema>;
|
|
39
|
-
declare const WebsocketTriggerSchema: S.struct<{
|
|
39
|
+
declare const WebsocketTriggerSchema: S.mutable<S.struct<{
|
|
40
40
|
type: S.literal<["websocket"]>;
|
|
41
41
|
url: S.$string;
|
|
42
42
|
init: S.PropertySignature<"?:", {
|
|
@@ -44,7 +44,7 @@ declare const WebsocketTriggerSchema: S.struct<{
|
|
|
44
44
|
} | undefined, never, "?:", {
|
|
45
45
|
readonly [x: string]: any;
|
|
46
46
|
} | undefined, never>;
|
|
47
|
-
}
|
|
47
|
+
}>>;
|
|
48
48
|
export type WebsocketTrigger = S.Schema.Type<typeof WebsocketTriggerSchema>;
|
|
49
49
|
export type TriggerSpec = TimerTrigger | WebhookTrigger | WebsocketTrigger | SubscriptionTrigger;
|
|
50
50
|
declare const FunctionDef_base: import("@dxos/echo-schema").EchoSchemaClass<{
|
|
@@ -62,30 +62,31 @@ export declare class FunctionDef extends FunctionDef_base {
|
|
|
62
62
|
}
|
|
63
63
|
declare const FunctionTrigger_base: import("@dxos/echo-schema").EchoSchemaClass<{
|
|
64
64
|
function: string;
|
|
65
|
+
enabled?: boolean | undefined;
|
|
65
66
|
meta?: object | undefined;
|
|
66
67
|
spec: {
|
|
67
|
-
|
|
68
|
+
filter: readonly {
|
|
68
69
|
readonly type: string;
|
|
69
70
|
readonly props?: {
|
|
70
71
|
readonly [x: string]: any;
|
|
71
72
|
} | undefined;
|
|
72
73
|
}[];
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
type: "subscription";
|
|
75
|
+
options?: {
|
|
75
76
|
readonly deep?: boolean | undefined;
|
|
76
77
|
readonly delay?: number | undefined;
|
|
77
78
|
} | undefined;
|
|
78
79
|
} | {
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
type: "timer";
|
|
81
|
+
cron: string;
|
|
81
82
|
} | {
|
|
82
83
|
port?: number | undefined;
|
|
83
84
|
type: "webhook";
|
|
84
85
|
method: string;
|
|
85
86
|
} | {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
type: "websocket";
|
|
88
|
+
url: string;
|
|
89
|
+
init?: {
|
|
89
90
|
readonly [x: string]: any;
|
|
90
91
|
} | undefined;
|
|
91
92
|
};
|
|
@@ -125,30 +126,31 @@ export declare const FunctionManifestSchema: S.struct<{
|
|
|
125
126
|
})[] | undefined, never>;
|
|
126
127
|
triggers: S.PropertySignature<"?:", ({
|
|
127
128
|
function: string;
|
|
129
|
+
enabled?: boolean | undefined;
|
|
128
130
|
meta?: object | undefined;
|
|
129
131
|
spec: {
|
|
130
|
-
|
|
132
|
+
filter: readonly {
|
|
131
133
|
readonly type: string;
|
|
132
134
|
readonly props?: {
|
|
133
135
|
readonly [x: string]: any;
|
|
134
136
|
} | undefined;
|
|
135
137
|
}[];
|
|
136
|
-
|
|
137
|
-
|
|
138
|
+
type: "subscription";
|
|
139
|
+
options?: {
|
|
138
140
|
readonly deep?: boolean | undefined;
|
|
139
141
|
readonly delay?: number | undefined;
|
|
140
142
|
} | undefined;
|
|
141
143
|
} | {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
+
type: "timer";
|
|
145
|
+
cron: string;
|
|
144
146
|
} | {
|
|
145
147
|
port?: number | undefined;
|
|
146
148
|
type: "webhook";
|
|
147
149
|
method: string;
|
|
148
150
|
} | {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
151
|
+
type: "websocket";
|
|
152
|
+
url: string;
|
|
153
|
+
init?: {
|
|
152
154
|
readonly [x: string]: any;
|
|
153
155
|
} | undefined;
|
|
154
156
|
};
|
|
@@ -161,30 +163,31 @@ export declare const FunctionManifestSchema: S.struct<{
|
|
|
161
163
|
} | undefined;
|
|
162
164
|
})[] | undefined, never, "?:", ({
|
|
163
165
|
function: string;
|
|
166
|
+
enabled?: boolean | undefined;
|
|
164
167
|
meta?: object | undefined;
|
|
165
168
|
spec: {
|
|
166
|
-
|
|
169
|
+
filter: readonly {
|
|
167
170
|
readonly type: string;
|
|
168
171
|
readonly props?: {
|
|
169
172
|
readonly [x: string]: any;
|
|
170
173
|
} | undefined;
|
|
171
174
|
}[];
|
|
172
|
-
|
|
173
|
-
|
|
175
|
+
type: "subscription";
|
|
176
|
+
options?: {
|
|
174
177
|
readonly deep?: boolean | undefined;
|
|
175
178
|
readonly delay?: number | undefined;
|
|
176
179
|
} | undefined;
|
|
177
180
|
} | {
|
|
178
|
-
|
|
179
|
-
|
|
181
|
+
type: "timer";
|
|
182
|
+
cron: string;
|
|
180
183
|
} | {
|
|
181
184
|
port?: number | undefined;
|
|
182
185
|
type: "webhook";
|
|
183
186
|
method: string;
|
|
184
187
|
} | {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
+
type: "websocket";
|
|
189
|
+
url: string;
|
|
190
|
+
init?: {
|
|
188
191
|
readonly [x: string]: any;
|
|
189
192
|
} | undefined;
|
|
190
193
|
};
|
|
@@ -198,5 +201,6 @@ export declare const FunctionManifestSchema: S.struct<{
|
|
|
198
201
|
})[] | undefined, never>;
|
|
199
202
|
}>;
|
|
200
203
|
export type FunctionManifest = S.Schema.Type<typeof FunctionManifestSchema>;
|
|
204
|
+
export declare const FUNCTION_SCHEMA: (typeof FunctionDef | typeof FunctionTrigger)[];
|
|
201
205
|
export {};
|
|
202
206
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -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,gBAS/B;CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEL,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.3-main.
|
|
3
|
+
"version": "0.5.3-main.ac34611",
|
|
4
4
|
"description": "Functions API and runtime.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -40,23 +40,23 @@
|
|
|
40
40
|
"express": "^4.19.2",
|
|
41
41
|
"get-port-please": "^3.1.1",
|
|
42
42
|
"ws": "^8.14.2",
|
|
43
|
-
"@braneframe/types": "0.5.3-main.
|
|
44
|
-
"@dxos/async": "0.5.3-main.
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/echo-schema": "0.5.3-main.
|
|
48
|
-
"@dxos/invariant": "0.5.3-main.
|
|
49
|
-
"@dxos/keys": "0.5.3-main.
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/protocols": "0.5.3-main.
|
|
54
|
-
"@dxos/util": "0.5.3-main.
|
|
43
|
+
"@braneframe/types": "0.5.3-main.ac34611",
|
|
44
|
+
"@dxos/async": "0.5.3-main.ac34611",
|
|
45
|
+
"@dxos/client": "0.5.3-main.ac34611",
|
|
46
|
+
"@dxos/context": "0.5.3-main.ac34611",
|
|
47
|
+
"@dxos/echo-schema": "0.5.3-main.ac34611",
|
|
48
|
+
"@dxos/invariant": "0.5.3-main.ac34611",
|
|
49
|
+
"@dxos/keys": "0.5.3-main.ac34611",
|
|
50
|
+
"@dxos/echo-db": "0.5.3-main.ac34611",
|
|
51
|
+
"@dxos/node-std": "0.5.3-main.ac34611",
|
|
52
|
+
"@dxos/log": "0.5.3-main.ac34611",
|
|
53
|
+
"@dxos/protocols": "0.5.3-main.ac34611",
|
|
54
|
+
"@dxos/util": "0.5.3-main.ac34611"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/express": "^4.17.17",
|
|
58
58
|
"@types/ws": "^7.4.0",
|
|
59
|
-
"@dxos/agent": "0.5.3-main.
|
|
59
|
+
"@dxos/agent": "0.5.3-main.ac34611"
|
|
60
60
|
},
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|
|
@@ -8,10 +8,9 @@ import { create, Filter, type Space } from '@dxos/client/echo';
|
|
|
8
8
|
import { type Context, Resource } from '@dxos/context';
|
|
9
9
|
import { PublicKey } from '@dxos/keys';
|
|
10
10
|
import { log } from '@dxos/log';
|
|
11
|
-
import { ComplexMap } from '@dxos/util';
|
|
11
|
+
import { ComplexMap, diff } from '@dxos/util';
|
|
12
12
|
|
|
13
13
|
import { FunctionDef, type FunctionManifest } from '../types';
|
|
14
|
-
import { diff } from '../util';
|
|
15
14
|
|
|
16
15
|
export type FunctionsRegisteredEvent = {
|
|
17
16
|
space: Space;
|
|
@@ -46,13 +45,13 @@ export class FunctionRegistry extends Resource {
|
|
|
46
45
|
|
|
47
46
|
// Sync definitions.
|
|
48
47
|
const { objects: existing } = await space.db.query(Filter.schema(FunctionDef)).run();
|
|
49
|
-
const { added
|
|
50
|
-
added.forEach((def) => space.db.add(create(FunctionDef, def)));
|
|
48
|
+
const { added } = diff(existing, functions, (a, b) => a.uri === b.uri);
|
|
51
49
|
// TODO(burdon): Update existing templates.
|
|
52
|
-
|
|
50
|
+
added.forEach((def) => space.db.add(create(FunctionDef, def)));
|
|
53
51
|
}
|
|
54
52
|
|
|
55
53
|
protected override async _open(): Promise<void> {
|
|
54
|
+
log.info('opening...');
|
|
56
55
|
const spacesSubscription = this._client.spaces.subscribe(async (spaces) => {
|
|
57
56
|
for (const space of spaces) {
|
|
58
57
|
if (this._functionBySpaceKey.has(space.key)) {
|
|
@@ -85,6 +84,7 @@ export class FunctionRegistry extends Resource {
|
|
|
85
84
|
}
|
|
86
85
|
|
|
87
86
|
protected override async _close(_: Context): Promise<void> {
|
|
87
|
+
log.info('closing...');
|
|
88
88
|
this._functionBySpaceKey.clear();
|
|
89
89
|
}
|
|
90
90
|
}
|
package/src/runtime/scheduler.ts
CHANGED
|
@@ -27,7 +27,7 @@ export type SchedulerOptions = {
|
|
|
27
27
|
export class Scheduler {
|
|
28
28
|
private _ctx = createContext();
|
|
29
29
|
|
|
30
|
-
private readonly
|
|
30
|
+
private readonly _functionUriToCallMutex = new Map<string, Mutex>();
|
|
31
31
|
|
|
32
32
|
constructor(
|
|
33
33
|
public readonly functions: FunctionRegistry,
|
|
@@ -80,7 +80,12 @@ export class Scheduler {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
await this.triggers.activate({ space }, fnTrigger, async (args) => {
|
|
83
|
-
|
|
83
|
+
const mutex = this._functionUriToCallMutex.get(definition.uri) ?? new Mutex();
|
|
84
|
+
this._functionUriToCallMutex.set(definition.uri, mutex);
|
|
85
|
+
|
|
86
|
+
log.info('function triggered, waiting for mutex', { uri: definition.uri });
|
|
87
|
+
return mutex.executeSynchronized(() => {
|
|
88
|
+
log.info('mutex acquired', { uri: definition.uri });
|
|
84
89
|
return this._execFunction(definition, fnTrigger, {
|
|
85
90
|
meta: fnTrigger.meta,
|
|
86
91
|
data: { ...args, spaceKey: space.key },
|
|
@@ -10,11 +10,10 @@ import { ECHO_ATTR_META, foreignKey, foreignKeyEquals, splitMeta } from '@dxos/e
|
|
|
10
10
|
import { invariant } from '@dxos/invariant';
|
|
11
11
|
import { PublicKey } from '@dxos/keys';
|
|
12
12
|
import { log } from '@dxos/log';
|
|
13
|
-
import { ComplexMap } from '@dxos/util';
|
|
13
|
+
import { ComplexMap, diff, intersection } from '@dxos/util';
|
|
14
14
|
|
|
15
15
|
import { createSubscriptionTrigger, createTimerTrigger, createWebhookTrigger, createWebsocketTrigger } from './type';
|
|
16
16
|
import { type FunctionManifest, FunctionTrigger, type FunctionTriggerType, type TriggerSpec } from '../types';
|
|
17
|
-
import { diff, intersection } from '../util';
|
|
18
17
|
|
|
19
18
|
type ResponseCode = number;
|
|
20
19
|
|
|
@@ -104,22 +103,22 @@ export class TriggerRegistry extends Resource {
|
|
|
104
103
|
|
|
105
104
|
// Sync triggers.
|
|
106
105
|
const { objects: existing } = await space.db.query(Filter.schema(FunctionTrigger)).run();
|
|
107
|
-
const { added
|
|
106
|
+
const { added } = diff(existing, manifest.triggers, (a, b) => {
|
|
108
107
|
// Create FK to enable syncing if none are set.
|
|
109
108
|
// TODO(burdon): Warn if not unique.
|
|
110
109
|
const keys = b[ECHO_ATTR_META]?.keys ?? [foreignKey('manifest', [b.function, b.spec.type].join('-'))];
|
|
111
110
|
return intersection(getMeta(a)?.keys ?? [], keys, foreignKeyEquals).length > 0;
|
|
112
111
|
});
|
|
113
112
|
|
|
113
|
+
// TODO(burdon): Update existing.
|
|
114
114
|
added.forEach((trigger) => {
|
|
115
115
|
const { meta, object } = splitMeta(trigger);
|
|
116
116
|
space.db.add(create(FunctionTrigger, object, meta));
|
|
117
117
|
});
|
|
118
|
-
// TODO(burdon): Update existing triggers.
|
|
119
|
-
removed.forEach((trigger) => space.db.remove(trigger));
|
|
120
118
|
}
|
|
121
119
|
|
|
122
120
|
protected override async _open(): Promise<void> {
|
|
121
|
+
log.info('open...');
|
|
123
122
|
const spaceListSubscription = this._client.spaces.subscribe(async (spaces) => {
|
|
124
123
|
for (const space of spaces) {
|
|
125
124
|
if (this._triggersBySpaceKey.has(space.key)) {
|
|
@@ -132,12 +131,15 @@ export class TriggerRegistry extends Resource {
|
|
|
132
131
|
if (this._ctx.disposed) {
|
|
133
132
|
break;
|
|
134
133
|
}
|
|
135
|
-
const functionsSubscription = space.db.query(Filter.schema(FunctionTrigger)).subscribe(async (triggers) => {
|
|
136
|
-
await this._handleRemovedTriggers(space, triggers.objects, registered);
|
|
137
|
-
this._handleNewTriggers(space, triggers.objects, registered);
|
|
138
|
-
});
|
|
139
134
|
|
|
140
|
-
|
|
135
|
+
// Subscribe to updates.
|
|
136
|
+
this._ctx.onDispose(
|
|
137
|
+
space.db.query(Filter.schema(FunctionTrigger)).subscribe(async (triggers) => {
|
|
138
|
+
log.info('update', { space: space.key, triggers: triggers.objects.length });
|
|
139
|
+
await this._handleRemovedTriggers(space, triggers.objects, registered);
|
|
140
|
+
this._handleNewTriggers(space, triggers.objects, registered);
|
|
141
|
+
}),
|
|
142
|
+
);
|
|
141
143
|
}
|
|
142
144
|
});
|
|
143
145
|
|
|
@@ -145,6 +147,7 @@ export class TriggerRegistry extends Resource {
|
|
|
145
147
|
}
|
|
146
148
|
|
|
147
149
|
protected override async _close(_: Context): Promise<void> {
|
|
150
|
+
log.info('close...');
|
|
148
151
|
this._triggersBySpaceKey.clear();
|
|
149
152
|
}
|
|
150
153
|
|
|
@@ -156,7 +159,10 @@ export class TriggerRegistry extends Resource {
|
|
|
156
159
|
if (newTriggers.length > 0) {
|
|
157
160
|
const newRegisteredTriggers: RegisteredTrigger[] = newTriggers.map((trigger) => ({ trigger }));
|
|
158
161
|
registered.push(...newRegisteredTriggers);
|
|
159
|
-
log('
|
|
162
|
+
log.info('added', () => ({
|
|
163
|
+
spaceKey: space.key,
|
|
164
|
+
triggers: newTriggers.map((trigger) => trigger.function),
|
|
165
|
+
}));
|
|
160
166
|
this.registered.emit({ space, triggers: newTriggers });
|
|
161
167
|
}
|
|
162
168
|
}
|
|
@@ -171,6 +177,12 @@ export class TriggerRegistry extends Resource {
|
|
|
171
177
|
const wasRemoved =
|
|
172
178
|
allTriggers.find((trigger: FunctionTrigger) => trigger.id === registered[i].trigger.id) == null;
|
|
173
179
|
if (wasRemoved) {
|
|
180
|
+
if (removed.length) {
|
|
181
|
+
log.info('removed', () => ({
|
|
182
|
+
spaceKey: space.key,
|
|
183
|
+
triggers: removed.map((trigger) => trigger.function),
|
|
184
|
+
}));
|
|
185
|
+
}
|
|
174
186
|
const unregistered = registered.splice(i, 1)[0];
|
|
175
187
|
await unregistered.activationCtx?.dispose();
|
|
176
188
|
removed.push(unregistered.trigger);
|