@dxos/client-services 0.1.53-next.63b0547 → 0.1.53-next.e9dc2bc
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-RKD47ENR.mjs → chunk-3EI4PM2V.mjs} +194 -110
- package/dist/lib/browser/chunk-3EI4PM2V.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +8 -2
- package/dist/lib/browser/index.mjs.map +3 -3
- 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 +196 -106
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +203 -103
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- 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/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts +6 -1
- package/dist/types/src/packlets/services/service-host.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/package.json +32 -32
- package/src/packlets/identity/authenticator.ts +4 -2
- package/src/packlets/identity/identity.ts +21 -26
- package/src/packlets/services/service-context.ts +9 -7
- package/src/packlets/services/service-host.test.ts +50 -2
- package/src/packlets/services/service-host.ts +9 -0
- 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-runtime.ts +1 -1
- package/dist/lib/browser/chunk-RKD47ENR.mjs.map +0 -7
|
@@ -86,6 +86,7 @@ var import_credentials2 = require("@dxos/credentials");
|
|
|
86
86
|
var import_log = require("@dxos/log");
|
|
87
87
|
var import_protocols = require("@dxos/protocols");
|
|
88
88
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/authenticator.ts";
|
|
89
|
+
var Credential = import_protocols.schema.getCodecForType("dxos.halo.credentials.Credential");
|
|
89
90
|
var createAuthProvider = (signer) => async (nonce) => {
|
|
90
91
|
const credential = await signer.createCredential({
|
|
91
92
|
assertion: {
|
|
@@ -94,7 +95,7 @@ var createAuthProvider = (signer) => async (nonce) => {
|
|
|
94
95
|
subject: signer.getIssuer(),
|
|
95
96
|
nonce
|
|
96
97
|
});
|
|
97
|
-
return
|
|
98
|
+
return Credential.encode(credential);
|
|
98
99
|
};
|
|
99
100
|
var TrustedKeySetAuthVerifier = class {
|
|
100
101
|
// prettier-ignore
|
|
@@ -107,12 +108,12 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
107
108
|
}
|
|
108
109
|
get verifier() {
|
|
109
110
|
return async (nonce, auth) => {
|
|
110
|
-
const credential =
|
|
111
|
+
const credential = Credential.decode(auth);
|
|
111
112
|
(0, import_log.log)("authenticating...", {
|
|
112
113
|
credential
|
|
113
114
|
}, {
|
|
114
115
|
F: __dxlog_file,
|
|
115
|
-
L:
|
|
116
|
+
L: 59,
|
|
116
117
|
S: this,
|
|
117
118
|
C: (f, a) => f(...a)
|
|
118
119
|
});
|
|
@@ -122,7 +123,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
122
123
|
result
|
|
123
124
|
}, {
|
|
124
125
|
F: __dxlog_file,
|
|
125
|
-
L:
|
|
126
|
+
L: 63,
|
|
126
127
|
S: this,
|
|
127
128
|
C: (f, a) => f(...a)
|
|
128
129
|
});
|
|
@@ -134,7 +135,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
134
135
|
credential
|
|
135
136
|
}, {
|
|
136
137
|
F: __dxlog_file,
|
|
137
|
-
L:
|
|
138
|
+
L: 68,
|
|
138
139
|
S: this,
|
|
139
140
|
C: (f, a) => f(...a)
|
|
140
141
|
});
|
|
@@ -145,7 +146,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
145
146
|
key: credential.issuer
|
|
146
147
|
}, {
|
|
147
148
|
F: __dxlog_file,
|
|
148
|
-
L:
|
|
149
|
+
L: 73,
|
|
149
150
|
S: this,
|
|
150
151
|
C: (f, a) => f(...a)
|
|
151
152
|
});
|
|
@@ -161,7 +162,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
161
162
|
key: credential.issuer
|
|
162
163
|
}, {
|
|
163
164
|
F: __dxlog_file,
|
|
164
|
-
L:
|
|
165
|
+
L: 84,
|
|
165
166
|
S: this,
|
|
166
167
|
C: (f, a) => f(...a)
|
|
167
168
|
});
|
|
@@ -171,7 +172,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
171
172
|
key: credential.issuer
|
|
172
173
|
}, {
|
|
173
174
|
F: __dxlog_file,
|
|
174
|
-
L:
|
|
175
|
+
L: 87,
|
|
175
176
|
S: this,
|
|
176
177
|
C: (f, a) => f(...a)
|
|
177
178
|
});
|
|
@@ -211,15 +212,15 @@ var Identity = class {
|
|
|
211
212
|
this._signer = signer;
|
|
212
213
|
this.identityKey = identityKey;
|
|
213
214
|
this.deviceKey = deviceKey;
|
|
214
|
-
this._deviceStateMachine =
|
|
215
|
+
this._deviceStateMachine = new import_credentials3.DeviceStateMachine({
|
|
215
216
|
identityKey: this.identityKey,
|
|
216
217
|
deviceKey: this.deviceKey,
|
|
217
218
|
onUpdate: () => this.stateUpdate.emit()
|
|
218
|
-
})
|
|
219
|
-
this._profileStateMachine =
|
|
219
|
+
});
|
|
220
|
+
this._profileStateMachine = new import_credentials3.ProfileStateMachine({
|
|
220
221
|
identityKey: this.identityKey,
|
|
221
222
|
onUpdate: () => this.stateUpdate.emit()
|
|
222
|
-
})
|
|
223
|
+
});
|
|
223
224
|
this.authVerifier = new TrustedKeySetAuthVerifier({
|
|
224
225
|
trustedKeysProvider: () => this.authorizedDeviceKeys,
|
|
225
226
|
update: this.stateUpdate,
|
|
@@ -228,27 +229,27 @@ var Identity = class {
|
|
|
228
229
|
}
|
|
229
230
|
// TODO(burdon): Expose state object?
|
|
230
231
|
get authorizedDeviceKeys() {
|
|
231
|
-
return this._deviceStateMachine.
|
|
232
|
+
return this._deviceStateMachine.authorizedDeviceKeys;
|
|
232
233
|
}
|
|
233
234
|
async open() {
|
|
234
|
-
await this.
|
|
235
|
-
await this.
|
|
235
|
+
await this.space.spaceState.addCredentialProcessor(this._deviceStateMachine);
|
|
236
|
+
await this.space.spaceState.addCredentialProcessor(this._profileStateMachine);
|
|
236
237
|
await this.space.open();
|
|
237
238
|
}
|
|
238
239
|
async close() {
|
|
239
240
|
await this.authVerifier.close();
|
|
240
|
-
await this.
|
|
241
|
-
await this.
|
|
241
|
+
await this.space.spaceState.removeCredentialProcessor(this._profileStateMachine);
|
|
242
|
+
await this.space.spaceState.removeCredentialProcessor(this._deviceStateMachine);
|
|
242
243
|
await this.space.close();
|
|
243
244
|
}
|
|
244
245
|
async ready() {
|
|
245
|
-
await this._deviceStateMachine.
|
|
246
|
+
await this._deviceStateMachine.deviceChainReady.wait();
|
|
246
247
|
await this.controlPipeline.state.waitUntilReachedTargetTimeframe({
|
|
247
248
|
timeout: import_client_protocol.LOAD_CONTROL_FEEDS_TIMEOUT
|
|
248
249
|
});
|
|
249
250
|
}
|
|
250
251
|
get profileDocument() {
|
|
251
|
-
return this._profileStateMachine.
|
|
252
|
+
return this._profileStateMachine.profile;
|
|
252
253
|
}
|
|
253
254
|
/**
|
|
254
255
|
* @test-only
|
|
@@ -263,7 +264,7 @@ var Identity = class {
|
|
|
263
264
|
return this.space.genesisFeedKey;
|
|
264
265
|
}
|
|
265
266
|
get deviceCredentialChain() {
|
|
266
|
-
return this._deviceStateMachine.
|
|
267
|
+
return this._deviceStateMachine.deviceCredentialChain;
|
|
267
268
|
}
|
|
268
269
|
getAdmissionCredentials() {
|
|
269
270
|
var _a, _b;
|
|
@@ -278,8 +279,8 @@ var Identity = class {
|
|
|
278
279
|
* Requires identity to be ready.
|
|
279
280
|
*/
|
|
280
281
|
getIdentityCredentialSigner() {
|
|
281
|
-
(0, import_tiny_invariant.default)(this._deviceStateMachine.
|
|
282
|
-
return (0, import_credentials3.createCredentialSignerWithChain)(this._signer, this._deviceStateMachine.
|
|
282
|
+
(0, import_tiny_invariant.default)(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.");
|
|
283
|
+
return (0, import_credentials3.createCredentialSignerWithChain)(this._signer, this._deviceStateMachine.deviceCredentialChain, this.deviceKey);
|
|
283
284
|
}
|
|
284
285
|
/**
|
|
285
286
|
* Issues credentials as device.
|
|
@@ -296,7 +297,7 @@ var Identity = class {
|
|
|
296
297
|
dataFeedKey
|
|
297
298
|
}, {
|
|
298
299
|
F: __dxlog_file2,
|
|
299
|
-
L:
|
|
300
|
+
L: 151,
|
|
300
301
|
S: this,
|
|
301
302
|
C: (f, a) => f(...a)
|
|
302
303
|
});
|
|
@@ -1862,6 +1863,9 @@ var NotarizationPlugin = class {
|
|
|
1862
1863
|
this._processedCredentials = new import_util2.ComplexSet(import_keys5.PublicKey.hash);
|
|
1863
1864
|
this._processCredentialsTriggers = new import_util2.ComplexMap(import_keys5.PublicKey.hash);
|
|
1864
1865
|
}
|
|
1866
|
+
get hasWriter() {
|
|
1867
|
+
return !!this._writer;
|
|
1868
|
+
}
|
|
1865
1869
|
async open() {
|
|
1866
1870
|
}
|
|
1867
1871
|
async close() {
|
|
@@ -1875,7 +1879,7 @@ var NotarizationPlugin = class {
|
|
|
1875
1879
|
credentials
|
|
1876
1880
|
}, {
|
|
1877
1881
|
F: __dxlog_file8,
|
|
1878
|
-
L:
|
|
1882
|
+
L: 91,
|
|
1879
1883
|
S: this,
|
|
1880
1884
|
C: (f, a) => f(...a)
|
|
1881
1885
|
});
|
|
@@ -1887,7 +1891,7 @@ var NotarizationPlugin = class {
|
|
|
1887
1891
|
err
|
|
1888
1892
|
}, {
|
|
1889
1893
|
F: __dxlog_file8,
|
|
1890
|
-
L:
|
|
1894
|
+
L: 100,
|
|
1891
1895
|
S: this,
|
|
1892
1896
|
C: (f, a) => f(...a)
|
|
1893
1897
|
});
|
|
@@ -1903,7 +1907,7 @@ var NotarizationPlugin = class {
|
|
|
1903
1907
|
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
1904
1908
|
}, {
|
|
1905
1909
|
F: __dxlog_file8,
|
|
1906
|
-
L:
|
|
1910
|
+
L: 112,
|
|
1907
1911
|
S: this,
|
|
1908
1912
|
C: (f, a) => f(...a)
|
|
1909
1913
|
});
|
|
@@ -1926,7 +1930,7 @@ var NotarizationPlugin = class {
|
|
|
1926
1930
|
retryIn: retryTimeout
|
|
1927
1931
|
}, {
|
|
1928
1932
|
F: __dxlog_file8,
|
|
1929
|
-
L:
|
|
1933
|
+
L: 137,
|
|
1930
1934
|
S: this,
|
|
1931
1935
|
C: (f, a) => f(...a)
|
|
1932
1936
|
});
|
|
@@ -1940,7 +1944,7 @@ var NotarizationPlugin = class {
|
|
|
1940
1944
|
credentialId: credentials.map((credential) => credential.id)
|
|
1941
1945
|
}, {
|
|
1942
1946
|
F: __dxlog_file8,
|
|
1943
|
-
L:
|
|
1947
|
+
L: 144,
|
|
1944
1948
|
S: this,
|
|
1945
1949
|
C: (f, a) => f(...a)
|
|
1946
1950
|
});
|
|
@@ -1949,7 +1953,7 @@ var NotarizationPlugin = class {
|
|
|
1949
1953
|
});
|
|
1950
1954
|
(0, import_log8.log)("success", void 0, {
|
|
1951
1955
|
F: __dxlog_file8,
|
|
1952
|
-
L:
|
|
1956
|
+
L: 148,
|
|
1953
1957
|
S: this,
|
|
1954
1958
|
C: (f, a) => f(...a)
|
|
1955
1959
|
});
|
|
@@ -1958,7 +1962,7 @@ var NotarizationPlugin = class {
|
|
|
1958
1962
|
if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
|
|
1959
1963
|
import_log8.log.warn("error notarizing (recoverable)", err, {
|
|
1960
1964
|
F: __dxlog_file8,
|
|
1961
|
-
L:
|
|
1965
|
+
L: 152,
|
|
1962
1966
|
S: this,
|
|
1963
1967
|
C: (f, a) => f(...a)
|
|
1964
1968
|
});
|
|
@@ -1976,7 +1980,7 @@ var NotarizationPlugin = class {
|
|
|
1976
1980
|
]);
|
|
1977
1981
|
(0, import_log8.log)("done", void 0, {
|
|
1978
1982
|
F: __dxlog_file8,
|
|
1979
|
-
L:
|
|
1983
|
+
L: 163,
|
|
1980
1984
|
S: this,
|
|
1981
1985
|
C: (f, a) => f(...a)
|
|
1982
1986
|
});
|
|
@@ -1987,7 +1991,7 @@ var NotarizationPlugin = class {
|
|
|
1987
1991
|
/**
|
|
1988
1992
|
* Called with credentials arriving from the control pipeline.
|
|
1989
1993
|
*/
|
|
1990
|
-
async
|
|
1994
|
+
async processCredential(credential) {
|
|
1991
1995
|
var _a;
|
|
1992
1996
|
if (!credential.id) {
|
|
1993
1997
|
return;
|
|
@@ -2029,7 +2033,7 @@ var NotarizationPlugin = class {
|
|
|
2029
2033
|
peer: extension.localPeerId
|
|
2030
2034
|
}, {
|
|
2031
2035
|
F: __dxlog_file8,
|
|
2032
|
-
L:
|
|
2036
|
+
L: 212,
|
|
2033
2037
|
S: this,
|
|
2034
2038
|
C: (f, a) => f(...a)
|
|
2035
2039
|
});
|
|
@@ -2041,7 +2045,7 @@ var NotarizationPlugin = class {
|
|
|
2041
2045
|
peer: extension.localPeerId
|
|
2042
2046
|
}, {
|
|
2043
2047
|
F: __dxlog_file8,
|
|
2044
|
-
L:
|
|
2048
|
+
L: 217,
|
|
2045
2049
|
S: this,
|
|
2046
2050
|
C: (f, a) => f(...a)
|
|
2047
2051
|
});
|
|
@@ -2098,6 +2102,7 @@ var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/sr
|
|
|
2098
2102
|
var DataSpace = class DataSpace2 {
|
|
2099
2103
|
constructor(params) {
|
|
2100
2104
|
this._ctx = new import_context5.Context();
|
|
2105
|
+
this._notarizationPlugin = new NotarizationPlugin();
|
|
2101
2106
|
this._state = import_services6.SpaceState.CLOSED;
|
|
2102
2107
|
/**
|
|
2103
2108
|
* Error for _state === SpaceState.ERROR.
|
|
@@ -2120,8 +2125,8 @@ var DataSpace = class DataSpace2 {
|
|
|
2120
2125
|
update: this._inner.stateUpdate,
|
|
2121
2126
|
authTimeout: import_client_protocol3.AUTH_TIMEOUT
|
|
2122
2127
|
});
|
|
2123
|
-
this._notarizationPluginConsumer = this._inner.spaceState.registerProcessor(new NotarizationPlugin());
|
|
2124
2128
|
this._cache = params.cache;
|
|
2129
|
+
this._state = params.initialState;
|
|
2125
2130
|
}
|
|
2126
2131
|
get key() {
|
|
2127
2132
|
return this._inner.key;
|
|
@@ -2143,25 +2148,36 @@ var DataSpace = class DataSpace2 {
|
|
|
2143
2148
|
return this._presence;
|
|
2144
2149
|
}
|
|
2145
2150
|
get notarizationPlugin() {
|
|
2146
|
-
return this.
|
|
2151
|
+
return this._notarizationPlugin;
|
|
2147
2152
|
}
|
|
2148
2153
|
get cache() {
|
|
2149
2154
|
return this._cache;
|
|
2150
2155
|
}
|
|
2151
2156
|
async open() {
|
|
2152
|
-
await this.
|
|
2153
|
-
|
|
2157
|
+
await this._open();
|
|
2158
|
+
}
|
|
2159
|
+
async _open() {
|
|
2160
|
+
await this._notarizationPlugin.open();
|
|
2161
|
+
await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
|
|
2154
2162
|
await this._inner.open();
|
|
2155
|
-
this._state = import_services6.SpaceState.
|
|
2163
|
+
this._state = import_services6.SpaceState.CONTROL_ONLY;
|
|
2164
|
+
this.stateUpdate.emit();
|
|
2165
|
+
this.metrics = {};
|
|
2156
2166
|
this.metrics.open = new Date();
|
|
2157
2167
|
}
|
|
2158
2168
|
async close() {
|
|
2169
|
+
await this._close();
|
|
2170
|
+
}
|
|
2171
|
+
async _close() {
|
|
2172
|
+
var _a, _b;
|
|
2173
|
+
await ((_b = (_a = this._callbacks).beforeClose) == null ? void 0 : _b.call(_a));
|
|
2159
2174
|
this._state = import_services6.SpaceState.CLOSED;
|
|
2160
2175
|
await this._ctx.dispose();
|
|
2176
|
+
this._ctx = new import_context5.Context();
|
|
2161
2177
|
await this.authVerifier.close();
|
|
2162
2178
|
await this._inner.close();
|
|
2163
|
-
await this.
|
|
2164
|
-
await this.
|
|
2179
|
+
await this._inner.spaceState.removeCredentialProcessor(this._notarizationPlugin);
|
|
2180
|
+
await this._notarizationPlugin.close();
|
|
2165
2181
|
await this._presence.destroy();
|
|
2166
2182
|
}
|
|
2167
2183
|
async postMessage(channel, message) {
|
|
@@ -2182,7 +2198,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2182
2198
|
if (err instanceof import_errors3.CancelledError) {
|
|
2183
2199
|
(0, import_log9.log)("Data pipeline initialization cancelled", err, {
|
|
2184
2200
|
F: __dxlog_file9,
|
|
2185
|
-
L:
|
|
2201
|
+
L: 193,
|
|
2186
2202
|
S: this,
|
|
2187
2203
|
C: (f, a) => f(...a)
|
|
2188
2204
|
});
|
|
@@ -2190,7 +2206,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2190
2206
|
}
|
|
2191
2207
|
import_log9.log.error("Error initializing data pipeline", err, {
|
|
2192
2208
|
F: __dxlog_file9,
|
|
2193
|
-
L:
|
|
2209
|
+
L: 197,
|
|
2194
2210
|
S: this,
|
|
2195
2211
|
C: (f, a) => f(...a)
|
|
2196
2212
|
});
|
|
@@ -2204,7 +2220,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2204
2220
|
}
|
|
2205
2221
|
async initializeDataPipeline() {
|
|
2206
2222
|
var _a, _b, _c, _d;
|
|
2207
|
-
if (this._state !== import_services6.SpaceState.
|
|
2223
|
+
if (this._state !== import_services6.SpaceState.CONTROL_ONLY) {
|
|
2208
2224
|
throw new import_errors3.SystemError("Invalid operation");
|
|
2209
2225
|
}
|
|
2210
2226
|
this._state = import_services6.SpaceState.INITIALIZING;
|
|
@@ -2216,22 +2232,24 @@ var DataSpace = class DataSpace2 {
|
|
|
2216
2232
|
await this._createWritableFeeds();
|
|
2217
2233
|
(0, import_log9.log)("Writable feeds created", void 0, {
|
|
2218
2234
|
F: __dxlog_file9,
|
|
2219
|
-
L:
|
|
2235
|
+
L: 221,
|
|
2220
2236
|
S: this,
|
|
2221
2237
|
C: (f, a) => f(...a)
|
|
2222
2238
|
});
|
|
2223
2239
|
this.stateUpdate.emit();
|
|
2224
|
-
this.notarizationPlugin.
|
|
2225
|
-
credential
|
|
2226
|
-
credential
|
|
2227
|
-
|
|
2228
|
-
|
|
2240
|
+
if (!this.notarizationPlugin.hasWriter) {
|
|
2241
|
+
this.notarizationPlugin.setWriter((0, import_echo_pipeline.createMappedFeedWriter)((credential) => ({
|
|
2242
|
+
credential: {
|
|
2243
|
+
credential
|
|
2244
|
+
}
|
|
2245
|
+
}), this._inner.controlPipeline.writer));
|
|
2246
|
+
}
|
|
2229
2247
|
await this._inner.initializeDataPipeline();
|
|
2230
2248
|
this.metrics.dataPipelineOpen = new Date();
|
|
2231
2249
|
await (0, import_context5.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
|
|
2232
2250
|
(0, import_log9.log)("waiting for data pipeline to reach target timeframe", void 0, {
|
|
2233
2251
|
F: __dxlog_file9,
|
|
2234
|
-
L:
|
|
2252
|
+
L: 242,
|
|
2235
2253
|
S: this,
|
|
2236
2254
|
C: (f, a) => f(...a)
|
|
2237
2255
|
});
|
|
@@ -2242,7 +2260,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2242
2260
|
this.metrics.dataPipelineReady = new Date();
|
|
2243
2261
|
(0, import_log9.log)("data pipeline ready", void 0, {
|
|
2244
2262
|
F: __dxlog_file9,
|
|
2245
|
-
L:
|
|
2263
|
+
L: 251,
|
|
2246
2264
|
S: this,
|
|
2247
2265
|
C: (f, a) => f(...a)
|
|
2248
2266
|
});
|
|
@@ -2322,10 +2340,39 @@ var DataSpace = class DataSpace2 {
|
|
|
2322
2340
|
}
|
|
2323
2341
|
}
|
|
2324
2342
|
}
|
|
2343
|
+
async activate() {
|
|
2344
|
+
if (this._state !== import_services6.SpaceState.INACTIVE) {
|
|
2345
|
+
throw new import_errors3.SystemError("Invalid operation");
|
|
2346
|
+
}
|
|
2347
|
+
await this._metadataStore.setSpaceState(this.key, import_services6.SpaceState.ACTIVE);
|
|
2348
|
+
await this._open();
|
|
2349
|
+
this.initializeDataPipelineAsync();
|
|
2350
|
+
}
|
|
2351
|
+
async deactivate() {
|
|
2352
|
+
if (this._state === import_services6.SpaceState.INACTIVE) {
|
|
2353
|
+
throw new import_errors3.SystemError("Invalid operation");
|
|
2354
|
+
}
|
|
2355
|
+
await this._metadataStore.setSpaceState(this.key, import_services6.SpaceState.INACTIVE);
|
|
2356
|
+
await this._close();
|
|
2357
|
+
this._state = import_services6.SpaceState.INACTIVE;
|
|
2358
|
+
this.stateUpdate.emit();
|
|
2359
|
+
}
|
|
2325
2360
|
};
|
|
2361
|
+
_ts_decorate([
|
|
2362
|
+
import_async8.synchronized
|
|
2363
|
+
], DataSpace.prototype, "open", null);
|
|
2364
|
+
_ts_decorate([
|
|
2365
|
+
import_async8.synchronized
|
|
2366
|
+
], DataSpace.prototype, "close", null);
|
|
2326
2367
|
_ts_decorate([
|
|
2327
2368
|
(0, import_debug3.timed)(1e4)
|
|
2328
2369
|
], DataSpace.prototype, "_createWritableFeeds", null);
|
|
2370
|
+
_ts_decorate([
|
|
2371
|
+
import_async8.synchronized
|
|
2372
|
+
], DataSpace.prototype, "activate", null);
|
|
2373
|
+
_ts_decorate([
|
|
2374
|
+
import_async8.synchronized
|
|
2375
|
+
], DataSpace.prototype, "deactivate", null);
|
|
2329
2376
|
DataSpace = _ts_decorate([
|
|
2330
2377
|
(0, import_async8.trackLeaks)("open", "close")
|
|
2331
2378
|
], DataSpace);
|
|
@@ -2465,14 +2512,16 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2465
2512
|
C: (f, a) => f(...a)
|
|
2466
2513
|
});
|
|
2467
2514
|
const space = await this._constructSpace(spaceMetadata);
|
|
2468
|
-
|
|
2515
|
+
if (spaceMetadata.state !== import_services7.SpaceState.INACTIVE) {
|
|
2516
|
+
space.initializeDataPipelineAsync();
|
|
2517
|
+
}
|
|
2469
2518
|
} catch (err) {
|
|
2470
2519
|
import_log10.log.error("Error loading space", {
|
|
2471
2520
|
spaceMetadata,
|
|
2472
2521
|
err
|
|
2473
2522
|
}, {
|
|
2474
2523
|
F: __dxlog_file10,
|
|
2475
|
-
L:
|
|
2524
|
+
L: 93,
|
|
2476
2525
|
S: this,
|
|
2477
2526
|
C: (f, a) => f(...a)
|
|
2478
2527
|
});
|
|
@@ -2484,7 +2533,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2484
2533
|
id: this._instanceId
|
|
2485
2534
|
}), {
|
|
2486
2535
|
F: __dxlog_file10,
|
|
2487
|
-
L:
|
|
2536
|
+
L: 99,
|
|
2488
2537
|
S: this,
|
|
2489
2538
|
C: (f, a) => f(...a)
|
|
2490
2539
|
});
|
|
@@ -2492,7 +2541,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2492
2541
|
async close() {
|
|
2493
2542
|
(0, import_log10.log)("close", void 0, {
|
|
2494
2543
|
F: __dxlog_file10,
|
|
2495
|
-
L:
|
|
2544
|
+
L: 104,
|
|
2496
2545
|
S: this,
|
|
2497
2546
|
C: (f, a) => f(...a)
|
|
2498
2547
|
});
|
|
@@ -2514,13 +2563,14 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2514
2563
|
key: spaceKey,
|
|
2515
2564
|
genesisFeedKey: controlFeedKey,
|
|
2516
2565
|
controlFeedKey,
|
|
2517
|
-
dataFeedKey
|
|
2566
|
+
dataFeedKey,
|
|
2567
|
+
state: import_services7.SpaceState.ACTIVE
|
|
2518
2568
|
};
|
|
2519
2569
|
(0, import_log10.log)("creating space...", {
|
|
2520
2570
|
spaceKey
|
|
2521
2571
|
}, {
|
|
2522
2572
|
F: __dxlog_file10,
|
|
2523
|
-
L:
|
|
2573
|
+
L: 129,
|
|
2524
2574
|
S: this,
|
|
2525
2575
|
C: (f, a) => f(...a)
|
|
2526
2576
|
});
|
|
@@ -2540,7 +2590,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2540
2590
|
opts
|
|
2541
2591
|
}, {
|
|
2542
2592
|
F: __dxlog_file10,
|
|
2543
|
-
L:
|
|
2593
|
+
L: 148,
|
|
2544
2594
|
S: this,
|
|
2545
2595
|
C: (f, a) => f(...a)
|
|
2546
2596
|
});
|
|
@@ -2574,7 +2624,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2574
2624
|
metadata
|
|
2575
2625
|
}, {
|
|
2576
2626
|
F: __dxlog_file10,
|
|
2577
|
-
L:
|
|
2627
|
+
L: 183,
|
|
2578
2628
|
S: this,
|
|
2579
2629
|
C: (f, a) => f(...a)
|
|
2580
2630
|
});
|
|
@@ -2610,7 +2660,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2610
2660
|
onAuthFailure: () => {
|
|
2611
2661
|
import_log10.log.warn("auth failure", void 0, {
|
|
2612
2662
|
F: __dxlog_file10,
|
|
2613
|
-
L:
|
|
2663
|
+
L: 214,
|
|
2614
2664
|
S: this,
|
|
2615
2665
|
C: (f, a) => f(...a)
|
|
2616
2666
|
});
|
|
@@ -2621,6 +2671,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2621
2671
|
dataFeed && space.setDataFeed(dataFeed);
|
|
2622
2672
|
const dataSpace = new DataSpace({
|
|
2623
2673
|
inner: space,
|
|
2674
|
+
initialState: metadata.state === import_services7.SpaceState.INACTIVE ? import_services7.SpaceState.INACTIVE : import_services7.SpaceState.CLOSED,
|
|
2624
2675
|
metadataStore: this._metadataStore,
|
|
2625
2676
|
gossip,
|
|
2626
2677
|
presence,
|
|
@@ -2633,11 +2684,11 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2633
2684
|
space: space.key
|
|
2634
2685
|
}, {
|
|
2635
2686
|
F: __dxlog_file10,
|
|
2636
|
-
L:
|
|
2687
|
+
L: 232,
|
|
2637
2688
|
S: this,
|
|
2638
2689
|
C: (f, a) => f(...a)
|
|
2639
2690
|
});
|
|
2640
|
-
this._dataServiceSubscriptions.registerSpace(space.key, dataSpace.dataPipeline.databaseHost.createDataServiceHost());
|
|
2691
|
+
await this._dataServiceSubscriptions.registerSpace(space.key, dataSpace.dataPipeline.databaseHost.createDataServiceHost());
|
|
2641
2692
|
},
|
|
2642
2693
|
afterReady: async () => {
|
|
2643
2694
|
(0, import_log10.log)("after space ready", {
|
|
@@ -2645,18 +2696,31 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2645
2696
|
open: this._isOpen
|
|
2646
2697
|
}, {
|
|
2647
2698
|
F: __dxlog_file10,
|
|
2648
|
-
L:
|
|
2699
|
+
L: 239,
|
|
2649
2700
|
S: this,
|
|
2650
2701
|
C: (f, a) => f(...a)
|
|
2651
2702
|
});
|
|
2652
2703
|
if (this._isOpen) {
|
|
2653
2704
|
this.updated.emit();
|
|
2654
2705
|
}
|
|
2706
|
+
},
|
|
2707
|
+
beforeClose: async () => {
|
|
2708
|
+
(0, import_log10.log)("before space close", {
|
|
2709
|
+
space: space.key
|
|
2710
|
+
}, {
|
|
2711
|
+
F: __dxlog_file10,
|
|
2712
|
+
L: 245,
|
|
2713
|
+
S: this,
|
|
2714
|
+
C: (f, a) => f(...a)
|
|
2715
|
+
});
|
|
2716
|
+
await this._dataServiceSubscriptions.unregisterSpace(space.key);
|
|
2655
2717
|
}
|
|
2656
2718
|
},
|
|
2657
2719
|
cache: metadata.cache
|
|
2658
2720
|
});
|
|
2659
|
-
|
|
2721
|
+
if (metadata.state !== import_services7.SpaceState.INACTIVE) {
|
|
2722
|
+
await dataSpace.open();
|
|
2723
|
+
}
|
|
2660
2724
|
if (metadata.controlTimeframe) {
|
|
2661
2725
|
dataSpace.inner.controlPipeline.state.setTargetTimeframe(metadata.controlTimeframe);
|
|
2662
2726
|
}
|
|
@@ -2688,6 +2752,7 @@ var import_async10 = require("@dxos/async");
|
|
|
2688
2752
|
var import_codec_protobuf3 = require("@dxos/codec-protobuf");
|
|
2689
2753
|
var import_debug5 = require("@dxos/debug");
|
|
2690
2754
|
var import_echo_pipeline2 = require("@dxos/echo-pipeline");
|
|
2755
|
+
var import_errors4 = require("@dxos/errors");
|
|
2691
2756
|
var import_log11 = require("@dxos/log");
|
|
2692
2757
|
var import_protocols7 = require("@dxos/protocols");
|
|
2693
2758
|
var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
|
|
@@ -2708,8 +2773,22 @@ var SpacesServiceImpl = class {
|
|
|
2708
2773
|
const space = await dataSpaceManager.createSpace();
|
|
2709
2774
|
return this._serializeSpace(space);
|
|
2710
2775
|
}
|
|
2711
|
-
async updateSpace(
|
|
2712
|
-
|
|
2776
|
+
async updateSpace({ spaceKey, state }) {
|
|
2777
|
+
var _a;
|
|
2778
|
+
const dataSpaceManager = await this._getDataSpaceManager();
|
|
2779
|
+
const space = (_a = dataSpaceManager.spaces.get(spaceKey)) != null ? _a : (0, import_debug5.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
|
|
2780
|
+
if (state) {
|
|
2781
|
+
switch (state) {
|
|
2782
|
+
case import_services8.SpaceState.ACTIVE:
|
|
2783
|
+
await space.activate();
|
|
2784
|
+
break;
|
|
2785
|
+
case import_services8.SpaceState.INACTIVE:
|
|
2786
|
+
await space.deactivate();
|
|
2787
|
+
break;
|
|
2788
|
+
default:
|
|
2789
|
+
throw new import_errors4.ApiError("Invalid space state");
|
|
2790
|
+
}
|
|
2791
|
+
}
|
|
2713
2792
|
}
|
|
2714
2793
|
querySpaces() {
|
|
2715
2794
|
return new import_codec_protobuf3.Stream(({ next, ctx }) => {
|
|
@@ -2720,7 +2799,7 @@ var SpacesServiceImpl = class {
|
|
|
2720
2799
|
spaces
|
|
2721
2800
|
}, {
|
|
2722
2801
|
F: __dxlog_file11,
|
|
2723
|
-
L:
|
|
2802
|
+
L: 78,
|
|
2724
2803
|
S: this,
|
|
2725
2804
|
C: (f, a) => f(...a)
|
|
2726
2805
|
});
|
|
@@ -2783,13 +2862,13 @@ var SpacesServiceImpl = class {
|
|
|
2783
2862
|
return new import_codec_protobuf3.Stream(({ ctx, next }) => {
|
|
2784
2863
|
var _a;
|
|
2785
2864
|
const space = (_a = this._spaceManager.spaces.get(spaceKey)) != null ? _a : (0, import_debug5.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
|
|
2786
|
-
const processor =
|
|
2787
|
-
|
|
2865
|
+
const processor = {
|
|
2866
|
+
processCredential: async (credential) => {
|
|
2788
2867
|
next(credential);
|
|
2789
2868
|
}
|
|
2790
|
-
}
|
|
2791
|
-
ctx.onDispose(() =>
|
|
2792
|
-
(0, import_async10.scheduleTask)(ctx, () =>
|
|
2869
|
+
};
|
|
2870
|
+
ctx.onDispose(() => space.spaceState.removeCredentialProcessor(processor));
|
|
2871
|
+
(0, import_async10.scheduleTask)(ctx, () => space.spaceState.addCredentialProcessor(processor));
|
|
2793
2872
|
});
|
|
2794
2873
|
}
|
|
2795
2874
|
async writeCredentials({ spaceKey, credentials }) {
|
|
@@ -2928,15 +3007,17 @@ var ServiceContext = class {
|
|
|
2928
3007
|
});
|
|
2929
3008
|
}
|
|
2930
3009
|
async close() {
|
|
2931
|
-
var _a
|
|
3010
|
+
var _a;
|
|
2932
3011
|
(0, import_log12.log)("closing...", void 0, {
|
|
2933
3012
|
F: __dxlog_file12,
|
|
2934
3013
|
L: 143,
|
|
2935
3014
|
S: this,
|
|
2936
3015
|
C: (f, a) => f(...a)
|
|
2937
3016
|
});
|
|
2938
|
-
|
|
2939
|
-
|
|
3017
|
+
if (this._deviceSpaceSync && this.identityManager.identity) {
|
|
3018
|
+
await this.identityManager.identity.space.spaceState.removeCredentialProcessor(this._deviceSpaceSync);
|
|
3019
|
+
}
|
|
3020
|
+
await ((_a = this.dataSpaceManager) == null ? void 0 : _a.close());
|
|
2940
3021
|
await this.identityManager.close();
|
|
2941
3022
|
await this.spaceManager.close();
|
|
2942
3023
|
await this.feedStore.close();
|
|
@@ -2945,7 +3026,7 @@ var ServiceContext = class {
|
|
|
2945
3026
|
this.dataServiceSubscriptions.clear();
|
|
2946
3027
|
(0, import_log12.log)("closed", void 0, {
|
|
2947
3028
|
F: __dxlog_file12,
|
|
2948
|
-
L:
|
|
3029
|
+
L: 154,
|
|
2949
3030
|
S: this,
|
|
2950
3031
|
C: (f, a) => f(...a)
|
|
2951
3032
|
});
|
|
@@ -2976,7 +3057,7 @@ var ServiceContext = class {
|
|
|
2976
3057
|
var _a;
|
|
2977
3058
|
(0, import_log12.log)("initializing spaces...", void 0, {
|
|
2978
3059
|
F: __dxlog_file12,
|
|
2979
|
-
L:
|
|
3060
|
+
L: 187,
|
|
2980
3061
|
S: this,
|
|
2981
3062
|
C: (f, a) => f(...a)
|
|
2982
3063
|
});
|
|
@@ -3001,8 +3082,8 @@ var ServiceContext = class {
|
|
|
3001
3082
|
return new SpaceInvitationProtocol(this.dataSpaceManager, signingContext, this.keyring, invitation.spaceKey);
|
|
3002
3083
|
});
|
|
3003
3084
|
this.initialized.wake();
|
|
3004
|
-
this._deviceSpaceSync =
|
|
3005
|
-
|
|
3085
|
+
this._deviceSpaceSync = {
|
|
3086
|
+
processCredential: async (credential) => {
|
|
3006
3087
|
const assertion = (0, import_credentials14.getCredentialAssertion)(credential);
|
|
3007
3088
|
if (assertion["@type"] !== "dxos.halo.credentials.SpaceMember") {
|
|
3008
3089
|
return;
|
|
@@ -3015,7 +3096,7 @@ var ServiceContext = class {
|
|
|
3015
3096
|
details: assertion
|
|
3016
3097
|
}, {
|
|
3017
3098
|
F: __dxlog_file12,
|
|
3018
|
-
L:
|
|
3099
|
+
L: 226,
|
|
3019
3100
|
S: this,
|
|
3020
3101
|
C: (f, a) => f(...a)
|
|
3021
3102
|
});
|
|
@@ -3026,7 +3107,7 @@ var ServiceContext = class {
|
|
|
3026
3107
|
details: assertion
|
|
3027
3108
|
}, {
|
|
3028
3109
|
F: __dxlog_file12,
|
|
3029
|
-
L:
|
|
3110
|
+
L: 230,
|
|
3030
3111
|
S: this,
|
|
3031
3112
|
C: (f, a) => f(...a)
|
|
3032
3113
|
});
|
|
@@ -3037,7 +3118,7 @@ var ServiceContext = class {
|
|
|
3037
3118
|
details: assertion
|
|
3038
3119
|
}, {
|
|
3039
3120
|
F: __dxlog_file12,
|
|
3040
|
-
L:
|
|
3121
|
+
L: 235,
|
|
3041
3122
|
S: this,
|
|
3042
3123
|
C: (f, a) => f(...a)
|
|
3043
3124
|
});
|
|
@@ -3048,14 +3129,14 @@ var ServiceContext = class {
|
|
|
3048
3129
|
} catch (err) {
|
|
3049
3130
|
import_log12.log.catch(err, void 0, {
|
|
3050
3131
|
F: __dxlog_file12,
|
|
3051
|
-
L:
|
|
3132
|
+
L: 241,
|
|
3052
3133
|
S: this,
|
|
3053
3134
|
C: (f, a) => f(...a)
|
|
3054
3135
|
});
|
|
3055
3136
|
}
|
|
3056
3137
|
}
|
|
3057
|
-
}
|
|
3058
|
-
await this._deviceSpaceSync
|
|
3138
|
+
};
|
|
3139
|
+
await identity.space.spaceState.addCredentialProcessor(this._deviceSpaceSync);
|
|
3059
3140
|
}
|
|
3060
3141
|
};
|
|
3061
3142
|
|
|
@@ -3596,7 +3677,7 @@ var NetworkServiceImpl = class {
|
|
|
3596
3677
|
|
|
3597
3678
|
// packages/sdk/client-services/src/packlets/storage/storage.ts
|
|
3598
3679
|
var import_client_protocol4 = require("@dxos/client-protocol");
|
|
3599
|
-
var
|
|
3680
|
+
var import_errors5 = require("@dxos/errors");
|
|
3600
3681
|
var import_config = require("@dxos/protocols/proto/dxos/config");
|
|
3601
3682
|
var import_random_access_storage = require("@dxos/random-access-storage");
|
|
3602
3683
|
var import_util8 = require("@dxos/util");
|
|
@@ -3604,16 +3685,16 @@ var StorageDriver = import_config.Runtime.Client.Storage.StorageDriver;
|
|
|
3604
3685
|
var createStorageObjects = (config) => {
|
|
3605
3686
|
const { path = (0, import_util8.isNode)() ? import_client_protocol4.DX_DATA : "dxos/storage", storageType, keyStorage, persistent = false } = config != null ? config : {};
|
|
3606
3687
|
if (persistent && storageType === StorageDriver.RAM) {
|
|
3607
|
-
throw new
|
|
3688
|
+
throw new import_errors5.InvalidConfigError("RAM storage cannot be used in persistent mode.");
|
|
3608
3689
|
}
|
|
3609
3690
|
if (!persistent && storageType !== void 0 && storageType !== StorageDriver.RAM) {
|
|
3610
|
-
throw new
|
|
3691
|
+
throw new import_errors5.InvalidConfigError("Cannot use a persistent storage in not persistent mode.");
|
|
3611
3692
|
}
|
|
3612
3693
|
if (persistent && keyStorage === StorageDriver.RAM) {
|
|
3613
|
-
throw new
|
|
3694
|
+
throw new import_errors5.InvalidConfigError("RAM key storage cannot be used in persistent mode.");
|
|
3614
3695
|
}
|
|
3615
3696
|
if (!persistent && keyStorage !== StorageDriver.RAM && keyStorage !== void 0) {
|
|
3616
|
-
throw new
|
|
3697
|
+
throw new import_errors5.InvalidConfigError("Cannot use a persistent key storage in not persistent mode.");
|
|
3617
3698
|
}
|
|
3618
3699
|
return {
|
|
3619
3700
|
storage: (0, import_random_access_storage.createStorage)({
|
|
@@ -3730,13 +3811,15 @@ var ClientServicesHost = class {
|
|
|
3730
3811
|
connectionLog,
|
|
3731
3812
|
storage,
|
|
3732
3813
|
// TODO(wittjosiah): Turn this on by default.
|
|
3733
|
-
lockKey
|
|
3814
|
+
lockKey,
|
|
3815
|
+
callbacks
|
|
3734
3816
|
} = {}) {
|
|
3735
3817
|
this._statusUpdate = new import_async17.Event();
|
|
3736
3818
|
this._opening = false;
|
|
3737
3819
|
this._open = false;
|
|
3738
3820
|
this._storage = storage;
|
|
3739
3821
|
this._modelFactory = modelFactory;
|
|
3822
|
+
this._callbacks = callbacks;
|
|
3740
3823
|
if (config) {
|
|
3741
3824
|
this.initialize({
|
|
3742
3825
|
config,
|
|
@@ -3824,7 +3907,7 @@ var ClientServicesHost = class {
|
|
|
3824
3907
|
id: traceId
|
|
3825
3908
|
}), {
|
|
3826
3909
|
F: __dxlog_file14,
|
|
3827
|
-
L:
|
|
3910
|
+
L: 203,
|
|
3828
3911
|
S: this,
|
|
3829
3912
|
C: (f, a) => f(...a)
|
|
3830
3913
|
});
|
|
@@ -3837,7 +3920,7 @@ var ClientServicesHost = class {
|
|
|
3837
3920
|
lockKey: (_a = this._resourceLock) == null ? void 0 : _a.lockKey
|
|
3838
3921
|
}, {
|
|
3839
3922
|
F: __dxlog_file14,
|
|
3840
|
-
L:
|
|
3923
|
+
L: 211,
|
|
3841
3924
|
S: this,
|
|
3842
3925
|
C: (f, a) => f(...a)
|
|
3843
3926
|
});
|
|
@@ -3872,7 +3955,7 @@ var ClientServicesHost = class {
|
|
|
3872
3955
|
deviceKey
|
|
3873
3956
|
}, {
|
|
3874
3957
|
F: __dxlog_file14,
|
|
3875
|
-
L:
|
|
3958
|
+
L: 266,
|
|
3876
3959
|
S: this,
|
|
3877
3960
|
C: (f, a) => f(...a)
|
|
3878
3961
|
});
|
|
@@ -3880,7 +3963,7 @@ var ClientServicesHost = class {
|
|
|
3880
3963
|
id: traceId
|
|
3881
3964
|
}), {
|
|
3882
3965
|
F: __dxlog_file14,
|
|
3883
|
-
L:
|
|
3966
|
+
L: 267,
|
|
3884
3967
|
S: this,
|
|
3885
3968
|
C: (f, a) => f(...a)
|
|
3886
3969
|
});
|
|
@@ -3895,7 +3978,7 @@ var ClientServicesHost = class {
|
|
|
3895
3978
|
deviceKey
|
|
3896
3979
|
}, {
|
|
3897
3980
|
F: __dxlog_file14,
|
|
3898
|
-
L:
|
|
3981
|
+
L: 277,
|
|
3899
3982
|
S: this,
|
|
3900
3983
|
C: (f, a) => f(...a)
|
|
3901
3984
|
});
|
|
@@ -3910,25 +3993,25 @@ var ClientServicesHost = class {
|
|
|
3910
3993
|
deviceKey
|
|
3911
3994
|
}, {
|
|
3912
3995
|
F: __dxlog_file14,
|
|
3913
|
-
L:
|
|
3996
|
+
L: 283,
|
|
3914
3997
|
S: this,
|
|
3915
3998
|
C: (f, a) => f(...a)
|
|
3916
3999
|
});
|
|
3917
4000
|
}
|
|
3918
4001
|
async reset() {
|
|
3919
|
-
var _a;
|
|
4002
|
+
var _a, _b, _c;
|
|
3920
4003
|
const traceId = import_keys12.PublicKey.random().toHex();
|
|
3921
4004
|
import_log15.log.trace("dxos.sdk.client-services-host.reset", import_protocols9.trace.begin({
|
|
3922
4005
|
id: traceId
|
|
3923
4006
|
}), {
|
|
3924
4007
|
F: __dxlog_file14,
|
|
3925
|
-
L:
|
|
4008
|
+
L: 288,
|
|
3926
4009
|
S: this,
|
|
3927
4010
|
C: (f, a) => f(...a)
|
|
3928
4011
|
});
|
|
3929
4012
|
(0, import_log15.log)("resetting...", void 0, {
|
|
3930
4013
|
F: __dxlog_file14,
|
|
3931
|
-
L:
|
|
4014
|
+
L: 290,
|
|
3932
4015
|
S: this,
|
|
3933
4016
|
C: (f, a) => f(...a)
|
|
3934
4017
|
});
|
|
@@ -3936,7 +4019,7 @@ var ClientServicesHost = class {
|
|
|
3936
4019
|
await this._storage.reset();
|
|
3937
4020
|
(0, import_log15.log)("reset", void 0, {
|
|
3938
4021
|
F: __dxlog_file14,
|
|
3939
|
-
L:
|
|
4022
|
+
L: 293,
|
|
3940
4023
|
S: this,
|
|
3941
4024
|
C: (f, a) => f(...a)
|
|
3942
4025
|
});
|
|
@@ -3944,10 +4027,11 @@ var ClientServicesHost = class {
|
|
|
3944
4027
|
id: traceId
|
|
3945
4028
|
}), {
|
|
3946
4029
|
F: __dxlog_file14,
|
|
3947
|
-
L:
|
|
4030
|
+
L: 294,
|
|
3948
4031
|
S: this,
|
|
3949
4032
|
C: (f, a) => f(...a)
|
|
3950
4033
|
});
|
|
4034
|
+
await ((_c = (_b = this._callbacks) == null ? void 0 : _b.onReset) == null ? void 0 : _c.call(_b));
|
|
3951
4035
|
}
|
|
3952
4036
|
};
|
|
3953
4037
|
_ts_decorate4([
|
|
@@ -4132,6 +4216,7 @@ var acceptInvitation = (guest, invitation) => {
|
|
|
4132
4216
|
// packages/sdk/client-services/src/packlets/testing/test-builder.ts
|
|
4133
4217
|
var import_context8 = require("@dxos/context");
|
|
4134
4218
|
var import_credentials15 = require("@dxos/credentials");
|
|
4219
|
+
var import_debug7 = require("@dxos/debug");
|
|
4135
4220
|
var import_echo_pipeline5 = require("@dxos/echo-pipeline");
|
|
4136
4221
|
var import_testing = require("@dxos/echo-pipeline/testing");
|
|
4137
4222
|
var import_feed_store5 = require("@dxos/feed-store");
|
|
@@ -4198,6 +4283,9 @@ var TestPeer = class {
|
|
|
4198
4283
|
this.opts = opts;
|
|
4199
4284
|
this._props = {};
|
|
4200
4285
|
}
|
|
4286
|
+
get props() {
|
|
4287
|
+
return this._props;
|
|
4288
|
+
}
|
|
4201
4289
|
get storage() {
|
|
4202
4290
|
var _a, _b;
|
|
4203
4291
|
return (_b = (_a = this._props).storage) != null ? _b : _a.storage = (0, import_random_access_storage2.createStorage)({
|
|
@@ -4250,6 +4338,18 @@ var TestPeer = class {
|
|
|
4250
4338
|
blobStore: this.blobStore
|
|
4251
4339
|
});
|
|
4252
4340
|
}
|
|
4341
|
+
get identity() {
|
|
4342
|
+
var _a;
|
|
4343
|
+
return (_a = this._props.signingContext) != null ? _a : (0, import_debug7.failUndefined)();
|
|
4344
|
+
}
|
|
4345
|
+
get dataSpaceManager() {
|
|
4346
|
+
var _a, _b;
|
|
4347
|
+
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);
|
|
4348
|
+
}
|
|
4349
|
+
async createIdentity() {
|
|
4350
|
+
var _a, _b;
|
|
4351
|
+
(_b = (_a = this._props).signingContext) != null ? _b : _a.signingContext = await createSigningContext(this.keyring);
|
|
4352
|
+
}
|
|
4253
4353
|
async destroy() {
|
|
4254
4354
|
await this.storage.reset();
|
|
4255
4355
|
}
|