@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
package/dist/lib/node/index.cjs
CHANGED
|
@@ -2489,9 +2489,21 @@ var SpaceInvitationProtocol = class {
|
|
|
2489
2489
|
var import_codec_protobuf9 = require("@dxos/codec-protobuf");
|
|
2490
2490
|
var import_debug3 = require("@dxos/debug");
|
|
2491
2491
|
var import_rpc = require("@dxos/rpc");
|
|
2492
|
-
var
|
|
2492
|
+
var import_tracing3 = require("@dxos/tracing");
|
|
2493
|
+
function _ts_decorate3(decorators, target, key, desc) {
|
|
2494
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2495
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
2496
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
2497
|
+
else
|
|
2498
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
2499
|
+
if (d = decorators[i])
|
|
2500
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2501
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2502
|
+
}
|
|
2503
|
+
var ClientRpcServer = class ClientRpcServer2 {
|
|
2493
2504
|
constructor(params) {
|
|
2494
2505
|
this._handlerCache = /* @__PURE__ */ new Map();
|
|
2506
|
+
this._callMetrics = new import_tracing3.MapCounter();
|
|
2495
2507
|
const { serviceRegistry, handleCall, handleStream, ...rpcOptions } = params;
|
|
2496
2508
|
this._handleCall = handleCall;
|
|
2497
2509
|
this._handleStream = handleStream;
|
|
@@ -2501,6 +2513,7 @@ var ClientRpcServer = class {
|
|
|
2501
2513
|
callHandler: (method, params2) => {
|
|
2502
2514
|
const [serviceName, methodName] = (0, import_rpc.parseMethodName)(method);
|
|
2503
2515
|
const handler = (method2, params3) => this._getServiceHandler(serviceName).call(method2, params3);
|
|
2516
|
+
this._callMetrics.inc(`${serviceName}.${methodName} request`);
|
|
2504
2517
|
if (this._handleCall) {
|
|
2505
2518
|
return this._handleCall(methodName, params2, handler);
|
|
2506
2519
|
} else {
|
|
@@ -2510,14 +2523,21 @@ var ClientRpcServer = class {
|
|
|
2510
2523
|
streamHandler: (method, params2) => {
|
|
2511
2524
|
const [serviceName, methodName] = (0, import_rpc.parseMethodName)(method);
|
|
2512
2525
|
const handler = (method2, params3) => this._getServiceHandler(serviceName).callStream(method2, params3);
|
|
2526
|
+
this._callMetrics.inc(`${serviceName}.${methodName} request stream`);
|
|
2513
2527
|
if (this._handleStream) {
|
|
2514
|
-
return import_codec_protobuf9.Stream.unwrapPromise(this._handleStream(methodName, params2, handler))
|
|
2528
|
+
return import_codec_protobuf9.Stream.map(import_codec_protobuf9.Stream.unwrapPromise(this._handleStream(methodName, params2, handler)), (data) => {
|
|
2529
|
+
this._callMetrics.inc(`${serviceName}.${methodName} response stream`);
|
|
2530
|
+
return data;
|
|
2531
|
+
});
|
|
2515
2532
|
} else {
|
|
2516
2533
|
return handler(methodName, params2);
|
|
2517
2534
|
}
|
|
2518
2535
|
}
|
|
2519
2536
|
});
|
|
2520
2537
|
}
|
|
2538
|
+
get _services() {
|
|
2539
|
+
return Object.keys(this._serviceRegistry.services);
|
|
2540
|
+
}
|
|
2521
2541
|
async open() {
|
|
2522
2542
|
await this._rpcPeer.open();
|
|
2523
2543
|
}
|
|
@@ -2536,9 +2556,17 @@ var ClientRpcServer = class {
|
|
|
2536
2556
|
return this._handlerCache.get(serviceName);
|
|
2537
2557
|
}
|
|
2538
2558
|
};
|
|
2559
|
+
_ts_decorate3([
|
|
2560
|
+
import_tracing3.trace.metricsCounter()
|
|
2561
|
+
], ClientRpcServer.prototype, "_callMetrics", void 0);
|
|
2562
|
+
_ts_decorate3([
|
|
2563
|
+
import_tracing3.trace.info()
|
|
2564
|
+
], ClientRpcServer.prototype, "_services", null);
|
|
2565
|
+
ClientRpcServer = _ts_decorate3([
|
|
2566
|
+
import_tracing3.trace.resource()
|
|
2567
|
+
], ClientRpcServer);
|
|
2539
2568
|
|
|
2540
2569
|
// packages/sdk/client-services/src/packlets/services/diagnostics.ts
|
|
2541
|
-
var import_async10 = require("@dxos/async");
|
|
2542
2570
|
var import_codec_protobuf10 = require("@dxos/codec-protobuf");
|
|
2543
2571
|
var import_credentials9 = require("@dxos/credentials");
|
|
2544
2572
|
var import_document_model = require("@dxos/document-model");
|
|
@@ -2577,7 +2605,7 @@ var getPlatform = () => {
|
|
|
2577
2605
|
};
|
|
2578
2606
|
|
|
2579
2607
|
// packages/sdk/client-services/src/version.ts
|
|
2580
|
-
var DXOS_VERSION = "0.3.3-main.
|
|
2608
|
+
var DXOS_VERSION = "0.3.3-main.ff5734a";
|
|
2581
2609
|
|
|
2582
2610
|
// packages/sdk/client-services/src/packlets/services/diagnostics.ts
|
|
2583
2611
|
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
|
|
@@ -2596,7 +2624,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
2596
2624
|
{
|
|
2597
2625
|
(0, import_invariant9.invariant)(clientServices.LoggingService, "SystemService is not available.", {
|
|
2598
2626
|
F: __dxlog_file10,
|
|
2599
|
-
L:
|
|
2627
|
+
L: 92,
|
|
2600
2628
|
S: void 0,
|
|
2601
2629
|
A: [
|
|
2602
2630
|
"clientServices.LoggingService",
|
|
@@ -2633,15 +2661,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
2633
2661
|
timeout: DEFAULT_TIMEOUT
|
|
2634
2662
|
}).catch(() => void 0);
|
|
2635
2663
|
diagnostics.networkStatus = status;
|
|
2636
|
-
|
|
2637
|
-
serviceContext.networkManager.connectionLog?.update.on(async () => {
|
|
2638
|
-
const swarms = serviceContext.networkManager.connectionLog?.swarms;
|
|
2639
|
-
diagnostics.swarms = swarms;
|
|
2640
|
-
await swarmInfoDone.wake();
|
|
2641
|
-
});
|
|
2642
|
-
await swarmInfoDone.wait({
|
|
2643
|
-
timeout: DEFAULT_TIMEOUT
|
|
2644
|
-
});
|
|
2664
|
+
diagnostics.swarms = serviceContext.networkManager.connectionLog?.swarms;
|
|
2645
2665
|
}
|
|
2646
2666
|
diagnostics.config = config.values;
|
|
2647
2667
|
return diagnostics;
|
|
@@ -2655,7 +2675,7 @@ var getProperties = (space) => {
|
|
|
2655
2675
|
} catch (err) {
|
|
2656
2676
|
import_log8.log.warn(err.message, void 0, {
|
|
2657
2677
|
F: __dxlog_file10,
|
|
2658
|
-
L:
|
|
2678
|
+
L: 160,
|
|
2659
2679
|
S: void 0,
|
|
2660
2680
|
C: (f, a) => f(...a)
|
|
2661
2681
|
});
|
|
@@ -2711,7 +2731,7 @@ var getSpaceStats = async (space) => {
|
|
|
2711
2731
|
};
|
|
2712
2732
|
|
|
2713
2733
|
// packages/sdk/client-services/src/packlets/services/service-context.ts
|
|
2714
|
-
var
|
|
2734
|
+
var import_async14 = require("@dxos/async");
|
|
2715
2735
|
var import_context9 = require("@dxos/context");
|
|
2716
2736
|
var import_credentials14 = require("@dxos/credentials");
|
|
2717
2737
|
var import_debug7 = require("@dxos/debug");
|
|
@@ -2724,11 +2744,11 @@ var import_log13 = require("@dxos/log");
|
|
|
2724
2744
|
var import_protocols10 = require("@dxos/protocols");
|
|
2725
2745
|
var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
|
|
2726
2746
|
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
2727
|
-
var
|
|
2747
|
+
var import_tracing5 = require("@dxos/tracing");
|
|
2728
2748
|
var import_util7 = require("@dxos/util");
|
|
2729
2749
|
|
|
2730
2750
|
// packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
|
|
2731
|
-
var
|
|
2751
|
+
var import_async12 = require("@dxos/async");
|
|
2732
2752
|
var import_context8 = require("@dxos/context");
|
|
2733
2753
|
var import_credentials13 = require("@dxos/credentials");
|
|
2734
2754
|
var import_invariant11 = require("@dxos/invariant");
|
|
@@ -2740,7 +2760,7 @@ var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip"
|
|
|
2740
2760
|
var import_util6 = require("@dxos/util");
|
|
2741
2761
|
|
|
2742
2762
|
// packages/sdk/client-services/src/packlets/spaces/data-space.ts
|
|
2743
|
-
var
|
|
2763
|
+
var import_async11 = require("@dxos/async");
|
|
2744
2764
|
var import_client_protocol3 = require("@dxos/client-protocol");
|
|
2745
2765
|
var import_context7 = require("@dxos/context");
|
|
2746
2766
|
var import_debug4 = require("@dxos/debug");
|
|
@@ -2751,11 +2771,11 @@ var import_protocols7 = require("@dxos/protocols");
|
|
|
2751
2771
|
var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
|
|
2752
2772
|
var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
2753
2773
|
var import_timeframe2 = require("@dxos/timeframe");
|
|
2754
|
-
var
|
|
2774
|
+
var import_tracing4 = require("@dxos/tracing");
|
|
2755
2775
|
var import_util5 = require("@dxos/util");
|
|
2756
2776
|
|
|
2757
2777
|
// packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
|
|
2758
|
-
var
|
|
2778
|
+
var import_async10 = require("@dxos/async");
|
|
2759
2779
|
var import_context6 = require("@dxos/context");
|
|
2760
2780
|
var import_invariant10 = require("@dxos/invariant");
|
|
2761
2781
|
var import_keys8 = require("@dxos/keys");
|
|
@@ -2771,7 +2791,7 @@ var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
|
|
|
2771
2791
|
var NotarizationPlugin = class {
|
|
2772
2792
|
constructor() {
|
|
2773
2793
|
this._ctx = new import_context6.Context();
|
|
2774
|
-
this._extensionOpened = new
|
|
2794
|
+
this._extensionOpened = new import_async10.Event();
|
|
2775
2795
|
this._extensions = /* @__PURE__ */ new Set();
|
|
2776
2796
|
this._processedCredentials = new import_util4.ComplexSet(import_keys8.PublicKey.hash);
|
|
2777
2797
|
this._processCredentialsTriggers = new import_util4.ComplexMap(import_keys8.PublicKey.hash);
|
|
@@ -2805,7 +2825,7 @@ var NotarizationPlugin = class {
|
|
|
2805
2825
|
"'Credentials must have an id'"
|
|
2806
2826
|
]
|
|
2807
2827
|
});
|
|
2808
|
-
const errors = new
|
|
2828
|
+
const errors = new import_async10.Trigger();
|
|
2809
2829
|
const ctx = this._ctx.derive({
|
|
2810
2830
|
onError: (err) => {
|
|
2811
2831
|
import_log9.log.warn("Notarization error", {
|
|
@@ -2822,7 +2842,7 @@ var NotarizationPlugin = class {
|
|
|
2822
2842
|
});
|
|
2823
2843
|
opCtx?.onDispose(() => ctx.dispose());
|
|
2824
2844
|
if (timeout !== 0) {
|
|
2825
|
-
(0,
|
|
2845
|
+
(0, import_async10.scheduleTask)(ctx, () => {
|
|
2826
2846
|
import_log9.log.warn("Notarization timeout", {
|
|
2827
2847
|
timeout,
|
|
2828
2848
|
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
@@ -2833,12 +2853,12 @@ var NotarizationPlugin = class {
|
|
|
2833
2853
|
C: (f, a) => f(...a)
|
|
2834
2854
|
});
|
|
2835
2855
|
void ctx.dispose();
|
|
2836
|
-
errors.throw(new
|
|
2856
|
+
errors.throw(new import_async10.TimeoutError(timeout, "Notarization timed out"));
|
|
2837
2857
|
}, timeout);
|
|
2838
2858
|
}
|
|
2839
2859
|
const allNotarized = Promise.all(credentials.map((credential) => this._waitUntilProcessed(credential.id)));
|
|
2840
2860
|
const peersTried = /* @__PURE__ */ new Set();
|
|
2841
|
-
const notarizeTask = new
|
|
2861
|
+
const notarizeTask = new import_async10.DeferredTask(ctx, async () => {
|
|
2842
2862
|
try {
|
|
2843
2863
|
if (this._extensions.size === 0) {
|
|
2844
2864
|
return;
|
|
@@ -2856,7 +2876,7 @@ var NotarizationPlugin = class {
|
|
|
2856
2876
|
C: (f, a) => f(...a)
|
|
2857
2877
|
});
|
|
2858
2878
|
peersTried.clear();
|
|
2859
|
-
(0,
|
|
2879
|
+
(0, import_async10.scheduleTask)(ctx, () => notarizeTask.schedule(), retryTimeout);
|
|
2860
2880
|
return;
|
|
2861
2881
|
}
|
|
2862
2882
|
peersTried.add(peer);
|
|
@@ -2878,7 +2898,7 @@ var NotarizationPlugin = class {
|
|
|
2878
2898
|
S: this,
|
|
2879
2899
|
C: (f, a) => f(...a)
|
|
2880
2900
|
});
|
|
2881
|
-
await (0,
|
|
2901
|
+
await (0, import_async10.sleep)(successDelay);
|
|
2882
2902
|
} catch (err) {
|
|
2883
2903
|
if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
|
|
2884
2904
|
import_log9.log.warn("error notarizing (recoverable)", err, {
|
|
@@ -2936,7 +2956,7 @@ var NotarizationPlugin = class {
|
|
|
2936
2956
|
if (this._processedCredentials.has(id)) {
|
|
2937
2957
|
return;
|
|
2938
2958
|
}
|
|
2939
|
-
await (0, import_util4.entry)(this._processCredentialsTriggers, id).orInsert(new
|
|
2959
|
+
await (0, import_util4.entry)(this._processCredentialsTriggers, id).orInsert(new import_async10.Trigger()).value.wait();
|
|
2940
2960
|
}
|
|
2941
2961
|
/**
|
|
2942
2962
|
* Requests from other peers to notarize credentials.
|
|
@@ -3023,7 +3043,7 @@ var NotarizationTeleportExtension = class extends import_teleport2.RpcExtension
|
|
|
3023
3043
|
};
|
|
3024
3044
|
|
|
3025
3045
|
// packages/sdk/client-services/src/packlets/spaces/data-space.ts
|
|
3026
|
-
function
|
|
3046
|
+
function _ts_decorate4(decorators, target, key, desc) {
|
|
3027
3047
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3028
3048
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3029
3049
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3044,7 +3064,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3044
3064
|
* Error for _state === SpaceState.ERROR.
|
|
3045
3065
|
*/
|
|
3046
3066
|
this.error = void 0;
|
|
3047
|
-
this.stateUpdate = new
|
|
3067
|
+
this.stateUpdate = new import_async11.Event();
|
|
3048
3068
|
this.metrics = {};
|
|
3049
3069
|
this._inner = params.inner;
|
|
3050
3070
|
this._inner.stateUpdate.on(this._ctx, () => this.stateUpdate.emit());
|
|
@@ -3150,7 +3170,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3150
3170
|
* Initialize the data pipeline in a separate task.
|
|
3151
3171
|
*/
|
|
3152
3172
|
initializeDataPipelineAsync() {
|
|
3153
|
-
(0,
|
|
3173
|
+
(0, import_async11.scheduleTask)(this._ctx, async () => {
|
|
3154
3174
|
try {
|
|
3155
3175
|
this.metrics.pipelineInitBegin = /* @__PURE__ */ new Date();
|
|
3156
3176
|
await this.initializeDataPipeline();
|
|
@@ -3200,7 +3220,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3200
3220
|
C: (f, a) => f(...a)
|
|
3201
3221
|
});
|
|
3202
3222
|
await this._initializeAndReadControlPipeline();
|
|
3203
|
-
await (0,
|
|
3223
|
+
await (0, import_async11.sleep)(1);
|
|
3204
3224
|
await this._inner.initializeDataPipeline();
|
|
3205
3225
|
this.metrics.dataPipelineOpen = /* @__PURE__ */ new Date();
|
|
3206
3226
|
await (0, import_context7.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
|
|
@@ -3355,33 +3375,33 @@ var DataSpace = class DataSpace2 {
|
|
|
3355
3375
|
this.stateUpdate.emit();
|
|
3356
3376
|
}
|
|
3357
3377
|
};
|
|
3358
|
-
|
|
3359
|
-
|
|
3378
|
+
_ts_decorate4([
|
|
3379
|
+
import_async11.synchronized
|
|
3360
3380
|
], DataSpace.prototype, "open", null);
|
|
3361
|
-
|
|
3362
|
-
|
|
3381
|
+
_ts_decorate4([
|
|
3382
|
+
import_async11.synchronized
|
|
3363
3383
|
], DataSpace.prototype, "close", null);
|
|
3364
|
-
|
|
3365
|
-
|
|
3384
|
+
_ts_decorate4([
|
|
3385
|
+
import_tracing4.trace.span({
|
|
3366
3386
|
showInBrowserTimeline: true
|
|
3367
3387
|
})
|
|
3368
3388
|
], DataSpace.prototype, "initializeDataPipeline", null);
|
|
3369
|
-
|
|
3370
|
-
|
|
3389
|
+
_ts_decorate4([
|
|
3390
|
+
import_tracing4.trace.span({
|
|
3371
3391
|
showInBrowserTimeline: true
|
|
3372
3392
|
})
|
|
3373
3393
|
], DataSpace.prototype, "_initializeAndReadControlPipeline", null);
|
|
3374
|
-
|
|
3394
|
+
_ts_decorate4([
|
|
3375
3395
|
(0, import_debug4.timed)(1e4)
|
|
3376
3396
|
], DataSpace.prototype, "_createWritableFeeds", null);
|
|
3377
|
-
|
|
3378
|
-
|
|
3397
|
+
_ts_decorate4([
|
|
3398
|
+
import_async11.synchronized
|
|
3379
3399
|
], DataSpace.prototype, "activate", null);
|
|
3380
|
-
|
|
3381
|
-
|
|
3400
|
+
_ts_decorate4([
|
|
3401
|
+
import_async11.synchronized
|
|
3382
3402
|
], DataSpace.prototype, "deactivate", null);
|
|
3383
|
-
DataSpace =
|
|
3384
|
-
(0,
|
|
3403
|
+
DataSpace = _ts_decorate4([
|
|
3404
|
+
(0, import_async11.trackLeaks)("open", "close")
|
|
3385
3405
|
], DataSpace);
|
|
3386
3406
|
|
|
3387
3407
|
// packages/sdk/client-services/src/packlets/spaces/genesis.ts
|
|
@@ -3454,7 +3474,7 @@ var spaceGenesis = async (keyring, signingContext, space) => {
|
|
|
3454
3474
|
};
|
|
3455
3475
|
|
|
3456
3476
|
// packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
|
|
3457
|
-
function
|
|
3477
|
+
function _ts_decorate5(decorators, target, key, desc) {
|
|
3458
3478
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3459
3479
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3460
3480
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3474,7 +3494,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3474
3494
|
this._signingContext = _signingContext;
|
|
3475
3495
|
this._feedStore = _feedStore;
|
|
3476
3496
|
this._ctx = new import_context8.Context();
|
|
3477
|
-
this.updated = new
|
|
3497
|
+
this.updated = new import_async12.Event();
|
|
3478
3498
|
this._spaces = new import_util6.ComplexMap(import_keys10.PublicKey.hash);
|
|
3479
3499
|
this._isOpen = false;
|
|
3480
3500
|
this._instanceId = import_keys10.PublicKey.random().toHex();
|
|
@@ -3770,24 +3790,24 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3770
3790
|
return dataSpace;
|
|
3771
3791
|
}
|
|
3772
3792
|
};
|
|
3773
|
-
|
|
3774
|
-
|
|
3793
|
+
_ts_decorate5([
|
|
3794
|
+
import_async12.synchronized
|
|
3775
3795
|
], DataSpaceManager.prototype, "open", null);
|
|
3776
|
-
|
|
3777
|
-
|
|
3796
|
+
_ts_decorate5([
|
|
3797
|
+
import_async12.synchronized
|
|
3778
3798
|
], DataSpaceManager.prototype, "close", null);
|
|
3779
|
-
|
|
3780
|
-
|
|
3799
|
+
_ts_decorate5([
|
|
3800
|
+
import_async12.synchronized
|
|
3781
3801
|
], DataSpaceManager.prototype, "createSpace", null);
|
|
3782
|
-
|
|
3783
|
-
|
|
3802
|
+
_ts_decorate5([
|
|
3803
|
+
import_async12.synchronized
|
|
3784
3804
|
], DataSpaceManager.prototype, "acceptSpace", null);
|
|
3785
|
-
DataSpaceManager =
|
|
3786
|
-
(0,
|
|
3805
|
+
DataSpaceManager = _ts_decorate5([
|
|
3806
|
+
(0, import_async12.trackLeaks)("open", "close")
|
|
3787
3807
|
], DataSpaceManager);
|
|
3788
3808
|
|
|
3789
3809
|
// packages/sdk/client-services/src/packlets/spaces/spaces-service.ts
|
|
3790
|
-
var
|
|
3810
|
+
var import_async13 = require("@dxos/async");
|
|
3791
3811
|
var import_codec_protobuf11 = require("@dxos/codec-protobuf");
|
|
3792
3812
|
var import_debug6 = require("@dxos/debug");
|
|
3793
3813
|
var import_invariant12 = require("@dxos/invariant");
|
|
@@ -3828,7 +3848,7 @@ var SpacesServiceImpl = class {
|
|
|
3828
3848
|
}
|
|
3829
3849
|
querySpaces() {
|
|
3830
3850
|
return new import_codec_protobuf11.Stream(({ next, ctx }) => {
|
|
3831
|
-
const scheduler = new
|
|
3851
|
+
const scheduler = new import_async13.UpdateScheduler(ctx, async () => {
|
|
3832
3852
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3833
3853
|
const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
|
|
3834
3854
|
(0, import_log12.log)("update", {
|
|
@@ -3845,9 +3865,9 @@ var SpacesServiceImpl = class {
|
|
|
3845
3865
|
}, {
|
|
3846
3866
|
maxFrequency: process.env.NODE_ENV === "test" ? void 0 : 2
|
|
3847
3867
|
});
|
|
3848
|
-
(0,
|
|
3868
|
+
(0, import_async13.scheduleTask)(ctx, async () => {
|
|
3849
3869
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3850
|
-
const subscriptions = new
|
|
3870
|
+
const subscriptions = new import_async13.EventSubscriptions();
|
|
3851
3871
|
ctx.onDispose(() => subscriptions.clear());
|
|
3852
3872
|
const subscribeSpaces = () => {
|
|
3853
3873
|
subscriptions.clear();
|
|
@@ -3882,7 +3902,7 @@ var SpacesServiceImpl = class {
|
|
|
3882
3902
|
}
|
|
3883
3903
|
subscribeMessages({ spaceKey, channel }) {
|
|
3884
3904
|
return new import_codec_protobuf11.Stream(({ ctx, next }) => {
|
|
3885
|
-
(0,
|
|
3905
|
+
(0, import_async13.scheduleTask)(ctx, async () => {
|
|
3886
3906
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3887
3907
|
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
|
|
3888
3908
|
const handle = space.listen(getChannelId(channel), (message) => {
|
|
@@ -3901,7 +3921,7 @@ var SpacesServiceImpl = class {
|
|
|
3901
3921
|
}
|
|
3902
3922
|
};
|
|
3903
3923
|
ctx.onDispose(() => space.spaceState.removeCredentialProcessor(processor));
|
|
3904
|
-
(0,
|
|
3924
|
+
(0, import_async13.scheduleTask)(ctx, async () => {
|
|
3905
3925
|
await space.spaceState.addCredentialProcessor(processor);
|
|
3906
3926
|
if (noTail) {
|
|
3907
3927
|
close();
|
|
@@ -4008,7 +4028,7 @@ var SpacesServiceImpl = class {
|
|
|
4008
4028
|
var getChannelId = (channel) => `user-channel/${channel}`;
|
|
4009
4029
|
|
|
4010
4030
|
// packages/sdk/client-services/src/packlets/services/service-context.ts
|
|
4011
|
-
function
|
|
4031
|
+
function _ts_decorate6(decorators, target, key, desc) {
|
|
4012
4032
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4013
4033
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4014
4034
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4025,7 +4045,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4025
4045
|
this.networkManager = networkManager;
|
|
4026
4046
|
this.signalManager = signalManager;
|
|
4027
4047
|
this.modelFactory = modelFactory;
|
|
4028
|
-
this.initialized = new
|
|
4048
|
+
this.initialized = new import_async14.Trigger();
|
|
4029
4049
|
this.dataServiceSubscriptions = new import_echo_pipeline2.DataServiceSubscriptions();
|
|
4030
4050
|
this._handlerFactories = /* @__PURE__ */ new Map();
|
|
4031
4051
|
this._instanceId = import_keys11.PublicKey.random().toHex();
|
|
@@ -4242,19 +4262,19 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4242
4262
|
await identity.space.spaceState.addCredentialProcessor(this._deviceSpaceSync);
|
|
4243
4263
|
}
|
|
4244
4264
|
};
|
|
4245
|
-
|
|
4246
|
-
|
|
4265
|
+
_ts_decorate6([
|
|
4266
|
+
import_tracing5.trace.span()
|
|
4247
4267
|
], ServiceContext.prototype, "open", null);
|
|
4248
|
-
|
|
4249
|
-
|
|
4268
|
+
_ts_decorate6([
|
|
4269
|
+
import_tracing5.trace.span()
|
|
4250
4270
|
], ServiceContext.prototype, "_initialize", null);
|
|
4251
|
-
ServiceContext =
|
|
4271
|
+
ServiceContext = _ts_decorate6([
|
|
4252
4272
|
(0, import_util7.safeInstanceof)("dxos.client-services.ServiceContext"),
|
|
4253
|
-
|
|
4273
|
+
import_tracing5.trace.resource()
|
|
4254
4274
|
], ServiceContext);
|
|
4255
4275
|
|
|
4256
4276
|
// packages/sdk/client-services/src/packlets/services/service-host.ts
|
|
4257
|
-
var
|
|
4277
|
+
var import_async17 = require("@dxos/async");
|
|
4258
4278
|
var import_client_protocol5 = require("@dxos/client-protocol");
|
|
4259
4279
|
var import_context10 = require("@dxos/context");
|
|
4260
4280
|
var import_document_model2 = require("@dxos/document-model");
|
|
@@ -4269,7 +4289,7 @@ var import_network_manager2 = require("@dxos/network-manager");
|
|
|
4269
4289
|
var import_protocols12 = require("@dxos/protocols");
|
|
4270
4290
|
var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
|
|
4271
4291
|
var import_text_model = require("@dxos/text-model");
|
|
4272
|
-
var
|
|
4292
|
+
var import_tracing6 = require("@dxos/tracing");
|
|
4273
4293
|
var import_websocket_rpc = require("@dxos/websocket-rpc");
|
|
4274
4294
|
|
|
4275
4295
|
// packages/sdk/client-services/src/packlets/services/service-registry.ts
|
|
@@ -4297,7 +4317,7 @@ var ServiceRegistry = class {
|
|
|
4297
4317
|
};
|
|
4298
4318
|
|
|
4299
4319
|
// packages/sdk/client-services/src/packlets/devices/devices-service.ts
|
|
4300
|
-
var
|
|
4320
|
+
var import_async15 = require("@dxos/async");
|
|
4301
4321
|
var import_codec_protobuf12 = require("@dxos/codec-protobuf");
|
|
4302
4322
|
var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
|
|
4303
4323
|
var DevicesServiceImpl = class {
|
|
@@ -4325,7 +4345,7 @@ var DevicesServiceImpl = class {
|
|
|
4325
4345
|
});
|
|
4326
4346
|
}
|
|
4327
4347
|
};
|
|
4328
|
-
const subscriptions = new
|
|
4348
|
+
const subscriptions = new import_async15.EventSubscriptions();
|
|
4329
4349
|
subscriptions.add(this._identityManager.stateUpdate.on(() => {
|
|
4330
4350
|
update();
|
|
4331
4351
|
if (this._identityManager.identity) {
|
|
@@ -4344,7 +4364,7 @@ var DevicesServiceImpl = class {
|
|
|
4344
4364
|
var import_invariant14 = require("@dxos/invariant");
|
|
4345
4365
|
var import_lock_file = require("@dxos/lock-file");
|
|
4346
4366
|
var import_log14 = require("@dxos/log");
|
|
4347
|
-
function
|
|
4367
|
+
function _ts_decorate7(decorators, target, key, desc) {
|
|
4348
4368
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4349
4369
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4350
4370
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4394,20 +4414,20 @@ var Lock = class {
|
|
|
4394
4414
|
await import_lock_file.LockFile.release(this._fileHandle);
|
|
4395
4415
|
}
|
|
4396
4416
|
};
|
|
4397
|
-
|
|
4417
|
+
_ts_decorate7([
|
|
4398
4418
|
import_log14.logInfo
|
|
4399
4419
|
], Lock.prototype, "lockKey", null);
|
|
4400
4420
|
var isLocked = (lockPath) => import_lock_file.LockFile.isLocked(lockPath);
|
|
4401
4421
|
|
|
4402
4422
|
// packages/sdk/client-services/src/packlets/logging/logging-service.ts
|
|
4403
|
-
var
|
|
4423
|
+
var import_async16 = require("@dxos/async");
|
|
4404
4424
|
var import_codec_protobuf13 = require("@dxos/codec-protobuf");
|
|
4405
4425
|
var import_log15 = require("@dxos/log");
|
|
4406
4426
|
var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
|
|
4407
4427
|
var import_util8 = require("@dxos/util");
|
|
4408
4428
|
var LoggingServiceImpl = class {
|
|
4409
4429
|
constructor() {
|
|
4410
|
-
this._logs = new
|
|
4430
|
+
this._logs = new import_async16.Event();
|
|
4411
4431
|
this._started = /* @__PURE__ */ new Date();
|
|
4412
4432
|
this._logProcessor = (_config, entry2) => {
|
|
4413
4433
|
this._logs.emit(entry2);
|
|
@@ -4652,7 +4672,7 @@ var SystemServiceImpl = class {
|
|
|
4652
4672
|
};
|
|
4653
4673
|
|
|
4654
4674
|
// packages/sdk/client-services/src/packlets/services/service-host.ts
|
|
4655
|
-
function
|
|
4675
|
+
function _ts_decorate8(decorators, target, key, desc) {
|
|
4656
4676
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4657
4677
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4658
4678
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4689,8 +4709,8 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4689
4709
|
lockKey,
|
|
4690
4710
|
callbacks
|
|
4691
4711
|
} = {}) {
|
|
4692
|
-
this._tracingService =
|
|
4693
|
-
this._statusUpdate = new
|
|
4712
|
+
this._tracingService = import_tracing6.TRACE_PROCESSOR.createTraceSender();
|
|
4713
|
+
this._statusUpdate = new import_async17.Event();
|
|
4694
4714
|
this._opening = false;
|
|
4695
4715
|
this._open = false;
|
|
4696
4716
|
this._storage = storage;
|
|
@@ -5014,26 +5034,26 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
5014
5034
|
return identity;
|
|
5015
5035
|
}
|
|
5016
5036
|
};
|
|
5017
|
-
|
|
5018
|
-
|
|
5037
|
+
_ts_decorate8([
|
|
5038
|
+
import_tracing6.trace.info()
|
|
5019
5039
|
], ClientServicesHost.prototype, "_opening", void 0);
|
|
5020
|
-
|
|
5021
|
-
|
|
5040
|
+
_ts_decorate8([
|
|
5041
|
+
import_tracing6.trace.info()
|
|
5022
5042
|
], ClientServicesHost.prototype, "_open", void 0);
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5043
|
+
_ts_decorate8([
|
|
5044
|
+
import_async17.synchronized,
|
|
5045
|
+
import_tracing6.trace.span()
|
|
5026
5046
|
], ClientServicesHost.prototype, "open", null);
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5047
|
+
_ts_decorate8([
|
|
5048
|
+
import_async17.synchronized,
|
|
5049
|
+
import_tracing6.trace.span()
|
|
5030
5050
|
], ClientServicesHost.prototype, "close", null);
|
|
5031
|
-
ClientServicesHost =
|
|
5032
|
-
|
|
5051
|
+
ClientServicesHost = _ts_decorate8([
|
|
5052
|
+
import_tracing6.trace.resource()
|
|
5033
5053
|
], ClientServicesHost);
|
|
5034
5054
|
|
|
5035
5055
|
// packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts
|
|
5036
|
-
var
|
|
5056
|
+
var import_async19 = require("@dxos/async");
|
|
5037
5057
|
var import_client_protocol7 = require("@dxos/client-protocol");
|
|
5038
5058
|
var import_context11 = require("@dxos/context");
|
|
5039
5059
|
var import_log17 = require("@dxos/log");
|
|
@@ -5042,7 +5062,7 @@ var import_network_manager3 = require("@dxos/network-manager");
|
|
|
5042
5062
|
var import_util11 = require("@dxos/util");
|
|
5043
5063
|
|
|
5044
5064
|
// packages/sdk/client-services/src/packlets/vault/shell-runtime.ts
|
|
5045
|
-
var
|
|
5065
|
+
var import_async18 = require("@dxos/async");
|
|
5046
5066
|
var import_client_protocol6 = require("@dxos/client-protocol");
|
|
5047
5067
|
var import_invariant16 = require("@dxos/invariant");
|
|
5048
5068
|
var import_iframe = require("@dxos/protocols/proto/dxos/iframe");
|
|
@@ -5051,7 +5071,7 @@ var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
|
|
|
5051
5071
|
var ShellRuntimeImpl = class {
|
|
5052
5072
|
constructor(_port) {
|
|
5053
5073
|
this._port = _port;
|
|
5054
|
-
this.layoutUpdate = new
|
|
5074
|
+
this.layoutUpdate = new import_async18.Event();
|
|
5055
5075
|
this._layout = import_iframe.ShellLayout.DEFAULT;
|
|
5056
5076
|
}
|
|
5057
5077
|
get layout() {
|
|
@@ -5110,7 +5130,7 @@ var ShellRuntimeImpl = class {
|
|
|
5110
5130
|
};
|
|
5111
5131
|
|
|
5112
5132
|
// packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts
|
|
5113
|
-
function
|
|
5133
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
5114
5134
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5115
5135
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
5116
5136
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -5124,7 +5144,7 @@ var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
|
|
|
5124
5144
|
var LOCK_KEY = "DXOS_RESOURCE_LOCK";
|
|
5125
5145
|
var IFrameHostRuntime = class {
|
|
5126
5146
|
constructor({ config, origin, appPort, shellPort }) {
|
|
5127
|
-
this._ready = new
|
|
5147
|
+
this._ready = new import_async19.Trigger();
|
|
5128
5148
|
this._configProvider = config;
|
|
5129
5149
|
this.origin = origin;
|
|
5130
5150
|
this._appPort = appPort;
|
|
@@ -5223,12 +5243,12 @@ var IFrameHostRuntime = class {
|
|
|
5223
5243
|
});
|
|
5224
5244
|
}
|
|
5225
5245
|
};
|
|
5226
|
-
|
|
5246
|
+
_ts_decorate9([
|
|
5227
5247
|
import_log17.logInfo
|
|
5228
5248
|
], IFrameHostRuntime.prototype, "origin", void 0);
|
|
5229
5249
|
|
|
5230
5250
|
// packages/sdk/client-services/src/packlets/vault/iframe-proxy-runtime.ts
|
|
5231
|
-
var
|
|
5251
|
+
var import_async20 = require("@dxos/async");
|
|
5232
5252
|
var import_client_protocol8 = require("@dxos/client-protocol");
|
|
5233
5253
|
var import_log18 = require("@dxos/log");
|
|
5234
5254
|
var import_network_manager4 = require("@dxos/network-manager");
|
|
@@ -5239,7 +5259,7 @@ var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
|
|
|
5239
5259
|
var IFrameProxyRuntime = class {
|
|
5240
5260
|
constructor({ config, systemPort, shellPort }) {
|
|
5241
5261
|
this._id = String(Math.floor(Math.random() * 1e6));
|
|
5242
|
-
this._release = new
|
|
5262
|
+
this._release = new import_async20.Trigger();
|
|
5243
5263
|
this._configProvider = config;
|
|
5244
5264
|
this._systemPort = systemPort;
|
|
5245
5265
|
this._shellPort = shellPort;
|
|
@@ -5267,8 +5287,8 @@ var IFrameProxyRuntime = class {
|
|
|
5267
5287
|
let lockKey;
|
|
5268
5288
|
if (typeof navigator !== "undefined") {
|
|
5269
5289
|
lockKey = this._lockKey(origin);
|
|
5270
|
-
this._release = new
|
|
5271
|
-
const ready = new
|
|
5290
|
+
this._release = new import_async20.Trigger();
|
|
5291
|
+
const ready = new import_async20.Trigger();
|
|
5272
5292
|
void navigator.locks.request(lockKey, async () => {
|
|
5273
5293
|
ready.wake();
|
|
5274
5294
|
await this._release.wait();
|
|
@@ -5304,20 +5324,20 @@ var IFrameProxyRuntime = class {
|
|
|
5304
5324
|
};
|
|
5305
5325
|
|
|
5306
5326
|
// packages/sdk/client-services/src/packlets/vault/worker-runtime.ts
|
|
5307
|
-
var
|
|
5327
|
+
var import_async22 = require("@dxos/async");
|
|
5308
5328
|
var import_context12 = require("@dxos/context");
|
|
5309
5329
|
var import_log20 = require("@dxos/log");
|
|
5310
5330
|
var import_messaging3 = require("@dxos/messaging");
|
|
5311
5331
|
var import_network_manager5 = require("@dxos/network-manager");
|
|
5312
5332
|
|
|
5313
5333
|
// packages/sdk/client-services/src/packlets/vault/worker-session.ts
|
|
5314
|
-
var
|
|
5334
|
+
var import_async21 = require("@dxos/async");
|
|
5315
5335
|
var import_client_protocol9 = require("@dxos/client-protocol");
|
|
5316
5336
|
var import_invariant17 = require("@dxos/invariant");
|
|
5317
5337
|
var import_log19 = require("@dxos/log");
|
|
5318
5338
|
var import_rpc4 = require("@dxos/rpc");
|
|
5319
5339
|
var import_util13 = require("@dxos/util");
|
|
5320
|
-
function
|
|
5340
|
+
function _ts_decorate10(decorators, target, key, desc) {
|
|
5321
5341
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5322
5342
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
5323
5343
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -5330,7 +5350,7 @@ function _ts_decorate9(decorators, target, key, desc) {
|
|
|
5330
5350
|
var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/worker-session.ts";
|
|
5331
5351
|
var WorkerSession = class {
|
|
5332
5352
|
constructor({ serviceHost, systemPort, appPort, shellPort, readySignal }) {
|
|
5333
|
-
this._startTrigger = new
|
|
5353
|
+
this._startTrigger = new import_async21.Trigger();
|
|
5334
5354
|
this.onClose = new import_util13.Callback();
|
|
5335
5355
|
(0, import_invariant17.invariant)(serviceHost, void 0, {
|
|
5336
5356
|
F: __dxlog_file21,
|
|
@@ -5458,7 +5478,7 @@ var WorkerSession = class {
|
|
|
5458
5478
|
}
|
|
5459
5479
|
async _maybeOpenShell() {
|
|
5460
5480
|
try {
|
|
5461
|
-
await (0,
|
|
5481
|
+
await (0, import_async21.asyncTimeout)(this._shellClientRpc.open(), 1e3);
|
|
5462
5482
|
} catch {
|
|
5463
5483
|
import_log19.log.info("No shell connected.", void 0, {
|
|
5464
5484
|
F: __dxlog_file21,
|
|
@@ -5473,10 +5493,10 @@ var WorkerSession = class {
|
|
|
5473
5493
|
}).then(callback);
|
|
5474
5494
|
}
|
|
5475
5495
|
};
|
|
5476
|
-
|
|
5496
|
+
_ts_decorate10([
|
|
5477
5497
|
import_log19.logInfo
|
|
5478
5498
|
], WorkerSession.prototype, "origin", void 0);
|
|
5479
|
-
|
|
5499
|
+
_ts_decorate10([
|
|
5480
5500
|
import_log19.logInfo
|
|
5481
5501
|
], WorkerSession.prototype, "lockKey", void 0);
|
|
5482
5502
|
|
|
@@ -5486,7 +5506,7 @@ var WorkerRuntime = class {
|
|
|
5486
5506
|
constructor(_configProvider) {
|
|
5487
5507
|
this._configProvider = _configProvider;
|
|
5488
5508
|
this._transportFactory = new import_network_manager5.SimplePeerTransportProxyFactory();
|
|
5489
|
-
this._ready = new
|
|
5509
|
+
this._ready = new import_async22.Trigger();
|
|
5490
5510
|
this._sessions = /* @__PURE__ */ new Set();
|
|
5491
5511
|
this._clientServices = new ClientServicesHost({
|
|
5492
5512
|
callbacks: {
|