@dxos/protocols 0.8.4-main.dedc0f3 → 0.8.4-main.e8ec1fe

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 (271) hide show
  1. package/dist/src/FunctionProtocol.d.ts +76 -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/services_pb.d.ts +65 -19
  23. package/dist/src/buf/proto/gen/dxos/client/services_pb.d.ts.map +1 -1
  24. package/dist/src/buf/proto/gen/dxos/client/services_pb.js +28 -23
  25. package/dist/src/buf/proto/gen/dxos/client/services_pb.js.map +1 -1
  26. package/dist/src/buf/proto/gen/dxos/config_pb.d.ts +1 -1
  27. package/dist/src/buf/proto/gen/dxos/config_pb.js +1 -1
  28. package/dist/src/buf/proto/gen/dxos/devtools/diagnostics_pb.d.ts +1 -1
  29. package/dist/src/buf/proto/gen/dxos/devtools/diagnostics_pb.js +1 -1
  30. package/dist/src/buf/proto/gen/dxos/devtools/host_pb.d.ts +1 -1
  31. package/dist/src/buf/proto/gen/dxos/devtools/host_pb.js +1 -1
  32. package/dist/src/buf/proto/gen/dxos/devtools/swarm_pb.d.ts +1 -1
  33. package/dist/src/buf/proto/gen/dxos/devtools/swarm_pb.js +1 -1
  34. package/dist/src/buf/proto/gen/dxos/echo/blob_pb.d.ts +1 -1
  35. package/dist/src/buf/proto/gen/dxos/echo/blob_pb.js +1 -1
  36. package/dist/src/buf/proto/gen/dxos/echo/feed_pb.d.ts +1 -1
  37. package/dist/src/buf/proto/gen/dxos/echo/feed_pb.js +1 -1
  38. package/dist/src/buf/proto/gen/dxos/echo/filter_pb.d.ts +1 -1
  39. package/dist/src/buf/proto/gen/dxos/echo/filter_pb.js +1 -1
  40. package/dist/src/buf/proto/gen/dxos/echo/indexing_pb.d.ts +1 -1
  41. package/dist/src/buf/proto/gen/dxos/echo/indexing_pb.js +1 -1
  42. package/dist/src/buf/proto/gen/dxos/echo/metadata_pb.d.ts +1 -1
  43. package/dist/src/buf/proto/gen/dxos/echo/metadata_pb.js +1 -1
  44. package/dist/src/buf/proto/gen/dxos/echo/model/document_pb.d.ts +1 -1
  45. package/dist/src/buf/proto/gen/dxos/echo/model/document_pb.js +1 -1
  46. package/dist/src/buf/proto/gen/dxos/echo/model/messenger_pb.d.ts +1 -1
  47. package/dist/src/buf/proto/gen/dxos/echo/model/messenger_pb.js +1 -1
  48. package/dist/src/buf/proto/gen/dxos/echo/model/text_pb.d.ts +1 -1
  49. package/dist/src/buf/proto/gen/dxos/echo/model/text_pb.js +1 -1
  50. package/dist/src/buf/proto/gen/dxos/echo/object_pb.d.ts +1 -1
  51. package/dist/src/buf/proto/gen/dxos/echo/object_pb.js +1 -1
  52. package/dist/src/buf/proto/gen/dxos/echo/query_pb.d.ts +1 -1
  53. package/dist/src/buf/proto/gen/dxos/echo/query_pb.js +1 -1
  54. package/dist/src/buf/proto/gen/dxos/echo/service_pb.d.ts +1 -1
  55. package/dist/src/buf/proto/gen/dxos/echo/service_pb.js +1 -1
  56. package/dist/src/buf/proto/gen/dxos/echo/snapshot_pb.d.ts +1 -1
  57. package/dist/src/buf/proto/gen/dxos/echo/snapshot_pb.js +1 -1
  58. package/dist/src/buf/proto/gen/dxos/echo/timeframe_pb.d.ts +1 -1
  59. package/dist/src/buf/proto/gen/dxos/echo/timeframe_pb.js +1 -1
  60. package/dist/src/buf/proto/gen/dxos/edge/calls_pb.d.ts +1 -1
  61. package/dist/src/buf/proto/gen/dxos/edge/calls_pb.js +1 -1
  62. package/dist/src/buf/proto/gen/dxos/edge/messenger_pb.d.ts +1 -1
  63. package/dist/src/buf/proto/gen/dxos/edge/messenger_pb.js +1 -1
  64. package/dist/src/buf/proto/gen/dxos/edge/signal_pb.d.ts +1 -1
  65. package/dist/src/buf/proto/gen/dxos/edge/signal_pb.js +1 -1
  66. package/dist/src/buf/proto/gen/dxos/error_pb.d.ts +1 -1
  67. package/dist/src/buf/proto/gen/dxos/error_pb.js +1 -1
  68. package/dist/src/buf/proto/gen/dxos/field_options_pb.d.ts +1 -1
  69. package/dist/src/buf/proto/gen/dxos/field_options_pb.js +1 -1
  70. package/dist/src/buf/proto/gen/dxos/google_pb.d.ts +1 -1
  71. package/dist/src/buf/proto/gen/dxos/google_pb.js +2 -2
  72. package/dist/src/buf/proto/gen/dxos/gravity_pb.d.ts +1 -1
  73. package/dist/src/buf/proto/gen/dxos/gravity_pb.js +1 -1
  74. package/dist/src/buf/proto/gen/dxos/halo/credentials/auth_pb.d.ts +1 -1
  75. package/dist/src/buf/proto/gen/dxos/halo/credentials/auth_pb.js +1 -1
  76. package/dist/src/buf/proto/gen/dxos/halo/credentials/greet_pb.d.ts +1 -1
  77. package/dist/src/buf/proto/gen/dxos/halo/credentials/greet_pb.js +1 -1
  78. package/dist/src/buf/proto/gen/dxos/halo/credentials/identity_pb.d.ts +1 -1
  79. package/dist/src/buf/proto/gen/dxos/halo/credentials/identity_pb.js +1 -1
  80. package/dist/src/buf/proto/gen/dxos/halo/credentials_pb.d.ts +1 -1
  81. package/dist/src/buf/proto/gen/dxos/halo/credentials_pb.js +1 -1
  82. package/dist/src/buf/proto/gen/dxos/halo/invitations_pb.d.ts +1 -1
  83. package/dist/src/buf/proto/gen/dxos/halo/invitations_pb.js +1 -1
  84. package/dist/src/buf/proto/gen/dxos/halo/keyring_pb.d.ts +1 -1
  85. package/dist/src/buf/proto/gen/dxos/halo/keyring_pb.js +1 -1
  86. package/dist/src/buf/proto/gen/dxos/halo/keys_pb.d.ts +1 -1
  87. package/dist/src/buf/proto/gen/dxos/halo/keys_pb.js +1 -1
  88. package/dist/src/buf/proto/gen/dxos/halo/signed_pb.d.ts +1 -1
  89. package/dist/src/buf/proto/gen/dxos/halo/signed_pb.js +1 -1
  90. package/dist/src/buf/proto/gen/dxos/iframe_pb.d.ts +1 -1
  91. package/dist/src/buf/proto/gen/dxos/iframe_pb.js +1 -1
  92. package/dist/src/buf/proto/gen/dxos/keys_pb.d.ts +1 -1
  93. package/dist/src/buf/proto/gen/dxos/keys_pb.js +1 -1
  94. package/dist/src/buf/proto/gen/dxos/mesh/bridge_pb.d.ts +1 -1
  95. package/dist/src/buf/proto/gen/dxos/mesh/bridge_pb.js +1 -1
  96. package/dist/src/buf/proto/gen/dxos/mesh/broadcast_pb.d.ts +1 -1
  97. package/dist/src/buf/proto/gen/dxos/mesh/broadcast_pb.js +1 -1
  98. package/dist/src/buf/proto/gen/dxos/mesh/messaging_pb.d.ts +1 -1
  99. package/dist/src/buf/proto/gen/dxos/mesh/messaging_pb.js +1 -1
  100. package/dist/src/buf/proto/gen/dxos/mesh/muxer_pb.d.ts +1 -1
  101. package/dist/src/buf/proto/gen/dxos/mesh/muxer_pb.js +1 -1
  102. package/dist/src/buf/proto/gen/dxos/mesh/presence_pb.d.ts +1 -1
  103. package/dist/src/buf/proto/gen/dxos/mesh/presence_pb.js +1 -1
  104. package/dist/src/buf/proto/gen/dxos/mesh/protocol_pb.d.ts +1 -1
  105. package/dist/src/buf/proto/gen/dxos/mesh/protocol_pb.js +1 -1
  106. package/dist/src/buf/proto/gen/dxos/mesh/replicator_pb.d.ts +1 -1
  107. package/dist/src/buf/proto/gen/dxos/mesh/replicator_pb.js +1 -1
  108. package/dist/src/buf/proto/gen/dxos/mesh/signal_pb.d.ts +1 -1
  109. package/dist/src/buf/proto/gen/dxos/mesh/signal_pb.js +1 -1
  110. package/dist/src/buf/proto/gen/dxos/mesh/swarm_pb.d.ts +1 -1
  111. package/dist/src/buf/proto/gen/dxos/mesh/swarm_pb.js +1 -1
  112. package/dist/src/buf/proto/gen/dxos/mesh/teleport/admission-discovery_pb.d.ts +1 -1
  113. package/dist/src/buf/proto/gen/dxos/mesh/teleport/admission-discovery_pb.js +1 -1
  114. package/dist/src/buf/proto/gen/dxos/mesh/teleport/auth_pb.d.ts +1 -1
  115. package/dist/src/buf/proto/gen/dxos/mesh/teleport/auth_pb.js +1 -1
  116. package/dist/src/buf/proto/gen/dxos/mesh/teleport/automerge_pb.d.ts +1 -1
  117. package/dist/src/buf/proto/gen/dxos/mesh/teleport/automerge_pb.js +1 -1
  118. package/dist/src/buf/proto/gen/dxos/mesh/teleport/blobsync_pb.d.ts +1 -1
  119. package/dist/src/buf/proto/gen/dxos/mesh/teleport/blobsync_pb.js +1 -1
  120. package/dist/src/buf/proto/gen/dxos/mesh/teleport/control_pb.d.ts +1 -1
  121. package/dist/src/buf/proto/gen/dxos/mesh/teleport/control_pb.js +1 -1
  122. package/dist/src/buf/proto/gen/dxos/mesh/teleport/gossip_pb.d.ts +1 -1
  123. package/dist/src/buf/proto/gen/dxos/mesh/teleport/gossip_pb.js +1 -1
  124. package/dist/src/buf/proto/gen/dxos/mesh/teleport/notarization_pb.d.ts +1 -1
  125. package/dist/src/buf/proto/gen/dxos/mesh/teleport/notarization_pb.js +1 -1
  126. package/dist/src/buf/proto/gen/dxos/mesh/teleport/replicator_pb.d.ts +1 -1
  127. package/dist/src/buf/proto/gen/dxos/mesh/teleport/replicator_pb.js +1 -1
  128. package/dist/src/buf/proto/gen/dxos/registry_pb.d.ts +1 -1
  129. package/dist/src/buf/proto/gen/dxos/registry_pb.js +1 -1
  130. package/dist/src/buf/proto/gen/dxos/rpc_pb.d.ts +1 -1
  131. package/dist/src/buf/proto/gen/dxos/rpc_pb.js +1 -1
  132. package/dist/src/buf/proto/gen/dxos/service/agentmanager_pb.d.ts +1 -1
  133. package/dist/src/buf/proto/gen/dxos/service/agentmanager_pb.js +1 -1
  134. package/dist/src/buf/proto/gen/dxos/service/publisher_pb.d.ts +1 -1
  135. package/dist/src/buf/proto/gen/dxos/service/publisher_pb.js +1 -1
  136. package/dist/src/buf/proto/gen/dxos/service/supervisor_pb.d.ts +1 -1
  137. package/dist/src/buf/proto/gen/dxos/service/supervisor_pb.js +1 -1
  138. package/dist/src/buf/proto/gen/dxos/service/tunnel_pb.d.ts +1 -1
  139. package/dist/src/buf/proto/gen/dxos/service/tunnel_pb.js +1 -1
  140. package/dist/src/buf/proto/gen/dxos/tracing_pb.d.ts +1 -1
  141. package/dist/src/buf/proto/gen/dxos/tracing_pb.js +2 -2
  142. package/dist/src/buf/proto/gen/dxos/type_pb.d.ts +1 -1
  143. package/dist/src/buf/proto/gen/dxos/type_pb.js +1 -1
  144. package/dist/src/buf/proto/gen/dxos/value_pb.d.ts +1 -1
  145. package/dist/src/buf/proto/gen/dxos/value_pb.js +1 -1
  146. package/dist/src/buf/proto/gen/example/testing/data_pb.d.ts +1 -1
  147. package/dist/src/buf/proto/gen/example/testing/data_pb.js +1 -1
  148. package/dist/src/buf/proto/gen/example/testing/rpc_pb.d.ts +1 -1
  149. package/dist/src/buf/proto/gen/example/testing/rpc_pb.js +1 -1
  150. package/dist/src/edge-error.d.ts +11 -7
  151. package/dist/src/edge-error.d.ts.map +1 -1
  152. package/dist/src/edge-error.js +23 -53
  153. package/dist/src/edge-error.js.map +1 -1
  154. package/dist/src/edge.d.ts +93 -6
  155. package/dist/src/edge.d.ts.map +1 -1
  156. package/dist/src/edge.js +109 -3
  157. package/dist/src/edge.js.map +1 -1
  158. package/dist/src/errors/base-errors.d.ts.map +1 -1
  159. package/dist/src/errors/base-errors.js +1 -1
  160. package/dist/src/errors/base-errors.js.map +1 -1
  161. package/dist/src/index.d.ts +8 -7
  162. package/dist/src/index.d.ts.map +1 -1
  163. package/dist/src/index.js +7 -6
  164. package/dist/src/index.js.map +1 -1
  165. package/dist/src/indexing.d.ts +1 -1
  166. package/dist/src/indexing.d.ts.map +1 -1
  167. package/dist/src/indexing.js +1 -1
  168. package/dist/src/indexing.js.map +1 -1
  169. package/dist/src/invitation.d.ts +1 -1
  170. package/dist/src/invitation.d.ts.map +1 -1
  171. package/dist/src/invitation.js +1 -1
  172. package/dist/src/invitation.js.map +1 -1
  173. package/dist/src/proto/gen/dxos/client/services.d.ts +30 -3
  174. package/dist/src/proto/gen/dxos/client/services.d.ts.map +1 -1
  175. package/dist/src/proto/gen/dxos/client/services.js +9 -6
  176. package/dist/src/proto/gen/dxos/client/services.js.map +1 -1
  177. package/dist/src/proto/gen/google/protobuf.d.ts +8 -8
  178. package/dist/src/proto/gen/google/protobuf.d.ts.map +1 -1
  179. package/dist/src/proto/gen/google/protobuf.js.map +1 -1
  180. package/dist/src/proto/gen/index.d.ts +1 -0
  181. package/dist/src/proto/gen/index.d.ts.map +1 -1
  182. package/dist/src/proto/gen/index.js +1 -1
  183. package/dist/src/proto/gen/index.js.map +1 -1
  184. package/dist/src/queue.d.ts +9 -0
  185. package/dist/src/queue.d.ts.map +1 -1
  186. package/dist/src/queue.js.map +1 -1
  187. package/dist/tsconfig.tsbuildinfo +1 -1
  188. package/package.json +13 -16
  189. package/src/FunctionProtocol.ts +100 -0
  190. package/src/automerge.ts +8 -0
  191. package/src/buf/proto/gen/dxos/agent/dashboard_pb.ts +3 -3
  192. package/src/buf/proto/gen/dxos/agent/echo-proxy_pb.ts +3 -3
  193. package/src/buf/proto/gen/dxos/agent/epoch_pb.ts +3 -3
  194. package/src/buf/proto/gen/dxos/agent/functions_pb.ts +3 -3
  195. package/src/buf/proto/gen/dxos/bot_pb.ts +3 -3
  196. package/src/buf/proto/gen/dxos/client/invitation_pb.ts +3 -3
  197. package/src/buf/proto/gen/dxos/client/logging_pb.ts +3 -3
  198. package/src/buf/proto/gen/dxos/client/services_pb.ts +84 -29
  199. package/src/buf/proto/gen/dxos/config_pb.ts +3 -3
  200. package/src/buf/proto/gen/dxos/devtools/diagnostics_pb.ts +3 -3
  201. package/src/buf/proto/gen/dxos/devtools/host_pb.ts +3 -3
  202. package/src/buf/proto/gen/dxos/devtools/swarm_pb.ts +3 -3
  203. package/src/buf/proto/gen/dxos/echo/blob_pb.ts +3 -3
  204. package/src/buf/proto/gen/dxos/echo/feed_pb.ts +3 -3
  205. package/src/buf/proto/gen/dxos/echo/filter_pb.ts +3 -3
  206. package/src/buf/proto/gen/dxos/echo/indexing_pb.ts +3 -3
  207. package/src/buf/proto/gen/dxos/echo/metadata_pb.ts +3 -3
  208. package/src/buf/proto/gen/dxos/echo/model/document_pb.ts +3 -3
  209. package/src/buf/proto/gen/dxos/echo/model/messenger_pb.ts +3 -3
  210. package/src/buf/proto/gen/dxos/echo/model/text_pb.ts +3 -3
  211. package/src/buf/proto/gen/dxos/echo/object_pb.ts +3 -3
  212. package/src/buf/proto/gen/dxos/echo/query_pb.ts +3 -3
  213. package/src/buf/proto/gen/dxos/echo/service_pb.ts +3 -3
  214. package/src/buf/proto/gen/dxos/echo/snapshot_pb.ts +3 -3
  215. package/src/buf/proto/gen/dxos/echo/timeframe_pb.ts +3 -3
  216. package/src/buf/proto/gen/dxos/edge/calls_pb.ts +3 -3
  217. package/src/buf/proto/gen/dxos/edge/messenger_pb.ts +3 -3
  218. package/src/buf/proto/gen/dxos/edge/signal_pb.ts +3 -3
  219. package/src/buf/proto/gen/dxos/error_pb.ts +3 -3
  220. package/src/buf/proto/gen/dxos/field_options_pb.ts +3 -3
  221. package/src/buf/proto/gen/dxos/google_pb.ts +3 -3
  222. package/src/buf/proto/gen/dxos/gravity_pb.ts +3 -3
  223. package/src/buf/proto/gen/dxos/halo/credentials/auth_pb.ts +3 -3
  224. package/src/buf/proto/gen/dxos/halo/credentials/greet_pb.ts +3 -3
  225. package/src/buf/proto/gen/dxos/halo/credentials/identity_pb.ts +3 -3
  226. package/src/buf/proto/gen/dxos/halo/credentials_pb.ts +3 -3
  227. package/src/buf/proto/gen/dxos/halo/invitations_pb.ts +3 -3
  228. package/src/buf/proto/gen/dxos/halo/keyring_pb.ts +3 -3
  229. package/src/buf/proto/gen/dxos/halo/keys_pb.ts +3 -3
  230. package/src/buf/proto/gen/dxos/halo/signed_pb.ts +3 -3
  231. package/src/buf/proto/gen/dxos/iframe_pb.ts +3 -3
  232. package/src/buf/proto/gen/dxos/keys_pb.ts +3 -3
  233. package/src/buf/proto/gen/dxos/mesh/bridge_pb.ts +3 -3
  234. package/src/buf/proto/gen/dxos/mesh/broadcast_pb.ts +3 -3
  235. package/src/buf/proto/gen/dxos/mesh/messaging_pb.ts +3 -3
  236. package/src/buf/proto/gen/dxos/mesh/muxer_pb.ts +3 -3
  237. package/src/buf/proto/gen/dxos/mesh/presence_pb.ts +3 -3
  238. package/src/buf/proto/gen/dxos/mesh/protocol_pb.ts +3 -3
  239. package/src/buf/proto/gen/dxos/mesh/replicator_pb.ts +3 -3
  240. package/src/buf/proto/gen/dxos/mesh/signal_pb.ts +3 -3
  241. package/src/buf/proto/gen/dxos/mesh/swarm_pb.ts +3 -3
  242. package/src/buf/proto/gen/dxos/mesh/teleport/admission-discovery_pb.ts +3 -3
  243. package/src/buf/proto/gen/dxos/mesh/teleport/auth_pb.ts +3 -3
  244. package/src/buf/proto/gen/dxos/mesh/teleport/automerge_pb.ts +3 -3
  245. package/src/buf/proto/gen/dxos/mesh/teleport/blobsync_pb.ts +3 -3
  246. package/src/buf/proto/gen/dxos/mesh/teleport/control_pb.ts +3 -3
  247. package/src/buf/proto/gen/dxos/mesh/teleport/gossip_pb.ts +3 -3
  248. package/src/buf/proto/gen/dxos/mesh/teleport/notarization_pb.ts +3 -3
  249. package/src/buf/proto/gen/dxos/mesh/teleport/replicator_pb.ts +3 -3
  250. package/src/buf/proto/gen/dxos/registry_pb.ts +3 -3
  251. package/src/buf/proto/gen/dxos/rpc_pb.ts +3 -3
  252. package/src/buf/proto/gen/dxos/service/agentmanager_pb.ts +3 -3
  253. package/src/buf/proto/gen/dxos/service/publisher_pb.ts +3 -3
  254. package/src/buf/proto/gen/dxos/service/supervisor_pb.ts +3 -3
  255. package/src/buf/proto/gen/dxos/service/tunnel_pb.ts +3 -3
  256. package/src/buf/proto/gen/dxos/tracing_pb.ts +3 -3
  257. package/src/buf/proto/gen/dxos/type_pb.ts +3 -3
  258. package/src/buf/proto/gen/dxos/value_pb.ts +3 -3
  259. package/src/buf/proto/gen/example/testing/data_pb.ts +3 -3
  260. package/src/buf/proto/gen/example/testing/rpc_pb.ts +3 -3
  261. package/src/edge-error.ts +25 -69
  262. package/src/edge.ts +205 -7
  263. package/src/errors/base-errors.ts +2 -1
  264. package/src/index.ts +8 -7
  265. package/src/indexing.ts +1 -1
  266. package/src/invitation.ts +1 -1
  267. package/src/proto/dxos/client/services.proto +20 -3
  268. package/src/proto/gen/dxos/client/services.ts +30 -3
  269. package/src/proto/gen/google/protobuf.ts +8 -8
  270. package/src/proto/gen/index.ts +2 -1
  271. package/src/queue.ts +13 -0
