@dxos/client-services 0.8.4-main.ae835ea → 0.8.4-main.bc674ce
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-KPYVJG6G.mjs → chunk-J33W6T4Q.mjs} +1025 -1331
- package/dist/lib/browser/chunk-J33W6T4Q.mjs.map +7 -0
- package/dist/lib/browser/chunk-NQSC7HOE.mjs +22 -0
- package/dist/lib/browser/chunk-NQSC7HOE.mjs.map +7 -0
- package/dist/lib/browser/chunk-QCWEHHJW.mjs +24 -0
- package/dist/lib/browser/chunk-QCWEHHJW.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +432 -65
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/diagnostics/browser-diagnostics-broadcast.mjs +93 -0
- package/dist/lib/browser/packlets/diagnostics/browser-diagnostics-broadcast.mjs.map +7 -0
- package/dist/lib/browser/packlets/diagnostics/diagnostics-broadcast.mjs +11 -0
- package/dist/lib/browser/packlets/diagnostics/diagnostics-broadcast.mjs.map +7 -0
- package/dist/lib/browser/packlets/locks/browser.mjs +126 -0
- package/dist/lib/browser/packlets/locks/browser.mjs.map +7 -0
- package/dist/lib/browser/packlets/locks/node.mjs +66 -0
- package/dist/lib/browser/packlets/locks/node.mjs.map +7 -0
- package/dist/lib/browser/testing/index.mjs +24 -12
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/chunk-2SZHAWBN.mjs +24 -0
- package/dist/lib/node-esm/chunk-2SZHAWBN.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-BBBSS6UL.mjs → chunk-34HKLADW.mjs} +517 -692
- package/dist/lib/node-esm/chunk-34HKLADW.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-PKEGMOQ4.mjs +22 -0
- package/dist/lib/node-esm/chunk-PKEGMOQ4.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +432 -65
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/packlets/diagnostics/browser-diagnostics-broadcast.mjs +93 -0
- package/dist/lib/node-esm/packlets/diagnostics/browser-diagnostics-broadcast.mjs.map +7 -0
- package/dist/lib/node-esm/packlets/diagnostics/diagnostics-broadcast.mjs +11 -0
- package/dist/lib/node-esm/packlets/diagnostics/diagnostics-broadcast.mjs.map +7 -0
- package/dist/lib/node-esm/packlets/locks/browser.mjs +126 -0
- package/dist/lib/node-esm/packlets/locks/browser.mjs.map +7 -0
- package/dist/lib/node-esm/packlets/locks/node.mjs +66 -0
- package/dist/lib/node-esm/packlets/locks/node.mjs.map +7 -0
- package/dist/lib/node-esm/testing/index.mjs +24 -12
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/packlets/devtools/devtools.d.ts +2 -2
- package/dist/types/src/packlets/devtools/devtools.d.ts.map +1 -1
- package/dist/types/src/packlets/diagnostics/index.d.ts +1 -1
- package/dist/types/src/packlets/diagnostics/index.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/authenticator.d.ts +2 -2
- package/dist/types/src/packlets/identity/authenticator.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/default-space-state-machine.d.ts +2 -2
- package/dist/types/src/packlets/identity/default-space-state-machine.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-manager.d.ts +4 -4
- package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts +2 -2
- package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity.d.ts +2 -2
- package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts +4 -4
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-guest-extenstion.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-host-extension.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-protocol.d.ts +2 -3
- package/dist/types/src/packlets/invitations/invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts +4 -4
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts +2 -2
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/locks/index.d.ts +1 -1
- package/dist/types/src/packlets/locks/index.d.ts.map +1 -1
- package/dist/types/src/packlets/services/client-rpc-server.d.ts +2 -2
- package/dist/types/src/packlets/services/client-rpc-server.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts +13 -7
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts +19 -5
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/space-export/space-archive-writer.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts +10 -5
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts +2 -2
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts +2 -2
- package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/notarization-plugin.d.ts +6 -6
- package/dist/types/src/packlets/spaces/notarization-plugin.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/invitation-utils.d.ts +6 -3
- package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +6 -5
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/packlets/worker/worker-runtime.d.ts +23 -4
- package/dist/types/src/packlets/worker/worker-runtime.d.ts.map +1 -1
- package/dist/types/src/packlets/worker/worker-session.d.ts +2 -2
- package/dist/types/src/packlets/worker/worker-session.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +70 -48
- package/src/packlets/devtools/devtools.ts +2 -2
- package/src/packlets/diagnostics/index.ts +1 -1
- package/src/packlets/identity/authenticator.ts +2 -2
- package/src/packlets/identity/default-space-state-machine.ts +2 -2
- package/src/packlets/identity/identity-manager.ts +6 -6
- package/src/packlets/identity/identity-recovery-manager.ts +2 -2
- package/src/packlets/identity/identity.ts +2 -2
- package/src/packlets/invitations/device-invitation-protocol.ts +5 -5
- package/src/packlets/invitations/invitation-guest-extenstion.ts +6 -4
- package/src/packlets/invitations/invitation-host-extension.ts +6 -4
- package/src/packlets/invitations/invitation-protocol.ts +2 -3
- package/src/packlets/invitations/invitations-handler.ts +7 -7
- package/src/packlets/invitations/space-invitation-protocol.ts +7 -13
- package/src/packlets/locks/index.ts +1 -1
- package/src/packlets/logging/logging-service.ts +1 -1
- package/src/packlets/services/client-rpc-server.ts +4 -4
- package/src/packlets/services/service-context.ts +30 -19
- package/src/packlets/services/service-host.ts +56 -16
- package/src/packlets/space-export/space-archive-reader.ts +1 -1
- package/src/packlets/space-export/space-archive-writer.ts +3 -1
- package/src/packlets/spaces/data-space-manager.ts +43 -20
- package/src/packlets/spaces/data-space.ts +7 -6
- package/src/packlets/spaces/edge-feed-replicator.ts +2 -2
- package/src/packlets/spaces/epoch-migrations.ts +2 -2
- package/src/packlets/spaces/notarization-plugin.test.ts +2 -2
- package/src/packlets/spaces/notarization-plugin.ts +8 -8
- package/src/packlets/spaces/spaces-service.ts +10 -7
- package/src/packlets/storage/storage.ts +4 -4
- package/src/packlets/testing/invitation-utils.ts +7 -4
- package/src/packlets/testing/test-builder.ts +36 -10
- package/src/packlets/worker/worker-runtime.ts +141 -11
- package/src/packlets/worker/worker-session.ts +4 -4
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-KPYVJG6G.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BBBSS6UL.mjs.map +0 -7
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
createCollectDiagnosticsBroadcastSender
|
|
4
|
+
} from "./chunk-PKEGMOQ4.mjs";
|
|
5
|
+
import {
|
|
6
|
+
__export,
|
|
7
|
+
__reExport
|
|
8
|
+
} from "./chunk-2SZHAWBN.mjs";
|
|
2
9
|
|
|
3
10
|
// src/packlets/devtools/feeds.ts
|
|
4
11
|
import { SubscriptionList } from "@dxos/async";
|
|
@@ -396,7 +403,7 @@ import { SpaceMember } from "@dxos/protocols/proto/dxos/client/services";
|
|
|
396
403
|
import { TRACE_PROCESSOR } from "@dxos/tracing";
|
|
397
404
|
|
|
398
405
|
// src/version.ts
|
|
399
|
-
var DXOS_VERSION = "0.8.4-main.
|
|
406
|
+
var DXOS_VERSION = "0.8.4-main.bc674ce";
|
|
400
407
|
|
|
401
408
|
// src/packlets/services/platform.ts
|
|
402
409
|
import { Platform } from "@dxos/protocols/proto/dxos/client/services";
|
|
@@ -550,21 +557,6 @@ var getStorageDiagnostics = async () => {
|
|
|
550
557
|
}));
|
|
551
558
|
};
|
|
552
559
|
|
|
553
|
-
// src/packlets/diagnostics/diagnostics-broadcast.ts
|
|
554
|
-
var createCollectDiagnosticsBroadcastSender = () => {
|
|
555
|
-
return {
|
|
556
|
-
broadcastDiagnosticsRequest: async () => void 0
|
|
557
|
-
};
|
|
558
|
-
};
|
|
559
|
-
var createCollectDiagnosticsBroadcastHandler = (_) => {
|
|
560
|
-
return {
|
|
561
|
-
start: () => {
|
|
562
|
-
},
|
|
563
|
-
stop: () => {
|
|
564
|
-
}
|
|
565
|
-
};
|
|
566
|
-
};
|
|
567
|
-
|
|
568
560
|
// src/packlets/diagnostics/diagnostics-collector.ts
|
|
569
561
|
import { ClientServicesProviderResource } from "@dxos/client-protocol";
|
|
570
562
|
import { ConfigResource } from "@dxos/config";
|
|
@@ -604,6 +596,15 @@ var findConfigs = () => {
|
|
|
604
596
|
return configs.map((r) => r.instance.deref()).filter(isNonNullable);
|
|
605
597
|
};
|
|
606
598
|
|
|
599
|
+
// src/packlets/diagnostics/index.ts
|
|
600
|
+
var diagnostics_exports = {};
|
|
601
|
+
__export(diagnostics_exports, {
|
|
602
|
+
DiagnosticsCollector: () => DiagnosticsCollector,
|
|
603
|
+
createDiagnostics: () => createDiagnostics
|
|
604
|
+
});
|
|
605
|
+
__reExport(diagnostics_exports, diagnostics_broadcast_star);
|
|
606
|
+
import * as diagnostics_broadcast_star from "#diagnostics-broadcast";
|
|
607
|
+
|
|
607
608
|
// src/packlets/identity/authenticator.ts
|
|
608
609
|
import { Trigger } from "@dxos/async";
|
|
609
610
|
import { Context as Context2 } from "@dxos/context";
|
|
@@ -1247,7 +1248,7 @@ import { Event as Event7, Mutex as Mutex2, scheduleTask as scheduleTask4, sleep
|
|
|
1247
1248
|
import { AUTH_TIMEOUT as AUTH_TIMEOUT2 } from "@dxos/client-protocol";
|
|
1248
1249
|
import { Context as Context6, ContextDisposedError, cancelWithContext as cancelWithContext2 } from "@dxos/context";
|
|
1249
1250
|
import { timed, warnAfterTimeout } from "@dxos/debug";
|
|
1250
|
-
import {
|
|
1251
|
+
import { createMappedFeedWriter } from "@dxos/echo-pipeline";
|
|
1251
1252
|
import { SpaceDocVersion as SpaceDocVersion2 } from "@dxos/echo-protocol";
|
|
1252
1253
|
import { failedInvariant as failedInvariant3, invariant as invariant11 } from "@dxos/invariant";
|
|
1253
1254
|
import { PublicKey as PublicKey8 } from "@dxos/keys";
|
|
@@ -1275,15 +1276,16 @@ import { ComplexSet } from "@dxos/util";
|
|
|
1275
1276
|
// src/packlets/spaces/data-space-manager.ts
|
|
1276
1277
|
import { interpretAsDocumentId } from "@automerge/automerge-repo";
|
|
1277
1278
|
import { Event as Event2, synchronized, trackLeaks } from "@dxos/async";
|
|
1278
|
-
import {
|
|
1279
|
+
import { SpaceProperties } from "@dxos/client-protocol";
|
|
1279
1280
|
import { Context as Context4, LifecycleState, Resource as Resource2, cancelWithContext } from "@dxos/context";
|
|
1280
1281
|
import { createAdmissionCredentials, getCredentialAssertion } from "@dxos/credentials";
|
|
1281
|
-
import {
|
|
1282
|
-
import {
|
|
1283
|
-
import {
|
|
1282
|
+
import { Type } from "@dxos/echo";
|
|
1283
|
+
import { getSchemaDXN } from "@dxos/echo/internal";
|
|
1284
|
+
import { AuthStatus, CredentialServerExtension, DatabaseRoot, findInlineObjectOfType } from "@dxos/echo-pipeline";
|
|
1285
|
+
import { EncodedReference, SpaceDocVersion, createIdFromSpaceKey } from "@dxos/echo-protocol";
|
|
1284
1286
|
import { writeMessages } from "@dxos/feed-store";
|
|
1285
1287
|
import { assertArgument, assertState, failedInvariant, invariant as invariant3 } from "@dxos/invariant";
|
|
1286
|
-
import { PublicKey as PublicKey4 } from "@dxos/keys";
|
|
1288
|
+
import { ObjectId, PublicKey as PublicKey4 } from "@dxos/keys";
|
|
1287
1289
|
import { log as log4 } from "@dxos/log";
|
|
1288
1290
|
import { AlreadyJoinedError, trace as Trace } from "@dxos/protocols";
|
|
1289
1291
|
import { Invitation, SpaceState } from "@dxos/protocols/proto/dxos/client/services";
|
|
@@ -1390,7 +1392,7 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1390
1392
|
_edgeFeatures = void 0;
|
|
1391
1393
|
_meshReplicator = void 0;
|
|
1392
1394
|
_echoEdgeReplicator = void 0;
|
|
1393
|
-
|
|
1395
|
+
_runtimeProps = void 0;
|
|
1394
1396
|
constructor(params) {
|
|
1395
1397
|
super();
|
|
1396
1398
|
this._spaceManager = params.spaceManager;
|
|
@@ -1405,17 +1407,20 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1405
1407
|
this._edgeFeatures = params.edgeFeatures;
|
|
1406
1408
|
this._echoEdgeReplicator = params.echoEdgeReplicator;
|
|
1407
1409
|
this._edgeHttpClient = params.edgeHttpClient;
|
|
1408
|
-
this.
|
|
1410
|
+
this._runtimeProps = params.runtimeProps;
|
|
1409
1411
|
trace.diagnostic({
|
|
1410
1412
|
id: "spaces",
|
|
1411
1413
|
name: "Spaces",
|
|
1412
1414
|
fetch: async () => {
|
|
1413
1415
|
return Promise.all(Array.from(this._spaces.values()).map(async (space) => {
|
|
1414
1416
|
const rootUrl = space.automergeSpaceState.rootUrl;
|
|
1415
|
-
const rootHandle = rootUrl ? await this._echoHost.
|
|
1417
|
+
const rootHandle = rootUrl ? await this._echoHost.loadDoc(Context4.default(void 0, {
|
|
1418
|
+
F: __dxlog_file6,
|
|
1419
|
+
L: 187
|
|
1420
|
+
}), rootUrl) : void 0;
|
|
1416
1421
|
await rootHandle?.whenReady();
|
|
1417
1422
|
const rootDoc = rootHandle?.doc();
|
|
1418
|
-
const properties = rootDoc && findInlineObjectOfType(rootDoc,
|
|
1423
|
+
const properties = rootDoc && findInlineObjectOfType(rootDoc, Type.getTypename(SpaceProperties));
|
|
1419
1424
|
return {
|
|
1420
1425
|
key: space.key.toHex(),
|
|
1421
1426
|
state: SpaceState[space.state],
|
|
@@ -1442,7 +1447,7 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1442
1447
|
async _open() {
|
|
1443
1448
|
log4("open", void 0, {
|
|
1444
1449
|
F: __dxlog_file6,
|
|
1445
|
-
L:
|
|
1450
|
+
L: 221,
|
|
1446
1451
|
S: this,
|
|
1447
1452
|
C: (f, a) => f(...a)
|
|
1448
1453
|
});
|
|
@@ -1450,7 +1455,7 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1450
1455
|
id: this._instanceId
|
|
1451
1456
|
}), {
|
|
1452
1457
|
F: __dxlog_file6,
|
|
1453
|
-
L:
|
|
1458
|
+
L: 222,
|
|
1454
1459
|
S: this,
|
|
1455
1460
|
C: (f, a) => f(...a)
|
|
1456
1461
|
});
|
|
@@ -1458,39 +1463,64 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1458
1463
|
spaces: this._metadataStore.spaces.length
|
|
1459
1464
|
}, {
|
|
1460
1465
|
F: __dxlog_file6,
|
|
1461
|
-
L:
|
|
1466
|
+
L: 223,
|
|
1462
1467
|
S: this,
|
|
1463
1468
|
C: (f, a) => f(...a)
|
|
1464
1469
|
});
|
|
1470
|
+
const spacesToActivate = [];
|
|
1465
1471
|
await forEachAsync(this._metadataStore.spaces, async (spaceMetadata) => {
|
|
1466
1472
|
try {
|
|
1467
1473
|
log4("load space", {
|
|
1468
1474
|
spaceMetadata
|
|
1469
1475
|
}, {
|
|
1470
1476
|
F: __dxlog_file6,
|
|
1471
|
-
L:
|
|
1477
|
+
L: 228,
|
|
1472
1478
|
S: this,
|
|
1473
1479
|
C: (f, a) => f(...a)
|
|
1474
1480
|
});
|
|
1475
|
-
await this._constructSpace(spaceMetadata);
|
|
1481
|
+
const space = await this._constructSpace(spaceMetadata);
|
|
1482
|
+
if (this._runtimeProps?.autoActivateSpaces && spaceMetadata.state === SpaceState.SPACE_ACTIVE) {
|
|
1483
|
+
spacesToActivate.push(space);
|
|
1484
|
+
}
|
|
1476
1485
|
} catch (err) {
|
|
1477
1486
|
log4.error("Error loading space", {
|
|
1478
1487
|
spaceMetadata,
|
|
1479
1488
|
err
|
|
1480
1489
|
}, {
|
|
1481
1490
|
F: __dxlog_file6,
|
|
1482
|
-
L:
|
|
1491
|
+
L: 235,
|
|
1483
1492
|
S: this,
|
|
1484
1493
|
C: (f, a) => f(...a)
|
|
1485
1494
|
});
|
|
1486
1495
|
}
|
|
1487
1496
|
});
|
|
1497
|
+
for (const space of spacesToActivate) {
|
|
1498
|
+
log4("auto-activating space", {
|
|
1499
|
+
spaceKey: space.key
|
|
1500
|
+
}, {
|
|
1501
|
+
F: __dxlog_file6,
|
|
1502
|
+
L: 241,
|
|
1503
|
+
S: this,
|
|
1504
|
+
C: (f, a) => f(...a)
|
|
1505
|
+
});
|
|
1506
|
+
space.activate().catch((err) => {
|
|
1507
|
+
log4.error("Error auto-activating space", {
|
|
1508
|
+
spaceKey: space.key,
|
|
1509
|
+
err
|
|
1510
|
+
}, {
|
|
1511
|
+
F: __dxlog_file6,
|
|
1512
|
+
L: 243,
|
|
1513
|
+
S: this,
|
|
1514
|
+
C: (f, a) => f(...a)
|
|
1515
|
+
});
|
|
1516
|
+
});
|
|
1517
|
+
}
|
|
1488
1518
|
this.updated.emit();
|
|
1489
1519
|
log4.trace("dxos.echo.data-space-manager.open", Trace.end({
|
|
1490
1520
|
id: this._instanceId
|
|
1491
1521
|
}), {
|
|
1492
1522
|
F: __dxlog_file6,
|
|
1493
|
-
L:
|
|
1523
|
+
L: 249,
|
|
1494
1524
|
S: this,
|
|
1495
1525
|
C: (f, a) => f(...a)
|
|
1496
1526
|
});
|
|
@@ -1498,7 +1528,7 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1498
1528
|
async _close() {
|
|
1499
1529
|
log4("close", void 0, {
|
|
1500
1530
|
F: __dxlog_file6,
|
|
1501
|
-
L:
|
|
1531
|
+
L: 254,
|
|
1502
1532
|
S: this,
|
|
1503
1533
|
C: (f, a) => f(...a)
|
|
1504
1534
|
});
|
|
@@ -1529,7 +1559,7 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1529
1559
|
spaceKey
|
|
1530
1560
|
}, {
|
|
1531
1561
|
F: __dxlog_file6,
|
|
1532
|
-
L:
|
|
1562
|
+
L: 287,
|
|
1533
1563
|
S: this,
|
|
1534
1564
|
C: (f, a) => f(...a)
|
|
1535
1565
|
});
|
|
@@ -1537,7 +1567,7 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1537
1567
|
if (options.documents) {
|
|
1538
1568
|
invariant3(Object.keys(options.documents).every((documentId) => /^[a-zA-Z0-9]+$/.test(documentId)), "Invalid document IDs", {
|
|
1539
1569
|
F: __dxlog_file6,
|
|
1540
|
-
L:
|
|
1570
|
+
L: 292,
|
|
1541
1571
|
S: this,
|
|
1542
1572
|
A: [
|
|
1543
1573
|
"Object.keys(options.documents).every((documentId) => /^[a-zA-Z0-9]+$/.test(documentId))",
|
|
@@ -1549,7 +1579,7 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1549
1579
|
documentId
|
|
1550
1580
|
}, {
|
|
1551
1581
|
F: __dxlog_file6,
|
|
1552
|
-
L:
|
|
1582
|
+
L: 299,
|
|
1553
1583
|
S: this,
|
|
1554
1584
|
C: (f, a) => f(...a)
|
|
1555
1585
|
});
|
|
@@ -1568,7 +1598,7 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1568
1598
|
spaceKey
|
|
1569
1599
|
}, {
|
|
1570
1600
|
F: __dxlog_file6,
|
|
1571
|
-
L:
|
|
1601
|
+
L: 317,
|
|
1572
1602
|
S: this,
|
|
1573
1603
|
C: (f, a) => f(...a)
|
|
1574
1604
|
});
|
|
@@ -1577,7 +1607,7 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1577
1607
|
const newRootDocId = documentIdMapping[interpretAsDocumentId(options.rootUrl)] ?? failedInvariant();
|
|
1578
1608
|
const rootDocHandle = await this._echoHost.loadDoc(Context4.default(void 0, {
|
|
1579
1609
|
F: __dxlog_file6,
|
|
1580
|
-
L:
|
|
1610
|
+
L: 322
|
|
1581
1611
|
}), newRootDocId);
|
|
1582
1612
|
DatabaseRoot.mapLinks(rootDocHandle, documentIdMapping);
|
|
1583
1613
|
root = await this._echoHost.openSpaceRoot(spaceId, `automerge:${newRootDocId}`);
|
|
@@ -1589,7 +1619,7 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1589
1619
|
spaceKey
|
|
1590
1620
|
}, {
|
|
1591
1621
|
F: __dxlog_file6,
|
|
1592
|
-
L:
|
|
1622
|
+
L: 331,
|
|
1593
1623
|
S: this,
|
|
1594
1624
|
C: (f, a) => f(...a)
|
|
1595
1625
|
});
|
|
@@ -1599,7 +1629,7 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1599
1629
|
spaceKey
|
|
1600
1630
|
}, {
|
|
1601
1631
|
F: __dxlog_file6,
|
|
1602
|
-
L:
|
|
1632
|
+
L: 336,
|
|
1603
1633
|
S: this,
|
|
1604
1634
|
C: (f, a) => f(...a)
|
|
1605
1635
|
});
|
|
@@ -1608,7 +1638,7 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1608
1638
|
const memberCredential = credentials[1];
|
|
1609
1639
|
invariant3(getCredentialAssertion(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
1610
1640
|
F: __dxlog_file6,
|
|
1611
|
-
L:
|
|
1641
|
+
L: 342,
|
|
1612
1642
|
S: this,
|
|
1613
1643
|
A: [
|
|
1614
1644
|
"getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -1622,7 +1652,7 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1622
1652
|
spaceKey
|
|
1623
1653
|
}, {
|
|
1624
1654
|
F: __dxlog_file6,
|
|
1625
|
-
L:
|
|
1655
|
+
L: 347,
|
|
1626
1656
|
S: this,
|
|
1627
1657
|
C: (f, a) => f(...a)
|
|
1628
1658
|
});
|
|
@@ -1640,13 +1670,13 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1640
1670
|
spaceId: space.id
|
|
1641
1671
|
}, {
|
|
1642
1672
|
F: __dxlog_file6,
|
|
1643
|
-
L:
|
|
1673
|
+
L: 360,
|
|
1644
1674
|
S: this,
|
|
1645
1675
|
C: (f, a) => f(...a)
|
|
1646
1676
|
});
|
|
1647
1677
|
await space.databaseRoot.handle.whenReady();
|
|
1648
1678
|
}
|
|
1649
|
-
const [_, properties] = findInlineObjectOfType(space.databaseRoot.doc(),
|
|
1679
|
+
const [_, properties] = findInlineObjectOfType(space.databaseRoot.doc(), Type.getTypename(SpaceProperties)) ?? [];
|
|
1650
1680
|
return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
|
|
1651
1681
|
}
|
|
1652
1682
|
case SpaceDocVersion.LEGACY: {
|
|
@@ -1658,7 +1688,7 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1658
1688
|
spaceId: space.id
|
|
1659
1689
|
}, {
|
|
1660
1690
|
F: __dxlog_file6,
|
|
1661
|
-
L:
|
|
1691
|
+
L: 374,
|
|
1662
1692
|
S: this,
|
|
1663
1693
|
C: (f, a) => f(...a)
|
|
1664
1694
|
});
|
|
@@ -1670,7 +1700,7 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1670
1700
|
const document = await this._getSpaceRootDocument(space);
|
|
1671
1701
|
const properties = {
|
|
1672
1702
|
system: {
|
|
1673
|
-
type:
|
|
1703
|
+
type: EncodedReference.fromDXN(getSchemaDXN(SpaceProperties))
|
|
1674
1704
|
},
|
|
1675
1705
|
data: {
|
|
1676
1706
|
[DEFAULT_SPACE_KEY]: this._signingContext.identityKey.toHex()
|
|
@@ -1693,14 +1723,19 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1693
1723
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
1694
1724
|
invariant3(automergeIndex, void 0, {
|
|
1695
1725
|
F: __dxlog_file6,
|
|
1696
|
-
L:
|
|
1726
|
+
L: 407,
|
|
1697
1727
|
S: this,
|
|
1698
1728
|
A: [
|
|
1699
1729
|
"automergeIndex",
|
|
1700
1730
|
""
|
|
1701
1731
|
]
|
|
1702
1732
|
});
|
|
1703
|
-
const document = await this._echoHost.
|
|
1733
|
+
const document = await this._echoHost.loadDoc(Context4.default(void 0, {
|
|
1734
|
+
F: __dxlog_file6,
|
|
1735
|
+
L: 408
|
|
1736
|
+
}), automergeIndex, {
|
|
1737
|
+
fetchFromNetwork: true
|
|
1738
|
+
});
|
|
1704
1739
|
await document.whenReady();
|
|
1705
1740
|
return document;
|
|
1706
1741
|
}
|
|
@@ -1710,13 +1745,13 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1710
1745
|
opts
|
|
1711
1746
|
}, {
|
|
1712
1747
|
F: __dxlog_file6,
|
|
1713
|
-
L:
|
|
1748
|
+
L: 418,
|
|
1714
1749
|
S: this,
|
|
1715
1750
|
C: (f, a) => f(...a)
|
|
1716
1751
|
});
|
|
1717
1752
|
invariant3(this._lifecycleState === LifecycleState.OPEN, "Not open.", {
|
|
1718
1753
|
F: __dxlog_file6,
|
|
1719
|
-
L:
|
|
1754
|
+
L: 419,
|
|
1720
1755
|
S: this,
|
|
1721
1756
|
A: [
|
|
1722
1757
|
"this._lifecycleState === LifecycleState.OPEN",
|
|
@@ -1725,7 +1760,7 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1725
1760
|
});
|
|
1726
1761
|
invariant3(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
1727
1762
|
F: __dxlog_file6,
|
|
1728
|
-
L:
|
|
1763
|
+
L: 420,
|
|
1729
1764
|
S: this,
|
|
1730
1765
|
A: [
|
|
1731
1766
|
"!this._spaces.has(opts.spaceKey)",
|
|
@@ -1749,7 +1784,7 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1749
1784
|
const space = this._spaceManager.spaces.get(options.spaceKey);
|
|
1750
1785
|
invariant3(space, void 0, {
|
|
1751
1786
|
F: __dxlog_file6,
|
|
1752
|
-
L:
|
|
1787
|
+
L: 440,
|
|
1753
1788
|
S: this,
|
|
1754
1789
|
A: [
|
|
1755
1790
|
"space",
|
|
@@ -1762,7 +1797,7 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1762
1797
|
const credentials = await createAdmissionCredentials(this._signingContext.credentialSigner, options.identityKey, space.key, space.genesisFeedKey, options.role, space.spaceState.membershipChainHeads, options.profile, options.delegationCredentialId);
|
|
1763
1798
|
invariant3(credentials[0].credential, void 0, {
|
|
1764
1799
|
F: __dxlog_file6,
|
|
1765
|
-
L:
|
|
1800
|
+
L: 459,
|
|
1766
1801
|
S: this,
|
|
1767
1802
|
A: [
|
|
1768
1803
|
"credentials[0].credential",
|
|
@@ -1772,7 +1807,7 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1772
1807
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
1773
1808
|
invariant3(getCredentialAssertion(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
1774
1809
|
F: __dxlog_file6,
|
|
1775
|
-
L:
|
|
1810
|
+
L: 461,
|
|
1776
1811
|
S: this,
|
|
1777
1812
|
A: [
|
|
1778
1813
|
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -1810,7 +1845,7 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1810
1845
|
const space = this._spaces.get(spaceKey);
|
|
1811
1846
|
invariant3(space, "Space not found.", {
|
|
1812
1847
|
F: __dxlog_file6,
|
|
1813
|
-
L:
|
|
1848
|
+
L: 498,
|
|
1814
1849
|
S: this,
|
|
1815
1850
|
A: [
|
|
1816
1851
|
"space",
|
|
@@ -1835,7 +1870,7 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1835
1870
|
metadata
|
|
1836
1871
|
}, {
|
|
1837
1872
|
F: __dxlog_file6,
|
|
1838
|
-
L:
|
|
1873
|
+
L: 517,
|
|
1839
1874
|
S: this,
|
|
1840
1875
|
C: (f, a) => f(...a)
|
|
1841
1876
|
});
|
|
@@ -1843,8 +1878,8 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1843
1878
|
localPeerId: this._signingContext.deviceKey
|
|
1844
1879
|
});
|
|
1845
1880
|
const presence = new Presence({
|
|
1846
|
-
announceInterval: this.
|
|
1847
|
-
offlineTimeout: this.
|
|
1881
|
+
announceInterval: this._runtimeProps?.spaceMemberPresenceAnnounceInterval ?? PRESENCE_ANNOUNCE_INTERVAL,
|
|
1882
|
+
offlineTimeout: this._runtimeProps?.spaceMemberPresenceOfflineTimeout ?? PRESENCE_OFFLINE_TIMEOUT,
|
|
1848
1883
|
identityKey: this._signingContext.identityKey,
|
|
1849
1884
|
gossip
|
|
1850
1885
|
});
|
|
@@ -1879,7 +1914,7 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1879
1914
|
err
|
|
1880
1915
|
}, {
|
|
1881
1916
|
F: __dxlog_file6,
|
|
1882
|
-
L:
|
|
1917
|
+
L: 559,
|
|
1883
1918
|
S: this,
|
|
1884
1919
|
C: (f, a) => f(...a)
|
|
1885
1920
|
});
|
|
@@ -1889,7 +1924,7 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1889
1924
|
onAuthFailure: () => {
|
|
1890
1925
|
log4.warn("auth failure", void 0, {
|
|
1891
1926
|
F: __dxlog_file6,
|
|
1892
|
-
L:
|
|
1927
|
+
L: 564,
|
|
1893
1928
|
S: this,
|
|
1894
1929
|
C: (f, a) => f(...a)
|
|
1895
1930
|
});
|
|
@@ -1922,7 +1957,7 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1922
1957
|
space: space.key
|
|
1923
1958
|
}, {
|
|
1924
1959
|
F: __dxlog_file6,
|
|
1925
|
-
L:
|
|
1960
|
+
L: 591,
|
|
1926
1961
|
S: this,
|
|
1927
1962
|
C: (f, a) => f(...a)
|
|
1928
1963
|
});
|
|
@@ -1933,7 +1968,7 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1933
1968
|
open: this._lifecycleState === LifecycleState.OPEN
|
|
1934
1969
|
}, {
|
|
1935
1970
|
F: __dxlog_file6,
|
|
1936
|
-
L:
|
|
1971
|
+
L: 594,
|
|
1937
1972
|
S: this,
|
|
1938
1973
|
C: (f, a) => f(...a)
|
|
1939
1974
|
});
|
|
@@ -1952,7 +1987,7 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1952
1987
|
space: space.key
|
|
1953
1988
|
}, {
|
|
1954
1989
|
F: __dxlog_file6,
|
|
1955
|
-
L:
|
|
1990
|
+
L: 602,
|
|
1956
1991
|
S: this,
|
|
1957
1992
|
C: (f, a) => f(...a)
|
|
1958
1993
|
});
|
|
@@ -1962,7 +1997,7 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1962
1997
|
edgeConnection: this._edgeConnection,
|
|
1963
1998
|
edgeHttpClient: this._edgeHttpClient,
|
|
1964
1999
|
edgeFeatures: this._edgeFeatures,
|
|
1965
|
-
activeEdgeNotarizationPollingInterval: this.
|
|
2000
|
+
activeEdgeNotarizationPollingInterval: this._runtimeProps?.activeEdgeNotarizationPollingInterval
|
|
1966
2001
|
});
|
|
1967
2002
|
dataSpace.postOpen.append(async () => {
|
|
1968
2003
|
const setting = dataSpace.getEdgeReplicationSetting();
|
|
@@ -1973,7 +2008,7 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
1973
2008
|
spaceId: dataSpace.id
|
|
1974
2009
|
}, {
|
|
1975
2010
|
F: __dxlog_file6,
|
|
1976
|
-
L:
|
|
2011
|
+
L: 616,
|
|
1977
2012
|
S: this,
|
|
1978
2013
|
C: (f, a) => f(...a)
|
|
1979
2014
|
});
|
|
@@ -2003,7 +2038,7 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
2003
2038
|
space: space.key
|
|
2004
2039
|
}, {
|
|
2005
2040
|
F: __dxlog_file6,
|
|
2006
|
-
L:
|
|
2041
|
+
L: 643,
|
|
2007
2042
|
S: this,
|
|
2008
2043
|
C: (f, a) => f(...a)
|
|
2009
2044
|
});
|
|
@@ -2036,7 +2071,7 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
2036
2071
|
closedSessions
|
|
2037
2072
|
}, {
|
|
2038
2073
|
F: __dxlog_file6,
|
|
2039
|
-
L:
|
|
2074
|
+
L: 669,
|
|
2040
2075
|
S: this,
|
|
2041
2076
|
C: (f, a) => f(...a)
|
|
2042
2077
|
});
|
|
@@ -2051,7 +2086,7 @@ var DataSpaceManager = class extends Resource2 {
|
|
|
2051
2086
|
peerId: peerState.peerId
|
|
2052
2087
|
}, {
|
|
2053
2088
|
F: __dxlog_file6,
|
|
2054
|
-
L:
|
|
2089
|
+
L: 683,
|
|
2055
2090
|
S: this,
|
|
2056
2091
|
C: (f, a) => f(...a)
|
|
2057
2092
|
});
|
|
@@ -2128,6 +2163,7 @@ import { trace as trace2 } from "@dxos/tracing";
|
|
|
2128
2163
|
import { Resource as Resource3 } from "@dxos/context";
|
|
2129
2164
|
import { assertArgument as assertArgument2, assertState as assertState2 } from "@dxos/invariant";
|
|
2130
2165
|
import { SpaceArchiveFileStructure, SpaceArchiveVersion } from "@dxos/protocols";
|
|
2166
|
+
import { createFilename } from "@dxos/util";
|
|
2131
2167
|
var CURRENT_VERSION = SpaceArchiveVersion.V1;
|
|
2132
2168
|
var SpaceArchiveWriter = class extends Resource3 {
|
|
2133
2169
|
_tar;
|
|
@@ -2160,6 +2196,7 @@ var SpaceArchiveWriter = class extends Resource3 {
|
|
|
2160
2196
|
async finish() {
|
|
2161
2197
|
assertState2(this._archive, "Not open");
|
|
2162
2198
|
assertState2(this._meta, "Not started");
|
|
2199
|
+
assertState2(this._meta.spaceId, "No space ID set");
|
|
2163
2200
|
assertState2(this._currentRootUrl, "No root URL set");
|
|
2164
2201
|
const metadata = {
|
|
2165
2202
|
version: CURRENT_VERSION,
|
|
@@ -2173,7 +2210,12 @@ var SpaceArchiveWriter = class extends Resource3 {
|
|
|
2173
2210
|
this._archive.addTextFile(SpaceArchiveFileStructure.metadata, JSON.stringify(metadata));
|
|
2174
2211
|
const binary = this._archive.toUint8Array();
|
|
2175
2212
|
return {
|
|
2176
|
-
filename:
|
|
2213
|
+
filename: createFilename({
|
|
2214
|
+
parts: [
|
|
2215
|
+
this._meta.spaceId
|
|
2216
|
+
],
|
|
2217
|
+
ext: "tar"
|
|
2218
|
+
}),
|
|
2177
2219
|
contents: binary
|
|
2178
2220
|
};
|
|
2179
2221
|
}
|
|
@@ -2204,7 +2246,7 @@ var extractSpaceArchive = async (archive) => {
|
|
|
2204
2246
|
});
|
|
2205
2247
|
documents[documentId] = entry2.content ?? failedInvariant2();
|
|
2206
2248
|
}
|
|
2207
|
-
log5
|
|
2249
|
+
log5("extracted space archive", {
|
|
2208
2250
|
metadata,
|
|
2209
2251
|
documents
|
|
2210
2252
|
}, {
|
|
@@ -2314,7 +2356,9 @@ var SpacesServiceImpl = class {
|
|
|
2314
2356
|
await space.deactivate();
|
|
2315
2357
|
break;
|
|
2316
2358
|
default:
|
|
2317
|
-
throw new ApiError(
|
|
2359
|
+
throw new ApiError({
|
|
2360
|
+
message: "Invalid space state"
|
|
2361
|
+
});
|
|
2318
2362
|
}
|
|
2319
2363
|
}
|
|
2320
2364
|
if (edgeReplication !== void 0) {
|
|
@@ -2328,15 +2372,18 @@ var SpacesServiceImpl = class {
|
|
|
2328
2372
|
throw new SpaceNotFoundError(request.spaceKey);
|
|
2329
2373
|
}
|
|
2330
2374
|
if (!space.spaceState.hasMembershipManagementPermission(identity.identityKey)) {
|
|
2331
|
-
throw new AuthorizationError(
|
|
2332
|
-
|
|
2333
|
-
|
|
2375
|
+
throw new AuthorizationError({
|
|
2376
|
+
message: "No member management permission.",
|
|
2377
|
+
context: {
|
|
2378
|
+
spaceKey: space.key,
|
|
2379
|
+
role: space.spaceState.getMemberRole(identity.identityKey)
|
|
2380
|
+
}
|
|
2334
2381
|
});
|
|
2335
2382
|
}
|
|
2336
2383
|
const credentials = await createAdmissionCredentials2(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
|
|
2337
2384
|
invariant5(credentials[0].credential, void 0, {
|
|
2338
2385
|
F: __dxlog_file8,
|
|
2339
|
-
L:
|
|
2386
|
+
L: 123,
|
|
2340
2387
|
S: this,
|
|
2341
2388
|
A: [
|
|
2342
2389
|
"credentials[0].credential",
|
|
@@ -2346,7 +2393,7 @@ var SpacesServiceImpl = class {
|
|
|
2346
2393
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
2347
2394
|
invariant5(getCredentialAssertion2(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
2348
2395
|
F: __dxlog_file8,
|
|
2349
|
-
L:
|
|
2396
|
+
L: 125,
|
|
2350
2397
|
S: this,
|
|
2351
2398
|
A: [
|
|
2352
2399
|
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2364,7 +2411,7 @@ var SpacesServiceImpl = class {
|
|
|
2364
2411
|
ids: spaces.map((space) => space.id)
|
|
2365
2412
|
}), {
|
|
2366
2413
|
F: __dxlog_file8,
|
|
2367
|
-
L:
|
|
2414
|
+
L: 138,
|
|
2368
2415
|
S: this,
|
|
2369
2416
|
C: (f, a) => f(...a)
|
|
2370
2417
|
});
|
|
@@ -2456,7 +2503,7 @@ var SpacesServiceImpl = class {
|
|
|
2456
2503
|
} else {
|
|
2457
2504
|
invariant5(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
2458
2505
|
F: __dxlog_file8,
|
|
2459
|
-
L:
|
|
2506
|
+
L: 236,
|
|
2460
2507
|
S: this,
|
|
2461
2508
|
A: [
|
|
2462
2509
|
"!credential.id",
|
|
@@ -2465,7 +2512,7 @@ var SpacesServiceImpl = class {
|
|
|
2465
2512
|
});
|
|
2466
2513
|
invariant5(this._identityManager.identity, "Identity is not available", {
|
|
2467
2514
|
F: __dxlog_file8,
|
|
2468
|
-
L:
|
|
2515
|
+
L: 237,
|
|
2469
2516
|
S: this,
|
|
2470
2517
|
A: [
|
|
2471
2518
|
"this._identityManager.identity",
|
|
@@ -2475,7 +2522,7 @@ var SpacesServiceImpl = class {
|
|
|
2475
2522
|
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
2476
2523
|
invariant5(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
2477
2524
|
F: __dxlog_file8,
|
|
2478
|
-
L:
|
|
2525
|
+
L: 239,
|
|
2479
2526
|
S: this,
|
|
2480
2527
|
A: [
|
|
2481
2528
|
"credential.issuer.equals(signer.getIssuer())",
|
|
@@ -2558,7 +2605,7 @@ var SpacesServiceImpl = class {
|
|
|
2558
2605
|
const extracted = await extractSpaceArchive(request.archive);
|
|
2559
2606
|
invariant5(extracted.metadata.echo?.currentRootUrl, "Space archive does not contain a root URL", {
|
|
2560
2607
|
F: __dxlog_file8,
|
|
2561
|
-
L:
|
|
2608
|
+
L: 293,
|
|
2562
2609
|
S: this,
|
|
2563
2610
|
A: [
|
|
2564
2611
|
"extracted.metadata.echo?.currentRootUrl",
|
|
@@ -2578,7 +2625,7 @@ var SpacesServiceImpl = class {
|
|
|
2578
2625
|
const assertion = getCredentialAssertion2(credential);
|
|
2579
2626
|
invariant5(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
2580
2627
|
F: __dxlog_file8,
|
|
2581
|
-
L:
|
|
2628
|
+
L: 304,
|
|
2582
2629
|
S: this,
|
|
2583
2630
|
A: [
|
|
2584
2631
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2588,7 +2635,7 @@ var SpacesServiceImpl = class {
|
|
|
2588
2635
|
const myIdentity = this._identityManager.identity;
|
|
2589
2636
|
invariant5(myIdentity && credential.subject.id.equals(myIdentity.identityKey), void 0, {
|
|
2590
2637
|
F: __dxlog_file8,
|
|
2591
|
-
L:
|
|
2638
|
+
L: 306,
|
|
2592
2639
|
S: this,
|
|
2593
2640
|
A: [
|
|
2594
2641
|
"myIdentity && credential.subject.id.equals(myIdentity.identityKey)",
|
|
@@ -2657,7 +2704,9 @@ var SpacesServiceImpl = class {
|
|
|
2657
2704
|
}
|
|
2658
2705
|
_requireIdentity() {
|
|
2659
2706
|
if (!this._identityManager.identity) {
|
|
2660
|
-
throw new IdentityNotInitializedError(
|
|
2707
|
+
throw new IdentityNotInitializedError({
|
|
2708
|
+
message: "This device has no HALO identity available. See https://docs.dxos.org/guide/platform/halo"
|
|
2709
|
+
});
|
|
2661
2710
|
}
|
|
2662
2711
|
return this._identityManager.identity;
|
|
2663
2712
|
}
|
|
@@ -3697,7 +3746,7 @@ var LOAD_DOC_TIMEOUT = 1e4;
|
|
|
3697
3746
|
var runEpochMigration = async (ctx, context) => {
|
|
3698
3747
|
switch (context.migration) {
|
|
3699
3748
|
case CreateEpochRequest.Migration.INIT_AUTOMERGE: {
|
|
3700
|
-
const document = context.echoHost.createDoc();
|
|
3749
|
+
const document = await context.echoHost.createDoc();
|
|
3701
3750
|
await context.echoHost.flush();
|
|
3702
3751
|
return {
|
|
3703
3752
|
newRoot: document.url
|
|
@@ -3710,7 +3759,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3710
3759
|
const rootHandle = await context.echoHost.loadDoc(ctx, context.currentRoot, {
|
|
3711
3760
|
timeout: LOAD_DOC_TIMEOUT
|
|
3712
3761
|
});
|
|
3713
|
-
const newRoot = context.echoHost.createDoc(rootHandle.doc());
|
|
3762
|
+
const newRoot = await context.echoHost.createDoc(rootHandle.doc());
|
|
3714
3763
|
await context.echoHost.flush();
|
|
3715
3764
|
return {
|
|
3716
3765
|
newRoot: newRoot.url
|
|
@@ -4150,7 +4199,7 @@ _ts_decorate5([
|
|
|
4150
4199
|
logInfo2
|
|
4151
4200
|
], NotarizationPlugin.prototype, "_spaceId", void 0);
|
|
4152
4201
|
var handleEdgeError = (error) => {
|
|
4153
|
-
if (!(error instanceof EdgeCallFailedError) || error.
|
|
4202
|
+
if (!(error instanceof EdgeCallFailedError) || error.data) {
|
|
4154
4203
|
log11.catch(error, void 0, {
|
|
4155
4204
|
F: __dxlog_file14,
|
|
4156
4205
|
L: 396,
|
|
@@ -4159,7 +4208,7 @@ var handleEdgeError = (error) => {
|
|
|
4159
4208
|
});
|
|
4160
4209
|
} else {
|
|
4161
4210
|
log11.info("Edge notarization failure", {
|
|
4162
|
-
|
|
4211
|
+
message: error.message
|
|
4163
4212
|
}, {
|
|
4164
4213
|
F: __dxlog_file14,
|
|
4165
4214
|
L: 398,
|
|
@@ -4275,7 +4324,7 @@ var __dxlog_file15 = "/__w/dxos/dxos/packages/sdk/client-services/src/packlets/s
|
|
|
4275
4324
|
var DataSpace = class {
|
|
4276
4325
|
_ctx = new Context6(void 0, {
|
|
4277
4326
|
F: __dxlog_file15,
|
|
4278
|
-
L:
|
|
4327
|
+
L: 100
|
|
4279
4328
|
});
|
|
4280
4329
|
_inner;
|
|
4281
4330
|
_gossip;
|
|
@@ -4337,7 +4386,7 @@ var DataSpace = class {
|
|
|
4337
4386
|
state: SpaceState4[this._state]
|
|
4338
4387
|
}, {
|
|
4339
4388
|
F: __dxlog_file15,
|
|
4340
|
-
L:
|
|
4389
|
+
L: 176,
|
|
4341
4390
|
S: this,
|
|
4342
4391
|
C: (f, a) => f(...a)
|
|
4343
4392
|
});
|
|
@@ -4396,7 +4445,7 @@ var DataSpace = class {
|
|
|
4396
4445
|
}
|
|
4397
4446
|
await this._inner.open(new Context6(void 0, {
|
|
4398
4447
|
F: __dxlog_file15,
|
|
4399
|
-
L:
|
|
4448
|
+
L: 250
|
|
4400
4449
|
}));
|
|
4401
4450
|
await this._inner.startProtocol();
|
|
4402
4451
|
await this._edgeFeedReplicator?.open();
|
|
@@ -4405,7 +4454,7 @@ var DataSpace = class {
|
|
|
4405
4454
|
state: SpaceState4[this._state]
|
|
4406
4455
|
}, {
|
|
4407
4456
|
F: __dxlog_file15,
|
|
4408
|
-
L:
|
|
4457
|
+
L: 256,
|
|
4409
4458
|
S: this,
|
|
4410
4459
|
C: (f, a) => f(...a)
|
|
4411
4460
|
});
|
|
@@ -4425,14 +4474,14 @@ var DataSpace = class {
|
|
|
4425
4474
|
state: SpaceState4[this._state]
|
|
4426
4475
|
}, {
|
|
4427
4476
|
F: __dxlog_file15,
|
|
4428
|
-
L:
|
|
4477
|
+
L: 275,
|
|
4429
4478
|
S: this,
|
|
4430
4479
|
C: (f, a) => f(...a)
|
|
4431
4480
|
});
|
|
4432
4481
|
await this._ctx.dispose();
|
|
4433
4482
|
this._ctx = new Context6(void 0, {
|
|
4434
4483
|
F: __dxlog_file15,
|
|
4435
|
-
L:
|
|
4484
|
+
L: 277
|
|
4436
4485
|
});
|
|
4437
4486
|
if (this._edgeFeedReplicator) {
|
|
4438
4487
|
this.inner.protocol.feedAdded.remove(this._onFeedAdded);
|
|
@@ -4465,7 +4514,7 @@ var DataSpace = class {
|
|
|
4465
4514
|
if (err instanceof CancelledError || err instanceof ContextDisposedError) {
|
|
4466
4515
|
log12("data pipeline initialization cancelled", err, {
|
|
4467
4516
|
F: __dxlog_file15,
|
|
4468
|
-
L:
|
|
4517
|
+
L: 315,
|
|
4469
4518
|
S: this,
|
|
4470
4519
|
C: (f, a) => f(...a)
|
|
4471
4520
|
});
|
|
@@ -4473,7 +4522,7 @@ var DataSpace = class {
|
|
|
4473
4522
|
}
|
|
4474
4523
|
log12.error("Error initializing data pipeline", err, {
|
|
4475
4524
|
F: __dxlog_file15,
|
|
4476
|
-
L:
|
|
4525
|
+
L: 319,
|
|
4477
4526
|
S: this,
|
|
4478
4527
|
C: (f, a) => f(...a)
|
|
4479
4528
|
});
|
|
@@ -4482,7 +4531,7 @@ var DataSpace = class {
|
|
|
4482
4531
|
state: SpaceState4[this._state]
|
|
4483
4532
|
}, {
|
|
4484
4533
|
F: __dxlog_file15,
|
|
4485
|
-
L:
|
|
4534
|
+
L: 321,
|
|
4486
4535
|
S: this,
|
|
4487
4536
|
C: (f, a) => f(...a)
|
|
4488
4537
|
});
|
|
@@ -4495,20 +4544,22 @@ var DataSpace = class {
|
|
|
4495
4544
|
}
|
|
4496
4545
|
async initializeDataPipeline() {
|
|
4497
4546
|
if (this._state !== SpaceState4.SPACE_CONTROL_ONLY) {
|
|
4498
|
-
throw new SystemError(
|
|
4547
|
+
throw new SystemError({
|
|
4548
|
+
message: "Invalid operation"
|
|
4549
|
+
});
|
|
4499
4550
|
}
|
|
4500
4551
|
this._state = SpaceState4.SPACE_INITIALIZING;
|
|
4501
4552
|
log12("new state", {
|
|
4502
4553
|
state: SpaceState4[this._state]
|
|
4503
4554
|
}, {
|
|
4504
4555
|
F: __dxlog_file15,
|
|
4505
|
-
L:
|
|
4556
|
+
L: 337,
|
|
4506
4557
|
S: this,
|
|
4507
4558
|
C: (f, a) => f(...a)
|
|
4508
4559
|
});
|
|
4509
4560
|
log12("initializing control pipeline", void 0, {
|
|
4510
4561
|
F: __dxlog_file15,
|
|
4511
|
-
L:
|
|
4562
|
+
L: 339,
|
|
4512
4563
|
S: this,
|
|
4513
4564
|
C: (f, a) => f(...a)
|
|
4514
4565
|
});
|
|
@@ -4517,21 +4568,21 @@ var DataSpace = class {
|
|
|
4517
4568
|
const ready = this.stateUpdate.waitForCondition(() => this._state === SpaceState4.SPACE_READY);
|
|
4518
4569
|
log12("initializing automerge root", void 0, {
|
|
4519
4570
|
F: __dxlog_file15,
|
|
4520
|
-
L:
|
|
4571
|
+
L: 347,
|
|
4521
4572
|
S: this,
|
|
4522
4573
|
C: (f, a) => f(...a)
|
|
4523
4574
|
});
|
|
4524
4575
|
this._automergeSpaceState.startProcessingRootDocs();
|
|
4525
4576
|
log12("waiting for space to be ready", void 0, {
|
|
4526
4577
|
F: __dxlog_file15,
|
|
4527
|
-
L:
|
|
4578
|
+
L: 351,
|
|
4528
4579
|
S: this,
|
|
4529
4580
|
C: (f, a) => f(...a)
|
|
4530
4581
|
});
|
|
4531
4582
|
await ready;
|
|
4532
4583
|
log12("space is ready", void 0, {
|
|
4533
4584
|
F: __dxlog_file15,
|
|
4534
|
-
L:
|
|
4585
|
+
L: 353,
|
|
4535
4586
|
S: this,
|
|
4536
4587
|
C: (f, a) => f(...a)
|
|
4537
4588
|
});
|
|
@@ -4539,7 +4590,7 @@ var DataSpace = class {
|
|
|
4539
4590
|
async *getAllDocuments() {
|
|
4540
4591
|
invariant11(this._databaseRoot, "Space is not ready", {
|
|
4541
4592
|
F: __dxlog_file15,
|
|
4542
|
-
L:
|
|
4593
|
+
L: 357,
|
|
4543
4594
|
S: this,
|
|
4544
4595
|
A: [
|
|
4545
4596
|
"this._databaseRoot",
|
|
@@ -4555,7 +4606,7 @@ var DataSpace = class {
|
|
|
4555
4606
|
for (const documentUrl of this._databaseRoot.getAllLinkedDocuments()) {
|
|
4556
4607
|
const data = await this._echoHost.exportDoc(Context6.default(void 0, {
|
|
4557
4608
|
F: __dxlog_file15,
|
|
4558
|
-
L:
|
|
4609
|
+
L: 363
|
|
4559
4610
|
}), documentUrl);
|
|
4560
4611
|
yield [
|
|
4561
4612
|
documentUrl.replace(/^automerge:/, ""),
|
|
@@ -4570,7 +4621,7 @@ var DataSpace = class {
|
|
|
4570
4621
|
state: SpaceState4[this._state]
|
|
4571
4622
|
}, {
|
|
4572
4623
|
F: __dxlog_file15,
|
|
4573
|
-
L:
|
|
4624
|
+
L: 372,
|
|
4574
4625
|
S: this,
|
|
4575
4626
|
C: (f, a) => f(...a)
|
|
4576
4627
|
});
|
|
@@ -4587,7 +4638,7 @@ var DataSpace = class {
|
|
|
4587
4638
|
await this._createWritableFeeds();
|
|
4588
4639
|
log12("writable feeds created", void 0, {
|
|
4589
4640
|
F: __dxlog_file15,
|
|
4590
|
-
L:
|
|
4641
|
+
L: 389,
|
|
4591
4642
|
S: this,
|
|
4592
4643
|
C: (f, a) => f(...a)
|
|
4593
4644
|
});
|
|
@@ -4641,7 +4692,7 @@ var DataSpace = class {
|
|
|
4641
4692
|
count: credentials.length
|
|
4642
4693
|
}, {
|
|
4643
4694
|
F: __dxlog_file15,
|
|
4644
|
-
L:
|
|
4695
|
+
L: 447,
|
|
4645
4696
|
S: this,
|
|
4646
4697
|
C: (f, a) => f(...a)
|
|
4647
4698
|
});
|
|
@@ -4652,14 +4703,14 @@ var DataSpace = class {
|
|
|
4652
4703
|
});
|
|
4653
4704
|
log12("credentials notarized", void 0, {
|
|
4654
4705
|
F: __dxlog_file15,
|
|
4655
|
-
L:
|
|
4706
|
+
L: 451,
|
|
4656
4707
|
S: this,
|
|
4657
4708
|
C: (f, a) => f(...a)
|
|
4658
4709
|
});
|
|
4659
4710
|
} catch (err) {
|
|
4660
4711
|
log12.error("error notarizing credentials for feed admission", err, {
|
|
4661
4712
|
F: __dxlog_file15,
|
|
4662
|
-
L:
|
|
4713
|
+
L: 453,
|
|
4663
4714
|
S: this,
|
|
4664
4715
|
C: (f, a) => f(...a)
|
|
4665
4716
|
});
|
|
@@ -4674,7 +4725,7 @@ var DataSpace = class {
|
|
|
4674
4725
|
rootUrl
|
|
4675
4726
|
}, {
|
|
4676
4727
|
F: __dxlog_file15,
|
|
4677
|
-
L:
|
|
4728
|
+
L: 463,
|
|
4678
4729
|
S: this,
|
|
4679
4730
|
C: (f, a) => f(...a)
|
|
4680
4731
|
});
|
|
@@ -4688,7 +4739,12 @@ var DataSpace = class {
|
|
|
4688
4739
|
};
|
|
4689
4740
|
try {
|
|
4690
4741
|
await warnAfterTimeout(5e3, "Automerge root doc load timeout (DataSpace)", async () => {
|
|
4691
|
-
handle = await cancelWithContext2(this._ctx, this._echoHost.
|
|
4742
|
+
handle = await cancelWithContext2(this._ctx, this._echoHost.loadDoc(Context6.default(void 0, {
|
|
4743
|
+
F: __dxlog_file15,
|
|
4744
|
+
L: 473
|
|
4745
|
+
}), rootUrl, {
|
|
4746
|
+
fetchFromNetwork: true
|
|
4747
|
+
}));
|
|
4692
4748
|
await cancelWithContext2(this._ctx, handle.whenReady());
|
|
4693
4749
|
});
|
|
4694
4750
|
if (this._ctx.disposed) {
|
|
@@ -4729,7 +4785,7 @@ var DataSpace = class {
|
|
|
4729
4785
|
err
|
|
4730
4786
|
}, {
|
|
4731
4787
|
F: __dxlog_file15,
|
|
4732
|
-
L:
|
|
4788
|
+
L: 512,
|
|
4733
4789
|
S: this,
|
|
4734
4790
|
C: (f, a) => f(...a)
|
|
4735
4791
|
});
|
|
@@ -4819,7 +4875,7 @@ var DataSpace = class {
|
|
|
4819
4875
|
state: SpaceState4[this._state]
|
|
4820
4876
|
}, {
|
|
4821
4877
|
F: __dxlog_file15,
|
|
4822
|
-
L:
|
|
4878
|
+
L: 594,
|
|
4823
4879
|
S: this,
|
|
4824
4880
|
C: (f, a) => f(...a)
|
|
4825
4881
|
});
|
|
@@ -4950,7 +5006,9 @@ var DeviceInvitationProtocol = class {
|
|
|
4950
5006
|
try {
|
|
4951
5007
|
const identity = this._getIdentity();
|
|
4952
5008
|
if (identity) {
|
|
4953
|
-
return new AlreadyJoinedError2(
|
|
5009
|
+
return new AlreadyJoinedError2({
|
|
5010
|
+
message: "Currently only one identity per client is supported."
|
|
5011
|
+
});
|
|
4954
5012
|
}
|
|
4955
5013
|
} catch {
|
|
4956
5014
|
}
|
|
@@ -5321,10 +5379,12 @@ var InvitationGuestExtension = class extends RpcExtension2 {
|
|
|
5321
5379
|
C: (f, a) => f(...a)
|
|
5322
5380
|
});
|
|
5323
5381
|
if (this._remoteOptions?.role !== InvitationOptions.Role.HOST) {
|
|
5324
|
-
throw new InvalidInvitationExtensionRoleError(
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5382
|
+
throw new InvalidInvitationExtensionRoleError({
|
|
5383
|
+
context: {
|
|
5384
|
+
expected: InvitationOptions.Role.HOST,
|
|
5385
|
+
remoteOptions: this._remoteOptions,
|
|
5386
|
+
remotePeerId: context.remotePeerId
|
|
5387
|
+
}
|
|
5328
5388
|
});
|
|
5329
5389
|
}
|
|
5330
5390
|
this._callbacks.onOpen(this._ctx, context);
|
|
@@ -5350,7 +5410,7 @@ var InvitationGuestExtension = class extends RpcExtension2 {
|
|
|
5350
5410
|
this._invitationFlowLock = null;
|
|
5351
5411
|
log14.verbose("invitation flow lock released", void 0, {
|
|
5352
5412
|
F: __dxlog_file18,
|
|
5353
|
-
L:
|
|
5413
|
+
L: 133,
|
|
5354
5414
|
S: this,
|
|
5355
5415
|
C: (f, a) => f(...a)
|
|
5356
5416
|
});
|
|
@@ -5656,10 +5716,12 @@ var InvitationHostExtension = class extends RpcExtension3 {
|
|
|
5656
5716
|
C: (f, a) => f(...a)
|
|
5657
5717
|
});
|
|
5658
5718
|
if (this._remoteOptions?.role !== InvitationOptions2.Role.GUEST) {
|
|
5659
|
-
throw new InvalidInvitationExtensionRoleError2(
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5719
|
+
throw new InvalidInvitationExtensionRoleError2({
|
|
5720
|
+
context: {
|
|
5721
|
+
expected: InvitationOptions2.Role.GUEST,
|
|
5722
|
+
remoteOptions: this._remoteOptions,
|
|
5723
|
+
remotePeerId: context.remotePeerId
|
|
5724
|
+
}
|
|
5663
5725
|
});
|
|
5664
5726
|
}
|
|
5665
5727
|
this._callbacks.onStateUpdate(Invitation5.State.CONNECTED);
|
|
@@ -5704,7 +5766,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
|
|
|
5704
5766
|
this._invitationFlowLock = null;
|
|
5705
5767
|
log15.verbose("invitation flow lock released", void 0, {
|
|
5706
5768
|
F: __dxlog_file19,
|
|
5707
|
-
L:
|
|
5769
|
+
L: 301,
|
|
5708
5770
|
S: this,
|
|
5709
5771
|
C: (f, a) => f(...a)
|
|
5710
5772
|
});
|
|
@@ -5904,14 +5966,14 @@ var MAX_DELEGATED_INVITATION_HOST_TRIES = 3;
|
|
|
5904
5966
|
var InvitationsHandler = class {
|
|
5905
5967
|
_networkManager;
|
|
5906
5968
|
_edgeClient;
|
|
5907
|
-
|
|
5969
|
+
_connectionProps;
|
|
5908
5970
|
/**
|
|
5909
5971
|
* @internal
|
|
5910
5972
|
*/
|
|
5911
|
-
constructor(_networkManager, _edgeClient,
|
|
5973
|
+
constructor(_networkManager, _edgeClient, _connectionProps) {
|
|
5912
5974
|
this._networkManager = _networkManager;
|
|
5913
5975
|
this._edgeClient = _edgeClient;
|
|
5914
|
-
this.
|
|
5976
|
+
this._connectionProps = _connectionProps;
|
|
5915
5977
|
}
|
|
5916
5978
|
handleInvitationFlow(ctx, stream, protocol, invitation) {
|
|
5917
5979
|
log18.verbose("dxos.sdk.invitations-handler.handleInvitationFlow", {
|
|
@@ -6355,7 +6417,7 @@ var InvitationsHandler = class {
|
|
|
6355
6417
|
});
|
|
6356
6418
|
return extension;
|
|
6357
6419
|
};
|
|
6358
|
-
const edgeInvitationHandler = new EdgeInvitationHandler(this.
|
|
6420
|
+
const edgeInvitationHandler = new EdgeInvitationHandler(this._connectionProps?.edgeInvitations, this._edgeClient, {
|
|
6359
6421
|
onInvitationSuccess: async (admissionResponse, admissionRequest) => {
|
|
6360
6422
|
const result = await protocol.accept(admissionResponse, admissionRequest);
|
|
6361
6423
|
log18.info("admitted by edge", {
|
|
@@ -6415,7 +6477,7 @@ var InvitationsHandler = class {
|
|
|
6415
6477
|
topic: invitation.swarmKey,
|
|
6416
6478
|
protocolProvider: createTeleportProtocolFactory(async (teleport) => {
|
|
6417
6479
|
teleport.addExtension("dxos.halo.invitations", extensionFactory());
|
|
6418
|
-
}, this.
|
|
6480
|
+
}, this._connectionProps?.teleport),
|
|
6419
6481
|
topology: new InvitationTopology(role),
|
|
6420
6482
|
label
|
|
6421
6483
|
});
|
|
@@ -6487,7 +6549,9 @@ var InvitationsHandler = class {
|
|
|
6487
6549
|
var checkInvitation = (protocol, invitation) => {
|
|
6488
6550
|
const expiresOn = getExpirationTime(invitation);
|
|
6489
6551
|
if (expiresOn && expiresOn.getTime() < Date.now()) {
|
|
6490
|
-
return new InvalidInvitationError(
|
|
6552
|
+
return new InvalidInvitationError({
|
|
6553
|
+
message: "Invitation already expired."
|
|
6554
|
+
});
|
|
6491
6555
|
}
|
|
6492
6556
|
return protocol.checkInvitation(invitation);
|
|
6493
6557
|
};
|
|
@@ -6630,21 +6694,25 @@ var SpaceInvitationProtocol = class {
|
|
|
6630
6694
|
}
|
|
6631
6695
|
checkCanInviteNewMembers() {
|
|
6632
6696
|
if (this._spaceKey == null) {
|
|
6633
|
-
return new InvalidInvitationError2(
|
|
6697
|
+
return new InvalidInvitationError2({
|
|
6698
|
+
message: "No spaceKey was provided for a space invitation."
|
|
6699
|
+
});
|
|
6634
6700
|
}
|
|
6635
6701
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6636
6702
|
if (space == null) {
|
|
6637
6703
|
return new SpaceNotFoundError2(this._spaceKey);
|
|
6638
6704
|
}
|
|
6639
6705
|
if (!space?.inner.spaceState.hasMembershipManagementPermission(this._signingContext.identityKey)) {
|
|
6640
|
-
return new AuthorizationError2(
|
|
6706
|
+
return new AuthorizationError2({
|
|
6707
|
+
message: "No member management permission."
|
|
6708
|
+
});
|
|
6641
6709
|
}
|
|
6642
6710
|
return void 0;
|
|
6643
6711
|
}
|
|
6644
6712
|
getInvitationContext() {
|
|
6645
6713
|
invariant18(this._spaceKey, void 0, {
|
|
6646
6714
|
F: __dxlog_file23,
|
|
6647
|
-
L:
|
|
6715
|
+
L: 60,
|
|
6648
6716
|
S: this,
|
|
6649
6717
|
A: [
|
|
6650
6718
|
"this._spaceKey",
|
|
@@ -6654,7 +6722,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6654
6722
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6655
6723
|
invariant18(space, void 0, {
|
|
6656
6724
|
F: __dxlog_file23,
|
|
6657
|
-
L:
|
|
6725
|
+
L: 62,
|
|
6658
6726
|
S: this,
|
|
6659
6727
|
A: [
|
|
6660
6728
|
"space",
|
|
@@ -6670,7 +6738,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6670
6738
|
async admit(invitation, request, guestProfile) {
|
|
6671
6739
|
invariant18(this._spaceKey && request.space, void 0, {
|
|
6672
6740
|
F: __dxlog_file23,
|
|
6673
|
-
L:
|
|
6741
|
+
L: 75,
|
|
6674
6742
|
S: this,
|
|
6675
6743
|
A: [
|
|
6676
6744
|
"this._spaceKey && request.space",
|
|
@@ -6682,7 +6750,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6682
6750
|
guest: request.space.deviceKey
|
|
6683
6751
|
}, {
|
|
6684
6752
|
F: __dxlog_file23,
|
|
6685
|
-
L:
|
|
6753
|
+
L: 76,
|
|
6686
6754
|
S: this,
|
|
6687
6755
|
C: (f, a) => f(...a)
|
|
6688
6756
|
});
|
|
@@ -6704,7 +6772,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6704
6772
|
async delegate(invitation) {
|
|
6705
6773
|
invariant18(this._spaceKey, void 0, {
|
|
6706
6774
|
F: __dxlog_file23,
|
|
6707
|
-
L:
|
|
6775
|
+
L: 96,
|
|
6708
6776
|
S: this,
|
|
6709
6777
|
A: [
|
|
6710
6778
|
"this._spaceKey",
|
|
@@ -6714,7 +6782,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6714
6782
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6715
6783
|
invariant18(space, void 0, {
|
|
6716
6784
|
F: __dxlog_file23,
|
|
6717
|
-
L:
|
|
6785
|
+
L: 98,
|
|
6718
6786
|
S: this,
|
|
6719
6787
|
A: [
|
|
6720
6788
|
"space",
|
|
@@ -6724,7 +6792,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6724
6792
|
if (invitation.authMethod === Invitation8.AuthMethod.KNOWN_PUBLIC_KEY) {
|
|
6725
6793
|
invariant18(invitation.guestKeypair?.publicKey, void 0, {
|
|
6726
6794
|
F: __dxlog_file23,
|
|
6727
|
-
L:
|
|
6795
|
+
L: 100,
|
|
6728
6796
|
S: this,
|
|
6729
6797
|
A: [
|
|
6730
6798
|
"invitation.guestKeypair?.publicKey",
|
|
@@ -6737,7 +6805,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6737
6805
|
id: invitation.invitationId
|
|
6738
6806
|
}, {
|
|
6739
6807
|
F: __dxlog_file23,
|
|
6740
|
-
L:
|
|
6808
|
+
L: 103,
|
|
6741
6809
|
S: this,
|
|
6742
6810
|
C: (f, a) => f(...a)
|
|
6743
6811
|
});
|
|
@@ -6752,7 +6820,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6752
6820
|
});
|
|
6753
6821
|
invariant18(credential.credential, void 0, {
|
|
6754
6822
|
F: __dxlog_file23,
|
|
6755
|
-
L:
|
|
6823
|
+
L: 121,
|
|
6756
6824
|
S: this,
|
|
6757
6825
|
A: [
|
|
6758
6826
|
"credential.credential",
|
|
@@ -6767,7 +6835,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6767
6835
|
async cancelDelegation(invitation) {
|
|
6768
6836
|
invariant18(this._spaceKey, void 0, {
|
|
6769
6837
|
F: __dxlog_file23,
|
|
6770
|
-
L:
|
|
6838
|
+
L: 127,
|
|
6771
6839
|
S: this,
|
|
6772
6840
|
A: [
|
|
6773
6841
|
"this._spaceKey",
|
|
@@ -6776,7 +6844,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6776
6844
|
});
|
|
6777
6845
|
invariant18(invitation.type === Invitation8.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
|
|
6778
6846
|
F: __dxlog_file23,
|
|
6779
|
-
L:
|
|
6847
|
+
L: 128,
|
|
6780
6848
|
S: this,
|
|
6781
6849
|
A: [
|
|
6782
6850
|
"invitation.type === Invitation.Type.DELEGATED && invitation.delegationCredentialId",
|
|
@@ -6786,7 +6854,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6786
6854
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6787
6855
|
invariant18(space, void 0, {
|
|
6788
6856
|
F: __dxlog_file23,
|
|
6789
|
-
L:
|
|
6857
|
+
L: 130,
|
|
6790
6858
|
S: this,
|
|
6791
6859
|
A: [
|
|
6792
6860
|
"space",
|
|
@@ -6798,14 +6866,14 @@ var SpaceInvitationProtocol = class {
|
|
|
6798
6866
|
id: invitation.invitationId
|
|
6799
6867
|
}, {
|
|
6800
6868
|
F: __dxlog_file23,
|
|
6801
|
-
L:
|
|
6869
|
+
L: 132,
|
|
6802
6870
|
S: this,
|
|
6803
6871
|
C: (f, a) => f(...a)
|
|
6804
6872
|
});
|
|
6805
6873
|
const credential = await createCancelDelegatedSpaceInvitationCredential(this._signingContext.credentialSigner, space.key, invitation.delegationCredentialId);
|
|
6806
6874
|
invariant18(credential.credential, void 0, {
|
|
6807
6875
|
F: __dxlog_file23,
|
|
6808
|
-
L:
|
|
6876
|
+
L: 139,
|
|
6809
6877
|
S: this,
|
|
6810
6878
|
A: [
|
|
6811
6879
|
"credential.credential",
|
|
@@ -6818,10 +6886,14 @@ var SpaceInvitationProtocol = class {
|
|
|
6818
6886
|
}
|
|
6819
6887
|
checkInvitation(invitation) {
|
|
6820
6888
|
if (invitation.spaceKey == null) {
|
|
6821
|
-
return new InvalidInvitationError2(
|
|
6889
|
+
return new InvalidInvitationError2({
|
|
6890
|
+
message: "No spaceKey was provided for a space invitation."
|
|
6891
|
+
});
|
|
6822
6892
|
}
|
|
6823
6893
|
if (this._spaceManager.spaces.has(invitation.spaceKey)) {
|
|
6824
|
-
return new AlreadyJoinedError3(
|
|
6894
|
+
return new AlreadyJoinedError3({
|
|
6895
|
+
message: "Already joined space."
|
|
6896
|
+
});
|
|
6825
6897
|
}
|
|
6826
6898
|
}
|
|
6827
6899
|
createIntroduction() {
|
|
@@ -6844,7 +6916,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6844
6916
|
async accept(response) {
|
|
6845
6917
|
invariant18(response.space, void 0, {
|
|
6846
6918
|
F: __dxlog_file23,
|
|
6847
|
-
L:
|
|
6919
|
+
L: 174,
|
|
6848
6920
|
S: this,
|
|
6849
6921
|
A: [
|
|
6850
6922
|
"response.space",
|
|
@@ -6855,7 +6927,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6855
6927
|
const assertion = getCredentialAssertion5(credential);
|
|
6856
6928
|
invariant18(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
6857
6929
|
F: __dxlog_file23,
|
|
6858
|
-
L:
|
|
6930
|
+
L: 177,
|
|
6859
6931
|
S: this,
|
|
6860
6932
|
A: [
|
|
6861
6933
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -6864,7 +6936,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6864
6936
|
});
|
|
6865
6937
|
invariant18(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
6866
6938
|
F: __dxlog_file23,
|
|
6867
|
-
L:
|
|
6939
|
+
L: 178,
|
|
6868
6940
|
S: this,
|
|
6869
6941
|
A: [
|
|
6870
6942
|
"credential.subject.id.equals(this._signingContext.identityKey)",
|
|
@@ -6872,7 +6944,9 @@ var SpaceInvitationProtocol = class {
|
|
|
6872
6944
|
]
|
|
6873
6945
|
});
|
|
6874
6946
|
if (this._spaceManager.spaces.has(assertion.spaceKey)) {
|
|
6875
|
-
throw new AlreadyJoinedError3(
|
|
6947
|
+
throw new AlreadyJoinedError3({
|
|
6948
|
+
message: "Already joined space."
|
|
6949
|
+
});
|
|
6876
6950
|
}
|
|
6877
6951
|
await this._spaceManager.acceptSpace({
|
|
6878
6952
|
spaceKey: assertion.spaceKey,
|
|
@@ -7262,162 +7336,27 @@ var InvitationsManager = class {
|
|
|
7262
7336
|
}
|
|
7263
7337
|
};
|
|
7264
7338
|
|
|
7265
|
-
// src/packlets/locks/
|
|
7266
|
-
|
|
7267
|
-
|
|
7268
|
-
import
|
|
7269
|
-
function _ts_decorate7(decorators, target, key, desc) {
|
|
7270
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7271
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7272
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7273
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7274
|
-
}
|
|
7275
|
-
var __dxlog_file25 = "/__w/dxos/dxos/packages/sdk/client-services/src/packlets/locks/node.ts";
|
|
7276
|
-
var Lock = class {
|
|
7277
|
-
_lockPath;
|
|
7278
|
-
_onAcquire;
|
|
7279
|
-
_onRelease;
|
|
7280
|
-
_fileHandle;
|
|
7281
|
-
constructor({ lockKey: lockPath, onAcquire, onRelease }) {
|
|
7282
|
-
this._lockPath = lockPath;
|
|
7283
|
-
this._onAcquire = onAcquire;
|
|
7284
|
-
this._onRelease = onRelease;
|
|
7285
|
-
}
|
|
7286
|
-
get lockKey() {
|
|
7287
|
-
return this._lockPath;
|
|
7288
|
-
}
|
|
7289
|
-
async acquire() {
|
|
7290
|
-
log21("acquiring lock...", void 0, {
|
|
7291
|
-
F: __dxlog_file25,
|
|
7292
|
-
L: 32,
|
|
7293
|
-
S: this,
|
|
7294
|
-
C: (f, a) => f(...a)
|
|
7295
|
-
});
|
|
7296
|
-
this._fileHandle = await LockFile.acquire(this._lockPath);
|
|
7297
|
-
await this._onAcquire?.();
|
|
7298
|
-
log21("acquired lock", void 0, {
|
|
7299
|
-
F: __dxlog_file25,
|
|
7300
|
-
L: 37,
|
|
7301
|
-
S: this,
|
|
7302
|
-
C: (f, a) => f(...a)
|
|
7303
|
-
});
|
|
7304
|
-
}
|
|
7305
|
-
async release() {
|
|
7306
|
-
await this._onRelease?.();
|
|
7307
|
-
invariant20(this._fileHandle, "Lock is not acquired", {
|
|
7308
|
-
F: __dxlog_file25,
|
|
7309
|
-
L: 42,
|
|
7310
|
-
S: this,
|
|
7311
|
-
A: [
|
|
7312
|
-
"this._fileHandle",
|
|
7313
|
-
"'Lock is not acquired'"
|
|
7314
|
-
]
|
|
7315
|
-
});
|
|
7316
|
-
await LockFile.release(this._fileHandle);
|
|
7317
|
-
}
|
|
7318
|
-
};
|
|
7319
|
-
_ts_decorate7([
|
|
7320
|
-
logInfo3
|
|
7321
|
-
], Lock.prototype, "lockKey", null);
|
|
7322
|
-
var isLocked = (lockPath) => LockFile.isLocked(lockPath);
|
|
7323
|
-
|
|
7324
|
-
// src/packlets/services/client-rpc-server.ts
|
|
7325
|
-
import { Stream as Stream10 } from "@dxos/codec-protobuf";
|
|
7326
|
-
import { raise as raise2 } from "@dxos/debug";
|
|
7327
|
-
import { RpcPeer, parseMethodName } from "@dxos/rpc";
|
|
7328
|
-
import { MapCounter, trace as trace9 } from "@dxos/tracing";
|
|
7329
|
-
function _ts_decorate8(decorators, target, key, desc) {
|
|
7330
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7331
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7332
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7333
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7334
|
-
}
|
|
7335
|
-
var ClientRpcServer = class {
|
|
7336
|
-
_serviceRegistry;
|
|
7337
|
-
_rpcPeer;
|
|
7338
|
-
_handlerCache = /* @__PURE__ */ new Map();
|
|
7339
|
-
_handleCall;
|
|
7340
|
-
_handleStream;
|
|
7341
|
-
_callMetrics = new MapCounter();
|
|
7342
|
-
get _services() {
|
|
7343
|
-
return Object.keys(this._serviceRegistry.services);
|
|
7344
|
-
}
|
|
7345
|
-
constructor(params) {
|
|
7346
|
-
const { serviceRegistry, handleCall, handleStream, ...rpcOptions } = params;
|
|
7347
|
-
this._handleCall = handleCall;
|
|
7348
|
-
this._handleStream = handleStream;
|
|
7349
|
-
this._serviceRegistry = serviceRegistry;
|
|
7350
|
-
this._rpcPeer = new RpcPeer({
|
|
7351
|
-
...rpcOptions,
|
|
7352
|
-
callHandler: (method, params2) => {
|
|
7353
|
-
const [serviceName, methodName] = parseMethodName(method);
|
|
7354
|
-
const handler = (method2, params3) => this._getServiceHandler(serviceName).call(method2, params3);
|
|
7355
|
-
this._callMetrics.inc(`${serviceName}.${methodName} request`);
|
|
7356
|
-
if (this._handleCall) {
|
|
7357
|
-
return this._handleCall(methodName, params2, handler);
|
|
7358
|
-
} else {
|
|
7359
|
-
return handler(methodName, params2);
|
|
7360
|
-
}
|
|
7361
|
-
},
|
|
7362
|
-
streamHandler: (method, params2) => {
|
|
7363
|
-
const [serviceName, methodName] = parseMethodName(method);
|
|
7364
|
-
const handler = (method2, params3) => this._getServiceHandler(serviceName).callStream(method2, params3);
|
|
7365
|
-
this._callMetrics.inc(`${serviceName}.${methodName} request stream`);
|
|
7366
|
-
if (this._handleStream) {
|
|
7367
|
-
return Stream10.map(Stream10.unwrapPromise(this._handleStream(methodName, params2, handler)), (data) => {
|
|
7368
|
-
this._callMetrics.inc(`${serviceName}.${methodName} response stream`);
|
|
7369
|
-
return data;
|
|
7370
|
-
});
|
|
7371
|
-
} else {
|
|
7372
|
-
return handler(methodName, params2);
|
|
7373
|
-
}
|
|
7374
|
-
}
|
|
7375
|
-
});
|
|
7376
|
-
}
|
|
7377
|
-
async open() {
|
|
7378
|
-
await this._rpcPeer.open();
|
|
7379
|
-
}
|
|
7380
|
-
async close() {
|
|
7381
|
-
await this._rpcPeer.close();
|
|
7382
|
-
}
|
|
7383
|
-
_getServiceHandler(serviceName) {
|
|
7384
|
-
if (!this._handlerCache.has(serviceName)) {
|
|
7385
|
-
const [key, descriptor] = Object.entries(this._serviceRegistry.descriptors).find(([key2, descriptor2]) => descriptor2.name === serviceName) ?? raise2(new Error(`Service not available: ${serviceName}`));
|
|
7386
|
-
const service = this._serviceRegistry.services[key];
|
|
7387
|
-
if (!service) {
|
|
7388
|
-
throw new Error(`Service not available: ${serviceName}`);
|
|
7389
|
-
}
|
|
7390
|
-
this._handlerCache.set(serviceName, descriptor.createServer(service));
|
|
7391
|
-
}
|
|
7392
|
-
return this._handlerCache.get(serviceName);
|
|
7393
|
-
}
|
|
7394
|
-
};
|
|
7395
|
-
_ts_decorate8([
|
|
7396
|
-
trace9.metricsCounter()
|
|
7397
|
-
], ClientRpcServer.prototype, "_callMetrics", void 0);
|
|
7398
|
-
_ts_decorate8([
|
|
7399
|
-
trace9.info()
|
|
7400
|
-
], ClientRpcServer.prototype, "_services", null);
|
|
7401
|
-
ClientRpcServer = _ts_decorate8([
|
|
7402
|
-
trace9.resource()
|
|
7403
|
-
], ClientRpcServer);
|
|
7339
|
+
// src/packlets/locks/index.ts
|
|
7340
|
+
var locks_exports = {};
|
|
7341
|
+
__reExport(locks_exports, locks_platform_star);
|
|
7342
|
+
import * as locks_platform_star from "#locks-platform";
|
|
7404
7343
|
|
|
7405
7344
|
// src/packlets/agents/edge-agent-manager.ts
|
|
7406
7345
|
import { DeferredTask as DeferredTask2, Event as Event9, scheduleTask as scheduleTask8, synchronized as synchronized3 } from "@dxos/async";
|
|
7407
7346
|
import { Resource as Resource7 } from "@dxos/context";
|
|
7408
|
-
import { invariant as
|
|
7347
|
+
import { invariant as invariant20 } from "@dxos/invariant";
|
|
7409
7348
|
import { PublicKey as PublicKey13 } from "@dxos/keys";
|
|
7410
|
-
import { log as
|
|
7349
|
+
import { log as log21 } from "@dxos/log";
|
|
7411
7350
|
import { EdgeAgentStatus, EdgeCallFailedError as EdgeCallFailedError3 } from "@dxos/protocols";
|
|
7412
7351
|
import { SpaceState as SpaceState5 } from "@dxos/protocols/proto/dxos/client/services";
|
|
7413
7352
|
import { EdgeReplicationSetting as EdgeReplicationSetting2 } from "@dxos/protocols/proto/dxos/echo/metadata";
|
|
7414
|
-
function
|
|
7353
|
+
function _ts_decorate7(decorators, target, key, desc) {
|
|
7415
7354
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7416
7355
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7417
7356
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7418
7357
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7419
7358
|
}
|
|
7420
|
-
var
|
|
7359
|
+
var __dxlog_file25 = "/__w/dxos/dxos/packages/sdk/client-services/src/packlets/agents/edge-agent-manager.ts";
|
|
7421
7360
|
var AGENT_STATUS_QUERY_RETRY_INTERVAL = 5e3;
|
|
7422
7361
|
var AGENT_STATUS_QUERY_RETRY_JITTER = 1e3;
|
|
7423
7362
|
var AGENT_FEED_ADDED_CHECK_INTERVAL_MS = 3e3;
|
|
@@ -7441,8 +7380,8 @@ var EdgeAgentManager = class extends Resource7 {
|
|
|
7441
7380
|
return this._agentStatus && this._agentStatus !== EdgeAgentStatus.NOT_FOUND;
|
|
7442
7381
|
}
|
|
7443
7382
|
async createAgent() {
|
|
7444
|
-
|
|
7445
|
-
F:
|
|
7383
|
+
invariant20(this.isOpen, void 0, {
|
|
7384
|
+
F: __dxlog_file25,
|
|
7446
7385
|
L: 54,
|
|
7447
7386
|
S: this,
|
|
7448
7387
|
A: [
|
|
@@ -7450,8 +7389,8 @@ var EdgeAgentManager = class extends Resource7 {
|
|
|
7450
7389
|
""
|
|
7451
7390
|
]
|
|
7452
7391
|
});
|
|
7453
|
-
|
|
7454
|
-
F:
|
|
7392
|
+
invariant20(this._edgeHttpClient, void 0, {
|
|
7393
|
+
F: __dxlog_file25,
|
|
7455
7394
|
L: 55,
|
|
7456
7395
|
S: this,
|
|
7457
7396
|
A: [
|
|
@@ -7459,8 +7398,8 @@ var EdgeAgentManager = class extends Resource7 {
|
|
|
7459
7398
|
""
|
|
7460
7399
|
]
|
|
7461
7400
|
});
|
|
7462
|
-
|
|
7463
|
-
F:
|
|
7401
|
+
invariant20(this._edgeFeatures?.agents, void 0, {
|
|
7402
|
+
F: __dxlog_file25,
|
|
7464
7403
|
L: 56,
|
|
7465
7404
|
S: this,
|
|
7466
7405
|
A: [
|
|
@@ -7475,10 +7414,10 @@ var EdgeAgentManager = class extends Resource7 {
|
|
|
7475
7414
|
});
|
|
7476
7415
|
const deviceKey = PublicKey13.fromHex(response.deviceKey);
|
|
7477
7416
|
if (await this._identity.authorizedDeviceKeys.has(deviceKey)) {
|
|
7478
|
-
|
|
7417
|
+
log21.info("agent was already added to HALO, ignoring response", {
|
|
7479
7418
|
response
|
|
7480
7419
|
}, {
|
|
7481
|
-
F:
|
|
7420
|
+
F: __dxlog_file25,
|
|
7482
7421
|
L: 67,
|
|
7483
7422
|
S: this,
|
|
7484
7423
|
C: (f, a) => f(...a)
|
|
@@ -7492,8 +7431,8 @@ var EdgeAgentManager = class extends Resource7 {
|
|
|
7492
7431
|
// TODO: agents don't have data feed, should be removed
|
|
7493
7432
|
dataFeedKey: PublicKey13.random()
|
|
7494
7433
|
});
|
|
7495
|
-
|
|
7496
|
-
F:
|
|
7434
|
+
log21("agent created", response, {
|
|
7435
|
+
F: __dxlog_file25,
|
|
7497
7436
|
L: 79,
|
|
7498
7437
|
S: this,
|
|
7499
7438
|
C: (f, a) => f(...a)
|
|
@@ -7502,10 +7441,10 @@ var EdgeAgentManager = class extends Resource7 {
|
|
|
7502
7441
|
}
|
|
7503
7442
|
async _open() {
|
|
7504
7443
|
const isEnabled = this._edgeHttpClient && this._edgeFeatures?.agents;
|
|
7505
|
-
|
|
7444
|
+
log21("edge agent manager open", {
|
|
7506
7445
|
isEnabled
|
|
7507
7446
|
}, {
|
|
7508
|
-
F:
|
|
7447
|
+
F: __dxlog_file25,
|
|
7509
7448
|
L: 87,
|
|
7510
7449
|
S: this,
|
|
7511
7450
|
C: (f, a) => f(...a)
|
|
@@ -7537,8 +7476,8 @@ var EdgeAgentManager = class extends Resource7 {
|
|
|
7537
7476
|
this._lastKnownDeviceCount = 0;
|
|
7538
7477
|
}
|
|
7539
7478
|
async _fetchAgentStatus() {
|
|
7540
|
-
|
|
7541
|
-
F:
|
|
7479
|
+
invariant20(this._edgeHttpClient, void 0, {
|
|
7480
|
+
F: __dxlog_file25,
|
|
7542
7481
|
L: 121,
|
|
7543
7482
|
S: this,
|
|
7544
7483
|
A: [
|
|
@@ -7547,8 +7486,8 @@ var EdgeAgentManager = class extends Resource7 {
|
|
|
7547
7486
|
]
|
|
7548
7487
|
});
|
|
7549
7488
|
try {
|
|
7550
|
-
|
|
7551
|
-
F:
|
|
7489
|
+
log21("fetching agent status", void 0, {
|
|
7490
|
+
F: __dxlog_file25,
|
|
7552
7491
|
L: 123,
|
|
7553
7492
|
S: this,
|
|
7554
7493
|
C: (f, a) => f(...a)
|
|
@@ -7564,10 +7503,10 @@ var EdgeAgentManager = class extends Resource7 {
|
|
|
7564
7503
|
} catch (err) {
|
|
7565
7504
|
if (err instanceof EdgeCallFailedError3) {
|
|
7566
7505
|
if (!err.isRetryable) {
|
|
7567
|
-
|
|
7506
|
+
log21.warn("non retryable error on agent status fetch attempt", {
|
|
7568
7507
|
err
|
|
7569
7508
|
}, {
|
|
7570
|
-
F:
|
|
7509
|
+
F: __dxlog_file25,
|
|
7571
7510
|
L: 133,
|
|
7572
7511
|
S: this,
|
|
7573
7512
|
C: (f, a) => f(...a)
|
|
@@ -7576,11 +7515,11 @@ var EdgeAgentManager = class extends Resource7 {
|
|
|
7576
7515
|
}
|
|
7577
7516
|
}
|
|
7578
7517
|
const retryAfterMs = AGENT_STATUS_QUERY_RETRY_INTERVAL + Math.random() * AGENT_STATUS_QUERY_RETRY_JITTER;
|
|
7579
|
-
|
|
7518
|
+
log21.info("agent status fetching failed", {
|
|
7580
7519
|
err,
|
|
7581
7520
|
retryAfterMs
|
|
7582
7521
|
}, {
|
|
7583
|
-
F:
|
|
7522
|
+
F: __dxlog_file25,
|
|
7584
7523
|
L: 138,
|
|
7585
7524
|
S: this,
|
|
7586
7525
|
C: (f, a) => f(...a)
|
|
@@ -7612,11 +7551,11 @@ var EdgeAgentManager = class extends Resource7 {
|
|
|
7612
7551
|
].some((feed) => feed.assertion.deviceKey.equals(agentDeviceKey));
|
|
7613
7552
|
space.notarizationPlugin.setActiveEdgePollingEnabled(agentFeedNeedsNotarization);
|
|
7614
7553
|
activePollingEnabled = activePollingEnabled || agentFeedNeedsNotarization;
|
|
7615
|
-
|
|
7554
|
+
log21.verbose("set active edge polling", {
|
|
7616
7555
|
enabled: agentFeedNeedsNotarization,
|
|
7617
7556
|
spaceId: space.id
|
|
7618
7557
|
}, {
|
|
7619
|
-
F:
|
|
7558
|
+
F: __dxlog_file25,
|
|
7620
7559
|
L: 165,
|
|
7621
7560
|
S: this,
|
|
7622
7561
|
C: (f, a) => f(...a)
|
|
@@ -7633,22 +7572,22 @@ var EdgeAgentManager = class extends Resource7 {
|
|
|
7633
7572
|
if (deviceKey) {
|
|
7634
7573
|
this._ensureAgentIsInSpaces(deviceKey);
|
|
7635
7574
|
}
|
|
7636
|
-
|
|
7575
|
+
log21.verbose("agent status update", {
|
|
7637
7576
|
status
|
|
7638
7577
|
}, {
|
|
7639
|
-
F:
|
|
7578
|
+
F: __dxlog_file25,
|
|
7640
7579
|
L: 181,
|
|
7641
7580
|
S: this,
|
|
7642
7581
|
C: (f, a) => f(...a)
|
|
7643
7582
|
});
|
|
7644
7583
|
}
|
|
7645
7584
|
};
|
|
7646
|
-
|
|
7585
|
+
_ts_decorate7([
|
|
7647
7586
|
synchronized3
|
|
7648
7587
|
], EdgeAgentManager.prototype, "createAgent", null);
|
|
7649
7588
|
|
|
7650
7589
|
// src/packlets/agents/edge-agent-service.ts
|
|
7651
|
-
import { Stream as
|
|
7590
|
+
import { Stream as Stream10 } from "@dxos/codec-protobuf/stream";
|
|
7652
7591
|
import { EdgeAgentStatus as EdgeAgentStatus2 } from "@dxos/protocols";
|
|
7653
7592
|
import { EdgeStatus as EdgeStatus2, QueryAgentStatusResponse } from "@dxos/protocols/proto/dxos/client/services";
|
|
7654
7593
|
var EdgeAgentServiceImpl = class {
|
|
@@ -7660,7 +7599,7 @@ var EdgeAgentServiceImpl = class {
|
|
|
7660
7599
|
}
|
|
7661
7600
|
// TODO(mykola): Reconcile with NetworkService.queryStatus.
|
|
7662
7601
|
queryEdgeStatus() {
|
|
7663
|
-
return new
|
|
7602
|
+
return new Stream10(({ ctx, next }) => {
|
|
7664
7603
|
const update = () => {
|
|
7665
7604
|
next({
|
|
7666
7605
|
status: this._edgeConnection?.status ?? {
|
|
@@ -7682,7 +7621,7 @@ var EdgeAgentServiceImpl = class {
|
|
|
7682
7621
|
return (await this._agentManagerProvider()).createAgent();
|
|
7683
7622
|
}
|
|
7684
7623
|
queryAgentStatus() {
|
|
7685
|
-
return new
|
|
7624
|
+
return new Stream10(({ ctx, next }) => {
|
|
7686
7625
|
next({
|
|
7687
7626
|
status: QueryAgentStatusResponse.AgentStatus.UNKNOWN
|
|
7688
7627
|
});
|
|
@@ -7720,11 +7659,11 @@ import { failUndefined as failUndefined2, warnAfterTimeout as warnAfterTimeout2
|
|
|
7720
7659
|
import { EchoEdgeReplicator, EchoHost, MeshEchoReplicator, MetadataStore, SpaceManager, valueEncoding } from "@dxos/echo-pipeline";
|
|
7721
7660
|
import { createChainEdgeIdentity, createEphemeralEdgeIdentity } from "@dxos/edge-client";
|
|
7722
7661
|
import { FeedFactory, FeedStore } from "@dxos/feed-store";
|
|
7723
|
-
import { invariant as
|
|
7662
|
+
import { invariant as invariant22 } from "@dxos/invariant";
|
|
7724
7663
|
import { Keyring } from "@dxos/keyring";
|
|
7725
7664
|
import { PublicKey as PublicKey15 } from "@dxos/keys";
|
|
7726
|
-
import { log as
|
|
7727
|
-
import { InvalidStorageVersionError, STORAGE_VERSION as STORAGE_VERSION2, trace as
|
|
7665
|
+
import { log as log23 } from "@dxos/log";
|
|
7666
|
+
import { InvalidStorageVersionError, STORAGE_VERSION as STORAGE_VERSION2, trace as trace9 } from "@dxos/protocols";
|
|
7728
7667
|
import { Invitation as Invitation10 } from "@dxos/protocols/proto/dxos/client/services";
|
|
7729
7668
|
import { BlobStore } from "@dxos/teleport-extension-object-sync";
|
|
7730
7669
|
import { trace as Trace3 } from "@dxos/tracing";
|
|
@@ -7733,13 +7672,13 @@ import { safeInstanceof } from "@dxos/util";
|
|
|
7733
7672
|
// src/packlets/identity/identity-recovery-manager.ts
|
|
7734
7673
|
import { generateSeedPhrase, keyPairFromSeedPhrase } from "@dxos/credentials";
|
|
7735
7674
|
import { sign as sign3 } from "@dxos/crypto";
|
|
7736
|
-
import { invariant as
|
|
7675
|
+
import { invariant as invariant21 } from "@dxos/invariant";
|
|
7737
7676
|
import { PublicKey as PublicKey14 } from "@dxos/keys";
|
|
7738
|
-
import { log as
|
|
7677
|
+
import { log as log22 } from "@dxos/log";
|
|
7739
7678
|
import { EdgeAuthChallengeError as EdgeAuthChallengeError2 } from "@dxos/protocols";
|
|
7740
7679
|
import { schema as schema6 } from "@dxos/protocols/proto";
|
|
7741
7680
|
import { Timeframe as Timeframe5 } from "@dxos/timeframe";
|
|
7742
|
-
var
|
|
7681
|
+
var __dxlog_file26 = "/__w/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-recovery-manager.ts";
|
|
7743
7682
|
var EdgeIdentityRecoveryManager = class {
|
|
7744
7683
|
_keyring;
|
|
7745
7684
|
_edgeClient;
|
|
@@ -7753,8 +7692,8 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7753
7692
|
}
|
|
7754
7693
|
async createRecoveryCredential({ data }) {
|
|
7755
7694
|
const identity = this._identityProvider();
|
|
7756
|
-
|
|
7757
|
-
F:
|
|
7695
|
+
invariant21(identity, void 0, {
|
|
7696
|
+
F: __dxlog_file26,
|
|
7758
7697
|
L: 39,
|
|
7759
7698
|
S: this,
|
|
7760
7699
|
A: [
|
|
@@ -7804,8 +7743,8 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7804
7743
|
};
|
|
7805
7744
|
}
|
|
7806
7745
|
async requestRecoveryChallenge() {
|
|
7807
|
-
|
|
7808
|
-
F:
|
|
7746
|
+
invariant21(this._edgeClient, "Not connected to EDGE.", {
|
|
7747
|
+
F: __dxlog_file26,
|
|
7809
7748
|
L: 76,
|
|
7810
7749
|
S: this,
|
|
7811
7750
|
A: [
|
|
@@ -7834,8 +7773,8 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7834
7773
|
}
|
|
7835
7774
|
}
|
|
7836
7775
|
async recoverIdentityWithExternalSignature({ lookupKey, deviceKey, controlFeedKey, signature, clientDataJson, authenticatorData }) {
|
|
7837
|
-
|
|
7838
|
-
F:
|
|
7776
|
+
invariant21(this._edgeClient, "Not connected to EDGE.", {
|
|
7777
|
+
F: __dxlog_file26,
|
|
7839
7778
|
L: 108,
|
|
7840
7779
|
S: this,
|
|
7841
7780
|
A: [
|
|
@@ -7868,8 +7807,8 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7868
7807
|
* Recovery identity using an opaque token sent to the user's email.
|
|
7869
7808
|
*/
|
|
7870
7809
|
async recoverIdentityWithToken({ token }) {
|
|
7871
|
-
|
|
7872
|
-
F:
|
|
7810
|
+
invariant21(this._edgeClient, "Not connected to EDGE.", {
|
|
7811
|
+
F: __dxlog_file26,
|
|
7873
7812
|
L: 141,
|
|
7874
7813
|
S: this,
|
|
7875
7814
|
A: [
|
|
@@ -7896,8 +7835,8 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7896
7835
|
});
|
|
7897
7836
|
}
|
|
7898
7837
|
async recoverIdentity({ recoveryCode }) {
|
|
7899
|
-
|
|
7900
|
-
F:
|
|
7838
|
+
invariant21(this._edgeClient, "Not connected to EDGE.", {
|
|
7839
|
+
F: __dxlog_file26,
|
|
7901
7840
|
L: 165,
|
|
7902
7841
|
S: this,
|
|
7903
7842
|
A: [
|
|
@@ -7927,8 +7866,8 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7927
7866
|
signature: Buffer.from(signature).toString("base64")
|
|
7928
7867
|
});
|
|
7929
7868
|
}
|
|
7930
|
-
|
|
7931
|
-
F:
|
|
7869
|
+
log22.info("recovering identity", response, {
|
|
7870
|
+
F: __dxlog_file26,
|
|
7932
7871
|
L: 191,
|
|
7933
7872
|
S: this,
|
|
7934
7873
|
C: (f, a) => f(...a)
|
|
@@ -7951,7 +7890,7 @@ var decodeCredential = (credentialBase64) => {
|
|
|
7951
7890
|
};
|
|
7952
7891
|
|
|
7953
7892
|
// src/packlets/services/service-context.ts
|
|
7954
|
-
function
|
|
7893
|
+
function _ts_decorate8(decorators, target, key, desc) {
|
|
7955
7894
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7956
7895
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7957
7896
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -8022,7 +7961,7 @@ function _ts_dispose_resources4(env) {
|
|
|
8022
7961
|
return next();
|
|
8023
7962
|
})(env);
|
|
8024
7963
|
}
|
|
8025
|
-
var
|
|
7964
|
+
var __dxlog_file27 = "/__w/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
8026
7965
|
var ServiceContext = class extends Resource8 {
|
|
8027
7966
|
storage;
|
|
8028
7967
|
level;
|
|
@@ -8030,7 +7969,8 @@ var ServiceContext = class extends Resource8 {
|
|
|
8030
7969
|
signalManager;
|
|
8031
7970
|
_edgeConnection;
|
|
8032
7971
|
_edgeHttpClient;
|
|
8033
|
-
|
|
7972
|
+
_runtime;
|
|
7973
|
+
_runtimeProps;
|
|
8034
7974
|
_edgeFeatures;
|
|
8035
7975
|
_edgeIdentityUpdateMutex = new Mutex4();
|
|
8036
7976
|
initialized = new Trigger7();
|
|
@@ -8052,8 +7992,20 @@ var ServiceContext = class extends Resource8 {
|
|
|
8052
7992
|
_handlerFactories = /* @__PURE__ */ new Map();
|
|
8053
7993
|
_deviceSpaceSync;
|
|
8054
7994
|
_instanceId = PublicKey15.random().toHex();
|
|
8055
|
-
constructor(storage, level, networkManager, signalManager, _edgeConnection, _edgeHttpClient,
|
|
8056
|
-
super(), this.storage = storage, this.level = level, this.networkManager = networkManager, this.signalManager = signalManager, this._edgeConnection = _edgeConnection, this._edgeHttpClient = _edgeHttpClient, this.
|
|
7995
|
+
constructor(storage, level, networkManager, signalManager, _edgeConnection, _edgeHttpClient, _runtime, _runtimeProps, _edgeFeatures) {
|
|
7996
|
+
super(), this.storage = storage, this.level = level, this.networkManager = networkManager, this.signalManager = signalManager, this._edgeConnection = _edgeConnection, this._edgeHttpClient = _edgeHttpClient, this._runtime = _runtime, this._runtimeProps = _runtimeProps, this._edgeFeatures = _edgeFeatures;
|
|
7997
|
+
log23("runtimeProps", this._runtimeProps, {
|
|
7998
|
+
F: __dxlog_file27,
|
|
7999
|
+
L: 120,
|
|
8000
|
+
S: this,
|
|
8001
|
+
C: (f, a) => f(...a)
|
|
8002
|
+
});
|
|
8003
|
+
log23("edgeFeatures", this._edgeFeatures, {
|
|
8004
|
+
F: __dxlog_file27,
|
|
8005
|
+
L: 121,
|
|
8006
|
+
S: this,
|
|
8007
|
+
C: (f, a) => f(...a)
|
|
8008
|
+
});
|
|
8057
8009
|
this.metadataStore = new MetadataStore(storage.createDirectory("metadata"));
|
|
8058
8010
|
this.blobStore = new BlobStore(storage.createDirectory("blobs"));
|
|
8059
8011
|
this.keyring = new Keyring(storage.createDirectory("keyring"));
|
|
@@ -8072,15 +8024,15 @@ var ServiceContext = class extends Resource8 {
|
|
|
8072
8024
|
networkManager: this.networkManager,
|
|
8073
8025
|
blobStore: this.blobStore,
|
|
8074
8026
|
metadataStore: this.metadataStore,
|
|
8075
|
-
disableP2pReplication: this.
|
|
8027
|
+
disableP2pReplication: this._runtimeProps?.disableP2pReplication
|
|
8076
8028
|
});
|
|
8077
8029
|
this.identityManager = new IdentityManager({
|
|
8078
8030
|
metadataStore: this.metadataStore,
|
|
8079
8031
|
keyring: this.keyring,
|
|
8080
8032
|
feedStore: this.feedStore,
|
|
8081
8033
|
spaceManager: this.spaceManager,
|
|
8082
|
-
devicePresenceOfflineTimeout: this.
|
|
8083
|
-
devicePresenceAnnounceInterval: this.
|
|
8034
|
+
devicePresenceOfflineTimeout: this._runtimeProps?.devicePresenceOfflineTimeout,
|
|
8035
|
+
devicePresenceAnnounceInterval: this._runtimeProps?.devicePresenceAnnounceInterval,
|
|
8084
8036
|
edgeConnection: this._edgeConnection,
|
|
8085
8037
|
edgeFeatures: this._edgeFeatures
|
|
8086
8038
|
});
|
|
@@ -8090,14 +8042,16 @@ var ServiceContext = class extends Resource8 {
|
|
|
8090
8042
|
peerIdProvider: () => this.identityManager.identity?.deviceKey?.toHex(),
|
|
8091
8043
|
getSpaceKeyByRootDocumentId: (documentId) => this.spaceManager.findSpaceByRootDocumentId(documentId)?.key,
|
|
8092
8044
|
indexing: {
|
|
8093
|
-
vector: this.
|
|
8094
|
-
|
|
8045
|
+
vector: this._runtimeProps?.enableVectorIndexing,
|
|
8046
|
+
sqlIndex: this._runtimeProps?.enableSqlite
|
|
8047
|
+
},
|
|
8048
|
+
runtime: this._runtime,
|
|
8049
|
+
localQueues: this._runtimeProps?.enableLocalQueues
|
|
8095
8050
|
});
|
|
8096
|
-
this.
|
|
8097
|
-
this.invitations = new InvitationsHandler(this.networkManager, this._edgeHttpClient, _runtimeParams?.invitationConnectionDefaultParams);
|
|
8051
|
+
this.invitations = new InvitationsHandler(this.networkManager, this._edgeHttpClient, _runtimeProps?.invitationConnectionDefaultProps);
|
|
8098
8052
|
this.invitationsManager = new InvitationsManager(this.invitations, (invitation) => this.getInvitationHandler(invitation), this.metadataStore);
|
|
8099
8053
|
this._handlerFactories.set(Invitation10.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? failUndefined2(), this._acceptIdentity.bind(this)));
|
|
8100
|
-
if (!this.
|
|
8054
|
+
if (!this._runtimeProps?.disableP2pReplication) {
|
|
8101
8055
|
this._meshReplicator = new MeshEchoReplicator();
|
|
8102
8056
|
}
|
|
8103
8057
|
if (this._edgeConnection && this._edgeFeatures?.echoReplicator && this._edgeHttpClient) {
|
|
@@ -8109,17 +8063,17 @@ var ServiceContext = class extends Resource8 {
|
|
|
8109
8063
|
}
|
|
8110
8064
|
async _open(ctx) {
|
|
8111
8065
|
await this._checkStorageVersion();
|
|
8112
|
-
|
|
8113
|
-
F:
|
|
8114
|
-
L:
|
|
8066
|
+
log23("opening...", void 0, {
|
|
8067
|
+
F: __dxlog_file27,
|
|
8068
|
+
L: 215,
|
|
8115
8069
|
S: this,
|
|
8116
8070
|
C: (f, a) => f(...a)
|
|
8117
8071
|
});
|
|
8118
|
-
|
|
8072
|
+
log23.trace("dxos.sdk.service-context.open", trace9.begin({
|
|
8119
8073
|
id: this._instanceId
|
|
8120
8074
|
}), {
|
|
8121
|
-
F:
|
|
8122
|
-
L:
|
|
8075
|
+
F: __dxlog_file27,
|
|
8076
|
+
L: 216,
|
|
8123
8077
|
S: this,
|
|
8124
8078
|
C: (f, a) => f(...a)
|
|
8125
8079
|
});
|
|
@@ -8142,33 +8096,33 @@ var ServiceContext = class extends Resource8 {
|
|
|
8142
8096
|
await this._initialize(ctx);
|
|
8143
8097
|
}
|
|
8144
8098
|
const loadedInvitations = await this.invitationsManager.loadPersistentInvitations();
|
|
8145
|
-
|
|
8099
|
+
log23("loaded persistent invitations", {
|
|
8146
8100
|
count: loadedInvitations.invitations?.length
|
|
8147
8101
|
}, {
|
|
8148
|
-
F:
|
|
8149
|
-
L:
|
|
8102
|
+
F: __dxlog_file27,
|
|
8103
|
+
L: 244,
|
|
8150
8104
|
S: this,
|
|
8151
8105
|
C: (f, a) => f(...a)
|
|
8152
8106
|
});
|
|
8153
|
-
|
|
8107
|
+
log23.trace("dxos.sdk.service-context.open", trace9.end({
|
|
8154
8108
|
id: this._instanceId
|
|
8155
8109
|
}), {
|
|
8156
|
-
F:
|
|
8157
|
-
L:
|
|
8110
|
+
F: __dxlog_file27,
|
|
8111
|
+
L: 246,
|
|
8158
8112
|
S: this,
|
|
8159
8113
|
C: (f, a) => f(...a)
|
|
8160
8114
|
});
|
|
8161
|
-
|
|
8162
|
-
F:
|
|
8163
|
-
L:
|
|
8115
|
+
log23("opened", void 0, {
|
|
8116
|
+
F: __dxlog_file27,
|
|
8117
|
+
L: 247,
|
|
8164
8118
|
S: this,
|
|
8165
8119
|
C: (f, a) => f(...a)
|
|
8166
8120
|
});
|
|
8167
8121
|
}
|
|
8168
8122
|
async _close(ctx) {
|
|
8169
|
-
|
|
8170
|
-
F:
|
|
8171
|
-
L:
|
|
8123
|
+
log23("closing...", void 0, {
|
|
8124
|
+
F: __dxlog_file27,
|
|
8125
|
+
L: 251,
|
|
8172
8126
|
S: this,
|
|
8173
8127
|
C: (f, a) => f(...a)
|
|
8174
8128
|
});
|
|
@@ -8185,9 +8139,9 @@ var ServiceContext = class extends Resource8 {
|
|
|
8185
8139
|
await this._edgeConnection?.close();
|
|
8186
8140
|
await this.feedStore.close();
|
|
8187
8141
|
await this.metadataStore.close();
|
|
8188
|
-
|
|
8189
|
-
F:
|
|
8190
|
-
L:
|
|
8142
|
+
log23("closed", void 0, {
|
|
8143
|
+
F: __dxlog_file27,
|
|
8144
|
+
L: 267,
|
|
8191
8145
|
S: this,
|
|
8192
8146
|
C: (f, a) => f(...a)
|
|
8193
8147
|
});
|
|
@@ -8197,8 +8151,8 @@ var ServiceContext = class extends Resource8 {
|
|
|
8197
8151
|
await this._setNetworkIdentity();
|
|
8198
8152
|
await identity.joinNetwork();
|
|
8199
8153
|
await this._initialize(new Context10(void 0, {
|
|
8200
|
-
F:
|
|
8201
|
-
L:
|
|
8154
|
+
F: __dxlog_file27,
|
|
8155
|
+
L: 274
|
|
8202
8156
|
}));
|
|
8203
8157
|
return identity;
|
|
8204
8158
|
}
|
|
@@ -8207,9 +8161,9 @@ var ServiceContext = class extends Resource8 {
|
|
|
8207
8161
|
throw new Error("Identity must be created before joining a space.");
|
|
8208
8162
|
}
|
|
8209
8163
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
8210
|
-
|
|
8211
|
-
F:
|
|
8212
|
-
L:
|
|
8164
|
+
invariant22(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
8165
|
+
F: __dxlog_file27,
|
|
8166
|
+
L: 283,
|
|
8213
8167
|
S: this,
|
|
8214
8168
|
A: [
|
|
8215
8169
|
"factory",
|
|
@@ -8234,8 +8188,8 @@ var ServiceContext = class extends Resource8 {
|
|
|
8234
8188
|
await identity.joinNetwork();
|
|
8235
8189
|
await this.identityManager.acceptIdentity(identity, identityRecord, params.deviceProfile);
|
|
8236
8190
|
await this._initialize(new Context10(void 0, {
|
|
8237
|
-
F:
|
|
8238
|
-
L:
|
|
8191
|
+
F: __dxlog_file27,
|
|
8192
|
+
L: 302
|
|
8239
8193
|
}));
|
|
8240
8194
|
return identity;
|
|
8241
8195
|
}
|
|
@@ -8247,9 +8201,9 @@ var ServiceContext = class extends Resource8 {
|
|
|
8247
8201
|
}
|
|
8248
8202
|
// Called when identity is created.
|
|
8249
8203
|
async _initialize(ctx) {
|
|
8250
|
-
|
|
8251
|
-
F:
|
|
8252
|
-
L:
|
|
8204
|
+
log23("initializing spaces...", void 0, {
|
|
8205
|
+
F: __dxlog_file27,
|
|
8206
|
+
L: 317,
|
|
8253
8207
|
S: this,
|
|
8254
8208
|
C: (f, a) => f(...a)
|
|
8255
8209
|
});
|
|
@@ -8279,16 +8233,16 @@ var ServiceContext = class extends Resource8 {
|
|
|
8279
8233
|
edgeHttpClient: this._edgeHttpClient,
|
|
8280
8234
|
echoEdgeReplicator: this._echoEdgeReplicator,
|
|
8281
8235
|
meshReplicator: this._meshReplicator,
|
|
8282
|
-
|
|
8236
|
+
runtimeProps: this._runtimeProps,
|
|
8283
8237
|
edgeFeatures: this._edgeFeatures
|
|
8284
8238
|
});
|
|
8285
8239
|
await this.dataSpaceManager.open();
|
|
8286
8240
|
this.edgeAgentManager = new EdgeAgentManager(this._edgeFeatures, this._edgeHttpClient, this.dataSpaceManager, identity);
|
|
8287
8241
|
await this.edgeAgentManager.open();
|
|
8288
8242
|
this._handlerFactories.set(Invitation10.Kind.SPACE, (invitation) => {
|
|
8289
|
-
|
|
8290
|
-
F:
|
|
8291
|
-
L:
|
|
8243
|
+
invariant22(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
8244
|
+
F: __dxlog_file27,
|
|
8245
|
+
L: 355,
|
|
8292
8246
|
S: this,
|
|
8293
8247
|
A: [
|
|
8294
8248
|
"this.dataSpaceManager",
|
|
@@ -8308,33 +8262,33 @@ var ServiceContext = class extends Resource8 {
|
|
|
8308
8262
|
return;
|
|
8309
8263
|
}
|
|
8310
8264
|
if (!this.dataSpaceManager) {
|
|
8311
|
-
|
|
8265
|
+
log23("dataSpaceManager not initialized yet, ignoring space admission", {
|
|
8312
8266
|
details: assertion
|
|
8313
8267
|
}, {
|
|
8314
|
-
F:
|
|
8315
|
-
L:
|
|
8268
|
+
F: __dxlog_file27,
|
|
8269
|
+
L: 371,
|
|
8316
8270
|
S: this,
|
|
8317
8271
|
C: (f, a) => f(...a)
|
|
8318
8272
|
});
|
|
8319
8273
|
return;
|
|
8320
8274
|
}
|
|
8321
8275
|
if (this.dataSpaceManager.spaces.has(assertion.spaceKey)) {
|
|
8322
|
-
|
|
8276
|
+
log23("space already exists, ignoring space admission", {
|
|
8323
8277
|
details: assertion
|
|
8324
8278
|
}, {
|
|
8325
|
-
F:
|
|
8326
|
-
L:
|
|
8279
|
+
F: __dxlog_file27,
|
|
8280
|
+
L: 375,
|
|
8327
8281
|
S: this,
|
|
8328
8282
|
C: (f, a) => f(...a)
|
|
8329
8283
|
});
|
|
8330
8284
|
return;
|
|
8331
8285
|
}
|
|
8332
8286
|
try {
|
|
8333
|
-
|
|
8287
|
+
log23("accepting space recorded in halo", {
|
|
8334
8288
|
details: assertion
|
|
8335
8289
|
}, {
|
|
8336
|
-
F:
|
|
8337
|
-
L:
|
|
8290
|
+
F: __dxlog_file27,
|
|
8291
|
+
L: 380,
|
|
8338
8292
|
S: this,
|
|
8339
8293
|
C: (f, a) => f(...a)
|
|
8340
8294
|
});
|
|
@@ -8343,9 +8297,9 @@ var ServiceContext = class extends Resource8 {
|
|
|
8343
8297
|
genesisFeedKey: assertion.genesisFeedKey
|
|
8344
8298
|
});
|
|
8345
8299
|
} catch (err) {
|
|
8346
|
-
|
|
8347
|
-
F:
|
|
8348
|
-
L:
|
|
8300
|
+
log23.catch(err, void 0, {
|
|
8301
|
+
F: __dxlog_file27,
|
|
8302
|
+
L: 386,
|
|
8349
8303
|
S: this,
|
|
8350
8304
|
C: (f, a) => f(...a)
|
|
8351
8305
|
});
|
|
@@ -8365,12 +8319,12 @@ var ServiceContext = class extends Resource8 {
|
|
|
8365
8319
|
let edgeIdentity;
|
|
8366
8320
|
const identity = this.identityManager.identity;
|
|
8367
8321
|
if (identity) {
|
|
8368
|
-
|
|
8322
|
+
log23("setting identity on edge connection", {
|
|
8369
8323
|
identity: identity.identityKey.toHex(),
|
|
8370
8324
|
swarms: this.networkManager.topics
|
|
8371
8325
|
}, {
|
|
8372
|
-
F:
|
|
8373
|
-
L:
|
|
8326
|
+
F: __dxlog_file27,
|
|
8327
|
+
L: 400,
|
|
8374
8328
|
S: this,
|
|
8375
8329
|
C: (f, a) => f(...a)
|
|
8376
8330
|
});
|
|
@@ -8382,9 +8336,9 @@ var ServiceContext = class extends Resource8 {
|
|
|
8382
8336
|
await warnAfterTimeout2(1e4, "Waiting for identity to be ready for edge connection", async () => {
|
|
8383
8337
|
await identity.ready();
|
|
8384
8338
|
});
|
|
8385
|
-
|
|
8386
|
-
F:
|
|
8387
|
-
L:
|
|
8339
|
+
invariant22(identity.deviceCredentialChain, void 0, {
|
|
8340
|
+
F: __dxlog_file27,
|
|
8341
|
+
L: 419,
|
|
8388
8342
|
S: this,
|
|
8389
8343
|
A: [
|
|
8390
8344
|
"identity.deviceCredentialChain",
|
|
@@ -8410,13 +8364,13 @@ var ServiceContext = class extends Resource8 {
|
|
|
8410
8364
|
}
|
|
8411
8365
|
}
|
|
8412
8366
|
};
|
|
8413
|
-
|
|
8367
|
+
_ts_decorate8([
|
|
8414
8368
|
Trace3.span()
|
|
8415
8369
|
], ServiceContext.prototype, "_open", null);
|
|
8416
|
-
|
|
8370
|
+
_ts_decorate8([
|
|
8417
8371
|
Trace3.span()
|
|
8418
8372
|
], ServiceContext.prototype, "_initialize", null);
|
|
8419
|
-
ServiceContext =
|
|
8373
|
+
ServiceContext = _ts_decorate8([
|
|
8420
8374
|
safeInstanceof("dxos.client-services.ServiceContext"),
|
|
8421
8375
|
Trace3.resource()
|
|
8422
8376
|
], ServiceContext);
|
|
@@ -8444,16 +8398,24 @@ var StorageDriver = Runtime2.Client.Storage.StorageDriver;
|
|
|
8444
8398
|
var createStorageObjects = (config) => {
|
|
8445
8399
|
const { persistent = false, keyStore, dataStore } = config ?? {};
|
|
8446
8400
|
if (persistent && dataStore === StorageDriver.RAM) {
|
|
8447
|
-
throw new InvalidConfigError(
|
|
8401
|
+
throw new InvalidConfigError({
|
|
8402
|
+
message: "RAM storage cannot be used in persistent mode."
|
|
8403
|
+
});
|
|
8448
8404
|
}
|
|
8449
8405
|
if (!persistent && dataStore !== void 0 && dataStore !== StorageDriver.RAM) {
|
|
8450
|
-
throw new InvalidConfigError(
|
|
8406
|
+
throw new InvalidConfigError({
|
|
8407
|
+
message: "Cannot use a persistent storage in not persistent mode."
|
|
8408
|
+
});
|
|
8451
8409
|
}
|
|
8452
8410
|
if (persistent && keyStore === StorageDriver.RAM) {
|
|
8453
|
-
throw new InvalidConfigError(
|
|
8411
|
+
throw new InvalidConfigError({
|
|
8412
|
+
message: "RAM key storage cannot be used in persistent mode."
|
|
8413
|
+
});
|
|
8454
8414
|
}
|
|
8455
8415
|
if (!persistent && keyStore !== StorageDriver.RAM && keyStore !== void 0) {
|
|
8456
|
-
throw new InvalidConfigError(
|
|
8416
|
+
throw new InvalidConfigError({
|
|
8417
|
+
message: "Cannot use a persistent key storage in not persistent mode."
|
|
8418
|
+
});
|
|
8457
8419
|
}
|
|
8458
8420
|
return {
|
|
8459
8421
|
storage: createStorage({
|
|
@@ -8495,165 +8457,6 @@ var createLevel = async (config) => {
|
|
|
8495
8457
|
return level;
|
|
8496
8458
|
};
|
|
8497
8459
|
|
|
8498
|
-
// src/packlets/storage/profile-archive.ts
|
|
8499
|
-
import { cbor } from "@automerge/automerge-repo";
|
|
8500
|
-
import { invariant as invariant24 } from "@dxos/invariant";
|
|
8501
|
-
import { log as log25 } from "@dxos/log";
|
|
8502
|
-
import { ProfileArchiveEntryType } from "@dxos/protocols";
|
|
8503
|
-
import { arrayToBuffer as arrayToBuffer2 } from "@dxos/util";
|
|
8504
|
-
var __dxlog_file29 = "/__w/dxos/dxos/packages/sdk/client-services/src/packlets/storage/profile-archive.ts";
|
|
8505
|
-
var encodeProfileArchive = (profile) => cbor.encode(profile);
|
|
8506
|
-
var decodeProfileArchive = (data) => cbor.decode(data);
|
|
8507
|
-
var exportProfileData = async ({ storage, level }) => {
|
|
8508
|
-
const archive = {
|
|
8509
|
-
storage: [],
|
|
8510
|
-
meta: {
|
|
8511
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
8512
|
-
}
|
|
8513
|
-
};
|
|
8514
|
-
{
|
|
8515
|
-
const directory = await storage.createDirectory();
|
|
8516
|
-
const files = await directory.list();
|
|
8517
|
-
log25.info("begin exporting files", {
|
|
8518
|
-
count: files.length
|
|
8519
|
-
}, {
|
|
8520
|
-
F: __dxlog_file29,
|
|
8521
|
-
L: 31,
|
|
8522
|
-
S: void 0,
|
|
8523
|
-
C: (f, a) => f(...a)
|
|
8524
|
-
});
|
|
8525
|
-
for (const filename of files) {
|
|
8526
|
-
const file = await directory.getOrCreateFile(filename);
|
|
8527
|
-
const { size } = await file.stat();
|
|
8528
|
-
const data = await file.read(0, size);
|
|
8529
|
-
archive.storage.push({
|
|
8530
|
-
type: ProfileArchiveEntryType.FILE,
|
|
8531
|
-
key: filename,
|
|
8532
|
-
value: data
|
|
8533
|
-
});
|
|
8534
|
-
}
|
|
8535
|
-
log25.info("done exporting files", {
|
|
8536
|
-
count: files.length
|
|
8537
|
-
}, {
|
|
8538
|
-
F: __dxlog_file29,
|
|
8539
|
-
L: 42,
|
|
8540
|
-
S: void 0,
|
|
8541
|
-
C: (f, a) => f(...a)
|
|
8542
|
-
});
|
|
8543
|
-
}
|
|
8544
|
-
{
|
|
8545
|
-
log25.info("begin exporting kv pairs", void 0, {
|
|
8546
|
-
F: __dxlog_file29,
|
|
8547
|
-
L: 46,
|
|
8548
|
-
S: void 0,
|
|
8549
|
-
C: (f, a) => f(...a)
|
|
8550
|
-
});
|
|
8551
|
-
const iter = await level.iterator({
|
|
8552
|
-
keyEncoding: "binary",
|
|
8553
|
-
valueEncoding: "binary"
|
|
8554
|
-
});
|
|
8555
|
-
let count = 0;
|
|
8556
|
-
for await (const [key, value] of iter) {
|
|
8557
|
-
archive.storage.push({
|
|
8558
|
-
type: ProfileArchiveEntryType.KEY_VALUE,
|
|
8559
|
-
key,
|
|
8560
|
-
value
|
|
8561
|
-
});
|
|
8562
|
-
count++;
|
|
8563
|
-
}
|
|
8564
|
-
log25.info("done exporting kv pairs", {
|
|
8565
|
-
count
|
|
8566
|
-
}, {
|
|
8567
|
-
F: __dxlog_file29,
|
|
8568
|
-
L: 57,
|
|
8569
|
-
S: void 0,
|
|
8570
|
-
C: (f, a) => f(...a)
|
|
8571
|
-
});
|
|
8572
|
-
}
|
|
8573
|
-
return archive;
|
|
8574
|
-
};
|
|
8575
|
-
var importProfileData = async ({ storage, level }, archive) => {
|
|
8576
|
-
let batch = level.batch();
|
|
8577
|
-
let count = 0;
|
|
8578
|
-
for (const entry2 of archive.storage) {
|
|
8579
|
-
switch (entry2.type) {
|
|
8580
|
-
case ProfileArchiveEntryType.FILE: {
|
|
8581
|
-
const directory = await storage.createDirectory();
|
|
8582
|
-
invariant24(typeof entry2.key === "string", "Invalid key type", {
|
|
8583
|
-
F: __dxlog_file29,
|
|
8584
|
-
L: 80,
|
|
8585
|
-
S: void 0,
|
|
8586
|
-
A: [
|
|
8587
|
-
"typeof entry.key === 'string'",
|
|
8588
|
-
"'Invalid key type'"
|
|
8589
|
-
]
|
|
8590
|
-
});
|
|
8591
|
-
const file = await directory.getOrCreateFile(entry2.key);
|
|
8592
|
-
invariant24(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
8593
|
-
F: __dxlog_file29,
|
|
8594
|
-
L: 82,
|
|
8595
|
-
S: void 0,
|
|
8596
|
-
A: [
|
|
8597
|
-
"entry.value instanceof Uint8Array",
|
|
8598
|
-
"'Invalid value type'"
|
|
8599
|
-
]
|
|
8600
|
-
});
|
|
8601
|
-
await file.write(0, arrayToBuffer2(entry2.value));
|
|
8602
|
-
await file.close();
|
|
8603
|
-
break;
|
|
8604
|
-
}
|
|
8605
|
-
case ProfileArchiveEntryType.KEY_VALUE: {
|
|
8606
|
-
invariant24(entry2.key instanceof Uint8Array, "Invalid key type", {
|
|
8607
|
-
F: __dxlog_file29,
|
|
8608
|
-
L: 88,
|
|
8609
|
-
S: void 0,
|
|
8610
|
-
A: [
|
|
8611
|
-
"entry.key instanceof Uint8Array",
|
|
8612
|
-
"'Invalid key type'"
|
|
8613
|
-
]
|
|
8614
|
-
});
|
|
8615
|
-
invariant24(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
8616
|
-
F: __dxlog_file29,
|
|
8617
|
-
L: 89,
|
|
8618
|
-
S: void 0,
|
|
8619
|
-
A: [
|
|
8620
|
-
"entry.value instanceof Uint8Array",
|
|
8621
|
-
"'Invalid value type'"
|
|
8622
|
-
]
|
|
8623
|
-
});
|
|
8624
|
-
batch.put(entry2.key, entry2.value, {
|
|
8625
|
-
keyEncoding: "binary",
|
|
8626
|
-
valueEncoding: "binary"
|
|
8627
|
-
});
|
|
8628
|
-
break;
|
|
8629
|
-
}
|
|
8630
|
-
default:
|
|
8631
|
-
throw new Error(`Invalid entry type: ${entry2.type}`);
|
|
8632
|
-
}
|
|
8633
|
-
if (++count % 1e3 === 0) {
|
|
8634
|
-
await batch.write();
|
|
8635
|
-
batch = level.batch();
|
|
8636
|
-
log25.info("importing", {
|
|
8637
|
-
count,
|
|
8638
|
-
total: archive.storage.length,
|
|
8639
|
-
progress: `${(count / archive.storage.length * 100).toFixed()}%`
|
|
8640
|
-
}, {
|
|
8641
|
-
F: __dxlog_file29,
|
|
8642
|
-
L: 102,
|
|
8643
|
-
S: void 0,
|
|
8644
|
-
C: (f, a) => f(...a)
|
|
8645
|
-
});
|
|
8646
|
-
}
|
|
8647
|
-
}
|
|
8648
|
-
log25.info("committing changes..", void 0, {
|
|
8649
|
-
F: __dxlog_file29,
|
|
8650
|
-
L: 110,
|
|
8651
|
-
S: void 0,
|
|
8652
|
-
C: (f, a) => f(...a)
|
|
8653
|
-
});
|
|
8654
|
-
await batch.write();
|
|
8655
|
-
};
|
|
8656
|
-
|
|
8657
8460
|
// src/packlets/services/service-registry.ts
|
|
8658
8461
|
var ServiceRegistry = class {
|
|
8659
8462
|
_serviceBundle;
|
|
@@ -8681,26 +8484,30 @@ var ServiceRegistry = class {
|
|
|
8681
8484
|
};
|
|
8682
8485
|
|
|
8683
8486
|
// src/packlets/services/service-host.ts
|
|
8487
|
+
import * as SqlClient from "@effect/sql/SqlClient";
|
|
8488
|
+
import * as Effect from "effect/Effect";
|
|
8684
8489
|
import { Event as Event11, synchronized as synchronized4 } from "@dxos/async";
|
|
8685
8490
|
import { clientServiceBundle } from "@dxos/client-protocol";
|
|
8686
8491
|
import { Context as Context11 } from "@dxos/context";
|
|
8687
8492
|
import { EdgeClient, EdgeHttpClient, createStubEdgeIdentity } from "@dxos/edge-client";
|
|
8688
|
-
import {
|
|
8493
|
+
import { RuntimeProvider } from "@dxos/effect";
|
|
8494
|
+
import { invariant as invariant24 } from "@dxos/invariant";
|
|
8689
8495
|
import { PublicKey as PublicKey19 } from "@dxos/keys";
|
|
8690
|
-
import { log as
|
|
8496
|
+
import { log as log25 } from "@dxos/log";
|
|
8691
8497
|
import { EdgeSignalManager, WebsocketSignalManager } from "@dxos/messaging";
|
|
8692
8498
|
import { SwarmNetworkManager, createIceProvider, createRtcTransportFactory } from "@dxos/network-manager";
|
|
8693
|
-
import { trace as
|
|
8499
|
+
import { trace as trace10 } from "@dxos/protocols";
|
|
8694
8500
|
import { SystemStatus } from "@dxos/protocols/proto/dxos/client/services";
|
|
8501
|
+
import * as SqlExport from "@dxos/sql-sqlite/SqlExport";
|
|
8695
8502
|
import { TRACE_PROCESSOR as TRACE_PROCESSOR3, trace as Trace4 } from "@dxos/tracing";
|
|
8696
8503
|
import { WebsocketRpcClient } from "@dxos/websocket-rpc";
|
|
8697
8504
|
|
|
8698
8505
|
// src/packlets/devices/devices-service.ts
|
|
8699
8506
|
import { SubscriptionList as SubscriptionList3 } from "@dxos/async";
|
|
8700
|
-
import { Stream as
|
|
8701
|
-
import { invariant as
|
|
8507
|
+
import { Stream as Stream11 } from "@dxos/codec-protobuf/stream";
|
|
8508
|
+
import { invariant as invariant23 } from "@dxos/invariant";
|
|
8702
8509
|
import { Device as Device2, DeviceKind as DeviceKind2, EdgeStatus as EdgeStatus3 } from "@dxos/protocols/proto/dxos/client/services";
|
|
8703
|
-
var
|
|
8510
|
+
var __dxlog_file28 = "/__w/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
|
|
8704
8511
|
var DevicesServiceImpl = class {
|
|
8705
8512
|
_identityManager;
|
|
8706
8513
|
_edgeConnection;
|
|
@@ -8712,7 +8519,7 @@ var DevicesServiceImpl = class {
|
|
|
8712
8519
|
return this._identityManager.updateDeviceProfile(profile);
|
|
8713
8520
|
}
|
|
8714
8521
|
queryDevices() {
|
|
8715
|
-
return new
|
|
8522
|
+
return new Stream11(({ next }) => {
|
|
8716
8523
|
const update = () => {
|
|
8717
8524
|
const deviceKeys = this._identityManager.identity?.authorizedDeviceKeys;
|
|
8718
8525
|
if (!deviceKeys) {
|
|
@@ -8720,8 +8527,8 @@ var DevicesServiceImpl = class {
|
|
|
8720
8527
|
devices: []
|
|
8721
8528
|
});
|
|
8722
8529
|
} else {
|
|
8723
|
-
|
|
8724
|
-
F:
|
|
8530
|
+
invariant23(this._identityManager.identity?.presence, "presence not present", {
|
|
8531
|
+
F: __dxlog_file28,
|
|
8725
8532
|
L: 37,
|
|
8726
8533
|
S: this,
|
|
8727
8534
|
A: [
|
|
@@ -8789,7 +8596,7 @@ var DevicesServiceImpl = class {
|
|
|
8789
8596
|
|
|
8790
8597
|
// src/packlets/identity/contacts-service.ts
|
|
8791
8598
|
import { SubscriptionList as SubscriptionList4, UpdateScheduler as UpdateScheduler2, scheduleTask as scheduleTask9 } from "@dxos/async";
|
|
8792
|
-
import { Stream as
|
|
8599
|
+
import { Stream as Stream12 } from "@dxos/codec-protobuf/stream";
|
|
8793
8600
|
import { PublicKey as PublicKey17 } from "@dxos/keys";
|
|
8794
8601
|
import { ComplexMap as ComplexMap5, ComplexSet as ComplexSet6 } from "@dxos/util";
|
|
8795
8602
|
var ContactsServiceImpl = class {
|
|
@@ -8843,7 +8650,7 @@ var ContactsServiceImpl = class {
|
|
|
8843
8650
|
}
|
|
8844
8651
|
queryContacts() {
|
|
8845
8652
|
const subscribedSpaceKeySet = new ComplexSet6(PublicKey17.hash);
|
|
8846
|
-
return new
|
|
8653
|
+
return new Stream12(({ next, ctx }) => {
|
|
8847
8654
|
const pushUpdateTask = new UpdateScheduler2(ctx, async () => {
|
|
8848
8655
|
const contacts = await this.getContacts();
|
|
8849
8656
|
next(contacts);
|
|
@@ -8875,9 +8682,9 @@ var ContactsServiceImpl = class {
|
|
|
8875
8682
|
|
|
8876
8683
|
// src/packlets/logging/logging-service.ts
|
|
8877
8684
|
import { Event as Event10 } from "@dxos/async";
|
|
8878
|
-
import { Stream as
|
|
8685
|
+
import { Stream as Stream13 } from "@dxos/codec-protobuf/stream";
|
|
8879
8686
|
import { PublicKey as PublicKey18 } from "@dxos/keys";
|
|
8880
|
-
import { getContextFromEntry, log as
|
|
8687
|
+
import { getContextFromEntry, log as log24 } from "@dxos/log";
|
|
8881
8688
|
import { QueryLogsRequest } from "@dxos/protocols/proto/dxos/client/services";
|
|
8882
8689
|
import { getDebugName, jsonify, numericalValues, tracer } from "@dxos/util";
|
|
8883
8690
|
var LoggingServiceImpl = class {
|
|
@@ -8885,11 +8692,11 @@ var LoggingServiceImpl = class {
|
|
|
8885
8692
|
_started = Date.now();
|
|
8886
8693
|
_sessionId = PublicKey18.random().toHex();
|
|
8887
8694
|
async open() {
|
|
8888
|
-
|
|
8695
|
+
log24.runtimeConfig.processors.push(this._logProcessor);
|
|
8889
8696
|
}
|
|
8890
8697
|
async close() {
|
|
8891
|
-
const index =
|
|
8892
|
-
|
|
8698
|
+
const index = log24.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
|
|
8699
|
+
log24.runtimeConfig.processors.splice(index, 1);
|
|
8893
8700
|
}
|
|
8894
8701
|
async controlMetrics({ reset, record }) {
|
|
8895
8702
|
if (reset) {
|
|
@@ -8915,7 +8722,7 @@ var LoggingServiceImpl = class {
|
|
|
8915
8722
|
stats: numericalValues(events, "duration")
|
|
8916
8723
|
};
|
|
8917
8724
|
};
|
|
8918
|
-
return new
|
|
8725
|
+
return new Stream13(({ next }) => {
|
|
8919
8726
|
const update = () => {
|
|
8920
8727
|
const metrics2 = {
|
|
8921
8728
|
timestamp: /* @__PURE__ */ new Date(),
|
|
@@ -8937,7 +8744,7 @@ var LoggingServiceImpl = class {
|
|
|
8937
8744
|
});
|
|
8938
8745
|
}
|
|
8939
8746
|
queryLogs(request) {
|
|
8940
|
-
return new
|
|
8747
|
+
return new Stream13(({ ctx, next }) => {
|
|
8941
8748
|
const handler = (entry2) => {
|
|
8942
8749
|
if (LOG_PROCESSING > 0) {
|
|
8943
8750
|
return;
|
|
@@ -8997,7 +8804,7 @@ var shouldLog = (entry2, request) => {
|
|
|
8997
8804
|
var LOG_PROCESSING = 0;
|
|
8998
8805
|
|
|
8999
8806
|
// src/packlets/network/network-service.ts
|
|
9000
|
-
import { Stream as
|
|
8807
|
+
import { Stream as Stream14 } from "@dxos/codec-protobuf/stream";
|
|
9001
8808
|
var NetworkServiceImpl = class {
|
|
9002
8809
|
networkManager;
|
|
9003
8810
|
signalManager;
|
|
@@ -9008,7 +8815,7 @@ var NetworkServiceImpl = class {
|
|
|
9008
8815
|
this.edgeConnection = edgeConnection;
|
|
9009
8816
|
}
|
|
9010
8817
|
queryStatus() {
|
|
9011
|
-
return new
|
|
8818
|
+
return new Stream14(({ ctx, next }) => {
|
|
9012
8819
|
const update = () => {
|
|
9013
8820
|
next({
|
|
9014
8821
|
swarm: this.networkManager.connectionState,
|
|
@@ -9037,7 +8844,7 @@ var NetworkServiceImpl = class {
|
|
|
9037
8844
|
return this.signalManager.query(request);
|
|
9038
8845
|
}
|
|
9039
8846
|
subscribeSwarmState(request) {
|
|
9040
|
-
return new
|
|
8847
|
+
return new Stream14(({ ctx, next }) => {
|
|
9041
8848
|
this.signalManager.swarmState?.on(ctx, (state) => {
|
|
9042
8849
|
if (request.topic.equals(state.swarmKey)) {
|
|
9043
8850
|
next(state);
|
|
@@ -9049,7 +8856,7 @@ var NetworkServiceImpl = class {
|
|
|
9049
8856
|
return this.signalManager.sendMessage(message);
|
|
9050
8857
|
}
|
|
9051
8858
|
subscribeMessages(peer) {
|
|
9052
|
-
return new
|
|
8859
|
+
return new Stream14(({ ctx, next }) => {
|
|
9053
8860
|
this.signalManager.onMessage.on(ctx, (message) => {
|
|
9054
8861
|
if (message.recipient.peerKey === peer.peerKey) {
|
|
9055
8862
|
next(message);
|
|
@@ -9060,7 +8867,7 @@ var NetworkServiceImpl = class {
|
|
|
9060
8867
|
};
|
|
9061
8868
|
|
|
9062
8869
|
// src/packlets/system/system-service.ts
|
|
9063
|
-
import { Stream as
|
|
8870
|
+
import { Stream as Stream15 } from "@dxos/codec-protobuf/stream";
|
|
9064
8871
|
import { GetDiagnosticsRequest as GetDiagnosticsRequest2 } from "@dxos/protocols/proto/dxos/client/services";
|
|
9065
8872
|
import { jsonKeyReplacer as jsonKeyReplacer2 } from "@dxos/util";
|
|
9066
8873
|
var SystemServiceImpl = class {
|
|
@@ -9102,7 +8909,7 @@ var SystemServiceImpl = class {
|
|
|
9102
8909
|
}
|
|
9103
8910
|
// TODO(burdon): Standardize interval option in stream request?
|
|
9104
8911
|
queryStatus({ interval = 3e3 } = {}) {
|
|
9105
|
-
return new
|
|
8912
|
+
return new Stream15(({ next }) => {
|
|
9106
8913
|
const update = () => {
|
|
9107
8914
|
next({
|
|
9108
8915
|
status: this._getCurrentStatus()
|
|
@@ -9123,13 +8930,13 @@ var SystemServiceImpl = class {
|
|
|
9123
8930
|
};
|
|
9124
8931
|
|
|
9125
8932
|
// src/packlets/services/service-host.ts
|
|
9126
|
-
function
|
|
8933
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
9127
8934
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9128
8935
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9129
8936
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9130
8937
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9131
8938
|
}
|
|
9132
|
-
var
|
|
8939
|
+
var __dxlog_file29 = "/__w/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
|
|
9133
8940
|
var ClientServicesHost = class {
|
|
9134
8941
|
_resourceLock;
|
|
9135
8942
|
_serviceRegistry;
|
|
@@ -9147,7 +8954,8 @@ var ClientServicesHost = class {
|
|
|
9147
8954
|
_edgeConnection = void 0;
|
|
9148
8955
|
_edgeHttpClient = void 0;
|
|
9149
8956
|
_serviceContext;
|
|
9150
|
-
|
|
8957
|
+
_runtime;
|
|
8958
|
+
_runtimeProps;
|
|
9151
8959
|
diagnosticsBroadcastHandler;
|
|
9152
8960
|
_opening = false;
|
|
9153
8961
|
_open = false;
|
|
@@ -9161,18 +8969,14 @@ var ClientServicesHost = class {
|
|
|
9161
8969
|
// TODO(wittjosiah): Turn this on by default.
|
|
9162
8970
|
lockKey,
|
|
9163
8971
|
callbacks,
|
|
9164
|
-
|
|
9165
|
-
|
|
8972
|
+
runtime,
|
|
8973
|
+
runtimeProps
|
|
8974
|
+
}) {
|
|
9166
8975
|
this._storage = storage;
|
|
9167
8976
|
this._level = level;
|
|
9168
8977
|
this._callbacks = callbacks;
|
|
9169
|
-
this.
|
|
9170
|
-
|
|
9171
|
-
this._runtimeParams.disableP2pReplication = config?.get("runtime.client.disableP2pReplication", false);
|
|
9172
|
-
}
|
|
9173
|
-
if (this._runtimeParams.enableVectorIndexing === void 0) {
|
|
9174
|
-
this._runtimeParams.enableVectorIndexing = config?.get("runtime.client.enableVectorIndexing", false);
|
|
9175
|
-
}
|
|
8978
|
+
this._runtime = runtime;
|
|
8979
|
+
this._runtimeProps = runtimeProps ?? {};
|
|
9176
8980
|
if (config) {
|
|
9177
8981
|
this.initialize({
|
|
9178
8982
|
config,
|
|
@@ -9181,13 +8985,13 @@ var ClientServicesHost = class {
|
|
|
9181
8985
|
});
|
|
9182
8986
|
}
|
|
9183
8987
|
if (lockKey) {
|
|
9184
|
-
this._resourceLock = new Lock({
|
|
8988
|
+
this._resourceLock = new locks_exports.Lock({
|
|
9185
8989
|
lockKey,
|
|
9186
8990
|
onAcquire: () => {
|
|
9187
8991
|
if (!this._opening) {
|
|
9188
8992
|
void this.open(new Context11(void 0, {
|
|
9189
|
-
F:
|
|
9190
|
-
L:
|
|
8993
|
+
F: __dxlog_file29,
|
|
8994
|
+
L: 147
|
|
9191
8995
|
}));
|
|
9192
8996
|
}
|
|
9193
8997
|
},
|
|
@@ -9212,7 +9016,7 @@ var ClientServicesHost = class {
|
|
|
9212
9016
|
await this.reset();
|
|
9213
9017
|
}
|
|
9214
9018
|
});
|
|
9215
|
-
this.diagnosticsBroadcastHandler = createCollectDiagnosticsBroadcastHandler(this._systemService);
|
|
9019
|
+
this.diagnosticsBroadcastHandler = (0, diagnostics_exports.createCollectDiagnosticsBroadcastHandler)(this._systemService);
|
|
9216
9020
|
this._loggingService = new LoggingServiceImpl();
|
|
9217
9021
|
this._serviceRegistry = new ServiceRegistry(clientServiceBundle, {
|
|
9218
9022
|
SystemService: this._systemService,
|
|
@@ -9238,30 +9042,57 @@ var ClientServicesHost = class {
|
|
|
9238
9042
|
return this._serviceRegistry.services;
|
|
9239
9043
|
}
|
|
9240
9044
|
/**
|
|
9045
|
+
* Debugging util.
|
|
9046
|
+
*/
|
|
9047
|
+
async exportSqliteDatabase() {
|
|
9048
|
+
return await RuntimeProvider.runPromise(this._runtime)(Effect.gen(function* () {
|
|
9049
|
+
const sql = yield* SqlExport.SqlExport;
|
|
9050
|
+
return yield* sql.export;
|
|
9051
|
+
}));
|
|
9052
|
+
}
|
|
9053
|
+
/**
|
|
9054
|
+
* Debugging util.
|
|
9055
|
+
*/
|
|
9056
|
+
async runSqliteQuery(query, params) {
|
|
9057
|
+
return await RuntimeProvider.runPromise(this._runtime)(Effect.gen(function* () {
|
|
9058
|
+
const sql = yield* SqlClient.SqlClient;
|
|
9059
|
+
return yield* sql`${sql.unsafe(query, params)}`;
|
|
9060
|
+
}));
|
|
9061
|
+
}
|
|
9062
|
+
/**
|
|
9241
9063
|
* Initialize the service host with the config.
|
|
9242
9064
|
* Config can also be provided in the constructor.
|
|
9243
9065
|
* Can only be called once.
|
|
9244
9066
|
*/
|
|
9245
9067
|
initialize({ config, ...options }) {
|
|
9246
|
-
|
|
9247
|
-
F:
|
|
9248
|
-
L:
|
|
9068
|
+
invariant24(!this._open, "service host is open", {
|
|
9069
|
+
F: __dxlog_file29,
|
|
9070
|
+
L: 237,
|
|
9249
9071
|
S: this,
|
|
9250
9072
|
A: [
|
|
9251
9073
|
"!this._open",
|
|
9252
9074
|
"'service host is open'"
|
|
9253
9075
|
]
|
|
9254
9076
|
});
|
|
9255
|
-
|
|
9256
|
-
F:
|
|
9257
|
-
L:
|
|
9077
|
+
log25("initializing...", void 0, {
|
|
9078
|
+
F: __dxlog_file29,
|
|
9079
|
+
L: 238,
|
|
9258
9080
|
S: this,
|
|
9259
9081
|
C: (f, a) => f(...a)
|
|
9260
9082
|
});
|
|
9261
9083
|
if (config) {
|
|
9262
|
-
|
|
9263
|
-
|
|
9264
|
-
|
|
9084
|
+
if (this._runtimeProps.disableP2pReplication === void 0) {
|
|
9085
|
+
this._runtimeProps.disableP2pReplication = config?.get("runtime.client.disableP2pReplication", false);
|
|
9086
|
+
}
|
|
9087
|
+
if (this._runtimeProps.enableVectorIndexing === void 0) {
|
|
9088
|
+
this._runtimeProps.enableVectorIndexing = config?.get("runtime.client.enableVectorIndexing", false);
|
|
9089
|
+
}
|
|
9090
|
+
if (this._runtimeProps.enableLocalQueues === void 0) {
|
|
9091
|
+
this._runtimeProps.enableLocalQueues = config?.get("runtime.client.enableLocalQueues", false);
|
|
9092
|
+
}
|
|
9093
|
+
invariant24(!this._config, "config already set", {
|
|
9094
|
+
F: __dxlog_file29,
|
|
9095
|
+
L: 251,
|
|
9265
9096
|
S: this,
|
|
9266
9097
|
A: [
|
|
9267
9098
|
"!this._config",
|
|
@@ -9288,9 +9119,9 @@ var ClientServicesHost = class {
|
|
|
9288
9119
|
edgeConnection: this._edgeConnection
|
|
9289
9120
|
}) : new WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
|
|
9290
9121
|
this._signalManager = signalManager;
|
|
9291
|
-
|
|
9292
|
-
F:
|
|
9293
|
-
L:
|
|
9122
|
+
invariant24(!this._networkManager, "network manager already set", {
|
|
9123
|
+
F: __dxlog_file29,
|
|
9124
|
+
L: 282,
|
|
9294
9125
|
S: this,
|
|
9295
9126
|
A: [
|
|
9296
9127
|
"!this._networkManager",
|
|
@@ -9306,9 +9137,9 @@ var ClientServicesHost = class {
|
|
|
9306
9137
|
peerKey: this._edgeConnection.peerKey
|
|
9307
9138
|
} : void 0
|
|
9308
9139
|
});
|
|
9309
|
-
|
|
9310
|
-
F:
|
|
9311
|
-
L:
|
|
9140
|
+
log25("initialized", void 0, {
|
|
9141
|
+
F: __dxlog_file29,
|
|
9142
|
+
L: 295,
|
|
9312
9143
|
S: this,
|
|
9313
9144
|
C: (f, a) => f(...a)
|
|
9314
9145
|
});
|
|
@@ -9318,44 +9149,44 @@ var ClientServicesHost = class {
|
|
|
9318
9149
|
return;
|
|
9319
9150
|
}
|
|
9320
9151
|
const traceId = PublicKey19.random().toHex();
|
|
9321
|
-
|
|
9152
|
+
log25.trace("dxos.client-services.host.open", trace10.begin({
|
|
9322
9153
|
id: traceId
|
|
9323
9154
|
}), {
|
|
9324
|
-
F:
|
|
9325
|
-
L:
|
|
9155
|
+
F: __dxlog_file29,
|
|
9156
|
+
L: 306,
|
|
9326
9157
|
S: this,
|
|
9327
9158
|
C: (f, a) => f(...a)
|
|
9328
9159
|
});
|
|
9329
|
-
|
|
9330
|
-
F:
|
|
9331
|
-
L:
|
|
9160
|
+
invariant24(this._config, "config not set", {
|
|
9161
|
+
F: __dxlog_file29,
|
|
9162
|
+
L: 308,
|
|
9332
9163
|
S: this,
|
|
9333
9164
|
A: [
|
|
9334
9165
|
"this._config",
|
|
9335
9166
|
"'config not set'"
|
|
9336
9167
|
]
|
|
9337
9168
|
});
|
|
9338
|
-
|
|
9339
|
-
F:
|
|
9340
|
-
L:
|
|
9169
|
+
invariant24(this._storage, "storage not set", {
|
|
9170
|
+
F: __dxlog_file29,
|
|
9171
|
+
L: 309,
|
|
9341
9172
|
S: this,
|
|
9342
9173
|
A: [
|
|
9343
9174
|
"this._storage",
|
|
9344
9175
|
"'storage not set'"
|
|
9345
9176
|
]
|
|
9346
9177
|
});
|
|
9347
|
-
|
|
9348
|
-
F:
|
|
9349
|
-
L:
|
|
9178
|
+
invariant24(this._signalManager, "signal manager not set", {
|
|
9179
|
+
F: __dxlog_file29,
|
|
9180
|
+
L: 310,
|
|
9350
9181
|
S: this,
|
|
9351
9182
|
A: [
|
|
9352
9183
|
"this._signalManager",
|
|
9353
9184
|
"'signal manager not set'"
|
|
9354
9185
|
]
|
|
9355
9186
|
});
|
|
9356
|
-
|
|
9357
|
-
F:
|
|
9358
|
-
L:
|
|
9187
|
+
invariant24(this._networkManager, "network manager not set", {
|
|
9188
|
+
F: __dxlog_file29,
|
|
9189
|
+
L: 311,
|
|
9359
9190
|
S: this,
|
|
9360
9191
|
A: [
|
|
9361
9192
|
"this._networkManager",
|
|
@@ -9363,11 +9194,11 @@ var ClientServicesHost = class {
|
|
|
9363
9194
|
]
|
|
9364
9195
|
});
|
|
9365
9196
|
this._opening = true;
|
|
9366
|
-
|
|
9197
|
+
log25("opening...", {
|
|
9367
9198
|
lockKey: this._resourceLock?.lockKey
|
|
9368
9199
|
}, {
|
|
9369
|
-
F:
|
|
9370
|
-
L:
|
|
9200
|
+
F: __dxlog_file29,
|
|
9201
|
+
L: 314,
|
|
9371
9202
|
S: this,
|
|
9372
9203
|
C: (f, a) => f(...a)
|
|
9373
9204
|
});
|
|
@@ -9377,7 +9208,7 @@ var ClientServicesHost = class {
|
|
|
9377
9208
|
}
|
|
9378
9209
|
await this._level.open();
|
|
9379
9210
|
await this._loggingService.open();
|
|
9380
|
-
this._serviceContext = new ServiceContext(this._storage, this._level, this._networkManager, this._signalManager, this._edgeConnection, this._edgeHttpClient, this.
|
|
9211
|
+
this._serviceContext = new ServiceContext(this._storage, this._level, this._networkManager, this._signalManager, this._edgeConnection, this._edgeHttpClient, this._runtime, this._runtimeProps, this._config.get("runtime.client.edgeFeatures"));
|
|
9381
9212
|
const dataSpaceManagerProvider = async () => {
|
|
9382
9213
|
await this._serviceContext.initialized.wait();
|
|
9383
9214
|
return this._serviceContext.dataSpaceManager;
|
|
@@ -9396,6 +9227,7 @@ var ClientServicesHost = class {
|
|
|
9396
9227
|
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
|
|
9397
9228
|
DataService: this._serviceContext.echoHost.dataService,
|
|
9398
9229
|
QueryService: this._serviceContext.echoHost.queryService,
|
|
9230
|
+
QueueService: this._serviceContext.echoHost.queuesService,
|
|
9399
9231
|
NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager, this._edgeConnection),
|
|
9400
9232
|
LoggingService: this._loggingService,
|
|
9401
9233
|
TracingService: this._tracingService,
|
|
@@ -9424,19 +9256,19 @@ var ClientServicesHost = class {
|
|
|
9424
9256
|
this._open = true;
|
|
9425
9257
|
this._statusUpdate.emit();
|
|
9426
9258
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
9427
|
-
|
|
9259
|
+
log25("opened", {
|
|
9428
9260
|
deviceKey
|
|
9429
9261
|
}, {
|
|
9430
|
-
F:
|
|
9431
|
-
L:
|
|
9262
|
+
F: __dxlog_file29,
|
|
9263
|
+
L: 417,
|
|
9432
9264
|
S: this,
|
|
9433
9265
|
C: (f, a) => f(...a)
|
|
9434
9266
|
});
|
|
9435
|
-
|
|
9267
|
+
log25.trace("dxos.client-services.host.open", trace10.end({
|
|
9436
9268
|
id: traceId
|
|
9437
9269
|
}), {
|
|
9438
|
-
F:
|
|
9439
|
-
L:
|
|
9270
|
+
F: __dxlog_file29,
|
|
9271
|
+
L: 418,
|
|
9440
9272
|
S: this,
|
|
9441
9273
|
C: (f, a) => f(...a)
|
|
9442
9274
|
});
|
|
@@ -9446,11 +9278,11 @@ var ClientServicesHost = class {
|
|
|
9446
9278
|
return;
|
|
9447
9279
|
}
|
|
9448
9280
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
9449
|
-
|
|
9281
|
+
log25("closing...", {
|
|
9450
9282
|
deviceKey
|
|
9451
9283
|
}, {
|
|
9452
|
-
F:
|
|
9453
|
-
L:
|
|
9284
|
+
F: __dxlog_file29,
|
|
9285
|
+
L: 429,
|
|
9454
9286
|
S: this,
|
|
9455
9287
|
C: (f, a) => f(...a)
|
|
9456
9288
|
});
|
|
@@ -9464,28 +9296,28 @@ var ClientServicesHost = class {
|
|
|
9464
9296
|
await this._level?.close();
|
|
9465
9297
|
this._open = false;
|
|
9466
9298
|
this._statusUpdate.emit();
|
|
9467
|
-
|
|
9299
|
+
log25("closed", {
|
|
9468
9300
|
deviceKey
|
|
9469
9301
|
}, {
|
|
9470
|
-
F:
|
|
9471
|
-
L:
|
|
9302
|
+
F: __dxlog_file29,
|
|
9303
|
+
L: 438,
|
|
9472
9304
|
S: this,
|
|
9473
9305
|
C: (f, a) => f(...a)
|
|
9474
9306
|
});
|
|
9475
9307
|
}
|
|
9476
9308
|
async reset() {
|
|
9477
9309
|
const traceId = PublicKey19.random().toHex();
|
|
9478
|
-
|
|
9310
|
+
log25.trace("dxos.sdk.client-services-host.reset", trace10.begin({
|
|
9479
9311
|
id: traceId
|
|
9480
9312
|
}), {
|
|
9481
|
-
F:
|
|
9482
|
-
L:
|
|
9313
|
+
F: __dxlog_file29,
|
|
9314
|
+
L: 443,
|
|
9483
9315
|
S: this,
|
|
9484
9316
|
C: (f, a) => f(...a)
|
|
9485
9317
|
});
|
|
9486
|
-
|
|
9487
|
-
F:
|
|
9488
|
-
L:
|
|
9318
|
+
log25.info("resetting...", void 0, {
|
|
9319
|
+
F: __dxlog_file29,
|
|
9320
|
+
L: 445,
|
|
9489
9321
|
S: this,
|
|
9490
9322
|
C: (f, a) => f(...a)
|
|
9491
9323
|
});
|
|
@@ -9495,27 +9327,27 @@ var ClientServicesHost = class {
|
|
|
9495
9327
|
try {
|
|
9496
9328
|
await this._level.clear();
|
|
9497
9329
|
} catch (err) {
|
|
9498
|
-
|
|
9330
|
+
log25.warn("failed to clear leveldb during reset", {
|
|
9499
9331
|
err
|
|
9500
9332
|
}, {
|
|
9501
|
-
F:
|
|
9502
|
-
L:
|
|
9333
|
+
F: __dxlog_file29,
|
|
9334
|
+
L: 455,
|
|
9503
9335
|
S: this,
|
|
9504
9336
|
C: (f, a) => f(...a)
|
|
9505
9337
|
});
|
|
9506
9338
|
}
|
|
9507
9339
|
await this._storage.reset();
|
|
9508
|
-
|
|
9509
|
-
F:
|
|
9510
|
-
L:
|
|
9340
|
+
log25.info("reset", void 0, {
|
|
9341
|
+
F: __dxlog_file29,
|
|
9342
|
+
L: 458,
|
|
9511
9343
|
S: this,
|
|
9512
9344
|
C: (f, a) => f(...a)
|
|
9513
9345
|
});
|
|
9514
|
-
|
|
9346
|
+
log25.trace("dxos.sdk.client-services-host.reset", trace10.end({
|
|
9515
9347
|
id: traceId
|
|
9516
9348
|
}), {
|
|
9517
|
-
F:
|
|
9518
|
-
L:
|
|
9349
|
+
F: __dxlog_file29,
|
|
9350
|
+
L: 459,
|
|
9519
9351
|
S: this,
|
|
9520
9352
|
C: (f, a) => f(...a)
|
|
9521
9353
|
});
|
|
@@ -9527,24 +9359,24 @@ var ClientServicesHost = class {
|
|
|
9527
9359
|
return identity;
|
|
9528
9360
|
}
|
|
9529
9361
|
};
|
|
9530
|
-
|
|
9362
|
+
_ts_decorate9([
|
|
9531
9363
|
Trace4.info()
|
|
9532
9364
|
], ClientServicesHost.prototype, "_opening", void 0);
|
|
9533
|
-
|
|
9365
|
+
_ts_decorate9([
|
|
9534
9366
|
Trace4.info()
|
|
9535
9367
|
], ClientServicesHost.prototype, "_open", void 0);
|
|
9536
|
-
|
|
9368
|
+
_ts_decorate9([
|
|
9537
9369
|
Trace4.info()
|
|
9538
9370
|
], ClientServicesHost.prototype, "_resetting", void 0);
|
|
9539
|
-
|
|
9371
|
+
_ts_decorate9([
|
|
9540
9372
|
synchronized4,
|
|
9541
9373
|
Trace4.span()
|
|
9542
9374
|
], ClientServicesHost.prototype, "open", null);
|
|
9543
|
-
|
|
9375
|
+
_ts_decorate9([
|
|
9544
9376
|
synchronized4,
|
|
9545
9377
|
Trace4.span()
|
|
9546
9378
|
], ClientServicesHost.prototype, "close", null);
|
|
9547
|
-
ClientServicesHost =
|
|
9379
|
+
ClientServicesHost = _ts_decorate9([
|
|
9548
9380
|
Trace4.resource()
|
|
9549
9381
|
], ClientServicesHost);
|
|
9550
9382
|
|
|
@@ -9560,9 +9392,8 @@ export {
|
|
|
9560
9392
|
DevtoolsHostEvents,
|
|
9561
9393
|
DevtoolsServiceImpl,
|
|
9562
9394
|
createDiagnostics,
|
|
9563
|
-
createCollectDiagnosticsBroadcastSender,
|
|
9564
|
-
createCollectDiagnosticsBroadcastHandler,
|
|
9565
9395
|
DiagnosticsCollector,
|
|
9396
|
+
diagnostics_exports,
|
|
9566
9397
|
createAuthProvider,
|
|
9567
9398
|
TrustedKeySetAuthVerifier,
|
|
9568
9399
|
EdgeFeedReplicator,
|
|
@@ -9578,19 +9409,13 @@ export {
|
|
|
9578
9409
|
InvitationsServiceImpl,
|
|
9579
9410
|
SpaceInvitationProtocol,
|
|
9580
9411
|
InvitationsManager,
|
|
9581
|
-
|
|
9582
|
-
isLocked,
|
|
9583
|
-
ClientRpcServer,
|
|
9412
|
+
locks_exports,
|
|
9584
9413
|
EdgeAgentManager,
|
|
9585
9414
|
EdgeAgentServiceImpl,
|
|
9586
9415
|
ServiceContext,
|
|
9587
9416
|
createStorageObjects,
|
|
9588
9417
|
createLevel,
|
|
9589
|
-
encodeProfileArchive,
|
|
9590
|
-
decodeProfileArchive,
|
|
9591
|
-
exportProfileData,
|
|
9592
|
-
importProfileData,
|
|
9593
9418
|
ServiceRegistry,
|
|
9594
9419
|
ClientServicesHost
|
|
9595
9420
|
};
|
|
9596
|
-
//# sourceMappingURL=chunk-
|
|
9421
|
+
//# sourceMappingURL=chunk-34HKLADW.mjs.map
|