@dxos/protocols 0.8.4-main.a4bbb77 → 0.8.4-main.ae835ea

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 (257) hide show
  1. package/dist/src/automerge.d.ts +8 -0
  2. package/dist/src/automerge.d.ts.map +1 -1
  3. package/dist/src/automerge.js.map +1 -1
  4. package/dist/src/buf/proto/gen/dxos/agent/dashboard_pb.d.ts +1 -1
  5. package/dist/src/buf/proto/gen/dxos/agent/dashboard_pb.js +1 -1
  6. package/dist/src/buf/proto/gen/dxos/agent/echo-proxy_pb.d.ts +1 -1
  7. package/dist/src/buf/proto/gen/dxos/agent/echo-proxy_pb.js +1 -1
  8. package/dist/src/buf/proto/gen/dxos/agent/epoch_pb.d.ts +1 -1
  9. package/dist/src/buf/proto/gen/dxos/agent/epoch_pb.js +1 -1
  10. package/dist/src/buf/proto/gen/dxos/agent/functions_pb.d.ts +1 -1
  11. package/dist/src/buf/proto/gen/dxos/agent/functions_pb.js +1 -1
  12. package/dist/src/buf/proto/gen/dxos/bot_pb.d.ts +1 -1
  13. package/dist/src/buf/proto/gen/dxos/bot_pb.js +1 -1
  14. package/dist/src/buf/proto/gen/dxos/client/invitation_pb.d.ts +1 -1
  15. package/dist/src/buf/proto/gen/dxos/client/invitation_pb.js +1 -1
  16. package/dist/src/buf/proto/gen/dxos/client/logging_pb.d.ts +1 -1
  17. package/dist/src/buf/proto/gen/dxos/client/logging_pb.js +1 -1
  18. package/dist/src/buf/proto/gen/dxos/client/services_pb.d.ts +65 -19
  19. package/dist/src/buf/proto/gen/dxos/client/services_pb.d.ts.map +1 -1
  20. package/dist/src/buf/proto/gen/dxos/client/services_pb.js +28 -23
  21. package/dist/src/buf/proto/gen/dxos/client/services_pb.js.map +1 -1
  22. package/dist/src/buf/proto/gen/dxos/config_pb.d.ts +1 -1
  23. package/dist/src/buf/proto/gen/dxos/config_pb.js +1 -1
  24. package/dist/src/buf/proto/gen/dxos/devtools/diagnostics_pb.d.ts +1 -1
  25. package/dist/src/buf/proto/gen/dxos/devtools/diagnostics_pb.js +1 -1
  26. package/dist/src/buf/proto/gen/dxos/devtools/host_pb.d.ts +1 -1
  27. package/dist/src/buf/proto/gen/dxos/devtools/host_pb.js +1 -1
  28. package/dist/src/buf/proto/gen/dxos/devtools/swarm_pb.d.ts +1 -1
  29. package/dist/src/buf/proto/gen/dxos/devtools/swarm_pb.js +1 -1
  30. package/dist/src/buf/proto/gen/dxos/echo/blob_pb.d.ts +1 -1
  31. package/dist/src/buf/proto/gen/dxos/echo/blob_pb.js +1 -1
  32. package/dist/src/buf/proto/gen/dxos/echo/feed_pb.d.ts +1 -1
  33. package/dist/src/buf/proto/gen/dxos/echo/feed_pb.js +1 -1
  34. package/dist/src/buf/proto/gen/dxos/echo/filter_pb.d.ts +1 -1
  35. package/dist/src/buf/proto/gen/dxos/echo/filter_pb.js +1 -1
  36. package/dist/src/buf/proto/gen/dxos/echo/indexing_pb.d.ts +1 -1
  37. package/dist/src/buf/proto/gen/dxos/echo/indexing_pb.js +1 -1
  38. package/dist/src/buf/proto/gen/dxos/echo/metadata_pb.d.ts +1 -1
  39. package/dist/src/buf/proto/gen/dxos/echo/metadata_pb.js +1 -1
  40. package/dist/src/buf/proto/gen/dxos/echo/model/document_pb.d.ts +1 -1
  41. package/dist/src/buf/proto/gen/dxos/echo/model/document_pb.js +1 -1
  42. package/dist/src/buf/proto/gen/dxos/echo/model/messenger_pb.d.ts +1 -1
  43. package/dist/src/buf/proto/gen/dxos/echo/model/messenger_pb.js +1 -1
  44. package/dist/src/buf/proto/gen/dxos/echo/model/text_pb.d.ts +1 -1
  45. package/dist/src/buf/proto/gen/dxos/echo/model/text_pb.js +1 -1
  46. package/dist/src/buf/proto/gen/dxos/echo/object_pb.d.ts +1 -1
  47. package/dist/src/buf/proto/gen/dxos/echo/object_pb.js +1 -1
  48. package/dist/src/buf/proto/gen/dxos/echo/query_pb.d.ts +1 -1
  49. package/dist/src/buf/proto/gen/dxos/echo/query_pb.js +1 -1
  50. package/dist/src/buf/proto/gen/dxos/echo/service_pb.d.ts +1 -1
  51. package/dist/src/buf/proto/gen/dxos/echo/service_pb.js +1 -1
  52. package/dist/src/buf/proto/gen/dxos/echo/snapshot_pb.d.ts +1 -1
  53. package/dist/src/buf/proto/gen/dxos/echo/snapshot_pb.js +1 -1
  54. package/dist/src/buf/proto/gen/dxos/echo/timeframe_pb.d.ts +1 -1
  55. package/dist/src/buf/proto/gen/dxos/echo/timeframe_pb.js +1 -1
  56. package/dist/src/buf/proto/gen/dxos/edge/calls_pb.d.ts +1 -1
  57. package/dist/src/buf/proto/gen/dxos/edge/calls_pb.js +1 -1
  58. package/dist/src/buf/proto/gen/dxos/edge/messenger_pb.d.ts +1 -1
  59. package/dist/src/buf/proto/gen/dxos/edge/messenger_pb.js +1 -1
  60. package/dist/src/buf/proto/gen/dxos/edge/signal_pb.d.ts +1 -1
  61. package/dist/src/buf/proto/gen/dxos/edge/signal_pb.js +1 -1
  62. package/dist/src/buf/proto/gen/dxos/error_pb.d.ts +1 -1
  63. package/dist/src/buf/proto/gen/dxos/error_pb.js +1 -1
  64. package/dist/src/buf/proto/gen/dxos/field_options_pb.d.ts +1 -1
  65. package/dist/src/buf/proto/gen/dxos/field_options_pb.js +1 -1
  66. package/dist/src/buf/proto/gen/dxos/google_pb.d.ts +1 -1
  67. package/dist/src/buf/proto/gen/dxos/google_pb.js +2 -2
  68. package/dist/src/buf/proto/gen/dxos/gravity_pb.d.ts +1 -1
  69. package/dist/src/buf/proto/gen/dxos/gravity_pb.js +1 -1
  70. package/dist/src/buf/proto/gen/dxos/halo/credentials/auth_pb.d.ts +1 -1
  71. package/dist/src/buf/proto/gen/dxos/halo/credentials/auth_pb.js +1 -1
  72. package/dist/src/buf/proto/gen/dxos/halo/credentials/greet_pb.d.ts +1 -1
  73. package/dist/src/buf/proto/gen/dxos/halo/credentials/greet_pb.js +1 -1
  74. package/dist/src/buf/proto/gen/dxos/halo/credentials/identity_pb.d.ts +1 -1
  75. package/dist/src/buf/proto/gen/dxos/halo/credentials/identity_pb.js +1 -1
  76. package/dist/src/buf/proto/gen/dxos/halo/credentials_pb.d.ts +1 -1
  77. package/dist/src/buf/proto/gen/dxos/halo/credentials_pb.js +1 -1
  78. package/dist/src/buf/proto/gen/dxos/halo/invitations_pb.d.ts +1 -1
  79. package/dist/src/buf/proto/gen/dxos/halo/invitations_pb.js +1 -1
  80. package/dist/src/buf/proto/gen/dxos/halo/keyring_pb.d.ts +1 -1
  81. package/dist/src/buf/proto/gen/dxos/halo/keyring_pb.js +1 -1
  82. package/dist/src/buf/proto/gen/dxos/halo/keys_pb.d.ts +1 -1
  83. package/dist/src/buf/proto/gen/dxos/halo/keys_pb.js +1 -1
  84. package/dist/src/buf/proto/gen/dxos/halo/signed_pb.d.ts +1 -1
  85. package/dist/src/buf/proto/gen/dxos/halo/signed_pb.js +1 -1
  86. package/dist/src/buf/proto/gen/dxos/iframe_pb.d.ts +1 -1
  87. package/dist/src/buf/proto/gen/dxos/iframe_pb.js +1 -1
  88. package/dist/src/buf/proto/gen/dxos/keys_pb.d.ts +1 -1
  89. package/dist/src/buf/proto/gen/dxos/keys_pb.js +1 -1
  90. package/dist/src/buf/proto/gen/dxos/mesh/bridge_pb.d.ts +1 -1
  91. package/dist/src/buf/proto/gen/dxos/mesh/bridge_pb.js +1 -1
  92. package/dist/src/buf/proto/gen/dxos/mesh/broadcast_pb.d.ts +1 -1
  93. package/dist/src/buf/proto/gen/dxos/mesh/broadcast_pb.js +1 -1
  94. package/dist/src/buf/proto/gen/dxos/mesh/messaging_pb.d.ts +1 -1
  95. package/dist/src/buf/proto/gen/dxos/mesh/messaging_pb.js +1 -1
  96. package/dist/src/buf/proto/gen/dxos/mesh/muxer_pb.d.ts +1 -1
  97. package/dist/src/buf/proto/gen/dxos/mesh/muxer_pb.js +1 -1
  98. package/dist/src/buf/proto/gen/dxos/mesh/presence_pb.d.ts +1 -1
  99. package/dist/src/buf/proto/gen/dxos/mesh/presence_pb.js +1 -1
  100. package/dist/src/buf/proto/gen/dxos/mesh/protocol_pb.d.ts +1 -1
  101. package/dist/src/buf/proto/gen/dxos/mesh/protocol_pb.js +1 -1
  102. package/dist/src/buf/proto/gen/dxos/mesh/replicator_pb.d.ts +1 -1
  103. package/dist/src/buf/proto/gen/dxos/mesh/replicator_pb.js +1 -1
  104. package/dist/src/buf/proto/gen/dxos/mesh/signal_pb.d.ts +1 -1
  105. package/dist/src/buf/proto/gen/dxos/mesh/signal_pb.js +1 -1
  106. package/dist/src/buf/proto/gen/dxos/mesh/swarm_pb.d.ts +1 -1
  107. package/dist/src/buf/proto/gen/dxos/mesh/swarm_pb.js +1 -1
  108. package/dist/src/buf/proto/gen/dxos/mesh/teleport/admission-discovery_pb.d.ts +1 -1
  109. package/dist/src/buf/proto/gen/dxos/mesh/teleport/admission-discovery_pb.js +1 -1
  110. package/dist/src/buf/proto/gen/dxos/mesh/teleport/auth_pb.d.ts +1 -1
  111. package/dist/src/buf/proto/gen/dxos/mesh/teleport/auth_pb.js +1 -1
  112. package/dist/src/buf/proto/gen/dxos/mesh/teleport/automerge_pb.d.ts +1 -1
  113. package/dist/src/buf/proto/gen/dxos/mesh/teleport/automerge_pb.js +1 -1
  114. package/dist/src/buf/proto/gen/dxos/mesh/teleport/blobsync_pb.d.ts +1 -1
  115. package/dist/src/buf/proto/gen/dxos/mesh/teleport/blobsync_pb.js +1 -1
  116. package/dist/src/buf/proto/gen/dxos/mesh/teleport/control_pb.d.ts +1 -1
  117. package/dist/src/buf/proto/gen/dxos/mesh/teleport/control_pb.js +1 -1
  118. package/dist/src/buf/proto/gen/dxos/mesh/teleport/gossip_pb.d.ts +1 -1
  119. package/dist/src/buf/proto/gen/dxos/mesh/teleport/gossip_pb.js +1 -1
  120. package/dist/src/buf/proto/gen/dxos/mesh/teleport/notarization_pb.d.ts +1 -1
  121. package/dist/src/buf/proto/gen/dxos/mesh/teleport/notarization_pb.js +1 -1
  122. package/dist/src/buf/proto/gen/dxos/mesh/teleport/replicator_pb.d.ts +1 -1
  123. package/dist/src/buf/proto/gen/dxos/mesh/teleport/replicator_pb.js +1 -1
  124. package/dist/src/buf/proto/gen/dxos/registry_pb.d.ts +1 -1
  125. package/dist/src/buf/proto/gen/dxos/registry_pb.js +1 -1
  126. package/dist/src/buf/proto/gen/dxos/rpc_pb.d.ts +1 -1
  127. package/dist/src/buf/proto/gen/dxos/rpc_pb.js +1 -1
  128. package/dist/src/buf/proto/gen/dxos/service/agentmanager_pb.d.ts +1 -1
  129. package/dist/src/buf/proto/gen/dxos/service/agentmanager_pb.js +1 -1
  130. package/dist/src/buf/proto/gen/dxos/service/publisher_pb.d.ts +1 -1
  131. package/dist/src/buf/proto/gen/dxos/service/publisher_pb.js +1 -1
  132. package/dist/src/buf/proto/gen/dxos/service/supervisor_pb.d.ts +1 -1
  133. package/dist/src/buf/proto/gen/dxos/service/supervisor_pb.js +1 -1
  134. package/dist/src/buf/proto/gen/dxos/service/tunnel_pb.d.ts +1 -1
  135. package/dist/src/buf/proto/gen/dxos/service/tunnel_pb.js +1 -1
  136. package/dist/src/buf/proto/gen/dxos/tracing_pb.d.ts +1 -1
  137. package/dist/src/buf/proto/gen/dxos/tracing_pb.js +2 -2
  138. package/dist/src/buf/proto/gen/dxos/type_pb.d.ts +1 -1
  139. package/dist/src/buf/proto/gen/dxos/type_pb.js +1 -1
  140. package/dist/src/buf/proto/gen/dxos/value_pb.d.ts +1 -1
  141. package/dist/src/buf/proto/gen/dxos/value_pb.js +1 -1
  142. package/dist/src/buf/proto/gen/example/testing/data_pb.d.ts +1 -1
  143. package/dist/src/buf/proto/gen/example/testing/data_pb.js +1 -1
  144. package/dist/src/buf/proto/gen/example/testing/rpc_pb.d.ts +1 -1
  145. package/dist/src/buf/proto/gen/example/testing/rpc_pb.js +1 -1
  146. package/dist/src/edge-error.d.ts +11 -7
  147. package/dist/src/edge-error.d.ts.map +1 -1
  148. package/dist/src/edge-error.js +22 -54
  149. package/dist/src/edge-error.js.map +1 -1
  150. package/dist/src/edge.d.ts +79 -6
  151. package/dist/src/edge.d.ts.map +1 -1
  152. package/dist/src/edge.js +97 -3
  153. package/dist/src/edge.js.map +1 -1
  154. package/dist/src/index.d.ts +7 -7
  155. package/dist/src/index.d.ts.map +1 -1
  156. package/dist/src/index.js +6 -6
  157. package/dist/src/index.js.map +1 -1
  158. package/dist/src/indexing.d.ts +1 -1
  159. package/dist/src/indexing.d.ts.map +1 -1
  160. package/dist/src/indexing.js +1 -1
  161. package/dist/src/indexing.js.map +1 -1
  162. package/dist/src/invitation.d.ts +1 -1
  163. package/dist/src/invitation.d.ts.map +1 -1
  164. package/dist/src/invitation.js +1 -1
  165. package/dist/src/invitation.js.map +1 -1
  166. package/dist/src/proto/gen/dxos/client/services.d.ts +30 -3
  167. package/dist/src/proto/gen/dxos/client/services.d.ts.map +1 -1
  168. package/dist/src/proto/gen/dxos/client/services.js +9 -6
  169. package/dist/src/proto/gen/dxos/client/services.js.map +1 -1
  170. package/dist/src/proto/gen/google/protobuf.d.ts +4 -4
  171. package/dist/src/proto/gen/google/protobuf.d.ts.map +1 -1
  172. package/dist/src/proto/gen/index.d.ts +1 -0
  173. package/dist/src/proto/gen/index.d.ts.map +1 -1
  174. package/dist/src/proto/gen/index.js +1 -1
  175. package/dist/src/proto/gen/index.js.map +1 -1
  176. package/dist/tsconfig.tsbuildinfo +1 -1
  177. package/package.json +12 -15
  178. package/src/automerge.ts +8 -0
  179. package/src/buf/proto/gen/dxos/agent/dashboard_pb.ts +3 -3
  180. package/src/buf/proto/gen/dxos/agent/echo-proxy_pb.ts +3 -3
  181. package/src/buf/proto/gen/dxos/agent/epoch_pb.ts +3 -3
  182. package/src/buf/proto/gen/dxos/agent/functions_pb.ts +3 -3
  183. package/src/buf/proto/gen/dxos/bot_pb.ts +3 -3
  184. package/src/buf/proto/gen/dxos/client/invitation_pb.ts +3 -3
  185. package/src/buf/proto/gen/dxos/client/logging_pb.ts +3 -3
  186. package/src/buf/proto/gen/dxos/client/services_pb.ts +84 -29
  187. package/src/buf/proto/gen/dxos/config_pb.ts +3 -3
  188. package/src/buf/proto/gen/dxos/devtools/diagnostics_pb.ts +3 -3
  189. package/src/buf/proto/gen/dxos/devtools/host_pb.ts +3 -3
  190. package/src/buf/proto/gen/dxos/devtools/swarm_pb.ts +3 -3
  191. package/src/buf/proto/gen/dxos/echo/blob_pb.ts +3 -3
  192. package/src/buf/proto/gen/dxos/echo/feed_pb.ts +3 -3
  193. package/src/buf/proto/gen/dxos/echo/filter_pb.ts +3 -3
  194. package/src/buf/proto/gen/dxos/echo/indexing_pb.ts +3 -3
  195. package/src/buf/proto/gen/dxos/echo/metadata_pb.ts +3 -3
  196. package/src/buf/proto/gen/dxos/echo/model/document_pb.ts +3 -3
  197. package/src/buf/proto/gen/dxos/echo/model/messenger_pb.ts +3 -3
  198. package/src/buf/proto/gen/dxos/echo/model/text_pb.ts +3 -3
  199. package/src/buf/proto/gen/dxos/echo/object_pb.ts +3 -3
  200. package/src/buf/proto/gen/dxos/echo/query_pb.ts +3 -3
  201. package/src/buf/proto/gen/dxos/echo/service_pb.ts +3 -3
  202. package/src/buf/proto/gen/dxos/echo/snapshot_pb.ts +3 -3
  203. package/src/buf/proto/gen/dxos/echo/timeframe_pb.ts +3 -3
  204. package/src/buf/proto/gen/dxos/edge/calls_pb.ts +3 -3
  205. package/src/buf/proto/gen/dxos/edge/messenger_pb.ts +3 -3
  206. package/src/buf/proto/gen/dxos/edge/signal_pb.ts +3 -3
  207. package/src/buf/proto/gen/dxos/error_pb.ts +3 -3
  208. package/src/buf/proto/gen/dxos/field_options_pb.ts +3 -3
  209. package/src/buf/proto/gen/dxos/google_pb.ts +3 -3
  210. package/src/buf/proto/gen/dxos/gravity_pb.ts +3 -3
  211. package/src/buf/proto/gen/dxos/halo/credentials/auth_pb.ts +3 -3
  212. package/src/buf/proto/gen/dxos/halo/credentials/greet_pb.ts +3 -3
  213. package/src/buf/proto/gen/dxos/halo/credentials/identity_pb.ts +3 -3
  214. package/src/buf/proto/gen/dxos/halo/credentials_pb.ts +3 -3
  215. package/src/buf/proto/gen/dxos/halo/invitations_pb.ts +3 -3
  216. package/src/buf/proto/gen/dxos/halo/keyring_pb.ts +3 -3
  217. package/src/buf/proto/gen/dxos/halo/keys_pb.ts +3 -3
  218. package/src/buf/proto/gen/dxos/halo/signed_pb.ts +3 -3
  219. package/src/buf/proto/gen/dxos/iframe_pb.ts +3 -3
  220. package/src/buf/proto/gen/dxos/keys_pb.ts +3 -3
  221. package/src/buf/proto/gen/dxos/mesh/bridge_pb.ts +3 -3
  222. package/src/buf/proto/gen/dxos/mesh/broadcast_pb.ts +3 -3
  223. package/src/buf/proto/gen/dxos/mesh/messaging_pb.ts +3 -3
  224. package/src/buf/proto/gen/dxos/mesh/muxer_pb.ts +3 -3
  225. package/src/buf/proto/gen/dxos/mesh/presence_pb.ts +3 -3
  226. package/src/buf/proto/gen/dxos/mesh/protocol_pb.ts +3 -3
  227. package/src/buf/proto/gen/dxos/mesh/replicator_pb.ts +3 -3
  228. package/src/buf/proto/gen/dxos/mesh/signal_pb.ts +3 -3
  229. package/src/buf/proto/gen/dxos/mesh/swarm_pb.ts +3 -3
  230. package/src/buf/proto/gen/dxos/mesh/teleport/admission-discovery_pb.ts +3 -3
  231. package/src/buf/proto/gen/dxos/mesh/teleport/auth_pb.ts +3 -3
  232. package/src/buf/proto/gen/dxos/mesh/teleport/automerge_pb.ts +3 -3
  233. package/src/buf/proto/gen/dxos/mesh/teleport/blobsync_pb.ts +3 -3
  234. package/src/buf/proto/gen/dxos/mesh/teleport/control_pb.ts +3 -3
  235. package/src/buf/proto/gen/dxos/mesh/teleport/gossip_pb.ts +3 -3
  236. package/src/buf/proto/gen/dxos/mesh/teleport/notarization_pb.ts +3 -3
  237. package/src/buf/proto/gen/dxos/mesh/teleport/replicator_pb.ts +3 -3
  238. package/src/buf/proto/gen/dxos/registry_pb.ts +3 -3
  239. package/src/buf/proto/gen/dxos/rpc_pb.ts +3 -3
  240. package/src/buf/proto/gen/dxos/service/agentmanager_pb.ts +3 -3
  241. package/src/buf/proto/gen/dxos/service/publisher_pb.ts +3 -3
  242. package/src/buf/proto/gen/dxos/service/supervisor_pb.ts +3 -3
  243. package/src/buf/proto/gen/dxos/service/tunnel_pb.ts +3 -3
  244. package/src/buf/proto/gen/dxos/tracing_pb.ts +3 -3
  245. package/src/buf/proto/gen/dxos/type_pb.ts +3 -3
  246. package/src/buf/proto/gen/dxos/value_pb.ts +3 -3
  247. package/src/buf/proto/gen/example/testing/data_pb.ts +3 -3
  248. package/src/buf/proto/gen/example/testing/rpc_pb.ts +3 -3
  249. package/src/edge-error.ts +23 -71
  250. package/src/edge.ts +182 -7
  251. package/src/index.ts +7 -7
  252. package/src/indexing.ts +1 -1
  253. package/src/invitation.ts +1 -1
  254. package/src/proto/dxos/client/services.proto +20 -3
  255. package/src/proto/gen/dxos/client/services.ts +30 -3
  256. package/src/proto/gen/google/protobuf.ts +4 -4
  257. package/src/proto/gen/index.ts +2 -1