package/src/edge.ts CHANGED
@@ -2,8 +2,10 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
 
7
+ import { BaseError } from '@dxos/errors';
8
+ import { invariant } from '@dxos/invariant';
7
9
  import { SpaceId } from '@dxos/keys';
8
10
 
9
11
  // TODO(burdon): Rename EdgerRouterEndpoint.
@@ -16,20 +18,43 @@ export enum EdgeService {
16
18
  STATUS = 'status',
17
19
  }
18
20
 
19
- export type EdgeHttpSuccess<T> = {
21
+ export type EdgeSuccess<T> = {
20
22
  success: true;
21
23
  data: T;
22
24
  };
23
25
 
26
+ export type SerializedError = {
27
+ code?: string;
28
+ message?: string;
29
+ context?: Record<string, unknown>;
30
+ stack?: string;
31
+ cause?: SerializedError;
32
+ };
33
+
24
34
  export type EdgeErrorData = { type: string } & Record<string, any>;
25
35
 
26
- export type EdgeHttpFailure = {
27
- // TODO(burdon): Why is this required?
36
+ /**
37
+ * This is the shape of the error response from the Edge service,
38
+ * when the error is gracefully handled, the Response will be an object with this shape and have status code 200.
39
+ */
40
+ // TODO(dmaretskyi): Refactor this type to just be { success: false, error: SerializedError }
41
+ // reason -> error.message
42
+ // cause -> error.cause
43
+ // errorData.type -> error.code
44
+ // ...errorData -> error.context
45
+ export type EdgeFailure = {
46
+ /**
47
+ * Branded Type.
48
+ */
28
49
  success: false;
29
50
  /**
30
51
  * An explanation of why the call failed. Used mostly for logging and monitoring.
31
52
  */
32
53
  reason: string;
54
+ /**
55
+ * Cause Error captured on the EDGE service to aid debugging on the client.
56
+ */
57
+ cause?: SerializedError;
33
58
  /**
34
59
  * Information that can be used to retry the request such that it will succeed, for example:
35
60
  * 1. { type: 'auth_required', challenge: string }
@@ -43,7 +68,87 @@ export type EdgeHttpFailure = {
43
68
  errorData?: EdgeErrorData;
44
69
  };
45
70
 
46
- export type EdgeHttpResponse<T> = EdgeHttpSuccess<T> | EdgeHttpFailure;
71
+ /**
72
+ * Represents a body response from the Edge service.
73
+ */
74
+ export type EdgeBody<T> = EdgeSuccess<T> | EdgeFailure;
75
+
76
+ /**
77
+ * Use this to create a response from the Edge service.
78
+ */
79
+ export const EdgeResponse = Object.freeze({
80
+ success: <T>(data: T, status: number = 200): Response => {
81
+ invariant(status >= 200 && status < 300, 'Status code must be in the 2xx range');
82
+ const headers = new Headers({ 'Content-Type': 'application/json' });
83
+ return new Response(
84
+ JSON.stringify({
85
+ success: true,
86
+ data,
87
+ } satisfies EdgeSuccess<T>),
88
+ {
89
+ status,
90
+ headers,
91
+ },
92
+ );
93
+ },
94
+ failure: ({
95
+ reason,
96
+ cause,
97
+ errorData,
98
+ shouldRetryAfter,
99
+ status = 500,
100
+ }: {
101
+ /**
102
+ * An explanation of why the call failed. Used mostly for logging and monitoring.
103
+ */
104
+ reason: string;
105
+ /**
106
+ * Error that caused the failure.
107
+ * Useful for debugging.
108
+ */
109
+ cause?: Error;
110
+ /**
111
+ * Information that can be used to retry the request such that it will succeed, for example:
112
+ * 1. { type: 'auth_required', challenge: string }
113
+ * Requires retrying the request with challenge signature included.
114
+ * 2. { type: 'user_confirmation_required', dialog: { title: string, message: string, confirmation_payload: string } }
115
+ * Requires showing a confirmation dialog to a user and retrying the request with confirmation_payload included
116
+ * if the user confirms.
117
+ * When errorData is returned simply retrying the request won't have any effect.
118
+ * EdgeHttpClient should parse well-known errorData into Error types and throw.
119
+ */
120
+ errorData?: EdgeErrorData;
121
+ /**
122
+ * If provided, this request will be marked as retryable and the client will wait for the specified number of milliseconds before retrying.
123
+ * If not provided, the client will not retry the request.
124
+ */
125
+ shouldRetryAfter?: number;
126
+
127
+ /**
128
+ * Status code of the response.
129
+ * @default 500
130
+ */
131
+ status?: number;
132
+ }): Response => {
133
+ const headers = new Headers({ 'Content-Type': 'application/json' });
134
+ if (shouldRetryAfter) {
135
+ headers.set('Retry-After', String(shouldRetryAfter));
136
+ }
137
+
138
+ return new Response(
139
+ JSON.stringify({
140
+ success: false,
141
+ reason,
142
+ errorData,
143
+ cause: cause ? ErrorCodec.encode(cause) : undefined,
144
+ } satisfies EdgeFailure),
145
+ {
146
+ status,
147
+ headers,
148
+ },
149
+ );
150
+ },
151
+ });
47
152
 
48
153
  export type GetNotarizationResponseBody = {
49
154
  awaitingNotarization: { credentials: string[] };
@@ -122,8 +227,26 @@ export type UploadFunctionRequest = {
122
227
  ownerPublicKey: string;
123
228
  entryPoint: string;
124
229
  assets: Record<string, Uint8Array>;
230
+ /**
231
+ * Runtime in Edge that will be used to run the function.
232
+ * Runtime cannot be changed once the function was deployed.
233
+ * @default Runtime.WORKERS_FOR_PLATFORMS
234
+ */
235
+ runtime?: Runtime;
125
236
  };
126
237
 
238
+ /**
239
+ * Note: Do not change the values of these enums, this values are stored in the FunctionVersions database.
240
+ */
241
+ export enum Runtime {
242
+ // https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
243
+ WORKERS_FOR_PLATFORMS = 'WORKERS_FOR_PLATFORMS',
244
+ // https://developers.cloudflare.com/workers/runtime-apis/bindings/worker-loader/
245
+ WORKER_LOADER = 'WORKER_LOADER',
246
+ // Local worker dispatcher for testing.
247
+ TEST = 'TEST',
248
+ }
249
+
127
250
  export type UploadFunctionResponseBody = {
128
251
  functionId: string;
129
252
  version: string;
@@ -273,7 +396,82 @@ export type ExportBundleResponse = {
273
396
  }[];
274
397
  };
275
398
 
276
- export const DocumentCodec = {
399
+ export const DocumentCodec = Object.freeze({
277
400
  encode: (doc: Uint8Array) => Buffer.from(doc).toString('base64'),
278
401
  decode: (doc: string) => new Uint8Array(Buffer.from(doc, 'base64')),
279
- };
402
+ });
403
+
404
+ const MAX_ERROR_DEPTH = 3;
405
+
406
+ /**
407
+ * Codec for serializing and deserializing Edge Errors.
408
+ */
409
+ export const ErrorCodec = Object.freeze({
410
+ encode: (err: Error, depth: number = 0): SerializedError => ({
411
+ code: 'code' in err ? (err as any).code : undefined,
412
+ message: err.message,
413
+ stack: err.stack,
414
+ cause: err.cause instanceof Error && depth < MAX_ERROR_DEPTH ? ErrorCodec.encode(err.cause, depth + 1) : undefined,
415
+ }),
416
+ decode: (serializedError: SerializedError, depth: number = 0): Error => {
417
+ let err: Error;
418
+ if (typeof serializedError.code === 'string') {
419
+ err = new BaseError(serializedError.code, {
420
+ message: serializedError.message ?? 'Unknown error',
421
+ cause:
422
+ serializedError.cause && depth < MAX_ERROR_DEPTH
423
+ ? ErrorCodec.decode(serializedError.cause, depth + 1)
424
+ : undefined,
425
+ context: serializedError.context,
426
+ });
427
+
428
+ if (serializedError.stack) {
429
+ Object.defineProperty(err, 'stack', {
430
+ value: serializedError.stack,
431
+ });
432
+ }
433
+ } else {
434
+ err = new Error(serializedError.message ?? 'Unknown error', {
435
+ cause:
436
+ serializedError.cause && depth < MAX_ERROR_DEPTH
437
+ ? ErrorCodec.decode(serializedError.cause, depth + 1)
438
+ : undefined,
439
+ });
440
+
441
+ if (serializedError.stack) {
442
+ Object.defineProperty(err, 'stack', {
443
+ value: serializedError.stack,
444
+ });
445
+ }
446
+ }
447
+
448
+ return err;
449
+ },
450
+ });
451
+
452
+ /**
453
+ * Codec for serializing and deserializing Edge unhandled HTTP errors.
454
+ */
455
+ export const EdgeHttpErrorCodec = Object.freeze({
456
+ encode: (err: Error): Response =>
457
+ new Response(
458
+ JSON.stringify({
459
+ error: ErrorCodec.encode(err),
460
+ }),
461
+ { status: 500 },
462
+ ),
463
+
464
+ decode: async (response: Response): Promise<Error | undefined> => {
465
+ if (response.headers.get('Content-Type') !== 'application/json') {
466
+ const body = await response.clone().text();
467
+ return new Error(body.slice(0, 256));
468
+ }
469
+
470
+ const body = await response.clone().json();
471
+ if (!('error' in body)) {
472
+ return undefined;
473
+ }
474
+
475
+ return ErrorCodec.decode(body.error);
476
+ },
477
+ });
@@ -2,11 +2,12 @@
2
2
  // Copyright 2021 DXOS.org
3
3
  //
4
4
 
5
+ // TODO(dmaretskyi): Reconcile with @dxos/errors
6
+
5
7
  /**
6
8
  * NOTE: Messages should be sentences (Start with a capital letter and end with a period).
7
9
  * Errors can optionally include a JSON context object.
8
10
  */
9
- // TODO(dmaretskyi): Duplicate of @dxos/errors
10
11
  export class BaseError extends Error {
11
12
  constructor(
12
13
  readonly code: string,
package/src/index.ts CHANGED
@@ -2,15 +2,16 @@
2
2
  // Copyright 2021 DXOS.org
3
3
  //
4
4
 
5
+ export * from './automerge.js';
6
+ export * from './edge-error.js';
7
+ export * from './edge.js';
5
8
  export * from './errors/index.js';
6
9
  export * from './indexing.js';
7
- export * from './storage.js';
8
- export * from './tracing.js';
9
- export type * from './types.js';
10
- export * from './query.js';
11
10
  export * from './profile-archive.js';
12
- export * from './automerge.js';
13
- export * from './edge.js';
11
+ export * from './query.js';
14
12
  export * from './queue.js';
15
13
  export * from './space-archive.js';
16
- export * from './edge-error.js';
14
+ export * from './storage.js';
15
+ export * from './tracing.js';
16
+ export type * from './types.js';
17
+ export * as FunctionProtocol from './FunctionProtocol.js';
package/src/indexing.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
 
7
7
  export type ObjectPointerDecoded = {
8
8
  spaceKey: string | undefined;
package/src/invitation.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
 
7
7
  import { ParamKeyAnnotation } from '@dxos/effect';
8
8
 
@@ -596,9 +596,26 @@ service EdgeAgentService {
596
596
  rpc QueryAgentStatus(google.protobuf.Empty) returns (stream QueryAgentStatusResponse);
597
597
  }
598
598
 
599
- enum EdgeStatus {
600
- NOT_CONNECTED = 0;
601
- CONNECTED = 1;
599
+ message EdgeStatus {
600
+ enum ConnectionState {
601
+ NOT_CONNECTED = 0;
602
+ CONNECTED = 1;
603
+ }
604
+
605
+ ConnectionState state = 1;
606
+ /** Latency in ms */
607
+ int32 rtt = 2;
608
+
609
+ /** How long the connection has been up */
610
+ int32 uptime = 3;
611
+
612
+ /** Upload rate in bytes per second */
613
+ int32 rate_bytes_up = 4;
614
+ /** Download rate in bytes per second */
615
+ int32 rate_bytes_down = 5;
616
+
617
+ int32 messages_sent = 6;
618
+ int32 messages_received = 7;
602
619
  }
603
620
 
604
621
  message QueryEdgeStatusResponse {
@@ -1399,9 +1399,36 @@ export interface EdgeAgentService {
1399
1399
  * Defined in:
1400
1400
  * {@link file://./../../../dxos/client/services.proto}
1401
1401
  */
1402
- export enum EdgeStatus {
1403
- NOT_CONNECTED = 0,
1404
- CONNECTED = 1
1402
+ export interface EdgeStatus {
1403
+ state: EdgeStatus.ConnectionState;
1404
+ /**
1405
+ * Latency in ms
1406
+ */
1407
+ rtt: number;
1408
+ /**
1409
+ * How long the connection has been up
1410
+ */
1411
+ uptime: number;
1412
+ /**
1413
+ * Upload rate in bytes per second
1414
+ */
1415
+ rateBytesUp: number;
1416
+ /**
1417
+ * Download rate in bytes per second
1418
+ */
1419
+ rateBytesDown: number;
1420
+ messagesSent: number;
1421
+ messagesReceived: number;
1422
+ }
1423
+ export namespace EdgeStatus {
1424
+ /**
1425
+ * Defined in:
1426
+ * {@link file://./../../../dxos/client/services.proto}
1427
+ */
1428
+ export enum ConnectionState {
1429
+ NOT_CONNECTED = 0,
1430
+ CONNECTED = 1
1431
+ }
1405
1432
  }
1406
1433
  /**
1407
1434
  * Defined in:
@@ -67,14 +67,6 @@ import * as example_testing_data from "../example/testing/data.js";
67
67
  import * as example_testing_rpc from "../example/testing/rpc.js";
68
68
  export interface Empty {
69
69
  }
70
- export interface Timestamp {
71
- seconds: string;
72
- nanos: number;
73
- }
74
- export interface Any {
75
- type_url: string;
76
- value: Uint8Array;
77
- }
78
70
  export interface Struct {
79
71
  fields?: Partial<Record<string, Value>>;
80
72
  }
@@ -92,6 +84,14 @@ export enum NullValue {
92
84
  export interface ListValue {
93
85
  values?: Value[];
94
86
  }
87
+ export interface Timestamp {
88
+ seconds: string;
89
+ nanos: number;
90
+ }
91
+ export interface Any {
92
+ type_url: string;
93
+ value: Uint8Array;
94
+ }
95
95
  export interface FileDescriptorSet {
96
96
  file?: FileDescriptorProto[];
97
97
  }