@dxos/protocols 0.8.4-main.1da679c → 0.8.4-main.21d9917

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 (346) hide show
  1. package/dist/src/FunctionProtocol.d.ts +82 -0
  2. package/dist/src/FunctionProtocol.d.ts.map +1 -0
  3. package/dist/src/FunctionProtocol.js +4 -0
  4. package/dist/src/FunctionProtocol.js.map +1 -0
  5. package/dist/src/automerge.d.ts +8 -0
  6. package/dist/src/automerge.d.ts.map +1 -1
  7. package/dist/src/automerge.js.map +1 -1
  8. package/dist/src/buf/proto/gen/dxos/agent/dashboard_pb.d.ts +1 -1
  9. package/dist/src/buf/proto/gen/dxos/agent/dashboard_pb.js +1 -1
  10. package/dist/src/buf/proto/gen/dxos/agent/echo-proxy_pb.d.ts +1 -1
  11. package/dist/src/buf/proto/gen/dxos/agent/echo-proxy_pb.js +1 -1
  12. package/dist/src/buf/proto/gen/dxos/agent/epoch_pb.d.ts +1 -1
  13. package/dist/src/buf/proto/gen/dxos/agent/epoch_pb.js +1 -1
  14. package/dist/src/buf/proto/gen/dxos/agent/functions_pb.d.ts +1 -1
  15. package/dist/src/buf/proto/gen/dxos/agent/functions_pb.js +1 -1
  16. package/dist/src/buf/proto/gen/dxos/bot_pb.d.ts +1 -1
  17. package/dist/src/buf/proto/gen/dxos/bot_pb.js +1 -1
  18. package/dist/src/buf/proto/gen/dxos/client/invitation_pb.d.ts +1 -1
  19. package/dist/src/buf/proto/gen/dxos/client/invitation_pb.js +1 -1
  20. package/dist/src/buf/proto/gen/dxos/client/logging_pb.d.ts +1 -1
  21. package/dist/src/buf/proto/gen/dxos/client/logging_pb.js +1 -1
  22. package/dist/src/buf/proto/gen/dxos/client/queue_pb.d.ts +189 -0
  23. package/dist/src/buf/proto/gen/dxos/client/queue_pb.d.ts.map +1 -0
  24. package/dist/src/buf/proto/gen/dxos/client/queue_pb.js +39 -0
  25. package/dist/src/buf/proto/gen/dxos/client/queue_pb.js.map +1 -0
  26. package/dist/src/buf/proto/gen/dxos/client/services_pb.d.ts +65 -19
  27. package/dist/src/buf/proto/gen/dxos/client/services_pb.d.ts.map +1 -1
  28. package/dist/src/buf/proto/gen/dxos/client/services_pb.js +28 -23
  29. package/dist/src/buf/proto/gen/dxos/client/services_pb.js.map +1 -1
  30. package/dist/src/buf/proto/gen/dxos/config_pb.d.ts +5 -1
  31. package/dist/src/buf/proto/gen/dxos/config_pb.d.ts.map +1 -1
  32. package/dist/src/buf/proto/gen/dxos/config_pb.js +2 -2
  33. package/dist/src/buf/proto/gen/dxos/config_pb.js.map +1 -1
  34. package/dist/src/buf/proto/gen/dxos/devtools/diagnostics_pb.d.ts +1 -1
  35. package/dist/src/buf/proto/gen/dxos/devtools/diagnostics_pb.js +1 -1
  36. package/dist/src/buf/proto/gen/dxos/devtools/host_pb.d.ts +1 -1
  37. package/dist/src/buf/proto/gen/dxos/devtools/host_pb.js +1 -1
  38. package/dist/src/buf/proto/gen/dxos/devtools/swarm_pb.d.ts +1 -1
  39. package/dist/src/buf/proto/gen/dxos/devtools/swarm_pb.js +1 -1
  40. package/dist/src/buf/proto/gen/dxos/echo/blob_pb.d.ts +1 -1
  41. package/dist/src/buf/proto/gen/dxos/echo/blob_pb.js +1 -1
  42. package/dist/src/buf/proto/gen/dxos/echo/feed_pb.d.ts +1 -1
  43. package/dist/src/buf/proto/gen/dxos/echo/feed_pb.js +1 -1
  44. package/dist/src/buf/proto/gen/dxos/echo/filter_pb.d.ts +1 -1
  45. package/dist/src/buf/proto/gen/dxos/echo/filter_pb.js +1 -1
  46. package/dist/src/buf/proto/gen/dxos/echo/indexing_pb.d.ts +1 -1
  47. package/dist/src/buf/proto/gen/dxos/echo/indexing_pb.js +1 -1
  48. package/dist/src/buf/proto/gen/dxos/echo/metadata_pb.d.ts +1 -1
  49. package/dist/src/buf/proto/gen/dxos/echo/metadata_pb.js +1 -1
  50. package/dist/src/buf/proto/gen/dxos/echo/model/document_pb.d.ts +1 -1
  51. package/dist/src/buf/proto/gen/dxos/echo/model/document_pb.js +1 -1
  52. package/dist/src/buf/proto/gen/dxos/echo/model/messenger_pb.d.ts +1 -1
  53. package/dist/src/buf/proto/gen/dxos/echo/model/messenger_pb.js +1 -1
  54. package/dist/src/buf/proto/gen/dxos/echo/model/text_pb.d.ts +1 -1
  55. package/dist/src/buf/proto/gen/dxos/echo/model/text_pb.js +1 -1
  56. package/dist/src/buf/proto/gen/dxos/echo/object_pb.d.ts +1 -1
  57. package/dist/src/buf/proto/gen/dxos/echo/object_pb.js +1 -1
  58. package/dist/src/buf/proto/gen/dxos/echo/query_pb.d.ts +13 -3
  59. package/dist/src/buf/proto/gen/dxos/echo/query_pb.d.ts.map +1 -1
  60. package/dist/src/buf/proto/gen/dxos/echo/query_pb.js +2 -2
  61. package/dist/src/buf/proto/gen/dxos/echo/query_pb.js.map +1 -1
  62. package/dist/src/buf/proto/gen/dxos/echo/service_pb.d.ts +56 -10
  63. package/dist/src/buf/proto/gen/dxos/echo/service_pb.d.ts.map +1 -1
  64. package/dist/src/buf/proto/gen/dxos/echo/service_pb.js +16 -6
  65. package/dist/src/buf/proto/gen/dxos/echo/service_pb.js.map +1 -1
  66. package/dist/src/buf/proto/gen/dxos/echo/snapshot_pb.d.ts +1 -1
  67. package/dist/src/buf/proto/gen/dxos/echo/snapshot_pb.js +1 -1
  68. package/dist/src/buf/proto/gen/dxos/echo/timeframe_pb.d.ts +1 -1
  69. package/dist/src/buf/proto/gen/dxos/echo/timeframe_pb.js +1 -1
  70. package/dist/src/buf/proto/gen/dxos/edge/calls_pb.d.ts +1 -1
  71. package/dist/src/buf/proto/gen/dxos/edge/calls_pb.js +1 -1
  72. package/dist/src/buf/proto/gen/dxos/edge/messenger_pb.d.ts +1 -1
  73. package/dist/src/buf/proto/gen/dxos/edge/messenger_pb.js +1 -1
  74. package/dist/src/buf/proto/gen/dxos/edge/signal_pb.d.ts +1 -1
  75. package/dist/src/buf/proto/gen/dxos/edge/signal_pb.js +1 -1
  76. package/dist/src/buf/proto/gen/dxos/error_pb.d.ts +1 -1
  77. package/dist/src/buf/proto/gen/dxos/error_pb.js +1 -1
  78. package/dist/src/buf/proto/gen/dxos/field_options_pb.d.ts +1 -1
  79. package/dist/src/buf/proto/gen/dxos/field_options_pb.js +1 -1
  80. package/dist/src/buf/proto/gen/dxos/google_pb.d.ts +1 -1
  81. package/dist/src/buf/proto/gen/dxos/google_pb.js +2 -2
  82. package/dist/src/buf/proto/gen/dxos/google_pb.js.map +1 -1
  83. package/dist/src/buf/proto/gen/dxos/gravity_pb.d.ts +1 -1
  84. package/dist/src/buf/proto/gen/dxos/gravity_pb.js +1 -1
  85. package/dist/src/buf/proto/gen/dxos/halo/credentials/auth_pb.d.ts +1 -1
  86. package/dist/src/buf/proto/gen/dxos/halo/credentials/auth_pb.js +1 -1
  87. package/dist/src/buf/proto/gen/dxos/halo/credentials/greet_pb.d.ts +1 -1
  88. package/dist/src/buf/proto/gen/dxos/halo/credentials/greet_pb.js +1 -1
  89. package/dist/src/buf/proto/gen/dxos/halo/credentials/identity_pb.d.ts +1 -1
  90. package/dist/src/buf/proto/gen/dxos/halo/credentials/identity_pb.js +1 -1
  91. package/dist/src/buf/proto/gen/dxos/halo/credentials_pb.d.ts +1 -1
  92. package/dist/src/buf/proto/gen/dxos/halo/credentials_pb.js +1 -1
  93. package/dist/src/buf/proto/gen/dxos/halo/invitations_pb.d.ts +1 -1
  94. package/dist/src/buf/proto/gen/dxos/halo/invitations_pb.js +1 -1
  95. package/dist/src/buf/proto/gen/dxos/halo/keyring_pb.d.ts +1 -1
  96. package/dist/src/buf/proto/gen/dxos/halo/keyring_pb.js +1 -1
  97. package/dist/src/buf/proto/gen/dxos/halo/keys_pb.d.ts +1 -1
  98. package/dist/src/buf/proto/gen/dxos/halo/keys_pb.js +1 -1
  99. package/dist/src/buf/proto/gen/dxos/halo/signed_pb.d.ts +1 -1
  100. package/dist/src/buf/proto/gen/dxos/halo/signed_pb.js +1 -1
  101. package/dist/src/buf/proto/gen/dxos/iframe_pb.d.ts +2 -1
  102. package/dist/src/buf/proto/gen/dxos/iframe_pb.d.ts.map +1 -1
  103. package/dist/src/buf/proto/gen/dxos/iframe_pb.js +1 -1
  104. package/dist/src/buf/proto/gen/dxos/iframe_pb.js.map +1 -1
  105. package/dist/src/buf/proto/gen/dxos/keys_pb.d.ts +1 -1
  106. package/dist/src/buf/proto/gen/dxos/keys_pb.js +1 -1
  107. package/dist/src/buf/proto/gen/dxos/mesh/bridge_pb.d.ts +1 -1
  108. package/dist/src/buf/proto/gen/dxos/mesh/bridge_pb.js +1 -1
  109. package/dist/src/buf/proto/gen/dxos/mesh/broadcast_pb.d.ts +1 -1
  110. package/dist/src/buf/proto/gen/dxos/mesh/broadcast_pb.js +1 -1
  111. package/dist/src/buf/proto/gen/dxos/mesh/messaging_pb.d.ts +1 -1
  112. package/dist/src/buf/proto/gen/dxos/mesh/messaging_pb.js +1 -1
  113. package/dist/src/buf/proto/gen/dxos/mesh/muxer_pb.d.ts +1 -1
  114. package/dist/src/buf/proto/gen/dxos/mesh/muxer_pb.js +1 -1
  115. package/dist/src/buf/proto/gen/dxos/mesh/presence_pb.d.ts +1 -1
  116. package/dist/src/buf/proto/gen/dxos/mesh/presence_pb.js +1 -1
  117. package/dist/src/buf/proto/gen/dxos/mesh/protocol_pb.d.ts +1 -1
  118. package/dist/src/buf/proto/gen/dxos/mesh/protocol_pb.js +1 -1
  119. package/dist/src/buf/proto/gen/dxos/mesh/replicator_pb.d.ts +1 -1
  120. package/dist/src/buf/proto/gen/dxos/mesh/replicator_pb.js +1 -1
  121. package/dist/src/buf/proto/gen/dxos/mesh/signal_pb.d.ts +1 -1
  122. package/dist/src/buf/proto/gen/dxos/mesh/signal_pb.js +1 -1
  123. package/dist/src/buf/proto/gen/dxos/mesh/swarm_pb.d.ts +1 -1
  124. package/dist/src/buf/proto/gen/dxos/mesh/swarm_pb.js +1 -1
  125. package/dist/src/buf/proto/gen/dxos/mesh/teleport/admission-discovery_pb.d.ts +1 -1
  126. package/dist/src/buf/proto/gen/dxos/mesh/teleport/admission-discovery_pb.js +1 -1
  127. package/dist/src/buf/proto/gen/dxos/mesh/teleport/auth_pb.d.ts +1 -1
  128. package/dist/src/buf/proto/gen/dxos/mesh/teleport/auth_pb.js +1 -1
  129. package/dist/src/buf/proto/gen/dxos/mesh/teleport/automerge_pb.d.ts +1 -1
  130. package/dist/src/buf/proto/gen/dxos/mesh/teleport/automerge_pb.js +1 -1
  131. package/dist/src/buf/proto/gen/dxos/mesh/teleport/blobsync_pb.d.ts +1 -1
  132. package/dist/src/buf/proto/gen/dxos/mesh/teleport/blobsync_pb.js +1 -1
  133. package/dist/src/buf/proto/gen/dxos/mesh/teleport/control_pb.d.ts +1 -1
  134. package/dist/src/buf/proto/gen/dxos/mesh/teleport/control_pb.js +1 -1
  135. package/dist/src/buf/proto/gen/dxos/mesh/teleport/gossip_pb.d.ts +1 -1
  136. package/dist/src/buf/proto/gen/dxos/mesh/teleport/gossip_pb.js +1 -1
  137. package/dist/src/buf/proto/gen/dxos/mesh/teleport/notarization_pb.d.ts +1 -1
  138. package/dist/src/buf/proto/gen/dxos/mesh/teleport/notarization_pb.js +1 -1
  139. package/dist/src/buf/proto/gen/dxos/mesh/teleport/replicator_pb.d.ts +1 -1
  140. package/dist/src/buf/proto/gen/dxos/mesh/teleport/replicator_pb.js +1 -1
  141. package/dist/src/buf/proto/gen/dxos/registry_pb.d.ts +1 -1
  142. package/dist/src/buf/proto/gen/dxos/registry_pb.js +1 -1
  143. package/dist/src/buf/proto/gen/dxos/rpc_pb.d.ts +1 -1
  144. package/dist/src/buf/proto/gen/dxos/rpc_pb.js +1 -1
  145. package/dist/src/buf/proto/gen/dxos/service/agentmanager_pb.d.ts +1 -1
  146. package/dist/src/buf/proto/gen/dxos/service/agentmanager_pb.js +1 -1
  147. package/dist/src/buf/proto/gen/dxos/service/publisher_pb.d.ts +1 -1
  148. package/dist/src/buf/proto/gen/dxos/service/publisher_pb.js +1 -1
  149. package/dist/src/buf/proto/gen/dxos/service/supervisor_pb.d.ts +1 -1
  150. package/dist/src/buf/proto/gen/dxos/service/supervisor_pb.js +1 -1
  151. package/dist/src/buf/proto/gen/dxos/service/tunnel_pb.d.ts +1 -1
  152. package/dist/src/buf/proto/gen/dxos/service/tunnel_pb.js +1 -1
  153. package/dist/src/buf/proto/gen/dxos/tracing_pb.d.ts +1 -1
  154. package/dist/src/buf/proto/gen/dxos/tracing_pb.js +2 -2
  155. package/dist/src/buf/proto/gen/dxos/tracing_pb.js.map +1 -1
  156. package/dist/src/buf/proto/gen/dxos/type_pb.d.ts +1 -1
  157. package/dist/src/buf/proto/gen/dxos/type_pb.js +1 -1
  158. package/dist/src/buf/proto/gen/dxos/value_pb.d.ts +1 -1
  159. package/dist/src/buf/proto/gen/dxos/value_pb.js +1 -1
  160. package/dist/src/buf/proto/gen/example/testing/data_pb.d.ts +1 -1
  161. package/dist/src/buf/proto/gen/example/testing/data_pb.js +1 -1
  162. package/dist/src/buf/proto/gen/example/testing/rpc_pb.d.ts +1 -1
  163. package/dist/src/buf/proto/gen/example/testing/rpc_pb.js +1 -1
  164. package/dist/src/edge/EdgeFunctionEnv.d.ts +120 -0
  165. package/dist/src/edge/EdgeFunctionEnv.d.ts.map +1 -0
  166. package/dist/src/edge/EdgeFunctionEnv.js +4 -0
  167. package/dist/src/edge/EdgeFunctionEnv.js.map +1 -0
  168. package/dist/src/{edge.d.ts → edge/edge.d.ts} +111 -11
  169. package/dist/src/edge/edge.d.ts.map +1 -0
  170. package/dist/src/edge/edge.js +160 -0
  171. package/dist/src/edge/edge.js.map +1 -0
  172. package/dist/src/edge/errors.d.ts +29 -0
  173. package/dist/src/edge/errors.d.ts.map +1 -0
  174. package/dist/src/edge/errors.js +69 -0
  175. package/dist/src/edge/errors.js.map +1 -0
  176. package/dist/src/edge/index.d.ts +4 -0
  177. package/dist/src/edge/index.d.ts.map +1 -0
  178. package/dist/src/edge/index.js +7 -0
  179. package/dist/src/edge/index.js.map +1 -0
  180. package/dist/src/errors/base-errors.d.ts +86 -8
  181. package/dist/src/errors/base-errors.d.ts.map +1 -1
  182. package/dist/src/errors/base-errors.js +4 -20
  183. package/dist/src/errors/base-errors.js.map +1 -1
  184. package/dist/src/errors/encoding.d.ts +1 -1
  185. package/dist/src/errors/encoding.d.ts.map +1 -1
  186. package/dist/src/errors/errors.d.ts +618 -41
  187. package/dist/src/errors/errors.d.ts.map +1 -1
  188. package/dist/src/errors/errors.js +49 -103
  189. package/dist/src/errors/errors.js.map +1 -1
  190. package/dist/src/errors/errors.test.js +1 -1
  191. package/dist/src/errors/errors.test.js.map +1 -1
  192. package/dist/src/errors/helpers.d.ts +8 -4
  193. package/dist/src/errors/helpers.d.ts.map +1 -1
  194. package/dist/src/errors/helpers.js +3 -3
  195. package/dist/src/errors/helpers.js.map +1 -1
  196. package/dist/src/feed-replication.d.ts.map +1 -1
  197. package/dist/src/index.d.ts +7 -7
  198. package/dist/src/index.d.ts.map +1 -1
  199. package/dist/src/index.js +7 -6
  200. package/dist/src/index.js.map +1 -1
  201. package/dist/src/indexing.d.ts +1 -1
  202. package/dist/src/indexing.d.ts.map +1 -1
  203. package/dist/src/indexing.js +1 -1
  204. package/dist/src/indexing.js.map +1 -1
  205. package/dist/src/invitation.d.ts +1 -1
  206. package/dist/src/invitation.d.ts.map +1 -1
  207. package/dist/src/invitation.js +1 -1
  208. package/dist/src/invitation.js.map +1 -1
  209. package/dist/src/messenger.d.ts +16 -0
  210. package/dist/src/messenger.d.ts.map +1 -0
  211. package/dist/src/messenger.js +4 -0
  212. package/dist/src/messenger.js.map +1 -0
  213. package/dist/src/proto/gen/dxos/client/services.d.ts +133 -3
  214. package/dist/src/proto/gen/dxos/client/services.d.ts.map +1 -1
  215. package/dist/src/proto/gen/dxos/client/services.js +9 -6
  216. package/dist/src/proto/gen/dxos/client/services.js.map +1 -1
  217. package/dist/src/proto/gen/dxos/config.d.ts +5 -0
  218. package/dist/src/proto/gen/dxos/config.d.ts.map +1 -1
  219. package/dist/src/proto/gen/dxos/config.js.map +1 -1
  220. package/dist/src/proto/gen/dxos/echo/query.d.ts +17 -1
  221. package/dist/src/proto/gen/dxos/echo/query.d.ts.map +1 -1
  222. package/dist/src/proto/gen/dxos/echo/query.js.map +1 -1
  223. package/dist/src/proto/gen/dxos/echo/service.d.ts +34 -8
  224. package/dist/src/proto/gen/dxos/echo/service.d.ts.map +1 -1
  225. package/dist/src/proto/gen/index.d.ts +9 -0
  226. package/dist/src/proto/gen/index.d.ts.map +1 -1
  227. package/dist/src/proto/gen/index.js +1 -1
  228. package/dist/src/proto/gen/index.js.map +1 -1
  229. package/dist/src/queue.d.ts +1 -26
  230. package/dist/src/queue.d.ts.map +1 -1
  231. package/dist/src/queue.js +1 -4
  232. package/dist/src/queue.js.map +1 -1
  233. package/dist/tsconfig.tsbuildinfo +1 -1
  234. package/package.json +19 -18
  235. package/src/FunctionProtocol.ts +104 -0
  236. package/src/automerge.ts +8 -0
  237. package/src/buf/proto/gen/dxos/agent/dashboard_pb.ts +3 -3
  238. package/src/buf/proto/gen/dxos/agent/echo-proxy_pb.ts +3 -3
  239. package/src/buf/proto/gen/dxos/agent/epoch_pb.ts +3 -3
  240. package/src/buf/proto/gen/dxos/agent/functions_pb.ts +3 -3
  241. package/src/buf/proto/gen/dxos/bot_pb.ts +3 -3
  242. package/src/buf/proto/gen/dxos/client/invitation_pb.ts +3 -3
  243. package/src/buf/proto/gen/dxos/client/logging_pb.ts +3 -3
  244. package/src/buf/proto/gen/dxos/client/queue_pb.ts +231 -0
  245. package/src/buf/proto/gen/dxos/client/services_pb.ts +84 -29
  246. package/src/buf/proto/gen/dxos/config_pb.ts +9 -4
  247. package/src/buf/proto/gen/dxos/devtools/diagnostics_pb.ts +3 -3
  248. package/src/buf/proto/gen/dxos/devtools/host_pb.ts +3 -3
  249. package/src/buf/proto/gen/dxos/devtools/swarm_pb.ts +3 -3
  250. package/src/buf/proto/gen/dxos/echo/blob_pb.ts +3 -3
  251. package/src/buf/proto/gen/dxos/echo/feed_pb.ts +3 -3
  252. package/src/buf/proto/gen/dxos/echo/filter_pb.ts +3 -3
  253. package/src/buf/proto/gen/dxos/echo/indexing_pb.ts +3 -3
  254. package/src/buf/proto/gen/dxos/echo/metadata_pb.ts +3 -3
  255. package/src/buf/proto/gen/dxos/echo/model/document_pb.ts +3 -3
  256. package/src/buf/proto/gen/dxos/echo/model/messenger_pb.ts +3 -3
  257. package/src/buf/proto/gen/dxos/echo/model/text_pb.ts +3 -3
  258. package/src/buf/proto/gen/dxos/echo/object_pb.ts +3 -3
  259. package/src/buf/proto/gen/dxos/echo/query_pb.ts +18 -6
  260. package/src/buf/proto/gen/dxos/echo/service_pb.ts +70 -18
  261. package/src/buf/proto/gen/dxos/echo/snapshot_pb.ts +3 -3
  262. package/src/buf/proto/gen/dxos/echo/timeframe_pb.ts +3 -3
  263. package/src/buf/proto/gen/dxos/edge/calls_pb.ts +3 -3
  264. package/src/buf/proto/gen/dxos/edge/messenger_pb.ts +3 -3
  265. package/src/buf/proto/gen/dxos/edge/signal_pb.ts +3 -3
  266. package/src/buf/proto/gen/dxos/error_pb.ts +3 -3
  267. package/src/buf/proto/gen/dxos/field_options_pb.ts +3 -3
  268. package/src/buf/proto/gen/dxos/google_pb.ts +3 -3
  269. package/src/buf/proto/gen/dxos/gravity_pb.ts +3 -3
  270. package/src/buf/proto/gen/dxos/halo/credentials/auth_pb.ts +3 -3
  271. package/src/buf/proto/gen/dxos/halo/credentials/greet_pb.ts +3 -3
  272. package/src/buf/proto/gen/dxos/halo/credentials/identity_pb.ts +3 -3
  273. package/src/buf/proto/gen/dxos/halo/credentials_pb.ts +3 -3
  274. package/src/buf/proto/gen/dxos/halo/invitations_pb.ts +3 -3
  275. package/src/buf/proto/gen/dxos/halo/keyring_pb.ts +3 -3
  276. package/src/buf/proto/gen/dxos/halo/keys_pb.ts +3 -3
  277. package/src/buf/proto/gen/dxos/halo/signed_pb.ts +3 -3
  278. package/src/buf/proto/gen/dxos/iframe_pb.ts +4 -3
  279. package/src/buf/proto/gen/dxos/keys_pb.ts +3 -3
  280. package/src/buf/proto/gen/dxos/mesh/bridge_pb.ts +3 -3
  281. package/src/buf/proto/gen/dxos/mesh/broadcast_pb.ts +3 -3
  282. package/src/buf/proto/gen/dxos/mesh/messaging_pb.ts +3 -3
  283. package/src/buf/proto/gen/dxos/mesh/muxer_pb.ts +3 -3
  284. package/src/buf/proto/gen/dxos/mesh/presence_pb.ts +3 -3
  285. package/src/buf/proto/gen/dxos/mesh/protocol_pb.ts +3 -3
  286. package/src/buf/proto/gen/dxos/mesh/replicator_pb.ts +3 -3
  287. package/src/buf/proto/gen/dxos/mesh/signal_pb.ts +3 -3
  288. package/src/buf/proto/gen/dxos/mesh/swarm_pb.ts +3 -3
  289. package/src/buf/proto/gen/dxos/mesh/teleport/admission-discovery_pb.ts +3 -3
  290. package/src/buf/proto/gen/dxos/mesh/teleport/auth_pb.ts +3 -3
  291. package/src/buf/proto/gen/dxos/mesh/teleport/automerge_pb.ts +3 -3
  292. package/src/buf/proto/gen/dxos/mesh/teleport/blobsync_pb.ts +3 -3
  293. package/src/buf/proto/gen/dxos/mesh/teleport/control_pb.ts +3 -3
  294. package/src/buf/proto/gen/dxos/mesh/teleport/gossip_pb.ts +3 -3
  295. package/src/buf/proto/gen/dxos/mesh/teleport/notarization_pb.ts +3 -3
  296. package/src/buf/proto/gen/dxos/mesh/teleport/replicator_pb.ts +3 -3
  297. package/src/buf/proto/gen/dxos/registry_pb.ts +3 -3
  298. package/src/buf/proto/gen/dxos/rpc_pb.ts +3 -3
  299. package/src/buf/proto/gen/dxos/service/agentmanager_pb.ts +3 -3
  300. package/src/buf/proto/gen/dxos/service/publisher_pb.ts +3 -3
  301. package/src/buf/proto/gen/dxos/service/supervisor_pb.ts +3 -3
  302. package/src/buf/proto/gen/dxos/service/tunnel_pb.ts +3 -3
  303. package/src/buf/proto/gen/dxos/tracing_pb.ts +3 -3
  304. package/src/buf/proto/gen/dxos/type_pb.ts +3 -3
  305. package/src/buf/proto/gen/dxos/value_pb.ts +3 -3
  306. package/src/buf/proto/gen/example/testing/data_pb.ts +3 -3
  307. package/src/buf/proto/gen/example/testing/rpc_pb.ts +3 -3
  308. package/src/edge/EdgeFunctionEnv.ts +193 -0
  309. package/src/edge/edge.ts +484 -0
  310. package/src/edge/errors.ts +85 -0
  311. package/src/edge/index.ts +7 -0
  312. package/src/errors/base-errors.ts +4 -22
  313. package/src/errors/errors.test.ts +1 -1
  314. package/src/errors/errors.ts +55 -121
  315. package/src/errors/helpers.ts +5 -6
  316. package/src/feed-replication.ts +1 -0
  317. package/src/index.ts +9 -7
  318. package/src/indexing.ts +1 -1
  319. package/src/invitation.ts +1 -1
  320. package/src/messenger.ts +22 -0
  321. package/src/proto/dxos/client/queue.proto +67 -0
  322. package/src/proto/dxos/client/services.proto +20 -3
  323. package/src/proto/dxos/config.proto +2 -0
  324. package/src/proto/dxos/echo/query.proto +4 -1
  325. package/src/proto/dxos/echo/service.proto +27 -6
  326. package/src/proto/dxos/iframe.proto +1 -0
  327. package/src/proto/gen/dxos/client/services.ts +133 -3
  328. package/src/proto/gen/dxos/config.ts +5 -0
  329. package/src/proto/gen/dxos/echo/query.ts +17 -1
  330. package/src/proto/gen/dxos/echo/service.ts +33 -8
  331. package/src/proto/gen/index.ts +10 -1
  332. package/src/queue.ts +9 -33
  333. package/dist/src/edge-error.d.ts +0 -26
  334. package/dist/src/edge-error.d.ts.map +0 -1
  335. package/dist/src/edge-error.js +0 -102
  336. package/dist/src/edge-error.js.map +0 -1
  337. package/dist/src/edge.d.ts.map +0 -1
  338. package/dist/src/edge.js +0 -49
  339. package/dist/src/edge.js.map +0 -1
  340. package/dist/src/query.d.ts +0 -5
  341. package/dist/src/query.d.ts.map +0 -1
  342. package/dist/src/query.js +0 -8
  343. package/dist/src/query.js.map +0 -1
  344. package/src/edge-error.ts +0 -134
  345. package/src/edge.ts +0 -279
  346. package/src/query.ts +0 -8
