@dxos/functions 0.7.5-main.9d2a38b → 0.7.5-main.b19bfc8

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.
Files changed (70) hide show
  1. package/dist/lib/browser/bundler/index.mjs +239 -0
  2. package/dist/lib/browser/bundler/index.mjs.map +7 -0
  3. package/dist/lib/browser/{chunk-IP657FIW.mjs → chunk-JNWHUD6Z.mjs} +2 -2
  4. package/dist/lib/browser/{chunk-PWSDZCXB.mjs → chunk-PI2DP37S.mjs} +11 -3
  5. package/dist/lib/browser/chunk-PI2DP37S.mjs.map +7 -0
  6. package/dist/lib/browser/{chunk-B3FGASHJ.mjs → chunk-YJEIETRB.mjs} +6 -3
  7. package/dist/lib/browser/{chunk-B3FGASHJ.mjs.map → chunk-YJEIETRB.mjs.map} +3 -3
  8. package/dist/lib/browser/edge/index.mjs +1 -1
  9. package/dist/lib/browser/index.mjs +24 -8
  10. package/dist/lib/browser/index.mjs.map +3 -3
  11. package/dist/lib/browser/meta.json +1 -1
  12. package/dist/lib/browser/testing/index.mjs +2 -2
  13. package/dist/lib/browser/types/index.mjs +1 -1
  14. package/dist/lib/node/bundler/index.cjs +261 -0
  15. package/dist/lib/node/bundler/index.cjs.map +7 -0
  16. package/dist/lib/node/{chunk-3HCN2EE6.cjs → chunk-2ASAZ4AS.cjs} +15 -15
  17. package/dist/lib/node/{chunk-ZDG466QT.cjs → chunk-MZMHE4DC.cjs} +9 -6
  18. package/dist/lib/node/{chunk-ZDG466QT.cjs.map → chunk-MZMHE4DC.cjs.map} +3 -3
  19. package/dist/lib/node/{chunk-2YCBLNMR.cjs → chunk-PGFJYL6Q.cjs} +13 -5
  20. package/dist/lib/node/chunk-PGFJYL6Q.cjs.map +7 -0
  21. package/dist/lib/node/edge/index.cjs +8 -8
  22. package/dist/lib/node/edge/index.cjs.map +1 -1
  23. package/dist/lib/node/index.cjs +44 -27
  24. package/dist/lib/node/index.cjs.map +3 -3
  25. package/dist/lib/node/meta.json +1 -1
  26. package/dist/lib/node/testing/index.cjs +7 -7
  27. package/dist/lib/node/types/index.cjs +10 -10
  28. package/dist/lib/node/types/index.cjs.map +1 -1
  29. package/dist/lib/node-esm/bundler/index.mjs +239 -0
  30. package/dist/lib/node-esm/bundler/index.mjs.map +7 -0
  31. package/dist/lib/node-esm/{chunk-WEI4UCRY.mjs → chunk-IOAKDIT3.mjs} +11 -3
  32. package/dist/lib/node-esm/chunk-IOAKDIT3.mjs.map +7 -0
  33. package/dist/lib/node-esm/{chunk-EK2U3CEM.mjs → chunk-LNBGGB6Z.mjs} +2 -2
  34. package/dist/lib/node-esm/{chunk-CN74WOTT.mjs → chunk-T2KBXTMR.mjs} +6 -3
  35. package/dist/lib/node-esm/{chunk-CN74WOTT.mjs.map → chunk-T2KBXTMR.mjs.map} +3 -3
  36. package/dist/lib/node-esm/edge/index.mjs +1 -1
  37. package/dist/lib/node-esm/index.mjs +24 -8
  38. package/dist/lib/node-esm/index.mjs.map +3 -3
  39. package/dist/lib/node-esm/meta.json +1 -1
  40. package/dist/lib/node-esm/testing/index.mjs +2 -2
  41. package/dist/lib/node-esm/types/index.mjs +1 -1
  42. package/dist/types/src/bundler/bundler.d.ts +51 -0
  43. package/dist/types/src/bundler/bundler.d.ts.map +1 -0
  44. package/dist/types/src/bundler/bundler.test.d.ts +2 -0
  45. package/dist/types/src/bundler/bundler.test.d.ts.map +1 -0
  46. package/dist/types/src/bundler/index.d.ts +2 -0
  47. package/dist/types/src/bundler/index.d.ts.map +1 -0
  48. package/dist/types/src/edge/functions.d.ts.map +1 -1
  49. package/dist/types/src/handler.d.ts +29 -4
  50. package/dist/types/src/handler.d.ts.map +1 -1
  51. package/dist/types/src/testing/types.d.ts +2 -2
  52. package/dist/types/src/types/schema.d.ts +20 -16
  53. package/dist/types/src/types/schema.d.ts.map +1 -1
  54. package/dist/types/src/types/types.d.ts +33 -9
  55. package/dist/types/src/types/types.d.ts.map +1 -1
  56. package/package.json +33 -19
  57. package/src/bundler/bundler.test.ts +59 -0
  58. package/src/bundler/bundler.ts +264 -0
  59. package/src/bundler/index.ts +5 -0
  60. package/src/edge/functions.ts +5 -1
  61. package/src/handler.ts +58 -9
  62. package/src/trigger/trigger-registry.test.ts +3 -1
  63. package/src/types/schema.ts +3 -0
  64. package/src/types/types.ts +10 -1
  65. package/dist/lib/browser/chunk-PWSDZCXB.mjs.map +0 -7
  66. package/dist/lib/node/chunk-2YCBLNMR.cjs.map +0 -7
  67. package/dist/lib/node-esm/chunk-WEI4UCRY.mjs.map +0 -7
  68. /package/dist/lib/browser/{chunk-IP657FIW.mjs.map → chunk-JNWHUD6Z.mjs.map} +0 -0
  69. /package/dist/lib/node/{chunk-3HCN2EE6.cjs.map → chunk-2ASAZ4AS.cjs.map} +0 -0
  70. /package/dist/lib/node-esm/{chunk-EK2U3CEM.mjs.map → chunk-LNBGGB6Z.mjs.map} +0 -0
