@dxos/functions 0.8.1 → 0.8.2-main.2f9c567

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 (168) hide show
  1. package/dist/lib/browser/bundler/index.mjs +0 -3
  2. package/dist/lib/browser/bundler/index.mjs.map +1 -1
  3. package/dist/lib/browser/edge/index.mjs +63 -7
  4. package/dist/lib/browser/edge/index.mjs.map +4 -4
  5. package/dist/lib/browser/index.mjs +368 -98
  6. package/dist/lib/browser/index.mjs.map +4 -4
  7. package/dist/lib/browser/meta.json +1 -1
  8. package/dist/lib/node/bundler/index.cjs +0 -1
  9. package/dist/lib/node/bundler/index.cjs.map +1 -1
  10. package/dist/lib/node/edge/index.cjs +65 -5
  11. package/dist/lib/node/edge/index.cjs.map +4 -4
  12. package/dist/lib/node/index.cjs +383 -93
  13. package/dist/lib/node/index.cjs.map +4 -4
  14. package/dist/lib/node/meta.json +1 -1
  15. package/dist/lib/node-esm/bundler/index.mjs +0 -1
  16. package/dist/lib/node-esm/bundler/index.mjs.map +1 -1
  17. package/dist/lib/node-esm/edge/index.mjs +64 -6
  18. package/dist/lib/node-esm/edge/index.mjs.map +4 -4
  19. package/dist/lib/node-esm/index.mjs +368 -96
  20. package/dist/lib/node-esm/index.mjs.map +4 -4
  21. package/dist/lib/node-esm/meta.json +1 -1
  22. package/dist/types/src/edge/index.d.ts.map +1 -1
  23. package/dist/types/src/handler.d.ts +15 -63
  24. package/dist/types/src/handler.d.ts.map +1 -1
  25. package/dist/types/src/index.d.ts +3 -3
  26. package/dist/types/src/index.d.ts.map +1 -1
  27. package/dist/types/src/schema.d.ts +57 -0
  28. package/dist/types/src/schema.d.ts.map +1 -0
  29. package/dist/types/src/trace.d.ts +148 -0
  30. package/dist/types/src/trace.d.ts.map +1 -0
  31. package/dist/types/src/{types/types.d.ts → types.d.ts} +191 -49
  32. package/dist/types/src/types.d.ts.map +1 -0
  33. package/dist/types/src/{types/url.d.ts → url.d.ts} +6 -0
  34. package/dist/types/src/url.d.ts.map +1 -0
  35. package/package.json +20 -35
  36. package/src/edge/index.ts +4 -0
  37. package/src/handler.ts +17 -120
  38. package/src/index.ts +4 -5
  39. package/src/schema.ts +53 -0
  40. package/src/{types/trace.ts → trace.ts} +33 -31
  41. package/src/translations.ts +1 -1
  42. package/src/types.ts +214 -0
  43. package/src/{types/url.ts → url.ts} +5 -0
  44. package/dist/lib/browser/chunk-HI7YZO2K.mjs +0 -482
  45. package/dist/lib/browser/chunk-HI7YZO2K.mjs.map +0 -7
  46. package/dist/lib/browser/chunk-LT4LR4VU.mjs +0 -72
  47. package/dist/lib/browser/chunk-LT4LR4VU.mjs.map +0 -7
  48. package/dist/lib/browser/chunk-RVSG6WTL.mjs +0 -358
  49. package/dist/lib/browser/chunk-RVSG6WTL.mjs.map +0 -7
  50. package/dist/lib/browser/chunk-XRCXIG74.mjs +0 -12
  51. package/dist/lib/browser/chunk-XRCXIG74.mjs.map +0 -7
  52. package/dist/lib/browser/testing/index.mjs +0 -670
  53. package/dist/lib/browser/testing/index.mjs.map +0 -7
  54. package/dist/lib/browser/types/index.mjs +0 -49
  55. package/dist/lib/browser/types/index.mjs.map +0 -7
  56. package/dist/lib/node/chunk-DSUGRAAL.cjs +0 -392
  57. package/dist/lib/node/chunk-DSUGRAAL.cjs.map +0 -7
  58. package/dist/lib/node/chunk-JEQ2X3Z6.cjs +0 -34
  59. package/dist/lib/node/chunk-JEQ2X3Z6.cjs.map +0 -7
  60. package/dist/lib/node/chunk-NXZNXVT3.cjs +0 -94
  61. package/dist/lib/node/chunk-NXZNXVT3.cjs.map +0 -7
  62. package/dist/lib/node/chunk-RXMCVAMJ.cjs +0 -496
  63. package/dist/lib/node/chunk-RXMCVAMJ.cjs.map +0 -7
  64. package/dist/lib/node/testing/index.cjs +0 -687
  65. package/dist/lib/node/testing/index.cjs.map +0 -7
  66. package/dist/lib/node/types/index.cjs +0 -70
  67. package/dist/lib/node/types/index.cjs.map +0 -7
  68. package/dist/lib/node-esm/chunk-DHGBFXSZ.mjs +0 -12
  69. package/dist/lib/node-esm/chunk-DHGBFXSZ.mjs.map +0 -7
  70. package/dist/lib/node-esm/chunk-HBD2FZXO.mjs +0 -358
  71. package/dist/lib/node-esm/chunk-HBD2FZXO.mjs.map +0 -7
  72. package/dist/lib/node-esm/chunk-O2SXVYU5.mjs +0 -72
  73. package/dist/lib/node-esm/chunk-O2SXVYU5.mjs.map +0 -7
  74. package/dist/lib/node-esm/chunk-SQSJO5HI.mjs +0 -482
  75. package/dist/lib/node-esm/chunk-SQSJO5HI.mjs.map +0 -7
  76. package/dist/lib/node-esm/testing/index.mjs +0 -670
  77. package/dist/lib/node-esm/testing/index.mjs.map +0 -7
  78. package/dist/lib/node-esm/types/index.mjs +0 -49
  79. package/dist/lib/node-esm/types/index.mjs.map +0 -7
  80. package/dist/types/src/browser/index.d.ts +0 -2
  81. package/dist/types/src/browser/index.d.ts.map +0 -1
  82. package/dist/types/src/function/function-registry.d.ts +0 -25
  83. package/dist/types/src/function/function-registry.d.ts.map +0 -1
  84. package/dist/types/src/function/function-registry.test.d.ts +0 -2
  85. package/dist/types/src/function/function-registry.test.d.ts.map +0 -1
  86. package/dist/types/src/function/index.d.ts +0 -2
  87. package/dist/types/src/function/index.d.ts.map +0 -1
  88. package/dist/types/src/runtime/dev-server.d.ts +0 -52
  89. package/dist/types/src/runtime/dev-server.d.ts.map +0 -1
  90. package/dist/types/src/runtime/dev-server.test.d.ts +0 -2
  91. package/dist/types/src/runtime/dev-server.test.d.ts.map +0 -1
  92. package/dist/types/src/runtime/index.d.ts +0 -3
  93. package/dist/types/src/runtime/index.d.ts.map +0 -1
  94. package/dist/types/src/runtime/scheduler.d.ts +0 -34
  95. package/dist/types/src/runtime/scheduler.d.ts.map +0 -1
  96. package/dist/types/src/runtime/scheduler.test.d.ts +0 -2
  97. package/dist/types/src/runtime/scheduler.test.d.ts.map +0 -1
  98. package/dist/types/src/testing/functions-integration.test.d.ts +0 -2
  99. package/dist/types/src/testing/functions-integration.test.d.ts.map +0 -1
  100. package/dist/types/src/testing/index.d.ts +0 -5
  101. package/dist/types/src/testing/index.d.ts.map +0 -1
  102. package/dist/types/src/testing/manifest.d.ts +0 -3
  103. package/dist/types/src/testing/manifest.d.ts.map +0 -1
  104. package/dist/types/src/testing/plugin-init.d.ts +0 -6
  105. package/dist/types/src/testing/plugin-init.d.ts.map +0 -1
  106. package/dist/types/src/testing/setup.d.ts +0 -15
  107. package/dist/types/src/testing/setup.d.ts.map +0 -1
  108. package/dist/types/src/testing/test/handler.d.ts +0 -4
  109. package/dist/types/src/testing/test/handler.d.ts.map +0 -1
  110. package/dist/types/src/testing/test/index.d.ts +0 -3
  111. package/dist/types/src/testing/test/index.d.ts.map +0 -1
  112. package/dist/types/src/testing/types.d.ts +0 -10
  113. package/dist/types/src/testing/types.d.ts.map +0 -1
  114. package/dist/types/src/testing/util.d.ts +0 -5
  115. package/dist/types/src/testing/util.d.ts.map +0 -1
  116. package/dist/types/src/trigger/index.d.ts +0 -3
  117. package/dist/types/src/trigger/index.d.ts.map +0 -1
  118. package/dist/types/src/trigger/trigger-registry.d.ts +0 -38
  119. package/dist/types/src/trigger/trigger-registry.d.ts.map +0 -1
  120. package/dist/types/src/trigger/trigger-registry.test.d.ts +0 -2
  121. package/dist/types/src/trigger/trigger-registry.test.d.ts.map +0 -1
  122. package/dist/types/src/trigger/type/index.d.ts +0 -3
  123. package/dist/types/src/trigger/type/index.d.ts.map +0 -1
  124. package/dist/types/src/trigger/type/subscription-trigger.d.ts +0 -4
  125. package/dist/types/src/trigger/type/subscription-trigger.d.ts.map +0 -1
  126. package/dist/types/src/trigger/type/timer-trigger.d.ts +0 -4
  127. package/dist/types/src/trigger/type/timer-trigger.d.ts.map +0 -1
  128. package/dist/types/src/trigger/type/webhook-trigger.d.ts +0 -4
  129. package/dist/types/src/trigger/type/webhook-trigger.d.ts.map +0 -1
  130. package/dist/types/src/types/index.d.ts +0 -5
  131. package/dist/types/src/types/index.d.ts.map +0 -1
  132. package/dist/types/src/types/schema.d.ts +0 -53
  133. package/dist/types/src/types/schema.d.ts.map +0 -1
  134. package/dist/types/src/types/trace.d.ts +0 -146
  135. package/dist/types/src/types/trace.d.ts.map +0 -1
  136. package/dist/types/src/types/types.d.ts.map +0 -1
  137. package/dist/types/src/types/url.d.ts.map +0 -1
  138. package/dist/types/tools/schema.d.ts +0 -2
  139. package/dist/types/tools/schema.d.ts.map +0 -1
  140. package/schema/functions.json +0 -211
  141. package/src/browser/index.ts +0 -5
  142. package/src/function/function-registry.test.ts +0 -118
  143. package/src/function/function-registry.ts +0 -104
  144. package/src/function/index.ts +0 -5
  145. package/src/runtime/dev-server.test.ts +0 -79
  146. package/src/runtime/dev-server.ts +0 -240
  147. package/src/runtime/index.ts +0 -6
  148. package/src/runtime/scheduler.test.ts +0 -152
  149. package/src/runtime/scheduler.ts +0 -170
  150. package/src/testing/functions-integration.test.ts +0 -65
  151. package/src/testing/index.ts +0 -8
  152. package/src/testing/manifest.ts +0 -15
  153. package/src/testing/plugin-init.ts +0 -20
  154. package/src/testing/setup.ts +0 -109
  155. package/src/testing/test/handler.ts +0 -15
  156. package/src/testing/test/index.ts +0 -7
  157. package/src/testing/types.ts +0 -9
  158. package/src/testing/util.ts +0 -26
  159. package/src/trigger/index.ts +0 -6
  160. package/src/trigger/trigger-registry.test.ts +0 -278
  161. package/src/trigger/trigger-registry.ts +0 -218
  162. package/src/trigger/type/index.ts +0 -7
  163. package/src/trigger/type/subscription-trigger.ts +0 -84
  164. package/src/trigger/type/timer-trigger.ts +0 -48
  165. package/src/trigger/type/webhook-trigger.ts +0 -48
  166. package/src/types/index.ts +0 -8
  167. package/src/types/schema.ts +0 -46
  168. package/src/types/types.ts +0 -163
