@dxos/client-services 0.8.4-main.b97322e → 0.8.4-main.bcb3aa67d6

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 (222) hide show
  1. package/dist/lib/browser/{chunk-WKKP35EC.mjs → chunk-5A3KX2RY.mjs} +4406 -3958
  2. package/dist/lib/browser/chunk-5A3KX2RY.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-NQSC7HOE.mjs +22 -0
  4. package/dist/lib/browser/chunk-NQSC7HOE.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-QCWEHHJW.mjs +24 -0
  6. package/dist/lib/browser/chunk-QCWEHHJW.mjs.map +7 -0
  7. package/dist/lib/browser/index.mjs +481 -78
  8. package/dist/lib/browser/index.mjs.map +4 -4
  9. package/dist/lib/browser/meta.json +1 -1
  10. package/dist/lib/browser/packlets/diagnostics/browser-diagnostics-broadcast.mjs +93 -0
  11. package/dist/lib/browser/packlets/diagnostics/browser-diagnostics-broadcast.mjs.map +7 -0
  12. package/dist/lib/browser/packlets/diagnostics/diagnostics-broadcast.mjs +11 -0
  13. package/dist/lib/browser/packlets/diagnostics/diagnostics-broadcast.mjs.map +7 -0
  14. package/dist/lib/browser/packlets/locks/browser.mjs +126 -0
  15. package/dist/lib/browser/packlets/locks/browser.mjs.map +7 -0
  16. package/dist/lib/browser/packlets/locks/node.mjs +66 -0
  17. package/dist/lib/browser/packlets/locks/node.mjs.map +7 -0
  18. package/dist/lib/browser/testing/index.mjs +45 -26
  19. package/dist/lib/browser/testing/index.mjs.map +3 -3
  20. package/dist/lib/node-esm/chunk-2SZHAWBN.mjs +24 -0
  21. package/dist/lib/node-esm/chunk-2SZHAWBN.mjs.map +7 -0
  22. package/dist/lib/node-esm/{chunk-ZE2HYS56.mjs → chunk-FNPO5UMU.mjs} +4302 -3722
  23. package/dist/lib/node-esm/chunk-FNPO5UMU.mjs.map +7 -0
  24. package/dist/lib/node-esm/chunk-PKEGMOQ4.mjs +22 -0
  25. package/dist/lib/node-esm/chunk-PKEGMOQ4.mjs.map +7 -0
  26. package/dist/lib/node-esm/index.mjs +481 -78
  27. package/dist/lib/node-esm/index.mjs.map +4 -4
  28. package/dist/lib/node-esm/meta.json +1 -1
  29. package/dist/lib/node-esm/packlets/diagnostics/browser-diagnostics-broadcast.mjs +93 -0
  30. package/dist/lib/node-esm/packlets/diagnostics/browser-diagnostics-broadcast.mjs.map +7 -0
  31. package/dist/lib/node-esm/packlets/diagnostics/diagnostics-broadcast.mjs +11 -0
  32. package/dist/lib/node-esm/packlets/diagnostics/diagnostics-broadcast.mjs.map +7 -0
  33. package/dist/lib/node-esm/packlets/locks/browser.mjs +126 -0
  34. package/dist/lib/node-esm/packlets/locks/browser.mjs.map +7 -0
  35. package/dist/lib/node-esm/packlets/locks/node.mjs +66 -0
  36. package/dist/lib/node-esm/packlets/locks/node.mjs.map +7 -0
  37. package/dist/lib/node-esm/testing/index.mjs +45 -26
  38. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  39. package/dist/types/src/index.d.ts +1 -0
  40. package/dist/types/src/index.d.ts.map +1 -1
  41. package/dist/types/src/packlets/agents/edge-agent-manager.d.ts +3 -2
  42. package/dist/types/src/packlets/agents/edge-agent-manager.d.ts.map +1 -1
  43. package/dist/types/src/packlets/agents/edge-agent-service.d.ts +1 -1
  44. package/dist/types/src/packlets/agents/edge-agent-service.d.ts.map +1 -1
  45. package/dist/types/src/packlets/devices/devices-service.d.ts.map +1 -1
  46. package/dist/types/src/packlets/devtools/devtools.d.ts +20 -20
  47. package/dist/types/src/packlets/devtools/devtools.d.ts.map +1 -1
  48. package/dist/types/src/packlets/devtools/feeds.d.ts +1 -1
  49. package/dist/types/src/packlets/devtools/feeds.d.ts.map +1 -1
  50. package/dist/types/src/packlets/devtools/network.d.ts +1 -1
  51. package/dist/types/src/packlets/devtools/network.d.ts.map +1 -1
  52. package/dist/types/src/packlets/diagnostics/browser-diagnostics-broadcast.d.ts +1 -1
  53. package/dist/types/src/packlets/diagnostics/browser-diagnostics-broadcast.d.ts.map +1 -1
  54. package/dist/types/src/packlets/diagnostics/diagnostics-broadcast.d.ts +1 -1
  55. package/dist/types/src/packlets/diagnostics/diagnostics-broadcast.d.ts.map +1 -1
  56. package/dist/types/src/packlets/diagnostics/diagnostics.d.ts +1 -1
  57. package/dist/types/src/packlets/diagnostics/diagnostics.d.ts.map +1 -1
  58. package/dist/types/src/packlets/diagnostics/index.d.ts +1 -1
  59. package/dist/types/src/packlets/diagnostics/index.d.ts.map +1 -1
  60. package/dist/types/src/packlets/identity/authenticator.d.ts +2 -2
  61. package/dist/types/src/packlets/identity/authenticator.d.ts.map +1 -1
  62. package/dist/types/src/packlets/identity/contacts-service.d.ts +1 -1
  63. package/dist/types/src/packlets/identity/contacts-service.d.ts.map +1 -1
  64. package/dist/types/src/packlets/identity/identity-manager.d.ts +7 -7
  65. package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
  66. package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts +7 -6
  67. package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts.map +1 -1
  68. package/dist/types/src/packlets/identity/identity-service.d.ts +1 -6
  69. package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
  70. package/dist/types/src/packlets/identity/identity.d.ts +9 -12
  71. package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
  72. package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts +4 -4
  73. package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts.map +1 -1
  74. package/dist/types/src/packlets/invitations/edge-invitation-handler.d.ts +1 -1
  75. package/dist/types/src/packlets/invitations/edge-invitation-handler.d.ts.map +1 -1
  76. package/dist/types/src/packlets/invitations/invitation-guest-extenstion.d.ts.map +1 -1
  77. package/dist/types/src/packlets/invitations/invitation-host-extension.d.ts.map +1 -1
  78. package/dist/types/src/packlets/invitations/invitation-protocol.d.ts +3 -4
  79. package/dist/types/src/packlets/invitations/invitation-protocol.d.ts.map +1 -1
  80. package/dist/types/src/packlets/invitations/invitations-handler.d.ts +4 -4
  81. package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
  82. package/dist/types/src/packlets/invitations/invitations-manager.d.ts +3 -3
  83. package/dist/types/src/packlets/invitations/invitations-manager.d.ts.map +1 -1
  84. package/dist/types/src/packlets/invitations/invitations-service.d.ts +1 -1
  85. package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
  86. package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts +3 -3
  87. package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
  88. package/dist/types/src/packlets/invitations/utils.d.ts.map +1 -1
  89. package/dist/types/src/packlets/locks/index.d.ts +1 -1
  90. package/dist/types/src/packlets/locks/index.d.ts.map +1 -1
  91. package/dist/types/src/packlets/logging/logging-service.d.ts +5 -1
  92. package/dist/types/src/packlets/logging/logging-service.d.ts.map +1 -1
  93. package/dist/types/src/packlets/network/network-service.d.ts +2 -2
  94. package/dist/types/src/packlets/network/network-service.d.ts.map +1 -1
  95. package/dist/types/src/packlets/services/client-rpc-server.d.ts +2 -2
  96. package/dist/types/src/packlets/services/client-rpc-server.d.ts.map +1 -1
  97. package/dist/types/src/packlets/services/feed-syncer.d.ts +59 -0
  98. package/dist/types/src/packlets/services/feed-syncer.d.ts.map +1 -0
  99. package/dist/types/src/packlets/services/feed-syncer.test.d.ts +2 -0
  100. package/dist/types/src/packlets/services/feed-syncer.test.d.ts.map +1 -0
  101. package/dist/types/src/packlets/services/platform.d.ts.map +1 -1
  102. package/dist/types/src/packlets/services/service-context.d.ts +14 -9
  103. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  104. package/dist/types/src/packlets/services/service-host.d.ts +20 -6
  105. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  106. package/dist/types/src/packlets/space-export/space-archive-reader.d.ts +9 -1
  107. package/dist/types/src/packlets/space-export/space-archive-reader.d.ts.map +1 -1
  108. package/dist/types/src/packlets/space-export/space-archive-writer.d.ts +7 -1
  109. package/dist/types/src/packlets/space-export/space-archive-writer.d.ts.map +1 -1
  110. package/dist/types/src/packlets/space-export/space-archive.test.d.ts +2 -0
  111. package/dist/types/src/packlets/space-export/space-archive.test.d.ts.map +1 -0
  112. package/dist/types/src/packlets/spaces/automerge-space-state.d.ts +1 -1
  113. package/dist/types/src/packlets/spaces/automerge-space-state.d.ts.map +1 -1
  114. package/dist/types/src/packlets/spaces/data-space-manager.d.ts +28 -16
  115. package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
  116. package/dist/types/src/packlets/spaces/data-space.d.ts +28 -12
  117. package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
  118. package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts +2 -2
  119. package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts.map +1 -1
  120. package/dist/types/src/packlets/spaces/genesis.d.ts +2 -1
  121. package/dist/types/src/packlets/spaces/genesis.d.ts.map +1 -1
  122. package/dist/types/src/packlets/spaces/notarization-plugin.d.ts +6 -6
  123. package/dist/types/src/packlets/spaces/notarization-plugin.d.ts.map +1 -1
  124. package/dist/types/src/packlets/spaces/spaces-service.d.ts +3 -3
  125. package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
  126. package/dist/types/src/packlets/storage/profile-archive.d.ts.map +1 -1
  127. package/dist/types/src/packlets/storage/storage.d.ts.map +1 -1
  128. package/dist/types/src/packlets/system/system-service.d.ts +1 -1
  129. package/dist/types/src/packlets/system/system-service.d.ts.map +1 -1
  130. package/dist/types/src/packlets/testing/invitation-utils.d.ts +6 -3
  131. package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
  132. package/dist/types/src/packlets/testing/test-builder.d.ts +8 -7
  133. package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
  134. package/dist/types/src/packlets/worker/worker-runtime.d.ts +31 -4
  135. package/dist/types/src/packlets/worker/worker-runtime.d.ts.map +1 -1
  136. package/dist/types/src/packlets/worker/worker-session.d.ts +2 -2
  137. package/dist/types/src/packlets/worker/worker-session.d.ts.map +1 -1
  138. package/dist/types/src/version.d.ts +1 -1
  139. package/dist/types/src/version.d.ts.map +1 -1
  140. package/dist/types/tsconfig.tsbuildinfo +1 -1
  141. package/package.json +72 -48
  142. package/src/index.ts +1 -0
  143. package/src/packlets/agents/edge-agent-manager.ts +10 -7
  144. package/src/packlets/agents/edge-agent-service.ts +15 -5
  145. package/src/packlets/devices/devices-service.test.ts +4 -3
  146. package/src/packlets/devices/devices-service.ts +2 -2
  147. package/src/packlets/devtools/devtools.ts +30 -29
  148. package/src/packlets/devtools/feeds.ts +2 -2
  149. package/src/packlets/devtools/network.ts +1 -1
  150. package/src/packlets/diagnostics/browser-diagnostics-broadcast.ts +1 -1
  151. package/src/packlets/diagnostics/diagnostics-broadcast.ts +1 -1
  152. package/src/packlets/diagnostics/diagnostics-collector.ts +1 -1
  153. package/src/packlets/diagnostics/diagnostics.ts +1 -1
  154. package/src/packlets/diagnostics/index.ts +1 -1
  155. package/src/packlets/identity/authenticator.node.test.ts +1 -1
  156. package/src/packlets/identity/authenticator.ts +3 -3
  157. package/src/packlets/identity/contacts-service.ts +3 -2
  158. package/src/packlets/identity/identity-manager.test.ts +8 -8
  159. package/src/packlets/identity/identity-manager.ts +23 -20
  160. package/src/packlets/identity/identity-recovery-manager.ts +22 -18
  161. package/src/packlets/identity/identity-service.test.ts +9 -28
  162. package/src/packlets/identity/identity-service.ts +5 -75
  163. package/src/packlets/identity/identity.test.ts +11 -11
  164. package/src/packlets/identity/identity.ts +16 -37
  165. package/src/packlets/invitations/device-invitation-protocol.test.ts +1 -1
  166. package/src/packlets/invitations/device-invitation-protocol.ts +6 -5
  167. package/src/packlets/invitations/edge-invitation-handler.ts +5 -4
  168. package/src/packlets/invitations/invitation-guest-extenstion.ts +7 -5
  169. package/src/packlets/invitations/invitation-host-extension.ts +8 -6
  170. package/src/packlets/invitations/invitation-protocol.ts +3 -4
  171. package/src/packlets/invitations/invitations-handler.test.ts +8 -7
  172. package/src/packlets/invitations/invitations-handler.ts +13 -13
  173. package/src/packlets/invitations/invitations-manager.ts +40 -17
  174. package/src/packlets/invitations/invitations-service.ts +5 -5
  175. package/src/packlets/invitations/space-invitation-protocol.test.ts +19 -18
  176. package/src/packlets/invitations/space-invitation-protocol.ts +13 -16
  177. package/src/packlets/invitations/utils.ts +1 -1
  178. package/src/packlets/locks/browser.ts +1 -1
  179. package/src/packlets/locks/index.ts +1 -1
  180. package/src/packlets/logging/logging-service.ts +7 -3
  181. package/src/packlets/logging/logging.test.ts +1 -1
  182. package/src/packlets/network/network-service.test.ts +4 -3
  183. package/src/packlets/network/network-service.ts +7 -6
  184. package/src/packlets/services/client-rpc-server.ts +5 -5
  185. package/src/packlets/services/feed-syncer.test.ts +340 -0
  186. package/src/packlets/services/feed-syncer.ts +337 -0
  187. package/src/packlets/services/platform.ts +7 -1
  188. package/src/packlets/services/service-context.test.ts +4 -3
  189. package/src/packlets/services/service-context.ts +139 -52
  190. package/src/packlets/services/service-host.test.ts +11 -9
  191. package/src/packlets/services/service-host.ts +78 -28
  192. package/src/packlets/services/service-registry.test.ts +2 -1
  193. package/src/packlets/space-export/space-archive-reader.ts +65 -4
  194. package/src/packlets/space-export/space-archive-writer.ts +42 -5
  195. package/src/packlets/space-export/space-archive.test.ts +287 -0
  196. package/src/packlets/space-export/tar.test.ts +1 -1
  197. package/src/packlets/spaces/automerge-space-state.ts +1 -1
  198. package/src/packlets/spaces/data-space-manager.test.ts +79 -13
  199. package/src/packlets/spaces/data-space-manager.ts +124 -116
  200. package/src/packlets/spaces/data-space.ts +60 -35
  201. package/src/packlets/spaces/edge-feed-replicator.test.ts +4 -4
  202. package/src/packlets/spaces/edge-feed-replicator.ts +12 -11
  203. package/src/packlets/spaces/epoch-migrations.ts +5 -5
  204. package/src/packlets/spaces/genesis.ts +6 -1
  205. package/src/packlets/spaces/notarization-plugin.test.ts +3 -3
  206. package/src/packlets/spaces/notarization-plugin.ts +13 -12
  207. package/src/packlets/spaces/spaces-service.test.ts +12 -8
  208. package/src/packlets/spaces/spaces-service.ts +57 -31
  209. package/src/packlets/storage/profile-archive.ts +1 -1
  210. package/src/packlets/storage/storage.ts +7 -8
  211. package/src/packlets/system/system-service.test.ts +1 -1
  212. package/src/packlets/system/system-service.ts +4 -4
  213. package/src/packlets/testing/invitation-utils.ts +11 -7
  214. package/src/packlets/testing/test-builder.ts +39 -13
  215. package/src/packlets/worker/worker-runtime.ts +152 -13
  216. package/src/packlets/worker/worker-session.ts +11 -11
  217. package/src/version.ts +1 -1
  218. package/dist/lib/browser/chunk-WKKP35EC.mjs.map +0 -7
  219. package/dist/lib/node-esm/chunk-ZE2HYS56.mjs.map +0 -7
  220. package/dist/types/src/packlets/identity/default-space-state-machine.d.ts +0 -19
  221. package/dist/types/src/packlets/identity/default-space-state-machine.d.ts.map +0 -1
  222. package/src/packlets/identity/default-space-state-machine.ts +0 -44
