@dxos/client-services 0.1.53-main.f5aedb7 → 0.1.53-next.3ab34c0
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.
- package/dist/lib/browser/{chunk-PWZ2J6KS.mjs → chunk-F4BHRFH4.mjs} +250 -115
- package/dist/lib/browser/chunk-F4BHRFH4.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +20 -59
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +19 -2
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/index.cjs +274 -179
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +247 -145
- package/dist/lib/node/packlets/testing/index.cjs.map +4 -4
- package/dist/types/src/packlets/identity/authenticator.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
- package/dist/types/src/packlets/services/index.d.ts +1 -0
- package/dist/types/src/packlets/services/index.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts +11 -2
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/notarization-plugin.d.ts +2 -1
- package/dist/types/src/packlets/spaces/notarization-plugin.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +7 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/worker-session.d.ts.map +1 -1
- package/package.json +32 -32
- package/src/packlets/identity/authenticator.ts +4 -2
- package/src/packlets/identity/identity.ts +21 -26
- package/src/packlets/services/index.ts +1 -0
- package/src/packlets/services/service-context.ts +9 -7
- package/src/packlets/spaces/data-space-manager.test.ts +75 -119
- package/src/packlets/spaces/data-space-manager.ts +13 -3
- package/src/packlets/spaces/data-space.ts +66 -20
- package/src/packlets/spaces/notarization-plugin.test.ts +1 -1
- package/src/packlets/spaces/notarization-plugin.ts +5 -1
- package/src/packlets/spaces/spaces-service.test.ts +5 -3
- package/src/packlets/spaces/spaces-service.ts +26 -8
- package/src/packlets/testing/test-builder.ts +35 -2
- package/src/packlets/vault/worker-session.ts +5 -4
- package/dist/lib/browser/chunk-PWZ2J6KS.mjs.map +0 -7
|
@@ -65,11 +65,16 @@ var import_tiny_invariant14 = __toESM(require("tiny-invariant"));
|
|
|
65
65
|
var import_async18 = require("@dxos/async");
|
|
66
66
|
var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
|
|
67
67
|
|
|
68
|
+
// packages/sdk/client-services/src/packlets/services/client-rpc-server.ts
|
|
69
|
+
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
70
|
+
var import_debug = require("@dxos/debug");
|
|
71
|
+
var import_rpc = require("@dxos/rpc");
|
|
72
|
+
|
|
68
73
|
// packages/sdk/client-services/src/packlets/services/service-context.ts
|
|
69
74
|
var import_tiny_invariant11 = __toESM(require("tiny-invariant"));
|
|
70
75
|
var import_async11 = require("@dxos/async");
|
|
71
76
|
var import_credentials14 = require("@dxos/credentials");
|
|
72
|
-
var
|
|
77
|
+
var import_debug7 = require("@dxos/debug");
|
|
73
78
|
var import_echo_pipeline3 = require("@dxos/echo-pipeline");
|
|
74
79
|
var import_feed_store3 = require("@dxos/feed-store");
|
|
75
80
|
var import_keyring = require("@dxos/keyring");
|
|
@@ -86,6 +91,7 @@ var import_credentials2 = require("@dxos/credentials");
|
|
|
86
91
|
var import_log = require("@dxos/log");
|
|
87
92
|
var import_protocols = require("@dxos/protocols");
|
|
88
93
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/authenticator.ts";
|
|
94
|
+
var Credential = import_protocols.schema.getCodecForType("dxos.halo.credentials.Credential");
|
|
89
95
|
var createAuthProvider = (signer) => async (nonce) => {
|
|
90
96
|
const credential = await signer.createCredential({
|
|
91
97
|
assertion: {
|
|
@@ -94,7 +100,7 @@ var createAuthProvider = (signer) => async (nonce) => {
|
|
|
94
100
|
subject: signer.getIssuer(),
|
|
95
101
|
nonce
|
|
96
102
|
});
|
|
97
|
-
return
|
|
103
|
+
return Credential.encode(credential);
|
|
98
104
|
};
|
|
99
105
|
var TrustedKeySetAuthVerifier = class {
|
|
100
106
|
// prettier-ignore
|
|
@@ -107,12 +113,12 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
107
113
|
}
|
|
108
114
|
get verifier() {
|
|
109
115
|
return async (nonce, auth) => {
|
|
110
|
-
const credential =
|
|
116
|
+
const credential = Credential.decode(auth);
|
|
111
117
|
(0, import_log.log)("authenticating...", {
|
|
112
118
|
credential
|
|
113
119
|
}, {
|
|
114
120
|
F: __dxlog_file,
|
|
115
|
-
L:
|
|
121
|
+
L: 59,
|
|
116
122
|
S: this,
|
|
117
123
|
C: (f, a) => f(...a)
|
|
118
124
|
});
|
|
@@ -122,7 +128,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
122
128
|
result
|
|
123
129
|
}, {
|
|
124
130
|
F: __dxlog_file,
|
|
125
|
-
L:
|
|
131
|
+
L: 63,
|
|
126
132
|
S: this,
|
|
127
133
|
C: (f, a) => f(...a)
|
|
128
134
|
});
|
|
@@ -134,7 +140,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
134
140
|
credential
|
|
135
141
|
}, {
|
|
136
142
|
F: __dxlog_file,
|
|
137
|
-
L:
|
|
143
|
+
L: 68,
|
|
138
144
|
S: this,
|
|
139
145
|
C: (f, a) => f(...a)
|
|
140
146
|
});
|
|
@@ -145,7 +151,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
145
151
|
key: credential.issuer
|
|
146
152
|
}, {
|
|
147
153
|
F: __dxlog_file,
|
|
148
|
-
L:
|
|
154
|
+
L: 73,
|
|
149
155
|
S: this,
|
|
150
156
|
C: (f, a) => f(...a)
|
|
151
157
|
});
|
|
@@ -161,7 +167,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
161
167
|
key: credential.issuer
|
|
162
168
|
}, {
|
|
163
169
|
F: __dxlog_file,
|
|
164
|
-
L:
|
|
170
|
+
L: 84,
|
|
165
171
|
S: this,
|
|
166
172
|
C: (f, a) => f(...a)
|
|
167
173
|
});
|
|
@@ -171,7 +177,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
171
177
|
key: credential.issuer
|
|
172
178
|
}, {
|
|
173
179
|
F: __dxlog_file,
|
|
174
|
-
L:
|
|
180
|
+
L: 87,
|
|
175
181
|
S: this,
|
|
176
182
|
C: (f, a) => f(...a)
|
|
177
183
|
});
|
|
@@ -199,7 +205,7 @@ var import_tiny_invariant = __toESM(require("tiny-invariant"));
|
|
|
199
205
|
var import_async2 = require("@dxos/async");
|
|
200
206
|
var import_client_protocol = require("@dxos/client-protocol");
|
|
201
207
|
var import_credentials3 = require("@dxos/credentials");
|
|
202
|
-
var
|
|
208
|
+
var import_debug2 = require("@dxos/debug");
|
|
203
209
|
var import_feed_store = require("@dxos/feed-store");
|
|
204
210
|
var import_log2 = require("@dxos/log");
|
|
205
211
|
var import_credentials4 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
@@ -211,15 +217,15 @@ var Identity = class {
|
|
|
211
217
|
this._signer = signer;
|
|
212
218
|
this.identityKey = identityKey;
|
|
213
219
|
this.deviceKey = deviceKey;
|
|
214
|
-
this._deviceStateMachine =
|
|
220
|
+
this._deviceStateMachine = new import_credentials3.DeviceStateMachine({
|
|
215
221
|
identityKey: this.identityKey,
|
|
216
222
|
deviceKey: this.deviceKey,
|
|
217
223
|
onUpdate: () => this.stateUpdate.emit()
|
|
218
|
-
})
|
|
219
|
-
this._profileStateMachine =
|
|
224
|
+
});
|
|
225
|
+
this._profileStateMachine = new import_credentials3.ProfileStateMachine({
|
|
220
226
|
identityKey: this.identityKey,
|
|
221
227
|
onUpdate: () => this.stateUpdate.emit()
|
|
222
|
-
})
|
|
228
|
+
});
|
|
223
229
|
this.authVerifier = new TrustedKeySetAuthVerifier({
|
|
224
230
|
trustedKeysProvider: () => this.authorizedDeviceKeys,
|
|
225
231
|
update: this.stateUpdate,
|
|
@@ -228,27 +234,27 @@ var Identity = class {
|
|
|
228
234
|
}
|
|
229
235
|
// TODO(burdon): Expose state object?
|
|
230
236
|
get authorizedDeviceKeys() {
|
|
231
|
-
return this._deviceStateMachine.
|
|
237
|
+
return this._deviceStateMachine.authorizedDeviceKeys;
|
|
232
238
|
}
|
|
233
239
|
async open() {
|
|
234
|
-
await this.
|
|
235
|
-
await this.
|
|
240
|
+
await this.space.spaceState.addCredentialProcessor(this._deviceStateMachine);
|
|
241
|
+
await this.space.spaceState.addCredentialProcessor(this._profileStateMachine);
|
|
236
242
|
await this.space.open();
|
|
237
243
|
}
|
|
238
244
|
async close() {
|
|
239
245
|
await this.authVerifier.close();
|
|
240
|
-
await this.
|
|
241
|
-
await this.
|
|
246
|
+
await this.space.spaceState.removeCredentialProcessor(this._profileStateMachine);
|
|
247
|
+
await this.space.spaceState.removeCredentialProcessor(this._deviceStateMachine);
|
|
242
248
|
await this.space.close();
|
|
243
249
|
}
|
|
244
250
|
async ready() {
|
|
245
|
-
await this._deviceStateMachine.
|
|
251
|
+
await this._deviceStateMachine.deviceChainReady.wait();
|
|
246
252
|
await this.controlPipeline.state.waitUntilReachedTargetTimeframe({
|
|
247
253
|
timeout: import_client_protocol.LOAD_CONTROL_FEEDS_TIMEOUT
|
|
248
254
|
});
|
|
249
255
|
}
|
|
250
256
|
get profileDocument() {
|
|
251
|
-
return this._profileStateMachine.
|
|
257
|
+
return this._profileStateMachine.profile;
|
|
252
258
|
}
|
|
253
259
|
/**
|
|
254
260
|
* @test-only
|
|
@@ -263,14 +269,14 @@ var Identity = class {
|
|
|
263
269
|
return this.space.genesisFeedKey;
|
|
264
270
|
}
|
|
265
271
|
get deviceCredentialChain() {
|
|
266
|
-
return this._deviceStateMachine.
|
|
272
|
+
return this._deviceStateMachine.deviceCredentialChain;
|
|
267
273
|
}
|
|
268
274
|
getAdmissionCredentials() {
|
|
269
275
|
var _a, _b;
|
|
270
276
|
return {
|
|
271
277
|
deviceKey: this.deviceKey,
|
|
272
|
-
controlFeedKey: (_a = this.space.controlFeedKey) != null ? _a : (0,
|
|
273
|
-
dataFeedKey: (_b = this.space.dataFeedKey) != null ? _b : (0,
|
|
278
|
+
controlFeedKey: (_a = this.space.controlFeedKey) != null ? _a : (0, import_debug2.failUndefined)(),
|
|
279
|
+
dataFeedKey: (_b = this.space.dataFeedKey) != null ? _b : (0, import_debug2.failUndefined)()
|
|
274
280
|
};
|
|
275
281
|
}
|
|
276
282
|
/**
|
|
@@ -278,8 +284,8 @@ var Identity = class {
|
|
|
278
284
|
* Requires identity to be ready.
|
|
279
285
|
*/
|
|
280
286
|
getIdentityCredentialSigner() {
|
|
281
|
-
(0, import_tiny_invariant.default)(this._deviceStateMachine.
|
|
282
|
-
return (0, import_credentials3.createCredentialSignerWithChain)(this._signer, this._deviceStateMachine.
|
|
287
|
+
(0, import_tiny_invariant.default)(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.");
|
|
288
|
+
return (0, import_credentials3.createCredentialSignerWithChain)(this._signer, this._deviceStateMachine.deviceCredentialChain, this.deviceKey);
|
|
283
289
|
}
|
|
284
290
|
/**
|
|
285
291
|
* Issues credentials as device.
|
|
@@ -296,7 +302,7 @@ var Identity = class {
|
|
|
296
302
|
dataFeedKey
|
|
297
303
|
}, {
|
|
298
304
|
F: __dxlog_file2,
|
|
299
|
-
L:
|
|
305
|
+
L: 151,
|
|
300
306
|
S: this,
|
|
301
307
|
C: (f, a) => f(...a)
|
|
302
308
|
});
|
|
@@ -604,9 +610,9 @@ var IdentityManager = class {
|
|
|
604
610
|
|
|
605
611
|
// packages/sdk/client-services/src/packlets/identity/identity-service.ts
|
|
606
612
|
var import_tiny_invariant3 = __toESM(require("tiny-invariant"));
|
|
607
|
-
var
|
|
613
|
+
var import_codec_protobuf2 = require("@dxos/codec-protobuf");
|
|
608
614
|
var import_credentials7 = require("@dxos/credentials");
|
|
609
|
-
var
|
|
615
|
+
var import_debug3 = require("@dxos/debug");
|
|
610
616
|
var IdentityServiceImpl = class {
|
|
611
617
|
// TODO(wittjosiah): Remove dependency on service context.
|
|
612
618
|
constructor(_serviceContext) {
|
|
@@ -617,10 +623,10 @@ var IdentityServiceImpl = class {
|
|
|
617
623
|
return this._getIdentity();
|
|
618
624
|
}
|
|
619
625
|
async recoverIdentity(request) {
|
|
620
|
-
return (0,
|
|
626
|
+
return (0, import_debug3.todo)();
|
|
621
627
|
}
|
|
622
628
|
queryIdentity() {
|
|
623
|
-
return new
|
|
629
|
+
return new import_codec_protobuf2.Stream(({ next }) => {
|
|
624
630
|
const emitNext = () => next({
|
|
625
631
|
identity: this._getIdentity()
|
|
626
632
|
});
|
|
@@ -1557,7 +1563,7 @@ var InvitationsHandler = class {
|
|
|
1557
1563
|
// packages/sdk/client-services/src/packlets/invitations/invitations-service.ts
|
|
1558
1564
|
var import_tiny_invariant7 = __toESM(require("tiny-invariant"));
|
|
1559
1565
|
var import_async6 = require("@dxos/async");
|
|
1560
|
-
var
|
|
1566
|
+
var import_codec_protobuf3 = require("@dxos/codec-protobuf");
|
|
1561
1567
|
var import_log6 = require("@dxos/log");
|
|
1562
1568
|
var import_services4 = require("@dxos/protocols/proto/dxos/client/services");
|
|
1563
1569
|
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-service.ts";
|
|
@@ -1587,7 +1593,7 @@ var InvitationsServiceImpl = class {
|
|
|
1587
1593
|
this._createInvitations.set(invitation.get().invitationId, invitation);
|
|
1588
1594
|
this._invitationCreated.emit(invitation.get());
|
|
1589
1595
|
}
|
|
1590
|
-
return new
|
|
1596
|
+
return new import_codec_protobuf3.Stream(({ next, close }) => {
|
|
1591
1597
|
invitation.subscribe((invitation2) => {
|
|
1592
1598
|
next(invitation2);
|
|
1593
1599
|
}, (err) => {
|
|
@@ -1609,7 +1615,7 @@ var InvitationsServiceImpl = class {
|
|
|
1609
1615
|
this._acceptInvitations.set(invitation.get().invitationId, invitation);
|
|
1610
1616
|
this._invitationAccepted.emit(invitation.get());
|
|
1611
1617
|
}
|
|
1612
|
-
return new
|
|
1618
|
+
return new import_codec_protobuf3.Stream(({ next, close }) => {
|
|
1613
1619
|
invitation.subscribe((invitation2) => {
|
|
1614
1620
|
next(invitation2);
|
|
1615
1621
|
}, (err) => {
|
|
@@ -1672,7 +1678,7 @@ var InvitationsServiceImpl = class {
|
|
|
1672
1678
|
}
|
|
1673
1679
|
}
|
|
1674
1680
|
queryInvitations() {
|
|
1675
|
-
return new
|
|
1681
|
+
return new import_codec_protobuf3.Stream(({ next, ctx }) => {
|
|
1676
1682
|
this._invitationCreated.on(ctx, (invitation) => {
|
|
1677
1683
|
next({
|
|
1678
1684
|
action: import_services4.QueryInvitationsResponse.Action.ADDED,
|
|
@@ -1830,7 +1836,7 @@ var import_util4 = require("@dxos/util");
|
|
|
1830
1836
|
var import_async8 = require("@dxos/async");
|
|
1831
1837
|
var import_client_protocol3 = require("@dxos/client-protocol");
|
|
1832
1838
|
var import_context5 = require("@dxos/context");
|
|
1833
|
-
var
|
|
1839
|
+
var import_debug4 = require("@dxos/debug");
|
|
1834
1840
|
var import_echo_pipeline = require("@dxos/echo-pipeline");
|
|
1835
1841
|
var import_errors3 = require("@dxos/errors");
|
|
1836
1842
|
var import_keys6 = require("@dxos/keys");
|
|
@@ -1862,6 +1868,9 @@ var NotarizationPlugin = class {
|
|
|
1862
1868
|
this._processedCredentials = new import_util2.ComplexSet(import_keys5.PublicKey.hash);
|
|
1863
1869
|
this._processCredentialsTriggers = new import_util2.ComplexMap(import_keys5.PublicKey.hash);
|
|
1864
1870
|
}
|
|
1871
|
+
get hasWriter() {
|
|
1872
|
+
return !!this._writer;
|
|
1873
|
+
}
|
|
1865
1874
|
async open() {
|
|
1866
1875
|
}
|
|
1867
1876
|
async close() {
|
|
@@ -1875,7 +1884,7 @@ var NotarizationPlugin = class {
|
|
|
1875
1884
|
credentials
|
|
1876
1885
|
}, {
|
|
1877
1886
|
F: __dxlog_file8,
|
|
1878
|
-
L:
|
|
1887
|
+
L: 91,
|
|
1879
1888
|
S: this,
|
|
1880
1889
|
C: (f, a) => f(...a)
|
|
1881
1890
|
});
|
|
@@ -1887,7 +1896,7 @@ var NotarizationPlugin = class {
|
|
|
1887
1896
|
err
|
|
1888
1897
|
}, {
|
|
1889
1898
|
F: __dxlog_file8,
|
|
1890
|
-
L:
|
|
1899
|
+
L: 100,
|
|
1891
1900
|
S: this,
|
|
1892
1901
|
C: (f, a) => f(...a)
|
|
1893
1902
|
});
|
|
@@ -1903,7 +1912,7 @@ var NotarizationPlugin = class {
|
|
|
1903
1912
|
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
1904
1913
|
}, {
|
|
1905
1914
|
F: __dxlog_file8,
|
|
1906
|
-
L:
|
|
1915
|
+
L: 112,
|
|
1907
1916
|
S: this,
|
|
1908
1917
|
C: (f, a) => f(...a)
|
|
1909
1918
|
});
|
|
@@ -1926,7 +1935,7 @@ var NotarizationPlugin = class {
|
|
|
1926
1935
|
retryIn: retryTimeout
|
|
1927
1936
|
}, {
|
|
1928
1937
|
F: __dxlog_file8,
|
|
1929
|
-
L:
|
|
1938
|
+
L: 137,
|
|
1930
1939
|
S: this,
|
|
1931
1940
|
C: (f, a) => f(...a)
|
|
1932
1941
|
});
|
|
@@ -1940,7 +1949,7 @@ var NotarizationPlugin = class {
|
|
|
1940
1949
|
credentialId: credentials.map((credential) => credential.id)
|
|
1941
1950
|
}, {
|
|
1942
1951
|
F: __dxlog_file8,
|
|
1943
|
-
L:
|
|
1952
|
+
L: 144,
|
|
1944
1953
|
S: this,
|
|
1945
1954
|
C: (f, a) => f(...a)
|
|
1946
1955
|
});
|
|
@@ -1949,7 +1958,7 @@ var NotarizationPlugin = class {
|
|
|
1949
1958
|
});
|
|
1950
1959
|
(0, import_log8.log)("success", void 0, {
|
|
1951
1960
|
F: __dxlog_file8,
|
|
1952
|
-
L:
|
|
1961
|
+
L: 148,
|
|
1953
1962
|
S: this,
|
|
1954
1963
|
C: (f, a) => f(...a)
|
|
1955
1964
|
});
|
|
@@ -1958,7 +1967,7 @@ var NotarizationPlugin = class {
|
|
|
1958
1967
|
if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
|
|
1959
1968
|
import_log8.log.warn("error notarizing (recoverable)", err, {
|
|
1960
1969
|
F: __dxlog_file8,
|
|
1961
|
-
L:
|
|
1970
|
+
L: 152,
|
|
1962
1971
|
S: this,
|
|
1963
1972
|
C: (f, a) => f(...a)
|
|
1964
1973
|
});
|
|
@@ -1976,7 +1985,7 @@ var NotarizationPlugin = class {
|
|
|
1976
1985
|
]);
|
|
1977
1986
|
(0, import_log8.log)("done", void 0, {
|
|
1978
1987
|
F: __dxlog_file8,
|
|
1979
|
-
L:
|
|
1988
|
+
L: 163,
|
|
1980
1989
|
S: this,
|
|
1981
1990
|
C: (f, a) => f(...a)
|
|
1982
1991
|
});
|
|
@@ -1987,7 +1996,7 @@ var NotarizationPlugin = class {
|
|
|
1987
1996
|
/**
|
|
1988
1997
|
* Called with credentials arriving from the control pipeline.
|
|
1989
1998
|
*/
|
|
1990
|
-
async
|
|
1999
|
+
async processCredential(credential) {
|
|
1991
2000
|
var _a;
|
|
1992
2001
|
if (!credential.id) {
|
|
1993
2002
|
return;
|
|
@@ -2029,7 +2038,7 @@ var NotarizationPlugin = class {
|
|
|
2029
2038
|
peer: extension.localPeerId
|
|
2030
2039
|
}, {
|
|
2031
2040
|
F: __dxlog_file8,
|
|
2032
|
-
L:
|
|
2041
|
+
L: 212,
|
|
2033
2042
|
S: this,
|
|
2034
2043
|
C: (f, a) => f(...a)
|
|
2035
2044
|
});
|
|
@@ -2041,7 +2050,7 @@ var NotarizationPlugin = class {
|
|
|
2041
2050
|
peer: extension.localPeerId
|
|
2042
2051
|
}, {
|
|
2043
2052
|
F: __dxlog_file8,
|
|
2044
|
-
L:
|
|
2053
|
+
L: 217,
|
|
2045
2054
|
S: this,
|
|
2046
2055
|
C: (f, a) => f(...a)
|
|
2047
2056
|
});
|
|
@@ -2098,6 +2107,7 @@ var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/sr
|
|
|
2098
2107
|
var DataSpace = class DataSpace2 {
|
|
2099
2108
|
constructor(params) {
|
|
2100
2109
|
this._ctx = new import_context5.Context();
|
|
2110
|
+
this._notarizationPlugin = new NotarizationPlugin();
|
|
2101
2111
|
this._state = import_services6.SpaceState.CLOSED;
|
|
2102
2112
|
/**
|
|
2103
2113
|
* Error for _state === SpaceState.ERROR.
|
|
@@ -2120,8 +2130,8 @@ var DataSpace = class DataSpace2 {
|
|
|
2120
2130
|
update: this._inner.stateUpdate,
|
|
2121
2131
|
authTimeout: import_client_protocol3.AUTH_TIMEOUT
|
|
2122
2132
|
});
|
|
2123
|
-
this._notarizationPluginConsumer = this._inner.spaceState.registerProcessor(new NotarizationPlugin());
|
|
2124
2133
|
this._cache = params.cache;
|
|
2134
|
+
this._state = params.initialState;
|
|
2125
2135
|
}
|
|
2126
2136
|
get key() {
|
|
2127
2137
|
return this._inner.key;
|
|
@@ -2143,25 +2153,36 @@ var DataSpace = class DataSpace2 {
|
|
|
2143
2153
|
return this._presence;
|
|
2144
2154
|
}
|
|
2145
2155
|
get notarizationPlugin() {
|
|
2146
|
-
return this.
|
|
2156
|
+
return this._notarizationPlugin;
|
|
2147
2157
|
}
|
|
2148
2158
|
get cache() {
|
|
2149
2159
|
return this._cache;
|
|
2150
2160
|
}
|
|
2151
2161
|
async open() {
|
|
2152
|
-
await this.
|
|
2153
|
-
|
|
2162
|
+
await this._open();
|
|
2163
|
+
}
|
|
2164
|
+
async _open() {
|
|
2165
|
+
await this._notarizationPlugin.open();
|
|
2166
|
+
await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
|
|
2154
2167
|
await this._inner.open();
|
|
2155
|
-
this._state = import_services6.SpaceState.
|
|
2168
|
+
this._state = import_services6.SpaceState.CONTROL_ONLY;
|
|
2169
|
+
this.stateUpdate.emit();
|
|
2170
|
+
this.metrics = {};
|
|
2156
2171
|
this.metrics.open = new Date();
|
|
2157
2172
|
}
|
|
2158
2173
|
async close() {
|
|
2174
|
+
await this._close();
|
|
2175
|
+
}
|
|
2176
|
+
async _close() {
|
|
2177
|
+
var _a, _b;
|
|
2178
|
+
await ((_b = (_a = this._callbacks).beforeClose) == null ? void 0 : _b.call(_a));
|
|
2159
2179
|
this._state = import_services6.SpaceState.CLOSED;
|
|
2160
2180
|
await this._ctx.dispose();
|
|
2181
|
+
this._ctx = new import_context5.Context();
|
|
2161
2182
|
await this.authVerifier.close();
|
|
2162
2183
|
await this._inner.close();
|
|
2163
|
-
await this.
|
|
2164
|
-
await this.
|
|
2184
|
+
await this._inner.spaceState.removeCredentialProcessor(this._notarizationPlugin);
|
|
2185
|
+
await this._notarizationPlugin.close();
|
|
2165
2186
|
await this._presence.destroy();
|
|
2166
2187
|
}
|
|
2167
2188
|
async postMessage(channel, message) {
|
|
@@ -2182,7 +2203,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2182
2203
|
if (err instanceof import_errors3.CancelledError) {
|
|
2183
2204
|
(0, import_log9.log)("Data pipeline initialization cancelled", err, {
|
|
2184
2205
|
F: __dxlog_file9,
|
|
2185
|
-
L:
|
|
2206
|
+
L: 193,
|
|
2186
2207
|
S: this,
|
|
2187
2208
|
C: (f, a) => f(...a)
|
|
2188
2209
|
});
|
|
@@ -2190,7 +2211,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2190
2211
|
}
|
|
2191
2212
|
import_log9.log.error("Error initializing data pipeline", err, {
|
|
2192
2213
|
F: __dxlog_file9,
|
|
2193
|
-
L:
|
|
2214
|
+
L: 197,
|
|
2194
2215
|
S: this,
|
|
2195
2216
|
C: (f, a) => f(...a)
|
|
2196
2217
|
});
|
|
@@ -2204,7 +2225,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2204
2225
|
}
|
|
2205
2226
|
async initializeDataPipeline() {
|
|
2206
2227
|
var _a, _b, _c, _d;
|
|
2207
|
-
if (this._state !== import_services6.SpaceState.
|
|
2228
|
+
if (this._state !== import_services6.SpaceState.CONTROL_ONLY) {
|
|
2208
2229
|
throw new import_errors3.SystemError("Invalid operation");
|
|
2209
2230
|
}
|
|
2210
2231
|
this._state = import_services6.SpaceState.INITIALIZING;
|
|
@@ -2216,22 +2237,24 @@ var DataSpace = class DataSpace2 {
|
|
|
2216
2237
|
await this._createWritableFeeds();
|
|
2217
2238
|
(0, import_log9.log)("Writable feeds created", void 0, {
|
|
2218
2239
|
F: __dxlog_file9,
|
|
2219
|
-
L:
|
|
2240
|
+
L: 221,
|
|
2220
2241
|
S: this,
|
|
2221
2242
|
C: (f, a) => f(...a)
|
|
2222
2243
|
});
|
|
2223
2244
|
this.stateUpdate.emit();
|
|
2224
|
-
this.notarizationPlugin.
|
|
2225
|
-
credential
|
|
2226
|
-
credential
|
|
2227
|
-
|
|
2228
|
-
|
|
2245
|
+
if (!this.notarizationPlugin.hasWriter) {
|
|
2246
|
+
this.notarizationPlugin.setWriter((0, import_echo_pipeline.createMappedFeedWriter)((credential) => ({
|
|
2247
|
+
credential: {
|
|
2248
|
+
credential
|
|
2249
|
+
}
|
|
2250
|
+
}), this._inner.controlPipeline.writer));
|
|
2251
|
+
}
|
|
2229
2252
|
await this._inner.initializeDataPipeline();
|
|
2230
2253
|
this.metrics.dataPipelineOpen = new Date();
|
|
2231
2254
|
await (0, import_context5.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
|
|
2232
2255
|
(0, import_log9.log)("waiting for data pipeline to reach target timeframe", void 0, {
|
|
2233
2256
|
F: __dxlog_file9,
|
|
2234
|
-
L:
|
|
2257
|
+
L: 242,
|
|
2235
2258
|
S: this,
|
|
2236
2259
|
C: (f, a) => f(...a)
|
|
2237
2260
|
});
|
|
@@ -2242,7 +2265,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2242
2265
|
this.metrics.dataPipelineReady = new Date();
|
|
2243
2266
|
(0, import_log9.log)("data pipeline ready", void 0, {
|
|
2244
2267
|
F: __dxlog_file9,
|
|
2245
|
-
L:
|
|
2268
|
+
L: 251,
|
|
2246
2269
|
S: this,
|
|
2247
2270
|
C: (f, a) => f(...a)
|
|
2248
2271
|
});
|
|
@@ -2322,17 +2345,46 @@ var DataSpace = class DataSpace2 {
|
|
|
2322
2345
|
}
|
|
2323
2346
|
}
|
|
2324
2347
|
}
|
|
2348
|
+
async activate() {
|
|
2349
|
+
if (this._state !== import_services6.SpaceState.INACTIVE) {
|
|
2350
|
+
throw new import_errors3.SystemError("Invalid operation");
|
|
2351
|
+
}
|
|
2352
|
+
await this._metadataStore.setSpaceState(this.key, import_services6.SpaceState.ACTIVE);
|
|
2353
|
+
await this._open();
|
|
2354
|
+
this.initializeDataPipelineAsync();
|
|
2355
|
+
}
|
|
2356
|
+
async deactivate() {
|
|
2357
|
+
if (this._state === import_services6.SpaceState.INACTIVE) {
|
|
2358
|
+
throw new import_errors3.SystemError("Invalid operation");
|
|
2359
|
+
}
|
|
2360
|
+
await this._metadataStore.setSpaceState(this.key, import_services6.SpaceState.INACTIVE);
|
|
2361
|
+
await this._close();
|
|
2362
|
+
this._state = import_services6.SpaceState.INACTIVE;
|
|
2363
|
+
this.stateUpdate.emit();
|
|
2364
|
+
}
|
|
2325
2365
|
};
|
|
2326
2366
|
_ts_decorate([
|
|
2327
|
-
|
|
2367
|
+
import_async8.synchronized
|
|
2368
|
+
], DataSpace.prototype, "open", null);
|
|
2369
|
+
_ts_decorate([
|
|
2370
|
+
import_async8.synchronized
|
|
2371
|
+
], DataSpace.prototype, "close", null);
|
|
2372
|
+
_ts_decorate([
|
|
2373
|
+
(0, import_debug4.timed)(1e4)
|
|
2328
2374
|
], DataSpace.prototype, "_createWritableFeeds", null);
|
|
2375
|
+
_ts_decorate([
|
|
2376
|
+
import_async8.synchronized
|
|
2377
|
+
], DataSpace.prototype, "activate", null);
|
|
2378
|
+
_ts_decorate([
|
|
2379
|
+
import_async8.synchronized
|
|
2380
|
+
], DataSpace.prototype, "deactivate", null);
|
|
2329
2381
|
DataSpace = _ts_decorate([
|
|
2330
2382
|
(0, import_async8.trackLeaks)("open", "close")
|
|
2331
2383
|
], DataSpace);
|
|
2332
2384
|
|
|
2333
2385
|
// packages/sdk/client-services/src/packlets/spaces/genesis.ts
|
|
2334
2386
|
var import_credentials11 = require("@dxos/credentials");
|
|
2335
|
-
var
|
|
2387
|
+
var import_debug5 = require("@dxos/debug");
|
|
2336
2388
|
var import_credentials12 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
2337
2389
|
var import_timeframe2 = require("@dxos/timeframe");
|
|
2338
2390
|
var spaceGenesis = async (keyring, signingContext, space) => {
|
|
@@ -2356,11 +2408,11 @@ var spaceGenesis = async (keyring, signingContext, space) => {
|
|
|
2356
2408
|
spaceKey: space.key,
|
|
2357
2409
|
role: import_credentials12.SpaceMember.Role.ADMIN,
|
|
2358
2410
|
profile: signingContext.profile,
|
|
2359
|
-
genesisFeedKey: (_a = space.controlFeedKey) != null ? _a : (0,
|
|
2411
|
+
genesisFeedKey: (_a = space.controlFeedKey) != null ? _a : (0, import_debug5.failUndefined)()
|
|
2360
2412
|
}
|
|
2361
2413
|
}),
|
|
2362
2414
|
await signingContext.credentialSigner.createCredential({
|
|
2363
|
-
subject: (_b = space.controlFeedKey) != null ? _b : (0,
|
|
2415
|
+
subject: (_b = space.controlFeedKey) != null ? _b : (0, import_debug5.failUndefined)(),
|
|
2364
2416
|
assertion: {
|
|
2365
2417
|
"@type": "dxos.halo.credentials.AdmittedFeed",
|
|
2366
2418
|
spaceKey: space.key,
|
|
@@ -2370,7 +2422,7 @@ var spaceGenesis = async (keyring, signingContext, space) => {
|
|
|
2370
2422
|
}
|
|
2371
2423
|
}),
|
|
2372
2424
|
await signingContext.credentialSigner.createCredential({
|
|
2373
|
-
subject: (_c = space.dataFeedKey) != null ? _c : (0,
|
|
2425
|
+
subject: (_c = space.dataFeedKey) != null ? _c : (0, import_debug5.failUndefined)(),
|
|
2374
2426
|
assertion: {
|
|
2375
2427
|
"@type": "dxos.halo.credentials.AdmittedFeed",
|
|
2376
2428
|
spaceKey: space.key,
|
|
@@ -2380,7 +2432,7 @@ var spaceGenesis = async (keyring, signingContext, space) => {
|
|
|
2380
2432
|
}
|
|
2381
2433
|
}),
|
|
2382
2434
|
await signingContext.credentialSigner.createCredential({
|
|
2383
|
-
subject: (_d = space.key) != null ? _d : (0,
|
|
2435
|
+
subject: (_d = space.key) != null ? _d : (0, import_debug5.failUndefined)(),
|
|
2384
2436
|
assertion: {
|
|
2385
2437
|
"@type": "dxos.halo.credentials.Epoch",
|
|
2386
2438
|
number: 0,
|
|
@@ -2465,14 +2517,16 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2465
2517
|
C: (f, a) => f(...a)
|
|
2466
2518
|
});
|
|
2467
2519
|
const space = await this._constructSpace(spaceMetadata);
|
|
2468
|
-
|
|
2520
|
+
if (spaceMetadata.state !== import_services7.SpaceState.INACTIVE) {
|
|
2521
|
+
space.initializeDataPipelineAsync();
|
|
2522
|
+
}
|
|
2469
2523
|
} catch (err) {
|
|
2470
2524
|
import_log10.log.error("Error loading space", {
|
|
2471
2525
|
spaceMetadata,
|
|
2472
2526
|
err
|
|
2473
2527
|
}, {
|
|
2474
2528
|
F: __dxlog_file10,
|
|
2475
|
-
L:
|
|
2529
|
+
L: 93,
|
|
2476
2530
|
S: this,
|
|
2477
2531
|
C: (f, a) => f(...a)
|
|
2478
2532
|
});
|
|
@@ -2484,7 +2538,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2484
2538
|
id: this._instanceId
|
|
2485
2539
|
}), {
|
|
2486
2540
|
F: __dxlog_file10,
|
|
2487
|
-
L:
|
|
2541
|
+
L: 99,
|
|
2488
2542
|
S: this,
|
|
2489
2543
|
C: (f, a) => f(...a)
|
|
2490
2544
|
});
|
|
@@ -2492,7 +2546,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2492
2546
|
async close() {
|
|
2493
2547
|
(0, import_log10.log)("close", void 0, {
|
|
2494
2548
|
F: __dxlog_file10,
|
|
2495
|
-
L:
|
|
2549
|
+
L: 104,
|
|
2496
2550
|
S: this,
|
|
2497
2551
|
C: (f, a) => f(...a)
|
|
2498
2552
|
});
|
|
@@ -2514,13 +2568,14 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2514
2568
|
key: spaceKey,
|
|
2515
2569
|
genesisFeedKey: controlFeedKey,
|
|
2516
2570
|
controlFeedKey,
|
|
2517
|
-
dataFeedKey
|
|
2571
|
+
dataFeedKey,
|
|
2572
|
+
state: import_services7.SpaceState.ACTIVE
|
|
2518
2573
|
};
|
|
2519
2574
|
(0, import_log10.log)("creating space...", {
|
|
2520
2575
|
spaceKey
|
|
2521
2576
|
}, {
|
|
2522
2577
|
F: __dxlog_file10,
|
|
2523
|
-
L:
|
|
2578
|
+
L: 129,
|
|
2524
2579
|
S: this,
|
|
2525
2580
|
C: (f, a) => f(...a)
|
|
2526
2581
|
});
|
|
@@ -2540,7 +2595,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2540
2595
|
opts
|
|
2541
2596
|
}, {
|
|
2542
2597
|
F: __dxlog_file10,
|
|
2543
|
-
L:
|
|
2598
|
+
L: 148,
|
|
2544
2599
|
S: this,
|
|
2545
2600
|
C: (f, a) => f(...a)
|
|
2546
2601
|
});
|
|
@@ -2574,7 +2629,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2574
2629
|
metadata
|
|
2575
2630
|
}, {
|
|
2576
2631
|
F: __dxlog_file10,
|
|
2577
|
-
L:
|
|
2632
|
+
L: 183,
|
|
2578
2633
|
S: this,
|
|
2579
2634
|
C: (f, a) => f(...a)
|
|
2580
2635
|
});
|
|
@@ -2610,7 +2665,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2610
2665
|
onAuthFailure: () => {
|
|
2611
2666
|
import_log10.log.warn("auth failure", void 0, {
|
|
2612
2667
|
F: __dxlog_file10,
|
|
2613
|
-
L:
|
|
2668
|
+
L: 214,
|
|
2614
2669
|
S: this,
|
|
2615
2670
|
C: (f, a) => f(...a)
|
|
2616
2671
|
});
|
|
@@ -2621,6 +2676,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2621
2676
|
dataFeed && space.setDataFeed(dataFeed);
|
|
2622
2677
|
const dataSpace = new DataSpace({
|
|
2623
2678
|
inner: space,
|
|
2679
|
+
initialState: metadata.state === import_services7.SpaceState.INACTIVE ? import_services7.SpaceState.INACTIVE : import_services7.SpaceState.CLOSED,
|
|
2624
2680
|
metadataStore: this._metadataStore,
|
|
2625
2681
|
gossip,
|
|
2626
2682
|
presence,
|
|
@@ -2633,11 +2689,11 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2633
2689
|
space: space.key
|
|
2634
2690
|
}, {
|
|
2635
2691
|
F: __dxlog_file10,
|
|
2636
|
-
L:
|
|
2692
|
+
L: 232,
|
|
2637
2693
|
S: this,
|
|
2638
2694
|
C: (f, a) => f(...a)
|
|
2639
2695
|
});
|
|
2640
|
-
this._dataServiceSubscriptions.registerSpace(space.key, dataSpace.dataPipeline.databaseHost.createDataServiceHost());
|
|
2696
|
+
await this._dataServiceSubscriptions.registerSpace(space.key, dataSpace.dataPipeline.databaseHost.createDataServiceHost());
|
|
2641
2697
|
},
|
|
2642
2698
|
afterReady: async () => {
|
|
2643
2699
|
(0, import_log10.log)("after space ready", {
|
|
@@ -2645,18 +2701,31 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2645
2701
|
open: this._isOpen
|
|
2646
2702
|
}, {
|
|
2647
2703
|
F: __dxlog_file10,
|
|
2648
|
-
L:
|
|
2704
|
+
L: 239,
|
|
2649
2705
|
S: this,
|
|
2650
2706
|
C: (f, a) => f(...a)
|
|
2651
2707
|
});
|
|
2652
2708
|
if (this._isOpen) {
|
|
2653
2709
|
this.updated.emit();
|
|
2654
2710
|
}
|
|
2711
|
+
},
|
|
2712
|
+
beforeClose: async () => {
|
|
2713
|
+
(0, import_log10.log)("before space close", {
|
|
2714
|
+
space: space.key
|
|
2715
|
+
}, {
|
|
2716
|
+
F: __dxlog_file10,
|
|
2717
|
+
L: 245,
|
|
2718
|
+
S: this,
|
|
2719
|
+
C: (f, a) => f(...a)
|
|
2720
|
+
});
|
|
2721
|
+
await this._dataServiceSubscriptions.unregisterSpace(space.key);
|
|
2655
2722
|
}
|
|
2656
2723
|
},
|
|
2657
2724
|
cache: metadata.cache
|
|
2658
2725
|
});
|
|
2659
|
-
|
|
2726
|
+
if (metadata.state !== import_services7.SpaceState.INACTIVE) {
|
|
2727
|
+
await dataSpace.open();
|
|
2728
|
+
}
|
|
2660
2729
|
if (metadata.controlTimeframe) {
|
|
2661
2730
|
dataSpace.inner.controlPipeline.state.setTargetTimeframe(metadata.controlTimeframe);
|
|
2662
2731
|
}
|
|
@@ -2685,9 +2754,10 @@ DataSpaceManager = _ts_decorate2([
|
|
|
2685
2754
|
|
|
2686
2755
|
// packages/sdk/client-services/src/packlets/spaces/spaces-service.ts
|
|
2687
2756
|
var import_async10 = require("@dxos/async");
|
|
2688
|
-
var
|
|
2689
|
-
var
|
|
2757
|
+
var import_codec_protobuf4 = require("@dxos/codec-protobuf");
|
|
2758
|
+
var import_debug6 = require("@dxos/debug");
|
|
2690
2759
|
var import_echo_pipeline2 = require("@dxos/echo-pipeline");
|
|
2760
|
+
var import_errors4 = require("@dxos/errors");
|
|
2691
2761
|
var import_log11 = require("@dxos/log");
|
|
2692
2762
|
var import_protocols7 = require("@dxos/protocols");
|
|
2693
2763
|
var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
|
|
@@ -2708,11 +2778,25 @@ var SpacesServiceImpl = class {
|
|
|
2708
2778
|
const space = await dataSpaceManager.createSpace();
|
|
2709
2779
|
return this._serializeSpace(space);
|
|
2710
2780
|
}
|
|
2711
|
-
async updateSpace(
|
|
2712
|
-
|
|
2781
|
+
async updateSpace({ spaceKey, state }) {
|
|
2782
|
+
var _a;
|
|
2783
|
+
const dataSpaceManager = await this._getDataSpaceManager();
|
|
2784
|
+
const space = (_a = dataSpaceManager.spaces.get(spaceKey)) != null ? _a : (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
|
|
2785
|
+
if (state) {
|
|
2786
|
+
switch (state) {
|
|
2787
|
+
case import_services8.SpaceState.ACTIVE:
|
|
2788
|
+
await space.activate();
|
|
2789
|
+
break;
|
|
2790
|
+
case import_services8.SpaceState.INACTIVE:
|
|
2791
|
+
await space.deactivate();
|
|
2792
|
+
break;
|
|
2793
|
+
default:
|
|
2794
|
+
throw new import_errors4.ApiError("Invalid space state");
|
|
2795
|
+
}
|
|
2796
|
+
}
|
|
2713
2797
|
}
|
|
2714
2798
|
querySpaces() {
|
|
2715
|
-
return new
|
|
2799
|
+
return new import_codec_protobuf4.Stream(({ next, ctx }) => {
|
|
2716
2800
|
const scheduler = new import_async10.UpdateScheduler(ctx, async () => {
|
|
2717
2801
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
2718
2802
|
const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
|
|
@@ -2720,7 +2804,7 @@ var SpacesServiceImpl = class {
|
|
|
2720
2804
|
spaces
|
|
2721
2805
|
}, {
|
|
2722
2806
|
F: __dxlog_file11,
|
|
2723
|
-
L:
|
|
2807
|
+
L: 78,
|
|
2724
2808
|
S: this,
|
|
2725
2809
|
C: (f, a) => f(...a)
|
|
2726
2810
|
});
|
|
@@ -2763,15 +2847,15 @@ var SpacesServiceImpl = class {
|
|
|
2763
2847
|
async postMessage({ spaceKey, channel, message }) {
|
|
2764
2848
|
var _a;
|
|
2765
2849
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
2766
|
-
const space = (_a = dataSpaceManager.spaces.get(spaceKey)) != null ? _a : (0,
|
|
2850
|
+
const space = (_a = dataSpaceManager.spaces.get(spaceKey)) != null ? _a : (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
|
|
2767
2851
|
await space.postMessage(getChannelId(channel), message);
|
|
2768
2852
|
}
|
|
2769
2853
|
subscribeMessages({ spaceKey, channel }) {
|
|
2770
|
-
return new
|
|
2854
|
+
return new import_codec_protobuf4.Stream(({ ctx, next }) => {
|
|
2771
2855
|
(0, import_async10.scheduleTask)(ctx, async () => {
|
|
2772
2856
|
var _a;
|
|
2773
2857
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
2774
|
-
const space = (_a = dataSpaceManager.spaces.get(spaceKey)) != null ? _a : (0,
|
|
2858
|
+
const space = (_a = dataSpaceManager.spaces.get(spaceKey)) != null ? _a : (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
|
|
2775
2859
|
const handle = space.listen(getChannelId(channel), (message) => {
|
|
2776
2860
|
next(message);
|
|
2777
2861
|
});
|
|
@@ -2780,21 +2864,21 @@ var SpacesServiceImpl = class {
|
|
|
2780
2864
|
});
|
|
2781
2865
|
}
|
|
2782
2866
|
queryCredentials({ spaceKey }) {
|
|
2783
|
-
return new
|
|
2867
|
+
return new import_codec_protobuf4.Stream(({ ctx, next }) => {
|
|
2784
2868
|
var _a;
|
|
2785
|
-
const space = (_a = this._spaceManager.spaces.get(spaceKey)) != null ? _a : (0,
|
|
2786
|
-
const processor =
|
|
2787
|
-
|
|
2869
|
+
const space = (_a = this._spaceManager.spaces.get(spaceKey)) != null ? _a : (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
|
|
2870
|
+
const processor = {
|
|
2871
|
+
processCredential: async (credential) => {
|
|
2788
2872
|
next(credential);
|
|
2789
2873
|
}
|
|
2790
|
-
}
|
|
2791
|
-
ctx.onDispose(() =>
|
|
2792
|
-
(0, import_async10.scheduleTask)(ctx, () =>
|
|
2874
|
+
};
|
|
2875
|
+
ctx.onDispose(() => space.spaceState.removeCredentialProcessor(processor));
|
|
2876
|
+
(0, import_async10.scheduleTask)(ctx, () => space.spaceState.addCredentialProcessor(processor));
|
|
2793
2877
|
});
|
|
2794
2878
|
}
|
|
2795
2879
|
async writeCredentials({ spaceKey, credentials }) {
|
|
2796
2880
|
var _a;
|
|
2797
|
-
const space = (_a = this._spaceManager.spaces.get(spaceKey)) != null ? _a : (0,
|
|
2881
|
+
const space = (_a = this._spaceManager.spaces.get(spaceKey)) != null ? _a : (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
|
|
2798
2882
|
for (const credential of credentials != null ? credentials : []) {
|
|
2799
2883
|
await space.controlPipeline.writer.write({
|
|
2800
2884
|
credential: {
|
|
@@ -2806,7 +2890,7 @@ var SpacesServiceImpl = class {
|
|
|
2806
2890
|
async createEpoch({ spaceKey }) {
|
|
2807
2891
|
var _a;
|
|
2808
2892
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
2809
|
-
const space = (_a = dataSpaceManager.spaces.get(spaceKey)) != null ? _a : (0,
|
|
2893
|
+
const space = (_a = dataSpaceManager.spaces.get(spaceKey)) != null ? _a : (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
|
|
2810
2894
|
await space.createEpoch();
|
|
2811
2895
|
}
|
|
2812
2896
|
_serializeSpace(space) {
|
|
@@ -2886,7 +2970,7 @@ var ServiceContext = class {
|
|
|
2886
2970
|
this.invitations = new InvitationsHandler(this.networkManager);
|
|
2887
2971
|
this._handlerFactories.set(import_services9.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => {
|
|
2888
2972
|
var _a;
|
|
2889
|
-
return (_a = this.identityManager.identity) != null ? _a : (0,
|
|
2973
|
+
return (_a = this.identityManager.identity) != null ? _a : (0, import_debug7.failUndefined)();
|
|
2890
2974
|
}, this._acceptIdentity.bind(this)));
|
|
2891
2975
|
}
|
|
2892
2976
|
async open() {
|
|
@@ -2928,15 +3012,17 @@ var ServiceContext = class {
|
|
|
2928
3012
|
});
|
|
2929
3013
|
}
|
|
2930
3014
|
async close() {
|
|
2931
|
-
var _a
|
|
3015
|
+
var _a;
|
|
2932
3016
|
(0, import_log12.log)("closing...", void 0, {
|
|
2933
3017
|
F: __dxlog_file12,
|
|
2934
3018
|
L: 143,
|
|
2935
3019
|
S: this,
|
|
2936
3020
|
C: (f, a) => f(...a)
|
|
2937
3021
|
});
|
|
2938
|
-
|
|
2939
|
-
|
|
3022
|
+
if (this._deviceSpaceSync && this.identityManager.identity) {
|
|
3023
|
+
await this.identityManager.identity.space.spaceState.removeCredentialProcessor(this._deviceSpaceSync);
|
|
3024
|
+
}
|
|
3025
|
+
await ((_a = this.dataSpaceManager) == null ? void 0 : _a.close());
|
|
2940
3026
|
await this.identityManager.close();
|
|
2941
3027
|
await this.spaceManager.close();
|
|
2942
3028
|
await this.feedStore.close();
|
|
@@ -2945,7 +3031,7 @@ var ServiceContext = class {
|
|
|
2945
3031
|
this.dataServiceSubscriptions.clear();
|
|
2946
3032
|
(0, import_log12.log)("closed", void 0, {
|
|
2947
3033
|
F: __dxlog_file12,
|
|
2948
|
-
L:
|
|
3034
|
+
L: 154,
|
|
2949
3035
|
S: this,
|
|
2950
3036
|
C: (f, a) => f(...a)
|
|
2951
3037
|
});
|
|
@@ -2976,11 +3062,11 @@ var ServiceContext = class {
|
|
|
2976
3062
|
var _a;
|
|
2977
3063
|
(0, import_log12.log)("initializing spaces...", void 0, {
|
|
2978
3064
|
F: __dxlog_file12,
|
|
2979
|
-
L:
|
|
3065
|
+
L: 187,
|
|
2980
3066
|
S: this,
|
|
2981
3067
|
C: (f, a) => f(...a)
|
|
2982
3068
|
});
|
|
2983
|
-
const identity = (_a = this.identityManager.identity) != null ? _a : (0,
|
|
3069
|
+
const identity = (_a = this.identityManager.identity) != null ? _a : (0, import_debug7.failUndefined)();
|
|
2984
3070
|
const signingContext = {
|
|
2985
3071
|
credentialSigner: identity.getIdentityCredentialSigner(),
|
|
2986
3072
|
identityKey: identity.identityKey,
|
|
@@ -3001,8 +3087,8 @@ var ServiceContext = class {
|
|
|
3001
3087
|
return new SpaceInvitationProtocol(this.dataSpaceManager, signingContext, this.keyring, invitation.spaceKey);
|
|
3002
3088
|
});
|
|
3003
3089
|
this.initialized.wake();
|
|
3004
|
-
this._deviceSpaceSync =
|
|
3005
|
-
|
|
3090
|
+
this._deviceSpaceSync = {
|
|
3091
|
+
processCredential: async (credential) => {
|
|
3006
3092
|
const assertion = (0, import_credentials14.getCredentialAssertion)(credential);
|
|
3007
3093
|
if (assertion["@type"] !== "dxos.halo.credentials.SpaceMember") {
|
|
3008
3094
|
return;
|
|
@@ -3015,7 +3101,7 @@ var ServiceContext = class {
|
|
|
3015
3101
|
details: assertion
|
|
3016
3102
|
}, {
|
|
3017
3103
|
F: __dxlog_file12,
|
|
3018
|
-
L:
|
|
3104
|
+
L: 226,
|
|
3019
3105
|
S: this,
|
|
3020
3106
|
C: (f, a) => f(...a)
|
|
3021
3107
|
});
|
|
@@ -3026,7 +3112,7 @@ var ServiceContext = class {
|
|
|
3026
3112
|
details: assertion
|
|
3027
3113
|
}, {
|
|
3028
3114
|
F: __dxlog_file12,
|
|
3029
|
-
L:
|
|
3115
|
+
L: 230,
|
|
3030
3116
|
S: this,
|
|
3031
3117
|
C: (f, a) => f(...a)
|
|
3032
3118
|
});
|
|
@@ -3037,7 +3123,7 @@ var ServiceContext = class {
|
|
|
3037
3123
|
details: assertion
|
|
3038
3124
|
}, {
|
|
3039
3125
|
F: __dxlog_file12,
|
|
3040
|
-
L:
|
|
3126
|
+
L: 235,
|
|
3041
3127
|
S: this,
|
|
3042
3128
|
C: (f, a) => f(...a)
|
|
3043
3129
|
});
|
|
@@ -3048,14 +3134,14 @@ var ServiceContext = class {
|
|
|
3048
3134
|
} catch (err) {
|
|
3049
3135
|
import_log12.log.catch(err, void 0, {
|
|
3050
3136
|
F: __dxlog_file12,
|
|
3051
|
-
L:
|
|
3137
|
+
L: 241,
|
|
3052
3138
|
S: this,
|
|
3053
3139
|
C: (f, a) => f(...a)
|
|
3054
3140
|
});
|
|
3055
3141
|
}
|
|
3056
3142
|
}
|
|
3057
|
-
}
|
|
3058
|
-
await this._deviceSpaceSync
|
|
3143
|
+
};
|
|
3144
|
+
await identity.space.spaceState.addCredentialProcessor(this._deviceSpaceSync);
|
|
3059
3145
|
}
|
|
3060
3146
|
};
|
|
3061
3147
|
|
|
@@ -3076,7 +3162,7 @@ var import_text_model = require("@dxos/text-model");
|
|
|
3076
3162
|
|
|
3077
3163
|
// packages/sdk/client-services/src/packlets/devices/devices-service.ts
|
|
3078
3164
|
var import_async12 = require("@dxos/async");
|
|
3079
|
-
var
|
|
3165
|
+
var import_codec_protobuf5 = require("@dxos/codec-protobuf");
|
|
3080
3166
|
var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
|
|
3081
3167
|
var DevicesServiceImpl = class {
|
|
3082
3168
|
constructor(_identityManager) {
|
|
@@ -3086,7 +3172,7 @@ var DevicesServiceImpl = class {
|
|
|
3086
3172
|
throw new Error("Method not implemented.");
|
|
3087
3173
|
}
|
|
3088
3174
|
queryDevices() {
|
|
3089
|
-
return new
|
|
3175
|
+
return new import_codec_protobuf5.Stream(({ next }) => {
|
|
3090
3176
|
const update = () => {
|
|
3091
3177
|
var _a;
|
|
3092
3178
|
const deviceKeys = (_a = this._identityManager.identity) == null ? void 0 : _a.authorizedDeviceKeys;
|
|
@@ -3123,16 +3209,16 @@ var DevicesServiceImpl = class {
|
|
|
3123
3209
|
|
|
3124
3210
|
// packages/sdk/client-services/src/packlets/devtools/devtools.ts
|
|
3125
3211
|
var import_async15 = require("@dxos/async");
|
|
3126
|
-
var
|
|
3212
|
+
var import_codec_protobuf11 = require("@dxos/codec-protobuf");
|
|
3127
3213
|
|
|
3128
3214
|
// packages/sdk/client-services/src/packlets/devtools/feeds.ts
|
|
3129
3215
|
var import_async13 = require("@dxos/async");
|
|
3130
|
-
var
|
|
3216
|
+
var import_codec_protobuf6 = require("@dxos/codec-protobuf");
|
|
3131
3217
|
var import_feed_store4 = require("@dxos/feed-store");
|
|
3132
3218
|
var import_keys9 = require("@dxos/keys");
|
|
3133
3219
|
var import_util6 = require("@dxos/util");
|
|
3134
3220
|
var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
|
|
3135
|
-
return new
|
|
3221
|
+
return new import_codec_protobuf6.Stream(({ next }) => {
|
|
3136
3222
|
const subscriptions = new import_async13.EventSubscriptions();
|
|
3137
3223
|
const feedMap = new import_util6.ComplexMap(import_keys9.PublicKey.hash);
|
|
3138
3224
|
const update = () => {
|
|
@@ -3164,7 +3250,7 @@ var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
|
|
|
3164
3250
|
});
|
|
3165
3251
|
};
|
|
3166
3252
|
var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
|
|
3167
|
-
return new
|
|
3253
|
+
return new import_codec_protobuf6.Stream(({ next }) => {
|
|
3168
3254
|
if (!feedKey) {
|
|
3169
3255
|
return;
|
|
3170
3256
|
}
|
|
@@ -3204,8 +3290,8 @@ var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
|
|
|
3204
3290
|
|
|
3205
3291
|
// packages/sdk/client-services/src/packlets/devtools/keys.ts
|
|
3206
3292
|
var import_async14 = require("@dxos/async");
|
|
3207
|
-
var
|
|
3208
|
-
var subscribeToKeyringKeys = ({ keyring }) => new
|
|
3293
|
+
var import_codec_protobuf7 = require("@dxos/codec-protobuf");
|
|
3294
|
+
var subscribeToKeyringKeys = ({ keyring }) => new import_codec_protobuf7.Stream(({ next, ctx }) => {
|
|
3209
3295
|
const update = async () => {
|
|
3210
3296
|
next({
|
|
3211
3297
|
keys: await keyring.list()
|
|
@@ -3216,8 +3302,8 @@ var subscribeToKeyringKeys = ({ keyring }) => new import_codec_protobuf6.Stream(
|
|
|
3216
3302
|
});
|
|
3217
3303
|
|
|
3218
3304
|
// packages/sdk/client-services/src/packlets/devtools/metadata.ts
|
|
3219
|
-
var
|
|
3220
|
-
var subscribeToMetadata = ({ context }) => new
|
|
3305
|
+
var import_codec_protobuf8 = require("@dxos/codec-protobuf");
|
|
3306
|
+
var subscribeToMetadata = ({ context }) => new import_codec_protobuf8.Stream(({ next, ctx }) => {
|
|
3221
3307
|
context.metadataStore.update.on(ctx, (data) => next({
|
|
3222
3308
|
metadata: data
|
|
3223
3309
|
}));
|
|
@@ -3227,10 +3313,10 @@ var subscribeToMetadata = ({ context }) => new import_codec_protobuf7.Stream(({
|
|
|
3227
3313
|
});
|
|
3228
3314
|
|
|
3229
3315
|
// packages/sdk/client-services/src/packlets/devtools/network.ts
|
|
3230
|
-
var
|
|
3316
|
+
var import_codec_protobuf9 = require("@dxos/codec-protobuf");
|
|
3231
3317
|
var import_context7 = require("@dxos/context");
|
|
3232
3318
|
var import_keys10 = require("@dxos/keys");
|
|
3233
|
-
var subscribeToNetworkStatus = ({ signalManager }) => new
|
|
3319
|
+
var subscribeToNetworkStatus = ({ signalManager }) => new import_codec_protobuf9.Stream(({ next, close }) => {
|
|
3234
3320
|
const update = () => {
|
|
3235
3321
|
try {
|
|
3236
3322
|
const status = signalManager.getStatus();
|
|
@@ -3244,7 +3330,7 @@ var subscribeToNetworkStatus = ({ signalManager }) => new import_codec_protobuf8
|
|
|
3244
3330
|
signalManager.statusChanged.on(() => update());
|
|
3245
3331
|
update();
|
|
3246
3332
|
});
|
|
3247
|
-
var subscribeToSignal = ({ signalManager }) => new
|
|
3333
|
+
var subscribeToSignal = ({ signalManager }) => new import_codec_protobuf9.Stream(({ next }) => {
|
|
3248
3334
|
const ctx = new import_context7.Context();
|
|
3249
3335
|
signalManager.onMessage.on(ctx, (message) => {
|
|
3250
3336
|
next({
|
|
@@ -3266,7 +3352,7 @@ var subscribeToSignal = ({ signalManager }) => new import_codec_protobuf8.Stream
|
|
|
3266
3352
|
return ctx.dispose();
|
|
3267
3353
|
};
|
|
3268
3354
|
});
|
|
3269
|
-
var subscribeToSwarmInfo = ({ networkManager }) => new
|
|
3355
|
+
var subscribeToSwarmInfo = ({ networkManager }) => new import_codec_protobuf9.Stream(({ next }) => {
|
|
3270
3356
|
var _a;
|
|
3271
3357
|
const update = () => {
|
|
3272
3358
|
var _a2;
|
|
@@ -3282,9 +3368,9 @@ var subscribeToSwarmInfo = ({ networkManager }) => new import_codec_protobuf8.St
|
|
|
3282
3368
|
});
|
|
3283
3369
|
|
|
3284
3370
|
// packages/sdk/client-services/src/packlets/devtools/spaces.ts
|
|
3285
|
-
var
|
|
3371
|
+
var import_codec_protobuf10 = require("@dxos/codec-protobuf");
|
|
3286
3372
|
var subscribeToSpaces = (context, { spaceKeys = [] }) => {
|
|
3287
|
-
return new
|
|
3373
|
+
return new import_codec_protobuf10.Stream(({ next }) => {
|
|
3288
3374
|
let unsubscribe;
|
|
3289
3375
|
const update = async () => {
|
|
3290
3376
|
const spaces = [
|
|
@@ -3328,7 +3414,7 @@ var DevtoolsServiceImpl = class {
|
|
|
3328
3414
|
this.params = params;
|
|
3329
3415
|
}
|
|
3330
3416
|
events(request) {
|
|
3331
|
-
return new
|
|
3417
|
+
return new import_codec_protobuf11.Stream(({ next }) => {
|
|
3332
3418
|
this.params.events.ready.on(() => {
|
|
3333
3419
|
next({
|
|
3334
3420
|
ready: {}
|
|
@@ -3488,7 +3574,7 @@ _ts_decorate3([
|
|
|
3488
3574
|
|
|
3489
3575
|
// packages/sdk/client-services/src/packlets/logging/logging-service.ts
|
|
3490
3576
|
var import_async16 = require("@dxos/async");
|
|
3491
|
-
var
|
|
3577
|
+
var import_codec_protobuf12 = require("@dxos/codec-protobuf");
|
|
3492
3578
|
var import_log14 = require("@dxos/log");
|
|
3493
3579
|
var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
|
|
3494
3580
|
var import_util7 = require("@dxos/util");
|
|
@@ -3507,7 +3593,7 @@ var LoggingServiceImpl = class {
|
|
|
3507
3593
|
import_log14.log.runtimeConfig.processors.splice(index, 1);
|
|
3508
3594
|
}
|
|
3509
3595
|
queryLogs(request) {
|
|
3510
|
-
return new
|
|
3596
|
+
return new import_codec_protobuf12.Stream(({ ctx, next }) => {
|
|
3511
3597
|
const handler = (entry2) => {
|
|
3512
3598
|
var _a, _b, _c, _d, _e;
|
|
3513
3599
|
if (LOG_PROCESSING > 0) {
|
|
@@ -3563,14 +3649,14 @@ var shouldLog = (entry2, request) => {
|
|
|
3563
3649
|
var LOG_PROCESSING = 0;
|
|
3564
3650
|
|
|
3565
3651
|
// packages/sdk/client-services/src/packlets/network/network-service.ts
|
|
3566
|
-
var
|
|
3652
|
+
var import_codec_protobuf13 = require("@dxos/codec-protobuf");
|
|
3567
3653
|
var NetworkServiceImpl = class {
|
|
3568
3654
|
constructor(networkManager, signalManager) {
|
|
3569
3655
|
this.networkManager = networkManager;
|
|
3570
3656
|
this.signalManager = signalManager;
|
|
3571
3657
|
}
|
|
3572
3658
|
queryStatus() {
|
|
3573
|
-
return new
|
|
3659
|
+
return new import_codec_protobuf13.Stream(({ next }) => {
|
|
3574
3660
|
const update = () => {
|
|
3575
3661
|
next({
|
|
3576
3662
|
swarm: this.networkManager.connectionState,
|
|
@@ -3596,7 +3682,7 @@ var NetworkServiceImpl = class {
|
|
|
3596
3682
|
|
|
3597
3683
|
// packages/sdk/client-services/src/packlets/storage/storage.ts
|
|
3598
3684
|
var import_client_protocol4 = require("@dxos/client-protocol");
|
|
3599
|
-
var
|
|
3685
|
+
var import_errors5 = require("@dxos/errors");
|
|
3600
3686
|
var import_config = require("@dxos/protocols/proto/dxos/config");
|
|
3601
3687
|
var import_random_access_storage = require("@dxos/random-access-storage");
|
|
3602
3688
|
var import_util8 = require("@dxos/util");
|
|
@@ -3604,16 +3690,16 @@ var StorageDriver = import_config.Runtime.Client.Storage.StorageDriver;
|
|
|
3604
3690
|
var createStorageObjects = (config) => {
|
|
3605
3691
|
const { path = (0, import_util8.isNode)() ? import_client_protocol4.DX_DATA : "dxos/storage", storageType, keyStorage, persistent = false } = config != null ? config : {};
|
|
3606
3692
|
if (persistent && storageType === StorageDriver.RAM) {
|
|
3607
|
-
throw new
|
|
3693
|
+
throw new import_errors5.InvalidConfigError("RAM storage cannot be used in persistent mode.");
|
|
3608
3694
|
}
|
|
3609
3695
|
if (!persistent && storageType !== void 0 && storageType !== StorageDriver.RAM) {
|
|
3610
|
-
throw new
|
|
3696
|
+
throw new import_errors5.InvalidConfigError("Cannot use a persistent storage in not persistent mode.");
|
|
3611
3697
|
}
|
|
3612
3698
|
if (persistent && keyStorage === StorageDriver.RAM) {
|
|
3613
|
-
throw new
|
|
3699
|
+
throw new import_errors5.InvalidConfigError("RAM key storage cannot be used in persistent mode.");
|
|
3614
3700
|
}
|
|
3615
3701
|
if (!persistent && keyStorage !== StorageDriver.RAM && keyStorage !== void 0) {
|
|
3616
|
-
throw new
|
|
3702
|
+
throw new import_errors5.InvalidConfigError("Cannot use a persistent key storage in not persistent mode.");
|
|
3617
3703
|
}
|
|
3618
3704
|
return {
|
|
3619
3705
|
storage: (0, import_random_access_storage.createStorage)({
|
|
@@ -3644,7 +3730,7 @@ var toStorageType = (type) => {
|
|
|
3644
3730
|
};
|
|
3645
3731
|
|
|
3646
3732
|
// packages/sdk/client-services/src/packlets/system/system-service.ts
|
|
3647
|
-
var
|
|
3733
|
+
var import_codec_protobuf14 = require("@dxos/codec-protobuf");
|
|
3648
3734
|
var SystemServiceImpl = class {
|
|
3649
3735
|
constructor({ config, statusUpdate, onUpdateStatus, getCurrentStatus, onReset }) {
|
|
3650
3736
|
this._config = config;
|
|
@@ -3661,7 +3747,7 @@ var SystemServiceImpl = class {
|
|
|
3661
3747
|
await this._onUpdateStatus(status);
|
|
3662
3748
|
}
|
|
3663
3749
|
queryStatus() {
|
|
3664
|
-
return new
|
|
3750
|
+
return new import_codec_protobuf14.Stream(({ next }) => {
|
|
3665
3751
|
const update = () => {
|
|
3666
3752
|
next({
|
|
3667
3753
|
status: this._getCurrentStatus()
|
|
@@ -4135,6 +4221,7 @@ var acceptInvitation = (guest, invitation) => {
|
|
|
4135
4221
|
// packages/sdk/client-services/src/packlets/testing/test-builder.ts
|
|
4136
4222
|
var import_context8 = require("@dxos/context");
|
|
4137
4223
|
var import_credentials15 = require("@dxos/credentials");
|
|
4224
|
+
var import_debug8 = require("@dxos/debug");
|
|
4138
4225
|
var import_echo_pipeline5 = require("@dxos/echo-pipeline");
|
|
4139
4226
|
var import_testing = require("@dxos/echo-pipeline/testing");
|
|
4140
4227
|
var import_feed_store5 = require("@dxos/feed-store");
|
|
@@ -4201,6 +4288,9 @@ var TestPeer = class {
|
|
|
4201
4288
|
this.opts = opts;
|
|
4202
4289
|
this._props = {};
|
|
4203
4290
|
}
|
|
4291
|
+
get props() {
|
|
4292
|
+
return this._props;
|
|
4293
|
+
}
|
|
4204
4294
|
get storage() {
|
|
4205
4295
|
var _a, _b;
|
|
4206
4296
|
return (_b = (_a = this._props).storage) != null ? _b : _a.storage = (0, import_random_access_storage2.createStorage)({
|
|
@@ -4253,6 +4343,18 @@ var TestPeer = class {
|
|
|
4253
4343
|
blobStore: this.blobStore
|
|
4254
4344
|
});
|
|
4255
4345
|
}
|
|
4346
|
+
get identity() {
|
|
4347
|
+
var _a;
|
|
4348
|
+
return (_a = this._props.signingContext) != null ? _a : (0, import_debug8.failUndefined)();
|
|
4349
|
+
}
|
|
4350
|
+
get dataSpaceManager() {
|
|
4351
|
+
var _a, _b;
|
|
4352
|
+
return (_b = (_a = this._props).dataSpaceManager) != null ? _b : _a.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, new import_echo_pipeline5.DataServiceSubscriptions(), this.keyring, this.identity, this.feedStore);
|
|
4353
|
+
}
|
|
4354
|
+
async createIdentity() {
|
|
4355
|
+
var _a, _b;
|
|
4356
|
+
(_b = (_a = this._props).signingContext) != null ? _b : _a.signingContext = await createSigningContext(this.keyring);
|
|
4357
|
+
}
|
|
4256
4358
|
async destroy() {
|
|
4257
4359
|
await this.storage.reset();
|
|
4258
4360
|
}
|