@@ -1 +1 @@
1
- {"inputs":{"packages/core/functions/src/edge/functions.ts":{"bytes":13462,"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":4200,"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":15589,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/types/index.ts":{"bytes":580,"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"}],"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":10610,"imports":[{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/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/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-B3FGASHJ.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":5764},"packages/core/functions/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-B3FGASHJ.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-IP657FIW.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-PWSDZCXB.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-XRCXIG74.mjs","kind":"import-statement"},{"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","ScriptType","TriggerKind","TriggerRegistry","TriggerSchema","createSubscriptionTrigger","createTimerTrigger","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":1624}},"bytes":2785},"packages/core/functions/dist/lib/browser/chunk-B3FGASHJ.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":6942},"packages/core/functions/dist/lib/browser/chunk-B3FGASHJ.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":3267},"packages/core/functions/src/edge/index.ts":{"bytesInOutput":0}},"bytes":3585},"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-IP657FIW.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-PWSDZCXB.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-IP657FIW.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":26827},"packages/core/functions/dist/lib/browser/chunk-IP657FIW.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-PWSDZCXB.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-PWSDZCXB.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","ScriptType","TriggerKind","TriggerSchema"],"entryPoint":"packages/core/functions/src/types/index.ts","inputs":{},"bytes":481},"packages/core/functions/dist/lib/browser/chunk-PWSDZCXB.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":10099},"packages/core/functions/dist/lib/browser/chunk-PWSDZCXB.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}],"exports":["FUNCTION_TYPES","FunctionDef","FunctionManifestSchema","FunctionTrigger","FunctionTriggerSchema","FunctionType","ScriptType","TriggerKind","TriggerSchema"],"inputs":{"packages/core/functions/src/types/schema.ts":{"bytesInOutput":963},"packages/core/functions/src/types/index.ts":{"bytesInOutput":0},"packages/core/functions/src/types/types.ts":{"bytesInOutput":3409}},"bytes":4721},"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":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":4517,"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":16405,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/types/index.ts":{"bytes":580,"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"}],"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":13974,"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":7838},"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-JNWHUD6Z.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-PI2DP37S.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","ScriptType","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":3263},"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-JNWHUD6Z.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-PI2DP37S.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-JNWHUD6Z.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":26827},"packages/core/functions/dist/lib/browser/chunk-JNWHUD6Z.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-PI2DP37S.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-PI2DP37S.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","ScriptType","TriggerKind","TriggerSchema"],"entryPoint":"packages/core/functions/src/types/index.ts","inputs":{},"bytes":481},"packages/core/functions/dist/lib/browser/chunk-PI2DP37S.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":10753},"packages/core/functions/dist/lib/browser/chunk-PI2DP37S.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}],"exports":["FUNCTION_TYPES","FunctionDef","FunctionManifestSchema","FunctionTrigger","FunctionTriggerSchema","FunctionType","ScriptType","TriggerKind","TriggerSchema"],"inputs":{"packages/core/functions/src/types/schema.ts":{"bytesInOutput":1044},"packages/core/functions/src/types/index.ts":{"bytesInOutput":0},"packages/core/functions/src/types/types.ts":{"bytesInOutput":3607}},"bytes":5000},"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-IP657FIW.mjs";
5
+ } from "../chunk-JNWHUD6Z.mjs";
6
6
  import {
7
7
  FunctionDef,
8
8
  FunctionTrigger
9
- } from "../chunk-PWSDZCXB.mjs";
9
+ } from "../chunk-PI2DP37S.mjs";
10
10
  import {
11
11
  __require
12
12
  } from "../chunk-XRCXIG74.mjs";
