@dxos/client-services 0.3.3-main.f990aad → 0.3.3-next.6bede4d
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-UUQTHQF5.mjs → chunk-FA5N7GEZ.mjs} +14 -23
- package/dist/lib/browser/chunk-FA5N7GEZ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +1 -1
- package/dist/lib/node/index.cjs +58 -67
- 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 +85 -94
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/services/diagnostics.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +35 -35
- package/src/packlets/services/diagnostics.ts +1 -9
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-UUQTHQF5.mjs.map +0 -7
|
@@ -61,7 +61,7 @@ var createMockCredential = async ({ signer, issuer }) => (0, import_credentials.
|
|
|
61
61
|
});
|
|
62
62
|
|
|
63
63
|
// packages/sdk/client-services/src/packlets/testing/invitation-utils.ts
|
|
64
|
-
var
|
|
64
|
+
var import_async18 = require("@dxos/async");
|
|
65
65
|
var import_invariant16 = require("@dxos/invariant");
|
|
66
66
|
var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
|
|
67
67
|
|
|
@@ -147,7 +147,6 @@ ClientRpcServer = _ts_decorate([
|
|
|
147
147
|
], ClientRpcServer);
|
|
148
148
|
|
|
149
149
|
// packages/sdk/client-services/src/packlets/services/diagnostics.ts
|
|
150
|
-
var import_async = require("@dxos/async");
|
|
151
150
|
var import_codec_protobuf2 = require("@dxos/codec-protobuf");
|
|
152
151
|
var import_credentials2 = require("@dxos/credentials");
|
|
153
152
|
var import_document_model = require("@dxos/document-model");
|
|
@@ -186,7 +185,7 @@ var getPlatform = () => {
|
|
|
186
185
|
};
|
|
187
186
|
|
|
188
187
|
// packages/sdk/client-services/src/version.ts
|
|
189
|
-
var DXOS_VERSION = "0.3.3-
|
|
188
|
+
var DXOS_VERSION = "0.3.3-next.6bede4d";
|
|
190
189
|
|
|
191
190
|
// packages/sdk/client-services/src/packlets/services/diagnostics.ts
|
|
192
191
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
|
|
@@ -205,7 +204,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
205
204
|
{
|
|
206
205
|
(0, import_invariant.invariant)(clientServices.LoggingService, "SystemService is not available.", {
|
|
207
206
|
F: __dxlog_file,
|
|
208
|
-
L:
|
|
207
|
+
L: 92,
|
|
209
208
|
S: void 0,
|
|
210
209
|
A: [
|
|
211
210
|
"clientServices.LoggingService",
|
|
@@ -242,15 +241,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
242
241
|
timeout: DEFAULT_TIMEOUT
|
|
243
242
|
}).catch(() => void 0);
|
|
244
243
|
diagnostics.networkStatus = status;
|
|
245
|
-
|
|
246
|
-
serviceContext.networkManager.connectionLog?.update.on(async () => {
|
|
247
|
-
const swarms = serviceContext.networkManager.connectionLog?.swarms;
|
|
248
|
-
diagnostics.swarms = swarms;
|
|
249
|
-
await swarmInfoDone.wake();
|
|
250
|
-
});
|
|
251
|
-
await swarmInfoDone.wait({
|
|
252
|
-
timeout: DEFAULT_TIMEOUT
|
|
253
|
-
});
|
|
244
|
+
diagnostics.swarms = serviceContext.networkManager.connectionLog?.swarms;
|
|
254
245
|
}
|
|
255
246
|
diagnostics.config = config.values;
|
|
256
247
|
return diagnostics;
|
|
@@ -264,7 +255,7 @@ var getProperties = (space) => {
|
|
|
264
255
|
} catch (err) {
|
|
265
256
|
import_log.log.warn(err.message, void 0, {
|
|
266
257
|
F: __dxlog_file,
|
|
267
|
-
L:
|
|
258
|
+
L: 160,
|
|
268
259
|
S: void 0,
|
|
269
260
|
C: (f, a) => f(...a)
|
|
270
261
|
});
|
|
@@ -320,7 +311,7 @@ var getSpaceStats = async (space) => {
|
|
|
320
311
|
};
|
|
321
312
|
|
|
322
313
|
// packages/sdk/client-services/src/packlets/services/service-context.ts
|
|
323
|
-
var
|
|
314
|
+
var import_async11 = require("@dxos/async");
|
|
324
315
|
var import_context8 = require("@dxos/context");
|
|
325
316
|
var import_credentials15 = require("@dxos/credentials");
|
|
326
317
|
var import_debug7 = require("@dxos/debug");
|
|
@@ -337,7 +328,7 @@ var import_tracing5 = require("@dxos/tracing");
|
|
|
337
328
|
var import_util6 = require("@dxos/util");
|
|
338
329
|
|
|
339
330
|
// packages/sdk/client-services/src/packlets/identity/authenticator.ts
|
|
340
|
-
var
|
|
331
|
+
var import_async = require("@dxos/async");
|
|
341
332
|
var import_context = require("@dxos/context");
|
|
342
333
|
var import_credentials3 = require("@dxos/credentials");
|
|
343
334
|
var import_log2 = require("@dxos/log");
|
|
@@ -408,7 +399,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
408
399
|
});
|
|
409
400
|
return true;
|
|
410
401
|
}
|
|
411
|
-
const trigger = new
|
|
402
|
+
const trigger = new import_async.Trigger();
|
|
412
403
|
this._ctx.onDispose(() => {
|
|
413
404
|
trigger.wake(false);
|
|
414
405
|
});
|
|
@@ -452,7 +443,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
452
443
|
};
|
|
453
444
|
|
|
454
445
|
// packages/sdk/client-services/src/packlets/identity/identity.ts
|
|
455
|
-
var
|
|
446
|
+
var import_async2 = require("@dxos/async");
|
|
456
447
|
var import_client_protocol = require("@dxos/client-protocol");
|
|
457
448
|
var import_credentials4 = require("@dxos/credentials");
|
|
458
449
|
var import_debug2 = require("@dxos/debug");
|
|
@@ -476,7 +467,7 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
476
467
|
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
|
|
477
468
|
var Identity = class Identity2 {
|
|
478
469
|
constructor({ space, signer, identityKey, deviceKey }) {
|
|
479
|
-
this.stateUpdate = new
|
|
470
|
+
this.stateUpdate = new import_async2.Event();
|
|
480
471
|
this.space = space;
|
|
481
472
|
this._signer = signer;
|
|
482
473
|
this.identityKey = identityKey;
|
|
@@ -634,7 +625,7 @@ Identity = _ts_decorate2([
|
|
|
634
625
|
|
|
635
626
|
// packages/sdk/client-services/src/packlets/identity/identity-manager.ts
|
|
636
627
|
var import_platform2 = __toESM(require("platform"));
|
|
637
|
-
var
|
|
628
|
+
var import_async3 = require("@dxos/async");
|
|
638
629
|
var import_context2 = require("@dxos/context");
|
|
639
630
|
var import_credentials6 = require("@dxos/credentials");
|
|
640
631
|
var import_invariant3 = require("@dxos/invariant");
|
|
@@ -664,7 +655,7 @@ var IdentityManager = class IdentityManager2 {
|
|
|
664
655
|
this._keyring = _keyring;
|
|
665
656
|
this._feedStore = _feedStore;
|
|
666
657
|
this._spaceManager = _spaceManager;
|
|
667
|
-
this.stateUpdate = new
|
|
658
|
+
this.stateUpdate = new import_async3.Event();
|
|
668
659
|
}
|
|
669
660
|
get identity() {
|
|
670
661
|
return this._identity;
|
|
@@ -1172,7 +1163,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1172
1163
|
};
|
|
1173
1164
|
|
|
1174
1165
|
// packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
|
|
1175
|
-
var
|
|
1166
|
+
var import_async5 = require("@dxos/async");
|
|
1176
1167
|
var import_client_protocol2 = require("@dxos/client-protocol");
|
|
1177
1168
|
var import_context4 = require("@dxos/context");
|
|
1178
1169
|
var import_credentials9 = require("@dxos/credentials");
|
|
@@ -1185,7 +1176,7 @@ var import_services4 = require("@dxos/protocols/proto/dxos/client/services");
|
|
|
1185
1176
|
var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
1186
1177
|
|
|
1187
1178
|
// packages/sdk/client-services/src/packlets/invitations/invitation-extension.ts
|
|
1188
|
-
var
|
|
1179
|
+
var import_async4 = require("@dxos/async");
|
|
1189
1180
|
var import_context3 = require("@dxos/context");
|
|
1190
1181
|
var import_invariant6 = require("@dxos/invariant");
|
|
1191
1182
|
var import_keys4 = require("@dxos/keys");
|
|
@@ -1209,12 +1200,12 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1209
1200
|
});
|
|
1210
1201
|
this._callbacks = _callbacks;
|
|
1211
1202
|
this._ctx = new import_context3.Context();
|
|
1212
|
-
this._remoteOptionsTrigger = new
|
|
1203
|
+
this._remoteOptionsTrigger = new import_async4.Trigger();
|
|
1213
1204
|
this.invitation = void 0;
|
|
1214
1205
|
this.guestProfile = void 0;
|
|
1215
1206
|
this.authenticationPassed = false;
|
|
1216
1207
|
this.authenticationRetry = 0;
|
|
1217
|
-
this.completedTrigger = new
|
|
1208
|
+
this.completedTrigger = new import_async4.Trigger();
|
|
1218
1209
|
}
|
|
1219
1210
|
async getHandlers() {
|
|
1220
1211
|
return {
|
|
@@ -1444,7 +1435,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1444
1435
|
});
|
|
1445
1436
|
this._callbacks = _callbacks;
|
|
1446
1437
|
this._ctx = new import_context3.Context();
|
|
1447
|
-
this._remoteOptionsTrigger = new
|
|
1438
|
+
this._remoteOptionsTrigger = new import_async4.Trigger();
|
|
1448
1439
|
}
|
|
1449
1440
|
async getHandlers() {
|
|
1450
1441
|
return {
|
|
@@ -1555,7 +1546,7 @@ var InvitationsHandler = class {
|
|
|
1555
1546
|
timeout,
|
|
1556
1547
|
...protocol.getInvitationContext()
|
|
1557
1548
|
};
|
|
1558
|
-
const stream = new
|
|
1549
|
+
const stream = new import_async5.PushStream();
|
|
1559
1550
|
const ctx = new import_context4.Context({
|
|
1560
1551
|
onError: (err) => {
|
|
1561
1552
|
void ctx.dispose();
|
|
@@ -1608,7 +1599,7 @@ var InvitationsHandler = class {
|
|
|
1608
1599
|
}
|
|
1609
1600
|
},
|
|
1610
1601
|
onOpen: () => {
|
|
1611
|
-
(0,
|
|
1602
|
+
(0, import_async5.scheduleTask)(ctx, async () => {
|
|
1612
1603
|
const traceId = import_keys5.PublicKey.random().toHex();
|
|
1613
1604
|
try {
|
|
1614
1605
|
import_log6.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.begin({
|
|
@@ -1656,7 +1647,7 @@ var InvitationsHandler = class {
|
|
|
1656
1647
|
C: (f, a) => f(...a)
|
|
1657
1648
|
});
|
|
1658
1649
|
} catch (err) {
|
|
1659
|
-
if (err instanceof
|
|
1650
|
+
if (err instanceof import_async5.TimeoutError) {
|
|
1660
1651
|
(0, import_log6.log)("timeout", {
|
|
1661
1652
|
...protocol.toJSON()
|
|
1662
1653
|
}, {
|
|
@@ -1699,7 +1690,7 @@ var InvitationsHandler = class {
|
|
|
1699
1690
|
if (err instanceof import_protocols5.InvalidInvitationExtensionRoleError) {
|
|
1700
1691
|
return;
|
|
1701
1692
|
}
|
|
1702
|
-
if (err instanceof
|
|
1693
|
+
if (err instanceof import_async5.TimeoutError) {
|
|
1703
1694
|
(0, import_log6.log)("timeout", {
|
|
1704
1695
|
...protocol.toJSON()
|
|
1705
1696
|
}, {
|
|
@@ -1726,7 +1717,7 @@ var InvitationsHandler = class {
|
|
|
1726
1717
|
return extension;
|
|
1727
1718
|
};
|
|
1728
1719
|
let swarmConnection;
|
|
1729
|
-
(0,
|
|
1720
|
+
(0, import_async5.scheduleTask)(ctx, async () => {
|
|
1730
1721
|
const topic = invitation.swarmKey;
|
|
1731
1722
|
swarmConnection = await this._networkManager.joinSwarm({
|
|
1732
1723
|
topic,
|
|
@@ -1767,10 +1758,10 @@ var InvitationsHandler = class {
|
|
|
1767
1758
|
""
|
|
1768
1759
|
]
|
|
1769
1760
|
});
|
|
1770
|
-
const authenticated = new
|
|
1761
|
+
const authenticated = new import_async5.Trigger();
|
|
1771
1762
|
let admitted = false;
|
|
1772
1763
|
let currentState;
|
|
1773
|
-
const stream = new
|
|
1764
|
+
const stream = new import_async5.PushStream();
|
|
1774
1765
|
const setState = (newData) => {
|
|
1775
1766
|
(0, import_invariant7.invariant)(newData.state !== void 0, void 0, {
|
|
1776
1767
|
F: __dxlog_file8,
|
|
@@ -1789,7 +1780,7 @@ var InvitationsHandler = class {
|
|
|
1789
1780
|
};
|
|
1790
1781
|
const ctx = new import_context4.Context({
|
|
1791
1782
|
onError: (err) => {
|
|
1792
|
-
if (err instanceof
|
|
1783
|
+
if (err instanceof import_async5.TimeoutError) {
|
|
1793
1784
|
(0, import_log6.log)("timeout", {
|
|
1794
1785
|
...protocol.toJSON()
|
|
1795
1786
|
}, {
|
|
@@ -1841,7 +1832,7 @@ var InvitationsHandler = class {
|
|
|
1841
1832
|
stream.error(new Error("Remote peer disconnected."));
|
|
1842
1833
|
}
|
|
1843
1834
|
});
|
|
1844
|
-
(0,
|
|
1835
|
+
(0, import_async5.scheduleTask)(ctx, async () => {
|
|
1845
1836
|
const traceId = import_keys5.PublicKey.random().toHex();
|
|
1846
1837
|
try {
|
|
1847
1838
|
import_log6.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.begin({
|
|
@@ -1855,7 +1846,7 @@ var InvitationsHandler = class {
|
|
|
1855
1846
|
if (++connectionCount > 1) {
|
|
1856
1847
|
throw new Error(`multiple connections detected: ${connectionCount}`);
|
|
1857
1848
|
}
|
|
1858
|
-
(0,
|
|
1849
|
+
(0, import_async5.scheduleTask)(ctx, () => ctx.raise(new import_async5.TimeoutError(timeout)), timeout);
|
|
1859
1850
|
(0, import_log6.log)("connected", {
|
|
1860
1851
|
...protocol.toJSON()
|
|
1861
1852
|
}, {
|
|
@@ -1972,7 +1963,7 @@ var InvitationsHandler = class {
|
|
|
1972
1963
|
C: (f, a) => f(...a)
|
|
1973
1964
|
});
|
|
1974
1965
|
} catch (err) {
|
|
1975
|
-
if (err instanceof
|
|
1966
|
+
if (err instanceof import_async5.TimeoutError) {
|
|
1976
1967
|
(0, import_log6.log)("timeout", {
|
|
1977
1968
|
...protocol.toJSON()
|
|
1978
1969
|
}, {
|
|
@@ -2011,7 +2002,7 @@ var InvitationsHandler = class {
|
|
|
2011
2002
|
if (err instanceof import_protocols5.InvalidInvitationExtensionRoleError) {
|
|
2012
2003
|
return;
|
|
2013
2004
|
}
|
|
2014
|
-
if (err instanceof
|
|
2005
|
+
if (err instanceof import_async5.TimeoutError) {
|
|
2015
2006
|
(0, import_log6.log)("timeout", {
|
|
2016
2007
|
...protocol.toJSON()
|
|
2017
2008
|
}, {
|
|
@@ -2036,7 +2027,7 @@ var InvitationsHandler = class {
|
|
|
2036
2027
|
});
|
|
2037
2028
|
return extension;
|
|
2038
2029
|
};
|
|
2039
|
-
(0,
|
|
2030
|
+
(0, import_async5.scheduleTask)(ctx, async () => {
|
|
2040
2031
|
(0, import_invariant7.invariant)(invitation.swarmKey, void 0, {
|
|
2041
2032
|
F: __dxlog_file8,
|
|
2042
2033
|
L: 361,
|
|
@@ -2079,7 +2070,7 @@ var InvitationsHandler = class {
|
|
|
2079
2070
|
};
|
|
2080
2071
|
|
|
2081
2072
|
// packages/sdk/client-services/src/packlets/invitations/invitations-service.ts
|
|
2082
|
-
var
|
|
2073
|
+
var import_async6 = require("@dxos/async");
|
|
2083
2074
|
var import_codec_protobuf4 = require("@dxos/codec-protobuf");
|
|
2084
2075
|
var import_invariant8 = require("@dxos/invariant");
|
|
2085
2076
|
var import_log7 = require("@dxos/log");
|
|
@@ -2091,10 +2082,10 @@ var InvitationsServiceImpl = class {
|
|
|
2091
2082
|
this._getHandler = _getHandler;
|
|
2092
2083
|
this._createInvitations = /* @__PURE__ */ new Map();
|
|
2093
2084
|
this._acceptInvitations = /* @__PURE__ */ new Map();
|
|
2094
|
-
this._invitationCreated = new
|
|
2095
|
-
this._invitationAccepted = new
|
|
2096
|
-
this._removedCreated = new
|
|
2097
|
-
this._removedAccepted = new
|
|
2085
|
+
this._invitationCreated = new import_async6.Event();
|
|
2086
|
+
this._invitationAccepted = new import_async6.Event();
|
|
2087
|
+
this._removedCreated = new import_async6.Event();
|
|
2088
|
+
this._removedAccepted = new import_async6.Event();
|
|
2098
2089
|
}
|
|
2099
2090
|
// TODO(burdon): Guest/host label.
|
|
2100
2091
|
getLoggingContext() {
|
|
@@ -2415,7 +2406,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2415
2406
|
};
|
|
2416
2407
|
|
|
2417
2408
|
// packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
|
|
2418
|
-
var
|
|
2409
|
+
var import_async9 = require("@dxos/async");
|
|
2419
2410
|
var import_context7 = require("@dxos/context");
|
|
2420
2411
|
var import_credentials14 = require("@dxos/credentials");
|
|
2421
2412
|
var import_invariant11 = require("@dxos/invariant");
|
|
@@ -2427,7 +2418,7 @@ var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip"
|
|
|
2427
2418
|
var import_util5 = require("@dxos/util");
|
|
2428
2419
|
|
|
2429
2420
|
// packages/sdk/client-services/src/packlets/spaces/data-space.ts
|
|
2430
|
-
var
|
|
2421
|
+
var import_async8 = require("@dxos/async");
|
|
2431
2422
|
var import_client_protocol3 = require("@dxos/client-protocol");
|
|
2432
2423
|
var import_context6 = require("@dxos/context");
|
|
2433
2424
|
var import_debug4 = require("@dxos/debug");
|
|
@@ -2442,7 +2433,7 @@ var import_tracing4 = require("@dxos/tracing");
|
|
|
2442
2433
|
var import_util4 = require("@dxos/util");
|
|
2443
2434
|
|
|
2444
2435
|
// packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
|
|
2445
|
-
var
|
|
2436
|
+
var import_async7 = require("@dxos/async");
|
|
2446
2437
|
var import_context5 = require("@dxos/context");
|
|
2447
2438
|
var import_invariant10 = require("@dxos/invariant");
|
|
2448
2439
|
var import_keys6 = require("@dxos/keys");
|
|
@@ -2458,7 +2449,7 @@ var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
|
|
|
2458
2449
|
var NotarizationPlugin = class {
|
|
2459
2450
|
constructor() {
|
|
2460
2451
|
this._ctx = new import_context5.Context();
|
|
2461
|
-
this._extensionOpened = new
|
|
2452
|
+
this._extensionOpened = new import_async7.Event();
|
|
2462
2453
|
this._extensions = /* @__PURE__ */ new Set();
|
|
2463
2454
|
this._processedCredentials = new import_util3.ComplexSet(import_keys6.PublicKey.hash);
|
|
2464
2455
|
this._processCredentialsTriggers = new import_util3.ComplexMap(import_keys6.PublicKey.hash);
|
|
@@ -2492,7 +2483,7 @@ var NotarizationPlugin = class {
|
|
|
2492
2483
|
"'Credentials must have an id'"
|
|
2493
2484
|
]
|
|
2494
2485
|
});
|
|
2495
|
-
const errors = new
|
|
2486
|
+
const errors = new import_async7.Trigger();
|
|
2496
2487
|
const ctx = this._ctx.derive({
|
|
2497
2488
|
onError: (err) => {
|
|
2498
2489
|
import_log9.log.warn("Notarization error", {
|
|
@@ -2509,7 +2500,7 @@ var NotarizationPlugin = class {
|
|
|
2509
2500
|
});
|
|
2510
2501
|
opCtx?.onDispose(() => ctx.dispose());
|
|
2511
2502
|
if (timeout !== 0) {
|
|
2512
|
-
(0,
|
|
2503
|
+
(0, import_async7.scheduleTask)(ctx, () => {
|
|
2513
2504
|
import_log9.log.warn("Notarization timeout", {
|
|
2514
2505
|
timeout,
|
|
2515
2506
|
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
@@ -2520,12 +2511,12 @@ var NotarizationPlugin = class {
|
|
|
2520
2511
|
C: (f, a) => f(...a)
|
|
2521
2512
|
});
|
|
2522
2513
|
void ctx.dispose();
|
|
2523
|
-
errors.throw(new
|
|
2514
|
+
errors.throw(new import_async7.TimeoutError(timeout, "Notarization timed out"));
|
|
2524
2515
|
}, timeout);
|
|
2525
2516
|
}
|
|
2526
2517
|
const allNotarized = Promise.all(credentials.map((credential) => this._waitUntilProcessed(credential.id)));
|
|
2527
2518
|
const peersTried = /* @__PURE__ */ new Set();
|
|
2528
|
-
const notarizeTask = new
|
|
2519
|
+
const notarizeTask = new import_async7.DeferredTask(ctx, async () => {
|
|
2529
2520
|
try {
|
|
2530
2521
|
if (this._extensions.size === 0) {
|
|
2531
2522
|
return;
|
|
@@ -2543,7 +2534,7 @@ var NotarizationPlugin = class {
|
|
|
2543
2534
|
C: (f, a) => f(...a)
|
|
2544
2535
|
});
|
|
2545
2536
|
peersTried.clear();
|
|
2546
|
-
(0,
|
|
2537
|
+
(0, import_async7.scheduleTask)(ctx, () => notarizeTask.schedule(), retryTimeout);
|
|
2547
2538
|
return;
|
|
2548
2539
|
}
|
|
2549
2540
|
peersTried.add(peer);
|
|
@@ -2565,7 +2556,7 @@ var NotarizationPlugin = class {
|
|
|
2565
2556
|
S: this,
|
|
2566
2557
|
C: (f, a) => f(...a)
|
|
2567
2558
|
});
|
|
2568
|
-
await (0,
|
|
2559
|
+
await (0, import_async7.sleep)(successDelay);
|
|
2569
2560
|
} catch (err) {
|
|
2570
2561
|
if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
|
|
2571
2562
|
import_log9.log.warn("error notarizing (recoverable)", err, {
|
|
@@ -2623,7 +2614,7 @@ var NotarizationPlugin = class {
|
|
|
2623
2614
|
if (this._processedCredentials.has(id)) {
|
|
2624
2615
|
return;
|
|
2625
2616
|
}
|
|
2626
|
-
await (0, import_util3.entry)(this._processCredentialsTriggers, id).orInsert(new
|
|
2617
|
+
await (0, import_util3.entry)(this._processCredentialsTriggers, id).orInsert(new import_async7.Trigger()).value.wait();
|
|
2627
2618
|
}
|
|
2628
2619
|
/**
|
|
2629
2620
|
* Requests from other peers to notarize credentials.
|
|
@@ -2731,7 +2722,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2731
2722
|
* Error for _state === SpaceState.ERROR.
|
|
2732
2723
|
*/
|
|
2733
2724
|
this.error = void 0;
|
|
2734
|
-
this.stateUpdate = new
|
|
2725
|
+
this.stateUpdate = new import_async8.Event();
|
|
2735
2726
|
this.metrics = {};
|
|
2736
2727
|
this._inner = params.inner;
|
|
2737
2728
|
this._inner.stateUpdate.on(this._ctx, () => this.stateUpdate.emit());
|
|
@@ -2837,7 +2828,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2837
2828
|
* Initialize the data pipeline in a separate task.
|
|
2838
2829
|
*/
|
|
2839
2830
|
initializeDataPipelineAsync() {
|
|
2840
|
-
(0,
|
|
2831
|
+
(0, import_async8.scheduleTask)(this._ctx, async () => {
|
|
2841
2832
|
try {
|
|
2842
2833
|
this.metrics.pipelineInitBegin = /* @__PURE__ */ new Date();
|
|
2843
2834
|
await this.initializeDataPipeline();
|
|
@@ -2887,7 +2878,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2887
2878
|
C: (f, a) => f(...a)
|
|
2888
2879
|
});
|
|
2889
2880
|
await this._initializeAndReadControlPipeline();
|
|
2890
|
-
await (0,
|
|
2881
|
+
await (0, import_async8.sleep)(1);
|
|
2891
2882
|
await this._inner.initializeDataPipeline();
|
|
2892
2883
|
this.metrics.dataPipelineOpen = /* @__PURE__ */ new Date();
|
|
2893
2884
|
await (0, import_context6.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
|
|
@@ -3043,10 +3034,10 @@ var DataSpace = class DataSpace2 {
|
|
|
3043
3034
|
}
|
|
3044
3035
|
};
|
|
3045
3036
|
_ts_decorate4([
|
|
3046
|
-
|
|
3037
|
+
import_async8.synchronized
|
|
3047
3038
|
], DataSpace.prototype, "open", null);
|
|
3048
3039
|
_ts_decorate4([
|
|
3049
|
-
|
|
3040
|
+
import_async8.synchronized
|
|
3050
3041
|
], DataSpace.prototype, "close", null);
|
|
3051
3042
|
_ts_decorate4([
|
|
3052
3043
|
import_tracing4.trace.span({
|
|
@@ -3062,13 +3053,13 @@ _ts_decorate4([
|
|
|
3062
3053
|
(0, import_debug4.timed)(1e4)
|
|
3063
3054
|
], DataSpace.prototype, "_createWritableFeeds", null);
|
|
3064
3055
|
_ts_decorate4([
|
|
3065
|
-
|
|
3056
|
+
import_async8.synchronized
|
|
3066
3057
|
], DataSpace.prototype, "activate", null);
|
|
3067
3058
|
_ts_decorate4([
|
|
3068
|
-
|
|
3059
|
+
import_async8.synchronized
|
|
3069
3060
|
], DataSpace.prototype, "deactivate", null);
|
|
3070
3061
|
DataSpace = _ts_decorate4([
|
|
3071
|
-
(0,
|
|
3062
|
+
(0, import_async8.trackLeaks)("open", "close")
|
|
3072
3063
|
], DataSpace);
|
|
3073
3064
|
|
|
3074
3065
|
// packages/sdk/client-services/src/packlets/spaces/genesis.ts
|
|
@@ -3161,7 +3152,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3161
3152
|
this._signingContext = _signingContext;
|
|
3162
3153
|
this._feedStore = _feedStore;
|
|
3163
3154
|
this._ctx = new import_context7.Context();
|
|
3164
|
-
this.updated = new
|
|
3155
|
+
this.updated = new import_async9.Event();
|
|
3165
3156
|
this._spaces = new import_util5.ComplexMap(import_keys8.PublicKey.hash);
|
|
3166
3157
|
this._isOpen = false;
|
|
3167
3158
|
this._instanceId = import_keys8.PublicKey.random().toHex();
|
|
@@ -3458,23 +3449,23 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3458
3449
|
}
|
|
3459
3450
|
};
|
|
3460
3451
|
_ts_decorate5([
|
|
3461
|
-
|
|
3452
|
+
import_async9.synchronized
|
|
3462
3453
|
], DataSpaceManager.prototype, "open", null);
|
|
3463
3454
|
_ts_decorate5([
|
|
3464
|
-
|
|
3455
|
+
import_async9.synchronized
|
|
3465
3456
|
], DataSpaceManager.prototype, "close", null);
|
|
3466
3457
|
_ts_decorate5([
|
|
3467
|
-
|
|
3458
|
+
import_async9.synchronized
|
|
3468
3459
|
], DataSpaceManager.prototype, "createSpace", null);
|
|
3469
3460
|
_ts_decorate5([
|
|
3470
|
-
|
|
3461
|
+
import_async9.synchronized
|
|
3471
3462
|
], DataSpaceManager.prototype, "acceptSpace", null);
|
|
3472
3463
|
DataSpaceManager = _ts_decorate5([
|
|
3473
|
-
(0,
|
|
3464
|
+
(0, import_async9.trackLeaks)("open", "close")
|
|
3474
3465
|
], DataSpaceManager);
|
|
3475
3466
|
|
|
3476
3467
|
// packages/sdk/client-services/src/packlets/spaces/spaces-service.ts
|
|
3477
|
-
var
|
|
3468
|
+
var import_async10 = require("@dxos/async");
|
|
3478
3469
|
var import_codec_protobuf5 = require("@dxos/codec-protobuf");
|
|
3479
3470
|
var import_debug6 = require("@dxos/debug");
|
|
3480
3471
|
var import_invariant12 = require("@dxos/invariant");
|
|
@@ -3515,7 +3506,7 @@ var SpacesServiceImpl = class {
|
|
|
3515
3506
|
}
|
|
3516
3507
|
querySpaces() {
|
|
3517
3508
|
return new import_codec_protobuf5.Stream(({ next, ctx }) => {
|
|
3518
|
-
const scheduler = new
|
|
3509
|
+
const scheduler = new import_async10.UpdateScheduler(ctx, async () => {
|
|
3519
3510
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3520
3511
|
const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
|
|
3521
3512
|
(0, import_log12.log)("update", {
|
|
@@ -3532,9 +3523,9 @@ var SpacesServiceImpl = class {
|
|
|
3532
3523
|
}, {
|
|
3533
3524
|
maxFrequency: process.env.NODE_ENV === "test" ? void 0 : 2
|
|
3534
3525
|
});
|
|
3535
|
-
(0,
|
|
3526
|
+
(0, import_async10.scheduleTask)(ctx, async () => {
|
|
3536
3527
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3537
|
-
const subscriptions = new
|
|
3528
|
+
const subscriptions = new import_async10.EventSubscriptions();
|
|
3538
3529
|
ctx.onDispose(() => subscriptions.clear());
|
|
3539
3530
|
const subscribeSpaces = () => {
|
|
3540
3531
|
subscriptions.clear();
|
|
@@ -3569,7 +3560,7 @@ var SpacesServiceImpl = class {
|
|
|
3569
3560
|
}
|
|
3570
3561
|
subscribeMessages({ spaceKey, channel }) {
|
|
3571
3562
|
return new import_codec_protobuf5.Stream(({ ctx, next }) => {
|
|
3572
|
-
(0,
|
|
3563
|
+
(0, import_async10.scheduleTask)(ctx, async () => {
|
|
3573
3564
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3574
3565
|
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
|
|
3575
3566
|
const handle = space.listen(getChannelId(channel), (message) => {
|
|
@@ -3588,7 +3579,7 @@ var SpacesServiceImpl = class {
|
|
|
3588
3579
|
}
|
|
3589
3580
|
};
|
|
3590
3581
|
ctx.onDispose(() => space.spaceState.removeCredentialProcessor(processor));
|
|
3591
|
-
(0,
|
|
3582
|
+
(0, import_async10.scheduleTask)(ctx, async () => {
|
|
3592
3583
|
await space.spaceState.addCredentialProcessor(processor);
|
|
3593
3584
|
if (noTail) {
|
|
3594
3585
|
close();
|
|
@@ -3712,7 +3703,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
3712
3703
|
this.networkManager = networkManager;
|
|
3713
3704
|
this.signalManager = signalManager;
|
|
3714
3705
|
this.modelFactory = modelFactory;
|
|
3715
|
-
this.initialized = new
|
|
3706
|
+
this.initialized = new import_async11.Trigger();
|
|
3716
3707
|
this.dataServiceSubscriptions = new import_echo_pipeline2.DataServiceSubscriptions();
|
|
3717
3708
|
this._handlerFactories = /* @__PURE__ */ new Map();
|
|
3718
3709
|
this._instanceId = import_keys9.PublicKey.random().toHex();
|
|
@@ -3941,7 +3932,7 @@ ServiceContext = _ts_decorate6([
|
|
|
3941
3932
|
], ServiceContext);
|
|
3942
3933
|
|
|
3943
3934
|
// packages/sdk/client-services/src/packlets/services/service-host.ts
|
|
3944
|
-
var
|
|
3935
|
+
var import_async17 = require("@dxos/async");
|
|
3945
3936
|
var import_client_protocol5 = require("@dxos/client-protocol");
|
|
3946
3937
|
var import_context10 = require("@dxos/context");
|
|
3947
3938
|
var import_document_model2 = require("@dxos/document-model");
|
|
@@ -3984,7 +3975,7 @@ var ServiceRegistry = class {
|
|
|
3984
3975
|
};
|
|
3985
3976
|
|
|
3986
3977
|
// packages/sdk/client-services/src/packlets/devices/devices-service.ts
|
|
3987
|
-
var
|
|
3978
|
+
var import_async12 = require("@dxos/async");
|
|
3988
3979
|
var import_codec_protobuf6 = require("@dxos/codec-protobuf");
|
|
3989
3980
|
var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
|
|
3990
3981
|
var DevicesServiceImpl = class {
|
|
@@ -4012,7 +4003,7 @@ var DevicesServiceImpl = class {
|
|
|
4012
4003
|
});
|
|
4013
4004
|
}
|
|
4014
4005
|
};
|
|
4015
|
-
const subscriptions = new
|
|
4006
|
+
const subscriptions = new import_async12.EventSubscriptions();
|
|
4016
4007
|
subscriptions.add(this._identityManager.stateUpdate.on(() => {
|
|
4017
4008
|
update();
|
|
4018
4009
|
if (this._identityManager.identity) {
|
|
@@ -4028,18 +4019,18 @@ var DevicesServiceImpl = class {
|
|
|
4028
4019
|
};
|
|
4029
4020
|
|
|
4030
4021
|
// packages/sdk/client-services/src/packlets/devtools/devtools.ts
|
|
4031
|
-
var
|
|
4022
|
+
var import_async15 = require("@dxos/async");
|
|
4032
4023
|
var import_codec_protobuf12 = require("@dxos/codec-protobuf");
|
|
4033
4024
|
|
|
4034
4025
|
// packages/sdk/client-services/src/packlets/devtools/feeds.ts
|
|
4035
|
-
var
|
|
4026
|
+
var import_async13 = require("@dxos/async");
|
|
4036
4027
|
var import_codec_protobuf7 = require("@dxos/codec-protobuf");
|
|
4037
4028
|
var import_feed_store4 = require("@dxos/feed-store");
|
|
4038
4029
|
var import_keys10 = require("@dxos/keys");
|
|
4039
4030
|
var import_util7 = require("@dxos/util");
|
|
4040
4031
|
var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
|
|
4041
4032
|
return new import_codec_protobuf7.Stream(({ next }) => {
|
|
4042
|
-
const subscriptions = new
|
|
4033
|
+
const subscriptions = new import_async13.EventSubscriptions();
|
|
4043
4034
|
const feedMap = new import_util7.ComplexMap(import_keys10.PublicKey.hash);
|
|
4044
4035
|
const update = () => {
|
|
4045
4036
|
const { feeds } = feedStore;
|
|
@@ -4071,7 +4062,7 @@ var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
|
|
|
4071
4062
|
if (!feedKey) {
|
|
4072
4063
|
return;
|
|
4073
4064
|
}
|
|
4074
|
-
const subscriptions = new
|
|
4065
|
+
const subscriptions = new import_async13.EventSubscriptions();
|
|
4075
4066
|
const timeout = setTimeout(async () => {
|
|
4076
4067
|
const feed = feedStore.getFeed(feedKey);
|
|
4077
4068
|
if (!feed) {
|
|
@@ -4106,7 +4097,7 @@ var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
|
|
|
4106
4097
|
};
|
|
4107
4098
|
|
|
4108
4099
|
// packages/sdk/client-services/src/packlets/devtools/keys.ts
|
|
4109
|
-
var
|
|
4100
|
+
var import_async14 = require("@dxos/async");
|
|
4110
4101
|
var import_codec_protobuf8 = require("@dxos/codec-protobuf");
|
|
4111
4102
|
var subscribeToKeyringKeys = ({ keyring }) => new import_codec_protobuf8.Stream(({ next, ctx }) => {
|
|
4112
4103
|
const update = async () => {
|
|
@@ -4115,7 +4106,7 @@ var subscribeToKeyringKeys = ({ keyring }) => new import_codec_protobuf8.Stream(
|
|
|
4115
4106
|
});
|
|
4116
4107
|
};
|
|
4117
4108
|
keyring.keysUpdate.on(ctx, update);
|
|
4118
|
-
(0,
|
|
4109
|
+
(0, import_async14.scheduleTask)(ctx, update);
|
|
4119
4110
|
});
|
|
4120
4111
|
|
|
4121
4112
|
// packages/sdk/client-services/src/packlets/devtools/metadata.ts
|
|
@@ -4222,7 +4213,7 @@ var subscribeToSpaces = (context, { spaceKeys = [] }) => {
|
|
|
4222
4213
|
// packages/sdk/client-services/src/packlets/devtools/devtools.ts
|
|
4223
4214
|
var DevtoolsHostEvents = class {
|
|
4224
4215
|
constructor() {
|
|
4225
|
-
this.ready = new
|
|
4216
|
+
this.ready = new import_async15.Event();
|
|
4226
4217
|
}
|
|
4227
4218
|
};
|
|
4228
4219
|
var DevtoolsServiceImpl = class {
|
|
@@ -4394,14 +4385,14 @@ _ts_decorate7([
|
|
|
4394
4385
|
], Lock.prototype, "lockKey", null);
|
|
4395
4386
|
|
|
4396
4387
|
// packages/sdk/client-services/src/packlets/logging/logging-service.ts
|
|
4397
|
-
var
|
|
4388
|
+
var import_async16 = require("@dxos/async");
|
|
4398
4389
|
var import_codec_protobuf13 = require("@dxos/codec-protobuf");
|
|
4399
4390
|
var import_log15 = require("@dxos/log");
|
|
4400
4391
|
var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
|
|
4401
4392
|
var import_util8 = require("@dxos/util");
|
|
4402
4393
|
var LoggingServiceImpl = class {
|
|
4403
4394
|
constructor() {
|
|
4404
|
-
this._logs = new
|
|
4395
|
+
this._logs = new import_async16.Event();
|
|
4405
4396
|
this._started = /* @__PURE__ */ new Date();
|
|
4406
4397
|
this._logProcessor = (_config, entry2) => {
|
|
4407
4398
|
this._logs.emit(entry2);
|
|
@@ -4684,7 +4675,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4684
4675
|
callbacks
|
|
4685
4676
|
} = {}) {
|
|
4686
4677
|
this._tracingService = import_tracing6.TRACE_PROCESSOR.createTraceSender();
|
|
4687
|
-
this._statusUpdate = new
|
|
4678
|
+
this._statusUpdate = new import_async17.Event();
|
|
4688
4679
|
this._opening = false;
|
|
4689
4680
|
this._open = false;
|
|
4690
4681
|
this._storage = storage;
|
|
@@ -5015,11 +5006,11 @@ _ts_decorate8([
|
|
|
5015
5006
|
import_tracing6.trace.info()
|
|
5016
5007
|
], ClientServicesHost.prototype, "_open", void 0);
|
|
5017
5008
|
_ts_decorate8([
|
|
5018
|
-
|
|
5009
|
+
import_async17.synchronized,
|
|
5019
5010
|
import_tracing6.trace.span()
|
|
5020
5011
|
], ClientServicesHost.prototype, "open", null);
|
|
5021
5012
|
_ts_decorate8([
|
|
5022
|
-
|
|
5013
|
+
import_async17.synchronized,
|
|
5023
5014
|
import_tracing6.trace.span()
|
|
5024
5015
|
], ClientServicesHost.prototype, "close", null);
|
|
5025
5016
|
ClientServicesHost = _ts_decorate8([
|
|
@@ -5040,9 +5031,9 @@ var sanitizeInvitation = (invitation) => {
|
|
|
5040
5031
|
};
|
|
5041
5032
|
};
|
|
5042
5033
|
var performInvitation = ({ host, guest, options, hooks }) => {
|
|
5043
|
-
const hostComplete = new
|
|
5044
|
-
const guestComplete = new
|
|
5045
|
-
const authCode = new
|
|
5034
|
+
const hostComplete = new import_async18.Trigger();
|
|
5035
|
+
const guestComplete = new import_async18.Trigger();
|
|
5036
|
+
const authCode = new import_async18.Trigger();
|
|
5046
5037
|
const hostObservable = createInvitation(host, options);
|
|
5047
5038
|
hostObservable.subscribe(async (hostInvitation) => {
|
|
5048
5039
|
switch (hostInvitation.state) {
|