@dxos/functions 0.8.0 → 0.8.1-main.81238a8
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-B747D6L6.mjs +72 -0
- package/dist/lib/browser/chunk-B747D6L6.mjs.map +7 -0
- package/dist/lib/browser/{chunk-WI2RVE6E.mjs → chunk-MF6IQWJ5.mjs} +27 -25
- package/dist/lib/browser/chunk-MF6IQWJ5.mjs.map +7 -0
- package/dist/lib/browser/{chunk-6XYG2TNO.mjs → chunk-Y3UMWWI4.mjs} +74 -22
- package/dist/lib/browser/chunk-Y3UMWWI4.mjs.map +7 -0
- package/dist/lib/browser/edge/index.mjs +1 -9
- package/dist/lib/browser/index.mjs +13 -11
- package/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +2 -2
- package/dist/lib/browser/types/index.mjs +15 -5
- package/dist/lib/node/{chunk-UNB65EWP.cjs → chunk-5Z24F7Z3.cjs} +77 -22
- package/dist/lib/node/chunk-5Z24F7Z3.cjs.map +7 -0
- package/dist/lib/node/{chunk-MZMHE4DC.cjs → chunk-D4T2DS7U.cjs} +9 -69
- package/dist/lib/node/chunk-D4T2DS7U.cjs.map +7 -0
- package/dist/lib/node/{chunk-HH4ZO3YY.cjs → chunk-P2QIHNWP.cjs} +40 -38
- package/dist/lib/node/chunk-P2QIHNWP.cjs.map +7 -0
- package/dist/lib/node/edge/index.cjs +4 -12
- package/dist/lib/node/edge/index.cjs.map +2 -2
- package/dist/lib/node/index.cjs +33 -31
- package/dist/lib/node/index.cjs.map +2 -2
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +7 -7
- package/dist/lib/node/types/index.cjs +26 -16
- package/dist/lib/node/types/index.cjs.map +2 -2
- package/dist/lib/node-esm/chunk-D43PP2YW.mjs +72 -0
- package/dist/lib/node-esm/chunk-D43PP2YW.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-A3BWJQVO.mjs → chunk-SNVRZBGG.mjs} +74 -22
- package/dist/lib/node-esm/chunk-SNVRZBGG.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-CM2LOG4A.mjs → chunk-USFENOK3.mjs} +27 -25
- package/dist/lib/node-esm/chunk-USFENOK3.mjs.map +7 -0
- package/dist/lib/node-esm/edge/index.mjs +1 -9
- package/dist/lib/node-esm/index.mjs +13 -11
- package/dist/lib/node-esm/index.mjs.map +2 -2
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +2 -2
- package/dist/lib/node-esm/types/index.mjs +15 -5
- package/dist/types/src/edge/functions.d.ts +0 -9
- package/dist/types/src/edge/functions.d.ts.map +1 -1
- package/dist/types/src/handler.d.ts +2 -2
- package/dist/types/src/handler.d.ts.map +1 -1
- package/dist/types/src/trigger/type/timer-trigger.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +1 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +20 -26
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/src/types/trace.d.ts +63 -81
- package/dist/types/src/types/trace.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +7 -7
- package/dist/types/src/types/url.d.ts +11 -0
- package/dist/types/src/types/url.d.ts.map +1 -0
- package/package.json +20 -20
- package/src/edge/functions.ts +2 -63
- package/src/handler.ts +3 -3
- package/src/runtime/scheduler.test.ts +2 -1
- package/src/trigger/type/timer-trigger.ts +21 -18
- package/src/types/index.ts +1 -0
- package/src/types/schema.ts +8 -6
- package/src/types/trace.ts +26 -9
- package/src/types/url.ts +47 -0
- package/dist/lib/browser/chunk-6XYG2TNO.mjs.map +0 -7
- package/dist/lib/browser/chunk-WI2RVE6E.mjs.map +0 -7
- package/dist/lib/browser/chunk-YJEIETRB.mjs +0 -128
- package/dist/lib/browser/chunk-YJEIETRB.mjs.map +0 -7
- package/dist/lib/node/chunk-HH4ZO3YY.cjs.map +0 -7
- package/dist/lib/node/chunk-MZMHE4DC.cjs.map +0 -7
- package/dist/lib/node/chunk-UNB65EWP.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-A3BWJQVO.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CM2LOG4A.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-T2KBXTMR.mjs +0 -128
- package/dist/lib/node-esm/chunk-T2KBXTMR.mjs.map +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/core/functions/src/bundler/bundler.ts":{"bytes":30383,"imports":[{"path":"esbuild-wasm","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/bundler/index.ts":{"bytes":502,"imports":[{"path":"packages/core/functions/src/bundler/bundler.ts","kind":"import-statement","original":"./bundler"}],"format":"esm"},"packages/core/functions/src/edge/functions.ts":{"bytes":13907,"imports":[{"path":"@dxos/edge-client","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/edge/index.ts":{"bytes":501,"imports":[{"path":"packages/core/functions/src/edge/functions.ts","kind":"import-statement","original":"./functions"}],"format":"esm"},"packages/core/functions/src/types/schema.ts":{"bytes":4417,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/types/types.ts":{"bytes":16526,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/types/trace.ts":{"bytes":4779,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"packages/core/functions/src/types/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/core/functions/src/types/index.ts":{"bytes":661,"imports":[{"path":"packages/core/functions/src/types/schema.ts","kind":"import-statement","original":"./schema"},{"path":"packages/core/functions/src/types/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/core/functions/src/types/trace.ts","kind":"import-statement","original":"./trace"}],"format":"esm"},"packages/core/functions/src/function/function-registry.ts":{"bytes":13004,"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/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/core/functions/src/function/index.ts":{"bytes":529,"imports":[{"path":"packages/core/functions/src/function/function-registry.ts","kind":"import-statement","original":"./function-registry"}],"format":"esm"},"packages/core/functions/src/handler.ts":{"bytes":14030,"imports":[{"path":"@effect/schema","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/trigger/type/subscription-trigger.ts":{"bytes":10314,"imports":[{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/trigger/type/timer-trigger.ts":{"bytes":4173,"imports":[{"path":"cron","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/trigger/type/index.ts":{"bytes":751,"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"}],"format":"esm"},"packages/core/functions/src/trigger/trigger-registry.ts":{"bytes":28465,"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/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/core/functions/src/trigger/index.ts":{"bytes":603,"imports":[{"path":"packages/core/functions/src/trigger/trigger-registry.ts","kind":"import-statement","original":"./trigger-registry"},{"path":"packages/core/functions/src/trigger/type/index.ts","kind":"import-statement","original":"./type"}],"format":"esm"},"packages/core/functions/src/index.ts":{"bytes":920,"imports":[{"path":"packages/core/functions/src/edge/index.ts","kind":"import-statement","original":"./edge"},{"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/trigger/index.ts","kind":"import-statement","original":"./trigger"},{"path":"packages/core/functions/src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/core/functions/src/testing/types.ts":{"bytes":1131,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/runtime/dev-server.ts":{"bytes":28958,"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":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/runtime/scheduler.ts":{"bytes":21200,"imports":[{"path":"@dxos/node-std/path","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-protocol","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/runtime/index.ts":{"bytes":598,"imports":[{"path":"packages/core/functions/src/runtime/dev-server.ts","kind":"import-statement","original":"./dev-server"},{"path":"packages/core/functions/src/runtime/scheduler.ts","kind":"import-statement","original":"./scheduler"}],"format":"esm"},"packages/core/functions/src/testing/setup.ts":{"bytes":12707,"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/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/core/functions/src/testing/util.ts":{"bytes":4310,"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/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/core/functions/src/testing/manifest.ts":{"bytes":1139,"imports":[],"format":"esm"},"packages/core/functions/src/testing/index.ts":{"bytes":749,"imports":[{"path":"packages/core/functions/src/testing/setup.ts","kind":"import-statement","original":"./setup"},{"path":"packages/core/functions/src/testing/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/core/functions/src/testing/util.ts","kind":"import-statement","original":"./util"},{"path":"packages/core/functions/src/testing/manifest.ts","kind":"import-statement","original":"./manifest"}],"format":"esm"}},"outputs":{"packages/core/functions/dist/lib/browser/bundler/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":14437},"packages/core/functions/dist/lib/browser/bundler/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-XRCXIG74.mjs","kind":"import-statement"},{"path":"esbuild-wasm","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["Bundler","initializeBundler"],"entryPoint":"packages/core/functions/src/bundler/index.ts","inputs":{"packages/core/functions/src/bundler/bundler.ts":{"bytesInOutput":7125},"packages/core/functions/src/bundler/index.ts":{"bytesInOutput":0}},"bytes":7319},"packages/core/functions/dist/lib/browser/edge/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/browser/edge/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-YJEIETRB.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-XRCXIG74.mjs","kind":"import-statement"}],"exports":["FUNCTIONS_PRESET_META_KEY","getInvocationUrl","getUserFunctionUrlInMetadata","incrementSemverPatch","publicKeyToDid","setUserFunctionUrlInMetadata","uploadWorkerFunction"],"entryPoint":"packages/core/functions/src/edge/index.ts","inputs":{},"bytes":509},"packages/core/functions/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7882},"packages/core/functions/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-YJEIETRB.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-WI2RVE6E.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-6XYG2TNO.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-XRCXIG74.mjs","kind":"import-statement"},{"path":"@effect/schema","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":["FUNCTIONS_PRESET_META_KEY","FUNCTION_TYPES","FunctionDef","FunctionManifestSchema","FunctionRegistry","FunctionTrigger","FunctionTriggerSchema","FunctionType","InvocationTrace","ScriptType","TraceEvent","TraceEventException","TraceEventLog","TriggerKind","TriggerRegistry","TriggerSchema","createSubscriptionTrigger","createTimerTrigger","defineFunction","getInvocationUrl","getUserFunctionUrlInMetadata","incrementSemverPatch","publicKeyToDid","setUserFunctionUrlInMetadata","subscriptionHandler","uploadWorkerFunction"],"entryPoint":"packages/core/functions/src/index.ts","inputs":{"packages/core/functions/src/index.ts":{"bytesInOutput":0},"packages/core/functions/src/handler.ts":{"bytesInOutput":2084}},"bytes":3409},"packages/core/functions/dist/lib/browser/chunk-YJEIETRB.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7185},"packages/core/functions/dist/lib/browser/chunk-YJEIETRB.mjs":{"imports":[{"path":"@dxos/edge-client","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["FUNCTIONS_PRESET_META_KEY","getInvocationUrl","getUserFunctionUrlInMetadata","incrementSemverPatch","publicKeyToDid","setUserFunctionUrlInMetadata","uploadWorkerFunction"],"inputs":{"packages/core/functions/src/edge/functions.ts":{"bytesInOutput":3390},"packages/core/functions/src/edge/index.ts":{"bytesInOutput":0}},"bytes":3708},"packages/core/functions/dist/lib/browser/testing/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":32290},"packages/core/functions/dist/lib/browser/testing/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-WI2RVE6E.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-6XYG2TNO.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-XRCXIG74.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":"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/client/echo","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo-protocol","kind":"import-statement","external":true},{"path":"@dxos/log","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":2785},"packages/core/functions/src/testing/types.ts":{"bytesInOutput":182},"packages/core/functions/src/runtime/dev-server.ts":{"bytesInOutput":7870},"packages/core/functions/src/runtime/index.ts":{"bytesInOutput":0},"packages/core/functions/src/runtime/scheduler.ts":{"bytesInOutput":5374},"packages/core/functions/src/testing/index.ts":{"bytesInOutput":0},"packages/core/functions/src/testing/util.ts":{"bytesInOutput":1067},"packages/core/functions/src/testing/manifest.ts":{"bytesInOutput":146}},"bytes":18208},"packages/core/functions/dist/lib/browser/chunk-WI2RVE6E.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":26827},"packages/core/functions/dist/lib/browser/chunk-WI2RVE6E.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-6XYG2TNO.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":"@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":"@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}],"exports":["FunctionRegistry","TriggerRegistry","createSubscriptionTrigger","createTimerTrigger"],"inputs":{"packages/core/functions/src/function/function-registry.ts":{"bytesInOutput":3046},"packages/core/functions/src/function/index.ts":{"bytesInOutput":0},"packages/core/functions/src/trigger/type/subscription-trigger.ts":{"bytesInOutput":2007},"packages/core/functions/src/trigger/type/timer-trigger.ts":{"bytesInOutput":898},"packages/core/functions/src/trigger/trigger-registry.ts":{"bytesInOutput":7538},"packages/core/functions/src/trigger/type/index.ts":{"bytesInOutput":0},"packages/core/functions/src/trigger/index.ts":{"bytesInOutput":0}},"bytes":13994},"packages/core/functions/dist/lib/browser/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/browser/types/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-6XYG2TNO.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-XRCXIG74.mjs","kind":"import-statement"}],"exports":["FUNCTION_TYPES","FunctionDef","FunctionManifestSchema","FunctionTrigger","FunctionTriggerSchema","FunctionType","InvocationTrace","ScriptType","TraceEvent","TraceEventException","TraceEventLog","TriggerKind","TriggerSchema"],"entryPoint":"packages/core/functions/src/types/index.ts","inputs":{},"bytes":627},"packages/core/functions/dist/lib/browser/chunk-6XYG2TNO.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":13241},"packages/core/functions/dist/lib/browser/chunk-6XYG2TNO.mjs":{"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"exports":["FUNCTION_TYPES","FunctionDef","FunctionManifestSchema","FunctionTrigger","FunctionTriggerSchema","FunctionType","InvocationTrace","ScriptType","TraceEvent","TraceEventException","TraceEventLog","TriggerKind","TriggerSchema"],"inputs":{"packages/core/functions/src/types/schema.ts":{"bytesInOutput":1010},"packages/core/functions/src/types/index.ts":{"bytesInOutput":0},"packages/core/functions/src/types/types.ts":{"bytesInOutput":3644},"packages/core/functions/src/types/trace.ts":{"bytesInOutput":997}},"bytes":6120},"packages/core/functions/dist/lib/browser/chunk-XRCXIG74.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/browser/chunk-XRCXIG74.mjs":{"imports":[],"exports":["__require"],"inputs":{},"bytes":467}}}
|
|
1
|
+
{"inputs":{"packages/core/functions/src/bundler/bundler.ts":{"bytes":30383,"imports":[{"path":"esbuild-wasm","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/bundler/index.ts":{"bytes":502,"imports":[{"path":"packages/core/functions/src/bundler/bundler.ts","kind":"import-statement","original":"./bundler"}],"format":"esm"},"packages/core/functions/src/edge/functions.ts":{"bytes":6205,"imports":[{"path":"@dxos/client/edge","kind":"import-statement","external":true},{"path":"@dxos/edge-client","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/edge/index.ts":{"bytes":501,"imports":[{"path":"packages/core/functions/src/edge/functions.ts","kind":"import-statement","original":"./functions"}],"format":"esm"},"packages/core/functions/src/types/schema.ts":{"bytes":4831,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/types/types.ts":{"bytes":16526,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/types/trace.ts":{"bytes":6233,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"packages/core/functions/src/types/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/core/functions/src/types/url.ts":{"bytes":5599,"imports":[],"format":"esm"},"packages/core/functions/src/types/index.ts":{"bytes":740,"imports":[{"path":"packages/core/functions/src/types/schema.ts","kind":"import-statement","original":"./schema"},{"path":"packages/core/functions/src/types/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/core/functions/src/types/trace.ts","kind":"import-statement","original":"./trace"},{"path":"packages/core/functions/src/types/url.ts","kind":"import-statement","original":"./url"}],"format":"esm"},"packages/core/functions/src/function/function-registry.ts":{"bytes":13004,"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/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/core/functions/src/function/index.ts":{"bytes":529,"imports":[{"path":"packages/core/functions/src/function/function-registry.ts","kind":"import-statement","original":"./function-registry"}],"format":"esm"},"packages/core/functions/src/handler.ts":{"bytes":14030,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/trigger/type/subscription-trigger.ts":{"bytes":10314,"imports":[{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/trigger/type/timer-trigger.ts":{"bytes":4673,"imports":[{"path":"cron-schedule","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/trigger/type/index.ts":{"bytes":751,"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"}],"format":"esm"},"packages/core/functions/src/trigger/trigger-registry.ts":{"bytes":28465,"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/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/core/functions/src/trigger/index.ts":{"bytes":603,"imports":[{"path":"packages/core/functions/src/trigger/trigger-registry.ts","kind":"import-statement","original":"./trigger-registry"},{"path":"packages/core/functions/src/trigger/type/index.ts","kind":"import-statement","original":"./type"}],"format":"esm"},"packages/core/functions/src/index.ts":{"bytes":920,"imports":[{"path":"packages/core/functions/src/edge/index.ts","kind":"import-statement","original":"./edge"},{"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/trigger/index.ts","kind":"import-statement","original":"./trigger"},{"path":"packages/core/functions/src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/core/functions/src/testing/types.ts":{"bytes":1131,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/runtime/dev-server.ts":{"bytes":28958,"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":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/runtime/scheduler.ts":{"bytes":21200,"imports":[{"path":"@dxos/node-std/path","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-protocol","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/runtime/index.ts":{"bytes":598,"imports":[{"path":"packages/core/functions/src/runtime/dev-server.ts","kind":"import-statement","original":"./dev-server"},{"path":"packages/core/functions/src/runtime/scheduler.ts","kind":"import-statement","original":"./scheduler"}],"format":"esm"},"packages/core/functions/src/testing/setup.ts":{"bytes":12707,"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/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/core/functions/src/testing/util.ts":{"bytes":4310,"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/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/core/functions/src/testing/manifest.ts":{"bytes":1139,"imports":[],"format":"esm"},"packages/core/functions/src/testing/index.ts":{"bytes":749,"imports":[{"path":"packages/core/functions/src/testing/setup.ts","kind":"import-statement","original":"./setup"},{"path":"packages/core/functions/src/testing/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/core/functions/src/testing/util.ts","kind":"import-statement","original":"./util"},{"path":"packages/core/functions/src/testing/manifest.ts","kind":"import-statement","original":"./manifest"}],"format":"esm"}},"outputs":{"packages/core/functions/dist/lib/browser/bundler/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":14437},"packages/core/functions/dist/lib/browser/bundler/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-XRCXIG74.mjs","kind":"import-statement"},{"path":"esbuild-wasm","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["Bundler","initializeBundler"],"entryPoint":"packages/core/functions/src/bundler/index.ts","inputs":{"packages/core/functions/src/bundler/bundler.ts":{"bytesInOutput":7125},"packages/core/functions/src/bundler/index.ts":{"bytesInOutput":0}},"bytes":7319},"packages/core/functions/dist/lib/browser/edge/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/browser/edge/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-B747D6L6.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-XRCXIG74.mjs","kind":"import-statement"}],"exports":["incrementSemverPatch","publicKeyToDid","uploadWorkerFunction"],"entryPoint":"packages/core/functions/src/edge/index.ts","inputs":{},"bytes":283},"packages/core/functions/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7891},"packages/core/functions/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-B747D6L6.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-MF6IQWJ5.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-Y3UMWWI4.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-XRCXIG74.mjs","kind":"import-statement"},{"path":"effect","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":["FUNCTIONS_PRESET_META_KEY","FUNCTION_TYPES","FunctionDef","FunctionManifestSchema","FunctionRegistry","FunctionTrigger","FunctionTriggerSchema","FunctionType","InvocationOutcome","InvocationTraceEvent","ScriptType","TraceEvent","TraceEventException","TraceEventLog","TriggerKind","TriggerRegistry","TriggerSchema","createSubscriptionTrigger","createTimerTrigger","defineFunction","getInvocationUrl","getUserFunctionUrlInMetadata","incrementSemverPatch","publicKeyToDid","setUserFunctionUrlInMetadata","subscriptionHandler","uploadWorkerFunction"],"entryPoint":"packages/core/functions/src/index.ts","inputs":{"packages/core/functions/src/index.ts":{"bytesInOutput":0},"packages/core/functions/src/handler.ts":{"bytesInOutput":2076}},"bytes":3453},"packages/core/functions/dist/lib/browser/chunk-B747D6L6.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3124},"packages/core/functions/dist/lib/browser/chunk-B747D6L6.mjs":{"imports":[{"path":"@dxos/client/edge","kind":"import-statement","external":true},{"path":"@dxos/edge-client","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["incrementSemverPatch","publicKeyToDid","uploadWorkerFunction"],"inputs":{"packages/core/functions/src/edge/functions.ts":{"bytesInOutput":1612},"packages/core/functions/src/edge/index.ts":{"bytesInOutput":0}},"bytes":1817},"packages/core/functions/dist/lib/browser/testing/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":32290},"packages/core/functions/dist/lib/browser/testing/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-MF6IQWJ5.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-Y3UMWWI4.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-XRCXIG74.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":"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/client/echo","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo-protocol","kind":"import-statement","external":true},{"path":"@dxos/log","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":2785},"packages/core/functions/src/testing/types.ts":{"bytesInOutput":182},"packages/core/functions/src/runtime/dev-server.ts":{"bytesInOutput":7870},"packages/core/functions/src/runtime/index.ts":{"bytesInOutput":0},"packages/core/functions/src/runtime/scheduler.ts":{"bytesInOutput":5374},"packages/core/functions/src/testing/index.ts":{"bytesInOutput":0},"packages/core/functions/src/testing/util.ts":{"bytesInOutput":1067},"packages/core/functions/src/testing/manifest.ts":{"bytesInOutput":146}},"bytes":18208},"packages/core/functions/dist/lib/browser/chunk-MF6IQWJ5.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":27170},"packages/core/functions/dist/lib/browser/chunk-MF6IQWJ5.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-Y3UMWWI4.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":"@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-schedule","kind":"import-statement","external":true},{"path":"@dxos/async","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}],"exports":["FunctionRegistry","TriggerRegistry","createSubscriptionTrigger","createTimerTrigger"],"inputs":{"packages/core/functions/src/function/function-registry.ts":{"bytesInOutput":3046},"packages/core/functions/src/function/index.ts":{"bytesInOutput":0},"packages/core/functions/src/trigger/type/subscription-trigger.ts":{"bytesInOutput":2007},"packages/core/functions/src/trigger/type/timer-trigger.ts":{"bytesInOutput":1086},"packages/core/functions/src/trigger/trigger-registry.ts":{"bytesInOutput":7538},"packages/core/functions/src/trigger/type/index.ts":{"bytesInOutput":0},"packages/core/functions/src/trigger/index.ts":{"bytesInOutput":0}},"bytes":14182},"packages/core/functions/dist/lib/browser/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/browser/types/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-Y3UMWWI4.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-XRCXIG74.mjs","kind":"import-statement"}],"exports":["FUNCTIONS_PRESET_META_KEY","FUNCTION_TYPES","FunctionDef","FunctionManifestSchema","FunctionTrigger","FunctionTriggerSchema","FunctionType","InvocationOutcome","InvocationTraceEvent","ScriptType","TraceEvent","TraceEventException","TraceEventLog","TriggerKind","TriggerSchema","getInvocationUrl","getUserFunctionUrlInMetadata","setUserFunctionUrlInMetadata"],"entryPoint":"packages/core/functions/src/types/index.ts","inputs":{},"bytes":905},"packages/core/functions/dist/lib/browser/chunk-Y3UMWWI4.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":17072},"packages/core/functions/dist/lib/browser/chunk-Y3UMWWI4.mjs":{"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"exports":["FUNCTIONS_PRESET_META_KEY","FUNCTION_TYPES","FunctionDef","FunctionManifestSchema","FunctionTrigger","FunctionTriggerSchema","FunctionType","InvocationOutcome","InvocationTraceEvent","ScriptType","TraceEvent","TraceEventException","TraceEventLog","TriggerKind","TriggerSchema","getInvocationUrl","getUserFunctionUrlInMetadata","setUserFunctionUrlInMetadata"],"inputs":{"packages/core/functions/src/types/schema.ts":{"bytesInOutput":1057},"packages/core/functions/src/types/index.ts":{"bytesInOutput":0},"packages/core/functions/src/types/types.ts":{"bytesInOutput":3644},"packages/core/functions/src/types/trace.ts":{"bytesInOutput":1502},"packages/core/functions/src/types/url.ts":{"bytesInOutput":1138}},"bytes":7994},"packages/core/functions/dist/lib/browser/chunk-XRCXIG74.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/browser/chunk-XRCXIG74.mjs":{"imports":[],"exports":["__require"],"inputs":{},"bytes":467}}}
|
|
@@ -2,11 +2,11 @@ import "@dxos/node-std/globals";
|
|
|
2
2
|
import {
|
|
3
3
|
FunctionRegistry,
|
|
4
4
|
TriggerRegistry
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-MF6IQWJ5.mjs";
|
|
6
6
|
import {
|
|
7
7
|
FunctionDef,
|
|
8
8
|
FunctionTrigger
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-Y3UMWWI4.mjs";
|
|
10
10
|
import {
|
|
11
11
|
__require
|
|
12
12
|
} from "../chunk-XRCXIG74.mjs";
|
|
@@ -1,33 +1,43 @@
|
|
|
1
1
|
import "@dxos/node-std/globals";
|
|
2
2
|
import {
|
|
3
|
+
FUNCTIONS_PRESET_META_KEY,
|
|
3
4
|
FUNCTION_TYPES,
|
|
4
5
|
FunctionDef,
|
|
5
6
|
FunctionManifestSchema,
|
|
6
7
|
FunctionTrigger,
|
|
7
8
|
FunctionTriggerSchema,
|
|
8
9
|
FunctionType,
|
|
9
|
-
|
|
10
|
+
InvocationOutcome,
|
|
11
|
+
InvocationTraceEvent,
|
|
10
12
|
ScriptType,
|
|
11
13
|
TraceEvent,
|
|
12
14
|
TraceEventException,
|
|
13
15
|
TraceEventLog,
|
|
14
16
|
TriggerKind,
|
|
15
|
-
TriggerSchema
|
|
16
|
-
|
|
17
|
+
TriggerSchema,
|
|
18
|
+
getInvocationUrl,
|
|
19
|
+
getUserFunctionUrlInMetadata,
|
|
20
|
+
setUserFunctionUrlInMetadata
|
|
21
|
+
} from "../chunk-Y3UMWWI4.mjs";
|
|
17
22
|
import "../chunk-XRCXIG74.mjs";
|
|
18
23
|
export {
|
|
24
|
+
FUNCTIONS_PRESET_META_KEY,
|
|
19
25
|
FUNCTION_TYPES,
|
|
20
26
|
FunctionDef,
|
|
21
27
|
FunctionManifestSchema,
|
|
22
28
|
FunctionTrigger,
|
|
23
29
|
FunctionTriggerSchema,
|
|
24
30
|
FunctionType,
|
|
25
|
-
|
|
31
|
+
InvocationOutcome,
|
|
32
|
+
InvocationTraceEvent,
|
|
26
33
|
ScriptType,
|
|
27
34
|
TraceEvent,
|
|
28
35
|
TraceEventException,
|
|
29
36
|
TraceEventLog,
|
|
30
37
|
TriggerKind,
|
|
31
|
-
TriggerSchema
|
|
38
|
+
TriggerSchema,
|
|
39
|
+
getInvocationUrl,
|
|
40
|
+
getUserFunctionUrlInMetadata,
|
|
41
|
+
setUserFunctionUrlInMetadata
|
|
32
42
|
};
|
|
33
43
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -16,39 +16,42 @@ 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_5Z24F7Z3_exports = {};
|
|
20
|
+
__export(chunk_5Z24F7Z3_exports, {
|
|
21
|
+
FUNCTIONS_PRESET_META_KEY: () => FUNCTIONS_PRESET_META_KEY,
|
|
21
22
|
FUNCTION_TYPES: () => FUNCTION_TYPES,
|
|
22
23
|
FunctionDef: () => FunctionDef,
|
|
23
24
|
FunctionManifestSchema: () => FunctionManifestSchema,
|
|
24
25
|
FunctionTrigger: () => FunctionTrigger,
|
|
25
26
|
FunctionTriggerSchema: () => FunctionTriggerSchema,
|
|
26
27
|
FunctionType: () => FunctionType,
|
|
27
|
-
|
|
28
|
+
InvocationOutcome: () => InvocationOutcome,
|
|
29
|
+
InvocationTraceEvent: () => InvocationTraceEvent,
|
|
28
30
|
ScriptType: () => ScriptType,
|
|
29
31
|
TraceEvent: () => TraceEvent,
|
|
30
32
|
TraceEventException: () => TraceEventException,
|
|
31
33
|
TraceEventLog: () => TraceEventLog,
|
|
32
34
|
TriggerKind: () => TriggerKind,
|
|
33
|
-
TriggerSchema: () => TriggerSchema
|
|
35
|
+
TriggerSchema: () => TriggerSchema,
|
|
36
|
+
getInvocationUrl: () => getInvocationUrl,
|
|
37
|
+
getUserFunctionUrlInMetadata: () => getUserFunctionUrlInMetadata,
|
|
38
|
+
setUserFunctionUrlInMetadata: () => setUserFunctionUrlInMetadata
|
|
34
39
|
});
|
|
35
|
-
module.exports = __toCommonJS(
|
|
40
|
+
module.exports = __toCommonJS(chunk_5Z24F7Z3_exports);
|
|
36
41
|
var import_echo_schema = require("@dxos/echo-schema");
|
|
37
42
|
var import_schema = require("@dxos/schema");
|
|
38
43
|
var import_echo_schema2 = require("@dxos/echo-schema");
|
|
39
44
|
var import_echo_schema3 = require("@dxos/echo-schema");
|
|
40
|
-
var ScriptType =
|
|
41
|
-
typename: "dxos.org/type/Script",
|
|
42
|
-
version: "0.1.0"
|
|
43
|
-
})({
|
|
45
|
+
var ScriptType = import_echo_schema.S.Struct({
|
|
44
46
|
name: import_echo_schema.S.optional(import_echo_schema.S.String),
|
|
45
47
|
description: import_echo_schema.S.optional(import_echo_schema.S.String),
|
|
46
48
|
// TODO(burdon): Change to hash of deployed content.
|
|
47
49
|
// Whether source has changed since last deploy.
|
|
48
50
|
changed: import_echo_schema.S.optional(import_echo_schema.S.Boolean),
|
|
49
51
|
source: (0, import_echo_schema.Ref)(import_schema.TextType)
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
+
}).annotations({
|
|
53
|
+
[import_echo_schema.LabelAnnotationId]: "name"
|
|
54
|
+
}).pipe((0, import_echo_schema.EchoObject)("dxos.org/type/Script", "0.1.0"));
|
|
52
55
|
var FunctionType = class extends (0, import_echo_schema.TypedObject)({
|
|
53
56
|
typename: "dxos.org/type/Function",
|
|
54
57
|
version: "0.1.0"
|
|
@@ -178,8 +181,23 @@ var FUNCTION_TYPES = [
|
|
|
178
181
|
FunctionDef,
|
|
179
182
|
FunctionTrigger
|
|
180
183
|
];
|
|
181
|
-
var
|
|
184
|
+
var InvocationOutcome;
|
|
185
|
+
(function(InvocationOutcome2) {
|
|
186
|
+
InvocationOutcome2["SUCCESS"] = "success";
|
|
187
|
+
InvocationOutcome2["FAILURE"] = "failure";
|
|
188
|
+
})(InvocationOutcome || (InvocationOutcome = {}));
|
|
189
|
+
var TraceEventException = import_echo_schema3.S.Struct({
|
|
190
|
+
timestampMs: import_echo_schema3.S.Number,
|
|
191
|
+
message: import_echo_schema3.S.String,
|
|
192
|
+
name: import_echo_schema3.S.String,
|
|
193
|
+
stack: import_echo_schema3.S.optional(import_echo_schema3.S.String)
|
|
194
|
+
});
|
|
195
|
+
var InvocationTraceEvent = import_echo_schema3.S.Struct({
|
|
182
196
|
id: import_echo_schema3.ObjectId,
|
|
197
|
+
timestampMs: import_echo_schema3.S.Number,
|
|
198
|
+
outcome: import_echo_schema3.S.Enums(InvocationOutcome),
|
|
199
|
+
input: import_echo_schema3.S.Object,
|
|
200
|
+
durationMs: import_echo_schema3.S.Number,
|
|
183
201
|
/**
|
|
184
202
|
* Queue DXN for function/workflow invocation events.
|
|
185
203
|
*/
|
|
@@ -191,7 +209,11 @@ var InvocationTrace = import_echo_schema3.S.Struct({
|
|
|
191
209
|
/**
|
|
192
210
|
* Present for automatic invocations.
|
|
193
211
|
*/
|
|
194
|
-
trigger: import_echo_schema3.S.optional((0, import_echo_schema3.Ref)(FunctionTrigger))
|
|
212
|
+
trigger: import_echo_schema3.S.optional((0, import_echo_schema3.Ref)(FunctionTrigger)),
|
|
213
|
+
/**
|
|
214
|
+
* Present for outcome FAILURE.
|
|
215
|
+
*/
|
|
216
|
+
exception: import_echo_schema3.S.optional(TraceEventException)
|
|
195
217
|
}).pipe((0, import_echo_schema3.EchoObject)("dxos.org/type/InvocationTrace", "0.1.0"));
|
|
196
218
|
var TraceEventLog = import_echo_schema3.S.Struct({
|
|
197
219
|
timestampMs: import_echo_schema3.S.Number,
|
|
@@ -199,33 +221,66 @@ var TraceEventLog = import_echo_schema3.S.Struct({
|
|
|
199
221
|
message: import_echo_schema3.S.String,
|
|
200
222
|
context: import_echo_schema3.S.optional(import_echo_schema3.S.Object)
|
|
201
223
|
});
|
|
202
|
-
var TraceEventException = import_echo_schema3.S.Struct({
|
|
203
|
-
timestampMs: import_echo_schema3.S.Number,
|
|
204
|
-
message: import_echo_schema3.S.String,
|
|
205
|
-
name: import_echo_schema3.S.String,
|
|
206
|
-
stack: import_echo_schema3.S.optional(import_echo_schema3.S.String)
|
|
207
|
-
});
|
|
208
224
|
var TraceEvent = import_echo_schema3.S.Struct({
|
|
209
225
|
id: import_echo_schema3.ObjectId,
|
|
210
226
|
outcome: import_echo_schema3.S.String,
|
|
211
227
|
truncated: import_echo_schema3.S.Boolean,
|
|
228
|
+
/**
|
|
229
|
+
* Time when the event was persisted.
|
|
230
|
+
*/
|
|
231
|
+
ingestionTimestampMs: import_echo_schema3.S.Number,
|
|
212
232
|
logs: import_echo_schema3.S.Array(TraceEventLog),
|
|
213
233
|
exceptions: import_echo_schema3.S.Array(TraceEventException)
|
|
214
234
|
}).pipe((0, import_echo_schema3.EchoObject)("dxos.org/type/TraceEvent", "0.1.0"));
|
|
235
|
+
var FUNCTIONS_META_KEY = "dxos.org/service/function";
|
|
236
|
+
var FUNCTIONS_PRESET_META_KEY = "dxos.org/service/function-preset";
|
|
237
|
+
var isSecure = (protocol) => {
|
|
238
|
+
return protocol === "https:" || protocol === "wss:";
|
|
239
|
+
};
|
|
240
|
+
var getUserFunctionUrlInMetadata = (meta) => {
|
|
241
|
+
return meta.keys.find((key) => key.source === FUNCTIONS_META_KEY)?.id;
|
|
242
|
+
};
|
|
243
|
+
var setUserFunctionUrlInMetadata = (meta, functionUrl) => {
|
|
244
|
+
const key = meta.keys.find((key2) => key2.source === FUNCTIONS_META_KEY);
|
|
245
|
+
if (key) {
|
|
246
|
+
if (key.id !== functionUrl) {
|
|
247
|
+
throw new Error("Metadata mismatch");
|
|
248
|
+
}
|
|
249
|
+
} else {
|
|
250
|
+
meta.keys.push({
|
|
251
|
+
source: FUNCTIONS_META_KEY,
|
|
252
|
+
id: functionUrl
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
var getInvocationUrl = (functionUrl, edgeUrl, options = {}) => {
|
|
257
|
+
const baseUrl = new URL("functions/", edgeUrl);
|
|
258
|
+
const relativeUrl = functionUrl.replace(/^\//, "");
|
|
259
|
+
const url = new URL(`./${relativeUrl}`, baseUrl.toString());
|
|
260
|
+
options.spaceId && url.searchParams.set("spaceId", options.spaceId);
|
|
261
|
+
options.subjectId && url.searchParams.set("subjectId", options.subjectId);
|
|
262
|
+
url.protocol = isSecure(url.protocol) ? "https" : "http";
|
|
263
|
+
return url.toString();
|
|
264
|
+
};
|
|
215
265
|
// Annotate the CommonJS export names for ESM import in node:
|
|
216
266
|
0 && (module.exports = {
|
|
267
|
+
FUNCTIONS_PRESET_META_KEY,
|
|
217
268
|
FUNCTION_TYPES,
|
|
218
269
|
FunctionDef,
|
|
219
270
|
FunctionManifestSchema,
|
|
220
271
|
FunctionTrigger,
|
|
221
272
|
FunctionTriggerSchema,
|
|
222
273
|
FunctionType,
|
|
223
|
-
|
|
274
|
+
InvocationOutcome,
|
|
275
|
+
InvocationTraceEvent,
|
|
224
276
|
ScriptType,
|
|
225
277
|
TraceEvent,
|
|
226
278
|
TraceEventException,
|
|
227
279
|
TraceEventLog,
|
|
228
280
|
TriggerKind,
|
|
229
|
-
TriggerSchema
|
|
281
|
+
TriggerSchema,
|
|
282
|
+
getInvocationUrl,
|
|
283
|
+
getUserFunctionUrlInMetadata,
|
|
284
|
+
setUserFunctionUrlInMetadata
|
|
230
285
|
});
|
|
231
|
-
//# sourceMappingURL=chunk-
|
|
286
|
+
//# sourceMappingURL=chunk-5Z24F7Z3.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/types/schema.ts", "../../../src/types/types.ts", "../../../src/types/trace.ts", "../../../src/types/url.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { EchoObject, JsonSchemaType, LabelAnnotationId, Ref, S, TypedObject } from '@dxos/echo-schema';\nimport { TextType } from '@dxos/schema';\n\n/**\n * Source script.\n */\nexport const ScriptType = S.Struct({\n name: S.optional(S.String),\n description: S.optional(S.String),\n // TODO(burdon): Change to hash of deployed content.\n // Whether source has changed since last deploy.\n changed: S.optional(S.Boolean),\n source: Ref(TextType),\n})\n .annotations({\n [LabelAnnotationId]: 'name',\n })\n .pipe(EchoObject('dxos.org/type/Script', '0.1.0'));\nexport type ScriptType = S.Schema.Type<typeof ScriptType>;\n\n/**\n * Function deployment.\n */\n// TODO(burdon): Move to core/functions.\nexport class FunctionType extends TypedObject({\n typename: 'dxos.org/type/Function',\n version: '0.1.0',\n})({\n // TODO(burdon): Rename to id/uri?\n name: S.NonEmptyString,\n version: S.String,\n\n description: S.optional(S.String),\n\n // Reference to a source script if it exists within ECHO.\n // TODO(burdon): Don't ref ScriptType directly (core).\n source: S.optional(Ref(ScriptType)),\n\n inputSchema: S.optional(JsonSchemaType),\n outputSchema: S.optional(JsonSchemaType),\n\n // Local binding to a function name.\n binding: S.optional(S.String),\n}) {}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { AST, OptionsAnnotationId, RawObject, S, TypedObject, DXN } from '@dxos/echo-schema';\n\n/**\n * Type discriminator for TriggerType.\n * Every spec has a type field of type TriggerKind that we can use to understand which type we're working with.\n * https://www.typescriptlang.org/docs/handbook/2/narrowing.html#discriminated-unions\n */\nexport enum TriggerKind {\n Timer = 'timer',\n Webhook = 'webhook',\n Subscription = 'subscription',\n Email = 'email',\n Queue = 'queue',\n}\n\n// TODO(burdon): Rename prop kind.\nconst typeLiteralAnnotations = { [AST.TitleAnnotationId]: 'Type' };\n\n/**\n * Cron timer.\n */\nconst TimerTriggerSchema = S.Struct({\n type: S.Literal(TriggerKind.Timer).annotations(typeLiteralAnnotations),\n cron: S.String.annotations({\n [AST.TitleAnnotationId]: 'Cron',\n [AST.ExamplesAnnotationId]: ['0 0 * * *'],\n }),\n}).pipe(S.mutable);\n\nexport type TimerTrigger = S.Schema.Type<typeof TimerTriggerSchema>;\n\nconst EmailTriggerSchema = S.Struct({\n type: S.Literal(TriggerKind.Email).annotations(typeLiteralAnnotations),\n}).pipe(S.mutable);\n\nexport type EmailTrigger = S.Schema.Type<typeof EmailTriggerSchema>;\n\nconst QueueTriggerSchema = S.Struct({\n type: S.Literal(TriggerKind.Queue).annotations(typeLiteralAnnotations),\n queue: DXN,\n}).pipe(S.mutable);\n\nexport type QueueTrigger = S.Schema.Type<typeof QueueTriggerSchema>;\n\n/**\n * Webhook.\n */\nconst WebhookTriggerSchema = S.Struct({\n type: S.Literal(TriggerKind.Webhook).annotations(typeLiteralAnnotations),\n method: S.optional(\n S.String.annotations({\n [AST.TitleAnnotationId]: 'Method',\n [OptionsAnnotationId]: ['GET', 'POST'],\n }),\n ),\n port: S.optional(\n S.Number.annotations({\n [AST.TitleAnnotationId]: 'Port',\n }),\n ),\n}).pipe(S.mutable);\n\nexport type WebhookTrigger = S.Schema.Type<typeof WebhookTriggerSchema>;\n\n// TODO(burdon): Use ECHO definition (from https://github.com/dxos/dxos/pull/8233).\nconst QuerySchema = S.Struct({\n type: S.optional(S.String.annotations({ [AST.TitleAnnotationId]: 'Type' })),\n props: S.optional(S.Record({ key: S.String, value: S.Any })),\n}).annotations({ [AST.TitleAnnotationId]: 'Query' });\n\n/**\n * Subscription.\n */\nconst SubscriptionTriggerSchema = S.Struct({\n type: S.Literal(TriggerKind.Subscription).annotations(typeLiteralAnnotations),\n // TODO(burdon): Define query DSL (from ECHO). Reconcile with Table.Query.\n filter: QuerySchema,\n options: S.optional(\n S.Struct({\n // Watch changes to object (not just creation).\n deep: S.optional(S.Boolean.annotations({ [AST.TitleAnnotationId]: 'Nested' })),\n // Debounce changes (delay in ms).\n delay: S.optional(S.Number.annotations({ [AST.TitleAnnotationId]: 'Delay' })),\n }).annotations({ [AST.TitleAnnotationId]: 'Options' }),\n ),\n}).pipe(S.mutable);\n\nexport type SubscriptionTrigger = S.Schema.Type<typeof SubscriptionTriggerSchema>;\n\n/**\n * Trigger schema (discriminated union).\n */\nexport const TriggerSchema = S.Union(\n TimerTriggerSchema,\n WebhookTriggerSchema,\n SubscriptionTriggerSchema,\n EmailTriggerSchema,\n QueueTriggerSchema,\n).annotations({\n [AST.TitleAnnotationId]: 'Trigger',\n});\n\nexport type TriggerType = S.Schema.Type<typeof TriggerSchema>;\n\n/**\n * Function trigger.\n */\nexport const FunctionTriggerSchema = S.Struct({\n // TODO(burdon): What type does this reference.\n // TODO(wittjosiah): This should probably be a Ref?\n function: S.optional(S.String.annotations({ [AST.TitleAnnotationId]: 'Function' })),\n\n enabled: S.optional(S.Boolean.annotations({ [AST.TitleAnnotationId]: 'Enabled' })),\n\n // TODO(burdon): Flatten entire schema.\n spec: S.optional(TriggerSchema),\n\n // TODO(burdon): Get meta from function.\n // The `meta` property is merged into the event data passed to the function.\n meta: S.optional(S.mutable(S.Record({ key: S.String, value: S.Any }))),\n});\n\nexport type FunctionTriggerType = S.Schema.Type<typeof FunctionTriggerSchema>;\n\n/**\n * Function trigger.\n */\nexport class FunctionTrigger extends TypedObject({\n typename: 'dxos.org/type/FunctionTrigger',\n version: '0.1.0',\n})(FunctionTriggerSchema.fields) {}\n\n/**\n * Function definition.\n * @deprecated (Use dxos.org/type/Function)\n */\n// TODO(burdon): Reconcile with FunctionType.\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 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\nexport const FUNCTION_TYPES = [FunctionDef, FunctionTrigger];\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { EchoObject, Expando, ObjectId, Ref, S } from '@dxos/echo-schema';\n\nimport { FunctionTrigger } from './types';\n\nexport enum InvocationOutcome {\n SUCCESS = 'success',\n FAILURE = 'failure',\n}\n\nexport const TraceEventException = S.Struct({\n timestampMs: S.Number,\n message: S.String,\n name: S.String,\n stack: S.optional(S.String),\n});\n\nexport const InvocationTraceEvent = S.Struct({\n id: ObjectId,\n timestampMs: S.Number,\n outcome: S.Enums(InvocationOutcome),\n input: S.Object,\n durationMs: S.Number,\n /**\n * Queue DXN for function/workflow invocation events.\n */\n invocationTraceQueue: Ref(Expando),\n /**\n * DXN of the invoked function/workflow.\n */\n invocationTarget: Ref(Expando),\n /**\n * Present for automatic invocations.\n */\n trigger: S.optional(Ref(FunctionTrigger)),\n /**\n * Present for outcome FAILURE.\n */\n exception: S.optional(TraceEventException),\n}).pipe(EchoObject('dxos.org/type/InvocationTrace', '0.1.0'));\n\nexport type InvocationTraceEvent = S.Schema.Type<typeof InvocationTraceEvent>;\n\nexport const TraceEventLog = S.Struct({\n timestampMs: S.Number,\n level: S.String,\n message: S.String,\n context: S.optional(S.Object),\n});\n\nexport const TraceEvent = S.Struct({\n id: ObjectId,\n outcome: S.String,\n truncated: S.Boolean,\n /**\n * Time when the event was persisted.\n */\n ingestionTimestampMs: S.Number,\n logs: S.Array(TraceEventLog),\n exceptions: S.Array(TraceEventException),\n}).pipe(EchoObject('dxos.org/type/TraceEvent', '0.1.0'));\n\nexport type TraceEvent = S.Schema.Type<typeof TraceEvent>;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type ObjectMeta } from '@dxos/echo-schema';\nimport { type SpaceId } from '@dxos/keys';\n\n// TODO: use URL scheme for source?\nconst FUNCTIONS_META_KEY = 'dxos.org/service/function';\n\nexport const FUNCTIONS_PRESET_META_KEY = 'dxos.org/service/function-preset';\n\nconst isSecure = (protocol: string) => {\n return protocol === 'https:' || protocol === 'wss:';\n};\n\nexport const getUserFunctionUrlInMetadata = (meta: ObjectMeta) => {\n return meta.keys.find((key) => key.source === FUNCTIONS_META_KEY)?.id;\n};\n\nexport const setUserFunctionUrlInMetadata = (meta: ObjectMeta, functionUrl: string) => {\n const key = meta.keys.find((key) => key.source === FUNCTIONS_META_KEY);\n if (key) {\n if (key.id !== functionUrl) {\n throw new Error('Metadata mismatch');\n }\n } else {\n meta.keys.push({ source: FUNCTIONS_META_KEY, id: functionUrl });\n }\n};\n\nexport const getInvocationUrl = (functionUrl: string, edgeUrl: string, options: InvocationOptions = {}) => {\n const baseUrl = new URL('functions/', edgeUrl);\n\n // Leading slashes cause the URL to be treated as an absolute path.\n const relativeUrl = functionUrl.replace(/^\\//, '');\n const url = new URL(`./${relativeUrl}`, baseUrl.toString());\n options.spaceId && url.searchParams.set('spaceId', options.spaceId);\n options.subjectId && url.searchParams.set('subjectId', options.subjectId);\n url.protocol = isSecure(url.protocol) ? 'https' : 'http';\n return url.toString();\n};\n\nexport type InvocationOptions = {\n spaceId?: SpaceId;\n subjectId?: string;\n};\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["import_echo_schema", "ScriptType", "S", "Struct", "name", "optional", "String", "description", "changed", "Boolean", "source", "Ref", "TextType", "annotations", "LabelAnnotationId", "pipe", "EchoObject", "FunctionType", "TypedObject", "typename", "version", "NonEmptyString", "inputSchema", "JsonSchemaType", "outputSchema", "binding", "TriggerKind", "typeLiteralAnnotations", "AST", "TitleAnnotationId", "TimerTriggerSchema", "type", "Literal", "cron", "ExamplesAnnotationId", "mutable", "EmailTriggerSchema", "QueueTriggerSchema", "queue", "DXN", "WebhookTriggerSchema", "method", "OptionsAnnotationId", "port", "Number", "QuerySchema", "props", "Record", "key", "value", "Any", "SubscriptionTriggerSchema", "filter", "options", "deep", "delay", "TriggerSchema", "Union", "FunctionTriggerSchema", "function", "enabled", "spec", "meta", "FunctionTrigger", "fields", "FunctionDef", "uri", "route", "handler", "FunctionManifestSchema", "functions", "Array", "RawObject", "triggers", "FUNCTION_TYPES", "InvocationOutcome", "TraceEventException", "timestampMs", "message", "stack", "InvocationTraceEvent", "id", "ObjectId", "outcome", "Enums", "input", "Object", "durationMs", "invocationTraceQueue", "Expando", "invocationTarget", "trigger", "exception", "TraceEventLog", "level", "context", "TraceEvent", "truncated", "ingestionTimestampMs", "logs", "exceptions", "FUNCTIONS_META_KEY", "FUNCTIONS_PRESET_META_KEY", "isSecure", "protocol", "getUserFunctionUrlInMetadata", "keys", "find", "setUserFunctionUrlInMetadata", "functionUrl", "Error", "push", "getInvocationUrl", "edgeUrl", "baseUrl", "URL", "relativeUrl", "replace", "url", "toString", "spaceId", "searchParams", "set", "subjectId"]
|
|
7
|
+
}
|
|
@@ -16,28 +16,23 @@ 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(
|
|
21
|
-
FUNCTIONS_PRESET_META_KEY: () => FUNCTIONS_PRESET_META_KEY,
|
|
22
|
-
getInvocationUrl: () => getInvocationUrl,
|
|
23
|
-
getUserFunctionUrlInMetadata: () => getUserFunctionUrlInMetadata,
|
|
19
|
+
var chunk_D4T2DS7U_exports = {};
|
|
20
|
+
__export(chunk_D4T2DS7U_exports, {
|
|
24
21
|
incrementSemverPatch: () => incrementSemverPatch,
|
|
25
22
|
publicKeyToDid: () => publicKeyToDid,
|
|
26
|
-
setUserFunctionUrlInMetadata: () => setUserFunctionUrlInMetadata,
|
|
27
23
|
uploadWorkerFunction: () => uploadWorkerFunction
|
|
28
24
|
});
|
|
29
|
-
module.exports = __toCommonJS(
|
|
25
|
+
module.exports = __toCommonJS(chunk_D4T2DS7U_exports);
|
|
26
|
+
var import_edge = require("@dxos/client/edge");
|
|
30
27
|
var import_edge_client = require("@dxos/edge-client");
|
|
31
28
|
var import_invariant = require("@dxos/invariant");
|
|
32
29
|
var import_log = require("@dxos/log");
|
|
33
30
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/functions/src/edge/functions.ts";
|
|
34
|
-
var FUNCTIONS_META_KEY = "dxos.org/service/function";
|
|
35
|
-
var FUNCTIONS_PRESET_META_KEY = "dxos.org/service/function-preset";
|
|
36
31
|
var uploadWorkerFunction = async ({ client, name, version, source, spaceId, functionId }) => {
|
|
37
32
|
const edgeUrl = client.config.values.runtime?.services?.edge?.url;
|
|
38
33
|
(0, import_invariant.invariant)(edgeUrl, "Edge is not configured.", {
|
|
39
34
|
F: __dxlog_file,
|
|
40
|
-
L:
|
|
35
|
+
L: 33,
|
|
41
36
|
S: void 0,
|
|
42
37
|
A: [
|
|
43
38
|
"edgeUrl",
|
|
@@ -45,7 +40,7 @@ var uploadWorkerFunction = async ({ client, name, version, source, spaceId, func
|
|
|
45
40
|
]
|
|
46
41
|
});
|
|
47
42
|
const edgeClient = new import_edge_client.EdgeHttpClient(edgeUrl);
|
|
48
|
-
const edgeIdentity = createEdgeIdentity(client);
|
|
43
|
+
const edgeIdentity = (0, import_edge.createEdgeIdentity)(client);
|
|
49
44
|
edgeClient.setIdentity(edgeIdentity);
|
|
50
45
|
const response = await edgeClient.uploadFunction({
|
|
51
46
|
spaceId,
|
|
@@ -63,69 +58,18 @@ var uploadWorkerFunction = async ({ client, name, version, source, spaceId, func
|
|
|
63
58
|
response
|
|
64
59
|
}, {
|
|
65
60
|
F: __dxlog_file,
|
|
66
|
-
L:
|
|
61
|
+
L: 39,
|
|
67
62
|
S: void 0,
|
|
68
63
|
C: (f, a) => f(...a)
|
|
69
64
|
});
|
|
70
65
|
return response;
|
|
71
66
|
};
|
|
72
|
-
var getUserFunctionUrlInMetadata = (meta) => {
|
|
73
|
-
return meta.keys.find((key) => key.source === FUNCTIONS_META_KEY)?.id;
|
|
74
|
-
};
|
|
75
|
-
var setUserFunctionUrlInMetadata = (meta, functionUrl) => {
|
|
76
|
-
const key = meta.keys.find((key2) => key2.source === FUNCTIONS_META_KEY);
|
|
77
|
-
if (key) {
|
|
78
|
-
if (key.id !== functionUrl) {
|
|
79
|
-
throw new Error("Metadata mismatch");
|
|
80
|
-
}
|
|
81
|
-
} else {
|
|
82
|
-
meta.keys.push({
|
|
83
|
-
source: FUNCTIONS_META_KEY,
|
|
84
|
-
id: functionUrl
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
var getInvocationUrl = (functionUrl, edgeUrl, options = {}) => {
|
|
89
|
-
const baseUrl = new URL("functions/", edgeUrl);
|
|
90
|
-
const relativeUrl = functionUrl.replace(/^\//, "");
|
|
91
|
-
const url = new URL(`./${relativeUrl}`, baseUrl.toString());
|
|
92
|
-
options.spaceId && url.searchParams.set("spaceId", options.spaceId);
|
|
93
|
-
options.subjectId && url.searchParams.set("subjectId", options.subjectId);
|
|
94
|
-
url.protocol = isSecure(url.protocol) ? "https" : "http";
|
|
95
|
-
return url.toString();
|
|
96
|
-
};
|
|
97
|
-
var isSecure = (protocol) => {
|
|
98
|
-
return protocol === "https:" || protocol === "wss:";
|
|
99
|
-
};
|
|
100
|
-
var createEdgeIdentity = (client) => {
|
|
101
|
-
const identity = client.halo.identity.get();
|
|
102
|
-
const device = client.halo.device;
|
|
103
|
-
if (!identity || !device) {
|
|
104
|
-
throw new Error("Identity not available");
|
|
105
|
-
}
|
|
106
|
-
return {
|
|
107
|
-
identityKey: identity.identityKey.toHex(),
|
|
108
|
-
peerKey: device.deviceKey.toHex(),
|
|
109
|
-
presentCredentials: async ({ challenge }) => {
|
|
110
|
-
const identityService = client.services.services.IdentityService;
|
|
111
|
-
const authCredential = await identityService.createAuthCredential();
|
|
112
|
-
return identityService.signPresentation({
|
|
113
|
-
presentation: {
|
|
114
|
-
credentials: [
|
|
115
|
-
authCredential
|
|
116
|
-
]
|
|
117
|
-
},
|
|
118
|
-
nonce: challenge
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
};
|
|
123
67
|
var incrementSemverPatch = (version) => {
|
|
124
68
|
const [major, minor, patch] = version.split(".");
|
|
125
69
|
const patchNum = Number(patch);
|
|
126
70
|
(0, import_invariant.invariant)(!Number.isNaN(patchNum), "Unexpected function version format.", {
|
|
127
71
|
F: __dxlog_file,
|
|
128
|
-
L:
|
|
72
|
+
L: 53,
|
|
129
73
|
S: void 0,
|
|
130
74
|
A: [
|
|
131
75
|
"!Number.isNaN(patchNum)",
|
|
@@ -143,12 +87,8 @@ var publicKeyToDid = (key) => {
|
|
|
143
87
|
};
|
|
144
88
|
// Annotate the CommonJS export names for ESM import in node:
|
|
145
89
|
0 && (module.exports = {
|
|
146
|
-
FUNCTIONS_PRESET_META_KEY,
|
|
147
|
-
getInvocationUrl,
|
|
148
|
-
getUserFunctionUrlInMetadata,
|
|
149
90
|
incrementSemverPatch,
|
|
150
91
|
publicKeyToDid,
|
|
151
|
-
setUserFunctionUrlInMetadata,
|
|
152
92
|
uploadWorkerFunction
|
|
153
93
|
});
|
|
154
|
-
//# sourceMappingURL=chunk-
|
|
94
|
+
//# sourceMappingURL=chunk-D4T2DS7U.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/edge/functions.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { type DID } from 'iso-did/types';\n\nimport { type Client } from '@dxos/client';\nimport { createEdgeIdentity } from '@dxos/client/edge';\nimport { EdgeHttpClient } from '@dxos/edge-client';\nimport { invariant } from '@dxos/invariant';\nimport type { PublicKey, SpaceId } from '@dxos/keys';\nimport { log } from '@dxos/log';\nimport { type UploadFunctionResponseBody } from '@dxos/protocols';\n\nexport type UploadWorkerArgs = {\n client: Client;\n name?: string;\n source: string;\n version: string;\n functionId?: string;\n spaceId: SpaceId;\n};\n\nexport const uploadWorkerFunction = async ({\n client,\n name,\n version,\n source,\n spaceId,\n functionId,\n}: UploadWorkerArgs): Promise<UploadFunctionResponseBody> => {\n const edgeUrl = client.config.values.runtime?.services?.edge?.url;\n invariant(edgeUrl, 'Edge is not configured.');\n const edgeClient = new EdgeHttpClient(edgeUrl);\n const edgeIdentity = createEdgeIdentity(client);\n edgeClient.setIdentity(edgeIdentity);\n const response = await edgeClient.uploadFunction({ spaceId, functionId }, { name, version, script: source });\n\n log('Uploaded', {\n functionId,\n source,\n name,\n identityKey: edgeIdentity.identityKey,\n response,\n });\n\n return response;\n};\n\nexport const incrementSemverPatch = (version: string): string => {\n const [major, minor, patch] = version.split('.');\n const patchNum = Number(patch);\n invariant(!Number.isNaN(patchNum), 'Unexpected function version format.');\n return [major, minor, String(patchNum + 1)].join('.');\n};\n\nexport const publicKeyToDid = (key: PublicKey): DID => {\n return `did:key:${key.toHex()}`;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAOA,kBAAmC;AACnC,yBAA+B;AAC/B,uBAA0B;AAE1B,iBAAoB;;AAYb,IAAMA,uBAAuB,OAAO,EACzCC,QACAC,MACAC,SACAC,QACAC,SACAC,WAAU,MACO;AACjB,QAAMC,UAAUN,OAAOO,OAAOC,OAAOC,SAASC,UAAUC,MAAMC;AAC9DC,kCAAUP,SAAS,2BAAA;;;;;;;;;AACnB,QAAMQ,aAAa,IAAIC,kCAAeT,OAAAA;AACtC,QAAMU,mBAAeC,gCAAmBjB,MAAAA;AACxCc,aAAWI,YAAYF,YAAAA;AACvB,QAAMG,WAAW,MAAML,WAAWM,eAAe;IAAEhB;IAASC;EAAW,GAAG;IAAEJ;IAAMC;IAASmB,QAAQlB;EAAO,CAAA;AAE1GmB,sBAAI,YAAY;IACdjB;IACAF;IACAF;IACAsB,aAAaP,aAAaO;IAC1BJ;EACF,GAAA;;;;;;AAEA,SAAOA;AACT;AAEO,IAAMK,uBAAuB,CAACtB,YAAAA;AACnC,QAAM,CAACuB,OAAOC,OAAOC,KAAAA,IAASzB,QAAQ0B,MAAM,GAAA;AAC5C,QAAMC,WAAWC,OAAOH,KAAAA;AACxBd,kCAAU,CAACiB,OAAOC,MAAMF,QAAAA,GAAW,uCAAA;;;;;;;;;AACnC,SAAO;IAACJ;IAAOC;IAAOM,OAAOH,WAAW,CAAA;IAAII,KAAK,GAAA;AACnD;AAEO,IAAMC,iBAAiB,CAACC,QAAAA;AAC7B,SAAO,WAAWA,IAAIC,MAAK,CAAA;AAC7B;",
|
|
6
|
+
"names": ["uploadWorkerFunction", "client", "name", "version", "source", "spaceId", "functionId", "edgeUrl", "config", "values", "runtime", "services", "edge", "url", "invariant", "edgeClient", "EdgeHttpClient", "edgeIdentity", "createEdgeIdentity", "setIdentity", "response", "uploadFunction", "script", "log", "identityKey", "incrementSemverPatch", "major", "minor", "patch", "split", "patchNum", "Number", "isNaN", "String", "join", "publicKeyToDid", "key", "toHex"]
|
|
7
|
+
}
|