@dxos/client-services 0.3.3-main.e0ded2e → 0.3.3-main.f2ca85a
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-OC4A3Z5C.mjs → chunk-CIMVJJPI.mjs} +27 -13
- package/dist/lib/browser/chunk-CIMVJJPI.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 +71 -57
- 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 +98 -84
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/services/diagnostics.d.ts +4 -1
- 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 +23 -0
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-OC4A3Z5C.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_async19 = 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
|
|
|
@@ -71,6 +71,7 @@ var import_debug = require("@dxos/debug");
|
|
|
71
71
|
var import_rpc = require("@dxos/rpc");
|
|
72
72
|
|
|
73
73
|
// packages/sdk/client-services/src/packlets/services/diagnostics.ts
|
|
74
|
+
var import_async = require("@dxos/async");
|
|
74
75
|
var import_codec_protobuf2 = require("@dxos/codec-protobuf");
|
|
75
76
|
var import_credentials2 = require("@dxos/credentials");
|
|
76
77
|
var import_document_model = require("@dxos/document-model");
|
|
@@ -109,7 +110,7 @@ var getPlatform = () => {
|
|
|
109
110
|
};
|
|
110
111
|
|
|
111
112
|
// packages/sdk/client-services/src/version.ts
|
|
112
|
-
var DXOS_VERSION = "0.3.3-main.
|
|
113
|
+
var DXOS_VERSION = "0.3.3-main.f2ca85a";
|
|
113
114
|
|
|
114
115
|
// packages/sdk/client-services/src/packlets/services/diagnostics.ts
|
|
115
116
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
|
|
@@ -128,7 +129,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
128
129
|
{
|
|
129
130
|
(0, import_invariant.invariant)(clientServices.LoggingService, "SystemService is not available.", {
|
|
130
131
|
F: __dxlog_file,
|
|
131
|
-
L:
|
|
132
|
+
L: 93,
|
|
132
133
|
S: void 0,
|
|
133
134
|
A: [
|
|
134
135
|
"clientServices.LoggingService",
|
|
@@ -161,6 +162,19 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
161
162
|
bytes,
|
|
162
163
|
length
|
|
163
164
|
}));
|
|
165
|
+
const status = await (0, import_codec_protobuf2.getFirstStreamValue)(clientServices.NetworkService.queryStatus(), {
|
|
166
|
+
timeout: DEFAULT_TIMEOUT
|
|
167
|
+
}).catch(() => void 0);
|
|
168
|
+
diagnostics.networkStatus = status;
|
|
169
|
+
const swarmInfoDone = new import_async.Trigger();
|
|
170
|
+
serviceContext.networkManager.connectionLog?.update.on(async () => {
|
|
171
|
+
const swarms = serviceContext.networkManager.connectionLog?.swarms;
|
|
172
|
+
diagnostics.swarms = swarms;
|
|
173
|
+
await swarmInfoDone.wake();
|
|
174
|
+
});
|
|
175
|
+
await swarmInfoDone.wait({
|
|
176
|
+
timeout: DEFAULT_TIMEOUT
|
|
177
|
+
});
|
|
164
178
|
}
|
|
165
179
|
diagnostics.config = config.values;
|
|
166
180
|
return diagnostics;
|
|
@@ -174,7 +188,7 @@ var getProperties = (space) => {
|
|
|
174
188
|
} catch (err) {
|
|
175
189
|
import_log.log.warn(err.message, void 0, {
|
|
176
190
|
F: __dxlog_file,
|
|
177
|
-
L:
|
|
191
|
+
L: 168,
|
|
178
192
|
S: void 0,
|
|
179
193
|
C: (f, a) => f(...a)
|
|
180
194
|
});
|
|
@@ -230,7 +244,7 @@ var getSpaceStats = async (space) => {
|
|
|
230
244
|
};
|
|
231
245
|
|
|
232
246
|
// packages/sdk/client-services/src/packlets/services/service-context.ts
|
|
233
|
-
var
|
|
247
|
+
var import_async12 = require("@dxos/async");
|
|
234
248
|
var import_context8 = require("@dxos/context");
|
|
235
249
|
var import_credentials15 = require("@dxos/credentials");
|
|
236
250
|
var import_debug7 = require("@dxos/debug");
|
|
@@ -247,7 +261,7 @@ var import_tracing4 = require("@dxos/tracing");
|
|
|
247
261
|
var import_util6 = require("@dxos/util");
|
|
248
262
|
|
|
249
263
|
// packages/sdk/client-services/src/packlets/identity/authenticator.ts
|
|
250
|
-
var
|
|
264
|
+
var import_async2 = require("@dxos/async");
|
|
251
265
|
var import_context = require("@dxos/context");
|
|
252
266
|
var import_credentials3 = require("@dxos/credentials");
|
|
253
267
|
var import_log2 = require("@dxos/log");
|
|
@@ -318,7 +332,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
318
332
|
});
|
|
319
333
|
return true;
|
|
320
334
|
}
|
|
321
|
-
const trigger = new
|
|
335
|
+
const trigger = new import_async2.Trigger();
|
|
322
336
|
this._ctx.onDispose(() => {
|
|
323
337
|
trigger.wake(false);
|
|
324
338
|
});
|
|
@@ -362,7 +376,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
362
376
|
};
|
|
363
377
|
|
|
364
378
|
// packages/sdk/client-services/src/packlets/identity/identity.ts
|
|
365
|
-
var
|
|
379
|
+
var import_async3 = require("@dxos/async");
|
|
366
380
|
var import_client_protocol = require("@dxos/client-protocol");
|
|
367
381
|
var import_credentials4 = require("@dxos/credentials");
|
|
368
382
|
var import_debug2 = require("@dxos/debug");
|
|
@@ -386,7 +400,7 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
386
400
|
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
|
|
387
401
|
var Identity = class Identity2 {
|
|
388
402
|
constructor({ space, signer, identityKey, deviceKey }) {
|
|
389
|
-
this.stateUpdate = new
|
|
403
|
+
this.stateUpdate = new import_async3.Event();
|
|
390
404
|
this.space = space;
|
|
391
405
|
this._signer = signer;
|
|
392
406
|
this.identityKey = identityKey;
|
|
@@ -544,7 +558,7 @@ Identity = _ts_decorate([
|
|
|
544
558
|
|
|
545
559
|
// packages/sdk/client-services/src/packlets/identity/identity-manager.ts
|
|
546
560
|
var import_platform2 = __toESM(require("platform"));
|
|
547
|
-
var
|
|
561
|
+
var import_async4 = require("@dxos/async");
|
|
548
562
|
var import_context2 = require("@dxos/context");
|
|
549
563
|
var import_credentials6 = require("@dxos/credentials");
|
|
550
564
|
var import_invariant3 = require("@dxos/invariant");
|
|
@@ -574,7 +588,7 @@ var IdentityManager = class IdentityManager2 {
|
|
|
574
588
|
this._keyring = _keyring;
|
|
575
589
|
this._feedStore = _feedStore;
|
|
576
590
|
this._spaceManager = _spaceManager;
|
|
577
|
-
this.stateUpdate = new
|
|
591
|
+
this.stateUpdate = new import_async4.Event();
|
|
578
592
|
}
|
|
579
593
|
get identity() {
|
|
580
594
|
return this._identity;
|
|
@@ -1082,7 +1096,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1082
1096
|
};
|
|
1083
1097
|
|
|
1084
1098
|
// packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
|
|
1085
|
-
var
|
|
1099
|
+
var import_async6 = require("@dxos/async");
|
|
1086
1100
|
var import_client_protocol2 = require("@dxos/client-protocol");
|
|
1087
1101
|
var import_context4 = require("@dxos/context");
|
|
1088
1102
|
var import_credentials9 = require("@dxos/credentials");
|
|
@@ -1095,7 +1109,7 @@ var import_services4 = require("@dxos/protocols/proto/dxos/client/services");
|
|
|
1095
1109
|
var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
1096
1110
|
|
|
1097
1111
|
// packages/sdk/client-services/src/packlets/invitations/invitation-extension.ts
|
|
1098
|
-
var
|
|
1112
|
+
var import_async5 = require("@dxos/async");
|
|
1099
1113
|
var import_context3 = require("@dxos/context");
|
|
1100
1114
|
var import_invariant6 = require("@dxos/invariant");
|
|
1101
1115
|
var import_keys4 = require("@dxos/keys");
|
|
@@ -1119,12 +1133,12 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1119
1133
|
});
|
|
1120
1134
|
this._callbacks = _callbacks;
|
|
1121
1135
|
this._ctx = new import_context3.Context();
|
|
1122
|
-
this._remoteOptionsTrigger = new
|
|
1136
|
+
this._remoteOptionsTrigger = new import_async5.Trigger();
|
|
1123
1137
|
this.invitation = void 0;
|
|
1124
1138
|
this.guestProfile = void 0;
|
|
1125
1139
|
this.authenticationPassed = false;
|
|
1126
1140
|
this.authenticationRetry = 0;
|
|
1127
|
-
this.completedTrigger = new
|
|
1141
|
+
this.completedTrigger = new import_async5.Trigger();
|
|
1128
1142
|
}
|
|
1129
1143
|
async getHandlers() {
|
|
1130
1144
|
return {
|
|
@@ -1354,7 +1368,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1354
1368
|
});
|
|
1355
1369
|
this._callbacks = _callbacks;
|
|
1356
1370
|
this._ctx = new import_context3.Context();
|
|
1357
|
-
this._remoteOptionsTrigger = new
|
|
1371
|
+
this._remoteOptionsTrigger = new import_async5.Trigger();
|
|
1358
1372
|
}
|
|
1359
1373
|
async getHandlers() {
|
|
1360
1374
|
return {
|
|
@@ -1465,7 +1479,7 @@ var InvitationsHandler = class {
|
|
|
1465
1479
|
timeout,
|
|
1466
1480
|
...protocol.getInvitationContext()
|
|
1467
1481
|
};
|
|
1468
|
-
const stream = new
|
|
1482
|
+
const stream = new import_async6.PushStream();
|
|
1469
1483
|
const ctx = new import_context4.Context({
|
|
1470
1484
|
onError: (err) => {
|
|
1471
1485
|
void ctx.dispose();
|
|
@@ -1518,7 +1532,7 @@ var InvitationsHandler = class {
|
|
|
1518
1532
|
}
|
|
1519
1533
|
},
|
|
1520
1534
|
onOpen: () => {
|
|
1521
|
-
(0,
|
|
1535
|
+
(0, import_async6.scheduleTask)(ctx, async () => {
|
|
1522
1536
|
const traceId = import_keys5.PublicKey.random().toHex();
|
|
1523
1537
|
try {
|
|
1524
1538
|
import_log6.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.begin({
|
|
@@ -1566,7 +1580,7 @@ var InvitationsHandler = class {
|
|
|
1566
1580
|
C: (f, a) => f(...a)
|
|
1567
1581
|
});
|
|
1568
1582
|
} catch (err) {
|
|
1569
|
-
if (err instanceof
|
|
1583
|
+
if (err instanceof import_async6.TimeoutError) {
|
|
1570
1584
|
(0, import_log6.log)("timeout", {
|
|
1571
1585
|
...protocol.toJSON()
|
|
1572
1586
|
}, {
|
|
@@ -1609,7 +1623,7 @@ var InvitationsHandler = class {
|
|
|
1609
1623
|
if (err instanceof import_protocols5.InvalidInvitationExtensionRoleError) {
|
|
1610
1624
|
return;
|
|
1611
1625
|
}
|
|
1612
|
-
if (err instanceof
|
|
1626
|
+
if (err instanceof import_async6.TimeoutError) {
|
|
1613
1627
|
(0, import_log6.log)("timeout", {
|
|
1614
1628
|
...protocol.toJSON()
|
|
1615
1629
|
}, {
|
|
@@ -1636,7 +1650,7 @@ var InvitationsHandler = class {
|
|
|
1636
1650
|
return extension;
|
|
1637
1651
|
};
|
|
1638
1652
|
let swarmConnection;
|
|
1639
|
-
(0,
|
|
1653
|
+
(0, import_async6.scheduleTask)(ctx, async () => {
|
|
1640
1654
|
const topic = invitation.swarmKey;
|
|
1641
1655
|
swarmConnection = await this._networkManager.joinSwarm({
|
|
1642
1656
|
topic,
|
|
@@ -1677,10 +1691,10 @@ var InvitationsHandler = class {
|
|
|
1677
1691
|
""
|
|
1678
1692
|
]
|
|
1679
1693
|
});
|
|
1680
|
-
const authenticated = new
|
|
1694
|
+
const authenticated = new import_async6.Trigger();
|
|
1681
1695
|
let admitted = false;
|
|
1682
1696
|
let currentState;
|
|
1683
|
-
const stream = new
|
|
1697
|
+
const stream = new import_async6.PushStream();
|
|
1684
1698
|
const setState = (newData) => {
|
|
1685
1699
|
(0, import_invariant7.invariant)(newData.state !== void 0, void 0, {
|
|
1686
1700
|
F: __dxlog_file8,
|
|
@@ -1699,7 +1713,7 @@ var InvitationsHandler = class {
|
|
|
1699
1713
|
};
|
|
1700
1714
|
const ctx = new import_context4.Context({
|
|
1701
1715
|
onError: (err) => {
|
|
1702
|
-
if (err instanceof
|
|
1716
|
+
if (err instanceof import_async6.TimeoutError) {
|
|
1703
1717
|
(0, import_log6.log)("timeout", {
|
|
1704
1718
|
...protocol.toJSON()
|
|
1705
1719
|
}, {
|
|
@@ -1751,7 +1765,7 @@ var InvitationsHandler = class {
|
|
|
1751
1765
|
stream.error(new Error("Remote peer disconnected."));
|
|
1752
1766
|
}
|
|
1753
1767
|
});
|
|
1754
|
-
(0,
|
|
1768
|
+
(0, import_async6.scheduleTask)(ctx, async () => {
|
|
1755
1769
|
const traceId = import_keys5.PublicKey.random().toHex();
|
|
1756
1770
|
try {
|
|
1757
1771
|
import_log6.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.begin({
|
|
@@ -1765,7 +1779,7 @@ var InvitationsHandler = class {
|
|
|
1765
1779
|
if (++connectionCount > 1) {
|
|
1766
1780
|
throw new Error(`multiple connections detected: ${connectionCount}`);
|
|
1767
1781
|
}
|
|
1768
|
-
(0,
|
|
1782
|
+
(0, import_async6.scheduleTask)(ctx, () => ctx.raise(new import_async6.TimeoutError(timeout)), timeout);
|
|
1769
1783
|
(0, import_log6.log)("connected", {
|
|
1770
1784
|
...protocol.toJSON()
|
|
1771
1785
|
}, {
|
|
@@ -1882,7 +1896,7 @@ var InvitationsHandler = class {
|
|
|
1882
1896
|
C: (f, a) => f(...a)
|
|
1883
1897
|
});
|
|
1884
1898
|
} catch (err) {
|
|
1885
|
-
if (err instanceof
|
|
1899
|
+
if (err instanceof import_async6.TimeoutError) {
|
|
1886
1900
|
(0, import_log6.log)("timeout", {
|
|
1887
1901
|
...protocol.toJSON()
|
|
1888
1902
|
}, {
|
|
@@ -1921,7 +1935,7 @@ var InvitationsHandler = class {
|
|
|
1921
1935
|
if (err instanceof import_protocols5.InvalidInvitationExtensionRoleError) {
|
|
1922
1936
|
return;
|
|
1923
1937
|
}
|
|
1924
|
-
if (err instanceof
|
|
1938
|
+
if (err instanceof import_async6.TimeoutError) {
|
|
1925
1939
|
(0, import_log6.log)("timeout", {
|
|
1926
1940
|
...protocol.toJSON()
|
|
1927
1941
|
}, {
|
|
@@ -1946,7 +1960,7 @@ var InvitationsHandler = class {
|
|
|
1946
1960
|
});
|
|
1947
1961
|
return extension;
|
|
1948
1962
|
};
|
|
1949
|
-
(0,
|
|
1963
|
+
(0, import_async6.scheduleTask)(ctx, async () => {
|
|
1950
1964
|
(0, import_invariant7.invariant)(invitation.swarmKey, void 0, {
|
|
1951
1965
|
F: __dxlog_file8,
|
|
1952
1966
|
L: 361,
|
|
@@ -1989,7 +2003,7 @@ var InvitationsHandler = class {
|
|
|
1989
2003
|
};
|
|
1990
2004
|
|
|
1991
2005
|
// packages/sdk/client-services/src/packlets/invitations/invitations-service.ts
|
|
1992
|
-
var
|
|
2006
|
+
var import_async7 = require("@dxos/async");
|
|
1993
2007
|
var import_codec_protobuf4 = require("@dxos/codec-protobuf");
|
|
1994
2008
|
var import_invariant8 = require("@dxos/invariant");
|
|
1995
2009
|
var import_log7 = require("@dxos/log");
|
|
@@ -2001,10 +2015,10 @@ var InvitationsServiceImpl = class {
|
|
|
2001
2015
|
this._getHandler = _getHandler;
|
|
2002
2016
|
this._createInvitations = /* @__PURE__ */ new Map();
|
|
2003
2017
|
this._acceptInvitations = /* @__PURE__ */ new Map();
|
|
2004
|
-
this._invitationCreated = new
|
|
2005
|
-
this._invitationAccepted = new
|
|
2006
|
-
this._removedCreated = new
|
|
2007
|
-
this._removedAccepted = new
|
|
2018
|
+
this._invitationCreated = new import_async7.Event();
|
|
2019
|
+
this._invitationAccepted = new import_async7.Event();
|
|
2020
|
+
this._removedCreated = new import_async7.Event();
|
|
2021
|
+
this._removedAccepted = new import_async7.Event();
|
|
2008
2022
|
}
|
|
2009
2023
|
// TODO(burdon): Guest/host label.
|
|
2010
2024
|
getLoggingContext() {
|
|
@@ -2325,7 +2339,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2325
2339
|
};
|
|
2326
2340
|
|
|
2327
2341
|
// packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
|
|
2328
|
-
var
|
|
2342
|
+
var import_async10 = require("@dxos/async");
|
|
2329
2343
|
var import_context7 = require("@dxos/context");
|
|
2330
2344
|
var import_credentials14 = require("@dxos/credentials");
|
|
2331
2345
|
var import_invariant11 = require("@dxos/invariant");
|
|
@@ -2337,7 +2351,7 @@ var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip"
|
|
|
2337
2351
|
var import_util5 = require("@dxos/util");
|
|
2338
2352
|
|
|
2339
2353
|
// packages/sdk/client-services/src/packlets/spaces/data-space.ts
|
|
2340
|
-
var
|
|
2354
|
+
var import_async9 = require("@dxos/async");
|
|
2341
2355
|
var import_client_protocol3 = require("@dxos/client-protocol");
|
|
2342
2356
|
var import_context6 = require("@dxos/context");
|
|
2343
2357
|
var import_debug4 = require("@dxos/debug");
|
|
@@ -2352,7 +2366,7 @@ var import_tracing3 = require("@dxos/tracing");
|
|
|
2352
2366
|
var import_util4 = require("@dxos/util");
|
|
2353
2367
|
|
|
2354
2368
|
// packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
|
|
2355
|
-
var
|
|
2369
|
+
var import_async8 = require("@dxos/async");
|
|
2356
2370
|
var import_context5 = require("@dxos/context");
|
|
2357
2371
|
var import_invariant10 = require("@dxos/invariant");
|
|
2358
2372
|
var import_keys6 = require("@dxos/keys");
|
|
@@ -2368,7 +2382,7 @@ var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
|
|
|
2368
2382
|
var NotarizationPlugin = class {
|
|
2369
2383
|
constructor() {
|
|
2370
2384
|
this._ctx = new import_context5.Context();
|
|
2371
|
-
this._extensionOpened = new
|
|
2385
|
+
this._extensionOpened = new import_async8.Event();
|
|
2372
2386
|
this._extensions = /* @__PURE__ */ new Set();
|
|
2373
2387
|
this._processedCredentials = new import_util3.ComplexSet(import_keys6.PublicKey.hash);
|
|
2374
2388
|
this._processCredentialsTriggers = new import_util3.ComplexMap(import_keys6.PublicKey.hash);
|
|
@@ -2402,7 +2416,7 @@ var NotarizationPlugin = class {
|
|
|
2402
2416
|
"'Credentials must have an id'"
|
|
2403
2417
|
]
|
|
2404
2418
|
});
|
|
2405
|
-
const errors = new
|
|
2419
|
+
const errors = new import_async8.Trigger();
|
|
2406
2420
|
const ctx = this._ctx.derive({
|
|
2407
2421
|
onError: (err) => {
|
|
2408
2422
|
import_log9.log.warn("Notarization error", {
|
|
@@ -2419,7 +2433,7 @@ var NotarizationPlugin = class {
|
|
|
2419
2433
|
});
|
|
2420
2434
|
opCtx?.onDispose(() => ctx.dispose());
|
|
2421
2435
|
if (timeout !== 0) {
|
|
2422
|
-
(0,
|
|
2436
|
+
(0, import_async8.scheduleTask)(ctx, () => {
|
|
2423
2437
|
import_log9.log.warn("Notarization timeout", {
|
|
2424
2438
|
timeout,
|
|
2425
2439
|
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
@@ -2430,12 +2444,12 @@ var NotarizationPlugin = class {
|
|
|
2430
2444
|
C: (f, a) => f(...a)
|
|
2431
2445
|
});
|
|
2432
2446
|
void ctx.dispose();
|
|
2433
|
-
errors.throw(new
|
|
2447
|
+
errors.throw(new import_async8.TimeoutError(timeout, "Notarization timed out"));
|
|
2434
2448
|
}, timeout);
|
|
2435
2449
|
}
|
|
2436
2450
|
const allNotarized = Promise.all(credentials.map((credential) => this._waitUntilProcessed(credential.id)));
|
|
2437
2451
|
const peersTried = /* @__PURE__ */ new Set();
|
|
2438
|
-
const notarizeTask = new
|
|
2452
|
+
const notarizeTask = new import_async8.DeferredTask(ctx, async () => {
|
|
2439
2453
|
try {
|
|
2440
2454
|
if (this._extensions.size === 0) {
|
|
2441
2455
|
return;
|
|
@@ -2453,7 +2467,7 @@ var NotarizationPlugin = class {
|
|
|
2453
2467
|
C: (f, a) => f(...a)
|
|
2454
2468
|
});
|
|
2455
2469
|
peersTried.clear();
|
|
2456
|
-
(0,
|
|
2470
|
+
(0, import_async8.scheduleTask)(ctx, () => notarizeTask.schedule(), retryTimeout);
|
|
2457
2471
|
return;
|
|
2458
2472
|
}
|
|
2459
2473
|
peersTried.add(peer);
|
|
@@ -2475,7 +2489,7 @@ var NotarizationPlugin = class {
|
|
|
2475
2489
|
S: this,
|
|
2476
2490
|
C: (f, a) => f(...a)
|
|
2477
2491
|
});
|
|
2478
|
-
await (0,
|
|
2492
|
+
await (0, import_async8.sleep)(successDelay);
|
|
2479
2493
|
} catch (err) {
|
|
2480
2494
|
if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
|
|
2481
2495
|
import_log9.log.warn("error notarizing (recoverable)", err, {
|
|
@@ -2533,7 +2547,7 @@ var NotarizationPlugin = class {
|
|
|
2533
2547
|
if (this._processedCredentials.has(id)) {
|
|
2534
2548
|
return;
|
|
2535
2549
|
}
|
|
2536
|
-
await (0, import_util3.entry)(this._processCredentialsTriggers, id).orInsert(new
|
|
2550
|
+
await (0, import_util3.entry)(this._processCredentialsTriggers, id).orInsert(new import_async8.Trigger()).value.wait();
|
|
2537
2551
|
}
|
|
2538
2552
|
/**
|
|
2539
2553
|
* Requests from other peers to notarize credentials.
|
|
@@ -2641,7 +2655,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2641
2655
|
* Error for _state === SpaceState.ERROR.
|
|
2642
2656
|
*/
|
|
2643
2657
|
this.error = void 0;
|
|
2644
|
-
this.stateUpdate = new
|
|
2658
|
+
this.stateUpdate = new import_async9.Event();
|
|
2645
2659
|
this.metrics = {};
|
|
2646
2660
|
this._inner = params.inner;
|
|
2647
2661
|
this._inner.stateUpdate.on(this._ctx, () => this.stateUpdate.emit());
|
|
@@ -2747,7 +2761,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2747
2761
|
* Initialize the data pipeline in a separate task.
|
|
2748
2762
|
*/
|
|
2749
2763
|
initializeDataPipelineAsync() {
|
|
2750
|
-
(0,
|
|
2764
|
+
(0, import_async9.scheduleTask)(this._ctx, async () => {
|
|
2751
2765
|
try {
|
|
2752
2766
|
this.metrics.pipelineInitBegin = /* @__PURE__ */ new Date();
|
|
2753
2767
|
await this.initializeDataPipeline();
|
|
@@ -2797,7 +2811,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2797
2811
|
C: (f, a) => f(...a)
|
|
2798
2812
|
});
|
|
2799
2813
|
await this._initializeAndReadControlPipeline();
|
|
2800
|
-
await (0,
|
|
2814
|
+
await (0, import_async9.sleep)(1);
|
|
2801
2815
|
await this._inner.initializeDataPipeline();
|
|
2802
2816
|
this.metrics.dataPipelineOpen = /* @__PURE__ */ new Date();
|
|
2803
2817
|
await (0, import_context6.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
|
|
@@ -2953,10 +2967,10 @@ var DataSpace = class DataSpace2 {
|
|
|
2953
2967
|
}
|
|
2954
2968
|
};
|
|
2955
2969
|
_ts_decorate3([
|
|
2956
|
-
|
|
2970
|
+
import_async9.synchronized
|
|
2957
2971
|
], DataSpace.prototype, "open", null);
|
|
2958
2972
|
_ts_decorate3([
|
|
2959
|
-
|
|
2973
|
+
import_async9.synchronized
|
|
2960
2974
|
], DataSpace.prototype, "close", null);
|
|
2961
2975
|
_ts_decorate3([
|
|
2962
2976
|
import_tracing3.trace.span({
|
|
@@ -2972,13 +2986,13 @@ _ts_decorate3([
|
|
|
2972
2986
|
(0, import_debug4.timed)(1e4)
|
|
2973
2987
|
], DataSpace.prototype, "_createWritableFeeds", null);
|
|
2974
2988
|
_ts_decorate3([
|
|
2975
|
-
|
|
2989
|
+
import_async9.synchronized
|
|
2976
2990
|
], DataSpace.prototype, "activate", null);
|
|
2977
2991
|
_ts_decorate3([
|
|
2978
|
-
|
|
2992
|
+
import_async9.synchronized
|
|
2979
2993
|
], DataSpace.prototype, "deactivate", null);
|
|
2980
2994
|
DataSpace = _ts_decorate3([
|
|
2981
|
-
(0,
|
|
2995
|
+
(0, import_async9.trackLeaks)("open", "close")
|
|
2982
2996
|
], DataSpace);
|
|
2983
2997
|
|
|
2984
2998
|
// packages/sdk/client-services/src/packlets/spaces/genesis.ts
|
|
@@ -3071,7 +3085,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3071
3085
|
this._signingContext = _signingContext;
|
|
3072
3086
|
this._feedStore = _feedStore;
|
|
3073
3087
|
this._ctx = new import_context7.Context();
|
|
3074
|
-
this.updated = new
|
|
3088
|
+
this.updated = new import_async10.Event();
|
|
3075
3089
|
this._spaces = new import_util5.ComplexMap(import_keys8.PublicKey.hash);
|
|
3076
3090
|
this._isOpen = false;
|
|
3077
3091
|
this._instanceId = import_keys8.PublicKey.random().toHex();
|
|
@@ -3368,23 +3382,23 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3368
3382
|
}
|
|
3369
3383
|
};
|
|
3370
3384
|
_ts_decorate4([
|
|
3371
|
-
|
|
3385
|
+
import_async10.synchronized
|
|
3372
3386
|
], DataSpaceManager.prototype, "open", null);
|
|
3373
3387
|
_ts_decorate4([
|
|
3374
|
-
|
|
3388
|
+
import_async10.synchronized
|
|
3375
3389
|
], DataSpaceManager.prototype, "close", null);
|
|
3376
3390
|
_ts_decorate4([
|
|
3377
|
-
|
|
3391
|
+
import_async10.synchronized
|
|
3378
3392
|
], DataSpaceManager.prototype, "createSpace", null);
|
|
3379
3393
|
_ts_decorate4([
|
|
3380
|
-
|
|
3394
|
+
import_async10.synchronized
|
|
3381
3395
|
], DataSpaceManager.prototype, "acceptSpace", null);
|
|
3382
3396
|
DataSpaceManager = _ts_decorate4([
|
|
3383
|
-
(0,
|
|
3397
|
+
(0, import_async10.trackLeaks)("open", "close")
|
|
3384
3398
|
], DataSpaceManager);
|
|
3385
3399
|
|
|
3386
3400
|
// packages/sdk/client-services/src/packlets/spaces/spaces-service.ts
|
|
3387
|
-
var
|
|
3401
|
+
var import_async11 = require("@dxos/async");
|
|
3388
3402
|
var import_codec_protobuf5 = require("@dxos/codec-protobuf");
|
|
3389
3403
|
var import_debug6 = require("@dxos/debug");
|
|
3390
3404
|
var import_invariant12 = require("@dxos/invariant");
|
|
@@ -3425,7 +3439,7 @@ var SpacesServiceImpl = class {
|
|
|
3425
3439
|
}
|
|
3426
3440
|
querySpaces() {
|
|
3427
3441
|
return new import_codec_protobuf5.Stream(({ next, ctx }) => {
|
|
3428
|
-
const scheduler = new
|
|
3442
|
+
const scheduler = new import_async11.UpdateScheduler(ctx, async () => {
|
|
3429
3443
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3430
3444
|
const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
|
|
3431
3445
|
(0, import_log12.log)("update", {
|
|
@@ -3442,9 +3456,9 @@ var SpacesServiceImpl = class {
|
|
|
3442
3456
|
}, {
|
|
3443
3457
|
maxFrequency: process.env.NODE_ENV === "test" ? void 0 : 2
|
|
3444
3458
|
});
|
|
3445
|
-
(0,
|
|
3459
|
+
(0, import_async11.scheduleTask)(ctx, async () => {
|
|
3446
3460
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3447
|
-
const subscriptions = new
|
|
3461
|
+
const subscriptions = new import_async11.EventSubscriptions();
|
|
3448
3462
|
ctx.onDispose(() => subscriptions.clear());
|
|
3449
3463
|
const subscribeSpaces = () => {
|
|
3450
3464
|
subscriptions.clear();
|
|
@@ -3479,7 +3493,7 @@ var SpacesServiceImpl = class {
|
|
|
3479
3493
|
}
|
|
3480
3494
|
subscribeMessages({ spaceKey, channel }) {
|
|
3481
3495
|
return new import_codec_protobuf5.Stream(({ ctx, next }) => {
|
|
3482
|
-
(0,
|
|
3496
|
+
(0, import_async11.scheduleTask)(ctx, async () => {
|
|
3483
3497
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3484
3498
|
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
|
|
3485
3499
|
const handle = space.listen(getChannelId(channel), (message) => {
|
|
@@ -3498,7 +3512,7 @@ var SpacesServiceImpl = class {
|
|
|
3498
3512
|
}
|
|
3499
3513
|
};
|
|
3500
3514
|
ctx.onDispose(() => space.spaceState.removeCredentialProcessor(processor));
|
|
3501
|
-
(0,
|
|
3515
|
+
(0, import_async11.scheduleTask)(ctx, async () => {
|
|
3502
3516
|
await space.spaceState.addCredentialProcessor(processor);
|
|
3503
3517
|
if (noTail) {
|
|
3504
3518
|
close();
|
|
@@ -3622,7 +3636,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
3622
3636
|
this.networkManager = networkManager;
|
|
3623
3637
|
this.signalManager = signalManager;
|
|
3624
3638
|
this.modelFactory = modelFactory;
|
|
3625
|
-
this.initialized = new
|
|
3639
|
+
this.initialized = new import_async12.Trigger();
|
|
3626
3640
|
this.dataServiceSubscriptions = new import_echo_pipeline2.DataServiceSubscriptions();
|
|
3627
3641
|
this._handlerFactories = /* @__PURE__ */ new Map();
|
|
3628
3642
|
this._instanceId = import_keys9.PublicKey.random().toHex();
|
|
@@ -3851,7 +3865,7 @@ ServiceContext = _ts_decorate5([
|
|
|
3851
3865
|
], ServiceContext);
|
|
3852
3866
|
|
|
3853
3867
|
// packages/sdk/client-services/src/packlets/services/service-host.ts
|
|
3854
|
-
var
|
|
3868
|
+
var import_async18 = require("@dxos/async");
|
|
3855
3869
|
var import_client_protocol5 = require("@dxos/client-protocol");
|
|
3856
3870
|
var import_context10 = require("@dxos/context");
|
|
3857
3871
|
var import_document_model2 = require("@dxos/document-model");
|
|
@@ -3894,7 +3908,7 @@ var ServiceRegistry = class {
|
|
|
3894
3908
|
};
|
|
3895
3909
|
|
|
3896
3910
|
// packages/sdk/client-services/src/packlets/devices/devices-service.ts
|
|
3897
|
-
var
|
|
3911
|
+
var import_async13 = require("@dxos/async");
|
|
3898
3912
|
var import_codec_protobuf6 = require("@dxos/codec-protobuf");
|
|
3899
3913
|
var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
|
|
3900
3914
|
var DevicesServiceImpl = class {
|
|
@@ -3922,7 +3936,7 @@ var DevicesServiceImpl = class {
|
|
|
3922
3936
|
});
|
|
3923
3937
|
}
|
|
3924
3938
|
};
|
|
3925
|
-
const subscriptions = new
|
|
3939
|
+
const subscriptions = new import_async13.EventSubscriptions();
|
|
3926
3940
|
subscriptions.add(this._identityManager.stateUpdate.on(() => {
|
|
3927
3941
|
update();
|
|
3928
3942
|
if (this._identityManager.identity) {
|
|
@@ -3938,18 +3952,18 @@ var DevicesServiceImpl = class {
|
|
|
3938
3952
|
};
|
|
3939
3953
|
|
|
3940
3954
|
// packages/sdk/client-services/src/packlets/devtools/devtools.ts
|
|
3941
|
-
var
|
|
3955
|
+
var import_async16 = require("@dxos/async");
|
|
3942
3956
|
var import_codec_protobuf12 = require("@dxos/codec-protobuf");
|
|
3943
3957
|
|
|
3944
3958
|
// packages/sdk/client-services/src/packlets/devtools/feeds.ts
|
|
3945
|
-
var
|
|
3959
|
+
var import_async14 = require("@dxos/async");
|
|
3946
3960
|
var import_codec_protobuf7 = require("@dxos/codec-protobuf");
|
|
3947
3961
|
var import_feed_store4 = require("@dxos/feed-store");
|
|
3948
3962
|
var import_keys10 = require("@dxos/keys");
|
|
3949
3963
|
var import_util7 = require("@dxos/util");
|
|
3950
3964
|
var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
|
|
3951
3965
|
return new import_codec_protobuf7.Stream(({ next }) => {
|
|
3952
|
-
const subscriptions = new
|
|
3966
|
+
const subscriptions = new import_async14.EventSubscriptions();
|
|
3953
3967
|
const feedMap = new import_util7.ComplexMap(import_keys10.PublicKey.hash);
|
|
3954
3968
|
const update = () => {
|
|
3955
3969
|
const { feeds } = feedStore;
|
|
@@ -3981,7 +3995,7 @@ var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
|
|
|
3981
3995
|
if (!feedKey) {
|
|
3982
3996
|
return;
|
|
3983
3997
|
}
|
|
3984
|
-
const subscriptions = new
|
|
3998
|
+
const subscriptions = new import_async14.EventSubscriptions();
|
|
3985
3999
|
const timeout = setTimeout(async () => {
|
|
3986
4000
|
const feed = feedStore.getFeed(feedKey);
|
|
3987
4001
|
if (!feed) {
|
|
@@ -4016,7 +4030,7 @@ var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
|
|
|
4016
4030
|
};
|
|
4017
4031
|
|
|
4018
4032
|
// packages/sdk/client-services/src/packlets/devtools/keys.ts
|
|
4019
|
-
var
|
|
4033
|
+
var import_async15 = require("@dxos/async");
|
|
4020
4034
|
var import_codec_protobuf8 = require("@dxos/codec-protobuf");
|
|
4021
4035
|
var subscribeToKeyringKeys = ({ keyring }) => new import_codec_protobuf8.Stream(({ next, ctx }) => {
|
|
4022
4036
|
const update = async () => {
|
|
@@ -4025,7 +4039,7 @@ var subscribeToKeyringKeys = ({ keyring }) => new import_codec_protobuf8.Stream(
|
|
|
4025
4039
|
});
|
|
4026
4040
|
};
|
|
4027
4041
|
keyring.keysUpdate.on(ctx, update);
|
|
4028
|
-
(0,
|
|
4042
|
+
(0, import_async15.scheduleTask)(ctx, update);
|
|
4029
4043
|
});
|
|
4030
4044
|
|
|
4031
4045
|
// packages/sdk/client-services/src/packlets/devtools/metadata.ts
|
|
@@ -4132,7 +4146,7 @@ var subscribeToSpaces = (context, { spaceKeys = [] }) => {
|
|
|
4132
4146
|
// packages/sdk/client-services/src/packlets/devtools/devtools.ts
|
|
4133
4147
|
var DevtoolsHostEvents = class {
|
|
4134
4148
|
constructor() {
|
|
4135
|
-
this.ready = new
|
|
4149
|
+
this.ready = new import_async16.Event();
|
|
4136
4150
|
}
|
|
4137
4151
|
};
|
|
4138
4152
|
var DevtoolsServiceImpl = class {
|
|
@@ -4304,14 +4318,14 @@ _ts_decorate6([
|
|
|
4304
4318
|
], Lock.prototype, "lockKey", null);
|
|
4305
4319
|
|
|
4306
4320
|
// packages/sdk/client-services/src/packlets/logging/logging-service.ts
|
|
4307
|
-
var
|
|
4321
|
+
var import_async17 = require("@dxos/async");
|
|
4308
4322
|
var import_codec_protobuf13 = require("@dxos/codec-protobuf");
|
|
4309
4323
|
var import_log15 = require("@dxos/log");
|
|
4310
4324
|
var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
|
|
4311
4325
|
var import_util8 = require("@dxos/util");
|
|
4312
4326
|
var LoggingServiceImpl = class {
|
|
4313
4327
|
constructor() {
|
|
4314
|
-
this._logs = new
|
|
4328
|
+
this._logs = new import_async17.Event();
|
|
4315
4329
|
this._started = /* @__PURE__ */ new Date();
|
|
4316
4330
|
this._logProcessor = (_config, entry2) => {
|
|
4317
4331
|
this._logs.emit(entry2);
|
|
@@ -4594,7 +4608,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4594
4608
|
callbacks
|
|
4595
4609
|
} = {}) {
|
|
4596
4610
|
this._tracingService = import_tracing5.TRACE_PROCESSOR.createTraceSender();
|
|
4597
|
-
this._statusUpdate = new
|
|
4611
|
+
this._statusUpdate = new import_async18.Event();
|
|
4598
4612
|
this._opening = false;
|
|
4599
4613
|
this._open = false;
|
|
4600
4614
|
this._storage = storage;
|
|
@@ -4925,11 +4939,11 @@ _ts_decorate7([
|
|
|
4925
4939
|
import_tracing5.trace.info()
|
|
4926
4940
|
], ClientServicesHost.prototype, "_open", void 0);
|
|
4927
4941
|
_ts_decorate7([
|
|
4928
|
-
|
|
4942
|
+
import_async18.synchronized,
|
|
4929
4943
|
import_tracing5.trace.span()
|
|
4930
4944
|
], ClientServicesHost.prototype, "open", null);
|
|
4931
4945
|
_ts_decorate7([
|
|
4932
|
-
|
|
4946
|
+
import_async18.synchronized,
|
|
4933
4947
|
import_tracing5.trace.span()
|
|
4934
4948
|
], ClientServicesHost.prototype, "close", null);
|
|
4935
4949
|
ClientServicesHost = _ts_decorate7([
|
|
@@ -4950,9 +4964,9 @@ var sanitizeInvitation = (invitation) => {
|
|
|
4950
4964
|
};
|
|
4951
4965
|
};
|
|
4952
4966
|
var performInvitation = ({ host, guest, options, hooks }) => {
|
|
4953
|
-
const hostComplete = new
|
|
4954
|
-
const guestComplete = new
|
|
4955
|
-
const authCode = new
|
|
4967
|
+
const hostComplete = new import_async19.Trigger();
|
|
4968
|
+
const guestComplete = new import_async19.Trigger();
|
|
4969
|
+
const authCode = new import_async19.Trigger();
|
|
4956
4970
|
const hostObservable = createInvitation(host, options);
|
|
4957
4971
|
hostObservable.subscribe(async (hostInvitation) => {
|
|
4958
4972
|
switch (hostInvitation.state) {
|