@dxos/client-services 0.1.50 → 0.1.51-main.04cd027
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-ARBZHWMK.mjs} +126 -74
- package/dist/lib/browser/chunk-ARBZHWMK.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +1 -1
- package/dist/lib/node/index.cjs +139 -87
- 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 +156 -104
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- 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/spaces/data-space-manager.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/package.json +30 -30
- package/src/packlets/devtools/feeds.ts +1 -0
- package/src/packlets/identity/identity-manager.ts +4 -1
- package/src/packlets/identity/identity.test.ts +9 -3
- 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/spaces/data-space-manager.test.ts +64 -1
- package/src/packlets/spaces/data-space-manager.ts +2 -1
- package/src/packlets/spaces/data-space.ts +8 -3
- package/src/packlets/spaces/spaces-service.ts +7 -0
- package/dist/lib/browser/chunk-BAHSFG33.mjs.map +0 -7
package/dist/lib/node/index.cjs
CHANGED
|
@@ -92,11 +92,15 @@ var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
|
|
|
92
92
|
}
|
|
93
93
|
});
|
|
94
94
|
next({
|
|
95
|
-
feeds: Array.from(feedMap.values()).map((feed) =>
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
feeds: Array.from(feedMap.values()).map((feed) => {
|
|
96
|
+
var _a, _b;
|
|
97
|
+
return {
|
|
98
|
+
feedKey: feed.key,
|
|
99
|
+
length: feed.properties.length,
|
|
100
|
+
bytes: feed.core.byteLength,
|
|
101
|
+
downloaded: (_b = (_a = feed.core.bitfield) == null ? void 0 : _a.data.toBuffer()) != null ? _b : new Uint8Array()
|
|
102
|
+
};
|
|
103
|
+
})
|
|
100
104
|
});
|
|
101
105
|
};
|
|
102
106
|
subscriptions.add(feedStore.feedOpened.on(update));
|
|
@@ -868,7 +872,8 @@ var IdentityManager = class {
|
|
|
868
872
|
});
|
|
869
873
|
(0, import_node_assert2.default)(identityRecord.haloSpace.dataFeedKey);
|
|
870
874
|
const dataFeed = await this._feedStore.openFeed(identityRecord.haloSpace.dataFeedKey, {
|
|
871
|
-
writable: true
|
|
875
|
+
writable: true,
|
|
876
|
+
sparse: true
|
|
872
877
|
});
|
|
873
878
|
const space = await this._constructSpace({
|
|
874
879
|
spaceRecord: identityRecord.haloSpace,
|
|
@@ -891,7 +896,7 @@ var IdentityManager = class {
|
|
|
891
896
|
identityKey: identityRecord.identityKey
|
|
892
897
|
}, {
|
|
893
898
|
file: "identity-manager.ts",
|
|
894
|
-
line:
|
|
899
|
+
line: 226,
|
|
895
900
|
scope: this,
|
|
896
901
|
callSite: (f, a) => f(...a)
|
|
897
902
|
});
|
|
@@ -912,7 +917,7 @@ var IdentityManager = class {
|
|
|
912
917
|
onAuthFailure: () => {
|
|
913
918
|
import_log3.log.warn("auth failure", {}, {
|
|
914
919
|
file: "identity-manager.ts",
|
|
915
|
-
line:
|
|
920
|
+
line: 245,
|
|
916
921
|
scope: this,
|
|
917
922
|
callSite: (f, a) => f(...a)
|
|
918
923
|
});
|
|
@@ -1394,7 +1399,7 @@ var InvitationsHandler = class {
|
|
|
1394
1399
|
...protocol.toJSON()
|
|
1395
1400
|
}, {
|
|
1396
1401
|
file: "invitations-handler.ts",
|
|
1397
|
-
line:
|
|
1402
|
+
line: 99,
|
|
1398
1403
|
scope: this,
|
|
1399
1404
|
callSite: (f, a) => f(...a)
|
|
1400
1405
|
});
|
|
@@ -1435,7 +1440,7 @@ var InvitationsHandler = class {
|
|
|
1435
1440
|
id: traceId
|
|
1436
1441
|
}), {
|
|
1437
1442
|
file: "invitations-handler.ts",
|
|
1438
|
-
line:
|
|
1443
|
+
line: 138,
|
|
1439
1444
|
scope: this,
|
|
1440
1445
|
callSite: (f, a) => f(...a)
|
|
1441
1446
|
});
|
|
@@ -1443,7 +1448,7 @@ var InvitationsHandler = class {
|
|
|
1443
1448
|
...protocol.toJSON()
|
|
1444
1449
|
}, {
|
|
1445
1450
|
file: "invitations-handler.ts",
|
|
1446
|
-
line:
|
|
1451
|
+
line: 139,
|
|
1447
1452
|
scope: this,
|
|
1448
1453
|
callSite: (f, a) => f(...a)
|
|
1449
1454
|
});
|
|
@@ -1459,7 +1464,7 @@ var InvitationsHandler = class {
|
|
|
1459
1464
|
...protocol.toJSON()
|
|
1460
1465
|
}, {
|
|
1461
1466
|
file: "invitations-handler.ts",
|
|
1462
|
-
line:
|
|
1467
|
+
line: 142,
|
|
1463
1468
|
scope: this,
|
|
1464
1469
|
callSite: (f, a) => f(...a)
|
|
1465
1470
|
});
|
|
@@ -1471,7 +1476,7 @@ var InvitationsHandler = class {
|
|
|
1471
1476
|
id: traceId
|
|
1472
1477
|
}), {
|
|
1473
1478
|
file: "invitations-handler.ts",
|
|
1474
|
-
line:
|
|
1479
|
+
line: 144,
|
|
1475
1480
|
scope: this,
|
|
1476
1481
|
callSite: (f, a) => f(...a)
|
|
1477
1482
|
});
|
|
@@ -1481,7 +1486,7 @@ var InvitationsHandler = class {
|
|
|
1481
1486
|
...protocol.toJSON()
|
|
1482
1487
|
}, {
|
|
1483
1488
|
file: "invitations-handler.ts",
|
|
1484
|
-
line:
|
|
1489
|
+
line: 147,
|
|
1485
1490
|
scope: this,
|
|
1486
1491
|
callSite: (f, a) => f(...a)
|
|
1487
1492
|
});
|
|
@@ -1492,7 +1497,7 @@ var InvitationsHandler = class {
|
|
|
1492
1497
|
} else {
|
|
1493
1498
|
import_log5.log.error("failed", err, {
|
|
1494
1499
|
file: "invitations-handler.ts",
|
|
1495
|
-
line:
|
|
1500
|
+
line: 150,
|
|
1496
1501
|
scope: this,
|
|
1497
1502
|
callSite: (f, a) => f(...a)
|
|
1498
1503
|
});
|
|
@@ -1503,13 +1508,13 @@ var InvitationsHandler = class {
|
|
|
1503
1508
|
error: err
|
|
1504
1509
|
}), {
|
|
1505
1510
|
file: "invitations-handler.ts",
|
|
1506
|
-
line:
|
|
1511
|
+
line: 153,
|
|
1507
1512
|
scope: this,
|
|
1508
1513
|
callSite: (f, a) => f(...a)
|
|
1509
1514
|
});
|
|
1510
1515
|
} finally {
|
|
1511
1516
|
if (type !== import_services3.Invitation.Type.MULTIUSE) {
|
|
1512
|
-
await
|
|
1517
|
+
await swarmConnection.close();
|
|
1513
1518
|
await ctx.dispose();
|
|
1514
1519
|
}
|
|
1515
1520
|
}
|
|
@@ -1545,9 +1550,10 @@ var InvitationsHandler = class {
|
|
|
1545
1550
|
});
|
|
1546
1551
|
return extension;
|
|
1547
1552
|
};
|
|
1553
|
+
let swarmConnection;
|
|
1548
1554
|
(0, import_async8.scheduleTask)(ctx, async () => {
|
|
1549
1555
|
const topic = invitation.swarmKey;
|
|
1550
|
-
|
|
1556
|
+
swarmConnection = await this._networkManager.joinSwarm({
|
|
1551
1557
|
topic,
|
|
1552
1558
|
peerId: topic,
|
|
1553
1559
|
protocolProvider: (0, import_network_manager.createTeleportProtocolFactory)(async (teleport) => {
|
|
@@ -1578,6 +1584,7 @@ var InvitationsHandler = class {
|
|
|
1578
1584
|
const { timeout = import_client_protocol2.INVITATION_TIMEOUT } = invitation;
|
|
1579
1585
|
(0, import_node_assert6.default)(protocol);
|
|
1580
1586
|
const authenticated = new import_async8.Trigger();
|
|
1587
|
+
let admitted = false;
|
|
1581
1588
|
let currentState;
|
|
1582
1589
|
const stream = new import_async8.PushStream();
|
|
1583
1590
|
const setState = (newData) => {
|
|
@@ -1595,7 +1602,7 @@ var InvitationsHandler = class {
|
|
|
1595
1602
|
...protocol.toJSON()
|
|
1596
1603
|
}, {
|
|
1597
1604
|
file: "invitations-handler.ts",
|
|
1598
|
-
line:
|
|
1605
|
+
line: 230,
|
|
1599
1606
|
scope: this,
|
|
1600
1607
|
callSite: (f, a) => f(...a)
|
|
1601
1608
|
});
|
|
@@ -1605,7 +1612,7 @@ var InvitationsHandler = class {
|
|
|
1605
1612
|
} else {
|
|
1606
1613
|
import_log5.log.warn("auth failed", err, {
|
|
1607
1614
|
file: "invitations-handler.ts",
|
|
1608
|
-
line:
|
|
1615
|
+
line: 233,
|
|
1609
1616
|
scope: this,
|
|
1610
1617
|
callSite: (f, a) => f(...a)
|
|
1611
1618
|
});
|
|
@@ -1619,7 +1626,7 @@ var InvitationsHandler = class {
|
|
|
1619
1626
|
...protocol.toJSON()
|
|
1620
1627
|
}, {
|
|
1621
1628
|
file: "invitations-handler.ts",
|
|
1622
|
-
line:
|
|
1629
|
+
line: 241,
|
|
1623
1630
|
scope: this,
|
|
1624
1631
|
callSite: (f, a) => f(...a)
|
|
1625
1632
|
});
|
|
@@ -1634,11 +1641,11 @@ var InvitationsHandler = class {
|
|
|
1634
1641
|
currentState
|
|
1635
1642
|
}, {
|
|
1636
1643
|
file: "invitations-handler.ts",
|
|
1637
|
-
line:
|
|
1644
|
+
line: 251,
|
|
1638
1645
|
scope: this,
|
|
1639
1646
|
callSite: (f, a) => f(...a)
|
|
1640
1647
|
});
|
|
1641
|
-
if (
|
|
1648
|
+
if (!admitted) {
|
|
1642
1649
|
stream.error(new Error("Remote peer disconnected."));
|
|
1643
1650
|
}
|
|
1644
1651
|
});
|
|
@@ -1649,7 +1656,7 @@ var InvitationsHandler = class {
|
|
|
1649
1656
|
id: traceId
|
|
1650
1657
|
}), {
|
|
1651
1658
|
file: "invitations-handler.ts",
|
|
1652
|
-
line:
|
|
1659
|
+
line: 260,
|
|
1653
1660
|
scope: this,
|
|
1654
1661
|
callSite: (f, a) => f(...a)
|
|
1655
1662
|
});
|
|
@@ -1661,7 +1668,7 @@ var InvitationsHandler = class {
|
|
|
1661
1668
|
...protocol.toJSON()
|
|
1662
1669
|
}, {
|
|
1663
1670
|
file: "invitations-handler.ts",
|
|
1664
|
-
line:
|
|
1671
|
+
line: 268,
|
|
1665
1672
|
scope: this,
|
|
1666
1673
|
callSite: (f, a) => f(...a)
|
|
1667
1674
|
});
|
|
@@ -1672,7 +1679,7 @@ var InvitationsHandler = class {
|
|
|
1672
1679
|
...protocol.toJSON()
|
|
1673
1680
|
}, {
|
|
1674
1681
|
file: "invitations-handler.ts",
|
|
1675
|
-
line:
|
|
1682
|
+
line: 272,
|
|
1676
1683
|
scope: this,
|
|
1677
1684
|
callSite: (f, a) => f(...a)
|
|
1678
1685
|
});
|
|
@@ -1682,7 +1689,7 @@ var InvitationsHandler = class {
|
|
|
1682
1689
|
response: introductionResponse
|
|
1683
1690
|
}, {
|
|
1684
1691
|
file: "invitations-handler.ts",
|
|
1685
|
-
line:
|
|
1692
|
+
line: 276,
|
|
1686
1693
|
scope: this,
|
|
1687
1694
|
callSite: (f, a) => f(...a)
|
|
1688
1695
|
});
|
|
@@ -1694,7 +1701,7 @@ var InvitationsHandler = class {
|
|
|
1694
1701
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
1695
1702
|
(0, import_log5.log)("guest waiting for authentication code...", {}, {
|
|
1696
1703
|
file: "invitations-handler.ts",
|
|
1697
|
-
line:
|
|
1704
|
+
line: 285,
|
|
1698
1705
|
scope: this,
|
|
1699
1706
|
callSite: (f, a) => f(...a)
|
|
1700
1707
|
});
|
|
@@ -1706,7 +1713,7 @@ var InvitationsHandler = class {
|
|
|
1706
1713
|
});
|
|
1707
1714
|
(0, import_log5.log)("sending authentication request", {}, {
|
|
1708
1715
|
file: "invitations-handler.ts",
|
|
1709
|
-
line:
|
|
1716
|
+
line: 289,
|
|
1710
1717
|
scope: this,
|
|
1711
1718
|
callSite: (f, a) => f(...a)
|
|
1712
1719
|
});
|
|
@@ -1727,7 +1734,7 @@ var InvitationsHandler = class {
|
|
|
1727
1734
|
attempt
|
|
1728
1735
|
}, {
|
|
1729
1736
|
file: "invitations-handler.ts",
|
|
1730
|
-
line:
|
|
1737
|
+
line: 300,
|
|
1731
1738
|
scope: this,
|
|
1732
1739
|
callSite: (f, a) => f(...a)
|
|
1733
1740
|
});
|
|
@@ -1744,18 +1751,19 @@ var InvitationsHandler = class {
|
|
|
1744
1751
|
...protocol.toJSON()
|
|
1745
1752
|
}, {
|
|
1746
1753
|
file: "invitations-handler.ts",
|
|
1747
|
-
line:
|
|
1754
|
+
line: 311,
|
|
1748
1755
|
scope: this,
|
|
1749
1756
|
callSite: (f, a) => f(...a)
|
|
1750
1757
|
});
|
|
1751
1758
|
const admissionRequest = await protocol.createAdmissionRequest();
|
|
1752
1759
|
const admissionResponse = await extension.rpc.InvitationHostService.admit(admissionRequest);
|
|
1760
|
+
admitted = true;
|
|
1753
1761
|
const result = await protocol.accept(admissionResponse, admissionRequest);
|
|
1754
1762
|
(0, import_log5.log)("admitted by host", {
|
|
1755
1763
|
...protocol.toJSON()
|
|
1756
1764
|
}, {
|
|
1757
1765
|
file: "invitations-handler.ts",
|
|
1758
|
-
line:
|
|
1766
|
+
line: 322,
|
|
1759
1767
|
scope: this,
|
|
1760
1768
|
callSite: (f, a) => f(...a)
|
|
1761
1769
|
});
|
|
@@ -1767,7 +1775,7 @@ var InvitationsHandler = class {
|
|
|
1767
1775
|
id: traceId
|
|
1768
1776
|
}), {
|
|
1769
1777
|
file: "invitations-handler.ts",
|
|
1770
|
-
line:
|
|
1778
|
+
line: 324,
|
|
1771
1779
|
scope: this,
|
|
1772
1780
|
callSite: (f, a) => f(...a)
|
|
1773
1781
|
});
|
|
@@ -1777,7 +1785,7 @@ var InvitationsHandler = class {
|
|
|
1777
1785
|
...protocol.toJSON()
|
|
1778
1786
|
}, {
|
|
1779
1787
|
file: "invitations-handler.ts",
|
|
1780
|
-
line:
|
|
1788
|
+
line: 327,
|
|
1781
1789
|
scope: this,
|
|
1782
1790
|
callSite: (f, a) => f(...a)
|
|
1783
1791
|
});
|
|
@@ -1787,7 +1795,7 @@ var InvitationsHandler = class {
|
|
|
1787
1795
|
} else {
|
|
1788
1796
|
(0, import_log5.log)("auth failed", err, {
|
|
1789
1797
|
file: "invitations-handler.ts",
|
|
1790
|
-
line:
|
|
1798
|
+
line: 330,
|
|
1791
1799
|
scope: this,
|
|
1792
1800
|
callSite: (f, a) => f(...a)
|
|
1793
1801
|
});
|
|
@@ -1798,7 +1806,7 @@ var InvitationsHandler = class {
|
|
|
1798
1806
|
error: err
|
|
1799
1807
|
}), {
|
|
1800
1808
|
file: "invitations-handler.ts",
|
|
1801
|
-
line:
|
|
1809
|
+
line: 333,
|
|
1802
1810
|
scope: this,
|
|
1803
1811
|
callSite: (f, a) => f(...a)
|
|
1804
1812
|
});
|
|
@@ -1816,7 +1824,7 @@ var InvitationsHandler = class {
|
|
|
1816
1824
|
...protocol.toJSON()
|
|
1817
1825
|
}, {
|
|
1818
1826
|
file: "invitations-handler.ts",
|
|
1819
|
-
line:
|
|
1827
|
+
line: 344,
|
|
1820
1828
|
scope: this,
|
|
1821
1829
|
callSite: (f, a) => f(...a)
|
|
1822
1830
|
});
|
|
@@ -1826,7 +1834,7 @@ var InvitationsHandler = class {
|
|
|
1826
1834
|
} else {
|
|
1827
1835
|
(0, import_log5.log)("auth failed", err, {
|
|
1828
1836
|
file: "invitations-handler.ts",
|
|
1829
|
-
line:
|
|
1837
|
+
line: 347,
|
|
1830
1838
|
scope: this,
|
|
1831
1839
|
callSite: (f, a) => f(...a)
|
|
1832
1840
|
});
|
|
@@ -2137,7 +2145,7 @@ var import_log15 = require("@dxos/log");
|
|
|
2137
2145
|
var import_messaging = require("@dxos/messaging");
|
|
2138
2146
|
var import_network_manager2 = require("@dxos/network-manager");
|
|
2139
2147
|
var import_protocols9 = require("@dxos/protocols");
|
|
2140
|
-
var
|
|
2148
|
+
var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
|
|
2141
2149
|
|
|
2142
2150
|
// packages/sdk/client-services/src/packlets/devices/devices-service.ts
|
|
2143
2151
|
var import_async10 = require("@dxos/async");
|
|
@@ -2248,6 +2256,7 @@ var isLocked = (lockPath) => import_lockfile.default.checkSync(lockPath);
|
|
|
2248
2256
|
var import_async12 = require("@dxos/async");
|
|
2249
2257
|
var import_codec_protobuf10 = require("@dxos/codec-protobuf");
|
|
2250
2258
|
var import_log9 = require("@dxos/log");
|
|
2259
|
+
var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
|
|
2251
2260
|
var import_util3 = require("@dxos/util");
|
|
2252
2261
|
var LoggingServiceImpl = class {
|
|
2253
2262
|
constructor() {
|
|
@@ -2264,31 +2273,60 @@ var LoggingServiceImpl = class {
|
|
|
2264
2273
|
import_log9.log.runtimeConfig.processors.splice(index, 1);
|
|
2265
2274
|
}
|
|
2266
2275
|
queryLogs(request) {
|
|
2267
|
-
var _a;
|
|
2268
|
-
const filters = ((_a = request.filters) == null ? void 0 : _a.length) ? request.filters : void 0;
|
|
2269
2276
|
return new import_codec_protobuf10.Stream(({ ctx, next }) => {
|
|
2270
2277
|
const handler = (entry2) => {
|
|
2271
|
-
var
|
|
2272
|
-
if (
|
|
2278
|
+
var _a, _b, _c, _d, _e;
|
|
2279
|
+
if (LOG_PROCESSING > 0) {
|
|
2273
2280
|
return;
|
|
2274
2281
|
}
|
|
2275
|
-
if ((0
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
+
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"))) {
|
|
2283
|
+
return;
|
|
2284
|
+
}
|
|
2285
|
+
if (!shouldLog(entry2, request)) {
|
|
2286
|
+
return;
|
|
2287
|
+
}
|
|
2288
|
+
const record = {
|
|
2289
|
+
...entry2,
|
|
2290
|
+
context: (0, import_util3.jsonify)((0, import_log9.getContextFromEntry)(entry2)),
|
|
2291
|
+
timestamp: new Date(),
|
|
2292
|
+
meta: {
|
|
2293
|
+
// TODO(dmaretskyi): Fix proto.
|
|
2294
|
+
file: (_c = (_b = entry2.meta) == null ? void 0 : _b.file) != null ? _c : "",
|
|
2295
|
+
line: (_e = (_d = entry2.meta) == null ? void 0 : _d.line) != null ? _e : 0
|
|
2296
|
+
}
|
|
2297
|
+
};
|
|
2298
|
+
try {
|
|
2299
|
+
LOG_PROCESSING++;
|
|
2282
2300
|
next(record);
|
|
2301
|
+
} finally {
|
|
2302
|
+
LOG_PROCESSING--;
|
|
2283
2303
|
}
|
|
2284
2304
|
};
|
|
2285
|
-
|
|
2286
|
-
this._logs.off(handler);
|
|
2287
|
-
});
|
|
2288
|
-
this._logs.on(handler);
|
|
2305
|
+
this._logs.on(ctx, handler);
|
|
2289
2306
|
});
|
|
2290
2307
|
}
|
|
2291
2308
|
};
|
|
2309
|
+
var matchFilter = (filter, level, path, options) => {
|
|
2310
|
+
switch (options) {
|
|
2311
|
+
case import_services7.QueryLogsRequest.MatchingOptions.INCLUSIVE:
|
|
2312
|
+
return level >= filter.level && (!filter.pattern || path.includes(filter.pattern));
|
|
2313
|
+
case import_services7.QueryLogsRequest.MatchingOptions.EXPLICIT:
|
|
2314
|
+
return level === filter.level && (!filter.pattern || path.includes(filter.pattern));
|
|
2315
|
+
}
|
|
2316
|
+
};
|
|
2317
|
+
var shouldLog = (entry2, request) => {
|
|
2318
|
+
var _a;
|
|
2319
|
+
const options = (_a = request.options) != null ? _a : import_services7.QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
2320
|
+
if (request.filters === void 0) {
|
|
2321
|
+
return options === import_services7.QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
2322
|
+
} else {
|
|
2323
|
+
return request.filters.some((filter) => {
|
|
2324
|
+
var _a2, _b;
|
|
2325
|
+
return matchFilter(filter, entry2.level, (_b = (_a2 = entry2.meta) == null ? void 0 : _a2.file) != null ? _b : "", options);
|
|
2326
|
+
});
|
|
2327
|
+
}
|
|
2328
|
+
};
|
|
2329
|
+
var LOG_PROCESSING = 0;
|
|
2292
2330
|
|
|
2293
2331
|
// packages/sdk/client-services/src/packlets/network/network-service.ts
|
|
2294
2332
|
var import_codec_protobuf11 = require("@dxos/codec-protobuf");
|
|
@@ -2330,7 +2368,7 @@ var import_credentials12 = require("@dxos/credentials");
|
|
|
2330
2368
|
var import_keys9 = require("@dxos/keys");
|
|
2331
2369
|
var import_log12 = require("@dxos/log");
|
|
2332
2370
|
var import_protocols6 = require("@dxos/protocols");
|
|
2333
|
-
var
|
|
2371
|
+
var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
|
|
2334
2372
|
var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
|
|
2335
2373
|
var import_util6 = require("@dxos/util");
|
|
2336
2374
|
|
|
@@ -2343,8 +2381,9 @@ var import_echo_pipeline = require("@dxos/echo-pipeline");
|
|
|
2343
2381
|
var import_errors3 = require("@dxos/errors");
|
|
2344
2382
|
var import_keys8 = require("@dxos/keys");
|
|
2345
2383
|
var import_log11 = require("@dxos/log");
|
|
2346
|
-
var
|
|
2384
|
+
var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
|
|
2347
2385
|
var import_credentials9 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
2386
|
+
var import_timeframe = require("@dxos/timeframe");
|
|
2348
2387
|
var import_util5 = require("@dxos/util");
|
|
2349
2388
|
|
|
2350
2389
|
// packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
|
|
@@ -2603,7 +2642,7 @@ var __decorate2 = function(decorators, target, key, desc) {
|
|
|
2603
2642
|
var DataSpace = class DataSpace2 {
|
|
2604
2643
|
constructor(params) {
|
|
2605
2644
|
this._ctx = new import_context6.Context();
|
|
2606
|
-
this._state =
|
|
2645
|
+
this._state = import_services8.SpaceState.CLOSED;
|
|
2607
2646
|
/**
|
|
2608
2647
|
* Error for _state === SpaceState.ERROR.
|
|
2609
2648
|
*/
|
|
@@ -2657,11 +2696,11 @@ var DataSpace = class DataSpace2 {
|
|
|
2657
2696
|
await this.notarizationPlugin.open();
|
|
2658
2697
|
await this._notarizationPluginConsumer.open();
|
|
2659
2698
|
await this._inner.open();
|
|
2660
|
-
this._state =
|
|
2699
|
+
this._state = import_services8.SpaceState.INACTIVE;
|
|
2661
2700
|
this.metrics.open = new Date();
|
|
2662
2701
|
}
|
|
2663
2702
|
async close() {
|
|
2664
|
-
this._state =
|
|
2703
|
+
this._state = import_services8.SpaceState.CLOSED;
|
|
2665
2704
|
await this._ctx.dispose();
|
|
2666
2705
|
await this.authVerifier.close();
|
|
2667
2706
|
await this._inner.close();
|
|
@@ -2687,7 +2726,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2687
2726
|
if (err instanceof import_errors3.CancelledError) {
|
|
2688
2727
|
(0, import_log11.log)("Data pipeline initialization cancelled", err, {
|
|
2689
2728
|
file: "data-space.ts",
|
|
2690
|
-
line:
|
|
2729
|
+
line: 173,
|
|
2691
2730
|
scope: this,
|
|
2692
2731
|
callSite: (f, a) => f(...a)
|
|
2693
2732
|
});
|
|
@@ -2695,11 +2734,11 @@ var DataSpace = class DataSpace2 {
|
|
|
2695
2734
|
}
|
|
2696
2735
|
import_log11.log.error("Error initializing data pipeline", err, {
|
|
2697
2736
|
file: "data-space.ts",
|
|
2698
|
-
line:
|
|
2737
|
+
line: 177,
|
|
2699
2738
|
scope: this,
|
|
2700
2739
|
callSite: (f, a) => f(...a)
|
|
2701
2740
|
});
|
|
2702
|
-
this._state =
|
|
2741
|
+
this._state = import_services8.SpaceState.ERROR;
|
|
2703
2742
|
this.error = err;
|
|
2704
2743
|
this.stateUpdate.emit();
|
|
2705
2744
|
} finally {
|
|
@@ -2709,10 +2748,10 @@ var DataSpace = class DataSpace2 {
|
|
|
2709
2748
|
}
|
|
2710
2749
|
async initializeDataPipeline() {
|
|
2711
2750
|
var _a, _b, _c, _d;
|
|
2712
|
-
if (this._state !==
|
|
2751
|
+
if (this._state !== import_services8.SpaceState.INACTIVE) {
|
|
2713
2752
|
throw new import_errors3.SystemError("Invalid operation");
|
|
2714
2753
|
}
|
|
2715
|
-
this._state =
|
|
2754
|
+
this._state = import_services8.SpaceState.INITIALIZING;
|
|
2716
2755
|
await this._inner.controlPipeline.state.waitUntilReachedTargetTimeframe({
|
|
2717
2756
|
ctx: this._ctx,
|
|
2718
2757
|
breakOnStall: false
|
|
@@ -2752,7 +2791,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2752
2791
|
callSite: (f, a) => f(...a)
|
|
2753
2792
|
});
|
|
2754
2793
|
await ((_b = (_a = this._callbacks).beforeReady) == null ? void 0 : _b.call(_a));
|
|
2755
|
-
this._state =
|
|
2794
|
+
this._state = import_services8.SpaceState.READY;
|
|
2756
2795
|
this.stateUpdate.emit();
|
|
2757
2796
|
await ((_d = (_c = this._callbacks).afterReady) == null ? void 0 : _d.call(_c));
|
|
2758
2797
|
}
|
|
@@ -2776,7 +2815,8 @@ var DataSpace = class DataSpace2 {
|
|
|
2776
2815
|
}
|
|
2777
2816
|
if (!this.inner.dataFeedKey) {
|
|
2778
2817
|
const dataFeed = await this._feedStore.openFeed(await this._keyring.createKey(), {
|
|
2779
|
-
writable: true
|
|
2818
|
+
writable: true,
|
|
2819
|
+
sparse: true
|
|
2780
2820
|
});
|
|
2781
2821
|
this.inner.setDataFeed(dataFeed);
|
|
2782
2822
|
credentials.push(await this._signingContext.credentialSigner.createCredential({
|
|
@@ -2802,7 +2842,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2802
2842
|
async createEpoch() {
|
|
2803
2843
|
var _a, _b;
|
|
2804
2844
|
const epoch = await this.dataPipeline.createEpoch();
|
|
2805
|
-
await this.inner.controlPipeline.writer.write({
|
|
2845
|
+
const receipt = await this.inner.controlPipeline.writer.write({
|
|
2806
2846
|
credential: {
|
|
2807
2847
|
credential: await this._signingContext.credentialSigner.createCredential({
|
|
2808
2848
|
subject: this.key,
|
|
@@ -2813,6 +2853,12 @@ var DataSpace = class DataSpace2 {
|
|
|
2813
2853
|
})
|
|
2814
2854
|
}
|
|
2815
2855
|
});
|
|
2856
|
+
await this.inner.controlPipeline.state.waitUntilTimeframe(new import_timeframe.Timeframe([
|
|
2857
|
+
[
|
|
2858
|
+
receipt.feedKey,
|
|
2859
|
+
receipt.seq
|
|
2860
|
+
]
|
|
2861
|
+
]));
|
|
2816
2862
|
for (const feed of (_b = (_a = this.inner.dataPipeline.pipelineState) == null ? void 0 : _a.feeds) != null ? _b : []) {
|
|
2817
2863
|
const indexBeforeEpoch = epoch.timeframe.get(feed.key);
|
|
2818
2864
|
if (indexBeforeEpoch) {
|
|
@@ -2832,7 +2878,7 @@ DataSpace = __decorate2([
|
|
|
2832
2878
|
var import_credentials10 = require("@dxos/credentials");
|
|
2833
2879
|
var import_debug4 = require("@dxos/debug");
|
|
2834
2880
|
var import_credentials11 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
2835
|
-
var
|
|
2881
|
+
var import_timeframe2 = require("@dxos/timeframe");
|
|
2836
2882
|
var spaceGenesis = async (keyring, signingContext, space) => {
|
|
2837
2883
|
var _a, _b, _c, _d;
|
|
2838
2884
|
const credentials = [
|
|
@@ -2883,7 +2929,7 @@ var spaceGenesis = async (keyring, signingContext, space) => {
|
|
|
2883
2929
|
"@type": "dxos.halo.credentials.Epoch",
|
|
2884
2930
|
number: 0,
|
|
2885
2931
|
previousId: void 0,
|
|
2886
|
-
timeframe: new
|
|
2932
|
+
timeframe: new import_timeframe2.Timeframe(),
|
|
2887
2933
|
snapshotCid: void 0
|
|
2888
2934
|
}
|
|
2889
2935
|
})
|
|
@@ -3063,7 +3109,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3063
3109
|
async waitUntilSpaceReady(spaceKey) {
|
|
3064
3110
|
await (0, import_context7.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
|
|
3065
3111
|
const space = this._spaces.get(spaceKey);
|
|
3066
|
-
return !!space && space.state ===
|
|
3112
|
+
return !!space && space.state === import_services9.SpaceState.READY;
|
|
3067
3113
|
}));
|
|
3068
3114
|
}
|
|
3069
3115
|
async _constructSpace(metadata) {
|
|
@@ -3088,7 +3134,8 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3088
3134
|
writable: true
|
|
3089
3135
|
});
|
|
3090
3136
|
const dataFeed = metadata.dataFeedKey && await this._feedStore.openFeed(metadata.dataFeedKey, {
|
|
3091
|
-
writable: true
|
|
3137
|
+
writable: true,
|
|
3138
|
+
sparse: true
|
|
3092
3139
|
});
|
|
3093
3140
|
const space = await this._spaceManager.constructSpace({
|
|
3094
3141
|
metadata,
|
|
@@ -3107,7 +3154,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3107
3154
|
onAuthFailure: () => {
|
|
3108
3155
|
import_log12.log.warn("auth failure", {}, {
|
|
3109
3156
|
file: "data-space-manager.ts",
|
|
3110
|
-
line:
|
|
3157
|
+
line: 213,
|
|
3111
3158
|
scope: this,
|
|
3112
3159
|
callSite: (f, a) => f(...a)
|
|
3113
3160
|
});
|
|
@@ -3130,7 +3177,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3130
3177
|
space: space.key
|
|
3131
3178
|
}, {
|
|
3132
3179
|
file: "data-space-manager.ts",
|
|
3133
|
-
line:
|
|
3180
|
+
line: 230,
|
|
3134
3181
|
scope: this,
|
|
3135
3182
|
callSite: (f, a) => f(...a)
|
|
3136
3183
|
});
|
|
@@ -3142,7 +3189,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3142
3189
|
open: this._isOpen
|
|
3143
3190
|
}, {
|
|
3144
3191
|
file: "data-space-manager.ts",
|
|
3145
|
-
line:
|
|
3192
|
+
line: 237,
|
|
3146
3193
|
scope: this,
|
|
3147
3194
|
callSite: (f, a) => f(...a)
|
|
3148
3195
|
});
|
|
@@ -3187,7 +3234,7 @@ var import_debug5 = require("@dxos/debug");
|
|
|
3187
3234
|
var import_echo_pipeline2 = require("@dxos/echo-pipeline");
|
|
3188
3235
|
var import_log13 = require("@dxos/log");
|
|
3189
3236
|
var import_protocols7 = require("@dxos/protocols");
|
|
3190
|
-
var
|
|
3237
|
+
var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
|
|
3191
3238
|
var import_util7 = require("@dxos/util");
|
|
3192
3239
|
var TIMEFRAME_UPDATE_DEBOUNCE_TIME = 500;
|
|
3193
3240
|
var SpacesServiceImpl = class {
|
|
@@ -3217,7 +3264,7 @@ var SpacesServiceImpl = class {
|
|
|
3217
3264
|
spaces
|
|
3218
3265
|
}, {
|
|
3219
3266
|
file: "spaces-service.ts",
|
|
3220
|
-
line:
|
|
3267
|
+
line: 60,
|
|
3221
3268
|
scope: this,
|
|
3222
3269
|
callSite: (f, a) => f(...a)
|
|
3223
3270
|
});
|
|
@@ -3234,6 +3281,7 @@ var SpacesServiceImpl = class {
|
|
|
3234
3281
|
for (const space of dataSpaceManager.spaces.values()) {
|
|
3235
3282
|
subscriptions.add(space.stateUpdate.on(ctx, onUpdate));
|
|
3236
3283
|
subscriptions.add(space.presence.updated.on(ctx, onUpdate));
|
|
3284
|
+
subscriptions.add(space.dataPipeline.onNewEpoch.on(ctx, onUpdate));
|
|
3237
3285
|
space.inner.controlPipeline.state.timeframeUpdate.debounce(TIMEFRAME_UPDATE_DEBOUNCE_TIME).on(ctx, onUpdate);
|
|
3238
3286
|
if (space.dataPipeline.pipelineState) {
|
|
3239
3287
|
subscriptions.add(space.dataPipeline.pipelineState.timeframeUpdate.debounce(TIMEFRAME_UPDATE_DEBOUNCE_TIME).on(ctx, onUpdate));
|
|
@@ -3304,20 +3352,23 @@ var SpacesServiceImpl = class {
|
|
|
3304
3352
|
await space.createEpoch();
|
|
3305
3353
|
}
|
|
3306
3354
|
_transformSpace(space) {
|
|
3307
|
-
var _a, _b, _c, _d, _e;
|
|
3355
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
3308
3356
|
return {
|
|
3309
3357
|
spaceKey: space.key,
|
|
3310
3358
|
state: space.state,
|
|
3311
3359
|
error: space.error ? (0, import_protocols7.encodeError)(space.error) : void 0,
|
|
3312
3360
|
pipeline: {
|
|
3361
|
+
currentEpoch: space.dataPipeline.currentEpoch,
|
|
3362
|
+
appliedEpoch: space.dataPipeline.appliedEpoch,
|
|
3313
3363
|
controlFeeds: space.inner.controlPipeline.state.feeds.map((feed) => feed.key),
|
|
3314
3364
|
currentControlTimeframe: space.inner.controlPipeline.state.timeframe,
|
|
3315
3365
|
targetControlTimeframe: space.inner.controlPipeline.state.targetTimeframe,
|
|
3316
3366
|
totalControlTimeframe: space.inner.controlPipeline.state.endTimeframe,
|
|
3317
3367
|
dataFeeds: (_b = (_a = space.dataPipeline.pipelineState) == null ? void 0 : _a.feeds.map((feed) => feed.key)) != null ? _b : [],
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3368
|
+
startDataTimeframe: (_c = space.dataPipeline.pipelineState) == null ? void 0 : _c.startTimeframe,
|
|
3369
|
+
currentDataTimeframe: (_d = space.dataPipeline.pipelineState) == null ? void 0 : _d.timeframe,
|
|
3370
|
+
targetDataTimeframe: (_e = space.dataPipeline.pipelineState) == null ? void 0 : _e.targetTimeframe,
|
|
3371
|
+
totalDataTimeframe: (_f = space.dataPipeline.pipelineState) == null ? void 0 : _f.endTimeframe
|
|
3321
3372
|
},
|
|
3322
3373
|
members: Array.from(space.inner.spaceState.members.values()).map((member) => {
|
|
3323
3374
|
var _a2, _b2, _c2;
|
|
@@ -3328,9 +3379,10 @@ var SpacesServiceImpl = class {
|
|
|
3328
3379
|
displayName: (_b2 = (_a2 = member.assertion.profile) == null ? void 0 : _a2.displayName) != null ? _b2 : (0, import_util7.humanize)(member.key)
|
|
3329
3380
|
}
|
|
3330
3381
|
},
|
|
3331
|
-
presence: ((_c2 = this._identityManager.identity) == null ? void 0 : _c2.identityKey.equals(member.key)) || space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key)).length > 0 ?
|
|
3382
|
+
presence: ((_c2 = this._identityManager.identity) == null ? void 0 : _c2.identityKey.equals(member.key)) || space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key)).length > 0 ? import_services10.SpaceMember.PresenceState.ONLINE : import_services10.SpaceMember.PresenceState.OFFLINE
|
|
3332
3383
|
};
|
|
3333
3384
|
}),
|
|
3385
|
+
creator: (_g = space.inner.spaceState.creator) == null ? void 0 : _g.key,
|
|
3334
3386
|
cache: space.cache,
|
|
3335
3387
|
metrics: space.metrics
|
|
3336
3388
|
};
|
|
@@ -3436,7 +3488,7 @@ var import_keyring = require("@dxos/keyring");
|
|
|
3436
3488
|
var import_keys10 = require("@dxos/keys");
|
|
3437
3489
|
var import_log14 = require("@dxos/log");
|
|
3438
3490
|
var import_protocols8 = require("@dxos/protocols");
|
|
3439
|
-
var
|
|
3491
|
+
var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
|
|
3440
3492
|
var ServiceContext = class {
|
|
3441
3493
|
// prettier-ignore
|
|
3442
3494
|
constructor(storage, networkManager, signalManager, modelFactory) {
|
|
@@ -3469,7 +3521,7 @@ var ServiceContext = class {
|
|
|
3469
3521
|
});
|
|
3470
3522
|
this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager);
|
|
3471
3523
|
this.invitations = new InvitationsHandler(this.networkManager);
|
|
3472
|
-
this._handlerFactories.set(
|
|
3524
|
+
this._handlerFactories.set(import_services11.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => {
|
|
3473
3525
|
var _a;
|
|
3474
3526
|
return (_a = this.identityManager.identity) != null ? _a : (0, import_debug6.failUndefined)();
|
|
3475
3527
|
}, this._acceptIdentity.bind(this)));
|
|
@@ -3581,7 +3633,7 @@ var ServiceContext = class {
|
|
|
3581
3633
|
};
|
|
3582
3634
|
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore);
|
|
3583
3635
|
await this.dataSpaceManager.open();
|
|
3584
|
-
this._handlerFactories.set(
|
|
3636
|
+
this._handlerFactories.set(import_services11.Invitation.Kind.SPACE, (invitation) => {
|
|
3585
3637
|
(0, import_node_assert11.default)(this.dataSpaceManager, "dataSpaceManager not initialized yet");
|
|
3586
3638
|
return new SpaceInvitationProtocol(this.dataSpaceManager, signingContext, this.keyring, invitation.spaceKey);
|
|
3587
3639
|
});
|
|
@@ -3707,12 +3759,12 @@ var ClientServicesHost = class {
|
|
|
3707
3759
|
this._systemService = new SystemServiceImpl({
|
|
3708
3760
|
config: this._config,
|
|
3709
3761
|
statusUpdate: this._statusUpdate,
|
|
3710
|
-
getCurrentStatus: () => this.isOpen ?
|
|
3762
|
+
getCurrentStatus: () => this.isOpen ? import_services12.SystemStatus.ACTIVE : import_services12.SystemStatus.INACTIVE,
|
|
3711
3763
|
onUpdateStatus: async (status) => {
|
|
3712
3764
|
var _a, _b;
|
|
3713
|
-
if (!this.isOpen && status ===
|
|
3765
|
+
if (!this.isOpen && status === import_services12.SystemStatus.ACTIVE) {
|
|
3714
3766
|
await ((_a = this._resourceLock) == null ? void 0 : _a.acquire());
|
|
3715
|
-
} else if (this.isOpen && status ===
|
|
3767
|
+
} else if (this.isOpen && status === import_services12.SystemStatus.INACTIVE) {
|
|
3716
3768
|
await ((_b = this._resourceLock) == null ? void 0 : _b.release());
|
|
3717
3769
|
}
|
|
3718
3770
|
},
|