@dxos/client-services 0.1.41-next.d517c89 → 0.1.41
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-LGMYP2WL.mjs → chunk-T73F4MV4.mjs} +232 -213
- package/dist/lib/browser/chunk-T73F4MV4.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 +271 -252
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +259 -217
- package/dist/lib/node/packlets/testing/index.cjs.map +4 -4
- package/dist/types/src/packlets/logging/index.d.ts +2 -0
- package/dist/types/src/packlets/logging/index.d.ts.map +1 -0
- package/dist/types/src/packlets/logging/logging-service.d.ts +13 -0
- package/dist/types/src/packlets/logging/logging-service.d.ts.map +1 -0
- package/dist/types/src/packlets/logging/logging.test.d.ts +2 -0
- package/dist/types/src/packlets/logging/logging.test.d.ts.map +1 -0
- package/dist/types/src/packlets/services/service-host.d.ts +1 -0
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts +6 -5
- package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/iframe-proxy-runtime.d.ts +9 -8
- package/dist/types/src/packlets/vault/iframe-proxy-runtime.d.ts.map +1 -1
- package/package.json +30 -30
- package/src/packlets/logging/index.ts +5 -0
- package/src/packlets/logging/logging-service.ts +78 -0
- package/src/packlets/logging/logging.test.ts +50 -0
- package/src/packlets/services/service-host.ts +9 -2
- package/src/packlets/spaces/data-space-manager.ts +7 -3
- package/src/packlets/tests/shared-worker.test.ts +9 -10
- package/src/packlets/vault/iframe-host-runtime.ts +13 -16
- package/src/packlets/vault/iframe-proxy-runtime.ts +28 -34
- package/dist/lib/browser/chunk-LGMYP2WL.mjs.map +0 -7
- package/dist/types/src/packlets/deprecated/index.d.ts +0 -2
- package/dist/types/src/packlets/deprecated/index.d.ts.map +0 -1
- package/dist/types/src/packlets/deprecated/tracing.d.ts +0 -12
- package/dist/types/src/packlets/deprecated/tracing.d.ts.map +0 -1
- package/src/packlets/deprecated/index.ts +0 -5
- package/src/packlets/deprecated/tracing.ts +0 -21
|
@@ -2131,33 +2131,20 @@ var MemoryShellRuntime = class {
|
|
|
2131
2131
|
|
|
2132
2132
|
// packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts
|
|
2133
2133
|
import { Trigger as Trigger9 } from "@dxos/async";
|
|
2134
|
-
import { log as
|
|
2134
|
+
import { log as log20, logInfo as logInfo3 } from "@dxos/log";
|
|
2135
2135
|
import { MemorySignalManager as MemorySignalManager3, MemorySignalManagerContext as MemorySignalManagerContext3, WebsocketSignalManager as WebsocketSignalManager3 } from "@dxos/messaging";
|
|
2136
2136
|
import { createWebRTCTransportFactory as createWebRTCTransportFactory2, NetworkManager as NetworkManager3 } from "@dxos/network-manager";
|
|
2137
|
-
import { getAsyncValue } from "@dxos/util";
|
|
2137
|
+
import { getAsyncValue as getAsyncValue2 } from "@dxos/util";
|
|
2138
2138
|
|
|
2139
2139
|
// packages/sdk/client-services/src/packlets/services/service-host.ts
|
|
2140
2140
|
import assert14 from "@dxos/node-std/assert";
|
|
2141
|
-
import { Event as
|
|
2141
|
+
import { Event as Event9 } from "@dxos/async";
|
|
2142
2142
|
import { clientServiceBundle, createDefaultModelFactory, PublicKey as PublicKey10 } from "@dxos/client";
|
|
2143
2143
|
import { DataServiceImpl } from "@dxos/echo-pipeline";
|
|
2144
|
-
import { log as
|
|
2144
|
+
import { log as log18 } from "@dxos/log";
|
|
2145
2145
|
import { trace as trace6 } from "@dxos/protocols";
|
|
2146
2146
|
import { SystemStatus } from "@dxos/protocols/proto/dxos/client/services";
|
|
2147
2147
|
|
|
2148
|
-
// packages/sdk/client-services/src/packlets/deprecated/tracing.ts
|
|
2149
|
-
var TracingServiceImpl = class {
|
|
2150
|
-
constructor(_config) {
|
|
2151
|
-
this._config = _config;
|
|
2152
|
-
}
|
|
2153
|
-
async setTracingOptions() {
|
|
2154
|
-
throw new Error("Tracing not available.");
|
|
2155
|
-
}
|
|
2156
|
-
subscribeToRpcTrace() {
|
|
2157
|
-
throw new Error("Tracing not available.");
|
|
2158
|
-
}
|
|
2159
|
-
};
|
|
2160
|
-
|
|
2161
2148
|
// packages/sdk/client-services/src/packlets/devices/devices-service.ts
|
|
2162
2149
|
import { EventSubscriptions as EventSubscriptions2 } from "@dxos/async";
|
|
2163
2150
|
import { Stream as Stream8 } from "@dxos/codec-protobuf";
|
|
@@ -2205,14 +2192,73 @@ var DevicesServiceImpl = class {
|
|
|
2205
2192
|
}
|
|
2206
2193
|
};
|
|
2207
2194
|
|
|
2208
|
-
// packages/sdk/client-services/src/packlets/
|
|
2195
|
+
// packages/sdk/client-services/src/packlets/logging/logging-service.ts
|
|
2196
|
+
import { Event as Event5 } from "@dxos/async";
|
|
2209
2197
|
import { Stream as Stream9 } from "@dxos/codec-protobuf";
|
|
2198
|
+
import { log as log8, shouldLog } from "@dxos/log";
|
|
2199
|
+
var LoggingServiceImpl = class {
|
|
2200
|
+
constructor() {
|
|
2201
|
+
this._logs = new Event5();
|
|
2202
|
+
this._logProcessor = (_config, entry2) => {
|
|
2203
|
+
this._logs.emit(entry2);
|
|
2204
|
+
};
|
|
2205
|
+
}
|
|
2206
|
+
async open() {
|
|
2207
|
+
log8.runtimeConfig.processors.push(this._logProcessor);
|
|
2208
|
+
}
|
|
2209
|
+
async close() {
|
|
2210
|
+
const index = log8.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
|
|
2211
|
+
log8.runtimeConfig.processors.splice(index, 1);
|
|
2212
|
+
}
|
|
2213
|
+
queryLogs(request) {
|
|
2214
|
+
var _a;
|
|
2215
|
+
const filters = ((_a = request.filters) == null ? void 0 : _a.length) ? request.filters : void 0;
|
|
2216
|
+
return new Stream9(({ ctx, next }) => {
|
|
2217
|
+
const handler = (entry2) => {
|
|
2218
|
+
var _a2;
|
|
2219
|
+
if (((_a2 = entry2.meta) == null ? void 0 : _a2.file.includes("logging-service")) || entry2.context && Object.values(entry2.context).some((value) => typeof value === "string" && value.includes("LoggingService"))) {
|
|
2220
|
+
return;
|
|
2221
|
+
}
|
|
2222
|
+
if (shouldLog(entry2, filters)) {
|
|
2223
|
+
next(jsonify(entry2));
|
|
2224
|
+
}
|
|
2225
|
+
};
|
|
2226
|
+
ctx.onDispose(() => {
|
|
2227
|
+
this._logs.off(handler);
|
|
2228
|
+
});
|
|
2229
|
+
this._logs.on(handler);
|
|
2230
|
+
});
|
|
2231
|
+
}
|
|
2232
|
+
};
|
|
2233
|
+
var jsonify = (value) => {
|
|
2234
|
+
if (typeof value === "function") {
|
|
2235
|
+
return null;
|
|
2236
|
+
} else if (typeof value === "object" && value !== null) {
|
|
2237
|
+
if (Array.isArray(value)) {
|
|
2238
|
+
return value.map(jsonify);
|
|
2239
|
+
} else {
|
|
2240
|
+
if (typeof value.toJSON === "function") {
|
|
2241
|
+
return value.toJSON();
|
|
2242
|
+
}
|
|
2243
|
+
const res = {};
|
|
2244
|
+
for (const key of Object.keys(value)) {
|
|
2245
|
+
res[key] = jsonify(value[key]);
|
|
2246
|
+
}
|
|
2247
|
+
return res;
|
|
2248
|
+
}
|
|
2249
|
+
} else {
|
|
2250
|
+
return value;
|
|
2251
|
+
}
|
|
2252
|
+
};
|
|
2253
|
+
|
|
2254
|
+
// packages/sdk/client-services/src/packlets/network/network-service.ts
|
|
2255
|
+
import { Stream as Stream10 } from "@dxos/codec-protobuf";
|
|
2210
2256
|
var NetworkServiceImpl = class {
|
|
2211
2257
|
constructor(networkManager) {
|
|
2212
2258
|
this.networkManager = networkManager;
|
|
2213
2259
|
}
|
|
2214
2260
|
subscribeToNetworkStatus() {
|
|
2215
|
-
return new
|
|
2261
|
+
return new Stream10(({ next }) => {
|
|
2216
2262
|
const unsubscribe = this.networkManager.connectionStateChanged.on((state) => next({
|
|
2217
2263
|
state
|
|
2218
2264
|
}));
|
|
@@ -2229,35 +2275,35 @@ var NetworkServiceImpl = class {
|
|
|
2229
2275
|
|
|
2230
2276
|
// packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
|
|
2231
2277
|
import assert11 from "@dxos/node-std/assert";
|
|
2232
|
-
import { Event as
|
|
2278
|
+
import { Event as Event8, synchronized, trackLeaks as trackLeaks2 } from "@dxos/async";
|
|
2233
2279
|
import { SpaceState as SpaceState2 } from "@dxos/client";
|
|
2234
2280
|
import { cancelWithContext as cancelWithContext2, Context as Context7 } from "@dxos/context";
|
|
2235
2281
|
import { getCredentialAssertion as getCredentialAssertion2 } from "@dxos/credentials";
|
|
2236
2282
|
import { SnapshotManager, spaceGenesis } from "@dxos/echo-pipeline";
|
|
2237
2283
|
import { PublicKey as PublicKey8 } from "@dxos/keys";
|
|
2238
|
-
import { log as
|
|
2284
|
+
import { log as log11 } from "@dxos/log";
|
|
2239
2285
|
import { trace as trace4 } from "@dxos/protocols";
|
|
2240
2286
|
import { Gossip, Presence } from "@dxos/teleport-extension-gossip";
|
|
2241
2287
|
import { ComplexMap as ComplexMap3, deferFunction as deferFunction2 } from "@dxos/util";
|
|
2242
2288
|
|
|
2243
2289
|
// packages/sdk/client-services/src/packlets/spaces/data-space.ts
|
|
2244
|
-
import { Event as
|
|
2290
|
+
import { Event as Event7, scheduleTask as scheduleTask3, trackLeaks } from "@dxos/async";
|
|
2245
2291
|
import { SpaceState } from "@dxos/client";
|
|
2246
2292
|
import { Context as Context6 } from "@dxos/context";
|
|
2247
2293
|
import { timed } from "@dxos/debug";
|
|
2248
2294
|
import { createMappedFeedWriter, DataPipeline } from "@dxos/echo-pipeline";
|
|
2249
2295
|
import { CancelledError, SystemError } from "@dxos/errors";
|
|
2250
2296
|
import { PublicKey as PublicKey7 } from "@dxos/keys";
|
|
2251
|
-
import { log as
|
|
2297
|
+
import { log as log10 } from "@dxos/log";
|
|
2252
2298
|
import { AdmittedFeed as AdmittedFeed3 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
2253
2299
|
import { ComplexSet as ComplexSet2 } from "@dxos/util";
|
|
2254
2300
|
|
|
2255
2301
|
// packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
|
|
2256
2302
|
import assert10 from "@dxos/node-std/assert";
|
|
2257
|
-
import { DeferredTask, Event as
|
|
2303
|
+
import { DeferredTask, Event as Event6, scheduleTask as scheduleTask2, sleep as sleep2, TimeoutError as TimeoutError2, Trigger as Trigger4 } from "@dxos/async";
|
|
2258
2304
|
import { Context as Context5, rejectOnDispose } from "@dxos/context";
|
|
2259
2305
|
import { PublicKey as PublicKey6 } from "@dxos/keys";
|
|
2260
|
-
import { log as
|
|
2306
|
+
import { log as log9 } from "@dxos/log";
|
|
2261
2307
|
import { schema as schema3 } from "@dxos/protocols";
|
|
2262
2308
|
import { RpcExtension as RpcExtension2 } from "@dxos/teleport";
|
|
2263
2309
|
import { ComplexMap as ComplexMap2, ComplexSet, entry } from "@dxos/util";
|
|
@@ -2267,7 +2313,7 @@ var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
|
|
|
2267
2313
|
var NotarizationPlugin = class {
|
|
2268
2314
|
constructor() {
|
|
2269
2315
|
this._ctx = new Context5();
|
|
2270
|
-
this._extensionOpened = new
|
|
2316
|
+
this._extensionOpened = new Event6();
|
|
2271
2317
|
this._extensions = /* @__PURE__ */ new Set();
|
|
2272
2318
|
this._processedCredentials = new ComplexSet(PublicKey6.hash);
|
|
2273
2319
|
this._processCredentialsTriggers = new ComplexMap2(PublicKey6.hash);
|
|
@@ -2281,7 +2327,7 @@ var NotarizationPlugin = class {
|
|
|
2281
2327
|
* Request credentials to be notarized.
|
|
2282
2328
|
*/
|
|
2283
2329
|
async notarize({ ctx: opCtx, credentials, timeout = DEFAULT_NOTARIZE_TIMEOUT, retryTimeout = DEFAULT_RETRY_TIMEOUT, successDelay = DEFAULT_SUCCESS_DELAY }) {
|
|
2284
|
-
|
|
2330
|
+
log9("notarize", {
|
|
2285
2331
|
credentials
|
|
2286
2332
|
}, {
|
|
2287
2333
|
file: "notarization-plugin.ts",
|
|
@@ -2293,7 +2339,7 @@ var NotarizationPlugin = class {
|
|
|
2293
2339
|
const errors = new Trigger4();
|
|
2294
2340
|
const ctx = this._ctx.derive({
|
|
2295
2341
|
onError: (err) => {
|
|
2296
|
-
|
|
2342
|
+
log9.warn("Notarization error", {
|
|
2297
2343
|
err
|
|
2298
2344
|
}, {
|
|
2299
2345
|
file: "notarization-plugin.ts",
|
|
@@ -2308,7 +2354,7 @@ var NotarizationPlugin = class {
|
|
|
2308
2354
|
opCtx == null ? void 0 : opCtx.onDispose(() => ctx.dispose());
|
|
2309
2355
|
if (timeout !== 0) {
|
|
2310
2356
|
scheduleTask2(ctx, () => {
|
|
2311
|
-
|
|
2357
|
+
log9.warn("Notarization timeout", {
|
|
2312
2358
|
timeout,
|
|
2313
2359
|
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
2314
2360
|
}, {
|
|
@@ -2332,7 +2378,7 @@ var NotarizationPlugin = class {
|
|
|
2332
2378
|
...this._extensions
|
|
2333
2379
|
].find((peer2) => !peersTried.has(peer2));
|
|
2334
2380
|
if (!peer) {
|
|
2335
|
-
|
|
2381
|
+
log9.warn("Exhausted all peers to notarize with", {
|
|
2336
2382
|
retryIn: retryTimeout
|
|
2337
2383
|
}, {
|
|
2338
2384
|
file: "notarization-plugin.ts",
|
|
@@ -2345,7 +2391,7 @@ var NotarizationPlugin = class {
|
|
|
2345
2391
|
return;
|
|
2346
2392
|
}
|
|
2347
2393
|
peersTried.add(peer);
|
|
2348
|
-
|
|
2394
|
+
log9("try notarizing", {
|
|
2349
2395
|
peer: peer.localPeerId,
|
|
2350
2396
|
credentialId: credentials.map((credential) => credential.id)
|
|
2351
2397
|
}, {
|
|
@@ -2357,7 +2403,7 @@ var NotarizationPlugin = class {
|
|
|
2357
2403
|
await peer.rpc.NotarizationService.notarize({
|
|
2358
2404
|
credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
|
|
2359
2405
|
});
|
|
2360
|
-
|
|
2406
|
+
log9("success", {}, {
|
|
2361
2407
|
file: "notarization-plugin.ts",
|
|
2362
2408
|
line: 142,
|
|
2363
2409
|
scope: this,
|
|
@@ -2365,7 +2411,7 @@ var NotarizationPlugin = class {
|
|
|
2365
2411
|
});
|
|
2366
2412
|
await sleep2(successDelay);
|
|
2367
2413
|
} catch (err) {
|
|
2368
|
-
|
|
2414
|
+
log9.warn("error notarizing (recoverable)", err, {
|
|
2369
2415
|
file: "notarization-plugin.ts",
|
|
2370
2416
|
line: 145,
|
|
2371
2417
|
scope: this,
|
|
@@ -2382,7 +2428,7 @@ var NotarizationPlugin = class {
|
|
|
2382
2428
|
allNotarized,
|
|
2383
2429
|
errors.wait()
|
|
2384
2430
|
]);
|
|
2385
|
-
|
|
2431
|
+
log9("done", {}, {
|
|
2386
2432
|
file: "notarization-plugin.ts",
|
|
2387
2433
|
line: 155,
|
|
2388
2434
|
scope: this,
|
|
@@ -2433,7 +2479,7 @@ var NotarizationPlugin = class {
|
|
|
2433
2479
|
createExtension() {
|
|
2434
2480
|
const extension = new NotarizationTeleportExtension({
|
|
2435
2481
|
onOpen: async () => {
|
|
2436
|
-
|
|
2482
|
+
log9("extension opened", {
|
|
2437
2483
|
peer: extension.localPeerId
|
|
2438
2484
|
}, {
|
|
2439
2485
|
file: "notarization-plugin.ts",
|
|
@@ -2445,7 +2491,7 @@ var NotarizationPlugin = class {
|
|
|
2445
2491
|
this._extensionOpened.emit();
|
|
2446
2492
|
},
|
|
2447
2493
|
onClose: async () => {
|
|
2448
|
-
|
|
2494
|
+
log9("extension closed", {
|
|
2449
2495
|
peer: extension.localPeerId
|
|
2450
2496
|
}, {
|
|
2451
2497
|
file: "notarization-plugin.ts",
|
|
@@ -2507,7 +2553,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2507
2553
|
constructor(params) {
|
|
2508
2554
|
this._ctx = new Context6();
|
|
2509
2555
|
this._state = SpaceState.CLOSED;
|
|
2510
|
-
this.stateUpdate = new
|
|
2556
|
+
this.stateUpdate = new Event7();
|
|
2511
2557
|
var _a;
|
|
2512
2558
|
this._inner = params.inner;
|
|
2513
2559
|
this._inner.stateUpdate.on(this._ctx, () => this.stateUpdate.emit());
|
|
@@ -2587,7 +2633,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2587
2633
|
await this.initializeDataPipeline();
|
|
2588
2634
|
} catch (err) {
|
|
2589
2635
|
if (err instanceof CancelledError) {
|
|
2590
|
-
|
|
2636
|
+
log10("Data pipeline initialization cancelled", err, {
|
|
2591
2637
|
file: "data-space.ts",
|
|
2592
2638
|
line: 178,
|
|
2593
2639
|
scope: this,
|
|
@@ -2595,7 +2641,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2595
2641
|
});
|
|
2596
2642
|
return;
|
|
2597
2643
|
}
|
|
2598
|
-
|
|
2644
|
+
log10.error("Error initializing data pipeline", err, {
|
|
2599
2645
|
file: "data-space.ts",
|
|
2600
2646
|
line: 182,
|
|
2601
2647
|
scope: this,
|
|
@@ -2615,7 +2661,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2615
2661
|
breakOnStall: false
|
|
2616
2662
|
});
|
|
2617
2663
|
await this._createWritableFeeds();
|
|
2618
|
-
|
|
2664
|
+
log10("Writable feeds created", {}, {
|
|
2619
2665
|
file: "data-space.ts",
|
|
2620
2666
|
line: 200,
|
|
2621
2667
|
scope: this,
|
|
@@ -2636,7 +2682,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2636
2682
|
return pipeline;
|
|
2637
2683
|
}
|
|
2638
2684
|
});
|
|
2639
|
-
|
|
2685
|
+
log10("waiting for data pipeline to reach target timeframe", {}, {
|
|
2640
2686
|
file: "data-space.ts",
|
|
2641
2687
|
line: 220,
|
|
2642
2688
|
scope: this,
|
|
@@ -2646,7 +2692,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2646
2692
|
ctx: this._ctx,
|
|
2647
2693
|
breakOnStall: false
|
|
2648
2694
|
});
|
|
2649
|
-
|
|
2695
|
+
log10("data pipeline ready", {}, {
|
|
2650
2696
|
file: "data-space.ts",
|
|
2651
2697
|
line: 227,
|
|
2652
2698
|
scope: this,
|
|
@@ -2730,7 +2776,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2730
2776
|
this._feedStore = _feedStore;
|
|
2731
2777
|
this._snapshotStore = _snapshotStore;
|
|
2732
2778
|
this._ctx = new Context7();
|
|
2733
|
-
this.updated = new
|
|
2779
|
+
this.updated = new Event8();
|
|
2734
2780
|
this._spaces = new ComplexMap3(PublicKey8.hash);
|
|
2735
2781
|
this._isOpen = false;
|
|
2736
2782
|
this._instanceId = PublicKey8.random().toHex();
|
|
@@ -2740,13 +2786,13 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2740
2786
|
return this._spaces;
|
|
2741
2787
|
}
|
|
2742
2788
|
async open() {
|
|
2743
|
-
|
|
2789
|
+
log11("open", {}, {
|
|
2744
2790
|
file: "data-space-manager.ts",
|
|
2745
2791
|
line: 83,
|
|
2746
2792
|
scope: this,
|
|
2747
2793
|
callSite: (f, a) => f(...a)
|
|
2748
2794
|
});
|
|
2749
|
-
|
|
2795
|
+
log11.trace("dxos.echo.data-space-manager", trace4.begin({
|
|
2750
2796
|
id: this._instanceId,
|
|
2751
2797
|
parentId: this._traceParent
|
|
2752
2798
|
}), {
|
|
@@ -2756,7 +2802,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2756
2802
|
callSite: (f, a) => f(...a)
|
|
2757
2803
|
});
|
|
2758
2804
|
await this._metadataStore.load();
|
|
2759
|
-
|
|
2805
|
+
log11("metadata loaded", {
|
|
2760
2806
|
spaces: this._metadataStore.spaces.length
|
|
2761
2807
|
}, {
|
|
2762
2808
|
file: "data-space-manager.ts",
|
|
@@ -2765,24 +2811,36 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2765
2811
|
callSite: (f, a) => f(...a)
|
|
2766
2812
|
});
|
|
2767
2813
|
for (const spaceMetadata of this._metadataStore.spaces) {
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2814
|
+
try {
|
|
2815
|
+
log11("load space", {
|
|
2816
|
+
spaceMetadata
|
|
2817
|
+
}, {
|
|
2818
|
+
file: "data-space-manager.ts",
|
|
2819
|
+
line: 90,
|
|
2820
|
+
scope: this,
|
|
2821
|
+
callSite: (f, a) => f(...a)
|
|
2822
|
+
});
|
|
2823
|
+
const space = await this._constructSpace(spaceMetadata);
|
|
2824
|
+
space.initializeDataPipelineAsync();
|
|
2825
|
+
} catch (err) {
|
|
2826
|
+
log11.error("Error loading space", {
|
|
2827
|
+
spaceMetadata,
|
|
2828
|
+
err
|
|
2829
|
+
}, {
|
|
2830
|
+
file: "data-space-manager.ts",
|
|
2831
|
+
line: 94,
|
|
2832
|
+
scope: this,
|
|
2833
|
+
callSite: (f, a) => f(...a)
|
|
2834
|
+
});
|
|
2835
|
+
}
|
|
2778
2836
|
}
|
|
2779
2837
|
this._isOpen = true;
|
|
2780
2838
|
this.updated.emit();
|
|
2781
2839
|
}
|
|
2782
2840
|
async close() {
|
|
2783
|
-
|
|
2841
|
+
log11("close", {}, {
|
|
2784
2842
|
file: "data-space-manager.ts",
|
|
2785
|
-
line:
|
|
2843
|
+
line: 104,
|
|
2786
2844
|
scope: this,
|
|
2787
2845
|
callSite: (f, a) => f(...a)
|
|
2788
2846
|
});
|
|
@@ -2791,11 +2849,11 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2791
2849
|
for (const space of this._spaces.values()) {
|
|
2792
2850
|
await space.close();
|
|
2793
2851
|
}
|
|
2794
|
-
|
|
2852
|
+
log11.trace("dxos.echo.data-space-manager", trace4.end({
|
|
2795
2853
|
id: this._instanceId
|
|
2796
2854
|
}), {
|
|
2797
2855
|
file: "data-space-manager.ts",
|
|
2798
|
-
line:
|
|
2856
|
+
line: 110,
|
|
2799
2857
|
scope: this,
|
|
2800
2858
|
callSite: (f, a) => f(...a)
|
|
2801
2859
|
});
|
|
@@ -2814,11 +2872,11 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2814
2872
|
controlFeedKey,
|
|
2815
2873
|
dataFeedKey
|
|
2816
2874
|
};
|
|
2817
|
-
|
|
2875
|
+
log11("creating space...", {
|
|
2818
2876
|
spaceKey
|
|
2819
2877
|
}, {
|
|
2820
2878
|
file: "data-space-manager.ts",
|
|
2821
|
-
line:
|
|
2879
|
+
line: 129,
|
|
2822
2880
|
scope: this,
|
|
2823
2881
|
callSite: (f, a) => f(...a)
|
|
2824
2882
|
});
|
|
@@ -2834,11 +2892,11 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2834
2892
|
}
|
|
2835
2893
|
// TODO(burdon): Rename join space.
|
|
2836
2894
|
async acceptSpace(opts) {
|
|
2837
|
-
|
|
2895
|
+
log11("accept space", {
|
|
2838
2896
|
opts
|
|
2839
2897
|
}, {
|
|
2840
2898
|
file: "data-space-manager.ts",
|
|
2841
|
-
line:
|
|
2899
|
+
line: 148,
|
|
2842
2900
|
scope: this,
|
|
2843
2901
|
callSite: (f, a) => f(...a)
|
|
2844
2902
|
});
|
|
@@ -2868,11 +2926,11 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2868
2926
|
}));
|
|
2869
2927
|
}
|
|
2870
2928
|
async _constructSpace(metadata) {
|
|
2871
|
-
|
|
2929
|
+
log11("construct space", {
|
|
2872
2930
|
metadata
|
|
2873
2931
|
}, {
|
|
2874
2932
|
file: "data-space-manager.ts",
|
|
2875
|
-
line:
|
|
2933
|
+
line: 184,
|
|
2876
2934
|
scope: this,
|
|
2877
2935
|
callSite: (f, a) => f(...a)
|
|
2878
2936
|
});
|
|
@@ -2923,23 +2981,23 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2923
2981
|
snapshotId: metadata.snapshot,
|
|
2924
2982
|
callbacks: {
|
|
2925
2983
|
beforeReady: async () => {
|
|
2926
|
-
|
|
2984
|
+
log11("before space ready", {
|
|
2927
2985
|
space: space.key
|
|
2928
2986
|
}, {
|
|
2929
2987
|
file: "data-space-manager.ts",
|
|
2930
|
-
line:
|
|
2988
|
+
line: 233,
|
|
2931
2989
|
scope: this,
|
|
2932
2990
|
callSite: (f, a) => f(...a)
|
|
2933
2991
|
});
|
|
2934
2992
|
this._dataServiceSubscriptions.registerSpace(space.key, dataSpace.dataPipeline.databaseBackend.createDataServiceHost());
|
|
2935
2993
|
},
|
|
2936
2994
|
afterReady: async () => {
|
|
2937
|
-
|
|
2995
|
+
log11("after space ready", {
|
|
2938
2996
|
space: space.key,
|
|
2939
2997
|
open: this._isOpen
|
|
2940
2998
|
}, {
|
|
2941
2999
|
file: "data-space-manager.ts",
|
|
2942
|
-
line:
|
|
3000
|
+
line: 240,
|
|
2943
3001
|
scope: this,
|
|
2944
3002
|
callSite: (f, a) => f(...a)
|
|
2945
3003
|
});
|
|
@@ -2978,10 +3036,10 @@ DataSpaceManager = __decorate2([
|
|
|
2978
3036
|
|
|
2979
3037
|
// packages/sdk/client-services/src/packlets/spaces/spaces-service.ts
|
|
2980
3038
|
import { EventSubscriptions as EventSubscriptions3, scheduleTask as scheduleTask4 } from "@dxos/async";
|
|
2981
|
-
import { Stream as
|
|
3039
|
+
import { Stream as Stream11 } from "@dxos/codec-protobuf";
|
|
2982
3040
|
import { raise, todo as todo2 } from "@dxos/debug";
|
|
2983
3041
|
import { SpaceNotFoundError } from "@dxos/echo-pipeline";
|
|
2984
|
-
import { log as
|
|
3042
|
+
import { log as log12 } from "@dxos/log";
|
|
2985
3043
|
import { SpaceMember } from "@dxos/protocols/proto/dxos/client/services";
|
|
2986
3044
|
import { humanize } from "@dxos/util";
|
|
2987
3045
|
var TIMEFRAME_UPDATE_DEBOUNCE_TIME = 500;
|
|
@@ -3004,11 +3062,11 @@ var SpacesServiceImpl = class {
|
|
|
3004
3062
|
todo2();
|
|
3005
3063
|
}
|
|
3006
3064
|
querySpaces() {
|
|
3007
|
-
return new
|
|
3065
|
+
return new Stream11(({ next, ctx }) => {
|
|
3008
3066
|
const onUpdate = async () => {
|
|
3009
3067
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3010
3068
|
const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._transformSpace(space));
|
|
3011
|
-
|
|
3069
|
+
log12("update", {
|
|
3012
3070
|
spaces
|
|
3013
3071
|
}, {
|
|
3014
3072
|
file: "spaces-service.ts",
|
|
@@ -3056,7 +3114,7 @@ var SpacesServiceImpl = class {
|
|
|
3056
3114
|
await space.postMessage(getChannelId(channel), message);
|
|
3057
3115
|
}
|
|
3058
3116
|
subscribeMessages({ spaceKey, channel }) {
|
|
3059
|
-
return new
|
|
3117
|
+
return new Stream11(({ ctx, next }) => {
|
|
3060
3118
|
scheduleTask4(ctx, async () => {
|
|
3061
3119
|
var _a;
|
|
3062
3120
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
@@ -3069,7 +3127,7 @@ var SpacesServiceImpl = class {
|
|
|
3069
3127
|
});
|
|
3070
3128
|
}
|
|
3071
3129
|
queryCredentials({ spaceKey }) {
|
|
3072
|
-
return new
|
|
3130
|
+
return new Stream11(({ ctx, next }) => {
|
|
3073
3131
|
var _a;
|
|
3074
3132
|
const space = (_a = this._spaceManager.spaces.get(spaceKey)) != null ? _a : raise(new SpaceNotFoundError(spaceKey));
|
|
3075
3133
|
const processor = space.spaceState.registerProcessor({
|
|
@@ -3125,7 +3183,7 @@ var SpacesServiceImpl = class {
|
|
|
3125
3183
|
var getChannelId = (channel) => `user-channel/${channel}`;
|
|
3126
3184
|
|
|
3127
3185
|
// packages/sdk/client-services/src/packlets/system/system-service.ts
|
|
3128
|
-
import { Stream as
|
|
3186
|
+
import { Stream as Stream12 } from "@dxos/codec-protobuf";
|
|
3129
3187
|
var SystemServiceImpl = class {
|
|
3130
3188
|
constructor({ config, statusUpdate, onUpdateStatus, getCurrentStatus, onReset }) {
|
|
3131
3189
|
this._config = config;
|
|
@@ -3142,7 +3200,7 @@ var SystemServiceImpl = class {
|
|
|
3142
3200
|
await this._onUpdateStatus(status);
|
|
3143
3201
|
}
|
|
3144
3202
|
queryStatus() {
|
|
3145
|
-
return new
|
|
3203
|
+
return new Stream12(({ next }) => {
|
|
3146
3204
|
const update = () => {
|
|
3147
3205
|
next({
|
|
3148
3206
|
status: this._getCurrentStatus()
|
|
@@ -3165,39 +3223,28 @@ var SystemServiceImpl = class {
|
|
|
3165
3223
|
// packages/sdk/client-services/src/packlets/vault/iframe-proxy-runtime.ts
|
|
3166
3224
|
import { iframeServiceBundle, workerServiceBundle } from "@dxos/client";
|
|
3167
3225
|
import { RemoteServiceConnectionError } from "@dxos/errors";
|
|
3168
|
-
import { log as
|
|
3226
|
+
import { log as log13 } from "@dxos/log";
|
|
3169
3227
|
import { WebRTCTransportService } from "@dxos/network-manager";
|
|
3170
3228
|
import { createProtoRpcPeer as createProtoRpcPeer2 } from "@dxos/rpc";
|
|
3229
|
+
import { getAsyncValue } from "@dxos/util";
|
|
3171
3230
|
var IFrameProxyRuntime = class {
|
|
3172
|
-
constructor({
|
|
3173
|
-
this.
|
|
3174
|
-
iceServers: [
|
|
3175
|
-
{
|
|
3176
|
-
urls: "stun:dev.kube.dxos.org:3478",
|
|
3177
|
-
username: "dxos",
|
|
3178
|
-
credential: "dxos"
|
|
3179
|
-
},
|
|
3180
|
-
{
|
|
3181
|
-
urls: "turn:dev.kube.dxos.org:3478",
|
|
3182
|
-
username: "dxos",
|
|
3183
|
-
credential: "dxos"
|
|
3184
|
-
},
|
|
3185
|
-
{
|
|
3186
|
-
urls: "stun:kube.dxos.org:3478",
|
|
3187
|
-
username: "dxos",
|
|
3188
|
-
credential: "dxos"
|
|
3189
|
-
},
|
|
3190
|
-
{
|
|
3191
|
-
urls: "turn:kube.dxos.org:3478",
|
|
3192
|
-
username: "dxos",
|
|
3193
|
-
credential: "dxos"
|
|
3194
|
-
}
|
|
3195
|
-
]
|
|
3196
|
-
});
|
|
3231
|
+
constructor({ config, systemPort, shellPort }) {
|
|
3232
|
+
this._configProvider = config;
|
|
3197
3233
|
this._systemPort = systemPort;
|
|
3198
|
-
this._windowAppPort = windowAppPort;
|
|
3199
|
-
this._workerAppPort = workerAppPort;
|
|
3200
3234
|
this._shellPort = shellPort;
|
|
3235
|
+
if (this._shellPort) {
|
|
3236
|
+
this._shellRuntime = new ShellRuntimeImpl(this._shellPort);
|
|
3237
|
+
}
|
|
3238
|
+
}
|
|
3239
|
+
get shell() {
|
|
3240
|
+
return this._shellRuntime;
|
|
3241
|
+
}
|
|
3242
|
+
async open(origin) {
|
|
3243
|
+
var _a;
|
|
3244
|
+
this._config = await getAsyncValue(this._configProvider);
|
|
3245
|
+
this._transportService = new WebRTCTransportService({
|
|
3246
|
+
iceServers: this._config.get("runtime.services.ice")
|
|
3247
|
+
});
|
|
3201
3248
|
this._systemRpc = createProtoRpcPeer2({
|
|
3202
3249
|
requested: workerServiceBundle,
|
|
3203
3250
|
exposed: iframeServiceBundle,
|
|
@@ -3209,28 +3256,17 @@ var IFrameProxyRuntime = class {
|
|
|
3209
3256
|
}
|
|
3210
3257
|
},
|
|
3211
3258
|
port: this._systemPort,
|
|
3212
|
-
timeout:
|
|
3259
|
+
timeout: 200
|
|
3213
3260
|
});
|
|
3214
|
-
this._workerAppPort.subscribe((msg) => this._windowAppPort.send(msg));
|
|
3215
|
-
this._windowAppPort.subscribe((msg) => this._workerAppPort.send(msg));
|
|
3216
|
-
if (this._shellPort) {
|
|
3217
|
-
this._shellRuntime = new ShellRuntimeImpl(this._shellPort);
|
|
3218
|
-
}
|
|
3219
|
-
}
|
|
3220
|
-
get shell() {
|
|
3221
|
-
return this._shellRuntime;
|
|
3222
|
-
}
|
|
3223
|
-
async open(origin) {
|
|
3224
|
-
var _a;
|
|
3225
3261
|
try {
|
|
3226
3262
|
await this._systemRpc.open();
|
|
3227
3263
|
await this._systemRpc.rpc.WorkerService.start({
|
|
3228
3264
|
origin
|
|
3229
3265
|
});
|
|
3230
3266
|
} catch (err) {
|
|
3231
|
-
|
|
3267
|
+
log13.catch(err, {}, {
|
|
3232
3268
|
file: "iframe-proxy-runtime.ts",
|
|
3233
|
-
line:
|
|
3269
|
+
line: 74,
|
|
3234
3270
|
scope: this,
|
|
3235
3271
|
callSite: (f, a) => f(...a)
|
|
3236
3272
|
});
|
|
@@ -3248,7 +3284,7 @@ var IFrameProxyRuntime = class {
|
|
|
3248
3284
|
|
|
3249
3285
|
// packages/sdk/client-services/src/packlets/vault/vault-resource-lock.ts
|
|
3250
3286
|
import { asyncTimeout, Trigger as Trigger5 } from "@dxos/async";
|
|
3251
|
-
import { log as
|
|
3287
|
+
import { log as log14, logInfo } from "@dxos/log";
|
|
3252
3288
|
var __decorate3 = function(decorators, target, key, desc) {
|
|
3253
3289
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3254
3290
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -3280,28 +3316,28 @@ var VaultResourceLock = class {
|
|
|
3280
3316
|
message: Message.ACQUIRING
|
|
3281
3317
|
});
|
|
3282
3318
|
try {
|
|
3283
|
-
|
|
3319
|
+
log14("aquiring lock...", {}, {
|
|
3284
3320
|
file: "vault-resource-lock.ts",
|
|
3285
3321
|
line: 44,
|
|
3286
3322
|
scope: this,
|
|
3287
3323
|
callSite: (f, a) => f(...a)
|
|
3288
3324
|
});
|
|
3289
3325
|
await asyncTimeout(this._requestLock(), 3e3);
|
|
3290
|
-
|
|
3326
|
+
log14("acquired lock", {}, {
|
|
3291
3327
|
file: "vault-resource-lock.ts",
|
|
3292
3328
|
line: 46,
|
|
3293
3329
|
scope: this,
|
|
3294
3330
|
callSite: (f, a) => f(...a)
|
|
3295
3331
|
});
|
|
3296
3332
|
} catch (e) {
|
|
3297
|
-
|
|
3333
|
+
log14("stealing lock...", {}, {
|
|
3298
3334
|
file: "vault-resource-lock.ts",
|
|
3299
3335
|
line: 48,
|
|
3300
3336
|
scope: this,
|
|
3301
3337
|
callSite: (f, a) => f(...a)
|
|
3302
3338
|
});
|
|
3303
3339
|
await this._requestLock(true);
|
|
3304
|
-
|
|
3340
|
+
log14("stolen lock", {}, {
|
|
3305
3341
|
file: "vault-resource-lock.ts",
|
|
3306
3342
|
line: 50,
|
|
3307
3343
|
scope: this,
|
|
@@ -3318,7 +3354,7 @@ var VaultResourceLock = class {
|
|
|
3318
3354
|
}
|
|
3319
3355
|
}
|
|
3320
3356
|
async _requestLock(steal = false) {
|
|
3321
|
-
|
|
3357
|
+
log14("requesting lock...", {
|
|
3322
3358
|
steal
|
|
3323
3359
|
}, {
|
|
3324
3360
|
file: "vault-resource-lock.ts",
|
|
@@ -3335,14 +3371,14 @@ var VaultResourceLock = class {
|
|
|
3335
3371
|
acquired.wake();
|
|
3336
3372
|
this._releaseTrigger = new Trigger5();
|
|
3337
3373
|
await this._releaseTrigger.wait();
|
|
3338
|
-
|
|
3374
|
+
log14("releasing lock...", {}, {
|
|
3339
3375
|
file: "vault-resource-lock.ts",
|
|
3340
3376
|
line: 74,
|
|
3341
3377
|
scope: this,
|
|
3342
3378
|
callSite: (f, a) => f(...a)
|
|
3343
3379
|
});
|
|
3344
3380
|
await ((_b = this._onRelease) == null ? void 0 : _b.call(this));
|
|
3345
|
-
|
|
3381
|
+
log14("released lock", {}, {
|
|
3346
3382
|
file: "vault-resource-lock.ts",
|
|
3347
3383
|
line: 76,
|
|
3348
3384
|
scope: this,
|
|
@@ -3353,7 +3389,7 @@ var VaultResourceLock = class {
|
|
|
3353
3389
|
await ((_a = this._onRelease) == null ? void 0 : _a.call(this));
|
|
3354
3390
|
});
|
|
3355
3391
|
await acquired.wait();
|
|
3356
|
-
|
|
3392
|
+
log14("recieved lock", {
|
|
3357
3393
|
steal
|
|
3358
3394
|
}, {
|
|
3359
3395
|
file: "vault-resource-lock.ts",
|
|
@@ -3369,7 +3405,7 @@ __decorate3([
|
|
|
3369
3405
|
|
|
3370
3406
|
// packages/sdk/client-services/src/packlets/vault/worker-runtime.ts
|
|
3371
3407
|
import { Trigger as Trigger7 } from "@dxos/async";
|
|
3372
|
-
import { log as
|
|
3408
|
+
import { log as log16 } from "@dxos/log";
|
|
3373
3409
|
import { MemorySignalManager, MemorySignalManagerContext, WebsocketSignalManager } from "@dxos/messaging";
|
|
3374
3410
|
import { NetworkManager, WebRTCTransportProxyFactory } from "@dxos/network-manager";
|
|
3375
3411
|
|
|
@@ -3377,12 +3413,12 @@ import { NetworkManager, WebRTCTransportProxyFactory } from "@dxos/network-manag
|
|
|
3377
3413
|
import assert12 from "@dxos/node-std/assert";
|
|
3378
3414
|
import { asyncTimeout as asyncTimeout2, Trigger as Trigger6 } from "@dxos/async";
|
|
3379
3415
|
import { iframeServiceBundle as iframeServiceBundle2, workerServiceBundle as workerServiceBundle2 } from "@dxos/client";
|
|
3380
|
-
import { log as
|
|
3416
|
+
import { log as log15, logInfo as logInfo2 } from "@dxos/log";
|
|
3381
3417
|
import { createProtoRpcPeer as createProtoRpcPeer3 } from "@dxos/rpc";
|
|
3382
3418
|
import { Callback } from "@dxos/util";
|
|
3383
3419
|
|
|
3384
3420
|
// packages/sdk/client-services/src/packlets/services/client-rpc-server.ts
|
|
3385
|
-
import { Stream as
|
|
3421
|
+
import { Stream as Stream13 } from "@dxos/codec-protobuf";
|
|
3386
3422
|
import { raise as raise2 } from "@dxos/debug";
|
|
3387
3423
|
import { parseMethodName, RpcPeer } from "@dxos/rpc";
|
|
3388
3424
|
var ClientRpcServer = class {
|
|
@@ -3407,7 +3443,7 @@ var ClientRpcServer = class {
|
|
|
3407
3443
|
const [serviceName, methodName] = parseMethodName(method);
|
|
3408
3444
|
const handler = (method2, params3) => this._getServiceHandler(serviceName).callStream(method2, params3);
|
|
3409
3445
|
if (this._handleStream) {
|
|
3410
|
-
return
|
|
3446
|
+
return Stream13.unwrapPromise(this._handleStream(methodName, params2, handler));
|
|
3411
3447
|
} else {
|
|
3412
3448
|
return handler(methodName, params2);
|
|
3413
3449
|
}
|
|
@@ -3499,7 +3535,7 @@ var WorkerSession = class {
|
|
|
3499
3535
|
try {
|
|
3500
3536
|
await this.close();
|
|
3501
3537
|
} catch (err) {
|
|
3502
|
-
|
|
3538
|
+
log15.catch(err, {}, {
|
|
3503
3539
|
file: "worker-session.ts",
|
|
3504
3540
|
line: 107,
|
|
3505
3541
|
scope: this,
|
|
@@ -3517,7 +3553,7 @@ var WorkerSession = class {
|
|
|
3517
3553
|
this.bridgeService = this._iframeRpc.rpc.BridgeService;
|
|
3518
3554
|
}
|
|
3519
3555
|
async open() {
|
|
3520
|
-
|
|
3556
|
+
log15.info("opening..", {}, {
|
|
3521
3557
|
file: "worker-session.ts",
|
|
3522
3558
|
line: 121,
|
|
3523
3559
|
scope: this,
|
|
@@ -3535,7 +3571,7 @@ var WorkerSession = class {
|
|
|
3535
3571
|
try {
|
|
3536
3572
|
await this._iframeRpc.rpc.IframeService.heartbeat();
|
|
3537
3573
|
} catch (err1) {
|
|
3538
|
-
|
|
3574
|
+
log15.warn("Heartbeat failed", {
|
|
3539
3575
|
err: err1
|
|
3540
3576
|
}, {
|
|
3541
3577
|
file: "worker-session.ts",
|
|
@@ -3546,7 +3582,7 @@ var WorkerSession = class {
|
|
|
3546
3582
|
try {
|
|
3547
3583
|
await this.close();
|
|
3548
3584
|
} catch (err) {
|
|
3549
|
-
|
|
3585
|
+
log15.catch(err, {}, {
|
|
3550
3586
|
file: "worker-session.ts",
|
|
3551
3587
|
line: 137,
|
|
3552
3588
|
scope: this,
|
|
@@ -3557,7 +3593,7 @@ var WorkerSession = class {
|
|
|
3557
3593
|
}, this._options.heartbeatInterval);
|
|
3558
3594
|
}
|
|
3559
3595
|
async close() {
|
|
3560
|
-
|
|
3596
|
+
log15.info("closing..", {}, {
|
|
3561
3597
|
file: "worker-session.ts",
|
|
3562
3598
|
line: 144,
|
|
3563
3599
|
scope: this,
|
|
@@ -3566,7 +3602,7 @@ var WorkerSession = class {
|
|
|
3566
3602
|
try {
|
|
3567
3603
|
await this.onClose.callIfSet();
|
|
3568
3604
|
} catch (err) {
|
|
3569
|
-
|
|
3605
|
+
log15.catch(err, {}, {
|
|
3570
3606
|
file: "worker-session.ts",
|
|
3571
3607
|
line: 148,
|
|
3572
3608
|
scope: this,
|
|
@@ -3585,7 +3621,7 @@ var WorkerSession = class {
|
|
|
3585
3621
|
try {
|
|
3586
3622
|
await asyncTimeout2(this._shellClientRpc.open(), 1e3);
|
|
3587
3623
|
} catch (e) {
|
|
3588
|
-
|
|
3624
|
+
log15.info("No shell connected.", {}, {
|
|
3589
3625
|
file: "worker-session.ts",
|
|
3590
3626
|
line: 162,
|
|
3591
3627
|
scope: this,
|
|
@@ -3612,7 +3648,7 @@ var WorkerRuntime = class {
|
|
|
3612
3648
|
return this._clientServices;
|
|
3613
3649
|
}
|
|
3614
3650
|
async start() {
|
|
3615
|
-
|
|
3651
|
+
log16("starting...", {}, {
|
|
3616
3652
|
file: "worker-runtime.ts",
|
|
3617
3653
|
line: 48,
|
|
3618
3654
|
scope: this,
|
|
@@ -3631,7 +3667,7 @@ var WorkerRuntime = class {
|
|
|
3631
3667
|
});
|
|
3632
3668
|
await this._clientServices.open();
|
|
3633
3669
|
this._ready.wake(void 0);
|
|
3634
|
-
|
|
3670
|
+
log16("started", {}, {
|
|
3635
3671
|
file: "worker-runtime.ts",
|
|
3636
3672
|
line: 65,
|
|
3637
3673
|
scope: this,
|
|
@@ -3639,7 +3675,7 @@ var WorkerRuntime = class {
|
|
|
3639
3675
|
});
|
|
3640
3676
|
} catch (err) {
|
|
3641
3677
|
this._ready.wake(err);
|
|
3642
|
-
|
|
3678
|
+
log16.catch(err, {}, {
|
|
3643
3679
|
file: "worker-runtime.ts",
|
|
3644
3680
|
line: 68,
|
|
3645
3681
|
scope: this,
|
|
@@ -3700,7 +3736,7 @@ import { valueEncoding, MetadataStore, SpaceManager, DataServiceSubscriptions, S
|
|
|
3700
3736
|
import { FeedFactory, FeedStore } from "@dxos/feed-store";
|
|
3701
3737
|
import { Keyring } from "@dxos/keyring";
|
|
3702
3738
|
import { PublicKey as PublicKey9 } from "@dxos/keys";
|
|
3703
|
-
import { log as
|
|
3739
|
+
import { log as log17 } from "@dxos/log";
|
|
3704
3740
|
import { trace as trace5 } from "@dxos/protocols";
|
|
3705
3741
|
var ServiceContext = class {
|
|
3706
3742
|
// prettier-ignore
|
|
@@ -3740,7 +3776,7 @@ var ServiceContext = class {
|
|
|
3740
3776
|
}, this._acceptIdentity.bind(this)));
|
|
3741
3777
|
}
|
|
3742
3778
|
async open() {
|
|
3743
|
-
|
|
3779
|
+
log17.trace("dxos.sdk.service-context", trace5.begin({
|
|
3744
3780
|
id: this._instanceId
|
|
3745
3781
|
}), {
|
|
3746
3782
|
file: "service-context.ts",
|
|
@@ -3748,7 +3784,7 @@ var ServiceContext = class {
|
|
|
3748
3784
|
scope: this,
|
|
3749
3785
|
callSite: (f, a) => f(...a)
|
|
3750
3786
|
});
|
|
3751
|
-
|
|
3787
|
+
log17("opening...", {}, {
|
|
3752
3788
|
file: "service-context.ts",
|
|
3753
3789
|
line: 117,
|
|
3754
3790
|
scope: this,
|
|
@@ -3760,7 +3796,7 @@ var ServiceContext = class {
|
|
|
3760
3796
|
if (this.identityManager.identity) {
|
|
3761
3797
|
await this._initialize();
|
|
3762
3798
|
}
|
|
3763
|
-
|
|
3799
|
+
log17("opened", {}, {
|
|
3764
3800
|
file: "service-context.ts",
|
|
3765
3801
|
line: 124,
|
|
3766
3802
|
scope: this,
|
|
@@ -3769,7 +3805,7 @@ var ServiceContext = class {
|
|
|
3769
3805
|
}
|
|
3770
3806
|
async close() {
|
|
3771
3807
|
var _a, _b;
|
|
3772
|
-
|
|
3808
|
+
log17("closing...", {}, {
|
|
3773
3809
|
file: "service-context.ts",
|
|
3774
3810
|
line: 128,
|
|
3775
3811
|
scope: this,
|
|
@@ -3782,13 +3818,13 @@ var ServiceContext = class {
|
|
|
3782
3818
|
await this.feedStore.close();
|
|
3783
3819
|
await this.networkManager.close();
|
|
3784
3820
|
this.dataServiceSubscriptions.clear();
|
|
3785
|
-
|
|
3821
|
+
log17("closed", {}, {
|
|
3786
3822
|
file: "service-context.ts",
|
|
3787
3823
|
line: 136,
|
|
3788
3824
|
scope: this,
|
|
3789
3825
|
callSite: (f, a) => f(...a)
|
|
3790
3826
|
});
|
|
3791
|
-
|
|
3827
|
+
log17.trace("dxos.sdk.service-context", trace5.end({
|
|
3792
3828
|
id: this._instanceId
|
|
3793
3829
|
}), {
|
|
3794
3830
|
file: "service-context.ts",
|
|
@@ -3815,7 +3851,7 @@ var ServiceContext = class {
|
|
|
3815
3851
|
// Called when identity is created.
|
|
3816
3852
|
async _initialize() {
|
|
3817
3853
|
var _a;
|
|
3818
|
-
|
|
3854
|
+
log17("initializing spaces...", {}, {
|
|
3819
3855
|
file: "service-context.ts",
|
|
3820
3856
|
line: 163,
|
|
3821
3857
|
scope: this,
|
|
@@ -3853,7 +3889,7 @@ var ServiceContext = class {
|
|
|
3853
3889
|
return;
|
|
3854
3890
|
}
|
|
3855
3891
|
if (!this.dataSpaceManager) {
|
|
3856
|
-
|
|
3892
|
+
log17("dataSpaceManager not initialized yet, ignoring space admission", {
|
|
3857
3893
|
details: assertion
|
|
3858
3894
|
}, {
|
|
3859
3895
|
file: "service-context.ts",
|
|
@@ -3864,7 +3900,7 @@ var ServiceContext = class {
|
|
|
3864
3900
|
return;
|
|
3865
3901
|
}
|
|
3866
3902
|
if (this.dataSpaceManager.spaces.has(assertion.spaceKey)) {
|
|
3867
|
-
|
|
3903
|
+
log17("space already exists, ignoring space admission", {
|
|
3868
3904
|
details: assertion
|
|
3869
3905
|
}, {
|
|
3870
3906
|
file: "service-context.ts",
|
|
@@ -3875,7 +3911,7 @@ var ServiceContext = class {
|
|
|
3875
3911
|
return;
|
|
3876
3912
|
}
|
|
3877
3913
|
try {
|
|
3878
|
-
|
|
3914
|
+
log17("accepting space recorded in halo", {
|
|
3879
3915
|
details: assertion
|
|
3880
3916
|
}, {
|
|
3881
3917
|
file: "service-context.ts",
|
|
@@ -3888,7 +3924,7 @@ var ServiceContext = class {
|
|
|
3888
3924
|
genesisFeedKey: assertion.genesisFeedKey
|
|
3889
3925
|
});
|
|
3890
3926
|
} catch (err) {
|
|
3891
|
-
|
|
3927
|
+
log17.catch(err, {}, {
|
|
3892
3928
|
file: "service-context.ts",
|
|
3893
3929
|
line: 220,
|
|
3894
3930
|
scope: this,
|
|
@@ -3936,7 +3972,7 @@ var ClientServicesHost = class {
|
|
|
3936
3972
|
// TODO(wittjosiah): Turn this on by default.
|
|
3937
3973
|
lockKey
|
|
3938
3974
|
} = {}) {
|
|
3939
|
-
this._statusUpdate = new
|
|
3975
|
+
this._statusUpdate = new Event9();
|
|
3940
3976
|
this._opening = false;
|
|
3941
3977
|
this._open = false;
|
|
3942
3978
|
this._instanceId = PublicKey10.random().toHex();
|
|
@@ -3971,6 +4007,7 @@ var ClientServicesHost = class {
|
|
|
3971
4007
|
await this.reset();
|
|
3972
4008
|
}
|
|
3973
4009
|
});
|
|
4010
|
+
this._loggingService = new LoggingServiceImpl();
|
|
3974
4011
|
this._serviceRegistry = new ServiceRegistry(clientServiceBundle, {
|
|
3975
4012
|
SystemService: this._systemService
|
|
3976
4013
|
});
|
|
@@ -4011,11 +4048,11 @@ var ClientServicesHost = class {
|
|
|
4011
4048
|
if (this._open) {
|
|
4012
4049
|
return;
|
|
4013
4050
|
}
|
|
4014
|
-
|
|
4051
|
+
log18.trace("dxos.sdk.client-services-host", trace6.begin({
|
|
4015
4052
|
id: this._instanceId
|
|
4016
4053
|
}), {
|
|
4017
4054
|
file: "service-host.ts",
|
|
4018
|
-
line:
|
|
4055
|
+
line: 169,
|
|
4019
4056
|
scope: this,
|
|
4020
4057
|
callSite: (f, a) => f(...a)
|
|
4021
4058
|
});
|
|
@@ -4023,15 +4060,16 @@ var ClientServicesHost = class {
|
|
|
4023
4060
|
assert14(this._storage, "storage not set");
|
|
4024
4061
|
assert14(this._networkManager, "network manager not set");
|
|
4025
4062
|
this._opening = true;
|
|
4026
|
-
|
|
4063
|
+
log18("opening...", {
|
|
4027
4064
|
lockKey: (_a = this._resourceLock) == null ? void 0 : _a.lockKey
|
|
4028
4065
|
}, {
|
|
4029
4066
|
file: "service-host.ts",
|
|
4030
|
-
line:
|
|
4067
|
+
line: 176,
|
|
4031
4068
|
scope: this,
|
|
4032
4069
|
callSite: (f, a) => f(...a)
|
|
4033
4070
|
});
|
|
4034
4071
|
await ((_b = this._resourceLock) == null ? void 0 : _b.acquire());
|
|
4072
|
+
await this._loggingService.open();
|
|
4035
4073
|
this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._modelFactory);
|
|
4036
4074
|
this._serviceRegistry.setServices({
|
|
4037
4075
|
SystemService: this._systemService,
|
|
@@ -4044,8 +4082,8 @@ var ClientServicesHost = class {
|
|
|
4044
4082
|
}),
|
|
4045
4083
|
DataService: new DataServiceImpl(this._serviceContext.dataServiceSubscriptions),
|
|
4046
4084
|
NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager),
|
|
4085
|
+
LoggingService: this._loggingService,
|
|
4047
4086
|
// TODO(burdon): Move to new protobuf definitions.
|
|
4048
|
-
TracingService: new TracingServiceImpl(this._config),
|
|
4049
4087
|
DevtoolsHost: new DevtoolsServiceImpl({
|
|
4050
4088
|
events: new DevtoolsHostEvents(),
|
|
4051
4089
|
config: this._config,
|
|
@@ -4057,11 +4095,11 @@ var ClientServicesHost = class {
|
|
|
4057
4095
|
this._open = true;
|
|
4058
4096
|
this._statusUpdate.emit();
|
|
4059
4097
|
const deviceKey = (_c = this._serviceContext.identityManager.identity) == null ? void 0 : _c.deviceKey;
|
|
4060
|
-
|
|
4098
|
+
log18("opened", {
|
|
4061
4099
|
deviceKey
|
|
4062
4100
|
}, {
|
|
4063
4101
|
file: "service-host.ts",
|
|
4064
|
-
line:
|
|
4102
|
+
line: 226,
|
|
4065
4103
|
scope: this,
|
|
4066
4104
|
callSite: (f, a) => f(...a)
|
|
4067
4105
|
});
|
|
@@ -4072,50 +4110,51 @@ var ClientServicesHost = class {
|
|
|
4072
4110
|
return;
|
|
4073
4111
|
}
|
|
4074
4112
|
const deviceKey = (_a = this._serviceContext.identityManager.identity) == null ? void 0 : _a.deviceKey;
|
|
4075
|
-
|
|
4113
|
+
log18("closing...", {
|
|
4076
4114
|
deviceKey
|
|
4077
4115
|
}, {
|
|
4078
4116
|
file: "service-host.ts",
|
|
4079
|
-
line:
|
|
4117
|
+
line: 235,
|
|
4080
4118
|
scope: this,
|
|
4081
4119
|
callSite: (f, a) => f(...a)
|
|
4082
4120
|
});
|
|
4083
4121
|
this._serviceRegistry.setServices({
|
|
4084
4122
|
SystemService: this._systemService
|
|
4085
4123
|
});
|
|
4124
|
+
await this._loggingService.close();
|
|
4086
4125
|
await this._serviceContext.close();
|
|
4087
4126
|
this._open = false;
|
|
4088
4127
|
this._statusUpdate.emit();
|
|
4089
|
-
|
|
4128
|
+
log18("closed", {
|
|
4090
4129
|
deviceKey
|
|
4091
4130
|
}, {
|
|
4092
4131
|
file: "service-host.ts",
|
|
4093
|
-
line:
|
|
4132
|
+
line: 241,
|
|
4094
4133
|
scope: this,
|
|
4095
4134
|
callSite: (f, a) => f(...a)
|
|
4096
4135
|
});
|
|
4097
|
-
|
|
4136
|
+
log18.trace("dxos.sdk.client-services-host", trace6.end({
|
|
4098
4137
|
id: this._instanceId
|
|
4099
4138
|
}), {
|
|
4100
4139
|
file: "service-host.ts",
|
|
4101
|
-
line:
|
|
4140
|
+
line: 243,
|
|
4102
4141
|
scope: this,
|
|
4103
4142
|
callSite: (f, a) => f(...a)
|
|
4104
4143
|
});
|
|
4105
4144
|
}
|
|
4106
4145
|
async reset() {
|
|
4107
4146
|
var _a;
|
|
4108
|
-
|
|
4147
|
+
log18("resetting...", {}, {
|
|
4109
4148
|
file: "service-host.ts",
|
|
4110
|
-
line:
|
|
4149
|
+
line: 247,
|
|
4111
4150
|
scope: this,
|
|
4112
4151
|
callSite: (f, a) => f(...a)
|
|
4113
4152
|
});
|
|
4114
4153
|
await ((_a = this._serviceContext) == null ? void 0 : _a.close());
|
|
4115
4154
|
await this._storage.reset();
|
|
4116
|
-
|
|
4155
|
+
log18("reset", {}, {
|
|
4117
4156
|
file: "service-host.ts",
|
|
4118
|
-
line:
|
|
4157
|
+
line: 250,
|
|
4119
4158
|
scope: this,
|
|
4120
4159
|
callSite: (f, a) => f(...a)
|
|
4121
4160
|
});
|
|
@@ -4146,7 +4185,7 @@ var LocalClientServices = class {
|
|
|
4146
4185
|
|
|
4147
4186
|
// packages/sdk/client-services/src/packlets/services/utils.ts
|
|
4148
4187
|
import { Config } from "@dxos/config";
|
|
4149
|
-
import { log as
|
|
4188
|
+
import { log as log19 } from "@dxos/log";
|
|
4150
4189
|
import { MemorySignalManager as MemorySignalManager2, MemorySignalManagerContext as MemorySignalManagerContext2, WebsocketSignalManager as WebsocketSignalManager2 } from "@dxos/messaging";
|
|
4151
4190
|
import { createWebRTCTransportFactory, MemoryTransportFactory, NetworkManager as NetworkManager2 } from "@dxos/network-manager";
|
|
4152
4191
|
var fromHost = (config = new Config()) => {
|
|
@@ -4167,7 +4206,7 @@ var createNetworkManager = (config, options = {}) => {
|
|
|
4167
4206
|
transportFactory
|
|
4168
4207
|
});
|
|
4169
4208
|
}
|
|
4170
|
-
|
|
4209
|
+
log19.warn("P2P network is not configured.", {}, {
|
|
4171
4210
|
file: "utils.ts",
|
|
4172
4211
|
line: 48,
|
|
4173
4212
|
scope: void 0,
|
|
@@ -4192,33 +4231,10 @@ var __decorate5 = function(decorators, target, key, desc) {
|
|
|
4192
4231
|
};
|
|
4193
4232
|
var LOCK_KEY = "DXOS_RESOURCE_LOCK";
|
|
4194
4233
|
var IFrameHostRuntime = class {
|
|
4195
|
-
constructor({
|
|
4196
|
-
this._transportFactory = createWebRTCTransportFactory2({
|
|
4197
|
-
iceServers: [
|
|
4198
|
-
{
|
|
4199
|
-
urls: "stun:dev.kube.dxos.org:3478",
|
|
4200
|
-
username: "dxos",
|
|
4201
|
-
credential: "dxos"
|
|
4202
|
-
},
|
|
4203
|
-
{
|
|
4204
|
-
urls: "turn:dev.kube.dxos.org:3478",
|
|
4205
|
-
username: "dxos",
|
|
4206
|
-
credential: "dxos"
|
|
4207
|
-
},
|
|
4208
|
-
{
|
|
4209
|
-
urls: "stun:kube.dxos.org:3478",
|
|
4210
|
-
username: "dxos",
|
|
4211
|
-
credential: "dxos"
|
|
4212
|
-
},
|
|
4213
|
-
{
|
|
4214
|
-
urls: "turn:kube.dxos.org:3478",
|
|
4215
|
-
username: "dxos",
|
|
4216
|
-
credential: "dxos"
|
|
4217
|
-
}
|
|
4218
|
-
]
|
|
4219
|
-
});
|
|
4234
|
+
constructor({ config, origin, appPort, shellPort }) {
|
|
4220
4235
|
this._ready = new Trigger9();
|
|
4221
|
-
this._configProvider =
|
|
4236
|
+
this._configProvider = config;
|
|
4237
|
+
this.origin = origin;
|
|
4222
4238
|
this._appPort = appPort;
|
|
4223
4239
|
this._shellPort = shellPort;
|
|
4224
4240
|
if (this._shellPort) {
|
|
@@ -4233,14 +4249,17 @@ var IFrameHostRuntime = class {
|
|
|
4233
4249
|
}
|
|
4234
4250
|
async start() {
|
|
4235
4251
|
var _a;
|
|
4236
|
-
|
|
4252
|
+
log20("starting...", {}, {
|
|
4237
4253
|
file: "iframe-host-runtime.ts",
|
|
4238
|
-
line:
|
|
4254
|
+
line: 69,
|
|
4239
4255
|
scope: this,
|
|
4240
4256
|
callSite: (f, a) => f(...a)
|
|
4241
4257
|
});
|
|
4242
4258
|
try {
|
|
4243
|
-
this._config = await
|
|
4259
|
+
this._config = await getAsyncValue2(this._configProvider);
|
|
4260
|
+
this._transportFactory = createWebRTCTransportFactory2({
|
|
4261
|
+
iceServers: this._config.get("runtime.services.ice")
|
|
4262
|
+
});
|
|
4244
4263
|
const signals = this._config.get("runtime.services.signaling");
|
|
4245
4264
|
this._clientServices = new LocalClientServices({
|
|
4246
4265
|
lockKey: LOCK_KEY,
|
|
@@ -4282,17 +4301,17 @@ var IFrameHostRuntime = class {
|
|
|
4282
4301
|
(_a = this._shellRuntime) == null ? void 0 : _a.open()
|
|
4283
4302
|
]);
|
|
4284
4303
|
this._ready.wake(void 0);
|
|
4285
|
-
|
|
4304
|
+
log20("started", {}, {
|
|
4286
4305
|
file: "iframe-host-runtime.ts",
|
|
4287
|
-
line:
|
|
4306
|
+
line: 115,
|
|
4288
4307
|
scope: this,
|
|
4289
4308
|
callSite: (f, a) => f(...a)
|
|
4290
4309
|
});
|
|
4291
4310
|
} catch (err) {
|
|
4292
4311
|
this._ready.wake(err);
|
|
4293
|
-
|
|
4312
|
+
log20.catch(err, {}, {
|
|
4294
4313
|
file: "iframe-host-runtime.ts",
|
|
4295
|
-
line:
|
|
4314
|
+
line: 118,
|
|
4296
4315
|
scope: this,
|
|
4297
4316
|
callSite: (f, a) => f(...a)
|
|
4298
4317
|
});
|
|
@@ -4300,18 +4319,18 @@ var IFrameHostRuntime = class {
|
|
|
4300
4319
|
}
|
|
4301
4320
|
async stop() {
|
|
4302
4321
|
var _a;
|
|
4303
|
-
|
|
4322
|
+
log20("stopping...", {}, {
|
|
4304
4323
|
file: "iframe-host-runtime.ts",
|
|
4305
|
-
line:
|
|
4324
|
+
line: 123,
|
|
4306
4325
|
scope: this,
|
|
4307
4326
|
callSite: (f, a) => f(...a)
|
|
4308
4327
|
});
|
|
4309
4328
|
await this._clientRpc.close();
|
|
4310
4329
|
await this._clientServices.close();
|
|
4311
4330
|
await ((_a = this._shellRuntime) == null ? void 0 : _a.close());
|
|
4312
|
-
|
|
4331
|
+
log20("stopped", {}, {
|
|
4313
4332
|
file: "iframe-host-runtime.ts",
|
|
4314
|
-
line:
|
|
4333
|
+
line: 127,
|
|
4315
4334
|
scope: this,
|
|
4316
4335
|
callSite: (f, a) => f(...a)
|
|
4317
4336
|
});
|
|
@@ -4355,4 +4374,4 @@ export {
|
|
|
4355
4374
|
LocalClientServices,
|
|
4356
4375
|
fromHost
|
|
4357
4376
|
};
|
|
4358
|
-
//# sourceMappingURL=chunk-
|
|
4377
|
+
//# sourceMappingURL=chunk-T73F4MV4.mjs.map
|