@dxos/client-services 0.3.3-main.f2ca85a → 0.3.3-main.ff5734a
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-CIMVJJPI.mjs → chunk-OTXSFYDU.mjs} +86 -66
- package/dist/lib/browser/chunk-OTXSFYDU.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 +135 -115
- 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 +216 -149
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/services/client-rpc-server.d.ts +2 -0
- package/dist/types/src/packlets/services/client-rpc-server.d.ts.map +1 -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/client-rpc-server.ts +18 -1
- package/src/packlets/services/diagnostics.ts +1 -9
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-CIMVJJPI.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
|
|
|
@@ -69,9 +69,84 @@ var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
|
|
|
69
69
|
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
70
70
|
var import_debug = require("@dxos/debug");
|
|
71
71
|
var import_rpc = require("@dxos/rpc");
|
|
72
|
+
var import_tracing = require("@dxos/tracing");
|
|
73
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
74
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
75
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
76
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
77
|
+
else
|
|
78
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
79
|
+
if (d = decorators[i])
|
|
80
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
81
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
82
|
+
}
|
|
83
|
+
var ClientRpcServer = class ClientRpcServer2 {
|
|
84
|
+
constructor(params) {
|
|
85
|
+
this._handlerCache = /* @__PURE__ */ new Map();
|
|
86
|
+
this._callMetrics = new import_tracing.MapCounter();
|
|
87
|
+
const { serviceRegistry, handleCall, handleStream, ...rpcOptions } = params;
|
|
88
|
+
this._handleCall = handleCall;
|
|
89
|
+
this._handleStream = handleStream;
|
|
90
|
+
this._serviceRegistry = serviceRegistry;
|
|
91
|
+
this._rpcPeer = new import_rpc.RpcPeer({
|
|
92
|
+
...rpcOptions,
|
|
93
|
+
callHandler: (method, params2) => {
|
|
94
|
+
const [serviceName, methodName] = (0, import_rpc.parseMethodName)(method);
|
|
95
|
+
const handler = (method2, params3) => this._getServiceHandler(serviceName).call(method2, params3);
|
|
96
|
+
this._callMetrics.inc(`${serviceName}.${methodName} request`);
|
|
97
|
+
if (this._handleCall) {
|
|
98
|
+
return this._handleCall(methodName, params2, handler);
|
|
99
|
+
} else {
|
|
100
|
+
return handler(methodName, params2);
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
streamHandler: (method, params2) => {
|
|
104
|
+
const [serviceName, methodName] = (0, import_rpc.parseMethodName)(method);
|
|
105
|
+
const handler = (method2, params3) => this._getServiceHandler(serviceName).callStream(method2, params3);
|
|
106
|
+
this._callMetrics.inc(`${serviceName}.${methodName} request stream`);
|
|
107
|
+
if (this._handleStream) {
|
|
108
|
+
return import_codec_protobuf.Stream.map(import_codec_protobuf.Stream.unwrapPromise(this._handleStream(methodName, params2, handler)), (data) => {
|
|
109
|
+
this._callMetrics.inc(`${serviceName}.${methodName} response stream`);
|
|
110
|
+
return data;
|
|
111
|
+
});
|
|
112
|
+
} else {
|
|
113
|
+
return handler(methodName, params2);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
get _services() {
|
|
119
|
+
return Object.keys(this._serviceRegistry.services);
|
|
120
|
+
}
|
|
121
|
+
async open() {
|
|
122
|
+
await this._rpcPeer.open();
|
|
123
|
+
}
|
|
124
|
+
async close() {
|
|
125
|
+
await this._rpcPeer.close();
|
|
126
|
+
}
|
|
127
|
+
_getServiceHandler(serviceName) {
|
|
128
|
+
if (!this._handlerCache.has(serviceName)) {
|
|
129
|
+
const [key, descriptor] = Object.entries(this._serviceRegistry.descriptors).find(([key2, descriptor2]) => descriptor2.name === serviceName) ?? (0, import_debug.raise)(new Error(`Service not available: ${serviceName}`));
|
|
130
|
+
const service = this._serviceRegistry.services[key];
|
|
131
|
+
if (!service) {
|
|
132
|
+
throw new Error(`Service not available: ${serviceName}`);
|
|
133
|
+
}
|
|
134
|
+
this._handlerCache.set(serviceName, descriptor.createServer(service));
|
|
135
|
+
}
|
|
136
|
+
return this._handlerCache.get(serviceName);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
_ts_decorate([
|
|
140
|
+
import_tracing.trace.metricsCounter()
|
|
141
|
+
], ClientRpcServer.prototype, "_callMetrics", void 0);
|
|
142
|
+
_ts_decorate([
|
|
143
|
+
import_tracing.trace.info()
|
|
144
|
+
], ClientRpcServer.prototype, "_services", null);
|
|
145
|
+
ClientRpcServer = _ts_decorate([
|
|
146
|
+
import_tracing.trace.resource()
|
|
147
|
+
], ClientRpcServer);
|
|
72
148
|
|
|
73
149
|
// packages/sdk/client-services/src/packlets/services/diagnostics.ts
|
|
74
|
-
var import_async = require("@dxos/async");
|
|
75
150
|
var import_codec_protobuf2 = require("@dxos/codec-protobuf");
|
|
76
151
|
var import_credentials2 = require("@dxos/credentials");
|
|
77
152
|
var import_document_model = require("@dxos/document-model");
|
|
@@ -110,7 +185,7 @@ var getPlatform = () => {
|
|
|
110
185
|
};
|
|
111
186
|
|
|
112
187
|
// packages/sdk/client-services/src/version.ts
|
|
113
|
-
var DXOS_VERSION = "0.3.3-main.
|
|
188
|
+
var DXOS_VERSION = "0.3.3-main.ff5734a";
|
|
114
189
|
|
|
115
190
|
// packages/sdk/client-services/src/packlets/services/diagnostics.ts
|
|
116
191
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
|
|
@@ -129,7 +204,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
129
204
|
{
|
|
130
205
|
(0, import_invariant.invariant)(clientServices.LoggingService, "SystemService is not available.", {
|
|
131
206
|
F: __dxlog_file,
|
|
132
|
-
L:
|
|
207
|
+
L: 92,
|
|
133
208
|
S: void 0,
|
|
134
209
|
A: [
|
|
135
210
|
"clientServices.LoggingService",
|
|
@@ -166,15 +241,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
166
241
|
timeout: DEFAULT_TIMEOUT
|
|
167
242
|
}).catch(() => void 0);
|
|
168
243
|
diagnostics.networkStatus = status;
|
|
169
|
-
|
|
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
|
-
});
|
|
244
|
+
diagnostics.swarms = serviceContext.networkManager.connectionLog?.swarms;
|
|
178
245
|
}
|
|
179
246
|
diagnostics.config = config.values;
|
|
180
247
|
return diagnostics;
|
|
@@ -188,7 +255,7 @@ var getProperties = (space) => {
|
|
|
188
255
|
} catch (err) {
|
|
189
256
|
import_log.log.warn(err.message, void 0, {
|
|
190
257
|
F: __dxlog_file,
|
|
191
|
-
L:
|
|
258
|
+
L: 160,
|
|
192
259
|
S: void 0,
|
|
193
260
|
C: (f, a) => f(...a)
|
|
194
261
|
});
|
|
@@ -244,7 +311,7 @@ var getSpaceStats = async (space) => {
|
|
|
244
311
|
};
|
|
245
312
|
|
|
246
313
|
// packages/sdk/client-services/src/packlets/services/service-context.ts
|
|
247
|
-
var
|
|
314
|
+
var import_async11 = require("@dxos/async");
|
|
248
315
|
var import_context8 = require("@dxos/context");
|
|
249
316
|
var import_credentials15 = require("@dxos/credentials");
|
|
250
317
|
var import_debug7 = require("@dxos/debug");
|
|
@@ -257,11 +324,11 @@ var import_log13 = require("@dxos/log");
|
|
|
257
324
|
var import_protocols10 = require("@dxos/protocols");
|
|
258
325
|
var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
|
|
259
326
|
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
260
|
-
var
|
|
327
|
+
var import_tracing5 = require("@dxos/tracing");
|
|
261
328
|
var import_util6 = require("@dxos/util");
|
|
262
329
|
|
|
263
330
|
// packages/sdk/client-services/src/packlets/identity/authenticator.ts
|
|
264
|
-
var
|
|
331
|
+
var import_async = require("@dxos/async");
|
|
265
332
|
var import_context = require("@dxos/context");
|
|
266
333
|
var import_credentials3 = require("@dxos/credentials");
|
|
267
334
|
var import_log2 = require("@dxos/log");
|
|
@@ -332,7 +399,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
332
399
|
});
|
|
333
400
|
return true;
|
|
334
401
|
}
|
|
335
|
-
const trigger = new
|
|
402
|
+
const trigger = new import_async.Trigger();
|
|
336
403
|
this._ctx.onDispose(() => {
|
|
337
404
|
trigger.wake(false);
|
|
338
405
|
});
|
|
@@ -376,7 +443,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
376
443
|
};
|
|
377
444
|
|
|
378
445
|
// packages/sdk/client-services/src/packlets/identity/identity.ts
|
|
379
|
-
var
|
|
446
|
+
var import_async2 = require("@dxos/async");
|
|
380
447
|
var import_client_protocol = require("@dxos/client-protocol");
|
|
381
448
|
var import_credentials4 = require("@dxos/credentials");
|
|
382
449
|
var import_debug2 = require("@dxos/debug");
|
|
@@ -385,9 +452,9 @@ var import_invariant2 = require("@dxos/invariant");
|
|
|
385
452
|
var import_keys2 = require("@dxos/keys");
|
|
386
453
|
var import_log3 = require("@dxos/log");
|
|
387
454
|
var import_credentials5 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
388
|
-
var
|
|
455
|
+
var import_tracing2 = require("@dxos/tracing");
|
|
389
456
|
var import_util = require("@dxos/util");
|
|
390
|
-
function
|
|
457
|
+
function _ts_decorate2(decorators, target, key, desc) {
|
|
391
458
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
392
459
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
393
460
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -400,7 +467,7 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
400
467
|
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
|
|
401
468
|
var Identity = class Identity2 {
|
|
402
469
|
constructor({ space, signer, identityKey, deviceKey }) {
|
|
403
|
-
this.stateUpdate = new
|
|
470
|
+
this.stateUpdate = new import_async2.Event();
|
|
404
471
|
this.space = space;
|
|
405
472
|
this._signer = signer;
|
|
406
473
|
this.identityKey = identityKey;
|
|
@@ -546,19 +613,19 @@ var Identity = class Identity2 {
|
|
|
546
613
|
})));
|
|
547
614
|
}
|
|
548
615
|
};
|
|
549
|
-
|
|
550
|
-
|
|
616
|
+
_ts_decorate2([
|
|
617
|
+
import_tracing2.trace.span()
|
|
551
618
|
], Identity.prototype, "open", null);
|
|
552
|
-
|
|
553
|
-
|
|
619
|
+
_ts_decorate2([
|
|
620
|
+
import_tracing2.trace.span()
|
|
554
621
|
], Identity.prototype, "close", null);
|
|
555
|
-
Identity =
|
|
556
|
-
|
|
622
|
+
Identity = _ts_decorate2([
|
|
623
|
+
import_tracing2.trace.resource()
|
|
557
624
|
], Identity);
|
|
558
625
|
|
|
559
626
|
// packages/sdk/client-services/src/packlets/identity/identity-manager.ts
|
|
560
627
|
var import_platform2 = __toESM(require("platform"));
|
|
561
|
-
var
|
|
628
|
+
var import_async3 = require("@dxos/async");
|
|
562
629
|
var import_context2 = require("@dxos/context");
|
|
563
630
|
var import_credentials6 = require("@dxos/credentials");
|
|
564
631
|
var import_invariant3 = require("@dxos/invariant");
|
|
@@ -567,9 +634,9 @@ var import_log4 = require("@dxos/log");
|
|
|
567
634
|
var import_protocols3 = require("@dxos/protocols");
|
|
568
635
|
var import_credentials7 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
569
636
|
var import_timeframe = require("@dxos/timeframe");
|
|
570
|
-
var
|
|
637
|
+
var import_tracing3 = require("@dxos/tracing");
|
|
571
638
|
var import_util2 = require("@dxos/util");
|
|
572
|
-
function
|
|
639
|
+
function _ts_decorate3(decorators, target, key, desc) {
|
|
573
640
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
574
641
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
575
642
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -588,7 +655,7 @@ var IdentityManager = class IdentityManager2 {
|
|
|
588
655
|
this._keyring = _keyring;
|
|
589
656
|
this._feedStore = _feedStore;
|
|
590
657
|
this._spaceManager = _spaceManager;
|
|
591
|
-
this.stateUpdate = new
|
|
658
|
+
this.stateUpdate = new import_async3.Event();
|
|
592
659
|
}
|
|
593
660
|
get identity() {
|
|
594
661
|
return this._identity;
|
|
@@ -925,13 +992,13 @@ var IdentityManager = class IdentityManager2 {
|
|
|
925
992
|
});
|
|
926
993
|
}
|
|
927
994
|
};
|
|
928
|
-
|
|
929
|
-
|
|
995
|
+
_ts_decorate3([
|
|
996
|
+
import_tracing3.trace.span({
|
|
930
997
|
showInBrowserTimeline: true
|
|
931
998
|
})
|
|
932
999
|
], IdentityManager.prototype, "open", null);
|
|
933
|
-
IdentityManager =
|
|
934
|
-
|
|
1000
|
+
IdentityManager = _ts_decorate3([
|
|
1001
|
+
import_tracing3.trace.resource()
|
|
935
1002
|
], IdentityManager);
|
|
936
1003
|
|
|
937
1004
|
// packages/sdk/client-services/src/packlets/identity/identity-service.ts
|
|
@@ -1096,7 +1163,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1096
1163
|
};
|
|
1097
1164
|
|
|
1098
1165
|
// packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
|
|
1099
|
-
var
|
|
1166
|
+
var import_async5 = require("@dxos/async");
|
|
1100
1167
|
var import_client_protocol2 = require("@dxos/client-protocol");
|
|
1101
1168
|
var import_context4 = require("@dxos/context");
|
|
1102
1169
|
var import_credentials9 = require("@dxos/credentials");
|
|
@@ -1109,7 +1176,7 @@ var import_services4 = require("@dxos/protocols/proto/dxos/client/services");
|
|
|
1109
1176
|
var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
1110
1177
|
|
|
1111
1178
|
// packages/sdk/client-services/src/packlets/invitations/invitation-extension.ts
|
|
1112
|
-
var
|
|
1179
|
+
var import_async4 = require("@dxos/async");
|
|
1113
1180
|
var import_context3 = require("@dxos/context");
|
|
1114
1181
|
var import_invariant6 = require("@dxos/invariant");
|
|
1115
1182
|
var import_keys4 = require("@dxos/keys");
|
|
@@ -1133,12 +1200,12 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1133
1200
|
});
|
|
1134
1201
|
this._callbacks = _callbacks;
|
|
1135
1202
|
this._ctx = new import_context3.Context();
|
|
1136
|
-
this._remoteOptionsTrigger = new
|
|
1203
|
+
this._remoteOptionsTrigger = new import_async4.Trigger();
|
|
1137
1204
|
this.invitation = void 0;
|
|
1138
1205
|
this.guestProfile = void 0;
|
|
1139
1206
|
this.authenticationPassed = false;
|
|
1140
1207
|
this.authenticationRetry = 0;
|
|
1141
|
-
this.completedTrigger = new
|
|
1208
|
+
this.completedTrigger = new import_async4.Trigger();
|
|
1142
1209
|
}
|
|
1143
1210
|
async getHandlers() {
|
|
1144
1211
|
return {
|
|
@@ -1368,7 +1435,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1368
1435
|
});
|
|
1369
1436
|
this._callbacks = _callbacks;
|
|
1370
1437
|
this._ctx = new import_context3.Context();
|
|
1371
|
-
this._remoteOptionsTrigger = new
|
|
1438
|
+
this._remoteOptionsTrigger = new import_async4.Trigger();
|
|
1372
1439
|
}
|
|
1373
1440
|
async getHandlers() {
|
|
1374
1441
|
return {
|
|
@@ -1479,7 +1546,7 @@ var InvitationsHandler = class {
|
|
|
1479
1546
|
timeout,
|
|
1480
1547
|
...protocol.getInvitationContext()
|
|
1481
1548
|
};
|
|
1482
|
-
const stream = new
|
|
1549
|
+
const stream = new import_async5.PushStream();
|
|
1483
1550
|
const ctx = new import_context4.Context({
|
|
1484
1551
|
onError: (err) => {
|
|
1485
1552
|
void ctx.dispose();
|
|
@@ -1532,7 +1599,7 @@ var InvitationsHandler = class {
|
|
|
1532
1599
|
}
|
|
1533
1600
|
},
|
|
1534
1601
|
onOpen: () => {
|
|
1535
|
-
(0,
|
|
1602
|
+
(0, import_async5.scheduleTask)(ctx, async () => {
|
|
1536
1603
|
const traceId = import_keys5.PublicKey.random().toHex();
|
|
1537
1604
|
try {
|
|
1538
1605
|
import_log6.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.begin({
|
|
@@ -1580,7 +1647,7 @@ var InvitationsHandler = class {
|
|
|
1580
1647
|
C: (f, a) => f(...a)
|
|
1581
1648
|
});
|
|
1582
1649
|
} catch (err) {
|
|
1583
|
-
if (err instanceof
|
|
1650
|
+
if (err instanceof import_async5.TimeoutError) {
|
|
1584
1651
|
(0, import_log6.log)("timeout", {
|
|
1585
1652
|
...protocol.toJSON()
|
|
1586
1653
|
}, {
|
|
@@ -1623,7 +1690,7 @@ var InvitationsHandler = class {
|
|
|
1623
1690
|
if (err instanceof import_protocols5.InvalidInvitationExtensionRoleError) {
|
|
1624
1691
|
return;
|
|
1625
1692
|
}
|
|
1626
|
-
if (err instanceof
|
|
1693
|
+
if (err instanceof import_async5.TimeoutError) {
|
|
1627
1694
|
(0, import_log6.log)("timeout", {
|
|
1628
1695
|
...protocol.toJSON()
|
|
1629
1696
|
}, {
|
|
@@ -1650,7 +1717,7 @@ var InvitationsHandler = class {
|
|
|
1650
1717
|
return extension;
|
|
1651
1718
|
};
|
|
1652
1719
|
let swarmConnection;
|
|
1653
|
-
(0,
|
|
1720
|
+
(0, import_async5.scheduleTask)(ctx, async () => {
|
|
1654
1721
|
const topic = invitation.swarmKey;
|
|
1655
1722
|
swarmConnection = await this._networkManager.joinSwarm({
|
|
1656
1723
|
topic,
|
|
@@ -1691,10 +1758,10 @@ var InvitationsHandler = class {
|
|
|
1691
1758
|
""
|
|
1692
1759
|
]
|
|
1693
1760
|
});
|
|
1694
|
-
const authenticated = new
|
|
1761
|
+
const authenticated = new import_async5.Trigger();
|
|
1695
1762
|
let admitted = false;
|
|
1696
1763
|
let currentState;
|
|
1697
|
-
const stream = new
|
|
1764
|
+
const stream = new import_async5.PushStream();
|
|
1698
1765
|
const setState = (newData) => {
|
|
1699
1766
|
(0, import_invariant7.invariant)(newData.state !== void 0, void 0, {
|
|
1700
1767
|
F: __dxlog_file8,
|
|
@@ -1713,7 +1780,7 @@ var InvitationsHandler = class {
|
|
|
1713
1780
|
};
|
|
1714
1781
|
const ctx = new import_context4.Context({
|
|
1715
1782
|
onError: (err) => {
|
|
1716
|
-
if (err instanceof
|
|
1783
|
+
if (err instanceof import_async5.TimeoutError) {
|
|
1717
1784
|
(0, import_log6.log)("timeout", {
|
|
1718
1785
|
...protocol.toJSON()
|
|
1719
1786
|
}, {
|
|
@@ -1765,7 +1832,7 @@ var InvitationsHandler = class {
|
|
|
1765
1832
|
stream.error(new Error("Remote peer disconnected."));
|
|
1766
1833
|
}
|
|
1767
1834
|
});
|
|
1768
|
-
(0,
|
|
1835
|
+
(0, import_async5.scheduleTask)(ctx, async () => {
|
|
1769
1836
|
const traceId = import_keys5.PublicKey.random().toHex();
|
|
1770
1837
|
try {
|
|
1771
1838
|
import_log6.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.begin({
|
|
@@ -1779,7 +1846,7 @@ var InvitationsHandler = class {
|
|
|
1779
1846
|
if (++connectionCount > 1) {
|
|
1780
1847
|
throw new Error(`multiple connections detected: ${connectionCount}`);
|
|
1781
1848
|
}
|
|
1782
|
-
(0,
|
|
1849
|
+
(0, import_async5.scheduleTask)(ctx, () => ctx.raise(new import_async5.TimeoutError(timeout)), timeout);
|
|
1783
1850
|
(0, import_log6.log)("connected", {
|
|
1784
1851
|
...protocol.toJSON()
|
|
1785
1852
|
}, {
|
|
@@ -1896,7 +1963,7 @@ var InvitationsHandler = class {
|
|
|
1896
1963
|
C: (f, a) => f(...a)
|
|
1897
1964
|
});
|
|
1898
1965
|
} catch (err) {
|
|
1899
|
-
if (err instanceof
|
|
1966
|
+
if (err instanceof import_async5.TimeoutError) {
|
|
1900
1967
|
(0, import_log6.log)("timeout", {
|
|
1901
1968
|
...protocol.toJSON()
|
|
1902
1969
|
}, {
|
|
@@ -1935,7 +2002,7 @@ var InvitationsHandler = class {
|
|
|
1935
2002
|
if (err instanceof import_protocols5.InvalidInvitationExtensionRoleError) {
|
|
1936
2003
|
return;
|
|
1937
2004
|
}
|
|
1938
|
-
if (err instanceof
|
|
2005
|
+
if (err instanceof import_async5.TimeoutError) {
|
|
1939
2006
|
(0, import_log6.log)("timeout", {
|
|
1940
2007
|
...protocol.toJSON()
|
|
1941
2008
|
}, {
|
|
@@ -1960,7 +2027,7 @@ var InvitationsHandler = class {
|
|
|
1960
2027
|
});
|
|
1961
2028
|
return extension;
|
|
1962
2029
|
};
|
|
1963
|
-
(0,
|
|
2030
|
+
(0, import_async5.scheduleTask)(ctx, async () => {
|
|
1964
2031
|
(0, import_invariant7.invariant)(invitation.swarmKey, void 0, {
|
|
1965
2032
|
F: __dxlog_file8,
|
|
1966
2033
|
L: 361,
|
|
@@ -2003,7 +2070,7 @@ var InvitationsHandler = class {
|
|
|
2003
2070
|
};
|
|
2004
2071
|
|
|
2005
2072
|
// packages/sdk/client-services/src/packlets/invitations/invitations-service.ts
|
|
2006
|
-
var
|
|
2073
|
+
var import_async6 = require("@dxos/async");
|
|
2007
2074
|
var import_codec_protobuf4 = require("@dxos/codec-protobuf");
|
|
2008
2075
|
var import_invariant8 = require("@dxos/invariant");
|
|
2009
2076
|
var import_log7 = require("@dxos/log");
|
|
@@ -2015,10 +2082,10 @@ var InvitationsServiceImpl = class {
|
|
|
2015
2082
|
this._getHandler = _getHandler;
|
|
2016
2083
|
this._createInvitations = /* @__PURE__ */ new Map();
|
|
2017
2084
|
this._acceptInvitations = /* @__PURE__ */ new Map();
|
|
2018
|
-
this._invitationCreated = new
|
|
2019
|
-
this._invitationAccepted = new
|
|
2020
|
-
this._removedCreated = new
|
|
2021
|
-
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();
|
|
2022
2089
|
}
|
|
2023
2090
|
// TODO(burdon): Guest/host label.
|
|
2024
2091
|
getLoggingContext() {
|
|
@@ -2339,7 +2406,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2339
2406
|
};
|
|
2340
2407
|
|
|
2341
2408
|
// packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
|
|
2342
|
-
var
|
|
2409
|
+
var import_async9 = require("@dxos/async");
|
|
2343
2410
|
var import_context7 = require("@dxos/context");
|
|
2344
2411
|
var import_credentials14 = require("@dxos/credentials");
|
|
2345
2412
|
var import_invariant11 = require("@dxos/invariant");
|
|
@@ -2351,7 +2418,7 @@ var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip"
|
|
|
2351
2418
|
var import_util5 = require("@dxos/util");
|
|
2352
2419
|
|
|
2353
2420
|
// packages/sdk/client-services/src/packlets/spaces/data-space.ts
|
|
2354
|
-
var
|
|
2421
|
+
var import_async8 = require("@dxos/async");
|
|
2355
2422
|
var import_client_protocol3 = require("@dxos/client-protocol");
|
|
2356
2423
|
var import_context6 = require("@dxos/context");
|
|
2357
2424
|
var import_debug4 = require("@dxos/debug");
|
|
@@ -2362,11 +2429,11 @@ var import_protocols7 = require("@dxos/protocols");
|
|
|
2362
2429
|
var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
|
|
2363
2430
|
var import_credentials11 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
2364
2431
|
var import_timeframe2 = require("@dxos/timeframe");
|
|
2365
|
-
var
|
|
2432
|
+
var import_tracing4 = require("@dxos/tracing");
|
|
2366
2433
|
var import_util4 = require("@dxos/util");
|
|
2367
2434
|
|
|
2368
2435
|
// packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
|
|
2369
|
-
var
|
|
2436
|
+
var import_async7 = require("@dxos/async");
|
|
2370
2437
|
var import_context5 = require("@dxos/context");
|
|
2371
2438
|
var import_invariant10 = require("@dxos/invariant");
|
|
2372
2439
|
var import_keys6 = require("@dxos/keys");
|
|
@@ -2382,7 +2449,7 @@ var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
|
|
|
2382
2449
|
var NotarizationPlugin = class {
|
|
2383
2450
|
constructor() {
|
|
2384
2451
|
this._ctx = new import_context5.Context();
|
|
2385
|
-
this._extensionOpened = new
|
|
2452
|
+
this._extensionOpened = new import_async7.Event();
|
|
2386
2453
|
this._extensions = /* @__PURE__ */ new Set();
|
|
2387
2454
|
this._processedCredentials = new import_util3.ComplexSet(import_keys6.PublicKey.hash);
|
|
2388
2455
|
this._processCredentialsTriggers = new import_util3.ComplexMap(import_keys6.PublicKey.hash);
|
|
@@ -2416,7 +2483,7 @@ var NotarizationPlugin = class {
|
|
|
2416
2483
|
"'Credentials must have an id'"
|
|
2417
2484
|
]
|
|
2418
2485
|
});
|
|
2419
|
-
const errors = new
|
|
2486
|
+
const errors = new import_async7.Trigger();
|
|
2420
2487
|
const ctx = this._ctx.derive({
|
|
2421
2488
|
onError: (err) => {
|
|
2422
2489
|
import_log9.log.warn("Notarization error", {
|
|
@@ -2433,7 +2500,7 @@ var NotarizationPlugin = class {
|
|
|
2433
2500
|
});
|
|
2434
2501
|
opCtx?.onDispose(() => ctx.dispose());
|
|
2435
2502
|
if (timeout !== 0) {
|
|
2436
|
-
(0,
|
|
2503
|
+
(0, import_async7.scheduleTask)(ctx, () => {
|
|
2437
2504
|
import_log9.log.warn("Notarization timeout", {
|
|
2438
2505
|
timeout,
|
|
2439
2506
|
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
@@ -2444,12 +2511,12 @@ var NotarizationPlugin = class {
|
|
|
2444
2511
|
C: (f, a) => f(...a)
|
|
2445
2512
|
});
|
|
2446
2513
|
void ctx.dispose();
|
|
2447
|
-
errors.throw(new
|
|
2514
|
+
errors.throw(new import_async7.TimeoutError(timeout, "Notarization timed out"));
|
|
2448
2515
|
}, timeout);
|
|
2449
2516
|
}
|
|
2450
2517
|
const allNotarized = Promise.all(credentials.map((credential) => this._waitUntilProcessed(credential.id)));
|
|
2451
2518
|
const peersTried = /* @__PURE__ */ new Set();
|
|
2452
|
-
const notarizeTask = new
|
|
2519
|
+
const notarizeTask = new import_async7.DeferredTask(ctx, async () => {
|
|
2453
2520
|
try {
|
|
2454
2521
|
if (this._extensions.size === 0) {
|
|
2455
2522
|
return;
|
|
@@ -2467,7 +2534,7 @@ var NotarizationPlugin = class {
|
|
|
2467
2534
|
C: (f, a) => f(...a)
|
|
2468
2535
|
});
|
|
2469
2536
|
peersTried.clear();
|
|
2470
|
-
(0,
|
|
2537
|
+
(0, import_async7.scheduleTask)(ctx, () => notarizeTask.schedule(), retryTimeout);
|
|
2471
2538
|
return;
|
|
2472
2539
|
}
|
|
2473
2540
|
peersTried.add(peer);
|
|
@@ -2489,7 +2556,7 @@ var NotarizationPlugin = class {
|
|
|
2489
2556
|
S: this,
|
|
2490
2557
|
C: (f, a) => f(...a)
|
|
2491
2558
|
});
|
|
2492
|
-
await (0,
|
|
2559
|
+
await (0, import_async7.sleep)(successDelay);
|
|
2493
2560
|
} catch (err) {
|
|
2494
2561
|
if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
|
|
2495
2562
|
import_log9.log.warn("error notarizing (recoverable)", err, {
|
|
@@ -2547,7 +2614,7 @@ var NotarizationPlugin = class {
|
|
|
2547
2614
|
if (this._processedCredentials.has(id)) {
|
|
2548
2615
|
return;
|
|
2549
2616
|
}
|
|
2550
|
-
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();
|
|
2551
2618
|
}
|
|
2552
2619
|
/**
|
|
2553
2620
|
* Requests from other peers to notarize credentials.
|
|
@@ -2634,7 +2701,7 @@ var NotarizationTeleportExtension = class extends import_teleport2.RpcExtension
|
|
|
2634
2701
|
};
|
|
2635
2702
|
|
|
2636
2703
|
// packages/sdk/client-services/src/packlets/spaces/data-space.ts
|
|
2637
|
-
function
|
|
2704
|
+
function _ts_decorate4(decorators, target, key, desc) {
|
|
2638
2705
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2639
2706
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
2640
2707
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2655,7 +2722,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2655
2722
|
* Error for _state === SpaceState.ERROR.
|
|
2656
2723
|
*/
|
|
2657
2724
|
this.error = void 0;
|
|
2658
|
-
this.stateUpdate = new
|
|
2725
|
+
this.stateUpdate = new import_async8.Event();
|
|
2659
2726
|
this.metrics = {};
|
|
2660
2727
|
this._inner = params.inner;
|
|
2661
2728
|
this._inner.stateUpdate.on(this._ctx, () => this.stateUpdate.emit());
|
|
@@ -2761,7 +2828,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2761
2828
|
* Initialize the data pipeline in a separate task.
|
|
2762
2829
|
*/
|
|
2763
2830
|
initializeDataPipelineAsync() {
|
|
2764
|
-
(0,
|
|
2831
|
+
(0, import_async8.scheduleTask)(this._ctx, async () => {
|
|
2765
2832
|
try {
|
|
2766
2833
|
this.metrics.pipelineInitBegin = /* @__PURE__ */ new Date();
|
|
2767
2834
|
await this.initializeDataPipeline();
|
|
@@ -2811,7 +2878,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2811
2878
|
C: (f, a) => f(...a)
|
|
2812
2879
|
});
|
|
2813
2880
|
await this._initializeAndReadControlPipeline();
|
|
2814
|
-
await (0,
|
|
2881
|
+
await (0, import_async8.sleep)(1);
|
|
2815
2882
|
await this._inner.initializeDataPipeline();
|
|
2816
2883
|
this.metrics.dataPipelineOpen = /* @__PURE__ */ new Date();
|
|
2817
2884
|
await (0, import_context6.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
|
|
@@ -2966,33 +3033,33 @@ var DataSpace = class DataSpace2 {
|
|
|
2966
3033
|
this.stateUpdate.emit();
|
|
2967
3034
|
}
|
|
2968
3035
|
};
|
|
2969
|
-
|
|
2970
|
-
|
|
3036
|
+
_ts_decorate4([
|
|
3037
|
+
import_async8.synchronized
|
|
2971
3038
|
], DataSpace.prototype, "open", null);
|
|
2972
|
-
|
|
2973
|
-
|
|
3039
|
+
_ts_decorate4([
|
|
3040
|
+
import_async8.synchronized
|
|
2974
3041
|
], DataSpace.prototype, "close", null);
|
|
2975
|
-
|
|
2976
|
-
|
|
3042
|
+
_ts_decorate4([
|
|
3043
|
+
import_tracing4.trace.span({
|
|
2977
3044
|
showInBrowserTimeline: true
|
|
2978
3045
|
})
|
|
2979
3046
|
], DataSpace.prototype, "initializeDataPipeline", null);
|
|
2980
|
-
|
|
2981
|
-
|
|
3047
|
+
_ts_decorate4([
|
|
3048
|
+
import_tracing4.trace.span({
|
|
2982
3049
|
showInBrowserTimeline: true
|
|
2983
3050
|
})
|
|
2984
3051
|
], DataSpace.prototype, "_initializeAndReadControlPipeline", null);
|
|
2985
|
-
|
|
3052
|
+
_ts_decorate4([
|
|
2986
3053
|
(0, import_debug4.timed)(1e4)
|
|
2987
3054
|
], DataSpace.prototype, "_createWritableFeeds", null);
|
|
2988
|
-
|
|
2989
|
-
|
|
3055
|
+
_ts_decorate4([
|
|
3056
|
+
import_async8.synchronized
|
|
2990
3057
|
], DataSpace.prototype, "activate", null);
|
|
2991
|
-
|
|
2992
|
-
|
|
3058
|
+
_ts_decorate4([
|
|
3059
|
+
import_async8.synchronized
|
|
2993
3060
|
], DataSpace.prototype, "deactivate", null);
|
|
2994
|
-
DataSpace =
|
|
2995
|
-
(0,
|
|
3061
|
+
DataSpace = _ts_decorate4([
|
|
3062
|
+
(0, import_async8.trackLeaks)("open", "close")
|
|
2996
3063
|
], DataSpace);
|
|
2997
3064
|
|
|
2998
3065
|
// packages/sdk/client-services/src/packlets/spaces/genesis.ts
|
|
@@ -3065,7 +3132,7 @@ var spaceGenesis = async (keyring, signingContext, space) => {
|
|
|
3065
3132
|
};
|
|
3066
3133
|
|
|
3067
3134
|
// packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
|
|
3068
|
-
function
|
|
3135
|
+
function _ts_decorate5(decorators, target, key, desc) {
|
|
3069
3136
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3070
3137
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3071
3138
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3085,7 +3152,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3085
3152
|
this._signingContext = _signingContext;
|
|
3086
3153
|
this._feedStore = _feedStore;
|
|
3087
3154
|
this._ctx = new import_context7.Context();
|
|
3088
|
-
this.updated = new
|
|
3155
|
+
this.updated = new import_async9.Event();
|
|
3089
3156
|
this._spaces = new import_util5.ComplexMap(import_keys8.PublicKey.hash);
|
|
3090
3157
|
this._isOpen = false;
|
|
3091
3158
|
this._instanceId = import_keys8.PublicKey.random().toHex();
|
|
@@ -3381,24 +3448,24 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3381
3448
|
return dataSpace;
|
|
3382
3449
|
}
|
|
3383
3450
|
};
|
|
3384
|
-
|
|
3385
|
-
|
|
3451
|
+
_ts_decorate5([
|
|
3452
|
+
import_async9.synchronized
|
|
3386
3453
|
], DataSpaceManager.prototype, "open", null);
|
|
3387
|
-
|
|
3388
|
-
|
|
3454
|
+
_ts_decorate5([
|
|
3455
|
+
import_async9.synchronized
|
|
3389
3456
|
], DataSpaceManager.prototype, "close", null);
|
|
3390
|
-
|
|
3391
|
-
|
|
3457
|
+
_ts_decorate5([
|
|
3458
|
+
import_async9.synchronized
|
|
3392
3459
|
], DataSpaceManager.prototype, "createSpace", null);
|
|
3393
|
-
|
|
3394
|
-
|
|
3460
|
+
_ts_decorate5([
|
|
3461
|
+
import_async9.synchronized
|
|
3395
3462
|
], DataSpaceManager.prototype, "acceptSpace", null);
|
|
3396
|
-
DataSpaceManager =
|
|
3397
|
-
(0,
|
|
3463
|
+
DataSpaceManager = _ts_decorate5([
|
|
3464
|
+
(0, import_async9.trackLeaks)("open", "close")
|
|
3398
3465
|
], DataSpaceManager);
|
|
3399
3466
|
|
|
3400
3467
|
// packages/sdk/client-services/src/packlets/spaces/spaces-service.ts
|
|
3401
|
-
var
|
|
3468
|
+
var import_async10 = require("@dxos/async");
|
|
3402
3469
|
var import_codec_protobuf5 = require("@dxos/codec-protobuf");
|
|
3403
3470
|
var import_debug6 = require("@dxos/debug");
|
|
3404
3471
|
var import_invariant12 = require("@dxos/invariant");
|
|
@@ -3439,7 +3506,7 @@ var SpacesServiceImpl = class {
|
|
|
3439
3506
|
}
|
|
3440
3507
|
querySpaces() {
|
|
3441
3508
|
return new import_codec_protobuf5.Stream(({ next, ctx }) => {
|
|
3442
|
-
const scheduler = new
|
|
3509
|
+
const scheduler = new import_async10.UpdateScheduler(ctx, async () => {
|
|
3443
3510
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3444
3511
|
const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
|
|
3445
3512
|
(0, import_log12.log)("update", {
|
|
@@ -3456,9 +3523,9 @@ var SpacesServiceImpl = class {
|
|
|
3456
3523
|
}, {
|
|
3457
3524
|
maxFrequency: process.env.NODE_ENV === "test" ? void 0 : 2
|
|
3458
3525
|
});
|
|
3459
|
-
(0,
|
|
3526
|
+
(0, import_async10.scheduleTask)(ctx, async () => {
|
|
3460
3527
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3461
|
-
const subscriptions = new
|
|
3528
|
+
const subscriptions = new import_async10.EventSubscriptions();
|
|
3462
3529
|
ctx.onDispose(() => subscriptions.clear());
|
|
3463
3530
|
const subscribeSpaces = () => {
|
|
3464
3531
|
subscriptions.clear();
|
|
@@ -3493,7 +3560,7 @@ var SpacesServiceImpl = class {
|
|
|
3493
3560
|
}
|
|
3494
3561
|
subscribeMessages({ spaceKey, channel }) {
|
|
3495
3562
|
return new import_codec_protobuf5.Stream(({ ctx, next }) => {
|
|
3496
|
-
(0,
|
|
3563
|
+
(0, import_async10.scheduleTask)(ctx, async () => {
|
|
3497
3564
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3498
3565
|
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
|
|
3499
3566
|
const handle = space.listen(getChannelId(channel), (message) => {
|
|
@@ -3512,7 +3579,7 @@ var SpacesServiceImpl = class {
|
|
|
3512
3579
|
}
|
|
3513
3580
|
};
|
|
3514
3581
|
ctx.onDispose(() => space.spaceState.removeCredentialProcessor(processor));
|
|
3515
|
-
(0,
|
|
3582
|
+
(0, import_async10.scheduleTask)(ctx, async () => {
|
|
3516
3583
|
await space.spaceState.addCredentialProcessor(processor);
|
|
3517
3584
|
if (noTail) {
|
|
3518
3585
|
close();
|
|
@@ -3619,7 +3686,7 @@ var SpacesServiceImpl = class {
|
|
|
3619
3686
|
var getChannelId = (channel) => `user-channel/${channel}`;
|
|
3620
3687
|
|
|
3621
3688
|
// packages/sdk/client-services/src/packlets/services/service-context.ts
|
|
3622
|
-
function
|
|
3689
|
+
function _ts_decorate6(decorators, target, key, desc) {
|
|
3623
3690
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3624
3691
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3625
3692
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3636,7 +3703,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
3636
3703
|
this.networkManager = networkManager;
|
|
3637
3704
|
this.signalManager = signalManager;
|
|
3638
3705
|
this.modelFactory = modelFactory;
|
|
3639
|
-
this.initialized = new
|
|
3706
|
+
this.initialized = new import_async11.Trigger();
|
|
3640
3707
|
this.dataServiceSubscriptions = new import_echo_pipeline2.DataServiceSubscriptions();
|
|
3641
3708
|
this._handlerFactories = /* @__PURE__ */ new Map();
|
|
3642
3709
|
this._instanceId = import_keys9.PublicKey.random().toHex();
|
|
@@ -3853,19 +3920,19 @@ var ServiceContext = class ServiceContext2 {
|
|
|
3853
3920
|
await identity.space.spaceState.addCredentialProcessor(this._deviceSpaceSync);
|
|
3854
3921
|
}
|
|
3855
3922
|
};
|
|
3856
|
-
|
|
3857
|
-
|
|
3923
|
+
_ts_decorate6([
|
|
3924
|
+
import_tracing5.trace.span()
|
|
3858
3925
|
], ServiceContext.prototype, "open", null);
|
|
3859
|
-
|
|
3860
|
-
|
|
3926
|
+
_ts_decorate6([
|
|
3927
|
+
import_tracing5.trace.span()
|
|
3861
3928
|
], ServiceContext.prototype, "_initialize", null);
|
|
3862
|
-
ServiceContext =
|
|
3929
|
+
ServiceContext = _ts_decorate6([
|
|
3863
3930
|
(0, import_util6.safeInstanceof)("dxos.client-services.ServiceContext"),
|
|
3864
|
-
|
|
3931
|
+
import_tracing5.trace.resource()
|
|
3865
3932
|
], ServiceContext);
|
|
3866
3933
|
|
|
3867
3934
|
// packages/sdk/client-services/src/packlets/services/service-host.ts
|
|
3868
|
-
var
|
|
3935
|
+
var import_async17 = require("@dxos/async");
|
|
3869
3936
|
var import_client_protocol5 = require("@dxos/client-protocol");
|
|
3870
3937
|
var import_context10 = require("@dxos/context");
|
|
3871
3938
|
var import_document_model2 = require("@dxos/document-model");
|
|
@@ -3880,7 +3947,7 @@ var import_network_manager2 = require("@dxos/network-manager");
|
|
|
3880
3947
|
var import_protocols12 = require("@dxos/protocols");
|
|
3881
3948
|
var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
|
|
3882
3949
|
var import_text_model = require("@dxos/text-model");
|
|
3883
|
-
var
|
|
3950
|
+
var import_tracing6 = require("@dxos/tracing");
|
|
3884
3951
|
var import_websocket_rpc = require("@dxos/websocket-rpc");
|
|
3885
3952
|
|
|
3886
3953
|
// packages/sdk/client-services/src/packlets/services/service-registry.ts
|
|
@@ -3908,7 +3975,7 @@ var ServiceRegistry = class {
|
|
|
3908
3975
|
};
|
|
3909
3976
|
|
|
3910
3977
|
// packages/sdk/client-services/src/packlets/devices/devices-service.ts
|
|
3911
|
-
var
|
|
3978
|
+
var import_async12 = require("@dxos/async");
|
|
3912
3979
|
var import_codec_protobuf6 = require("@dxos/codec-protobuf");
|
|
3913
3980
|
var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
|
|
3914
3981
|
var DevicesServiceImpl = class {
|
|
@@ -3936,7 +4003,7 @@ var DevicesServiceImpl = class {
|
|
|
3936
4003
|
});
|
|
3937
4004
|
}
|
|
3938
4005
|
};
|
|
3939
|
-
const subscriptions = new
|
|
4006
|
+
const subscriptions = new import_async12.EventSubscriptions();
|
|
3940
4007
|
subscriptions.add(this._identityManager.stateUpdate.on(() => {
|
|
3941
4008
|
update();
|
|
3942
4009
|
if (this._identityManager.identity) {
|
|
@@ -3952,18 +4019,18 @@ var DevicesServiceImpl = class {
|
|
|
3952
4019
|
};
|
|
3953
4020
|
|
|
3954
4021
|
// packages/sdk/client-services/src/packlets/devtools/devtools.ts
|
|
3955
|
-
var
|
|
4022
|
+
var import_async15 = require("@dxos/async");
|
|
3956
4023
|
var import_codec_protobuf12 = require("@dxos/codec-protobuf");
|
|
3957
4024
|
|
|
3958
4025
|
// packages/sdk/client-services/src/packlets/devtools/feeds.ts
|
|
3959
|
-
var
|
|
4026
|
+
var import_async13 = require("@dxos/async");
|
|
3960
4027
|
var import_codec_protobuf7 = require("@dxos/codec-protobuf");
|
|
3961
4028
|
var import_feed_store4 = require("@dxos/feed-store");
|
|
3962
4029
|
var import_keys10 = require("@dxos/keys");
|
|
3963
4030
|
var import_util7 = require("@dxos/util");
|
|
3964
4031
|
var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
|
|
3965
4032
|
return new import_codec_protobuf7.Stream(({ next }) => {
|
|
3966
|
-
const subscriptions = new
|
|
4033
|
+
const subscriptions = new import_async13.EventSubscriptions();
|
|
3967
4034
|
const feedMap = new import_util7.ComplexMap(import_keys10.PublicKey.hash);
|
|
3968
4035
|
const update = () => {
|
|
3969
4036
|
const { feeds } = feedStore;
|
|
@@ -3995,7 +4062,7 @@ var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
|
|
|
3995
4062
|
if (!feedKey) {
|
|
3996
4063
|
return;
|
|
3997
4064
|
}
|
|
3998
|
-
const subscriptions = new
|
|
4065
|
+
const subscriptions = new import_async13.EventSubscriptions();
|
|
3999
4066
|
const timeout = setTimeout(async () => {
|
|
4000
4067
|
const feed = feedStore.getFeed(feedKey);
|
|
4001
4068
|
if (!feed) {
|
|
@@ -4030,7 +4097,7 @@ var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
|
|
|
4030
4097
|
};
|
|
4031
4098
|
|
|
4032
4099
|
// packages/sdk/client-services/src/packlets/devtools/keys.ts
|
|
4033
|
-
var
|
|
4100
|
+
var import_async14 = require("@dxos/async");
|
|
4034
4101
|
var import_codec_protobuf8 = require("@dxos/codec-protobuf");
|
|
4035
4102
|
var subscribeToKeyringKeys = ({ keyring }) => new import_codec_protobuf8.Stream(({ next, ctx }) => {
|
|
4036
4103
|
const update = async () => {
|
|
@@ -4039,7 +4106,7 @@ var subscribeToKeyringKeys = ({ keyring }) => new import_codec_protobuf8.Stream(
|
|
|
4039
4106
|
});
|
|
4040
4107
|
};
|
|
4041
4108
|
keyring.keysUpdate.on(ctx, update);
|
|
4042
|
-
(0,
|
|
4109
|
+
(0, import_async14.scheduleTask)(ctx, update);
|
|
4043
4110
|
});
|
|
4044
4111
|
|
|
4045
4112
|
// packages/sdk/client-services/src/packlets/devtools/metadata.ts
|
|
@@ -4146,7 +4213,7 @@ var subscribeToSpaces = (context, { spaceKeys = [] }) => {
|
|
|
4146
4213
|
// packages/sdk/client-services/src/packlets/devtools/devtools.ts
|
|
4147
4214
|
var DevtoolsHostEvents = class {
|
|
4148
4215
|
constructor() {
|
|
4149
|
-
this.ready = new
|
|
4216
|
+
this.ready = new import_async15.Event();
|
|
4150
4217
|
}
|
|
4151
4218
|
};
|
|
4152
4219
|
var DevtoolsServiceImpl = class {
|
|
@@ -4263,7 +4330,7 @@ var DevtoolsServiceImpl = class {
|
|
|
4263
4330
|
var import_invariant14 = require("@dxos/invariant");
|
|
4264
4331
|
var import_lock_file = require("@dxos/lock-file");
|
|
4265
4332
|
var import_log14 = require("@dxos/log");
|
|
4266
|
-
function
|
|
4333
|
+
function _ts_decorate7(decorators, target, key, desc) {
|
|
4267
4334
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4268
4335
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4269
4336
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4313,19 +4380,19 @@ var Lock = class {
|
|
|
4313
4380
|
await import_lock_file.LockFile.release(this._fileHandle);
|
|
4314
4381
|
}
|
|
4315
4382
|
};
|
|
4316
|
-
|
|
4383
|
+
_ts_decorate7([
|
|
4317
4384
|
import_log14.logInfo
|
|
4318
4385
|
], Lock.prototype, "lockKey", null);
|
|
4319
4386
|
|
|
4320
4387
|
// packages/sdk/client-services/src/packlets/logging/logging-service.ts
|
|
4321
|
-
var
|
|
4388
|
+
var import_async16 = require("@dxos/async");
|
|
4322
4389
|
var import_codec_protobuf13 = require("@dxos/codec-protobuf");
|
|
4323
4390
|
var import_log15 = require("@dxos/log");
|
|
4324
4391
|
var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
|
|
4325
4392
|
var import_util8 = require("@dxos/util");
|
|
4326
4393
|
var LoggingServiceImpl = class {
|
|
4327
4394
|
constructor() {
|
|
4328
|
-
this._logs = new
|
|
4395
|
+
this._logs = new import_async16.Event();
|
|
4329
4396
|
this._started = /* @__PURE__ */ new Date();
|
|
4330
4397
|
this._logProcessor = (_config, entry2) => {
|
|
4331
4398
|
this._logs.emit(entry2);
|
|
@@ -4570,7 +4637,7 @@ var SystemServiceImpl = class {
|
|
|
4570
4637
|
};
|
|
4571
4638
|
|
|
4572
4639
|
// packages/sdk/client-services/src/packlets/services/service-host.ts
|
|
4573
|
-
function
|
|
4640
|
+
function _ts_decorate8(decorators, target, key, desc) {
|
|
4574
4641
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4575
4642
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4576
4643
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4607,8 +4674,8 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4607
4674
|
lockKey,
|
|
4608
4675
|
callbacks
|
|
4609
4676
|
} = {}) {
|
|
4610
|
-
this._tracingService =
|
|
4611
|
-
this._statusUpdate = new
|
|
4677
|
+
this._tracingService = import_tracing6.TRACE_PROCESSOR.createTraceSender();
|
|
4678
|
+
this._statusUpdate = new import_async17.Event();
|
|
4612
4679
|
this._opening = false;
|
|
4613
4680
|
this._open = false;
|
|
4614
4681
|
this._storage = storage;
|
|
@@ -4932,22 +4999,22 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4932
4999
|
return identity;
|
|
4933
5000
|
}
|
|
4934
5001
|
};
|
|
4935
|
-
|
|
4936
|
-
|
|
5002
|
+
_ts_decorate8([
|
|
5003
|
+
import_tracing6.trace.info()
|
|
4937
5004
|
], ClientServicesHost.prototype, "_opening", void 0);
|
|
4938
|
-
|
|
4939
|
-
|
|
5005
|
+
_ts_decorate8([
|
|
5006
|
+
import_tracing6.trace.info()
|
|
4940
5007
|
], ClientServicesHost.prototype, "_open", void 0);
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
5008
|
+
_ts_decorate8([
|
|
5009
|
+
import_async17.synchronized,
|
|
5010
|
+
import_tracing6.trace.span()
|
|
4944
5011
|
], ClientServicesHost.prototype, "open", null);
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
5012
|
+
_ts_decorate8([
|
|
5013
|
+
import_async17.synchronized,
|
|
5014
|
+
import_tracing6.trace.span()
|
|
4948
5015
|
], ClientServicesHost.prototype, "close", null);
|
|
4949
|
-
ClientServicesHost =
|
|
4950
|
-
|
|
5016
|
+
ClientServicesHost = _ts_decorate8([
|
|
5017
|
+
import_tracing6.trace.resource()
|
|
4951
5018
|
], ClientServicesHost);
|
|
4952
5019
|
|
|
4953
5020
|
// packages/sdk/client-services/src/packlets/testing/invitation-utils.ts
|
|
@@ -4964,9 +5031,9 @@ var sanitizeInvitation = (invitation) => {
|
|
|
4964
5031
|
};
|
|
4965
5032
|
};
|
|
4966
5033
|
var performInvitation = ({ host, guest, options, hooks }) => {
|
|
4967
|
-
const hostComplete = new
|
|
4968
|
-
const guestComplete = new
|
|
4969
|
-
const authCode = new
|
|
5034
|
+
const hostComplete = new import_async18.Trigger();
|
|
5035
|
+
const guestComplete = new import_async18.Trigger();
|
|
5036
|
+
const authCode = new import_async18.Trigger();
|
|
4970
5037
|
const hostObservable = createInvitation(host, options);
|
|
4971
5038
|
hostObservable.subscribe(async (hostInvitation) => {
|
|
4972
5039
|
switch (hostInvitation.state) {
|