@@ -1,4 +1,4 @@
1
- import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv1";
1
+ import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
2
2
  import type { EmptySchema } from "@bufbuild/protobuf/wkt";
3
3
  import type { Error } from "./error_pb.js";
4
4
  import type { LogEntry } from "./client/logging_pb.js";
@@ -1,7 +1,7 @@
1
- // @generated by protoc-gen-es v2.1.0 with parameter "target=ts,import_extension=js"
1
+ // @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=js"
2
2
  // @generated from file dxos/tracing.proto (package dxos.tracing, syntax proto3)
3
3
  /* eslint-disable */
4
- import { enumDesc, fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv1";
4
+ import { enumDesc, fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2";
5
5
  import { file_google_protobuf_empty, file_google_protobuf_struct } from "@bufbuild/protobuf/wkt";
6
6
  import { file_dxos_error } from "./error_pb.js";
7
7
  import { file_dxos_client_logging } from "./client/logging_pb.js";
@@ -1 +1 @@
1
- {"version":3,"file":"tracing_pb.js","sourceRoot":"","sources":["../../../../../../src/buf/proto/gen/dxos/tracing_pb.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,gFAAgF;AAChF,oBAAoB;AAGpB,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE5F,OAAO,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAEjG,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAGlE;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAY,aAAa,CACrD,QAAQ,CAAC,o+EAAo+E,EAAE,CAAC,2BAA2B,EAAE,0BAA0B,EAAE,eAAe,EAAE,wBA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AAE,CAAC,CAAC,CAAC;AAEvC;;GAEG;AACH,MAAM,CAAN,IAAY,UAoBX;AApBD,WAAY,UAAU;IACpB;;OAEG;IACH,mDAAY,CAAA;IAEZ;;OAEG;IACH,wDAAe,CAAA;IAEf;;OAEG;IACH,0DAAgB,CAAA;IAEhB;;OAEG;IACH,8CAAU,CAAA;AACZ,CAAC,EApBW,UAAU,KAAV,UAAU,QAoBrB;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAwB,aAAa,CAChE,QAAQ,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC;AAEjC;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAStB,aAAa,CAChB,WAAW,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1";
1
+ import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
2
2
  import type { Record_Extension } from "./registry_pb.js";
3
3
  import type { JsonObject, Message } from "@bufbuild/protobuf";
4
4
  /**
@@ -1,7 +1,7 @@
1
1
  //
2
2
  // Copyright 2022 DXOS.org
3
3
  //
4
- import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1";
4
+ import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2";
5
5
  import { file_google_protobuf_struct } from "@bufbuild/protobuf/wkt";
6
6
  import { file_dxos_registry } from "./registry_pb.js";
7
7
  /**
@@ -1,4 +1,4 @@
1
- import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1";
1
+ import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
2
2
  import type { Message } from "@bufbuild/protobuf";
3
3
  /**
4
4
  * Describes the file dxos/value.proto.
@@ -1,7 +1,7 @@
1
1
  //
2
2
  // Copyright 2021 DXOS.org
3
3
  //
4
- import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1";
4
+ import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2";
5
5
  /**
6
6
  * Describes the file dxos/value.proto.
7
7
  */
@@ -1,4 +1,4 @@
1
- import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1";
1
+ import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
2
2
  import type { Message } from "@bufbuild/protobuf";
3
3
  /**
4
4
  * Describes the file example/testing/data.proto.
@@ -1,7 +1,7 @@
1
1
  //
2
2
  // Copyright 2020 DXOS.org
3
3
  //
4
- import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1";
4
+ import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2";
5
5
  /**
6
6
  * Describes the file example/testing/data.proto.
7
7
  */
@@ -1,4 +1,4 @@
1
- import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv1";
1
+ import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
2
2
  import type { Any, EmptySchema } from "@bufbuild/protobuf/wkt";
3
3
  import type { Message } from "@bufbuild/protobuf";
4
4
  /**
@@ -1,7 +1,7 @@
1
1
  //
2
2
  // Copyright 2020 DXOS.org
3
3
  //
4
- import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv1";
4
+ import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2";
5
5
  import { file_google_protobuf_any, file_google_protobuf_empty } from "@bufbuild/protobuf/wkt";
6
6
  /**
7
7
  * Describes the file example/testing/rpc.proto.
@@ -0,0 +1,120 @@
1
+ import { type SpaceId } from '@dxos/keys';
2
+ import { type CreateDocumentRequest, type CreateDocumentResponse } from '../proto/gen/dxos/echo/service';
3
+ import { type QueryResult, type QueueQuery } from '../queue';
4
+ /**
5
+ * Environment available to the function running on Cloudflare.
6
+ */
7
+ export interface Env {
8
+ QUEUE_SERVICE: QueueService;
9
+ DATA_SERVICE: DataService;
10
+ FUNCTIONS_AI_SERVICE: FunctionsAiService;
11
+ }
12
+ /**
13
+ * Use to trace the execution across multiple services.
14
+ *
15
+ * NOTE: Currently unused in functions.
16
+ */
17
+ export interface ExecutionContext {
18
+ }
19
+ /**
20
+ * Database API for other CF services like functions.
21
+ */
22
+ export interface DataService {
23
+ getSpaceMeta(ctx: ExecutionContext, spaceId: SpaceId): Promise<RpcResult<SpaceMeta | undefined>>;
24
+ getDocument(ctx: ExecutionContext, spaceId: SpaceId, documentId: string): Promise<RpcResult<RawDocument | undefined>>;
25
+ query(ctx: ExecutionContext, request: QueryRequest): Promise<RpcResult<QueryResponse>>;
26
+ queryDocuments(ctx: ExecutionContext, request: QueryRequest): Promise<RpcResult<QueryDocumentsResponse>>;
27
+ queryReferences(ctx: ExecutionContext, request: QueryReferencesRequest): Promise<RpcResult<QueryReferencesResponse>>;
28
+ createDocument(ctx: ExecutionContext, request: CreateDocumentRequest): Promise<RpcResult<CreateDocumentResponse>>;
29
+ changeDocument(ctx: ExecutionContext, spaceId: SpaceId, documentId: string, changes: Uint8Array): Promise<void>;
30
+ }
31
+ export interface QueueService {
32
+ query(ctx: ExecutionContext, queueDXN: string, query: Omit<QueueQuery, 'queueId'>): Promise<RpcResult<QueryResult>>;
33
+ append(ctx: ExecutionContext, queueDXN: string, objects: unknown[]): Promise<void>;
34
+ }
35
+ /**
36
+ * FunctionsAiService API for other CF services like functions.
37
+ */
38
+ export interface FunctionsAiService {
39
+ /**
40
+ * Enables proxying HTTP requests to the AI service from other workers.
41
+ */
42
+ fetch(request: Request): Promise<RpcResult<Response>>;
43
+ }
44
+ export type ObjectDocumentJson = {
45
+ type?: string;
46
+ objectId: string;
47
+ documentId: string;
48
+ /** Base64 encoding of a document. */
49
+ document: string;
50
+ };
51
+ export type SpaceMeta = {
52
+ spaceKey: string;
53
+ rootDocumentId: string;
54
+ };
55
+ export type QueryRequest = {
56
+ spaceId: string;
57
+ type?: string;
58
+ where?: Record<string, any>;
59
+ objectIds?: string[];
60
+ cursor?: string;
61
+ limit?: number;
62
+ };
63
+ export type QueryResponse = {
64
+ results: ObjectSnapshot[];
65
+ cursor?: string;
66
+ };
67
+ /**
68
+ * TODO(yaroslav): make Indexer return EchoObject after create() can properly reconstruct an object
69
+ * from this structure (meta, id and type aren't handled properly)
70
+ */
71
+ export type ObjectSnapshot = {
72
+ type?: string;
73
+ documentId: string;
74
+ objectId: string;
75
+ object: unknown;
76
+ };
77
+ export type ObjectReference = {
78
+ fromId: string;
79
+ toId: string;
80
+ fieldName: string;
81
+ };
82
+ export type QueryDocumentsResponse = {
83
+ results: RawObject[];
84
+ cursor?: string;
85
+ };
86
+ export type RawDocument = {
87
+ documentId: string;
88
+ data: Uint8Array;
89
+ };
90
+ export type RawObject = {
91
+ type?: string;
92
+ objectId: string;
93
+ document: RawDocument;
94
+ };
95
+ export type QueryReferencesRequest = {
96
+ spaceId: string;
97
+ objectId: string;
98
+ referenceType: 'from' | 'to';
99
+ };
100
+ export type QueryReferencesResponse = {
101
+ references: ObjectReference[];
102
+ };
103
+ /**
104
+ * Cloudflare Workers RPC returns objects/arrays/stubs that may need to be explicitly disposed.
105
+ *
106
+ * See: https://developers.cloudflare.com/workers/runtime-apis/rpc/lifecycle/
107
+ */
108
+ export interface RpcDisposable {
109
+ /**
110
+ * Disposes the RPC stub / returned value and releases any server-side resources it references.
111
+ */
112
+ [Symbol.dispose](): void;
113
+ }
114
+ /**
115
+ * Wraps a return type so that any non-primitive value is marked as disposable.
116
+ *
117
+ * This models Workers RPC behavior where any returned object (including arrays) gets a disposer added.
118
+ */
119
+ export type RpcResult<T> = T extends object ? T & RpcDisposable : T;
120
+ //# sourceMappingURL=EdgeFunctionEnv.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EdgeFunctionEnv.d.ts","sourceRoot":"","sources":["../../../src/edge/EdgeFunctionEnv.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAE,KAAK,qBAAqB,EAAE,KAAK,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACzG,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unctionEnv.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE"}
@@ -1,4 +1,4 @@
1
- import { Schema } from 'effect';
1
+ import * as Schema from 'effect/Schema';
2
2
  import { SpaceId } from '@dxos/keys';
3
3
  export declare enum EdgeService {
4
4
  AUTOMERGE_REPLICATOR = "automerge-replicator",
@@ -7,19 +7,40 @@ export declare enum EdgeService {
7
7
  SIGNAL = "signal",
8
8
  STATUS = "status"
9
9
  }
10
- export type EdgeHttpSuccess<T> = {
10
+ export type EdgeSuccess<T> = {
11
11
  success: true;
12
12
  data: T;
13
13
  };
14
+ declare const _SerializedError: Schema.Struct<{
15
+ name: Schema.optional<typeof Schema.String>;
16
+ message: Schema.optional<typeof Schema.String>;
17
+ context: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Any>>;
18
+ stack: Schema.optional<typeof Schema.String>;
19
+ cause: Schema.optional<Schema.suspend<SerializedError, SerializedError, never>>;
20
+ }>;
21
+ export interface SerializedError extends Schema.Schema.Type<typeof _SerializedError> {
22
+ }
23
+ export declare const SerializedError: Schema.Schema<SerializedError, SerializedError, never>;
14
24
  export type EdgeErrorData = {
15
25
  type: string;
16
26
  } & Record<string, any>;
17
- export type EdgeHttpFailure = {
27
+ /**
28
+ * This is the shape of the error response from the Edge service,
29
+ * when the error is gracefully handled, the Response will be an object with this shape and have status code 200.
30
+ */
31
+ export type EdgeFailure = {
32
+ /**
33
+ * Branded Type.
34
+ */
18
35
  success: false;
19
36
  /**
20
37
  * An explanation of why the call failed. Used mostly for logging and monitoring.
21
38
  */
22
- reason: string;
39
+ message: string;
40
+ /**
41
+ * Cause Error captured on the EDGE service to aid debugging on the client.
42
+ */
43
+ error?: SerializedError;
23
44
  /**
24
45
  * Information that can be used to retry the request such that it will succeed, for example:
25
46
  * 1. { type: 'auth_required', challenge: string }
@@ -27,12 +48,62 @@ export type EdgeHttpFailure = {
27
48
  * 2. { type: 'user_confirmation_required', dialog: { title: string, message: string, confirmation_payload: string } }
28
49
  * Requires showing a confirmation dialog to a user and retrying the request with confirmation_payload included
29
50
  * if the user confirms.
30
- * When errorData is returned simply retrying the request won't have any effect.
31
- * EdgeHttpClient should parse well-known errorData into Error types and throw.
51
+ * When data is returned simply retrying the request won't have any effect.
52
+ * EdgeHttpClient should parse well-known data into Error types and throw.
32
53
  */
33
- errorData?: EdgeErrorData;
54
+ data?: EdgeErrorData;
34
55
  };
35
- export type EdgeHttpResponse<T> = EdgeHttpSuccess<T> | EdgeHttpFailure;
56
+ /**
57
+ * Represents a body response from the Edge service.
58
+ */
59
+ export type EdgeEnvelope<T> = EdgeSuccess<T> | EdgeFailure;
60
+ /**
61
+ * Use this to create a response from the Edge service.
62
+ */
63
+ export declare const EdgeResponse: Readonly<{
64
+ success: <T>(data: T, status?: number) => Response;
65
+ failure: ({ message, error, errorEncoded, data, shouldRetryAfter, status, }: {
66
+ /**
67
+ * An explanation of why the call failed. Used mostly for logging and monitoring.
68
+ */
69
+ message: string;
70
+ /**
71
+ * Error that caused the failure.
72
+ * Useful for debugging.
73
+ *
74
+ * Use only one of the fields `error` or `errorEncoded`.s
75
+ */
76
+ error?: Error;
77
+ /**
78
+ * Encoded Error that caused the failure.
79
+ * Useful for debugging.
80
+ *
81
+ * Use only one of the fields `error` or `errorEncoded`.
82
+ */
83
+ errorEncoded?: SerializedError;
84
+ /**
85
+ * Information that can be used to retry the request such that it will succeed, for example:
86
+ * 1. { type: 'auth_required', challenge: string }
87
+ * Requires retrying the request with challenge signature included.
88
+ * 2. { type: 'user_confirmation_required', dialog: { title: string, message: string, confirmation_payload: string } }
89
+ * Requires showing a confirmation dialog to a user and retrying the request with confirmation_payload included
90
+ * if the user confirms.
91
+ * When data is returned simply retrying the request won't have any effect.
92
+ * EdgeHttpClient should parse well-known data into Error types and throw.
93
+ */
94
+ data?: EdgeErrorData;
95
+ /**
96
+ * If provided, this request will be marked as retryable and the client will wait for the specified number of milliseconds before retrying.
97
+ * If not provided, the client will not retry the request.
98
+ */
99
+ shouldRetryAfter?: number;
100
+ /**
101
+ * Status code of the response.
102
+ * @default 500
103
+ */
104
+ status?: number;
105
+ }) => Response;
106
+ }>;
36
107
  export type GetNotarizationResponseBody = {
37
108
  awaitingNotarization: {
38
109
  credentials: string[];
@@ -98,7 +169,21 @@ export type UploadFunctionRequest = {
98
169
  ownerPublicKey: string;
99
170
  entryPoint: string;
100
171
  assets: Record<string, Uint8Array>;
172
+ /**
173
+ * Runtime in Edge that will be used to run the function.
174
+ * Runtime cannot be changed once the function was deployed.
175
+ * @default Runtime.WORKERS_FOR_PLATFORMS
176
+ */
177
+ runtime?: FunctionRuntimeKind;
101
178
  };
179
+ /**
180
+ * Note: Do not change the values of these enums, this values are stored in the FunctionVersions database.
181
+ */
182
+ export declare const FunctionRuntimeKind: Schema.Enums<{
183
+ WORKERS_FOR_PLATFORMS: string;
184
+ WORKER_LOADER: string;
185
+ }>;
186
+ export type FunctionRuntimeKind = Schema.Schema.Type<typeof FunctionRuntimeKind>;
102
187
  export type UploadFunctionResponseBody = {
103
188
  functionId: string;
104
189
  version: string;
@@ -147,7 +232,7 @@ export declare const InitiateOAuthFlowRequestSchema: Schema.Struct<{
147
232
  provider: Schema.Enums<typeof OAuthProvider>;
148
233
  spaceId: Schema.refine<string & {
149
234
  __SpaceId: true;
150
- }, Schema.Schema<string, string, never>>;
235
+ }, Schema.Schema<unknown, string, never>>;
151
236
  accessTokenId: typeof Schema.String;
152
237
  scopes: Schema.mutable<Schema.Array$<typeof Schema.String>>;
153
238
  noRefresh: Schema.optional<typeof Schema.Boolean>;
@@ -239,8 +324,23 @@ export type ExportBundleResponse = {
239
324
  mutation: string;
240
325
  }[];
241
326
  };
242
- export declare const DocumentCodec: {
327
+ export declare const DocumentCodec: Readonly<{
243
328
  encode: (doc: Uint8Array) => string;
244
329
  decode: (doc: string) => Uint8Array<ArrayBuffer>;
245
- };
330
+ }>;
331
+ /**
332
+ * Codec for serializing and deserializing Edge Errors.
333
+ */
334
+ export declare const ErrorCodec: Readonly<{
335
+ encode: (err: Error, depth?: number) => SerializedError;
336
+ decode: (serializedError: SerializedError, depth?: number) => Error;
337
+ }>;
338
+ /**
339
+ * Codec for serializing and deserializing Edge unhandled HTTP errors.
340
+ */
341
+ export declare const EdgeHttpErrorCodec: Readonly<{
342
+ encode: (err: Error) => Response;
343
+ decode: (response: Response) => Promise<Error | undefined>;
344
+ }>;
345
+ export {};
246
346
  //# sourceMappingURL=edge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edge.d.ts","sourceRoot":"","sources":["../../../src/edge/edge.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAIrC,oBAAY,WAAW;IACrB,oBAAoB,yBAAyB;IAC7C,eAAe,oBAAoB;IACnC,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAED,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;IAC3B,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE,CAAC,CAAC;CACT,CAAC;AAEF,QAAA,MAAM,gBAAgB;;;;;;EAMpB,CAAC;AACH,MAAM,WAAW,eAAgB,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,gBAAgB,CAAC;CAAG;AACvF,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,eAAe,EAAE,KAAK,CAAoB,CAAC;AAExG,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAEnE;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC;IACf;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,KAAK,CAAC,EAAE,eAAe,CAA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AAM,EAAE,CAAC;KACjB,EAAE,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE;QACN;;WAEG;QACH,UAAU,EAAE,MAAM,CAAC;QACnB;;WAEG;QACH,QAAQ,EAAE,MAAM,CAAC;KAClB,EAAE,CAAC;CACL,CAAC;AAEF,eAAO,MAAM,aAAa;kBACV,UAAU;kBACV,MAAM;EACpB,CAAC;AAIH;;GAEG;AACH,eAAO,MAAM,UAAU;kBACP,KAAK,UAAS,MAAM,KAAO,eAAe;8BAM9B,eAAe,UAAS,MAAM,KAAO,KAAK;EAkCpE,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB;kBACf,KAAK,KAAG,QAAQ;uBAQL,QAAQ,KAAG,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC;EAa9D,CAAC"}
@@ -0,0 +1,160 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+ import * as Schema from 'effect/Schema';
5
+ import { BaseError } from '@dxos/errors';
6
+ import { invariant } from '@dxos/invariant';
7
+ import { SpaceId } from '@dxos/keys';
8
+ // TODO(burdon): Rename EdgerRouterEndpoint.
9
+ // If we would rename it, we need to be careful to not break composer production.
10
+ export var EdgeService;
11
+ (function (EdgeService) {
12
+ EdgeService["AUTOMERGE_REPLICATOR"] = "automerge-replicator";
13
+ EdgeService["FEED_REPLICATOR"] = "feed-replicator";
14
+ EdgeService["SWARM"] = "swarm";
15
+ EdgeService["SIGNAL"] = "signal";
16
+ EdgeService["STATUS"] = "status";
17
+ })(EdgeService || (EdgeService = {}));
18
+ const _SerializedError = Schema.Struct({
19
+ name: Schema.optional(Schema.String),
20
+ message: Schema.optional(Schema.String),
21
+ context: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),
22
+ stack: Schema.optional(Schema.String),
23
+ cause: Schema.optional(Schema.suspend(() => SerializedError)),
24
+ });
25
+ export const SerializedError = _SerializedError;
26
+ /**
27
+ * Use this to create a response from the Edge service.
28
+ */
29
+ export const EdgeResponse = Object.freeze({
30
+ success: (data, status = 200) => {
31
+ invariant(status >= 200 && status < 300, 'Status code must be in the 2xx range');
32
+ const headers = new Headers({ 'Content-Type': 'application/json' });
33
+ return new Response(JSON.stringify({
34
+ success: true,
35
+ data,
36
+ }), {
37
+ status,
38
+ headers,
39
+ });
40
+ },
41
+ failure: ({ message, error, errorEncoded, data, shouldRetryAfter, status = 500, }) => {
42
+ const headers = new Headers({ 'Content-Type': 'application/json' });
43
+ if (shouldRetryAfter) {
44
+ headers.set('Retry-After', String(shouldRetryAfter));
45
+ }
46
+ return new Response(JSON.stringify({
47
+ success: false,
48
+ message,
49
+ data,
50
+ error: error ? ErrorCodec.encode(error) : errorEncoded,
51
+ }), {
52
+ status,
53
+ headers,
54
+ });
55
+ },
56
+ });
57
+ /**
58
+ * Note: Do not change the values of these enums, this values are stored in the FunctionVersions database.
59
+ */
60
+ export const FunctionRuntimeKind = Schema.Enums({
61
+ // https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
62
+ WORKERS_FOR_PLATFORMS: 'WORKERS_FOR_PLATFORMS',
63
+ // https://developers.cloudflare.com/workers/runtime-apis/bindings/worker-loader/
64
+ WORKER_LOADER: 'WORKER_LOADER',
65
+ });
66
+ export var EdgeAgentStatus;
67
+ (function (EdgeAgentStatus) {
68
+ EdgeAgentStatus["ACTIVE"] = "active";
69
+ EdgeAgentStatus["INACTIVE"] = "inactive";
70
+ EdgeAgentStatus["NOT_FOUND"] = "not_found";
71
+ })(EdgeAgentStatus || (EdgeAgentStatus = {}));
72
+ export var OAuthProvider;
73
+ (function (OAuthProvider) {
74
+ OAuthProvider["GOOGLE"] = "google";
75
+ OAuthProvider["BLUESKY"] = "bluesky";
76
+ })(OAuthProvider || (OAuthProvider = {}));
77
+ export const InitiateOAuthFlowRequestSchema = Schema.Struct({
78
+ provider: Schema.Enums(OAuthProvider),
79
+ spaceId: Schema.String.pipe(Schema.filter(SpaceId.isValid)), // TODO(burdon): Use SpaceId.
80
+ accessTokenId: Schema.String,
81
+ scopes: Schema.mutable(Schema.Array(Schema.String)),
82
+ // Set to true if we don't want periodic token refreshes in background, for cases like account connect
83
+ noRefresh: Schema.optional(Schema.Boolean),
84
+ // Provider-specific (user handle or did for bluesky) hint for auth server resolution
85
+ loginHint: Schema.optional(Schema.String),
86
+ });
87
+ export var EdgeWebsocketProtocol;
88
+ (function (EdgeWebsocketProtocol) {
89
+ EdgeWebsocketProtocol["V0"] = "edge-ws-v0";
90
+ /**
91
+ * Enables message framing and muxing by service-id.
92
+ */
93
+ EdgeWebsocketProtocol["V1"] = "edge-ws-v1";
94
+ })(EdgeWebsocketProtocol || (EdgeWebsocketProtocol = {}));
95
+ export const DocumentCodec = Object.freeze({
96
+ encode: (doc) => Buffer.from(doc).toString('base64'),
97
+ decode: (doc) => new Uint8Array(Buffer.from(doc, 'base64')),
98
+ });
99
+ const MAX_ERROR_DEPTH = 3;
100
+ /**
101
+ * Codec for serializing and deserializing Edge Errors.
102
+ */
103
+ export const ErrorCodec = Object.freeze({
104
+ encode: (err, depth = 0) => ({
105
+ name: 'name' in err ? err.name : err.code || 'Error',
106
+ message: err.message,
107
+ stack: err.stack,
108
+ cause: err.cause instanceof Error && depth < MAX_ERROR_DEPTH ? ErrorCodec.encode(err.cause, depth + 1) : undefined,
109
+ }),
110
+ decode: (serializedError, depth = 0) => {
111
+ let err;
112
+ if (typeof serializedError.name === 'string') {
113
+ err = new BaseError(serializedError.name, {
114
+ message: serializedError.message ?? 'Unknown error',
115
+ cause: serializedError.cause && depth < MAX_ERROR_DEPTH
116
+ ? ErrorCodec.decode(serializedError.cause, depth + 1)
117
+ : undefined,
118
+ context: serializedError.context,
119
+ });
120
+ if (serializedError.stack) {
121
+ Object.defineProperty(err, 'stack', {
122
+ value: serializedError.stack,
123
+ });
124
+ }
125
+ }
126
+ else {
127
+ err = new Error(serializedError.message ?? 'Unknown error', {
128
+ cause: serializedError.cause && depth < MAX_ERROR_DEPTH
129
+ ? ErrorCodec.decode(serializedError.cause, depth + 1)
130
+ : undefined,
131
+ });
132
+ if (serializedError.stack) {
133
+ Object.defineProperty(err, 'stack', {
134
+ value: serializedError.stack,
135
+ });
136
+ }
137
+ }
138
+ return err;
139
+ },
140
+ });
141
+ /**
142
+ * Codec for serializing and deserializing Edge unhandled HTTP errors.
143
+ */
144
+ export const EdgeHttpErrorCodec = Object.freeze({
145
+ encode: (err) => new Response(JSON.stringify({
146
+ error: ErrorCodec.encode(err),
147
+ }), { status: 500 }),
148
+ decode: async (response) => {
149
+ if (response.headers.get('Content-Type') !== 'application/json') {
150
+ const body = await response.clone().text();
151
+ return new Error(body.slice(0, 256));
152
+ }
153
+ const body = await response.clone().json();
154
+ if (!('error' in body)) {
155
+ return undefined;
156
+ }
157
+ return ErrorCodec.decode(body.error);
158
+ },
159
+ });
160
+ //# sourceMappingURL=edge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edge.js","sourceRoot":"","sources":["../../../src/edge/edge.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AAEF,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,4CAA4C;AAC5C,iFAAiF;AACjF,MAAM,CAAN,IAAY,WAMX;AAND,WAAY,WAAW;IACrB,4DAA6C,CAAA;IAC7C,kDAAmC,CAAA;IACnC,8BAAe,CAAA;IACf,gCAAiB,CAAA;IACjB,gCAAiB,CAAA;AACnB,CAAC,EANW,WAAW,KAAX,WAAW,QAMtB;AAOD,MAAM,gBA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CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9C,MAAM,EAAE,CAAC,GAAU,EAAY,EAAE,CAC/B,IAAI,QAAQ,CACV,IAAI,CAAC,SAAS,CAAC;QACb,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC;KAC9B,CAAC,EACF,EAAE,MAAM,EAAE,GAAG,EAAE,CAChB;IAEH,MAAM,EAAE,KAAK,EAAE,QAAkB,EAA8B,EAAE;QAC/D,IAAI,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,kBAAkB,EAAE,CAAC;YAChE,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC;YAC3C,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;QACvC,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC;QAC3C,IAAI,CAAC,CAAC,OAAO,IAAI,IAAI,CAAC,EAAE,CAAC;YACvB,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,OAAO,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { type EdgeErrorData, type EdgeFailure } from './edge.js';
2
+ /**
3
+ * Error thrown when a call to the Edge service fails.
4
+ * There 3 possible sources of failure:
5
+ * 1. EdgeFailure (JSON body with { success: false }) -> Processing the request failed and was gracefully handled by EDGE service.
6
+ * 2. Http failure (non-ok code) -> The HTTP request failed (e.g. timeout, network error).
7
+ * -> Unhandled exception on EDGE side, EDGE would provide serialized error in the response body.
8
+ * 3. Processing failure -> Unhandled exception on client side while processing the response.
9
+ */
10
+ export declare class EdgeCallFailedError extends Error {
11
+ static fromUnsuccessfulResponse(response: Response, body: EdgeFailure): EdgeCallFailedError;
12
+ static fromHttpFailure(response: Response): Promise<EdgeCallFailedError>;
13
+ static fromProcessingFailureCause(cause: Error): EdgeCallFailedError;
14
+ readonly data?: EdgeErrorData;
15
+ readonly isRetryable?: boolean;
16
+ readonly retryAfterMs?: number;
17
+ constructor(args: {
18
+ message: string;
19
+ isRetryable?: boolean;
20
+ data?: EdgeErrorData;
21
+ retryAfterMs?: number;
22
+ cause?: Error;
23
+ });
24
+ }
25
+ export declare class EdgeAuthChallengeError extends EdgeCallFailedError {
26
+ readonly challenge: string;
27
+ constructor(challenge: string, data: EdgeErrorData);
28
+ }
29
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/edge/errors.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,WAAW,EAAkC,MAAM,WAAW,CAAC;AAGjG;;;;;;;GAOG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;WAC9B,wBAAwB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,GAAG,mBAAmB;WAY9E,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,mBAAmB,CAAC;WASvE,0BAA0B,CAAC,KAAK,EAAE,KAAK,GAAG,mBAAmB;IAQ3E,QAAQ,CAAC,IAAI,CAAC,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;gBAEnB,IAAI,EAAE;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,IAAI,CAAC,EAAE,aAAa,CAAC;QACrB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,KAAK,CAAC,EAAE,KAAK,CAAC;KACf;CAOF;AAED,qBAAa,sBAAuB,SAAQ,mBAAmB;aAE3C,SAAS,EAAE,MAAM;gBAAjB,SAAS,EAAE,MAAM,EACjC,IAAI,EAAE,aAAa;CAItB"}