@@ -1,30 +1,40 @@
1
1
  //
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
- import { BaseError } from '@dxos/errors';
4
+ import { EdgeHttpErrorCodec, ErrorCodec } from './edge.js';
5
5
  // TODO(burdon): Reconcile with @dxos/errors.
6
+ /**
7
+ * Error thrown when a call to the Edge service fails.
8
+ * There 3 possible sources of failure:
9
+ * 1. EdgeFailure (JSON body with { success: false }) -> Processing the request failed and was gracefully handled by EDGE service.
10
+ * 2. Http failure (non-ok code) -> The HTTP request failed (e.g. timeout, network error).
11
+ * -> Unhandled exception on EDGE side, EDGE would provide serialized error in the response body.
12
+ * 3. Processing failure -> Unhandled exception on client side while processing the response.
13
+ */
6
14
  export class EdgeCallFailedError extends Error {
7
- static fromProcessingFailureCause(cause) {
8
- return new EdgeCallFailedError({
9
- reason: 'Error processing request.',
10
- isRetryable: true,
11
- cause,
15
+ static fromUnsuccessfulResponse(response, body) {
16
+ const error = new EdgeCallFailedError({
17
+ reason: body.reason,
18
+ errorData: body.errorData,
19
+ isRetryable: body.errorData == null && response.headers.has('Retry-After'),
20
+ retryAfterMs: getRetryAfterMillis(response),
21
+ cause: body.cause ? ErrorCodec.decode(body.cause) : undefined,
12
22
  });
23
+ return error;
13
24
  }
14
25
  static async fromHttpFailure(response) {
15
26
  return new EdgeCallFailedError({
16
27
  reason: `HTTP code ${response.status}: ${response.statusText}.`,
17
28
  isRetryable: isRetryableCode(response.status),
18
29
  retryAfterMs: getRetryAfterMillis(response),
19
- cause: await parseErrorBody(response),
30
+ cause: await EdgeHttpErrorCodec.decode(response),
20
31
  });
21
32
  }
22
- static fromUnsuccessfulResponse(response, body) {
33
+ static fromProcessingFailureCause(cause) {
23
34
  return new EdgeCallFailedError({
24
- reason: body.reason,
25
- errorData: body.errorData,
26
- isRetryable: body.errorData == null && response.headers.has('Retry-After'),
27
- retryAfterMs: getRetryAfterMillis(response),
35
+ reason: 'Error processing request.',
36
+ isRetryable: true,
37
+ cause,
28
38
  });
29
39
  }
30
40
  reason;
@@ -50,11 +60,6 @@ const getRetryAfterMillis = (response) => {
50
60
  const retryAfter = Number(response.headers.get('Retry-After'));
51
61
  return Number.isNaN(retryAfter) || retryAfter === 0 ? undefined : retryAfter * 1000;
52
62
  };
53
- export const createRetryableHttpFailure = (args) => {
54
- return new Response(JSON.stringify({ success: false, reason: args.reason }), {
55
- headers: { 'Retry-After': String(args.retryAfterSeconds) },
56
- });
57
- };
58
63
  const isRetryableCode = (status) => {
59
64
  if (status === 501) {
60
65
  // Not Implemented
@@ -62,41 +67,4 @@ const isRetryableCode = (status) => {
62
67
  }
63
68
  return !(status >= 400 && status < 500);
64
69
  };
65
- const parseErrorBody = async (response) => {
66
- if (response.headers.get('Content-Type') !== 'application/json') {
67
- const body = await response.text();
68
- return new Error(body.slice(0, 256));
69
- }
70
- const body = await response.json();
71
- if (!('error' in body)) {
72
- return undefined;
73
- }
74
- return parseSerializedError(body.error);
75
- };
76
- const parseSerializedError = (serializedError) => {
77
- let err;
78
- if (typeof serializedError.code === 'string') {
79
- err = new BaseError(serializedError.code, {
80
- message: serializedError.message ?? 'Unknown error',
81
- cause: serializedError.cause ? parseSerializedError(serializedError.cause) : undefined,
82
- context: serializedError.context,
83
- });
84
- if (serializedError.stack) {
85
- Object.defineProperty(err, 'stack', {
86
- value: serializedError.stack,
87
- });
88
- }
89
- }
90
- else {
91
- err = new Error(serializedError.message ?? 'Unknown error', {
92
- cause: serializedError.cause ? parseSerializedError(serializedError.cause) : undefined,
93
- });
94
- if (serializedError.stack) {
95
- Object.defineProperty(err, 'stack', {
96
- value: serializedError.stack,
97
- });
98
- }
99
- }
100
- return err;
101
- };
102
70
  //# sourceMappingURL=edge-error.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"edge-error.js","sourceRoot":"","sources":["../../src/edge-error.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AAEF,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzC,6CAA6C;AAC7C,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IACrC,MAAM,CAAC,0BAA0B,CAAC,KAAY;QACnD,OAAO,IAAI,mBAAmB,CAAC;YAC7B,MAAM,EAAE,2BAA2B;YACnC,WAAW,EAAE,IAAI;YACjB,KAAK;SACN,CAAC,CAAC;IACL,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,QAAkB;QACpD,OAAO,IAAI,mBAAmB,CAAC;YAC7B,MAAM,EAAE,aAAa,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,UAAU,GAAG;YAC/D,WAAW,EAAE,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC;YAC7C,YAAY,EAAE,mBAAmB,CAAC,QAAQ,CAAC;YAC3C,KAAK,EAAE,MAAM,cAAc,CAAC,QAAQ,CAAC;SACtC,CAAC,CAAC;IACL,CAAC;IAEM,MAAM,CAAC,wBAAwB,CAAC,QAAkB,EAA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AAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QACtC,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC/C,CAAC;CACF;AAED,MAAM,OAAO,sBAAuB,SAAQ,mBAAmB;IAE3C;IADlB,YACkB,SAAiB,EACjC,SAAwB;QAExB,KAAK,CAAC,EAAE,MAAM,EAAE,iBAAiB,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;QAHpD,cAAS,GAAT,SAAS,CAAQ;IAInC,CAAC;CACF;AAED,MAAM,mBAAmB,GAAG,CAAC,QAAkB,EAAE,EAAE;IACjD,MAAM,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC;IAC/D,OAAO,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,UAAU,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,GAAG,IAAI,CAAC;AACtF,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,CAAC,MAAc,EAAE,EAAE;IACzC,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;QACnB,kBAAkB;QAClB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,CAAC,CAAC,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG,CAAC,CAAC;AAC1C,CAAC,CAAC"}
@@ -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,37 @@ 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
+ export type SerializedError = {
15
+ code?: string;
16
+ message?: string;
17
+ context?: Record<string, unknown>;
18
+ stack?: string;
19
+ cause?: SerializedError;
20
+ };
14
21
  export type EdgeErrorData = {
15
22
  type: string;
16
23
  } & Record<string, any>;
17
- export type EdgeHttpFailure = {
24
+ /**
25
+ * This is the shape of the error response from the Edge service,
26
+ * when the error is gracefully handled, the Response will be an object with this shape and have status code 200.
27
+ */
28
+ export type EdgeFailure = {
29
+ /**
30
+ * Branded Type.
31
+ */
18
32
  success: false;
19
33
  /**
20
34
  * An explanation of why the call failed. Used mostly for logging and monitoring.
21
35
  */
22
36
  reason: string;
37
+ /**
38
+ * Cause Error captured on the EDGE service to aid debugging on the client.
39
+ */
40
+ cause?: SerializedError;
23
41
  /**
24
42
  * Information that can be used to retry the request such that it will succeed, for example:
25
43
  * 1. { type: 'auth_required', challenge: string }
@@ -32,7 +50,48 @@ export type EdgeHttpFailure = {
32
50
  */
33
51
  errorData?: EdgeErrorData;
34
52
  };
35
- export type EdgeHttpResponse<T> = EdgeHttpSuccess<T> | EdgeHttpFailure;
53
+ /**
54
+ * Represents a body response from the Edge service.
55
+ */
56
+ export type EdgeBody<T> = EdgeSuccess<T> | EdgeFailure;
57
+ /**
58
+ * Use this to create a response from the Edge service.
59
+ */
60
+ export declare const EdgeResponse: Readonly<{
61
+ success: <T>(data: T, status?: number) => Response;
62
+ failure: ({ reason, cause, errorData, shouldRetryAfter, status, }: {
63
+ /**
64
+ * An explanation of why the call failed. Used mostly for logging and monitoring.
65
+ */
66
+ reason: string;
67
+ /**
68
+ * Error that caused the failure.
69
+ * Useful for debugging.
70
+ */
71
+ cause?: Error;
72
+ /**
73
+ * Information that can be used to retry the request such that it will succeed, for example:
74
+ * 1. { type: 'auth_required', challenge: string }
75
+ * Requires retrying the request with challenge signature included.
76
+ * 2. { type: 'user_confirmation_required', dialog: { title: string, message: string, confirmation_payload: string } }
77
+ * Requires showing a confirmation dialog to a user and retrying the request with confirmation_payload included
78
+ * if the user confirms.
79
+ * When errorData is returned simply retrying the request won't have any effect.
80
+ * EdgeHttpClient should parse well-known errorData into Error types and throw.
81
+ */
82
+ errorData?: EdgeErrorData;
83
+ /**
84
+ * If provided, this request will be marked as retryable and the client will wait for the specified number of milliseconds before retrying.
85
+ * If not provided, the client will not retry the request.
86
+ */
87
+ shouldRetryAfter?: number;
88
+ /**
89
+ * Status code of the response.
90
+ * @default 500
91
+ */
92
+ status?: number;
93
+ }) => Response;
94
+ }>;
36
95
  export type GetNotarizationResponseBody = {
37
96
  awaitingNotarization: {
38
97
  credentials: string[];
@@ -239,8 +298,22 @@ export type ExportBundleResponse = {
239
298
  mutation: string;
240
299
  }[];
241
300
  };
242
- export declare const DocumentCodec: {
301
+ export declare const DocumentCodec: Readonly<{
243
302
  encode: (doc: Uint8Array) => string;
244
303
  decode: (doc: string) => Uint8Array<ArrayBuffer>;
245
- };
304
+ }>;
305
+ /**
306
+ * Codec for serializing and deserializing Edge Errors.
307
+ */
308
+ export declare const ErrorCodec: Readonly<{
309
+ encode: (err: Error, depth?: number) => SerializedError;
310
+ decode: (serializedError: SerializedError, depth?: number) => Error;
311
+ }>;
312
+ /**
313
+ * Codec for serializing and deserializing Edge unhandled HTTP errors.
314
+ */
315
+ export declare const EdgeHttpErrorCodec: Readonly<{
316
+ encode: (err: Error) => Response;
317
+ decode: (response: Response) => Promise<Error | undefined>;
318
+ }>;
246
319
  //# sourceMappingURL=edge.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"edge.d.ts","sourceRoot":"","sources":["../../src/edge.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,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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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"}
package/dist/src/edge.js CHANGED
@@ -1,7 +1,9 @@
1
1
  //
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
- import { Schema } from 'effect';
4
+ import * as Schema from 'effect/Schema';
5
+ import { BaseError } from '@dxos/errors';
6
+ import { invariant } from '@dxos/invariant';
5
7
  import { SpaceId } from '@dxos/keys';
6
8
  // TODO(burdon): Rename EdgerRouterEndpoint.
7
9
  // If we would rename it, we need to be careful to not break composer production.
@@ -13,6 +15,37 @@ export var EdgeService;
13
15
  EdgeService["SIGNAL"] = "signal";
14
16
  EdgeService["STATUS"] = "status";
15
17
  })(EdgeService || (EdgeService = {}));
18
+ /**
19
+ * Use this to create a response from the Edge service.
20
+ */
21
+ export const EdgeResponse = Object.freeze({
22
+ success: (data, status = 200) => {
23
+ invariant(status >= 200 && status < 300, 'Status code must be in the 2xx range');
24
+ const headers = new Headers({ 'Content-Type': 'application/json' });
25
+ return new Response(JSON.stringify({
26
+ success: true,
27
+ data,
28
+ }), {
29
+ status,
30
+ headers,
31
+ });
32
+ },
33
+ failure: ({ reason, cause, errorData, shouldRetryAfter, status = 500, }) => {
34
+ const headers = new Headers({ 'Content-Type': 'application/json' });
35
+ if (shouldRetryAfter) {
36
+ headers.set('Retry-After', String(shouldRetryAfter));
37
+ }
38
+ return new Response(JSON.stringify({
39
+ success: false,
40
+ reason,
41
+ errorData,
42
+ cause: cause ? ErrorCodec.encode(cause) : undefined,
43
+ }), {
44
+ status,
45
+ headers,
46
+ });
47
+ },
48
+ });
16
49
  export var EdgeAgentStatus;
17
50
  (function (EdgeAgentStatus) {
18
51
  EdgeAgentStatus["ACTIVE"] = "active";
@@ -42,8 +75,69 @@ export var EdgeWebsocketProtocol;
42
75
  */
43
76
  EdgeWebsocketProtocol["V1"] = "edge-ws-v1";
44
77
  })(EdgeWebsocketProtocol || (EdgeWebsocketProtocol = {}));
45
- export const DocumentCodec = {
78
+ export const DocumentCodec = Object.freeze({
46
79
  encode: (doc) => Buffer.from(doc).toString('base64'),
47
80
  decode: (doc) => new Uint8Array(Buffer.from(doc, 'base64')),
48
- };
81
+ });
82
+ const MAX_ERROR_DEPTH = 3;
83
+ /**
84
+ * Codec for serializing and deserializing Edge Errors.
85
+ */
86
+ export const ErrorCodec = Object.freeze({
87
+ encode: (err, depth = 0) => ({
88
+ code: 'code' in err ? err.code : undefined,
89
+ message: err.message,
90
+ stack: err.stack,
91
+ cause: err.cause instanceof Error && depth < MAX_ERROR_DEPTH ? ErrorCodec.encode(err.cause, depth + 1) : undefined,
92
+ }),
93
+ decode: (serializedError, depth = 0) => {
94
+ let err;
95
+ if (typeof serializedError.code === 'string') {
96
+ err = new BaseError(serializedError.code, {
97
+ message: serializedError.message ?? 'Unknown error',
98
+ cause: serializedError.cause && depth < MAX_ERROR_DEPTH
99
+ ? ErrorCodec.decode(serializedError.cause, depth + 1)
100
+ : undefined,
101
+ context: serializedError.context,
102
+ });
103
+ if (serializedError.stack) {
104
+ Object.defineProperty(err, 'stack', {
105
+ value: serializedError.stack,
106
+ });
107
+ }
108
+ }
109
+ else {
110
+ err = new Error(serializedError.message ?? 'Unknown error', {
111
+ cause: serializedError.cause && depth < MAX_ERROR_DEPTH
112
+ ? ErrorCodec.decode(serializedError.cause, depth + 1)
113
+ : undefined,
114
+ });
115
+ if (serializedError.stack) {
116
+ Object.defineProperty(err, 'stack', {
117
+ value: serializedError.stack,
118
+ });
119
+ }
120
+ }
121
+ return err;
122
+ },
123
+ });
124
+ /**
125
+ * Codec for serializing and deserializing Edge unhandled HTTP errors.
126
+ */
127
+ export const EdgeHttpErrorCodec = Object.freeze({
128
+ encode: (err) => new Response(JSON.stringify({
129
+ error: ErrorCodec.encode(err),
130
+ }), { status: 500 }),
131
+ decode: async (response) => {
132
+ if (response.headers.get('Content-Type') !== 'application/json') {
133
+ const body = await response.clone().text();
134
+ return new Error(body.slice(0, 256));
135
+ }
136
+ const body = await response.clone().json();
137
+ if (!('error' in body)) {
138
+ return undefined;
139
+ }
140
+ return ErrorCodec.decode(body.error);
141
+ },
142
+ });
49
143
  //# sourceMappingURL=edge.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"edge.js","sourceRoot":"","sources":["../../src/edge.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AAEF,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,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;AAgJD,MAAM,CAAN,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,oCAAiB,CAAA;IACjB,wCAAqB,CAAA;IACrB,0CAAuB,CAAA;AACzB,CAAC,EAJW,eAAe,KAAf,eAAe,QAI1B;AAOD,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,kCAAiB,CAAA;IACjB,oCAAmB,CAAA;AACrB,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB;AAED,MAAM,CAAC,MAAM,8BAA8B,GAAG,MAAM,CAAC,MAAM,CAAC;IAC1D,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC;IACrC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,6BAA6B;IAC1F,aAAa,EAAE,MAAM,CAAC,MAAM;IAC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,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;CACF,CAAC,CAAC"}
@@ -1,13 +1,13 @@
1
+ export * from './automerge.js';
2
+ export * from './edge-error.js';
3
+ export * from './edge.js';
1
4
  export * from './errors/index.js';
2
5
  export * from './indexing.js';
3
- export * from './storage.js';
4
- export * from './tracing.js';
5
- export type * from './types.js';
6
- export * from './query.js';
7
6
  export * from './profile-archive.js';
8
- export * from './automerge.js';
9
- export * from './edge.js';
7
+ export * from './query.js';
10
8
  export * from './queue.js';
11
9
  export * from './space-archive.js';
12
- export * from './edge-error.js';
10
+ export * from './storage.js';
11
+ export * from './tracing.js';
12
+ export type * from './types.js';
13
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,mBAAmB,YAAY,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,mBAAmB,YAAY,CAAC"}
package/dist/src/index.js CHANGED
@@ -1,15 +1,15 @@
1
1
  //
2
2
  // Copyright 2021 DXOS.org
3
3
  //
4
+ export * from './automerge.js';
5
+ export * from './edge-error.js';
6
+ export * from './edge.js';
4
7
  export * from './errors/index.js';
5
8
  export * from './indexing.js';
6
- export * from './storage.js';
7
- export * from './tracing.js';
8
- export * from './query.js';
9
9
  export * from './profile-archive.js';
10
- export * from './automerge.js';
11
- export * from './edge.js';
10
+ export * from './query.js';
12
11
  export * from './queue.js';
13
12
  export * from './space-archive.js';
14
- export * from './edge-error.js';
13
+ export * from './storage.js';
14
+ export * from './tracing.js';
15
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AAEF,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAE7B,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AAEF,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
@@ -1,4 +1,4 @@
1
- import { Schema } from 'effect';
1
+ import * as Schema from 'effect/Schema';
2
2
  export type ObjectPointerDecoded = {
3
3
  spaceKey: string | undefined;
4
4
  documentId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"indexing.d.ts","sourceRoot":"","sources":["../../src/indexing.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAE1C,eAAO,MAAM,oBAAoB,2CAA+D,CAAC;AAIjG,oBAAY,oBAAoB;IAC9B;;OAEG;IACH,EAAE,IAAI;IACN;;OAEG;IACH,EAAE,IAAI;CACP;AAED,eAAO,MAAM,kBAAkB;iDACgB,oBAAoB,KAAG,oBAAoB;iBAO3E,oBAAoB,KAAG,oBAAoB;qBASvC,oBAAoB,KAAG,oBAAoB;wBAOxC,oBAAoB,KAAG,oBAAoB;CAIhE,CAAC"}
1
+ {"version":3,"file":"indexing.d.ts","sourceRoot":"","sources":["../../src/indexing.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAE1C,eAAO,MAAM,oBAAoB,2CAA+D,CAAC;AAIjG,oBAAY,oBAAoB;IAC9B;;OAEG;IACH,EAAE,IAAI;IACN;;OAEG;IACH,EAAE,IAAI;CACP;AAED,eAAO,MAAM,kBAAkB;iDACgB,oBAAoB,KAAG,oBAAoB;iBAO3E,oBAAoB,KAAG,oBAAoB;qBASvC,oBAAoB,KAAG,oBAAoB;wBAOxC,oBAAoB,KAAG,oBAAoB;CAIhE,CAAC"}
@@ -1,7 +1,7 @@
1
1
  //
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
- import { Schema } from 'effect';
4
+ import * as Schema from 'effect/Schema';
5
5
  export const ObjectPointerEncoded = Schema.String.annotations({ title: 'ObjectPointerEncoded' });
6
6
  const V1_PREFIX = '#01';
7
7
  export var ObjectPointerVersion;
@@ -1 +1 @@
1
- {"version":3,"file":"indexing.js","sourceRoot":"","sources":["../../src/indexing.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AAEF,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAgBhC,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,sBAAsB,EAAE,CAAC,CAAC;AAEjG,MAAM,SAAS,GAAG,KAAK,CAAC;AAExB,MAAM,CAAN,IAAY,oBASX;AATD,WAAY,oBAAoB;IAC9B;;OAEG;IACH,2DAAM,CAAA;IACN;;OAEG;IACH,2DAAM,CAAA;AACR,CAAC,EATW,oBAAoB,KAApB,oBAAoB,QAS/B;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAwB,EAAwB,EAAE;QACzF,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,OAAO,GAAG,UAAU,IAAI,QAAQ,EAAE,CAAC;QACrC,CAAC;aAAM,CAAC;YACN,OAAO,GAAG,SAAS,IAAI,QAAQ,IAAI,UAAU,IAAI,QAAQ,EAAE,CAAC;QAC9D,CAAC;IACH,CAAC;IACD,MAAM,EAAE,CAAC,EAAwB,EAAwB,EAAE;QACzD,IAAI,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;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E;QAChE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC/D,OAAO,kBAAkB,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;IAClF,CAAC;CACF,CAAC"}
@@ -1,4 +1,4 @@
1
- import { Schema } from 'effect';
1
+ import * as Schema from 'effect/Schema';
2
2
  export declare const InvitationUrl: Schema.Struct<{
3
3
  accessToken: typeof Schema.String;
4
4
  deviceInvitationCode: Schema.SchemaClass<string, string, never>;
@@ -1 +1 @@
1
- {"version":3,"file":"invitation.d.ts","sourceRoot":"","sources":["../../src/invitation.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKhC,eAAO,MAAM,aAAa;;;;EAIxB,CAAC"}
1
+ {"version":3,"file":"invitation.d.ts","sourceRoot":"","sources":["../../src/invitation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAKxC,eAAO,MAAM,aAAa;;;;EAIxB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  //
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
- import { Schema } from 'effect';
4
+ import * as Schema from 'effect/Schema';
5
5
  import { ParamKeyAnnotation } from '@dxos/effect';
6
6
  // TODO(burdon): Use uniformly for processing HTTP params.
7
7
  export const InvitationUrl = Schema.Struct({
@@ -1 +1 @@
1
- {"version":3,"file":"invitation.js","sourceRoot":"","sources":["../../src/invitation.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AAEF,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,0DAA0D;AAC1D,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC;IACzC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,wBAAwB;IACpD,oBAAoB,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,GAAG,EAAE,sBAAsB,EAAE,CAAC,CAAC;IAC7F,mBAAmB,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,GAAG,EAAE,qBAAqB,EAAE,CAAC,CAAC;CAC5F,CAAC,CAAC"}
1
+ {"version":3,"file":"invitation.js","sourceRoot":"","sources":["../../src/invitation.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AAEF,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,0DAA0D;AAC1D,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC;IACzC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,wBAAwB;IACpD,oBAAoB,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,GAAG,EAAE,sBAAsB,EAAE,CAAC,CAAC;IAC7F,mBAAmB,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,GAAG,EAAE,qBAAqB,EAAE,CAAC,CAAC;CAC5F,CAAC,CAAC"}
@@ -1345,9 +1345,36 @@ export interface EdgeAgentService {
1345
1345
  * Defined in:
1346
1346
  * {@link file://./../../../dxos/client/services.proto}
1347
1347
  */
1348
- export declare enum EdgeStatus {
1349
- NOT_CONNECTED = 0,
1350
- CONNECTED = 1
1348
+ export interface EdgeStatus {
1349
+ state: EdgeStatus.ConnectionState;
1350
+ /**
1351
+ * Latency in ms
1352
+ */
1353
+ rtt: number;
1354
+ /**
1355
+ * How long the connection has been up
1356
+ */
1357
+ uptime: number;
1358
+ /**
1359
+ * Upload rate in bytes per second
1360
+ */
1361
+ rateBytesUp: number;
1362
+ /**
1363
+ * Download rate in bytes per second
1364
+ */
1365
+ rateBytesDown: number;
1366
+ messagesSent: number;
1367
+ messagesReceived: number;
1368
+ }
1369
+ export declare namespace EdgeStatus {
1370
+ /**
1371
+ * Defined in:
1372
+ * {@link file://./../../../dxos/client/services.proto}
1373
+ */
1374
+ enum ConnectionState {
1375
+ NOT_CONNECTED = 0,
1376
+ CONNECTED = 1
1377
+ }
1351
1378
  }
1352
1379
  /**
1353
1380
  * Defined in: