@dxos/client-services 0.4.8-main.c67d72c → 0.4.8-main.dcf422f
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-EUPRQ6KX.mjs → chunk-Z4VLE2UJ.mjs} +100 -33
- package/dist/lib/browser/{chunk-EUPRQ6KX.mjs.map → chunk-Z4VLE2UJ.mjs.map} +4 -4
- 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/{chunk-HFEOZ332.cjs → chunk-2QQ2IXOK.cjs} +107 -44
- package/dist/lib/node/{chunk-HFEOZ332.cjs.map → chunk-2QQ2IXOK.cjs.map} +4 -4
- package/dist/lib/node/index.cjs +38 -38
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +8 -8
- package/dist/types/src/packlets/indexing/index.d.ts +2 -0
- package/dist/types/src/packlets/indexing/index.d.ts.map +1 -0
- package/dist/types/src/packlets/indexing/util.d.ts +15 -0
- package/dist/types/src/packlets/indexing/util.d.ts.map +1 -0
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +37 -37
- package/src/packlets/indexing/index.ts +5 -0
- package/src/packlets/indexing/util.ts +89 -0
- package/src/packlets/services/service-context.ts +5 -16
- package/src/version.ts +1 -1
|
@@ -2772,7 +2772,7 @@ var getPlatform = () => {
|
|
|
2772
2772
|
};
|
|
2773
2773
|
|
|
2774
2774
|
// packages/sdk/client-services/src/version.ts
|
|
2775
|
-
var DXOS_VERSION = "0.4.8-main.
|
|
2775
|
+
var DXOS_VERSION = "0.4.8-main.dcf422f";
|
|
2776
2776
|
|
|
2777
2777
|
// packages/sdk/client-services/src/packlets/services/diagnostics.ts
|
|
2778
2778
|
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
|
|
@@ -4382,10 +4382,9 @@ var getChannelId = (channel) => `user-channel/${channel}`;
|
|
|
4382
4382
|
|
|
4383
4383
|
// packages/sdk/client-services/src/packlets/services/service-context.ts
|
|
4384
4384
|
import { Trigger as Trigger5 } from "@dxos/async";
|
|
4385
|
-
import { getHeads } from "@dxos/automerge/automerge";
|
|
4386
4385
|
import { Context as Context10 } from "@dxos/context";
|
|
4387
4386
|
import { getCredentialAssertion as getCredentialAssertion3 } from "@dxos/credentials";
|
|
4388
|
-
import { failUndefined as failUndefined2
|
|
4387
|
+
import { failUndefined as failUndefined2 } from "@dxos/debug";
|
|
4389
4388
|
import { valueEncoding, MetadataStore, SpaceManager, DataServiceSubscriptions, SnapshotStore, AutomergeHost } from "@dxos/echo-pipeline";
|
|
4390
4389
|
import { FeedFactory, FeedStore } from "@dxos/feed-store";
|
|
4391
4390
|
import { IndexMetadataStore, IndexStore, Indexer } from "@dxos/indexing";
|
|
@@ -4393,11 +4392,92 @@ import { invariant as invariant14 } from "@dxos/invariant";
|
|
|
4393
4392
|
import { Keyring } from "@dxos/keyring";
|
|
4394
4393
|
import { PublicKey as PublicKey10 } from "@dxos/keys";
|
|
4395
4394
|
import { log as log13 } from "@dxos/log";
|
|
4396
|
-
import { InvalidStorageVersionError, STORAGE_VERSION as STORAGE_VERSION2,
|
|
4395
|
+
import { InvalidStorageVersionError, STORAGE_VERSION as STORAGE_VERSION2, trace as trace8 } from "@dxos/protocols";
|
|
4397
4396
|
import { Invitation as Invitation6 } from "@dxos/protocols/proto/dxos/client/services";
|
|
4398
4397
|
import { BlobStore } from "@dxos/teleport-extension-object-sync";
|
|
4399
4398
|
import { trace as Trace2 } from "@dxos/tracing";
|
|
4400
4399
|
import { safeInstanceof } from "@dxos/util";
|
|
4400
|
+
|
|
4401
|
+
// packages/sdk/client-services/src/packlets/indexing/util.ts
|
|
4402
|
+
import { getHeads } from "@dxos/automerge/automerge";
|
|
4403
|
+
import { warnAfterTimeout as warnAfterTimeout2 } from "@dxos/debug";
|
|
4404
|
+
import { idCodec } from "@dxos/protocols";
|
|
4405
|
+
var createLoadDocuments = (automergeHost) => (
|
|
4406
|
+
/**
|
|
4407
|
+
* Get object data blobs from Automerge Repo by ids.
|
|
4408
|
+
* @param ids
|
|
4409
|
+
*/
|
|
4410
|
+
// TODO(mykola): Unload automerge handles after usage.
|
|
4411
|
+
async function* loadDocuments(ids) {
|
|
4412
|
+
for (const id of ids) {
|
|
4413
|
+
const { documentId, objectId } = idCodec.decode(id);
|
|
4414
|
+
const handle = automergeHost.repo.find(documentId);
|
|
4415
|
+
await warnAfterTimeout2(5e3, "to long to load doc", () => handle.whenReady());
|
|
4416
|
+
const doc = handle.docSync();
|
|
4417
|
+
const heads = getHeads(doc);
|
|
4418
|
+
yield [
|
|
4419
|
+
{
|
|
4420
|
+
id,
|
|
4421
|
+
object: doc.objects[objectId],
|
|
4422
|
+
currentHash: heads.at(-1)
|
|
4423
|
+
}
|
|
4424
|
+
];
|
|
4425
|
+
}
|
|
4426
|
+
}
|
|
4427
|
+
);
|
|
4428
|
+
var createGetAllDocuments = (automergeHost) => (
|
|
4429
|
+
/**
|
|
4430
|
+
* Recursively get all object data blobs from Automerge Repo.
|
|
4431
|
+
* @param ids
|
|
4432
|
+
*/
|
|
4433
|
+
// TODO(mykola): Unload automerge handles after usage.
|
|
4434
|
+
async function* getAllDocuments() {
|
|
4435
|
+
const visited = /* @__PURE__ */ new Set();
|
|
4436
|
+
async function* getObjectsFromHandle(handle) {
|
|
4437
|
+
if (visited.has(handle.documentId)) {
|
|
4438
|
+
return;
|
|
4439
|
+
}
|
|
4440
|
+
await warnAfterTimeout2(5e3, "to long to load doc", () => handle.whenReady());
|
|
4441
|
+
const doc = handle.docSync();
|
|
4442
|
+
const heads = getHeads(doc);
|
|
4443
|
+
if (doc.objects) {
|
|
4444
|
+
yield Object.entries(doc.objects).map(([objectId, object]) => {
|
|
4445
|
+
return {
|
|
4446
|
+
id: idCodec.encode({
|
|
4447
|
+
documentId: handle.documentId,
|
|
4448
|
+
objectId
|
|
4449
|
+
}),
|
|
4450
|
+
object,
|
|
4451
|
+
currentHash: heads.at(-1)
|
|
4452
|
+
};
|
|
4453
|
+
});
|
|
4454
|
+
}
|
|
4455
|
+
if (doc.links) {
|
|
4456
|
+
for (const id of Object.values(doc.links)) {
|
|
4457
|
+
if (visited.has(id)) {
|
|
4458
|
+
continue;
|
|
4459
|
+
}
|
|
4460
|
+
const linkHandle = automergeHost.repo.find(id);
|
|
4461
|
+
for await (const result of getObjectsFromHandle(linkHandle)) {
|
|
4462
|
+
yield result;
|
|
4463
|
+
}
|
|
4464
|
+
}
|
|
4465
|
+
}
|
|
4466
|
+
visited.add(handle.documentId);
|
|
4467
|
+
}
|
|
4468
|
+
for (const handle of Object.values(automergeHost.repo.handles)) {
|
|
4469
|
+
if (visited.has(handle.documentId)) {
|
|
4470
|
+
continue;
|
|
4471
|
+
}
|
|
4472
|
+
for await (const result of getObjectsFromHandle(handle)) {
|
|
4473
|
+
yield result;
|
|
4474
|
+
}
|
|
4475
|
+
visited.add(handle.documentId);
|
|
4476
|
+
}
|
|
4477
|
+
}
|
|
4478
|
+
);
|
|
4479
|
+
|
|
4480
|
+
// packages/sdk/client-services/src/packlets/services/service-context.ts
|
|
4401
4481
|
function _ts_decorate6(decorators, target, key, desc) {
|
|
4402
4482
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4403
4483
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -4455,21 +4535,8 @@ var ServiceContext = class {
|
|
|
4455
4535
|
directory: storage.createDirectory("index-store")
|
|
4456
4536
|
}),
|
|
4457
4537
|
metadataStore: this.indexMetadata,
|
|
4458
|
-
loadDocuments:
|
|
4459
|
-
|
|
4460
|
-
const { documentId, objectId } = idCodec.decode(id);
|
|
4461
|
-
const handle = this.automergeHost.repo.find(documentId);
|
|
4462
|
-
await warnAfterTimeout2(1e3, "to long to load doc", () => handle.whenReady());
|
|
4463
|
-
const doc = handle.docSync();
|
|
4464
|
-
const heads = getHeads(doc);
|
|
4465
|
-
return {
|
|
4466
|
-
id,
|
|
4467
|
-
object: doc.objects[objectId],
|
|
4468
|
-
currentHash: heads.at(-1)
|
|
4469
|
-
};
|
|
4470
|
-
}));
|
|
4471
|
-
return snapshots.filter((snapshot) => snapshot.object);
|
|
4472
|
-
}
|
|
4538
|
+
loadDocuments: createLoadDocuments(this.automergeHost),
|
|
4539
|
+
getAllDocuments: createGetAllDocuments(this.automergeHost)
|
|
4473
4540
|
});
|
|
4474
4541
|
this.invitations = new InvitationsHandler(this.networkManager);
|
|
4475
4542
|
this._handlerFactories.set(Invitation6.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? failUndefined2(), this._acceptIdentity.bind(this)));
|
|
@@ -4478,7 +4545,7 @@ var ServiceContext = class {
|
|
|
4478
4545
|
await this._checkStorageVersion();
|
|
4479
4546
|
log13("opening...", void 0, {
|
|
4480
4547
|
F: __dxlog_file15,
|
|
4481
|
-
L:
|
|
4548
|
+
L: 162,
|
|
4482
4549
|
S: this,
|
|
4483
4550
|
C: (f, a) => f(...a)
|
|
4484
4551
|
});
|
|
@@ -4486,7 +4553,7 @@ var ServiceContext = class {
|
|
|
4486
4553
|
id: this._instanceId
|
|
4487
4554
|
}), {
|
|
4488
4555
|
F: __dxlog_file15,
|
|
4489
|
-
L:
|
|
4556
|
+
L: 163,
|
|
4490
4557
|
S: this,
|
|
4491
4558
|
C: (f, a) => f(...a)
|
|
4492
4559
|
});
|
|
@@ -4502,13 +4569,13 @@ var ServiceContext = class {
|
|
|
4502
4569
|
id: this._instanceId
|
|
4503
4570
|
}), {
|
|
4504
4571
|
F: __dxlog_file15,
|
|
4505
|
-
L:
|
|
4572
|
+
L: 173,
|
|
4506
4573
|
S: this,
|
|
4507
4574
|
C: (f, a) => f(...a)
|
|
4508
4575
|
});
|
|
4509
4576
|
log13("opened", void 0, {
|
|
4510
4577
|
F: __dxlog_file15,
|
|
4511
|
-
L:
|
|
4578
|
+
L: 174,
|
|
4512
4579
|
S: this,
|
|
4513
4580
|
C: (f, a) => f(...a)
|
|
4514
4581
|
});
|
|
@@ -4516,7 +4583,7 @@ var ServiceContext = class {
|
|
|
4516
4583
|
async close() {
|
|
4517
4584
|
log13("closing...", void 0, {
|
|
4518
4585
|
F: __dxlog_file15,
|
|
4519
|
-
L:
|
|
4586
|
+
L: 178,
|
|
4520
4587
|
S: this,
|
|
4521
4588
|
C: (f, a) => f(...a)
|
|
4522
4589
|
});
|
|
@@ -4535,7 +4602,7 @@ var ServiceContext = class {
|
|
|
4535
4602
|
await this.indexer.destroy();
|
|
4536
4603
|
log13("closed", void 0, {
|
|
4537
4604
|
F: __dxlog_file15,
|
|
4538
|
-
L:
|
|
4605
|
+
L: 192,
|
|
4539
4606
|
S: this,
|
|
4540
4607
|
C: (f, a) => f(...a)
|
|
4541
4608
|
});
|
|
@@ -4549,7 +4616,7 @@ var ServiceContext = class {
|
|
|
4549
4616
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
4550
4617
|
invariant14(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
4551
4618
|
F: __dxlog_file15,
|
|
4552
|
-
L:
|
|
4619
|
+
L: 203,
|
|
4553
4620
|
S: this,
|
|
4554
4621
|
A: [
|
|
4555
4622
|
"factory",
|
|
@@ -4581,7 +4648,7 @@ var ServiceContext = class {
|
|
|
4581
4648
|
async _initialize(ctx) {
|
|
4582
4649
|
log13("initializing spaces...", void 0, {
|
|
4583
4650
|
F: __dxlog_file15,
|
|
4584
|
-
L:
|
|
4651
|
+
L: 234,
|
|
4585
4652
|
S: this,
|
|
4586
4653
|
C: (f, a) => f(...a)
|
|
4587
4654
|
});
|
|
@@ -4604,7 +4671,7 @@ var ServiceContext = class {
|
|
|
4604
4671
|
this._handlerFactories.set(Invitation6.Kind.SPACE, (invitation) => {
|
|
4605
4672
|
invariant14(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
4606
4673
|
F: __dxlog_file15,
|
|
4607
|
-
L:
|
|
4674
|
+
L: 259,
|
|
4608
4675
|
S: this,
|
|
4609
4676
|
A: [
|
|
4610
4677
|
"this.dataSpaceManager",
|
|
@@ -4628,7 +4695,7 @@ var ServiceContext = class {
|
|
|
4628
4695
|
details: assertion
|
|
4629
4696
|
}, {
|
|
4630
4697
|
F: __dxlog_file15,
|
|
4631
|
-
L:
|
|
4698
|
+
L: 275,
|
|
4632
4699
|
S: this,
|
|
4633
4700
|
C: (f, a) => f(...a)
|
|
4634
4701
|
});
|
|
@@ -4639,7 +4706,7 @@ var ServiceContext = class {
|
|
|
4639
4706
|
details: assertion
|
|
4640
4707
|
}, {
|
|
4641
4708
|
F: __dxlog_file15,
|
|
4642
|
-
L:
|
|
4709
|
+
L: 279,
|
|
4643
4710
|
S: this,
|
|
4644
4711
|
C: (f, a) => f(...a)
|
|
4645
4712
|
});
|
|
@@ -4650,7 +4717,7 @@ var ServiceContext = class {
|
|
|
4650
4717
|
details: assertion
|
|
4651
4718
|
}, {
|
|
4652
4719
|
F: __dxlog_file15,
|
|
4653
|
-
L:
|
|
4720
|
+
L: 284,
|
|
4654
4721
|
S: this,
|
|
4655
4722
|
C: (f, a) => f(...a)
|
|
4656
4723
|
});
|
|
@@ -4661,7 +4728,7 @@ var ServiceContext = class {
|
|
|
4661
4728
|
} catch (err) {
|
|
4662
4729
|
log13.catch(err, void 0, {
|
|
4663
4730
|
F: __dxlog_file15,
|
|
4664
|
-
L:
|
|
4731
|
+
L: 290,
|
|
4665
4732
|
S: this,
|
|
4666
4733
|
C: (f, a) => f(...a)
|
|
4667
4734
|
});
|
|
@@ -5631,4 +5698,4 @@ export {
|
|
|
5631
5698
|
createDefaultModelFactory,
|
|
5632
5699
|
ClientServicesHost
|
|
5633
5700
|
};
|
|
5634
|
-
//# sourceMappingURL=chunk-
|
|
5701
|
+
//# sourceMappingURL=chunk-Z4VLE2UJ.mjs.map
|