@dxos/functions 0.5.5 → 0.5.6-main.1a02a59
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-ERL6PHMU.mjs → chunk-SXZ5DYJG.mjs} +26 -21
- package/dist/lib/browser/{chunk-ERL6PHMU.mjs.map → chunk-SXZ5DYJG.mjs.map} +3 -3
- package/dist/lib/browser/index.mjs +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +8 -5
- 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-INM6XAL7.cjs → chunk-RPHL3ORN.cjs} +42 -37
- package/dist/lib/node/{chunk-INM6XAL7.cjs.map → chunk-RPHL3ORN.cjs.map} +3 -3
- package/dist/lib/node/index.cjs +10 -10
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +14 -11
- 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/trigger/type/websocket-trigger.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/runtime/dev-server.test.ts +2 -2
- package/src/runtime/scheduler.test.ts +4 -2
- package/src/testing/setup.ts +5 -3
- package/src/testing/types.ts +1 -1
- package/src/trigger/type/websocket-trigger.ts +12 -8
- package/src/types.ts +31 -31
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"inject-globals:@inject-globals":{"bytes":384,"imports":[{"path":"@dxos/node-std/inject-globals","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/types.ts":{"bytes":9711,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@inject-globals","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"},{"path":"@inject-globals","kind":"import-statement","external":true}],"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"},{"path":"@inject-globals","kind":"import-statement","external":true}],"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},{"path":"@inject-globals","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":"@dxos/node-std/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":"@inject-globals","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":"@dxos/node-std/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":"@inject-globals","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"},{"path":"@inject-globals","kind":"import-statement","external":true}],"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},{"path":"@inject-globals","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},{"path":"@inject-globals","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":"@dxos/node-std/http","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/trigger/type/websocket-trigger.ts":{"bytes":10551,"imports":[{"path":"ws","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@inject-globals","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"},{"path":"@inject-globals","kind":"import-statement","external":true}],"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"},{"path":"@inject-globals","kind":"import-statement","external":true}],"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"},{"path":"@inject-globals","kind":"import-statement","external":true}],"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"},{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/testing/types.ts":{"bytes":1131,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/testing/setup.ts":{"bytes":12011,"imports":[{"path":"@dxos/node-std/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"},{"path":"@inject-globals","kind":"import-statement","external":true}],"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"},{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/testing/manifest.ts":{"bytes":1139,"imports":[{"path":"@inject-globals","kind":"import-statement","external":true}],"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"},{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"packages/core/functions/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4964},"packages/core/functions/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-ERL6PHMU.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-4D4I3YMJ.mjs","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":2205},"packages/core/functions/dist/lib/browser/testing/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":9399},"packages/core/functions/dist/lib/browser/testing/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-ERL6PHMU.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-4D4I3YMJ.mjs","kind":"import-statement"},{"path":"@dxos/node-std/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":2603},"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":4615},"packages/core/functions/dist/lib/browser/chunk-ERL6PHMU.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":54572},"packages/core/functions/dist/lib/browser/chunk-ERL6PHMU.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-4D4I3YMJ.mjs","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":"@dxos/node-std/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":"@dxos/node-std/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":"@dxos/node-std/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":7861},"packages/core/functions/src/runtime/scheduler.ts":{"bytesInOutput":4612},"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":839},"packages/core/functions/src/trigger/type/websocket-trigger.ts":{"bytesInOutput":2837},"packages/core/functions/src/trigger/index.ts":{"bytesInOutput":0}},"bytes":30132},"packages/core/functions/dist/lib/browser/types.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/browser/types.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-4D4I3YMJ.mjs","kind":"import-statement"}],"exports":["FUNCTION_SCHEMA","FunctionDef","FunctionManifestSchema","FunctionTrigger"],"entryPoint":"packages/core/functions/src/types.ts","inputs":{},"bytes":276},"packages/core/functions/dist/lib/browser/chunk-4D4I3YMJ.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5396},"packages/core/functions/dist/lib/browser/chunk-4D4I3YMJ.mjs":{"imports":[{"path":"@dxos/node-std/inject-globals","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"exports":["FUNCTION_SCHEMA","FunctionDef","FunctionManifestSchema","FunctionTrigger","__require"],"inputs":{"inject-globals:@inject-globals":{"bytesInOutput":90},"packages/core/functions/src/types.ts":{"bytesInOutput":1848}},"bytes":2564}}}
|
|
1
|
+
{"inputs":{"inject-globals:@inject-globals":{"bytes":384,"imports":[{"path":"@dxos/node-std/inject-globals","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/types.ts":{"bytes":9711,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@inject-globals","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"},{"path":"@inject-globals","kind":"import-statement","external":true}],"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"},{"path":"@inject-globals","kind":"import-statement","external":true}],"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},{"path":"@inject-globals","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":"@dxos/node-std/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":"@inject-globals","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":"@dxos/node-std/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":"@inject-globals","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"},{"path":"@inject-globals","kind":"import-statement","external":true}],"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},{"path":"@inject-globals","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},{"path":"@inject-globals","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":"@dxos/node-std/http","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@inject-globals","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},{"path":"@inject-globals","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"},{"path":"@inject-globals","kind":"import-statement","external":true}],"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"},{"path":"@inject-globals","kind":"import-statement","external":true}],"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"},{"path":"@inject-globals","kind":"import-statement","external":true}],"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"},{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/testing/types.ts":{"bytes":1131,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@inject-globals","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":"@dxos/node-std/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"},{"path":"@inject-globals","kind":"import-statement","external":true}],"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"},{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/testing/manifest.ts":{"bytes":1139,"imports":[{"path":"@inject-globals","kind":"import-statement","external":true}],"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"},{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"packages/core/functions/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4964},"packages/core/functions/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-SXZ5DYJG.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-ERWZ4JUZ.mjs","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":2205},"packages/core/functions/dist/lib/browser/testing/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":9699},"packages/core/functions/dist/lib/browser/testing/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-SXZ5DYJG.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-ERWZ4JUZ.mjs","kind":"import-statement"},{"path":"get-port-please","kind":"import-statement","external":true},{"path":"@dxos/node-std/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":2759},"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":4771},"packages/core/functions/dist/lib/browser/chunk-SXZ5DYJG.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":54819},"packages/core/functions/dist/lib/browser/chunk-SXZ5DYJG.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-ERWZ4JUZ.mjs","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":"@dxos/node-std/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":"@dxos/node-std/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":"@dxos/node-std/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":7861},"packages/core/functions/src/runtime/scheduler.ts":{"bytesInOutput":4612},"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":839},"packages/core/functions/src/trigger/type/websocket-trigger.ts":{"bytesInOutput":2942},"packages/core/functions/src/trigger/index.ts":{"bytesInOutput":0}},"bytes":30237},"packages/core/functions/dist/lib/browser/types.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/browser/types.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-ERWZ4JUZ.mjs","kind":"import-statement"}],"exports":["FUNCTION_SCHEMA","FunctionDef","FunctionManifestSchema","FunctionTrigger"],"entryPoint":"packages/core/functions/src/types.ts","inputs":{},"bytes":276},"packages/core/functions/dist/lib/browser/chunk-ERWZ4JUZ.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5396},"packages/core/functions/dist/lib/browser/chunk-ERWZ4JUZ.mjs":{"imports":[{"path":"@dxos/node-std/inject-globals","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"exports":["FUNCTION_SCHEMA","FunctionDef","FunctionManifestSchema","FunctionTrigger","__require"],"inputs":{"inject-globals:@inject-globals":{"bytesInOutput":90},"packages/core/functions/src/types.ts":{"bytesInOutput":1848}},"bytes":2564}}}
|
|
@@ -4,13 +4,14 @@ import {
|
|
|
4
4
|
FunctionRegistry,
|
|
5
5
|
Scheduler,
|
|
6
6
|
TriggerRegistry
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-SXZ5DYJG.mjs";
|
|
8
8
|
import {
|
|
9
9
|
FunctionDef,
|
|
10
10
|
FunctionTrigger
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-ERWZ4JUZ.mjs";
|
|
12
12
|
|
|
13
13
|
// packages/core/functions/src/testing/setup.ts
|
|
14
|
+
import { getRandomPort } from "get-port-please";
|
|
14
15
|
import path from "@dxos/node-std/path";
|
|
15
16
|
import { waitForCondition } from "@dxos/async";
|
|
16
17
|
import { Client, Config } from "@dxos/client";
|
|
@@ -22,12 +23,11 @@ var TestType = class extends TypedObject({
|
|
|
22
23
|
typename: "example.com/type/Test",
|
|
23
24
|
version: "0.1.0"
|
|
24
25
|
})({
|
|
25
|
-
title: S.
|
|
26
|
+
title: S.String
|
|
26
27
|
}) {
|
|
27
28
|
};
|
|
28
29
|
|
|
29
30
|
// packages/core/functions/src/testing/setup.ts
|
|
30
|
-
var functionsPort = 8081;
|
|
31
31
|
var createInitializedClients = async (testBuilder, count = 1, config) => {
|
|
32
32
|
const clients = range(count).map(() => new Client({
|
|
33
33
|
config,
|
|
@@ -39,11 +39,13 @@ var createInitializedClients = async (testBuilder, count = 1, config) => {
|
|
|
39
39
|
await client.halo.createIdentity({
|
|
40
40
|
displayName: `Peer ${index}`
|
|
41
41
|
});
|
|
42
|
+
await client.spaces.isReady;
|
|
42
43
|
client.addSchema(FunctionDef, FunctionTrigger, TestType);
|
|
43
44
|
return client;
|
|
44
45
|
}));
|
|
45
46
|
};
|
|
46
47
|
var createFunctionRuntime = async (testBuilder, pluginInitializer) => {
|
|
48
|
+
const functionsPort = await getRandomPort("127.0.0.1");
|
|
47
49
|
const config = new Config({
|
|
48
50
|
runtime: {
|
|
49
51
|
agent: {
|
|
@@ -51,7 +53,7 @@ var createFunctionRuntime = async (testBuilder, pluginInitializer) => {
|
|
|
51
53
|
{
|
|
52
54
|
id: "dxos.org/agent/plugin/functions",
|
|
53
55
|
config: {
|
|
54
|
-
port: functionsPort
|
|
56
|
+
port: functionsPort
|
|
55
57
|
}
|
|
56
58
|
}
|
|
57
59
|
]
|
|
@@ -90,6 +92,7 @@ var startScheduler = async (testBuilder, client, devServer, functionRegistry) =>
|
|
|
90
92
|
var startDevServer = async (testBuilder, client, functionRegistry, options) => {
|
|
91
93
|
const server = new DevServer(client, functionRegistry, {
|
|
92
94
|
baseDir: path.join(__dirname, "../testing"),
|
|
95
|
+
port: await getRandomPort("127.0.0.1"),
|
|
93
96
|
...options
|
|
94
97
|
});
|
|
95
98
|
await server.start();
|
|
@@ -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 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\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;AAIA,
|
|
6
|
-
"names": ["path", "waitForCondition", "Client", "Config", "range", "S", "TypedObject", "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,SAASA,qBAAqB;AAC9B,OAAOC,UAAU;AAEjB,SAASC,wBAAwB;AACjC,SAASC,QAAQC,cAAc;AAG/B,SAASC,aAAa;;;ACPtB,SAASC,GAAGC,mBAAmB;AAExB,IAAMC,WAAN,cAAuBC,YAAY;EAAEC,UAAU;EAAyBC,SAAS;AAAQ,CAAA,EAAG;EACjGC,OAAOC,EAAEC;AACX,CAAA,EAAA;AAAI;;;ADeG,IAAMC,2BAA2B,OAAOC,aAA0BC,QAAgB,GAAGC,WAAAA;AAC1F,QAAMC,UAAUC,MAAMH,KAAAA,EAAOI,IAAI,MAAM,IAAIC,OAAO;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,aAAaC,iBAAiBC,QAAAA;AAC/C,WAAOZ;EACT,CAAA,CAAA;AAEJ;AAEO,IAAMa,wBAAwB,OACnC1B,aACA2B,sBAAAA;AAEA,QAAMC,gBAAgB,MAAMC,cAAc,WAAA;AAC1C,QAAM3B,SAAS,IAAI4B,OAAO;IACxBC,SAAS;MACPC,OAAO;QACLC,SAAS;UAAC;YAAEC,IAAI;YAAmChC,QAAQ;cAAEiC,MAAMP;YAAc;UAAE;;MACrF;IACF;EACF,CAAA;AAEA,QAAM,CAACf,MAAAA,IAAU,MAAMd,yBAAyBC,aAAa,GAAGE,MAAAA;AAChE,QAAMkC,SAAS,MAAMT,kBAAkBd,MAAAA;AACvCb,cAAYS,IAAIC,UAAU,MAAM0B,OAAOC,MAAK,CAAA;AAC5C,SAAOxB;AACT;AAEO,IAAMyB,qBAAqB,OAChCtC,aACA2B,mBACAY,YAAAA;AAEA,QAAMC,kBAAkB,MAAMd,sBAAsB1B,aAAa2B,iBAAAA;AACjE,QAAMc,oBAAoB,IAAIC,iBAAiBF,eAAAA;AAC/C,QAAMG,YAAY,MAAMC,eAAe5C,aAAawC,iBAAiBC,mBAAmBF,OAAAA;AACxF,QAAMM,YAAY,MAAMC,eAAe9C,aAAawC,iBAAiBG,WAAWF,iBAAAA;AAChF,SAAO;IACLI;IACAhC,QAAQ2B;IACRO,uBAAuB,OAAOC,UAAAA;AAC5B,YAAMC,iBAAiB;QAAEC,WAAW,MAAML,UAAUM,SAASC,kBAAkBJ,KAAAA,EAAOK,SAAS;MAAE,CAAA;IACnG;EACF;AACF;AAEA,IAAMP,iBAAiB,OACrB9C,aACAa,QACA8B,WACAW,qBAAAA;AAEA,QAAMC,kBAAkB,IAAIC,gBAAgB3C,MAAAA;AAC5C,QAAMgC,YAAY,IAAIY,UAAUH,kBAAkBC,iBAAiB;IAAEG,UAAUf,UAAUe;EAAS,CAAA;AAClG,QAAMb,UAAUc,MAAK;AACrB3D,cAAYS,IAAIC,UAAU,MAAMmC,UAAUe,KAAI,CAAA;AAC9C,SAAOf;AACT;AAEA,IAAMD,iBAAiB,OACrB5C,aACAa,QACAyC,kBACAf,YAAAA;AAEA,QAAMsB,SAAS,IAAIC,UAAUjD,QAAQyC,kBAAkB;IACrDS,SAASC,KAAKC,KAAKC,WAAW,YAAA;IAC9B/B,MAAM,MAAMN,cAAc,WAAA;IAC1B,GAAGU;EACL,CAAA;AACA,QAAMsB,OAAOF,MAAK;AAClB3D,cAAYS,IAAIC,UAAU,MAAMmD,OAAOD,KAAI,CAAA;AAC3C,SAAOC;AACT;;;AEhGA,SAASM,cAA0B;AACnC,SAASC,yBAAyB;AAClC,SAASC,iBAAiB;AAC1B,SAASC,kBAAkB;;AAIpB,IAAMC,iBAAiB,OAAOC,OAAcC,QAAAA;AACjD,QAAMC,WACJ,MAAMF,MAAMG,GAAGC,MAAMC,OAAOC,OAAOC,iBAAiB,CAACC,MAAuBA,EAAEC,aAAaR,GAAAA,CAAAA,EAAMS,IAAG,GACpGC,QAAQ,CAAA;AACVC,YAAUV,QAAQW,KAAKC,SAAS,WAAA,QAAA;;;;;;;;;AAChC,OAAKC,MAAM,oBAAoBb,QAAQW,KAAKG,IAAI,EAAE;AACpD;AAEO,IAAMC,eAAe,OAAOC,MAAaC,UAAAA;AAC9C,QAAM,CAAC,EAAEC,YAAYC,eAAc,CAAE,IAAI,MAAMC,QAAQC,IAAIC,kBAAkB;IAAEN;IAAMC,OAAOA,MAAMM;EAAO,CAAA,CAAA;AACzG,MAAIJ,gBAAgBK,UAAUC,WAAWC,MAAMC,SAAS;AACtD,UAAM,IAAIC,MAAM,YAAYT,gBAAgBK,KAAAA,UAAeC,WAAWC,MAAMC,OAAO,GAAG;EACxF;AACF;;;ACnBO,IAAME,uBAAyC;EACpDC,WAAW;IACT;MACEC,KAAK;MACLC,OAAO;MACPC,SAAS;IACX;;AAEJ;",
|
|
6
|
+
"names": ["getRandomPort", "path", "waitForCondition", "Client", "Config", "range", "S", "TypedObject", "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", "TestType", "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", "Filter", "performInvitation", "invariant", "Invitation", "triggerWebhook", "space", "uri", "trigger", "db", "query", "Filter", "schema", "FunctionTrigger", "t", "function", "run", "objects", "invariant", "spec", "type", "fetch", "port", "inviteMember", "host", "guest", "invitation", "hostInvitation", "Promise", "all", "performInvitation", "spaces", "state", "Invitation", "State", "SUCCESS", "Error", "testFunctionManifest", "functions", "uri", "route", "handler"]
|
|
7
7
|
}
|
|
@@ -16,15 +16,15 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
19
|
+
var chunk_BLLSDTKZ_exports = {};
|
|
20
|
+
__export(chunk_BLLSDTKZ_exports, {
|
|
21
21
|
FUNCTION_SCHEMA: () => FUNCTION_SCHEMA,
|
|
22
22
|
FunctionDef: () => FunctionDef,
|
|
23
23
|
FunctionManifestSchema: () => FunctionManifestSchema,
|
|
24
24
|
FunctionTrigger: () => FunctionTrigger,
|
|
25
25
|
__require: () => __require
|
|
26
26
|
});
|
|
27
|
-
module.exports = __toCommonJS(
|
|
27
|
+
module.exports = __toCommonJS(chunk_BLLSDTKZ_exports);
|
|
28
28
|
var import_echo_schema = require("@dxos/echo-schema");
|
|
29
29
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
30
30
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
@@ -33,60 +33,60 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
33
33
|
return require.apply(this, arguments);
|
|
34
34
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
35
35
|
});
|
|
36
|
-
var SubscriptionTriggerSchema = import_echo_schema.S.mutable(import_echo_schema.S.
|
|
37
|
-
type: import_echo_schema.S.
|
|
36
|
+
var SubscriptionTriggerSchema = import_echo_schema.S.mutable(import_echo_schema.S.Struct({
|
|
37
|
+
type: import_echo_schema.S.Literal("subscription"),
|
|
38
38
|
// TODO(burdon): Define query DSL (from ECHO).
|
|
39
|
-
filter: import_echo_schema.S.
|
|
40
|
-
type: import_echo_schema.S.
|
|
41
|
-
props: import_echo_schema.S.optional(import_echo_schema.S.
|
|
39
|
+
filter: import_echo_schema.S.Array(import_echo_schema.S.Struct({
|
|
40
|
+
type: import_echo_schema.S.String,
|
|
41
|
+
props: import_echo_schema.S.optional(import_echo_schema.S.Record(import_echo_schema.S.String, import_echo_schema.S.Any))
|
|
42
42
|
})),
|
|
43
|
-
options: import_echo_schema.S.optional(import_echo_schema.S.
|
|
43
|
+
options: import_echo_schema.S.optional(import_echo_schema.S.Struct({
|
|
44
44
|
// Watch changes to object (not just creation).
|
|
45
|
-
deep: import_echo_schema.S.optional(import_echo_schema.S.
|
|
45
|
+
deep: import_echo_schema.S.optional(import_echo_schema.S.Boolean),
|
|
46
46
|
// Debounce changes (delay in ms).
|
|
47
|
-
delay: import_echo_schema.S.optional(import_echo_schema.S.
|
|
47
|
+
delay: import_echo_schema.S.optional(import_echo_schema.S.Number)
|
|
48
48
|
}))
|
|
49
49
|
}));
|
|
50
|
-
var TimerTriggerSchema = import_echo_schema.S.mutable(import_echo_schema.S.
|
|
51
|
-
type: import_echo_schema.S.
|
|
52
|
-
cron: import_echo_schema.S.
|
|
50
|
+
var TimerTriggerSchema = import_echo_schema.S.mutable(import_echo_schema.S.Struct({
|
|
51
|
+
type: import_echo_schema.S.Literal("timer"),
|
|
52
|
+
cron: import_echo_schema.S.String
|
|
53
53
|
}));
|
|
54
|
-
var WebhookTriggerSchema = import_echo_schema.S.mutable(import_echo_schema.S.
|
|
55
|
-
type: import_echo_schema.S.
|
|
56
|
-
method: import_echo_schema.S.
|
|
54
|
+
var WebhookTriggerSchema = import_echo_schema.S.mutable(import_echo_schema.S.Struct({
|
|
55
|
+
type: import_echo_schema.S.Literal("webhook"),
|
|
56
|
+
method: import_echo_schema.S.String,
|
|
57
57
|
// Assigned port.
|
|
58
|
-
port: import_echo_schema.S.optional(import_echo_schema.S.
|
|
58
|
+
port: import_echo_schema.S.optional(import_echo_schema.S.Number)
|
|
59
59
|
}));
|
|
60
|
-
var WebsocketTriggerSchema = import_echo_schema.S.mutable(import_echo_schema.S.
|
|
61
|
-
type: import_echo_schema.S.
|
|
62
|
-
url: import_echo_schema.S.
|
|
63
|
-
init: import_echo_schema.S.optional(import_echo_schema.S.
|
|
60
|
+
var WebsocketTriggerSchema = import_echo_schema.S.mutable(import_echo_schema.S.Struct({
|
|
61
|
+
type: import_echo_schema.S.Literal("websocket"),
|
|
62
|
+
url: import_echo_schema.S.String,
|
|
63
|
+
init: import_echo_schema.S.optional(import_echo_schema.S.Record(import_echo_schema.S.String, import_echo_schema.S.Any))
|
|
64
64
|
}));
|
|
65
|
-
var TriggerSpecSchema = import_echo_schema.S.
|
|
65
|
+
var TriggerSpecSchema = import_echo_schema.S.Union(TimerTriggerSchema, WebhookTriggerSchema, WebsocketTriggerSchema, SubscriptionTriggerSchema);
|
|
66
66
|
var FunctionDef = class extends (0, import_echo_schema.TypedObject)({
|
|
67
67
|
typename: "dxos.org/type/FunctionDef",
|
|
68
68
|
version: "0.1.0"
|
|
69
69
|
})({
|
|
70
|
-
uri: import_echo_schema.S.
|
|
71
|
-
description: import_echo_schema.S.optional(import_echo_schema.S.
|
|
72
|
-
route: import_echo_schema.S.
|
|
73
|
-
handler: import_echo_schema.S.
|
|
70
|
+
uri: import_echo_schema.S.String,
|
|
71
|
+
description: import_echo_schema.S.optional(import_echo_schema.S.String),
|
|
72
|
+
route: import_echo_schema.S.String,
|
|
73
|
+
handler: import_echo_schema.S.String
|
|
74
74
|
}) {
|
|
75
75
|
};
|
|
76
76
|
var FunctionTrigger = class extends (0, import_echo_schema.TypedObject)({
|
|
77
77
|
typename: "dxos.org/type/FunctionTrigger",
|
|
78
78
|
version: "0.1.0"
|
|
79
79
|
})({
|
|
80
|
-
enabled: import_echo_schema.S.optional(import_echo_schema.S.
|
|
81
|
-
function: import_echo_schema.S.
|
|
80
|
+
enabled: import_echo_schema.S.optional(import_echo_schema.S.Boolean),
|
|
81
|
+
function: import_echo_schema.S.String.pipe(import_echo_schema.S.description("Function URI.")),
|
|
82
82
|
// The `meta` property is merged into the event data passed to the function.
|
|
83
|
-
meta: import_echo_schema.S.optional(import_echo_schema.S.mutable(import_echo_schema.S.
|
|
83
|
+
meta: import_echo_schema.S.optional(import_echo_schema.S.mutable(import_echo_schema.S.Any)),
|
|
84
84
|
spec: TriggerSpecSchema
|
|
85
85
|
}) {
|
|
86
86
|
};
|
|
87
|
-
var FunctionManifestSchema = import_echo_schema.S.
|
|
88
|
-
functions: import_echo_schema.S.optional(import_echo_schema.S.mutable(import_echo_schema.S.
|
|
89
|
-
triggers: import_echo_schema.S.optional(import_echo_schema.S.mutable(import_echo_schema.S.
|
|
87
|
+
var FunctionManifestSchema = import_echo_schema.S.Struct({
|
|
88
|
+
functions: import_echo_schema.S.optional(import_echo_schema.S.mutable(import_echo_schema.S.Array((0, import_echo_schema.RawObject)(FunctionDef)))),
|
|
89
|
+
triggers: import_echo_schema.S.optional(import_echo_schema.S.mutable(import_echo_schema.S.Array((0, import_echo_schema.RawObject)(FunctionTrigger))))
|
|
90
90
|
});
|
|
91
91
|
var FUNCTION_SCHEMA = [
|
|
92
92
|
FunctionDef,
|
|
@@ -100,4 +100,4 @@ var FUNCTION_SCHEMA = [
|
|
|
100
100
|
FunctionTrigger,
|
|
101
101
|
__require
|
|
102
102
|
});
|
|
103
|
-
//# sourceMappingURL=chunk-
|
|
103
|
+
//# sourceMappingURL=chunk-BLLSDTKZ.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/types.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { RawObject, S, TypedObject } from '@dxos/echo-schema';\n\n/**\n * Type discriminator for TriggerSpec.\n * Every spec has a type field of type FunctionTriggerType that we can use to understand which\n * type we're working with.\n * https://www.typescriptlang.org/docs/handbook/2/narrowing.html#discriminated-unions\n */\nexport type FunctionTriggerType = 'subscription' | 'timer' | 'webhook' | 'websocket';\n\nconst SubscriptionTriggerSchema = S.mutable(\n S.
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { RawObject, S, TypedObject } from '@dxos/echo-schema';\n\n/**\n * Type discriminator for TriggerSpec.\n * Every spec has a type field of type FunctionTriggerType that we can use to understand which\n * type we're working with.\n * https://www.typescriptlang.org/docs/handbook/2/narrowing.html#discriminated-unions\n */\nexport type FunctionTriggerType = 'subscription' | 'timer' | 'webhook' | 'websocket';\n\nconst SubscriptionTriggerSchema = S.mutable(\n S.Struct({\n type: S.Literal('subscription'),\n // TODO(burdon): Define query DSL (from ECHO).\n filter: S.Array(\n S.Struct({\n type: S.String,\n props: S.optional(S.Record(S.String, S.Any)),\n }),\n ),\n options: S.optional(\n S.Struct({\n // Watch changes to object (not just creation).\n deep: S.optional(S.Boolean),\n // Debounce changes (delay in ms).\n delay: S.optional(S.Number),\n }),\n ),\n }),\n);\n\nexport type SubscriptionTrigger = S.Schema.Type<typeof SubscriptionTriggerSchema>;\n\nconst TimerTriggerSchema = S.mutable(\n S.Struct({\n type: S.Literal('timer'),\n cron: S.String,\n }),\n);\n\nexport type TimerTrigger = S.Schema.Type<typeof TimerTriggerSchema>;\n\nconst WebhookTriggerSchema = S.mutable(\n S.Struct({\n type: S.Literal('webhook'),\n method: S.String,\n // Assigned port.\n port: S.optional(S.Number),\n }),\n);\n\nexport type WebhookTrigger = S.Schema.Type<typeof WebhookTriggerSchema>;\n\nconst WebsocketTriggerSchema = S.mutable(\n S.Struct({\n type: S.Literal('websocket'),\n url: S.String,\n init: S.optional(S.Record(S.String, S.Any)),\n }),\n);\n\nexport type WebsocketTrigger = S.Schema.Type<typeof WebsocketTriggerSchema>;\n\nconst TriggerSpecSchema = S.Union(\n TimerTriggerSchema,\n WebhookTriggerSchema,\n WebsocketTriggerSchema,\n SubscriptionTriggerSchema,\n);\n\nexport type TriggerSpec = TimerTrigger | WebhookTrigger | WebsocketTrigger | SubscriptionTrigger;\n\n/**\n * Function definition.\n */\nexport class FunctionDef extends TypedObject({\n typename: 'dxos.org/type/FunctionDef',\n version: '0.1.0',\n})({\n uri: S.String,\n description: S.optional(S.String),\n route: S.String,\n handler: S.String,\n}) {}\n\n/**\n * Function trigger.\n */\nexport class FunctionTrigger extends TypedObject({\n typename: 'dxos.org/type/FunctionTrigger',\n version: '0.1.0',\n})({\n enabled: S.optional(S.Boolean),\n function: S.String.pipe(S.description('Function URI.')),\n // The `meta` property is merged into the event data passed to the function.\n meta: S.optional(S.mutable(S.Any)),\n spec: TriggerSpecSchema,\n}) {}\n\n/**\n * Function manifest file.\n */\nexport const FunctionManifestSchema = S.Struct({\n functions: S.optional(S.mutable(S.Array(RawObject(FunctionDef)))),\n triggers: S.optional(S.mutable(S.Array(RawObject(FunctionTrigger)))),\n});\n\nexport type FunctionManifest = S.Schema.Type<typeof FunctionManifestSchema>;\n\n// TODO(burdon): Standards?\nexport const FUNCTION_SCHEMA = [FunctionDef, FunctionTrigger];\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,yBAA0C;;;;;;;;AAU1C,IAAMA,4BAA4BC,qBAAEC,QAClCD,qBAAEE,OAAO;EACPC,MAAMH,qBAAEI,QAAQ,cAAA;;EAEhBC,QAAQL,qBAAEM,MACRN,qBAAEE,OAAO;IACPC,MAAMH,qBAAEO;IACRC,OAAOR,qBAAES,SAAST,qBAAEU,OAAOV,qBAAEO,QAAQP,qBAAEW,GAAG,CAAA;EAC5C,CAAA,CAAA;EAEFC,SAASZ,qBAAES,SACTT,qBAAEE,OAAO;;IAEPW,MAAMb,qBAAES,SAAST,qBAAEc,OAAO;;IAE1BC,OAAOf,qBAAES,SAAST,qBAAEgB,MAAM;EAC5B,CAAA,CAAA;AAEJ,CAAA,CAAA;AAKF,IAAMC,qBAAqBjB,qBAAEC,QAC3BD,qBAAEE,OAAO;EACPC,MAAMH,qBAAEI,QAAQ,OAAA;EAChBc,MAAMlB,qBAAEO;AACV,CAAA,CAAA;AAKF,IAAMY,uBAAuBnB,qBAAEC,QAC7BD,qBAAEE,OAAO;EACPC,MAAMH,qBAAEI,QAAQ,SAAA;EAChBgB,QAAQpB,qBAAEO;;EAEVc,MAAMrB,qBAAES,SAAST,qBAAEgB,MAAM;AAC3B,CAAA,CAAA;AAKF,IAAMM,yBAAyBtB,qBAAEC,QAC/BD,qBAAEE,OAAO;EACPC,MAAMH,qBAAEI,QAAQ,WAAA;EAChBmB,KAAKvB,qBAAEO;EACPiB,MAAMxB,qBAAES,SAAST,qBAAEU,OAAOV,qBAAEO,QAAQP,qBAAEW,GAAG,CAAA;AAC3C,CAAA,CAAA;AAKF,IAAMc,oBAAoBzB,qBAAE0B,MAC1BT,oBACAE,sBACAG,wBACAvB,yBAAAA;AAQK,IAAM4B,cAAN,kBAA0BC,gCAAY;EAC3CC,UAAU;EACVC,SAAS;AACX,CAAA,EAAG;EACDC,KAAK/B,qBAAEO;EACPyB,aAAahC,qBAAES,SAAST,qBAAEO,MAAM;EAChC0B,OAAOjC,qBAAEO;EACT2B,SAASlC,qBAAEO;AACb,CAAA,EAAA;AAAI;AAKG,IAAM4B,kBAAN,kBAA8BP,gCAAY;EAC/CC,UAAU;EACVC,SAAS;AACX,CAAA,EAAG;EACDM,SAASpC,qBAAES,SAAST,qBAAEc,OAAO;EAC7BuB,UAAUrC,qBAAEO,OAAO+B,KAAKtC,qBAAEgC,YAAY,eAAA,CAAA;;EAEtCO,MAAMvC,qBAAES,SAAST,qBAAEC,QAAQD,qBAAEW,GAAG,CAAA;EAChC6B,MAAMf;AACR,CAAA,EAAA;AAAI;AAKG,IAAMgB,yBAAyBzC,qBAAEE,OAAO;EAC7CwC,WAAW1C,qBAAES,SAAST,qBAAEC,QAAQD,qBAAEM,UAAMqC,8BAAUhB,WAAAA,CAAAA,CAAAA,CAAAA;EAClDiB,UAAU5C,qBAAES,SAAST,qBAAEC,QAAQD,qBAAEM,UAAMqC,8BAAUR,eAAAA,CAAAA,CAAAA,CAAAA;AACnD,CAAA;AAKO,IAAMU,kBAAkB;EAAClB;EAAaQ;;",
|
|
6
|
-
"names": ["SubscriptionTriggerSchema", "S", "mutable", "
|
|
6
|
+
"names": ["SubscriptionTriggerSchema", "S", "mutable", "Struct", "type", "Literal", "filter", "Array", "String", "props", "optional", "Record", "Any", "options", "deep", "Boolean", "delay", "Number", "TimerTriggerSchema", "cron", "WebhookTriggerSchema", "method", "port", "WebsocketTriggerSchema", "url", "init", "TriggerSpecSchema", "Union", "FunctionDef", "TypedObject", "typename", "version", "uri", "description", "route", "handler", "FunctionTrigger", "enabled", "function", "pipe", "meta", "spec", "FunctionManifestSchema", "functions", "RawObject", "triggers", "FUNCTION_SCHEMA"]
|
|
7
7
|
}
|
|
@@ -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
|
}
|
|
@@ -770,6 +770,7 @@ var createWebsocketTrigger = async (ctx, space, spec, callback, options = {
|
|
|
770
770
|
maxAttempts: 5
|
|
771
771
|
}) => {
|
|
772
772
|
const { url, init } = spec;
|
|
773
|
+
let wasOpen = false;
|
|
773
774
|
let ws;
|
|
774
775
|
for (let attempt = 1; attempt <= options.maxAttempts; attempt++) {
|
|
775
776
|
const open = new import_async7.Trigger();
|
|
@@ -780,7 +781,7 @@ var createWebsocketTrigger = async (ctx, space, spec, callback, options = {
|
|
|
780
781
|
url
|
|
781
782
|
}, {
|
|
782
783
|
F: __dxlog_file7,
|
|
783
|
-
L:
|
|
784
|
+
L: 41,
|
|
784
785
|
S: void 0,
|
|
785
786
|
C: (f, a) => f(...a)
|
|
786
787
|
});
|
|
@@ -795,17 +796,17 @@ var createWebsocketTrigger = async (ctx, space, spec, callback, options = {
|
|
|
795
796
|
code: event.code
|
|
796
797
|
}, {
|
|
797
798
|
F: __dxlog_file7,
|
|
798
|
-
L:
|
|
799
|
+
L: 50,
|
|
799
800
|
S: void 0,
|
|
800
801
|
C: (f, a) => f(...a)
|
|
801
802
|
});
|
|
802
|
-
if (event.code === 1006) {
|
|
803
|
+
if (event.code === 1006 && wasOpen && !ctx.disposed) {
|
|
803
804
|
setTimeout(async () => {
|
|
804
805
|
import_log8.log.info(`reconnecting in ${options.retryDelay}s...`, {
|
|
805
806
|
url
|
|
806
807
|
}, {
|
|
807
808
|
F: __dxlog_file7,
|
|
808
|
-
L:
|
|
809
|
+
L: 55,
|
|
809
810
|
S: void 0,
|
|
810
811
|
C: (f, a) => f(...a)
|
|
811
812
|
});
|
|
@@ -823,12 +824,13 @@ var createWebsocketTrigger = async (ctx, space, spec, callback, options = {
|
|
|
823
824
|
S: void 0,
|
|
824
825
|
C: (f, a) => f(...a)
|
|
825
826
|
});
|
|
827
|
+
open.wake(false);
|
|
826
828
|
},
|
|
827
829
|
onmessage: async (event) => {
|
|
828
830
|
try {
|
|
829
831
|
import_log8.log.info("message", void 0, {
|
|
830
832
|
F: __dxlog_file7,
|
|
831
|
-
L:
|
|
833
|
+
L: 69,
|
|
832
834
|
S: void 0,
|
|
833
835
|
C: (f, a) => f(...a)
|
|
834
836
|
});
|
|
@@ -841,7 +843,7 @@ var createWebsocketTrigger = async (ctx, space, spec, callback, options = {
|
|
|
841
843
|
url
|
|
842
844
|
}, {
|
|
843
845
|
F: __dxlog_file7,
|
|
844
|
-
L:
|
|
846
|
+
L: 73,
|
|
845
847
|
S: void 0,
|
|
846
848
|
C: (f, a) => f(...a)
|
|
847
849
|
});
|
|
@@ -849,21 +851,24 @@ var createWebsocketTrigger = async (ctx, space, spec, callback, options = {
|
|
|
849
851
|
}
|
|
850
852
|
});
|
|
851
853
|
const isOpen = await open.wait();
|
|
854
|
+
if (ctx.disposed) {
|
|
855
|
+
break;
|
|
856
|
+
}
|
|
852
857
|
if (isOpen) {
|
|
858
|
+
wasOpen = true;
|
|
853
859
|
break;
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
}
|
|
860
|
+
}
|
|
861
|
+
const wait = Math.pow(attempt, 2) * options.retryDelay;
|
|
862
|
+
if (attempt < options.maxAttempts) {
|
|
863
|
+
import_log8.log.warn(`failed to connect; trying again in ${wait}s`, {
|
|
864
|
+
attempt
|
|
865
|
+
}, {
|
|
866
|
+
F: __dxlog_file7,
|
|
867
|
+
L: 88,
|
|
868
|
+
S: void 0,
|
|
869
|
+
C: (f, a) => f(...a)
|
|
870
|
+
});
|
|
871
|
+
await (0, import_async7.sleep)(wait * 1e3);
|
|
867
872
|
}
|
|
868
873
|
}
|
|
869
874
|
ctx.onDispose(() => {
|
|
@@ -940,8 +945,8 @@ var TriggerRegistry = class extends import_context4.Resource {
|
|
|
940
945
|
if (!manifest.triggers?.length) {
|
|
941
946
|
return;
|
|
942
947
|
}
|
|
943
|
-
if (!space.db.graph.runtimeSchemaRegistry.hasSchema(
|
|
944
|
-
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);
|
|
945
950
|
}
|
|
946
951
|
const manifestTriggers = manifest.triggers.map((trigger) => {
|
|
947
952
|
let keys = trigger[import_echo_schema.ECHO_ATTR_META]?.keys;
|
|
@@ -954,11 +959,11 @@ var TriggerRegistry = class extends import_context4.Resource {
|
|
|
954
959
|
].join(":"))
|
|
955
960
|
];
|
|
956
961
|
}
|
|
957
|
-
return (0, import_echo2.create)(
|
|
962
|
+
return (0, import_echo2.create)(import_chunk_BLLSDTKZ.FunctionTrigger, trigger, {
|
|
958
963
|
keys
|
|
959
964
|
});
|
|
960
965
|
});
|
|
961
|
-
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();
|
|
962
967
|
const { added } = (0, import_util2.diff)(existing, manifestTriggers, import_echo_schema.compareForeignKeys);
|
|
963
968
|
added.forEach((trigger) => {
|
|
964
969
|
space.db.add(trigger);
|
|
@@ -993,7 +998,7 @@ var TriggerRegistry = class extends import_context4.Resource {
|
|
|
993
998
|
if (this._ctx.disposed) {
|
|
994
999
|
break;
|
|
995
1000
|
}
|
|
996
|
-
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 }) => {
|
|
997
1002
|
import_log4.log.info("update", {
|
|
998
1003
|
space: space.key,
|
|
999
1004
|
registered: registered.length,
|
|
@@ -1094,4 +1099,4 @@ var TriggerRegistry = class extends import_context4.Resource {
|
|
|
1094
1099
|
Scheduler,
|
|
1095
1100
|
TriggerRegistry
|
|
1096
1101
|
});
|
|
1097
|
-
//# sourceMappingURL=chunk-
|
|
1102
|
+
//# sourceMappingURL=chunk-RPHL3ORN.cjs.map
|