@dxos/functions 0.5.5-main.dc01469 → 0.5.5-next.7ae47fc
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-ERWZ4JUZ.mjs → chunk-4D4I3YMJ.mjs} +31 -31
- package/dist/lib/browser/{chunk-ERWZ4JUZ.mjs.map → chunk-4D4I3YMJ.mjs.map} +2 -2
- package/dist/lib/browser/{chunk-SXZ5DYJG.mjs → chunk-ERL6PHMU.mjs} +21 -26
- package/dist/lib/browser/{chunk-SXZ5DYJG.mjs.map → chunk-ERL6PHMU.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 +5 -8
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/browser/types.mjs +1 -1
- package/dist/lib/node/{chunk-BLLSDTKZ.cjs → chunk-3UYUR5N5.cjs} +34 -34
- package/dist/lib/node/{chunk-BLLSDTKZ.cjs.map → chunk-3UYUR5N5.cjs.map} +2 -2
- package/dist/lib/node/{chunk-RPHL3ORN.cjs → chunk-INM6XAL7.cjs} +37 -42
- package/dist/lib/node/{chunk-RPHL3ORN.cjs.map → chunk-INM6XAL7.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 +11 -14
- 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 +38 -27
- 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 +2 -4
- package/src/testing/setup.ts +3 -5
- package/src/testing/types.ts +1 -1
- package/src/trigger/type/websocket-trigger.ts +8 -12
- 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":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}}}
|
|
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}}}
|
|
@@ -4,14 +4,13 @@ import {
|
|
|
4
4
|
FunctionRegistry,
|
|
5
5
|
Scheduler,
|
|
6
6
|
TriggerRegistry
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-ERL6PHMU.mjs";
|
|
8
8
|
import {
|
|
9
9
|
FunctionDef,
|
|
10
10
|
FunctionTrigger
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-4D4I3YMJ.mjs";
|
|
12
12
|
|
|
13
13
|
// packages/core/functions/src/testing/setup.ts
|
|
14
|
-
import { getRandomPort } from "get-port-please";
|
|
15
14
|
import path from "@dxos/node-std/path";
|
|
16
15
|
import { waitForCondition } from "@dxos/async";
|
|
17
16
|
import { Client, Config } from "@dxos/client";
|
|
@@ -23,11 +22,12 @@ var TestType = class extends TypedObject({
|
|
|
23
22
|
typename: "example.com/type/Test",
|
|
24
23
|
version: "0.1.0"
|
|
25
24
|
})({
|
|
26
|
-
title: S.
|
|
25
|
+
title: S.string
|
|
27
26
|
}) {
|
|
28
27
|
};
|
|
29
28
|
|
|
30
29
|
// 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,13 +39,11 @@ 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;
|
|
43
42
|
client.addSchema(FunctionDef, FunctionTrigger, TestType);
|
|
44
43
|
return client;
|
|
45
44
|
}));
|
|
46
45
|
};
|
|
47
46
|
var createFunctionRuntime = async (testBuilder, pluginInitializer) => {
|
|
48
|
-
const functionsPort = await getRandomPort("127.0.0.1");
|
|
49
47
|
const config = new Config({
|
|
50
48
|
runtime: {
|
|
51
49
|
agent: {
|
|
@@ -53,7 +51,7 @@ var createFunctionRuntime = async (testBuilder, pluginInitializer) => {
|
|
|
53
51
|
{
|
|
54
52
|
id: "dxos.org/agent/plugin/functions",
|
|
55
53
|
config: {
|
|
56
|
-
port: functionsPort
|
|
54
|
+
port: functionsPort++
|
|
57
55
|
}
|
|
58
56
|
}
|
|
59
57
|
]
|
|
@@ -92,7 +90,6 @@ var startScheduler = async (testBuilder, client, devServer, functionRegistry) =>
|
|
|
92
90
|
var startDevServer = async (testBuilder, client, functionRegistry, options) => {
|
|
93
91
|
const server = new DevServer(client, functionRegistry, {
|
|
94
92
|
baseDir: path.join(__dirname, "../testing"),
|
|
95
|
-
port: await getRandomPort("127.0.0.1"),
|
|
96
93
|
...options
|
|
97
94
|
});
|
|
98
95
|
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
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;AAIA,
|
|
6
|
-
"names": ["
|
|
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\nlet functionsPort = 8081;\n\nexport type FunctionsPluginInitializer = (client: Client) => Promise<{ close: () => Promise<void> }>;\n\n// TODO(burdon): Extend/wrap TestBuilder.\n\nexport const createInitializedClients = async (testBuilder: TestBuilder, count: number = 1, config?: Config) => {\n const clients = range(count).map(() => new Client({ config, services: testBuilder.createLocalClientServices() }));\n testBuilder.ctx.onDispose(() => Promise.all(clients.map((client) => client.destroy())));\n return Promise.all(\n clients.map(async (client, index) => {\n await client.initialize();\n await client.halo.createIdentity({ displayName: `Peer ${index}` });\n client.addSchema(FunctionDef, FunctionTrigger, TestType);\n return client;\n }),\n );\n};\n\nexport const createFunctionRuntime = async (\n testBuilder: TestBuilder,\n pluginInitializer: FunctionsPluginInitializer,\n): Promise<Client> => {\n const 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 ...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,OAAOA,UAAU;AAEjB,SAASC,wBAAwB;AACjC,SAASC,QAAQC,cAAc;AAG/B,SAASC,aAAa;;;ACNtB,SAASC,GAAGC,mBAAmB;AAExB,IAAMC,WAAN,cAAuBC,YAAY;EAAEC,UAAU;EAAyBC,SAAS;AAAQ,CAAA,EAAG;EACjGC,OAAOC,EAAEC;AACX,CAAA,EAAA;AAAI;;;ADUJ,IAAIC,gBAAgB;AAMb,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;AAChEF,WAAOO,UAAUC,aAAaC,iBAAiBC,QAAAA;AAC/C,WAAOV;EACT,CAAA,CAAA;AAEJ;AAEO,IAAMW,wBAAwB,OACnCxB,aACAyB,sBAAAA;AAEA,QAAMvB,SAAS,IAAIwB,OAAO;IACxBC,SAAS;MACPC,OAAO;QACLC,SAAS;UAAC;YAAEC,IAAI;YAAmC5B,QAAQ;cAAE6B,MAAMjC;YAAgB;UAAE;;MACvF;IACF;EACF,CAAA;AAEA,QAAM,CAACe,MAAAA,IAAU,MAAMd,yBAAyBC,aAAa,GAAGE,MAAAA;AAChE,QAAM8B,SAAS,MAAMP,kBAAkBZ,MAAAA;AACvCb,cAAYS,IAAIC,UAAU,MAAMsB,OAAOC,MAAK,CAAA;AAC5C,SAAOpB;AACT;AAEO,IAAMqB,qBAAqB,OAChClC,aACAyB,mBACAU,YAAAA;AAEA,QAAMC,kBAAkB,MAAMZ,sBAAsBxB,aAAayB,iBAAAA;AACjE,QAAMY,oBAAoB,IAAIC,iBAAiBF,eAAAA;AAC/C,QAAMG,YAAY,MAAMC,eAAexC,aAAaoC,iBAAiBC,mBAAmBF,OAAAA;AACxF,QAAMM,YAAY,MAAMC,eAAe1C,aAAaoC,iBAAiBG,WAAWF,iBAAAA;AAChF,SAAO;IACLI;IACA5B,QAAQuB;IACRO,uBAAuB,OAAOC,UAAAA;AAC5B,YAAMC,iBAAiB;QAAEC,WAAW,MAAML,UAAUM,SAASC,kBAAkBJ,KAAAA,EAAOK,SAAS;MAAE,CAAA;IACnG;EACF;AACF;AAEA,IAAMP,iBAAiB,OACrB1C,aACAa,QACA0B,WACAW,qBAAAA;AAEA,QAAMC,kBAAkB,IAAIC,gBAAgBvC,MAAAA;AAC5C,QAAM4B,YAAY,IAAIY,UAAUH,kBAAkBC,iBAAiB;IAAEG,UAAUf,UAAUe;EAAS,CAAA;AAClG,QAAMb,UAAUc,MAAK;AACrBvD,cAAYS,IAAIC,UAAU,MAAM+B,UAAUe,KAAI,CAAA;AAC9C,SAAOf;AACT;AAEA,IAAMD,iBAAiB,OACrBxC,aACAa,QACAqC,kBACAf,YAAAA;AAEA,QAAMsB,SAAS,IAAIC,UAAU7C,QAAQqC,kBAAkB;IACrDS,SAASC,KAAKC,KAAKC,WAAW,YAAA;IAC9B,GAAG3B;EACL,CAAA;AACA,QAAMsB,OAAOF,MAAK;AAClBvD,cAAYS,IAAIC,UAAU,MAAM+C,OAAOD,KAAI,CAAA;AAC3C,SAAOC;AACT;;;AE9FA,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": ["path", "waitForCondition", "Client", "Config", "range", "S", "TypedObject", "TestType", "TypedObject", "typename", "version", "title", "S", "string", "functionsPort", "createInitializedClients", "testBuilder", "count", "config", "clients", "range", "map", "Client", "services", "createLocalClientServices", "ctx", "onDispose", "Promise", "all", "client", "destroy", "index", "initialize", "halo", "createIdentity", "displayName", "addSchema", "FunctionDef", "FunctionTrigger", "TestType", "createFunctionRuntime", "pluginInitializer", "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_3UYUR5N5_exports = {};
|
|
20
|
+
__export(chunk_3UYUR5N5_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_3UYUR5N5_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-3UYUR5N5.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_INM6XAL7_exports = {};
|
|
30
|
+
__export(chunk_INM6XAL7_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_INM6XAL7_exports);
|
|
37
|
+
var import_chunk_3UYUR5N5 = require("./chunk-3UYUR5N5.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_3UYUR5N5.FunctionDef)) {
|
|
117
|
+
space.db.graph.runtimeSchemaRegistry.registerSchema(import_chunk_3UYUR5N5.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_3UYUR5N5.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_3UYUR5N5.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_3UYUR5N5.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_3UYUR5N5.__require.cache).filter((key) => key.startsWith(filePath)).forEach((key) => {
|
|
372
|
+
delete import_chunk_3UYUR5N5.__require.cache[key];
|
|
373
373
|
});
|
|
374
374
|
}
|
|
375
|
-
const module2 = (0,
|
|
375
|
+
const module2 = (0, import_chunk_3UYUR5N5.__require)(filePath);
|
|
376
376
|
if (typeof module2.default !== "function") {
|
|
377
377
|
throw new Error(`Handler must export default function: ${uri}`);
|
|
378
378
|
}
|
|
@@ -770,7 +770,6 @@ var createWebsocketTrigger = async (ctx, space, spec, callback, options = {
|
|
|
770
770
|
maxAttempts: 5
|
|
771
771
|
}) => {
|
|
772
772
|
const { url, init } = spec;
|
|
773
|
-
let wasOpen = false;
|
|
774
773
|
let ws;
|
|
775
774
|
for (let attempt = 1; attempt <= options.maxAttempts; attempt++) {
|
|
776
775
|
const open = new import_async7.Trigger();
|
|
@@ -781,7 +780,7 @@ var createWebsocketTrigger = async (ctx, space, spec, callback, options = {
|
|
|
781
780
|
url
|
|
782
781
|
}, {
|
|
783
782
|
F: __dxlog_file7,
|
|
784
|
-
L:
|
|
783
|
+
L: 40,
|
|
785
784
|
S: void 0,
|
|
786
785
|
C: (f, a) => f(...a)
|
|
787
786
|
});
|
|
@@ -796,17 +795,17 @@ var createWebsocketTrigger = async (ctx, space, spec, callback, options = {
|
|
|
796
795
|
code: event.code
|
|
797
796
|
}, {
|
|
798
797
|
F: __dxlog_file7,
|
|
799
|
-
L:
|
|
798
|
+
L: 49,
|
|
800
799
|
S: void 0,
|
|
801
800
|
C: (f, a) => f(...a)
|
|
802
801
|
});
|
|
803
|
-
if (event.code === 1006
|
|
802
|
+
if (event.code === 1006) {
|
|
804
803
|
setTimeout(async () => {
|
|
805
804
|
import_log8.log.info(`reconnecting in ${options.retryDelay}s...`, {
|
|
806
805
|
url
|
|
807
806
|
}, {
|
|
808
807
|
F: __dxlog_file7,
|
|
809
|
-
L:
|
|
808
|
+
L: 54,
|
|
810
809
|
S: void 0,
|
|
811
810
|
C: (f, a) => f(...a)
|
|
812
811
|
});
|
|
@@ -824,13 +823,12 @@ var createWebsocketTrigger = async (ctx, space, spec, callback, options = {
|
|
|
824
823
|
S: void 0,
|
|
825
824
|
C: (f, a) => f(...a)
|
|
826
825
|
});
|
|
827
|
-
open.wake(false);
|
|
828
826
|
},
|
|
829
827
|
onmessage: async (event) => {
|
|
830
828
|
try {
|
|
831
829
|
import_log8.log.info("message", void 0, {
|
|
832
830
|
F: __dxlog_file7,
|
|
833
|
-
L:
|
|
831
|
+
L: 68,
|
|
834
832
|
S: void 0,
|
|
835
833
|
C: (f, a) => f(...a)
|
|
836
834
|
});
|
|
@@ -843,7 +841,7 @@ var createWebsocketTrigger = async (ctx, space, spec, callback, options = {
|
|
|
843
841
|
url
|
|
844
842
|
}, {
|
|
845
843
|
F: __dxlog_file7,
|
|
846
|
-
L:
|
|
844
|
+
L: 72,
|
|
847
845
|
S: void 0,
|
|
848
846
|
C: (f, a) => f(...a)
|
|
849
847
|
});
|
|
@@ -851,24 +849,21 @@ var createWebsocketTrigger = async (ctx, space, spec, callback, options = {
|
|
|
851
849
|
}
|
|
852
850
|
});
|
|
853
851
|
const isOpen = await open.wait();
|
|
854
|
-
if (ctx.disposed) {
|
|
855
|
-
break;
|
|
856
|
-
}
|
|
857
852
|
if (isOpen) {
|
|
858
|
-
wasOpen = true;
|
|
859
853
|
break;
|
|
860
|
-
}
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
854
|
+
} else {
|
|
855
|
+
const wait = Math.pow(attempt, 2) * options.retryDelay;
|
|
856
|
+
if (attempt < options.maxAttempts) {
|
|
857
|
+
import_log8.log.warn(`failed to connect; trying again in ${wait}s`, {
|
|
858
|
+
attempt
|
|
859
|
+
}, {
|
|
860
|
+
F: __dxlog_file7,
|
|
861
|
+
L: 83,
|
|
862
|
+
S: void 0,
|
|
863
|
+
C: (f, a) => f(...a)
|
|
864
|
+
});
|
|
865
|
+
await (0, import_async7.sleep)(wait * 1e3);
|
|
866
|
+
}
|
|
872
867
|
}
|
|
873
868
|
}
|
|
874
869
|
ctx.onDispose(() => {
|
|
@@ -945,8 +940,8 @@ var TriggerRegistry = class extends import_context4.Resource {
|
|
|
945
940
|
if (!manifest.triggers?.length) {
|
|
946
941
|
return;
|
|
947
942
|
}
|
|
948
|
-
if (!space.db.graph.runtimeSchemaRegistry.hasSchema(
|
|
949
|
-
space.db.graph.runtimeSchemaRegistry.registerSchema(
|
|
943
|
+
if (!space.db.graph.runtimeSchemaRegistry.hasSchema(import_chunk_3UYUR5N5.FunctionTrigger)) {
|
|
944
|
+
space.db.graph.runtimeSchemaRegistry.registerSchema(import_chunk_3UYUR5N5.FunctionTrigger);
|
|
950
945
|
}
|
|
951
946
|
const manifestTriggers = manifest.triggers.map((trigger) => {
|
|
952
947
|
let keys = trigger[import_echo_schema.ECHO_ATTR_META]?.keys;
|
|
@@ -959,11 +954,11 @@ var TriggerRegistry = class extends import_context4.Resource {
|
|
|
959
954
|
].join(":"))
|
|
960
955
|
];
|
|
961
956
|
}
|
|
962
|
-
return (0, import_echo2.create)(
|
|
957
|
+
return (0, import_echo2.create)(import_chunk_3UYUR5N5.FunctionTrigger, trigger, {
|
|
963
958
|
keys
|
|
964
959
|
});
|
|
965
960
|
});
|
|
966
|
-
const { objects: existing } = await space.db.query(import_echo2.Filter.schema(
|
|
961
|
+
const { objects: existing } = await space.db.query(import_echo2.Filter.schema(import_chunk_3UYUR5N5.FunctionTrigger)).run();
|
|
967
962
|
const { added } = (0, import_util2.diff)(existing, manifestTriggers, import_echo_schema.compareForeignKeys);
|
|
968
963
|
added.forEach((trigger) => {
|
|
969
964
|
space.db.add(trigger);
|
|
@@ -998,7 +993,7 @@ var TriggerRegistry = class extends import_context4.Resource {
|
|
|
998
993
|
if (this._ctx.disposed) {
|
|
999
994
|
break;
|
|
1000
995
|
}
|
|
1001
|
-
this._ctx.onDispose(space.db.query(import_echo2.Filter.schema(
|
|
996
|
+
this._ctx.onDispose(space.db.query(import_echo2.Filter.schema(import_chunk_3UYUR5N5.FunctionTrigger)).subscribe(async ({ objects: current }) => {
|
|
1002
997
|
import_log4.log.info("update", {
|
|
1003
998
|
space: space.key,
|
|
1004
999
|
registered: registered.length,
|
|
@@ -1099,4 +1094,4 @@ var TriggerRegistry = class extends import_context4.Resource {
|
|
|
1099
1094
|
Scheduler,
|
|
1100
1095
|
TriggerRegistry
|
|
1101
1096
|
});
|
|
1102
|
-
//# sourceMappingURL=chunk-
|
|
1097
|
+
//# sourceMappingURL=chunk-INM6XAL7.cjs.map
|