@dxos/client-services 0.1.51-main.49677b6 → 0.1.51-main.5787f10
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-BAHSFG33.mjs → chunk-2GQ7337P.mjs} +142 -83
- package/dist/lib/browser/chunk-2GQ7337P.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +8 -2
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/index.cjs +155 -96
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +179 -114
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/devtools/devtools.d.ts +2 -1
- package/dist/types/src/packlets/devtools/devtools.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/feeds.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/logging/logging-service.d.ts +1 -1
- package/dist/types/src/packlets/logging/logging-service.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts +5 -0
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +3 -0
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/package.json +31 -30
- package/src/packlets/devtools/devtools.ts +7 -0
- package/src/packlets/devtools/feeds.ts +1 -0
- package/src/packlets/identity/identity-manager.test.ts +4 -1
- package/src/packlets/identity/identity-manager.ts +4 -1
- package/src/packlets/identity/identity.test.ts +40 -15
- package/src/packlets/invitations/invitations-handler.ts +14 -6
- package/src/packlets/invitations/space-invitation-protocol.test.ts +8 -1
- package/src/packlets/logging/logging-service.ts +58 -15
- package/src/packlets/services/service-context.ts +7 -0
- package/src/packlets/spaces/data-space-manager.test.ts +64 -1
- package/src/packlets/spaces/data-space-manager.ts +2 -2
- package/src/packlets/spaces/data-space.ts +8 -3
- package/src/packlets/spaces/spaces-service.ts +7 -0
- package/src/packlets/testing/test-builder.ts +7 -0
- package/dist/lib/browser/chunk-BAHSFG33.mjs.map +0 -7
|
@@ -20,11 +20,15 @@ var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
|
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
next({
|
|
23
|
-
feeds: Array.from(feedMap.values()).map((feed) =>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
feeds: Array.from(feedMap.values()).map((feed) => {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
return {
|
|
26
|
+
feedKey: feed.key,
|
|
27
|
+
length: feed.properties.length,
|
|
28
|
+
bytes: feed.core.byteLength,
|
|
29
|
+
downloaded: (_b = (_a = feed.core.bitfield) == null ? void 0 : _a.data.toBuffer()) != null ? _b : new Uint8Array()
|
|
30
|
+
};
|
|
31
|
+
})
|
|
28
32
|
});
|
|
29
33
|
};
|
|
30
34
|
subscriptions.add(feedStore.feedOpened.on(update));
|
|
@@ -260,6 +264,11 @@ var DevtoolsServiceImpl = class {
|
|
|
260
264
|
usageQuota: (_e = navigatorInfo == null ? void 0 : navigatorInfo.quota) != null ? _e : 0
|
|
261
265
|
};
|
|
262
266
|
}
|
|
267
|
+
async getBlobs() {
|
|
268
|
+
return {
|
|
269
|
+
blobs: await this.params.context.blobStore.list()
|
|
270
|
+
};
|
|
271
|
+
}
|
|
263
272
|
async getSnapshots() {
|
|
264
273
|
return {
|
|
265
274
|
snapshots: await this.params.context.snapshotStore.listSnapshots()
|
|
@@ -800,7 +809,8 @@ var IdentityManager = class {
|
|
|
800
809
|
});
|
|
801
810
|
assert2(identityRecord.haloSpace.dataFeedKey);
|
|
802
811
|
const dataFeed = await this._feedStore.openFeed(identityRecord.haloSpace.dataFeedKey, {
|
|
803
|
-
writable: true
|
|
812
|
+
writable: true,
|
|
813
|
+
sparse: true
|
|
804
814
|
});
|
|
805
815
|
const space = await this._constructSpace({
|
|
806
816
|
spaceRecord: identityRecord.haloSpace,
|
|
@@ -823,7 +833,7 @@ var IdentityManager = class {
|
|
|
823
833
|
identityKey: identityRecord.identityKey
|
|
824
834
|
}, {
|
|
825
835
|
file: "identity-manager.ts",
|
|
826
|
-
line:
|
|
836
|
+
line: 226,
|
|
827
837
|
scope: this,
|
|
828
838
|
callSite: (f, a) => f(...a)
|
|
829
839
|
});
|
|
@@ -844,7 +854,7 @@ var IdentityManager = class {
|
|
|
844
854
|
onAuthFailure: () => {
|
|
845
855
|
log3.warn("auth failure", {}, {
|
|
846
856
|
file: "identity-manager.ts",
|
|
847
|
-
line:
|
|
857
|
+
line: 245,
|
|
848
858
|
scope: this,
|
|
849
859
|
callSite: (f, a) => f(...a)
|
|
850
860
|
});
|
|
@@ -969,8 +979,8 @@ var DeviceInvitationProtocol = class {
|
|
|
969
979
|
|
|
970
980
|
// packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
|
|
971
981
|
import assert6 from "@dxos/node-std/assert";
|
|
972
|
-
import { PushStream, scheduleTask as scheduleTask2,
|
|
973
|
-
import { AuthenticatingInvitationObservable, AUTHENTICATION_CODE_LENGTH, CancellableInvitationObservable, INVITATION_TIMEOUT
|
|
982
|
+
import { PushStream, scheduleTask as scheduleTask2, TimeoutError, Trigger as Trigger3 } from "@dxos/async";
|
|
983
|
+
import { AuthenticatingInvitationObservable, AUTHENTICATION_CODE_LENGTH, CancellableInvitationObservable, INVITATION_TIMEOUT } from "@dxos/client-protocol";
|
|
974
984
|
import { Context as Context4 } from "@dxos/context";
|
|
975
985
|
import { generatePasscode } from "@dxos/credentials";
|
|
976
986
|
import { InvalidInvitationExtensionRoleError as InvalidInvitationExtensionRoleError2 } from "@dxos/errors";
|
|
@@ -1326,7 +1336,7 @@ var InvitationsHandler = class {
|
|
|
1326
1336
|
...protocol.toJSON()
|
|
1327
1337
|
}, {
|
|
1328
1338
|
file: "invitations-handler.ts",
|
|
1329
|
-
line:
|
|
1339
|
+
line: 99,
|
|
1330
1340
|
scope: this,
|
|
1331
1341
|
callSite: (f, a) => f(...a)
|
|
1332
1342
|
});
|
|
@@ -1367,7 +1377,7 @@ var InvitationsHandler = class {
|
|
|
1367
1377
|
id: traceId
|
|
1368
1378
|
}), {
|
|
1369
1379
|
file: "invitations-handler.ts",
|
|
1370
|
-
line:
|
|
1380
|
+
line: 138,
|
|
1371
1381
|
scope: this,
|
|
1372
1382
|
callSite: (f, a) => f(...a)
|
|
1373
1383
|
});
|
|
@@ -1375,7 +1385,7 @@ var InvitationsHandler = class {
|
|
|
1375
1385
|
...protocol.toJSON()
|
|
1376
1386
|
}, {
|
|
1377
1387
|
file: "invitations-handler.ts",
|
|
1378
|
-
line:
|
|
1388
|
+
line: 139,
|
|
1379
1389
|
scope: this,
|
|
1380
1390
|
callSite: (f, a) => f(...a)
|
|
1381
1391
|
});
|
|
@@ -1391,7 +1401,7 @@ var InvitationsHandler = class {
|
|
|
1391
1401
|
...protocol.toJSON()
|
|
1392
1402
|
}, {
|
|
1393
1403
|
file: "invitations-handler.ts",
|
|
1394
|
-
line:
|
|
1404
|
+
line: 142,
|
|
1395
1405
|
scope: this,
|
|
1396
1406
|
callSite: (f, a) => f(...a)
|
|
1397
1407
|
});
|
|
@@ -1403,7 +1413,7 @@ var InvitationsHandler = class {
|
|
|
1403
1413
|
id: traceId
|
|
1404
1414
|
}), {
|
|
1405
1415
|
file: "invitations-handler.ts",
|
|
1406
|
-
line:
|
|
1416
|
+
line: 144,
|
|
1407
1417
|
scope: this,
|
|
1408
1418
|
callSite: (f, a) => f(...a)
|
|
1409
1419
|
});
|
|
@@ -1413,7 +1423,7 @@ var InvitationsHandler = class {
|
|
|
1413
1423
|
...protocol.toJSON()
|
|
1414
1424
|
}, {
|
|
1415
1425
|
file: "invitations-handler.ts",
|
|
1416
|
-
line:
|
|
1426
|
+
line: 147,
|
|
1417
1427
|
scope: this,
|
|
1418
1428
|
callSite: (f, a) => f(...a)
|
|
1419
1429
|
});
|
|
@@ -1424,7 +1434,7 @@ var InvitationsHandler = class {
|
|
|
1424
1434
|
} else {
|
|
1425
1435
|
log5.error("failed", err, {
|
|
1426
1436
|
file: "invitations-handler.ts",
|
|
1427
|
-
line:
|
|
1437
|
+
line: 150,
|
|
1428
1438
|
scope: this,
|
|
1429
1439
|
callSite: (f, a) => f(...a)
|
|
1430
1440
|
});
|
|
@@ -1435,13 +1445,13 @@ var InvitationsHandler = class {
|
|
|
1435
1445
|
error: err
|
|
1436
1446
|
}), {
|
|
1437
1447
|
file: "invitations-handler.ts",
|
|
1438
|
-
line:
|
|
1448
|
+
line: 153,
|
|
1439
1449
|
scope: this,
|
|
1440
1450
|
callSite: (f, a) => f(...a)
|
|
1441
1451
|
});
|
|
1442
1452
|
} finally {
|
|
1443
1453
|
if (type !== Invitation3.Type.MULTIUSE) {
|
|
1444
|
-
await
|
|
1454
|
+
await swarmConnection.close();
|
|
1445
1455
|
await ctx.dispose();
|
|
1446
1456
|
}
|
|
1447
1457
|
}
|
|
@@ -1477,9 +1487,10 @@ var InvitationsHandler = class {
|
|
|
1477
1487
|
});
|
|
1478
1488
|
return extension;
|
|
1479
1489
|
};
|
|
1490
|
+
let swarmConnection;
|
|
1480
1491
|
scheduleTask2(ctx, async () => {
|
|
1481
1492
|
const topic = invitation.swarmKey;
|
|
1482
|
-
|
|
1493
|
+
swarmConnection = await this._networkManager.joinSwarm({
|
|
1483
1494
|
topic,
|
|
1484
1495
|
peerId: topic,
|
|
1485
1496
|
protocolProvider: createTeleportProtocolFactory(async (teleport) => {
|
|
@@ -1510,6 +1521,7 @@ var InvitationsHandler = class {
|
|
|
1510
1521
|
const { timeout = INVITATION_TIMEOUT } = invitation;
|
|
1511
1522
|
assert6(protocol);
|
|
1512
1523
|
const authenticated = new Trigger3();
|
|
1524
|
+
let admitted = false;
|
|
1513
1525
|
let currentState;
|
|
1514
1526
|
const stream = new PushStream();
|
|
1515
1527
|
const setState = (newData) => {
|
|
@@ -1527,7 +1539,7 @@ var InvitationsHandler = class {
|
|
|
1527
1539
|
...protocol.toJSON()
|
|
1528
1540
|
}, {
|
|
1529
1541
|
file: "invitations-handler.ts",
|
|
1530
|
-
line:
|
|
1542
|
+
line: 230,
|
|
1531
1543
|
scope: this,
|
|
1532
1544
|
callSite: (f, a) => f(...a)
|
|
1533
1545
|
});
|
|
@@ -1537,7 +1549,7 @@ var InvitationsHandler = class {
|
|
|
1537
1549
|
} else {
|
|
1538
1550
|
log5.warn("auth failed", err, {
|
|
1539
1551
|
file: "invitations-handler.ts",
|
|
1540
|
-
line:
|
|
1552
|
+
line: 233,
|
|
1541
1553
|
scope: this,
|
|
1542
1554
|
callSite: (f, a) => f(...a)
|
|
1543
1555
|
});
|
|
@@ -1551,7 +1563,7 @@ var InvitationsHandler = class {
|
|
|
1551
1563
|
...protocol.toJSON()
|
|
1552
1564
|
}, {
|
|
1553
1565
|
file: "invitations-handler.ts",
|
|
1554
|
-
line:
|
|
1566
|
+
line: 241,
|
|
1555
1567
|
scope: this,
|
|
1556
1568
|
callSite: (f, a) => f(...a)
|
|
1557
1569
|
});
|
|
@@ -1566,11 +1578,11 @@ var InvitationsHandler = class {
|
|
|
1566
1578
|
currentState
|
|
1567
1579
|
}, {
|
|
1568
1580
|
file: "invitations-handler.ts",
|
|
1569
|
-
line:
|
|
1581
|
+
line: 251,
|
|
1570
1582
|
scope: this,
|
|
1571
1583
|
callSite: (f, a) => f(...a)
|
|
1572
1584
|
});
|
|
1573
|
-
if (
|
|
1585
|
+
if (!admitted) {
|
|
1574
1586
|
stream.error(new Error("Remote peer disconnected."));
|
|
1575
1587
|
}
|
|
1576
1588
|
});
|
|
@@ -1581,7 +1593,7 @@ var InvitationsHandler = class {
|
|
|
1581
1593
|
id: traceId
|
|
1582
1594
|
}), {
|
|
1583
1595
|
file: "invitations-handler.ts",
|
|
1584
|
-
line:
|
|
1596
|
+
line: 260,
|
|
1585
1597
|
scope: this,
|
|
1586
1598
|
callSite: (f, a) => f(...a)
|
|
1587
1599
|
});
|
|
@@ -1593,7 +1605,7 @@ var InvitationsHandler = class {
|
|
|
1593
1605
|
...protocol.toJSON()
|
|
1594
1606
|
}, {
|
|
1595
1607
|
file: "invitations-handler.ts",
|
|
1596
|
-
line:
|
|
1608
|
+
line: 268,
|
|
1597
1609
|
scope: this,
|
|
1598
1610
|
callSite: (f, a) => f(...a)
|
|
1599
1611
|
});
|
|
@@ -1604,7 +1616,7 @@ var InvitationsHandler = class {
|
|
|
1604
1616
|
...protocol.toJSON()
|
|
1605
1617
|
}, {
|
|
1606
1618
|
file: "invitations-handler.ts",
|
|
1607
|
-
line:
|
|
1619
|
+
line: 272,
|
|
1608
1620
|
scope: this,
|
|
1609
1621
|
callSite: (f, a) => f(...a)
|
|
1610
1622
|
});
|
|
@@ -1614,7 +1626,7 @@ var InvitationsHandler = class {
|
|
|
1614
1626
|
response: introductionResponse
|
|
1615
1627
|
}, {
|
|
1616
1628
|
file: "invitations-handler.ts",
|
|
1617
|
-
line:
|
|
1629
|
+
line: 276,
|
|
1618
1630
|
scope: this,
|
|
1619
1631
|
callSite: (f, a) => f(...a)
|
|
1620
1632
|
});
|
|
@@ -1626,7 +1638,7 @@ var InvitationsHandler = class {
|
|
|
1626
1638
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
1627
1639
|
log5("guest waiting for authentication code...", {}, {
|
|
1628
1640
|
file: "invitations-handler.ts",
|
|
1629
|
-
line:
|
|
1641
|
+
line: 285,
|
|
1630
1642
|
scope: this,
|
|
1631
1643
|
callSite: (f, a) => f(...a)
|
|
1632
1644
|
});
|
|
@@ -1638,7 +1650,7 @@ var InvitationsHandler = class {
|
|
|
1638
1650
|
});
|
|
1639
1651
|
log5("sending authentication request", {}, {
|
|
1640
1652
|
file: "invitations-handler.ts",
|
|
1641
|
-
line:
|
|
1653
|
+
line: 289,
|
|
1642
1654
|
scope: this,
|
|
1643
1655
|
callSite: (f, a) => f(...a)
|
|
1644
1656
|
});
|
|
@@ -1659,7 +1671,7 @@ var InvitationsHandler = class {
|
|
|
1659
1671
|
attempt
|
|
1660
1672
|
}, {
|
|
1661
1673
|
file: "invitations-handler.ts",
|
|
1662
|
-
line:
|
|
1674
|
+
line: 300,
|
|
1663
1675
|
scope: this,
|
|
1664
1676
|
callSite: (f, a) => f(...a)
|
|
1665
1677
|
});
|
|
@@ -1676,18 +1688,19 @@ var InvitationsHandler = class {
|
|
|
1676
1688
|
...protocol.toJSON()
|
|
1677
1689
|
}, {
|
|
1678
1690
|
file: "invitations-handler.ts",
|
|
1679
|
-
line:
|
|
1691
|
+
line: 311,
|
|
1680
1692
|
scope: this,
|
|
1681
1693
|
callSite: (f, a) => f(...a)
|
|
1682
1694
|
});
|
|
1683
1695
|
const admissionRequest = await protocol.createAdmissionRequest();
|
|
1684
1696
|
const admissionResponse = await extension.rpc.InvitationHostService.admit(admissionRequest);
|
|
1697
|
+
admitted = true;
|
|
1685
1698
|
const result = await protocol.accept(admissionResponse, admissionRequest);
|
|
1686
1699
|
log5("admitted by host", {
|
|
1687
1700
|
...protocol.toJSON()
|
|
1688
1701
|
}, {
|
|
1689
1702
|
file: "invitations-handler.ts",
|
|
1690
|
-
line:
|
|
1703
|
+
line: 322,
|
|
1691
1704
|
scope: this,
|
|
1692
1705
|
callSite: (f, a) => f(...a)
|
|
1693
1706
|
});
|
|
@@ -1699,7 +1712,7 @@ var InvitationsHandler = class {
|
|
|
1699
1712
|
id: traceId
|
|
1700
1713
|
}), {
|
|
1701
1714
|
file: "invitations-handler.ts",
|
|
1702
|
-
line:
|
|
1715
|
+
line: 324,
|
|
1703
1716
|
scope: this,
|
|
1704
1717
|
callSite: (f, a) => f(...a)
|
|
1705
1718
|
});
|
|
@@ -1709,7 +1722,7 @@ var InvitationsHandler = class {
|
|
|
1709
1722
|
...protocol.toJSON()
|
|
1710
1723
|
}, {
|
|
1711
1724
|
file: "invitations-handler.ts",
|
|
1712
|
-
line:
|
|
1725
|
+
line: 327,
|
|
1713
1726
|
scope: this,
|
|
1714
1727
|
callSite: (f, a) => f(...a)
|
|
1715
1728
|
});
|
|
@@ -1719,7 +1732,7 @@ var InvitationsHandler = class {
|
|
|
1719
1732
|
} else {
|
|
1720
1733
|
log5("auth failed", err, {
|
|
1721
1734
|
file: "invitations-handler.ts",
|
|
1722
|
-
line:
|
|
1735
|
+
line: 330,
|
|
1723
1736
|
scope: this,
|
|
1724
1737
|
callSite: (f, a) => f(...a)
|
|
1725
1738
|
});
|
|
@@ -1730,7 +1743,7 @@ var InvitationsHandler = class {
|
|
|
1730
1743
|
error: err
|
|
1731
1744
|
}), {
|
|
1732
1745
|
file: "invitations-handler.ts",
|
|
1733
|
-
line:
|
|
1746
|
+
line: 333,
|
|
1734
1747
|
scope: this,
|
|
1735
1748
|
callSite: (f, a) => f(...a)
|
|
1736
1749
|
});
|
|
@@ -1748,7 +1761,7 @@ var InvitationsHandler = class {
|
|
|
1748
1761
|
...protocol.toJSON()
|
|
1749
1762
|
}, {
|
|
1750
1763
|
file: "invitations-handler.ts",
|
|
1751
|
-
line:
|
|
1764
|
+
line: 344,
|
|
1752
1765
|
scope: this,
|
|
1753
1766
|
callSite: (f, a) => f(...a)
|
|
1754
1767
|
});
|
|
@@ -1758,7 +1771,7 @@ var InvitationsHandler = class {
|
|
|
1758
1771
|
} else {
|
|
1759
1772
|
log5("auth failed", err, {
|
|
1760
1773
|
file: "invitations-handler.ts",
|
|
1761
|
-
line:
|
|
1774
|
+
line: 347,
|
|
1762
1775
|
scope: this,
|
|
1763
1776
|
callSite: (f, a) => f(...a)
|
|
1764
1777
|
});
|
|
@@ -2195,11 +2208,12 @@ import { PublicKey as PublicKey7 } from "@dxos/keys";
|
|
|
2195
2208
|
import { log as log10 } from "@dxos/log";
|
|
2196
2209
|
import { SpaceState } from "@dxos/protocols/proto/dxos/client/services";
|
|
2197
2210
|
import { AdmittedFeed as AdmittedFeed3 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
2211
|
+
import { Timeframe } from "@dxos/timeframe";
|
|
2198
2212
|
import { ComplexSet as ComplexSet2 } from "@dxos/util";
|
|
2199
2213
|
|
|
2200
2214
|
// packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
|
|
2201
2215
|
import assert9 from "@dxos/node-std/assert";
|
|
2202
|
-
import { DeferredTask, Event as Event4, scheduleTask as scheduleTask3, sleep
|
|
2216
|
+
import { DeferredTask, Event as Event4, scheduleTask as scheduleTask3, sleep, TimeoutError as TimeoutError2, Trigger as Trigger5 } from "@dxos/async";
|
|
2203
2217
|
import { Context as Context5, rejectOnDispose } from "@dxos/context";
|
|
2204
2218
|
import { PublicKey as PublicKey6 } from "@dxos/keys";
|
|
2205
2219
|
import { log as log9 } from "@dxos/log";
|
|
@@ -2309,7 +2323,7 @@ var NotarizationPlugin = class {
|
|
|
2309
2323
|
scope: this,
|
|
2310
2324
|
callSite: (f, a) => f(...a)
|
|
2311
2325
|
});
|
|
2312
|
-
await
|
|
2326
|
+
await sleep(successDelay);
|
|
2313
2327
|
} catch (err) {
|
|
2314
2328
|
if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
|
|
2315
2329
|
log9.warn("error notarizing (recoverable)", err, {
|
|
@@ -2537,7 +2551,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2537
2551
|
if (err instanceof CancelledError) {
|
|
2538
2552
|
log10("Data pipeline initialization cancelled", err, {
|
|
2539
2553
|
file: "data-space.ts",
|
|
2540
|
-
line:
|
|
2554
|
+
line: 173,
|
|
2541
2555
|
scope: this,
|
|
2542
2556
|
callSite: (f, a) => f(...a)
|
|
2543
2557
|
});
|
|
@@ -2545,7 +2559,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2545
2559
|
}
|
|
2546
2560
|
log10.error("Error initializing data pipeline", err, {
|
|
2547
2561
|
file: "data-space.ts",
|
|
2548
|
-
line:
|
|
2562
|
+
line: 177,
|
|
2549
2563
|
scope: this,
|
|
2550
2564
|
callSite: (f, a) => f(...a)
|
|
2551
2565
|
});
|
|
@@ -2626,7 +2640,8 @@ var DataSpace = class DataSpace2 {
|
|
|
2626
2640
|
}
|
|
2627
2641
|
if (!this.inner.dataFeedKey) {
|
|
2628
2642
|
const dataFeed = await this._feedStore.openFeed(await this._keyring.createKey(), {
|
|
2629
|
-
writable: true
|
|
2643
|
+
writable: true,
|
|
2644
|
+
sparse: true
|
|
2630
2645
|
});
|
|
2631
2646
|
this.inner.setDataFeed(dataFeed);
|
|
2632
2647
|
credentials.push(await this._signingContext.credentialSigner.createCredential({
|
|
@@ -2652,7 +2667,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2652
2667
|
async createEpoch() {
|
|
2653
2668
|
var _a, _b;
|
|
2654
2669
|
const epoch = await this.dataPipeline.createEpoch();
|
|
2655
|
-
await this.inner.controlPipeline.writer.write({
|
|
2670
|
+
const receipt = await this.inner.controlPipeline.writer.write({
|
|
2656
2671
|
credential: {
|
|
2657
2672
|
credential: await this._signingContext.credentialSigner.createCredential({
|
|
2658
2673
|
subject: this.key,
|
|
@@ -2663,6 +2678,12 @@ var DataSpace = class DataSpace2 {
|
|
|
2663
2678
|
})
|
|
2664
2679
|
}
|
|
2665
2680
|
});
|
|
2681
|
+
await this.inner.controlPipeline.state.waitUntilTimeframe(new Timeframe([
|
|
2682
|
+
[
|
|
2683
|
+
receipt.feedKey,
|
|
2684
|
+
receipt.seq
|
|
2685
|
+
]
|
|
2686
|
+
]));
|
|
2666
2687
|
for (const feed of (_b = (_a = this.inner.dataPipeline.pipelineState) == null ? void 0 : _a.feeds) != null ? _b : []) {
|
|
2667
2688
|
const indexBeforeEpoch = epoch.timeframe.get(feed.key);
|
|
2668
2689
|
if (indexBeforeEpoch) {
|
|
@@ -2694,7 +2715,7 @@ import { ComplexMap as ComplexMap3, deferFunction as deferFunction2 } from "@dxo
|
|
|
2694
2715
|
import { createCredential } from "@dxos/credentials";
|
|
2695
2716
|
import { failUndefined as failUndefined2 } from "@dxos/debug";
|
|
2696
2717
|
import { AdmittedFeed as AdmittedFeed4, SpaceMember } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
2697
|
-
import { Timeframe } from "@dxos/timeframe";
|
|
2718
|
+
import { Timeframe as Timeframe2 } from "@dxos/timeframe";
|
|
2698
2719
|
var spaceGenesis = async (keyring, signingContext, space) => {
|
|
2699
2720
|
var _a, _b, _c, _d;
|
|
2700
2721
|
const credentials = [
|
|
@@ -2745,7 +2766,7 @@ var spaceGenesis = async (keyring, signingContext, space) => {
|
|
|
2745
2766
|
"@type": "dxos.halo.credentials.Epoch",
|
|
2746
2767
|
number: 0,
|
|
2747
2768
|
previousId: void 0,
|
|
2748
|
-
timeframe: new
|
|
2769
|
+
timeframe: new Timeframe2(),
|
|
2749
2770
|
snapshotCid: void 0
|
|
2750
2771
|
}
|
|
2751
2772
|
})
|
|
@@ -2950,7 +2971,8 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2950
2971
|
writable: true
|
|
2951
2972
|
});
|
|
2952
2973
|
const dataFeed = metadata.dataFeedKey && await this._feedStore.openFeed(metadata.dataFeedKey, {
|
|
2953
|
-
writable: true
|
|
2974
|
+
writable: true,
|
|
2975
|
+
sparse: true
|
|
2954
2976
|
});
|
|
2955
2977
|
const space = await this._spaceManager.constructSpace({
|
|
2956
2978
|
metadata,
|
|
@@ -2963,7 +2985,6 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2963
2985
|
session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
|
|
2964
2986
|
remotePeerId: session.remotePeerId
|
|
2965
2987
|
}));
|
|
2966
|
-
session.addExtension("dxos.mesh.teleport.objectsync", space.snapshotManager.objectSync.createExtension());
|
|
2967
2988
|
session.addExtension("dxos.mesh.teleport.notarization", dataSpace.notarizationPlugin.createExtension());
|
|
2968
2989
|
},
|
|
2969
2990
|
onAuthFailure: () => {
|
|
@@ -3079,7 +3100,7 @@ var SpacesServiceImpl = class {
|
|
|
3079
3100
|
spaces
|
|
3080
3101
|
}, {
|
|
3081
3102
|
file: "spaces-service.ts",
|
|
3082
|
-
line:
|
|
3103
|
+
line: 60,
|
|
3083
3104
|
scope: this,
|
|
3084
3105
|
callSite: (f, a) => f(...a)
|
|
3085
3106
|
});
|
|
@@ -3096,6 +3117,7 @@ var SpacesServiceImpl = class {
|
|
|
3096
3117
|
for (const space of dataSpaceManager.spaces.values()) {
|
|
3097
3118
|
subscriptions.add(space.stateUpdate.on(ctx, onUpdate));
|
|
3098
3119
|
subscriptions.add(space.presence.updated.on(ctx, onUpdate));
|
|
3120
|
+
subscriptions.add(space.dataPipeline.onNewEpoch.on(ctx, onUpdate));
|
|
3099
3121
|
space.inner.controlPipeline.state.timeframeUpdate.debounce(TIMEFRAME_UPDATE_DEBOUNCE_TIME).on(ctx, onUpdate);
|
|
3100
3122
|
if (space.dataPipeline.pipelineState) {
|
|
3101
3123
|
subscriptions.add(space.dataPipeline.pipelineState.timeframeUpdate.debounce(TIMEFRAME_UPDATE_DEBOUNCE_TIME).on(ctx, onUpdate));
|
|
@@ -3166,20 +3188,23 @@ var SpacesServiceImpl = class {
|
|
|
3166
3188
|
await space.createEpoch();
|
|
3167
3189
|
}
|
|
3168
3190
|
_transformSpace(space) {
|
|
3169
|
-
var _a, _b, _c, _d, _e;
|
|
3191
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
3170
3192
|
return {
|
|
3171
3193
|
spaceKey: space.key,
|
|
3172
3194
|
state: space.state,
|
|
3173
3195
|
error: space.error ? encodeError(space.error) : void 0,
|
|
3174
3196
|
pipeline: {
|
|
3197
|
+
currentEpoch: space.dataPipeline.currentEpoch,
|
|
3198
|
+
appliedEpoch: space.dataPipeline.appliedEpoch,
|
|
3175
3199
|
controlFeeds: space.inner.controlPipeline.state.feeds.map((feed) => feed.key),
|
|
3176
3200
|
currentControlTimeframe: space.inner.controlPipeline.state.timeframe,
|
|
3177
3201
|
targetControlTimeframe: space.inner.controlPipeline.state.targetTimeframe,
|
|
3178
3202
|
totalControlTimeframe: space.inner.controlPipeline.state.endTimeframe,
|
|
3179
3203
|
dataFeeds: (_b = (_a = space.dataPipeline.pipelineState) == null ? void 0 : _a.feeds.map((feed) => feed.key)) != null ? _b : [],
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3204
|
+
startDataTimeframe: (_c = space.dataPipeline.pipelineState) == null ? void 0 : _c.startTimeframe,
|
|
3205
|
+
currentDataTimeframe: (_d = space.dataPipeline.pipelineState) == null ? void 0 : _d.timeframe,
|
|
3206
|
+
targetDataTimeframe: (_e = space.dataPipeline.pipelineState) == null ? void 0 : _e.targetTimeframe,
|
|
3207
|
+
totalDataTimeframe: (_f = space.dataPipeline.pipelineState) == null ? void 0 : _f.endTimeframe
|
|
3183
3208
|
},
|
|
3184
3209
|
members: Array.from(space.inner.spaceState.members.values()).map((member) => {
|
|
3185
3210
|
var _a2, _b2, _c2;
|
|
@@ -3193,6 +3218,7 @@ var SpacesServiceImpl = class {
|
|
|
3193
3218
|
presence: ((_c2 = this._identityManager.identity) == null ? void 0 : _c2.identityKey.equals(member.key)) || space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key)).length > 0 ? SpaceMember2.PresenceState.ONLINE : SpaceMember2.PresenceState.OFFLINE
|
|
3194
3219
|
};
|
|
3195
3220
|
}),
|
|
3221
|
+
creator: (_g = space.inner.spaceState.creator) == null ? void 0 : _g.key,
|
|
3196
3222
|
cache: space.cache,
|
|
3197
3223
|
metrics: space.metrics
|
|
3198
3224
|
};
|
|
@@ -3261,6 +3287,7 @@ import { PublicKey as PublicKey9 } from "@dxos/keys";
|
|
|
3261
3287
|
import { log as log13 } from "@dxos/log";
|
|
3262
3288
|
import { STORAGE_VERSION, trace as trace5 } from "@dxos/protocols";
|
|
3263
3289
|
import { Invitation as Invitation5 } from "@dxos/protocols/proto/dxos/client/services";
|
|
3290
|
+
import { BlobStore } from "@dxos/teleport-extension-object-sync";
|
|
3264
3291
|
var ServiceContext = class {
|
|
3265
3292
|
// prettier-ignore
|
|
3266
3293
|
constructor(storage, networkManager, signalManager, modelFactory) {
|
|
@@ -3274,6 +3301,7 @@ var ServiceContext = class {
|
|
|
3274
3301
|
this._instanceId = PublicKey9.random().toHex();
|
|
3275
3302
|
this.metadataStore = new MetadataStore(storage.createDirectory("metadata"));
|
|
3276
3303
|
this.snapshotStore = new SnapshotStore(storage.createDirectory("snapshots"));
|
|
3304
|
+
this.blobStore = new BlobStore(storage.createDirectory("blobs"));
|
|
3277
3305
|
this.keyring = new Keyring(storage.createDirectory("keyring"));
|
|
3278
3306
|
this.feedStore = new FeedStore({
|
|
3279
3307
|
factory: new FeedFactory({
|
|
@@ -3287,6 +3315,7 @@ var ServiceContext = class {
|
|
|
3287
3315
|
this.spaceManager = new SpaceManager({
|
|
3288
3316
|
feedStore: this.feedStore,
|
|
3289
3317
|
networkManager: this.networkManager,
|
|
3318
|
+
blobStore: this.blobStore,
|
|
3290
3319
|
metadataStore: this.metadataStore,
|
|
3291
3320
|
modelFactory: this.modelFactory,
|
|
3292
3321
|
snapshotStore: this.snapshotStore
|
|
@@ -3303,14 +3332,14 @@ var ServiceContext = class {
|
|
|
3303
3332
|
id: this._instanceId
|
|
3304
3333
|
}), {
|
|
3305
3334
|
file: "service-context.ts",
|
|
3306
|
-
line:
|
|
3335
|
+
line: 126,
|
|
3307
3336
|
scope: this,
|
|
3308
3337
|
callSite: (f, a) => f(...a)
|
|
3309
3338
|
});
|
|
3310
3339
|
await this._checkStorageVersion();
|
|
3311
3340
|
log13("opening...", {}, {
|
|
3312
3341
|
file: "service-context.ts",
|
|
3313
|
-
line:
|
|
3342
|
+
line: 130,
|
|
3314
3343
|
scope: this,
|
|
3315
3344
|
callSite: (f, a) => f(...a)
|
|
3316
3345
|
});
|
|
@@ -3323,7 +3352,7 @@ var ServiceContext = class {
|
|
|
3323
3352
|
}
|
|
3324
3353
|
log13("opened", {}, {
|
|
3325
3354
|
file: "service-context.ts",
|
|
3326
|
-
line:
|
|
3355
|
+
line: 138,
|
|
3327
3356
|
scope: this,
|
|
3328
3357
|
callSite: (f, a) => f(...a)
|
|
3329
3358
|
});
|
|
@@ -3331,7 +3360,7 @@ var ServiceContext = class {
|
|
|
3331
3360
|
id: this._instanceId
|
|
3332
3361
|
}), {
|
|
3333
3362
|
file: "service-context.ts",
|
|
3334
|
-
line:
|
|
3363
|
+
line: 139,
|
|
3335
3364
|
scope: this,
|
|
3336
3365
|
callSite: (f, a) => f(...a)
|
|
3337
3366
|
});
|
|
@@ -3340,7 +3369,7 @@ var ServiceContext = class {
|
|
|
3340
3369
|
var _a, _b;
|
|
3341
3370
|
log13("closing...", {}, {
|
|
3342
3371
|
file: "service-context.ts",
|
|
3343
|
-
line:
|
|
3372
|
+
line: 143,
|
|
3344
3373
|
scope: this,
|
|
3345
3374
|
callSite: (f, a) => f(...a)
|
|
3346
3375
|
});
|
|
@@ -3354,7 +3383,7 @@ var ServiceContext = class {
|
|
|
3354
3383
|
this.dataServiceSubscriptions.clear();
|
|
3355
3384
|
log13("closed", {}, {
|
|
3356
3385
|
file: "service-context.ts",
|
|
3357
|
-
line:
|
|
3386
|
+
line: 152,
|
|
3358
3387
|
scope: this,
|
|
3359
3388
|
callSite: (f, a) => f(...a)
|
|
3360
3389
|
});
|
|
@@ -3385,7 +3414,7 @@ var ServiceContext = class {
|
|
|
3385
3414
|
var _a;
|
|
3386
3415
|
log13("initializing spaces...", {}, {
|
|
3387
3416
|
file: "service-context.ts",
|
|
3388
|
-
line:
|
|
3417
|
+
line: 185,
|
|
3389
3418
|
scope: this,
|
|
3390
3419
|
callSite: (f, a) => f(...a)
|
|
3391
3420
|
});
|
|
@@ -3424,7 +3453,7 @@ var ServiceContext = class {
|
|
|
3424
3453
|
details: assertion
|
|
3425
3454
|
}, {
|
|
3426
3455
|
file: "service-context.ts",
|
|
3427
|
-
line:
|
|
3456
|
+
line: 224,
|
|
3428
3457
|
scope: this,
|
|
3429
3458
|
callSite: (f, a) => f(...a)
|
|
3430
3459
|
});
|
|
@@ -3435,7 +3464,7 @@ var ServiceContext = class {
|
|
|
3435
3464
|
details: assertion
|
|
3436
3465
|
}, {
|
|
3437
3466
|
file: "service-context.ts",
|
|
3438
|
-
line:
|
|
3467
|
+
line: 228,
|
|
3439
3468
|
scope: this,
|
|
3440
3469
|
callSite: (f, a) => f(...a)
|
|
3441
3470
|
});
|
|
@@ -3446,7 +3475,7 @@ var ServiceContext = class {
|
|
|
3446
3475
|
details: assertion
|
|
3447
3476
|
}, {
|
|
3448
3477
|
file: "service-context.ts",
|
|
3449
|
-
line:
|
|
3478
|
+
line: 233,
|
|
3450
3479
|
scope: this,
|
|
3451
3480
|
callSite: (f, a) => f(...a)
|
|
3452
3481
|
});
|
|
@@ -3457,7 +3486,7 @@ var ServiceContext = class {
|
|
|
3457
3486
|
} catch (err) {
|
|
3458
3487
|
log13.catch(err, {}, {
|
|
3459
3488
|
file: "service-context.ts",
|
|
3460
|
-
line:
|
|
3489
|
+
line: 239,
|
|
3461
3490
|
scope: this,
|
|
3462
3491
|
callSite: (f, a) => f(...a)
|
|
3463
3492
|
});
|
|
@@ -3554,7 +3583,8 @@ var DevicesServiceImpl = class {
|
|
|
3554
3583
|
// packages/sdk/client-services/src/packlets/logging/logging-service.ts
|
|
3555
3584
|
import { Event as Event7 } from "@dxos/async";
|
|
3556
3585
|
import { Stream as Stream11 } from "@dxos/codec-protobuf";
|
|
3557
|
-
import { log as log14
|
|
3586
|
+
import { getContextFromEntry, log as log14 } from "@dxos/log";
|
|
3587
|
+
import { QueryLogsRequest } from "@dxos/protocols/proto/dxos/client/services";
|
|
3558
3588
|
import { jsonify } from "@dxos/util";
|
|
3559
3589
|
var LoggingServiceImpl = class {
|
|
3560
3590
|
constructor() {
|
|
@@ -3571,31 +3601,60 @@ var LoggingServiceImpl = class {
|
|
|
3571
3601
|
log14.runtimeConfig.processors.splice(index, 1);
|
|
3572
3602
|
}
|
|
3573
3603
|
queryLogs(request) {
|
|
3574
|
-
var _a;
|
|
3575
|
-
const filters = ((_a = request.filters) == null ? void 0 : _a.length) ? request.filters : void 0;
|
|
3576
3604
|
return new Stream11(({ ctx, next }) => {
|
|
3577
3605
|
const handler = (entry2) => {
|
|
3578
|
-
var
|
|
3579
|
-
if (
|
|
3606
|
+
var _a, _b, _c, _d, _e;
|
|
3607
|
+
if (LOG_PROCESSING > 0) {
|
|
3580
3608
|
return;
|
|
3581
3609
|
}
|
|
3582
|
-
if (
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3610
|
+
if (((_a = entry2.meta) == null ? void 0 : _a.file.includes("logging-service")) || entry2.context && Object.values(entry2.context).some((value) => typeof value === "string" && value.includes("LoggingService"))) {
|
|
3611
|
+
return;
|
|
3612
|
+
}
|
|
3613
|
+
if (!shouldLog(entry2, request)) {
|
|
3614
|
+
return;
|
|
3615
|
+
}
|
|
3616
|
+
const record = {
|
|
3617
|
+
...entry2,
|
|
3618
|
+
context: jsonify(getContextFromEntry(entry2)),
|
|
3619
|
+
timestamp: new Date(),
|
|
3620
|
+
meta: {
|
|
3621
|
+
// TODO(dmaretskyi): Fix proto.
|
|
3622
|
+
file: (_c = (_b = entry2.meta) == null ? void 0 : _b.file) != null ? _c : "",
|
|
3623
|
+
line: (_e = (_d = entry2.meta) == null ? void 0 : _d.line) != null ? _e : 0
|
|
3624
|
+
}
|
|
3625
|
+
};
|
|
3626
|
+
try {
|
|
3627
|
+
LOG_PROCESSING++;
|
|
3589
3628
|
next(record);
|
|
3629
|
+
} finally {
|
|
3630
|
+
LOG_PROCESSING--;
|
|
3590
3631
|
}
|
|
3591
3632
|
};
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3633
|
+
this._logs.on(ctx, handler);
|
|
3634
|
+
});
|
|
3635
|
+
}
|
|
3636
|
+
};
|
|
3637
|
+
var matchFilter = (filter, level, path, options) => {
|
|
3638
|
+
switch (options) {
|
|
3639
|
+
case QueryLogsRequest.MatchingOptions.INCLUSIVE:
|
|
3640
|
+
return level >= filter.level && (!filter.pattern || path.includes(filter.pattern));
|
|
3641
|
+
case QueryLogsRequest.MatchingOptions.EXPLICIT:
|
|
3642
|
+
return level === filter.level && (!filter.pattern || path.includes(filter.pattern));
|
|
3643
|
+
}
|
|
3644
|
+
};
|
|
3645
|
+
var shouldLog = (entry2, request) => {
|
|
3646
|
+
var _a;
|
|
3647
|
+
const options = (_a = request.options) != null ? _a : QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
3648
|
+
if (request.filters === void 0) {
|
|
3649
|
+
return options === QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
3650
|
+
} else {
|
|
3651
|
+
return request.filters.some((filter) => {
|
|
3652
|
+
var _a2, _b;
|
|
3653
|
+
return matchFilter(filter, entry2.level, (_b = (_a2 = entry2.meta) == null ? void 0 : _a2.file) != null ? _b : "", options);
|
|
3596
3654
|
});
|
|
3597
3655
|
}
|
|
3598
3656
|
};
|
|
3657
|
+
var LOG_PROCESSING = 0;
|
|
3599
3658
|
|
|
3600
3659
|
// packages/sdk/client-services/src/packlets/network/network-service.ts
|
|
3601
3660
|
import { Stream as Stream12 } from "@dxos/codec-protobuf";
|
|
@@ -3952,4 +4011,4 @@ export {
|
|
|
3952
4011
|
ClientServicesHost,
|
|
3953
4012
|
LocalClientServices
|
|
3954
4013
|
};
|
|
3955
|
-
//# sourceMappingURL=chunk-
|
|
4014
|
+
//# sourceMappingURL=chunk-2GQ7337P.mjs.map
|