@@ -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":6587,"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":4797,"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":16679,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/types/trace.ts":{"bytes":16307,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/log","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":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/runtime/scheduler.ts":{"bytes":21200,"imports":[{"path":"node: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":"node: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/node/bundler/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":14436},"packages/core/functions/dist/lib/node/bundler/index.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-JEQ2X3Z6.cjs","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":7286},"packages/core/functions/dist/lib/node/edge/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/node/edge/index.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-NXZNXVT3.cjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node/chunk-JEQ2X3Z6.cjs","kind":"import-statement"}],"exports":["incrementSemverPatch","publicKeyToDid","uploadWorkerFunction"],"entryPoint":"packages/core/functions/src/edge/index.ts","inputs":{},"bytes":250},"packages/core/functions/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7893},"packages/core/functions/dist/lib/node/index.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-NXZNXVT3.cjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node/chunk-RXMCVAMJ.cjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node/chunk-DSUGRAAL.cjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node/chunk-JEQ2X3Z6.cjs","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","InvocationTraceEndEvent","InvocationTraceEventType","InvocationTraceStartEvent","ScriptType","TraceEvent","TraceEventException","TraceEventLog","TriggerKind","TriggerRegistry","TriggerSchema","createInvocationSpans","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":3590},"packages/core/functions/dist/lib/node/chunk-NXZNXVT3.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3275},"packages/core/functions/dist/lib/node/chunk-NXZNXVT3.cjs":{"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":1654},"packages/core/functions/src/edge/index.ts":{"bytesInOutput":0}},"bytes":1825},"packages/core/functions/dist/lib/node/testing/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":32289},"packages/core/functions/dist/lib/node/testing/index.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-RXMCVAMJ.cjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node/chunk-DSUGRAAL.cjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node/chunk-JEQ2X3Z6.cjs","kind":"import-statement"},{"path":"get-port-please","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/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":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/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":2775},"packages/core/functions/src/testing/types.ts":{"bytesInOutput":182},"packages/core/functions/src/runtime/dev-server.ts":{"bytesInOutput":7860},"packages/core/functions/src/runtime/index.ts":{"bytesInOutput":0},"packages/core/functions/src/runtime/scheduler.ts":{"bytesInOutput":5364},"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":18145},"packages/core/functions/dist/lib/node/chunk-RXMCVAMJ.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":27169},"packages/core/functions/dist/lib/node/chunk-RXMCVAMJ.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-DSUGRAAL.cjs","kind":"import-statement"},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/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":14149},"packages/core/functions/dist/lib/node/types/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/node/types/index.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-DSUGRAAL.cjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node/chunk-JEQ2X3Z6.cjs","kind":"import-statement"}],"exports":["FUNCTIONS_PRESET_META_KEY","FUNCTION_TYPES","FunctionDef","FunctionManifestSchema","FunctionTrigger","FunctionTriggerSchema","FunctionType","InvocationOutcome","InvocationTraceEndEvent","InvocationTraceEventType","InvocationTraceStartEvent","ScriptType","TraceEvent","TraceEventException","TraceEventLog","TriggerKind","TriggerSchema","createInvocationSpans","getInvocationUrl","getUserFunctionUrlInMetadata","setUserFunctionUrlInMetadata"],"entryPoint":"packages/core/functions/src/types/index.ts","inputs":{},"bytes":1042},"packages/core/functions/dist/lib/node/chunk-DSUGRAAL.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":22236},"packages/core/functions/dist/lib/node/chunk-DSUGRAAL.cjs":{"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},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["FUNCTIONS_PRESET_META_KEY","FUNCTION_TYPES","FunctionDef","FunctionManifestSchema","FunctionTrigger","FunctionTriggerSchema","FunctionType","InvocationOutcome","InvocationTraceEndEvent","InvocationTraceEventType","InvocationTraceStartEvent","ScriptType","TraceEvent","TraceEventException","TraceEventLog","TriggerKind","TriggerSchema","createInvocationSpans","getInvocationUrl","getUserFunctionUrlInMetadata","setUserFunctionUrlInMetadata"],"inputs":{"packages/core/functions/src/types/schema.ts":{"bytesInOutput":1084},"packages/core/functions/src/types/index.ts":{"bytesInOutput":0},"packages/core/functions/src/types/types.ts":{"bytesInOutput":3699},"packages/core/functions/src/types/trace.ts":{"bytesInOutput":4133},"packages/core/functions/src/types/url.ts":{"bytesInOutput":1138}},"bytes":10758},"packages/core/functions/dist/lib/node/chunk-JEQ2X3Z6.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/node/chunk-JEQ2X3Z6.cjs":{"imports":[],"exports":["__require"],"inputs":{},"bytes":434}}}
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":6587,"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":909,"imports":[{"path":"packages/core/functions/src/edge/functions.ts","kind":"import-statement","original":"./functions"}],"format":"esm"},"packages/core/functions/src/handler.ts":{"bytes":5909,"imports":[{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/schema.ts":{"bytes":5170,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/types.ts":{"bytes":21507,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"packages/core/functions/src/schema.ts","kind":"import-statement","original":"./schema"}],"format":"esm"},"packages/core/functions/src/trace.ts":{"bytes":16775,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"packages/core/functions/src/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/core/functions/src/url.ts":{"bytes":6178,"imports":[],"format":"esm"},"packages/core/functions/src/index.ts":{"bytes":821,"imports":[{"path":"packages/core/functions/src/handler.ts","kind":"import-statement","original":"./handler"},{"path":"packages/core/functions/src/schema.ts","kind":"import-statement","original":"./schema"},{"path":"packages/core/functions/src/trace.ts","kind":"import-statement","original":"./trace"},{"path":"packages/core/functions/src/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/core/functions/src/url.ts","kind":"import-statement","original":"./url"}],"format":"esm"}},"outputs":{"packages/core/functions/dist/lib/node/bundler/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":14434},"packages/core/functions/dist/lib/node/bundler/index.cjs":{"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}],"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":7253},"packages/core/functions/dist/lib/node/edge/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3278},"packages/core/functions/dist/lib/node/edge/index.cjs":{"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"],"entryPoint":"packages/core/functions/src/edge/index.ts","inputs":{"packages/core/functions/src/edge/functions.ts":{"bytesInOutput":1654},"packages/core/functions/src/edge/index.ts":{"bytesInOutput":0}},"bytes":1815},"packages/core/functions/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":29109},"packages/core/functions/dist/lib/node/index.cjs":{"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"exports":["EmailTriggerOutput","FUNCTIONS_PRESET_META_KEY","FUNCTION_TYPES","FunctionManifestSchema","FunctionTrigger","FunctionTriggerSchema","FunctionType","InvocationOutcome","InvocationTraceEndEvent","InvocationTraceEventType","InvocationTraceStartEvent","QueueTriggerOutput","ScriptType","SubscriptionTriggerOutput","TimerTriggerOutput","TraceEvent","TraceEventException","TraceEventLog","TriggerKind","TriggerSchema","WebhookTriggerOutput","createInvocationSpans","defineFunction","getInvocationUrl","getUserFunctionUrlInMetadata","makeFunctionUrl","setUserFunctionUrlInMetadata"],"entryPoint":"packages/core/functions/src/index.ts","inputs":{"packages/core/functions/src/handler.ts":{"bytesInOutput":448},"packages/core/functions/src/index.ts":{"bytesInOutput":0},"packages/core/functions/src/schema.ts":{"bytesInOutput":1199},"packages/core/functions/src/trace.ts":{"bytesInOutput":4316},"packages/core/functions/src/types.ts":{"bytesInOutput":4601},"packages/core/functions/src/url.ts":{"bytesInOutput":1209}},"bytes":12668}}}
@@ -1,5 +1,4 @@
1
1
  import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import "../chunk-DHGBFXSZ.mjs";