@@ -2,9 +2,10 @@
2
2
  // Copyright 2022 DXOS.org
3
3
  //
4
4
 
5
- import { onTestFinished, describe, expect, test } from 'vitest';
5
+ import { describe, expect, onTestFinished, test } from 'vitest';
6
6
 
7
- import { chain, Trigger } from '@dxos/async';
7
+ import { Trigger, chain } from '@dxos/async';
8
+ import { Context } from '@dxos/context';
8
9
  import { raise } from '@dxos/debug';
9
10
  import { AlreadyJoinedError } from '@dxos/protocols';
10
11
  import { Invitation } from '@dxos/protocols/proto/dxos/client/services';
@@ -24,26 +25,26 @@ describe('services/space-invitations-protocol', () => {
24
25
  test('genesis', async () => {
25
26
  const [peer] = await chain<ServiceContext>([createIdentity, closeAfterTest])(createPeers(1));
26
27
 
27
- const space = await peer.dataSpaceManager!.createSpace();
28
+ const space = await peer.dataSpaceManager!.createSpace(new Context());
28
29
  expect(peer.dataSpaceManager!.spaces.has(space.key)).to.be.true;
29
30
 
30
- await space.close();
31
+ await space.close(new Context());
31
32
  });
32
33
 
33
34
  test('genesis & ready', async () => {
34
35
  const [peer] = await chain<ServiceContext>([createIdentity, closeAfterTest])(createPeers(1));
35
36
 
36
- const space = await peer.dataSpaceManager!.createSpace();
37
+ const space = await peer.dataSpaceManager!.createSpace(new Context());
37
38
  expect(peer.dataSpaceManager!.spaces.has(space.key)).to.be.true;
38
39
 
39
40
  await peer.dataSpaceManager?.waitUntilSpaceReady(space.key);
40
- await space.close();
41
+ await space.close(new Context());
41
42
  });
42
43
 
43
44
  test('invitation with no auth', async () => {
44
45
  const [host, guest] = await chain<ServiceContext>([createIdentity, closeAfterTest])(createPeers(2));
45
46
 
46
- const space1 = await host.dataSpaceManager!.createSpace();
47
+ const space1 = await host.dataSpaceManager!.createSpace(new Context());
47
48
  const spaceKey = space1.key;
48
49
 
49
50
  await Promise.all(performInvitation({ host, guest, options: { kind: Invitation.Kind.SPACE, spaceKey } }));
@@ -59,15 +60,15 @@ describe('services/space-invitations-protocol', () => {
59
60
 
60
61
  await space2.inner.controlPipeline.state.waitUntilTimeframe(space1.inner.controlPipeline.state.timeframe);
61
62
 
62
- await space1.close();
63
- await space2.close();
63
+ await space1.close(new Context());
64
+ await space2.close(new Context());
64
65
  }
65
66
  });
66
67
 
67
68
  test('invitation when already joined', async () => {
68
69
  const [host, guest] = await chain<ServiceContext>([createIdentity, closeAfterTest])(createPeers(2));
69
70
 
70
- const space1 = await host.dataSpaceManager!.createSpace();
71
+ const space1 = await host.dataSpaceManager!.createSpace(new Context());
71
72
  const spaceKey = space1.key;
72
73
 
73
74
  await Promise.all(performInvitation({ host, guest, options: { kind: Invitation.Kind.SPACE, spaceKey } }));
@@ -96,7 +97,7 @@ describe('services/space-invitations-protocol', () => {
96
97
 
97
98
  let attempt = 0;
98
99
 
99
- const space1 = await host.dataSpaceManager!.createSpace();
100
+ const space1 = await host.dataSpaceManager!.createSpace(new Context());
100
101
 
101
102
  const [{ invitation: invitation1, error: error1 }, { invitation: invitation2, error: error2 }] = await Promise.all(
102
103
  performInvitation({
@@ -143,8 +144,8 @@ describe('services/space-invitations-protocol', () => {
143
144
 
144
145
  await space2.inner.controlPipeline.state.waitUntilTimeframe(space1.inner.controlPipeline.state.timeframe);
145
146
 
146
- await space1.close();
147
- await space2.close();
147
+ await space1.close(new Context());
148
+ await space2.close(new Context());
148
149
  }
149
150
 
150
151
  expect(
@@ -154,14 +155,14 @@ describe('services/space-invitations-protocol', () => {
154
155
 
155
156
  test('timeout', async () => {
156
157
  const [host, guest] = await chain<ServiceContext>([createIdentity, closeAfterTest])(createPeers(2));
157
- const space = await host.dataSpaceManager!.createSpace();
158
+ const space = await host.dataSpaceManager!.createSpace(new Context());
158
159
  const hostInvitation = await createInvitation(host, {
159
160
  kind: Invitation.Kind.SPACE,
160
161
  spaceKey: space.key,
161
162
  timeout: 100,
162
163
  });
163
164
  const invitation = hostInvitation.get();
164
- await host.close();
165
+ await host.close(Context.default());
165
166
 
166
167
  const guestTimeout = new Trigger();
167
168
  const guestInvitation = await acceptInvitation(guest, invitation);
@@ -180,7 +181,7 @@ describe('services/space-invitations-protocol', () => {
180
181
  const hostConnected = new Trigger<Invitation>();
181
182
  const guestConnected = new Trigger<Invitation>();
182
183
 
183
- const space1 = await host.dataSpaceManager!.createSpace();
184
+ const space1 = await host.dataSpaceManager!.createSpace(new Context());
184
185
 
185
186
  const invitationPromises = performInvitation({
186
187
  host,
@@ -213,7 +214,7 @@ describe('services/space-invitations-protocol', () => {
213
214
  expect(invitation1?.state).to.eq(Invitation.State.CANCELLED);
214
215
  expect(error).to.exist;
215
216
 
216
- await space1.close();
217
+ await space1.close(new Context());
217
218
  });
218
219
 
219
220
  // TODO(burdon): Flaky.
@@ -223,7 +224,7 @@ describe('services/space-invitations-protocol', () => {
223
224
  // createPeers(GUEST_COUNT + 1)
224
225
  // );
225
226
 
226
- // const hostSpace = await host.dataSpaceManager!.createSpace();
227
+ // const hostSpace = await host.dataSpaceManager!.createSpace(new Context());
227
228
  // const swarmKey = PublicKey.random();
228
229
  // const hostObservable = await host.spaceInvitations!.createInvitation(hostSpace, {
229
230
  // swarmKey,
@@ -7,29 +7,25 @@ import {
7
7
  createDelegatedSpaceInvitationCredential,
8
8
  getCredentialAssertion,
9
9
  } from '@dxos/credentials';
10
+ import { Context } from '@dxos/context';
10
11
  import { writeMessages } from '@dxos/feed-store';
11
12
  import { invariant } from '@dxos/invariant';
12
13
  import { type Keyring } from '@dxos/keyring';
13
14
  import { type PublicKey } from '@dxos/keys';
14
15
  import { log } from '@dxos/log';
15
- import {
16
- AlreadyJoinedError,
17
- type ApiError,
18
- AuthorizationError,
19
- InvalidInvitationError,
20
- SpaceNotFoundError,
21
- } from '@dxos/protocols';
16
+ import { AlreadyJoinedError, AuthorizationError, InvalidInvitationError, SpaceNotFoundError } from '@dxos/protocols';
22
17
  import { Invitation } from '@dxos/protocols/proto/dxos/client/services';
23
- import { SpaceMember, type ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
18
+ import { type ProfileDocument, SpaceMember } from '@dxos/protocols/proto/dxos/halo/credentials';
24
19
  import {
25
20
  type AdmissionRequest,
26
21
  type AdmissionResponse,
27
22
  type IntroductionRequest,
28
23
  } from '@dxos/protocols/proto/dxos/halo/invitations';
29
24
 
25
+ import { type DataSpaceManager, type SigningContext } from '../spaces';
26
+
30
27
  import { type InvitationProtocol } from './invitation-protocol';
31
28
  import { computeExpirationTime } from './utils';
32
- import { type DataSpaceManager, type SigningContext } from '../spaces';
33
29
 
34
30
  export class SpaceInvitationProtocol implements InvitationProtocol {
35
31
  constructor(
@@ -47,16 +43,16 @@ export class SpaceInvitationProtocol implements InvitationProtocol {
47
43
  };
48
44
  }
49
45
 
50
- checkCanInviteNewMembers(): ApiError | undefined {
46
+ checkCanInviteNewMembers(): Error | undefined {
51
47
  if (this._spaceKey == null) {
52
- return new InvalidInvitationError('No spaceKey was provided for a space invitation.');
48
+ return new InvalidInvitationError({ message: 'No spaceKey was provided for a space invitation.' });
53
49
  }
54
50
  const space = this._spaceManager.spaces.get(this._spaceKey);
55
51
  if (space == null) {
56
52
  return new SpaceNotFoundError(this._spaceKey);
57
53
  }
58
54
  if (!space?.inner.spaceState.hasMembershipManagementPermission(this._signingContext.identityKey)) {
59
- return new AuthorizationError('No member management permission.');
55
+ return new AuthorizationError({ message: 'No member management permission.' });
60
56
  }
61
57
  return undefined;
62
58
  }
@@ -147,10 +143,10 @@ export class SpaceInvitationProtocol implements InvitationProtocol {
147
143
 
148
144
  checkInvitation(invitation: Partial<Invitation>): InvalidInvitationError | AlreadyJoinedError | undefined {
149
145
  if (invitation.spaceKey == null) {
150
- return new InvalidInvitationError('No spaceKey was provided for a space invitation.');
146
+ return new InvalidInvitationError({ message: 'No spaceKey was provided for a space invitation.' });
151
147
  }
152
148
  if (this._spaceManager.spaces.has(invitation.spaceKey)) {
153
- return new AlreadyJoinedError('Already joined space.');
149
+ return new AlreadyJoinedError({ message: 'Already joined space.' });
154
150
  }
155
151
  }
156
152
 
@@ -183,15 +179,16 @@ export class SpaceInvitationProtocol implements InvitationProtocol {
183
179
  invariant(credential.subject.id.equals(this._signingContext.identityKey));
184
180
 
185
181
  if (this._spaceManager.spaces.has(assertion.spaceKey)) {
186
- throw new AlreadyJoinedError('Already joined space.');
182
+ throw new AlreadyJoinedError({ message: 'Already joined space.' });
187
183
  }
188
184
 
189
185
  // Create local space.
190
- await this._spaceManager.acceptSpace({
186
+ await this._spaceManager.acceptSpace(Context.default(), {
191
187
  spaceKey: assertion.spaceKey,
192
188
  genesisFeedKey: assertion.genesisFeedKey,
193
189
  controlTimeframe,
194
190
  dataTimeframe,
191
+ tags: assertion.tags,
195
192
  });
196
193
 
197
194
  await this._signingContext.recordCredential(credential);
@@ -3,7 +3,7 @@
3
3
  //
4
4
 
5
5
  import { type Mutex, type MutexGuard } from '@dxos/async';
6
- import { cancelWithContext, type Context, ContextDisposedError } from '@dxos/context';
6
+ import { type Context, ContextDisposedError, cancelWithContext } from '@dxos/context';
7
7
  import { Invitation } from '@dxos/protocols/proto/dxos/client/services';
8
8
 
9
9
  export const stateToString = (state: Invitation.State): string => {
@@ -2,7 +2,7 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { asyncTimeout, Trigger } from '@dxos/async';
5
+ import { Trigger, asyncTimeout } from '@dxos/async';
6
6
  import { RESOURCE_LOCK_TIMEOUT } from '@dxos/client-protocol';
7
7
  import { log, logInfo } from '@dxos/log';
8
8
 
@@ -3,4 +3,4 @@
3
3
  //
4
4
 
5
5
  export type * from './resource-lock';
6
- export * from './node';
6
+ export * from '#locks-platform';
@@ -13,12 +13,12 @@ import {
13
13
  log,
14
14
  } from '@dxos/log';
15
15
  import {
16
+ type ControlMetricsRequest,
17
+ type ControlMetricsResponse,
16
18
  type LogEntry,
17
19
  type LoggingService,
18
20
  type Metrics,
19
21
  QueryLogsRequest,
20
- type ControlMetricsRequest,
21
- type ControlMetricsResponse,
22
22
  type QueryMetricsRequest,
23
23
  type QueryMetricsResponse,
24
24
  } from '@dxos/protocols/proto/dxos/client/services';
@@ -26,6 +26,10 @@ import { getDebugName, jsonify, numericalValues, tracer } from '@dxos/util';
26
26
 
27
27
  /**
28
28
  * Logging service used to spy on logs of the host.
29
+ *
30
+ * @deprecated This was created so that logs from the shared worker (WorkerClientServices) could be
31
+ * seen in the main window console without opening the shared worker DevTools. Shared worker client
32
+ * services is deprecated; dedicated worker logs already show in the main window console.
29
33
  */
30
34
  export class LoggingServiceImpl implements LoggingService {
31
35
  private readonly _logs = new Event<NaturalLogEntry>();
@@ -37,7 +41,7 @@ export class LoggingServiceImpl implements LoggingService {
37
41
  }
38
42
 
39
43
  async close(): Promise<void> {
40
- const index = log.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
44
+ const index = log.runtimeConfig.processors.findIndex((processor: LogProcessor) => processor === this._logProcessor);
41
45
  log.runtimeConfig.processors.splice(index, 1);
42
46
  }
43
47
 
@@ -5,7 +5,7 @@
5
5
  import { afterEach, beforeEach, describe, expect, test } from 'vitest';
6
6
 
7
7
  import { Trigger } from '@dxos/async';
8
- import { log, LogLevel } from '@dxos/log';
8
+ import { LogLevel, log } from '@dxos/log';
9
9
  import { type LogEntry } from '@dxos/protocols/proto/dxos/client/services';
10
10
 
11
11
  import { LoggingServiceImpl } from './logging-service';
@@ -2,16 +2,17 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { afterEach, onTestFinished, beforeEach, describe, expect, test } from 'vitest';
5
+ import { afterEach, beforeEach, describe, expect, onTestFinished, test } from 'vitest';
6
6
 
7
7
  import { Trigger } from '@dxos/async';
8
8
  import { Context } from '@dxos/context';
9
- import { type NetworkService, ConnectionState } from '@dxos/protocols/proto/dxos/client/services';
9
+ import { ConnectionState, type NetworkService } from '@dxos/protocols/proto/dxos/client/services';
10
10
 
11
- import { NetworkServiceImpl } from './network-service';
12
11
  import { type ServiceContext } from '../services';
13
12
  import { createServiceContext } from '../testing';
14
13
 
14
+ import { NetworkServiceImpl } from './network-service';
15
+
15
16
  describe('NetworkService', () => {
16
17
  let serviceContext: ServiceContext;
17
18
  let networkService: NetworkService;
@@ -3,19 +3,20 @@
3
3
  //
4
4
 
5
5
  import { Stream } from '@dxos/codec-protobuf/stream';
6
+ import { Context } from '@dxos/context';
6
7
  import { type EdgeConnection } from '@dxos/edge-client';
7
8
  import { type SignalManager } from '@dxos/messaging';
8
9
  import { type SwarmNetworkManager } from '@dxos/network-manager';
9
10
  import {
10
- type SubscribeSwarmStateRequest,
11
11
  type NetworkService,
12
12
  type NetworkStatus,
13
+ type SubscribeSwarmStateRequest,
13
14
  type UpdateConfigRequest,
14
15
  } from '@dxos/protocols/proto/dxos/client/services';
15
16
  import { type Peer, type SwarmResponse } from '@dxos/protocols/proto/dxos/edge/messenger';
16
17
  import {
17
- type LeaveRequest,
18
18
  type JoinRequest,
19
+ type LeaveRequest,
19
20
  type Message,
20
21
  type QueryRequest,
21
22
  } from '@dxos/protocols/proto/dxos/edge/signal';
@@ -48,15 +49,15 @@ export class NetworkServiceImpl implements NetworkService {
48
49
  }
49
50
 
50
51
  async joinSwarm(request: JoinRequest): Promise<void> {
51
- return this.signalManager.join(request);
52
+ return this.signalManager.join(Context.default(), request);
52
53
  }
53
54
 
54
55
  async leaveSwarm(request: LeaveRequest): Promise<void> {
55
- return this.signalManager.leave(request);
56
+ return this.signalManager.leave(Context.default(), request);
56
57
  }
57
58
 
58
59
  async querySwarm(request: QueryRequest): Promise<SwarmResponse> {
59
- return this.signalManager.query(request);
60
+ return this.signalManager.query(Context.default(), request);
60
61
  }
61
62
 
62
63
  subscribeSwarmState(request: SubscribeSwarmStateRequest): Stream<SwarmResponse> {
@@ -70,7 +71,7 @@ export class NetworkServiceImpl implements NetworkService {
70
71
  }
71
72
 
72
73
  async sendMessage(message: Message): Promise<void> {
73
- return this.signalManager.sendMessage(message);
74
+ return this.signalManager.sendMessage(Context.default(), message);
74
75
  }
75
76
 
76
77
  subscribeMessages(peer: Peer): Stream<Message> {
@@ -5,13 +5,13 @@
5
5
  import { type ClientServices } from '@dxos/client-protocol';
6
6
  import { type Any, type ServiceHandler, Stream } from '@dxos/codec-protobuf';
7
7
  import { raise } from '@dxos/debug';
8
- import { parseMethodName, RpcPeer, type RpcPeerOptions, type ServiceBundle } from '@dxos/rpc';
8
+ import { RpcPeer, type RpcPeerOptions, type ServiceBundle, parseMethodName } from '@dxos/rpc';
9
9
  import { MapCounter, trace } from '@dxos/tracing';
10
10
  import { type MaybePromise } from '@dxos/util';
11
11
 
12
12
  import { type ServiceRegistry } from './service-registry';
13
13
 
14
- export type ClientRpcServerParams = {
14
+ export type ClientRpcServerProps = {
15
15
  serviceRegistry: ServiceRegistry<ClientServices>;
16
16
  handleCall?: (
17
17
  method: string,
@@ -30,8 +30,8 @@ export class ClientRpcServer {
30
30
  private readonly _serviceRegistry: ServiceRegistry<ClientServices>;
31
31
  private readonly _rpcPeer: RpcPeer;
32
32
  private readonly _handlerCache = new Map<string, ServiceHandler<any>>();
33
- private readonly _handleCall: ClientRpcServerParams['handleCall'];
34
- private readonly _handleStream: ClientRpcServerParams['handleStream'];
33
+ private readonly _handleCall: ClientRpcServerProps['handleCall'];
34
+ private readonly _handleStream: ClientRpcServerProps['handleStream'];
35
35
 
36
36
  @trace.metricsCounter()
37
37
  private readonly _callMetrics = new MapCounter();
@@ -41,7 +41,7 @@ export class ClientRpcServer {
41
41
  return Object.keys(this._serviceRegistry.services);
42
42
  }
43
43
 
44
- constructor(params: ClientRpcServerParams) {
44
+ constructor(params: ClientRpcServerProps) {
45
45
  const { serviceRegistry, handleCall, handleStream, ...rpcOptions } = params;
46
46
  this._handleCall = handleCall;
47
47
  this._handleStream = handleStream;