@@ -9,7 +9,7 @@ import {
9
9
  ScriptType,
10
10
  TriggerKind,
11
11
  TriggerSchema
12
- } from "../chunk-PWSDZCXB.mjs";
12
+ } from "../chunk-PI2DP37S.mjs";
13
13
  import "../chunk-XRCXIG74.mjs";
14
14
  export {
15
15
  FUNCTION_TYPES,
@@ -0,0 +1,261 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var bundler_exports = {};
20
+ __export(bundler_exports, {
21
+ Bundler: () => Bundler,
22
+ initializeBundler: () => initializeBundler
23
+ });
24
+ module.exports = __toCommonJS(bundler_exports);
25
+ var import_chunk_JEQ2X3Z6 = require("../chunk-JEQ2X3Z6.cjs");
26
+ var import_esbuild_wasm = require("esbuild-wasm");
27
+ var import_crypto = require("@dxos/crypto");
28
+ var import_invariant = require("@dxos/invariant");
29
+ var import_log = require("@dxos/log");
30
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/functions/src/bundler/bundler.ts";
31
+ var initialized;
32
+ var initializeBundler = async (options) => {
33
+ await (initialized ??= (0, import_esbuild_wasm.initialize)({
34
+ wasmURL: options.wasmUrl
35
+ }));
36
+ };
37
+ var Bundler = class {
38
+ constructor(_options) {
39
+ this._options = _options;
40
+ }
41
+ async bundle({ path, source }) {
42
+ const { sandboxedModules: providedModules, ...options } = this._options;
43
+ const createResult = async (result) => {
44
+ return {
45
+ timestamp: Date.now(),
46
+ sourceHash: source ? Buffer.from(await import_crypto.subtleCrypto.digest("SHA-256", Buffer.from(source))) : void 0,
47
+ ...result
48
+ };
49
+ };
50
+ if (this._options.platform === "browser") {
51
+ (0, import_invariant.invariant)(initialized, "Compiler not initialized.", {
52
+ F: __dxlog_file,
53
+ L: 71,
54
+ S: this,
55
+ A: [
56
+ "initialized",
57
+ "'Compiler not initialized.'"
58
+ ]
59
+ });
60
+ await initialized;
61
+ }
62
+ const imports = source ? analyzeSourceFileImports(source) : [];
63
+ try {
64
+ const result = await (0, import_esbuild_wasm.build)({
65
+ platform: options.platform,
66
+ conditions: [
67
+ "workerd",
68
+ "browser"
69
+ ],
70
+ metafile: true,
71
+ write: false,
72
+ entryPoints: [
73
+ path ?? "memory:main.tsx"
74
+ ],
75
+ bundle: true,
76
+ format: "esm",
77
+ plugins: [
78
+ {
79
+ name: "memory",
80
+ setup: (build2) => {
81
+ build2.onResolve({
82
+ filter: /^\.\/runtime\.js$/
83
+ }, ({ path: path2 }) => {
84
+ return {
85
+ path: path2,
86
+ external: true
87
+ };
88
+ });
89
+ build2.onResolve({
90
+ filter: /^dxos:functions$/
91
+ }, ({ path: path2 }) => {
92
+ return {
93
+ path: "./runtime.js",
94
+ external: true
95
+ };
96
+ });
97
+ build2.onResolve({
98
+ filter: /^memory:/
99
+ }, ({ path: path2 }) => {
100
+ return {
101
+ path: path2.split(":")[1],
102
+ namespace: "memory"
103
+ };
104
+ });
105
+ build2.onLoad({
106
+ filter: /.*/,
107
+ namespace: "memory"
108
+ }, ({ path: path2 }) => {
109
+ if (path2 === "main.tsx") {
110
+ return {
111
+ contents: source,
112
+ loader: "tsx"
113
+ };
114
+ }
115
+ });
116
+ for (const module2 of providedModules) {
117
+ build2.onResolve({
118
+ filter: new RegExp(`^${module2}$`)
119
+ }, ({ path: path2 }) => {
120
+ return {
121
+ path: path2,
122
+ namespace: "injected-module"
123
+ };
124
+ });
125
+ }
126
+ build2.onLoad({
127
+ filter: /.*/,
128
+ namespace: "injected-module"
129
+ }, ({ path: path2 }) => {
130
+ const namedImports = imports.find((entry) => entry.moduleIdentifier === path2)?.namedImports ?? [];
131
+ return {
132
+ contents: `
133
+ const { ${namedImports.join(",")} } = window.__DXOS_SANDBOX_MODULES__[${JSON.stringify(path2)}];
134
+ export { ${namedImports.join(",")} };
135
+ export default window.__DXOS_SANDBOX_MODULES__[${JSON.stringify(path2)}].default;
136
+ `,
137
+ loader: "tsx"
138
+ };
139
+ });
140
+ }
141
+ },
142
+ httpPlugin
143
+ ]
144
+ });
145
+ (0, import_log.log)("compile complete", result.metafile, {
146
+ F: __dxlog_file,
147
+ L: 135,
148
+ S: this,
149
+ C: (f, a) => f(...a)
150
+ });
151
+ return await createResult({
152
+ imports: this.analyzeImports(result),
153
+ bundle: result.outputFiles[0].text
154
+ });
155
+ } catch (err) {
156
+ return await createResult({
157
+ error: err
158
+ });
159
+ }
160
+ }
161
+ // TODO(dmaretskyi): In the future we can replace the compiler with SWC with plugins running in WASM.
162
+ analyzeImports(result) {
163
+ (0, import_invariant.invariant)(result.outputFiles, void 0, {
164
+ F: __dxlog_file,
165
+ L: 148,
166
+ S: this,
167
+ A: [
168
+ "result.outputFiles",
169
+ ""
170
+ ]
171
+ });
172
+ const parsedImports = allMatches(IMPORT_REGEX, result.outputFiles[0].text);
173
+ return Object.values(result.metafile.outputs)[0].imports.map((entry) => {
174
+ const namedImports = [];
175
+ const parsedImport = parsedImports.find((capture) => capture?.[4] === entry.path);
176
+ if (parsedImport?.[2]) {
177
+ NAMED_IMPORTS_REGEX.lastIndex = 0;
178
+ const namedImportsMatch = NAMED_IMPORTS_REGEX.exec(parsedImport[2]);
179
+ if (namedImportsMatch) {
180
+ namedImportsMatch[1].split(",").forEach((importName) => {
181
+ namedImports.push(importName.trim());
182
+ });
183
+ }
184
+ }
185
+ return {
186
+ moduleUrl: entry.path,
187
+ defaultImport: !!parsedImport?.[1],
188
+ namedImports
189
+ };
190
+ });
191
+ }
192
+ analyzeSourceFileImports(code) {
193
+ const parsedImports = allMatches(IMPORT_REGEX, code);
194
+ return parsedImports.map((capture) => {
195
+ return {
196
+ defaultImportName: capture[1],
197
+ namedImports: capture[2]?.split(",").map((importName) => importName.trim()),
198
+ wildcardImportName: capture[3],
199
+ moduleIdentifier: capture[4],
200
+ quotes: capture[5]
201
+ };
202
+ });
203
+ }
204
+ };
205
+ var IMPORT_REGEX = /import(?:(?:(?:[ \n\t]+([^ *\n\t{},]+)[ \n\t]*(?:,|[ \n\t]+))?([ \n\t]*{(?:[ \n\t]*[^ \n\t"'{}]+[ \n\t]*,?)+})?[ \n\t]*)|[ \n\t]*\*[ \n\t]*as[ \n\t]+([^ \n\t{}]+)[ \n\t]+)from[ \n\t]*(?:['"])([^'"\n]+)(['"])/gm;
206
+ var NAMED_IMPORTS_REGEX = /[ \n\t]*{((?:[ \n\t]*[^ \n\t"'{}]+[ \n\t]*,?)+)}[ \n\t]*/gm;
207
+ var allMatches = (regex, str) => {
208
+ regex.lastIndex = 0;
209
+ let match;
210
+ const matches = [];
211
+ while (match = regex.exec(str)) {
212
+ matches.push(match);
213
+ }
214
+ return matches;
215
+ };
216
+ var analyzeSourceFileImports = (code) => {
217
+ const parsedImports = allMatches(IMPORT_REGEX, code);
218
+ return parsedImports.map((capture) => {
219
+ return {
220
+ defaultImportName: capture[1],
221
+ namedImports: capture[2]?.trim().slice(1, -1).split(",").map((importName) => importName.trim()),
222
+ wildcardImportName: capture[3],
223
+ moduleIdentifier: capture[4],
224
+ quotes: capture[5]
225
+ };
226
+ });
227
+ };
228
+ var httpPlugin = {
229
+ name: "http",
230
+ setup: (build2) => {
231
+ build2.onResolve({
232
+ filter: /^https?:\/\//
233
+ }, (args) => ({
234
+ path: args.path,
235
+ namespace: "http-url"
236
+ }));
237
+ build2.onResolve({
238
+ filter: /.*/,
239
+ namespace: "http-url"
240
+ }, (args) => ({
241
+ path: new URL(args.path, args.importer).toString(),
242
+ namespace: "http-url"
243
+ }));
244
+ build2.onLoad({
245
+ filter: /.*/,
246
+ namespace: "http-url"
247
+ }, async (args) => {
248
+ const response = await fetch(args.path);
249
+ return {
250
+ contents: await response.text(),
251
+ loader: "jsx"
252
+ };
253
+ });
254
+ }
255
+ };
256
+ // Annotate the CommonJS export names for ESM import in node:
257
+ 0 && (module.exports = {
258
+ Bundler,
259
+ initializeBundler
260
+ });
261
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/bundler/bundler.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type BuildOptions } from 'esbuild';\nimport { build, initialize, type BuildResult, type Plugin } from 'esbuild-wasm';\n\nimport { subtleCrypto } from '@dxos/crypto';\nimport { invariant } from '@dxos/invariant';\nimport { log } from '@dxos/log';\n\nexport type Import = {\n moduleUrl: string;\n defaultImport: boolean;\n namedImports: string[];\n};\n\nexport type BundleOptions = {\n /**\n * Path to the source file on the local file system.\n * If provided, the path will be used instead of the `source` code.\n */\n path?: string;\n\n /**\n * Source code to bundle.\n * Required if `path` is not provided.\n */\n source?: string;\n};\n\nexport type BundleResult = {\n timestamp: number;\n sourceHash?: Buffer;\n imports?: Import[];\n bundle?: string;\n error?: any;\n};\n\nexport type BundlerOptions = {\n platform: BuildOptions['platform'];\n sandboxedModules: string[];\n remoteModules: Record<string, string>;\n};\n\nlet initialized: Promise<void>;\nexport const initializeBundler = async (options: { wasmUrl: string }) => {\n await (initialized ??= initialize({\n wasmURL: options.wasmUrl,\n }));\n};\n\n/**\n * ESBuild bundler.\n */\nexport class Bundler {\n constructor(private readonly _options: BundlerOptions) {}\n\n async bundle({ path, source }: BundleOptions): Promise<BundleResult> {\n const { sandboxedModules: providedModules, ...options } = this._options;\n\n const createResult = async (result?: Partial<BundleResult>) => {\n return {\n timestamp: Date.now(),\n sourceHash: source ? Buffer.from(await subtleCrypto.digest('SHA-256', Buffer.from(source))) : undefined,\n ...result,\n };\n };\n\n if (this._options.platform === 'browser') {\n invariant(initialized, 'Compiler not initialized.');\n await initialized;\n }\n\n const imports = source ? analyzeSourceFileImports(source) : [];\n\n // https://esbuild.github.io/api/#build\n try {\n const result = await build({\n platform: options.platform,\n conditions: ['workerd', 'browser'],\n metafile: true,\n write: false,\n entryPoints: [path ?? 'memory:main.tsx'],\n bundle: true,\n format: 'esm',\n plugins: [\n {\n name: 'memory',\n setup: (build) => {\n build.onResolve({ filter: /^\\.\\/runtime\\.js$/ }, ({ path }) => {\n return { path, external: true };\n });\n\n build.onResolve({ filter: /^dxos:functions$/ }, ({ path }) => {\n return { path: './runtime.js', external: true };\n });\n\n build.onResolve({ filter: /^memory:/ }, ({ path }) => {\n return { path: path.split(':')[1], namespace: 'memory' };\n });\n\n build.onLoad({ filter: /.*/, namespace: 'memory' }, ({ path }) => {\n if (path === 'main.tsx') {\n return {\n contents: source,\n loader: 'tsx',\n };\n }\n });\n\n for (const module of providedModules) {\n build.onResolve({ filter: new RegExp(`^${module}$`) }, ({ path }) => {\n return { path, namespace: 'injected-module' };\n });\n }\n\n build.onLoad({ filter: /.*/, namespace: 'injected-module' }, ({ path }) => {\n const namedImports = imports.find((entry) => entry.moduleIdentifier === path)?.namedImports ?? [];\n return {\n contents: `\n const { ${namedImports.join(',')} } = window.__DXOS_SANDBOX_MODULES__[${JSON.stringify(path)}];\n export { ${namedImports.join(',')} };\n export default window.__DXOS_SANDBOX_MODULES__[${JSON.stringify(path)}].default;\n `,\n loader: 'tsx',\n };\n });\n },\n },\n httpPlugin,\n ],\n });\n\n log('compile complete', result.metafile);\n\n return await createResult({\n imports: this.analyzeImports(result),\n bundle: result.outputFiles![0].text,\n });\n } catch (err) {\n return await createResult({ error: err });\n }\n }\n\n // TODO(dmaretskyi): In the future we can replace the compiler with SWC with plugins running in WASM.\n analyzeImports(result: BuildResult): Import[] {\n invariant(result.outputFiles);\n\n // TODO(dmaretskyi): Support import aliases and wildcard imports.\n const parsedImports = allMatches(IMPORT_REGEX, result.outputFiles[0].text);\n return Object.values(result.metafile!.outputs)[0].imports.map((entry): Import => {\n const namedImports: string[] = [];\n\n const parsedImport = parsedImports.find((capture) => capture?.[4] === entry.path);\n if (parsedImport?.[2]) {\n NAMED_IMPORTS_REGEX.lastIndex = 0;\n const namedImportsMatch = NAMED_IMPORTS_REGEX.exec(parsedImport[2]);\n if (namedImportsMatch) {\n namedImportsMatch[1].split(',').forEach((importName) => {\n namedImports.push(importName.trim());\n });\n }\n }\n\n return {\n moduleUrl: entry.path,\n defaultImport: !!parsedImport?.[1],\n namedImports,\n };\n });\n }\n\n analyzeSourceFileImports(code: string) {\n // TODO(dmaretskyi): Support import aliases and wildcard imports.\n const parsedImports = allMatches(IMPORT_REGEX, code);\n return parsedImports.map((capture) => {\n return {\n defaultImportName: capture[1],\n namedImports: capture[2]?.split(',').map((importName) => importName.trim()),\n wildcardImportName: capture[3],\n moduleIdentifier: capture[4],\n quotes: capture[5],\n };\n });\n }\n}\n\n// https://regex101.com/r/FEN5ks/1\n// https://stackoverflow.com/a/73265022\n// $1 = default import name (can be non-existent)\n// $2 = destructured exports (can be non-existent)\n// $3 = wildcard import name (can be non-existent)\n// $4 = module identifier\n// $5 = quotes used (either ' or \")\nconst IMPORT_REGEX =\n /import(?:(?:(?:[ \\n\\t]+([^ *\\n\\t{},]+)[ \\n\\t]*(?:,|[ \\n\\t]+))?([ \\n\\t]*{(?:[ \\n\\t]*[^ \\n\\t\"'{}]+[ \\n\\t]*,?)+})?[ \\n\\t]*)|[ \\n\\t]*\\*[ \\n\\t]*as[ \\n\\t]+([^ \\n\\t{}]+)[ \\n\\t]+)from[ \\n\\t]*(?:['\"])([^'\"\\n]+)(['\"])/gm;\n\nconst NAMED_IMPORTS_REGEX = /[ \\n\\t]*{((?:[ \\n\\t]*[^ \\n\\t\"'{}]+[ \\n\\t]*,?)+)}[ \\n\\t]*/gm;\n\nconst allMatches = (regex: RegExp, str: string) => {\n regex.lastIndex = 0;\n\n let match;\n const matches = [];\n while ((match = regex.exec(str))) {\n matches.push(match);\n }\n\n return matches;\n};\n\ntype ParsedImport = {\n defaultImportName?: string;\n namedImports: string[];\n wildcardImportName?: string;\n moduleIdentifier: string;\n quotes: string;\n};\n\nconst analyzeSourceFileImports = (code: string): ParsedImport[] => {\n // TODO(dmaretskyi): Support import aliases and wildcard imports.\n const parsedImports = allMatches(IMPORT_REGEX, code);\n return parsedImports.map((capture) => {\n return {\n defaultImportName: capture[1],\n namedImports: capture[2]\n ?.trim()\n .slice(1, -1)\n .split(',')\n .map((importName) => importName.trim()),\n wildcardImportName: capture[3],\n moduleIdentifier: capture[4],\n quotes: capture[5],\n };\n });\n};\n\nconst httpPlugin: Plugin = {\n name: 'http',\n setup: (build) => {\n // Intercept import paths starting with \"http:\" and \"https:\" so esbuild doesn't attempt to map them to a file system location.\n // Tag them with the \"http-url\" namespace to associate them with this plugin.\n build.onResolve({ filter: /^https?:\\/\\// }, (args) => ({\n path: args.path,\n namespace: 'http-url',\n }));\n\n // We also want to intercept all import paths inside downloaded files and resolve them against the original URL.\n // All of these files will be in the \"http-url\" namespace.\n // Make sure to keep the newly resolved URL in the \"http-url\" namespace so imports inside it will also be resolved as URLs recursively.\n build.onResolve({ filter: /.*/, namespace: 'http-url' }, (args) => ({\n path: new URL(args.path, args.importer).toString(),\n namespace: 'http-url',\n }));\n\n // When a URL is loaded, we want to actually download the content from the internet.\n // This has just enough logic to be able to handle the example import from unpkg.com but in reality this would probably need to be more complex.\n build.onLoad({ filter: /.*/, namespace: 'http-url' }, async (args) => {\n const response = await fetch(args.path);\n return { contents: await response.text(), loader: 'jsx' };\n });\n },\n};\n"],
5
+ "mappings": "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",
6
+ "names": ["initialized", "initializeBundler", "options", "initialize", "wasmURL", "wasmUrl", "Bundler", "constructor", "_options", "bundle", "path", "source", "sandboxedModules", "providedModules", "createResult", "result", "timestamp", "Date", "now", "sourceHash", "Buffer", "from", "subtleCrypto", "digest", "undefined", "platform", "invariant", "imports", "analyzeSourceFileImports", "build", "conditions", "metafile", "write", "entryPoints", "format", "plugins", "name", "setup", "onResolve", "filter", "external", "split", "namespace", "onLoad", "contents", "loader", "module", "RegExp", "namedImports", "find", "entry", "moduleIdentifier", "join", "JSON", "stringify", "httpPlugin", "log", "analyzeImports", "outputFiles", "text", "err", "error", "parsedImports", "allMatches", "IMPORT_REGEX", "Object", "values", "outputs", "map", "parsedImport", "capture", "NAMED_IMPORTS_REGEX", "lastIndex", "namedImportsMatch", "exec", "forEach", "importName", "push", "trim", "moduleUrl", "defaultImport", "code", "defaultImportName", "wildcardImportName", "quotes", "regex", "str", "match", "matches", "slice", "args", "URL", "importer", "toString", "response", "fetch"]
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 chunk_3HCN2EE6_exports = {};
20
- __export(chunk_3HCN2EE6_exports, {
19
+ var chunk_2ASAZ4AS_exports = {};
20
+ __export(chunk_2ASAZ4AS_exports, {
21
21
  FunctionRegistry: () => FunctionRegistry,
22
22
  TriggerRegistry: () => TriggerRegistry,
23
23
  createSubscriptionTrigger: () => createSubscriptionTrigger,
24
24
  createTimerTrigger: () => createTimerTrigger
25
25
  });
26
- module.exports = __toCommonJS(chunk_3HCN2EE6_exports);
27
- var import_chunk_2YCBLNMR = require("./chunk-2YCBLNMR.cjs");
26
+ module.exports = __toCommonJS(chunk_2ASAZ4AS_exports);
27
+ var import_chunk_PGFJYL6Q = require("./chunk-PGFJYL6Q.cjs");
28
28
  var import_async = require("@dxos/async");
29
29
  var import_echo = require("@dxos/client/echo");
30
30
  var import_context = require("@dxos/context");
@@ -85,14 +85,14 @@ var FunctionRegistry = class extends import_context.Resource {
85
85
  if (!functions?.length) {
86
86
  return;
87
87
  }
88
- if (!space.db.graph.schemaRegistry.hasSchema(import_chunk_2YCBLNMR.FunctionDef)) {
88
+ if (!space.db.graph.schemaRegistry.hasSchema(import_chunk_PGFJYL6Q.FunctionDef)) {
89
89
  space.db.graph.schemaRegistry.addSchema([
90
- import_chunk_2YCBLNMR.FunctionDef
90
+ import_chunk_PGFJYL6Q.FunctionDef
91
91
  ]);
92
92
  }
93
- const { objects: existing } = await space.db.query(import_echo.Filter.schema(import_chunk_2YCBLNMR.FunctionDef)).run();
93
+ const { objects: existing } = await space.db.query(import_echo.Filter.schema(import_chunk_PGFJYL6Q.FunctionDef)).run();
94
94
  const { added } = (0, import_util.diff)(existing, functions, (a, b) => a.uri === b.uri);
95
- added.forEach((def) => space.db.add((0, import_echo.create)(import_chunk_2YCBLNMR.FunctionDef, def)));
95
+ added.forEach((def) => space.db.add((0, import_echo.create)(import_chunk_PGFJYL6Q.FunctionDef, def)));
96
96
  if (added.length > 0) {
97
97
  await space.db.flush({
98
98
  indexes: true,
@@ -118,7 +118,7 @@ var FunctionRegistry = class extends import_context.Resource {
118
118
  if (this._ctx.disposed) {
119
119
  break;
120
120
  }
121
- this._ctx.onDispose(space.db.query(import_echo.Filter.schema(import_chunk_2YCBLNMR.FunctionDef)).subscribe(({ objects }) => {
121
+ this._ctx.onDispose(space.db.query(import_echo.Filter.schema(import_chunk_PGFJYL6Q.FunctionDef)).subscribe(({ objects }) => {
122
122
  const { added } = (0, import_util.diff)(registered, objects, (a, b) => a.uri === b.uri);
123
123
  if (added.length > 0) {
124
124
  registered.push(...added);
@@ -335,9 +335,9 @@ var TriggerRegistry = class extends import_context2.Resource {
335
335
  if (!manifest.triggers?.length) {
336
336
  return;
337
337
  }
338
- if (!space.db.graph.schemaRegistry.hasSchema(import_chunk_2YCBLNMR.FunctionTrigger)) {
338
+ if (!space.db.graph.schemaRegistry.hasSchema(import_chunk_PGFJYL6Q.FunctionTrigger)) {
339
339
  space.db.graph.schemaRegistry.addSchema([
340
- import_chunk_2YCBLNMR.FunctionTrigger
340
+ import_chunk_PGFJYL6Q.FunctionTrigger
341
341
  ]);
342
342
  }
343
343
  const manifestTriggers = manifest.triggers.map((trigger) => {
@@ -351,11 +351,11 @@ var TriggerRegistry = class extends import_context2.Resource {
351
351
  ].join(":"))
352
352
  ];
353
353
  }
354
- return (0, import_echo3.create)(import_chunk_2YCBLNMR.FunctionTrigger, trigger, {
354
+ return (0, import_echo3.create)(import_chunk_PGFJYL6Q.FunctionTrigger, trigger, {
355
355
  keys
356
356
  });
357
357
  });
358
- const { objects: existing } = await space.db.query(import_echo3.Filter.schema(import_chunk_2YCBLNMR.FunctionTrigger)).run();
358
+ const { objects: existing } = await space.db.query(import_echo3.Filter.schema(import_chunk_PGFJYL6Q.FunctionTrigger)).run();
359
359
  const { added } = (0, import_util2.diff)(existing, manifestTriggers, import_echo3.compareForeignKeys);
360
360
  added.forEach((trigger) => {
361
361
  space.db.add(trigger);
@@ -390,7 +390,7 @@ var TriggerRegistry = class extends import_context2.Resource {
390
390
  if (this._ctx.disposed) {
391
391
  break;
392
392
  }
393
- this._ctx.onDispose(space.db.query(import_echo3.Filter.schema(import_chunk_2YCBLNMR.FunctionTrigger)).subscribe(async ({ objects: current }) => {
393
+ this._ctx.onDispose(space.db.query(import_echo3.Filter.schema(import_chunk_PGFJYL6Q.FunctionTrigger)).subscribe(async ({ objects: current }) => {
394
394
  import_log4.log.info("update", {
395
395
  space: space.key,
396
396
  registered: registered.length,
@@ -491,4 +491,4 @@ var TriggerRegistry = class extends import_context2.Resource {
491
491
  createSubscriptionTrigger,
492
492
  createTimerTrigger
493
493
  });
494
- //# sourceMappingURL=chunk-3HCN2EE6.cjs.map
494
+ //# sourceMappingURL=chunk-2ASAZ4AS.cjs.map
@@ -16,8 +16,8 @@ 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 chunk_ZDG466QT_exports = {};
20
- __export(chunk_ZDG466QT_exports, {
19
+ var chunk_MZMHE4DC_exports = {};
20
+ __export(chunk_MZMHE4DC_exports, {
21
21
  FUNCTIONS_PRESET_META_KEY: () => FUNCTIONS_PRESET_META_KEY,
22
22
  getInvocationUrl: () => getInvocationUrl,
23
23
  getUserFunctionUrlInMetadata: () => getUserFunctionUrlInMetadata,
@@ -26,7 +26,7 @@ __export(chunk_ZDG466QT_exports, {
26
26
  setUserFunctionUrlInMetadata: () => setUserFunctionUrlInMetadata,
27
27
  uploadWorkerFunction: () => uploadWorkerFunction
28
28
  });
29
- module.exports = __toCommonJS(chunk_ZDG466QT_exports);
29
+ module.exports = __toCommonJS(chunk_MZMHE4DC_exports);
30
30
  var import_edge_client = require("@dxos/edge-client");
31
31
  var import_invariant = require("@dxos/invariant");
32
32
  var import_log = require("@dxos/log");
@@ -91,9 +91,12 @@ var getInvocationUrl = (functionUrl, edgeUrl, options = {}) => {
91
91
  const url = new URL(`./${relativeUrl}`, baseUrl.toString());
92
92
  options.spaceId && url.searchParams.set("spaceId", options.spaceId);
93
93
  options.subjectId && url.searchParams.set("subjectId", options.subjectId);
94
- url.protocol = "https";
94
+ url.protocol = isSecure(url.protocol) ? "https" : "http";
95
95
  return url.toString();
96
96
  };
97
+ var isSecure = (protocol) => {
98
+ return protocol === "https:" || protocol === "wss:";
99
+ };
97
100
  var createEdgeIdentity = (client) => {
98
101
  const identity = client.halo.identity.get();
99
102
  const device = client.halo.device;
@@ -122,7 +125,7 @@ var incrementSemverPatch = (version) => {
122
125
  const patchNum = Number(patch);
123
126
  (0, import_invariant.invariant)(!Number.isNaN(patchNum), "Unexpected function version format.", {
124
127
  F: __dxlog_file,
125
- L: 105,
128
+ L: 109,
126
129
  S: void 0,
127
130
  A: [
128
131
  "!Number.isNaN(patchNum)",
@@ -148,4 +151,4 @@ var publicKeyToDid = (key) => {
148
151
  setUserFunctionUrlInMetadata,
149
152
  uploadWorkerFunction
150
153
  });
151
- //# sourceMappingURL=chunk-ZDG466QT.cjs.map
154
+ //# sourceMappingURL=chunk-MZMHE4DC.cjs.map