3
2
 
4
3
  // packages/core/functions/src/bundler/bundler.ts
5
4
  import { build, initialize } from "esbuild-wasm";
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/bundler/bundler.ts"],
4
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": ";;;;AAKA,SAASA,OAAOC,kBAAiD;AAEjE,SAASC,oBAAoB;AAC7B,SAASC,iBAAiB;AAC1B,SAASC,WAAW;;AAoCpB,IAAIC;AACG,IAAMC,oBAAoB,OAAOC,YAAAA;AACtC,SAAOF,gBAAgBJ,WAAW;IAChCO,SAASD,QAAQE;EACnB,CAAA;AACF;AAKO,IAAMC,UAAN,MAAMA;EACXC,YAA6BC,UAA0B;SAA1BA,WAAAA;EAA2B;EAExD,MAAMC,OAAO,EAAEC,MAAMC,OAAM,GAA0C;AACnE,UAAM,EAAEC,kBAAkBC,iBAAiB,GAAGV,QAAAA,IAAY,KAAKK;AAE/D,UAAMM,eAAe,OAAOC,WAAAA;AAC1B,aAAO;QACLC,WAAWC,KAAKC,IAAG;QACnBC,YAAYR,SAASS,OAAOC,KAAK,MAAMvB,aAAawB,OAAO,WAAWF,OAAOC,KAAKV,MAAAA,CAAAA,CAAAA,IAAYY;QAC9F,GAAGR;MACL;IACF;AAEA,QAAI,KAAKP,SAASgB,aAAa,WAAW;AACxCzB,gBAAUE,aAAa,6BAAA;;;;;;;;;AACvB,YAAMA;IACR;AAEA,UAAMwB,UAAUd,SAASe,yBAAyBf,MAAAA,IAAU,CAAA;AAG5D,QAAI;AACF,YAAMI,SAAS,MAAMnB,MAAM;QACzB4B,UAAUrB,QAAQqB;QAClBG,YAAY;UAAC;UAAW;;QACxBC,UAAU;QACVC,OAAO;QACPC,aAAa;UAACpB,QAAQ;;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B,WAAW;IACb,EAAA;AAKA3C,IAAAA,OAAMuC,UAAU;MAAEC,QAAQ;MAAMG,WAAW;IAAW,GAAG,CAAC+C,UAAU;MAClE5E,MAAM,IAAI6E,IAAID,KAAK5E,MAAM4E,KAAKE,QAAQ,EAAEC,SAAQ;MAChDlD,WAAW;IACb,EAAA;AAIA3C,IAAAA,OAAM4C,OAAO;MAAEJ,QAAQ;MAAMG,WAAW;IAAW,GAAG,OAAO+C,SAAAA;AAC3D,YAAMI,WAAW,MAAMC,MAAML,KAAK5E,IAAI;AACtC,aAAO;QAAE+B,UAAU,MAAMiD,SAASnC,KAAI;QAAIb,QAAQ;MAAM;IAC1D,CAAA;EACF;AACF;",
6
6
  "names": ["build", "initialize", "subtleCrypto", "invariant", "log", "initialized", "initializeBundler", "options", "wasmURL", "wasmUrl", "Bundler", "constructor", "_options", "bundle", "path", "source", "sandboxedModules", "providedModules", "createResult", "result", "timestamp", "Date", "now", "sourceHash", "Buffer", "from", "digest", "undefined", "platform", "imports", "analyzeSourceFileImports", "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", "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
7
  }
@@ -1,10 +1,68 @@
1
1
  import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- incrementSemverPatch,
4
- publicKeyToDid,
5
- uploadWorkerFunction
6
- } from "../chunk-O2SXVYU5.mjs";
7
- import "../chunk-DHGBFXSZ.mjs";
2
+
3
+ // packages/core/functions/src/edge/functions.ts
4
+ import { createEdgeIdentity } from "@dxos/client/edge";
5
+ import { EdgeHttpClient } from "@dxos/edge-client";
6
+ import { invariant } from "@dxos/invariant";
7
+ import { log } from "@dxos/log";
8
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/functions/src/edge/functions.ts";
9
+ var uploadWorkerFunction = async ({ client, spaceId, version, source, name, functionId }) => {
10
+ const edgeUrl = client.config.values.runtime?.services?.edge?.url;
11
+ invariant(edgeUrl, "Edge is not configured.", {
12
+ F: __dxlog_file,
13
+ L: 33,
14
+ S: void 0,
15
+ A: [
16
+ "edgeUrl",
17
+ "'Edge is not configured.'"
18
+ ]
19
+ });
20
+ const edgeClient = new EdgeHttpClient(edgeUrl);
21
+ const edgeIdentity = createEdgeIdentity(client);
22
+ edgeClient.setIdentity(edgeIdentity);
23
+ const response = await edgeClient.uploadFunction({
24
+ spaceId,
25
+ functionId
26
+ }, {
27
+ name,
28
+ version,
29
+ script: source
30
+ });
31
+ log.info("Uploaded", {
32
+ identityKey: edgeIdentity.identityKey,
33
+ functionId,
34
+ name,
35
+ source: source.length,
36
+ response
37
+ }, {
38
+ F: __dxlog_file,
39
+ L: 40,
40
+ S: void 0,
41
+ C: (f, a) => f(...a)
42
+ });
43
+ return response;
44
+ };
45
+ var incrementSemverPatch = (version) => {
46
+ const [major, minor, patch] = version.split(".");
47
+ const patchNum = Number(patch);
48
+ invariant(!Number.isNaN(patchNum), `Unexpected function version format: ${version}`, {
49
+ F: __dxlog_file,
50
+ L: 54,
51
+ S: void 0,
52
+ A: [
53
+ "!Number.isNaN(patchNum)",
54
+ "`Unexpected function version format: ${version}`"
55
+ ]
56
+ });
57
+ return [
58
+ major,
59
+ minor,
60
+ String(patchNum + 1)
61
+ ].join(".");
62
+ };
63
+ var publicKeyToDid = (key) => {
64
+ return `did:key:${key.toHex()}`;
65
+ };
8
66
  export {
9
67
  incrementSemverPatch,
10
68
  publicKeyToDid,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
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 spaceId: SpaceId;\n source: string;\n version: string;\n name?: string;\n functionId?: string;\n};\n\nexport const uploadWorkerFunction = async ({\n client,\n spaceId,\n version,\n source,\n name,\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 // TODO(burdon): Edge service log.\n log.info('Uploaded', {\n identityKey: edgeIdentity.identityKey,\n functionId,\n name,\n source: source.length,\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: ${version}`);\n return [major, minor, String(patchNum + 1)].join('.');\n};\n\n// TODO(burdon): Factor out.\nexport const publicKeyToDid = (key: PublicKey): DID => {\n return `did:key:${key.toHex()}`;\n};\n"],
5
+ "mappings": ";;;AAOA,SAASA,0BAA0B;AACnC,SAASC,sBAAsB;AAC/B,SAASC,iBAAiB;AAE1B,SAASC,WAAW;;AAYb,IAAMC,uBAAuB,OAAO,EACzCC,QACAC,SACAC,SACAC,QACAC,MACAC,WAAU,MACO;AACjB,QAAMC,UAAUN,OAAOO,OAAOC,OAAOC,SAASC,UAAUC,MAAMC;AAC9Df,YAAUS,SAAS,2BAAA;;;;;;;;;AACnB,QAAMO,aAAa,IAAIjB,eAAeU,OAAAA;AACtC,QAAMQ,eAAenB,mBAAmBK,MAAAA;AACxCa,aAAWE,YAAYD,YAAAA;AACvB,QAAME,WAAW,MAAMH,WAAWI,eAAe;IAAEhB;IAASI;EAAW,GAAG;IAAED;IAAMF;IAASgB,QAAQf;EAAO,CAAA;AAG1GL,MAAIqB,KAAK,YAAY;IACnBC,aAAaN,aAAaM;IAC1Bf;IACAD;IACAD,QAAQA,OAAOkB;IACfL;EACF,GAAA;;;;;;AAEA,SAAOA;AACT;AAEO,IAAMM,uBAAuB,CAACpB,YAAAA;AACnC,QAAM,CAACqB,OAAOC,OAAOC,KAAAA,IAASvB,QAAQwB,MAAM,GAAA;AAC5C,QAAMC,WAAWC,OAAOH,KAAAA;AACxB5B,YAAU,CAAC+B,OAAOC,MAAMF,QAAAA,GAAW,uCAAuCzB,OAAAA,IAAS;;;;;;;;;AACnF,SAAO;IAACqB;IAAOC;IAAOM,OAAOH,WAAW,CAAA;IAAII,KAAK,GAAA;AACnD;AAGO,IAAMC,iBAAiB,CAACC,QAAAA;AAC7B,SAAO,WAAWA,IAAIC,MAAK,CAAA;AAC7B;",
6
+ "names": ["createEdgeIdentity", "EdgeHttpClient", "invariant", "log", "uploadWorkerFunction", "client", "spaceId", "version", "source", "name", "functionId", "edgeUrl", "config", "values", "runtime", "services", "edge", "url", "edgeClient", "edgeIdentity", "setIdentity", "response", "uploadFunction", "script", "info", "identityKey", "length", "incrementSemverPatch", "major", "minor", "patch", "split", "patchNum", "Number", "isNaN", "String", "join", "publicKeyToDid", "key", "toHex"]
7
7
  }