@dxos/client-services 0.1.58-main.f4192cb → 0.1.58-main.f69fa2f
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-ZQHNJIE4.mjs → chunk-5WTEAZYV.mjs} +62 -30
- package/dist/lib/browser/{chunk-ZQHNJIE4.mjs.map → chunk-5WTEAZYV.mjs.map} +3 -3
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +3 -3
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/index.cjs +60 -28
- 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 +62 -30
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/network/network-service.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts +1 -0
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +35 -34
- package/src/packlets/network/network-service.ts +1 -4
- package/src/packlets/services/service-host.test.ts +3 -3
- package/src/packlets/services/service-host.ts +39 -3
- package/src/packlets/spaces/data-space-manager.test.ts +1 -1
- package/src/packlets/storage/storage.ts +9 -9
- package/src/packlets/testing/test-builder.ts +3 -3
- package/src/version.ts +1 -1
|
@@ -99,7 +99,7 @@ var getPlatform = () => {
|
|
|
99
99
|
};
|
|
100
100
|
|
|
101
101
|
// packages/sdk/client-services/src/version.ts
|
|
102
|
-
var DXOS_VERSION = "0.1.58-main.
|
|
102
|
+
var DXOS_VERSION = "0.1.58-main.f69fa2f";
|
|
103
103
|
|
|
104
104
|
// packages/sdk/client-services/src/packlets/services/diagnostics.ts
|
|
105
105
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
|
|
@@ -3837,6 +3837,7 @@ var import_client_protocol5 = require("@dxos/client-protocol");
|
|
|
3837
3837
|
var import_context10 = require("@dxos/context");
|
|
3838
3838
|
var import_document_model2 = require("@dxos/document-model");
|
|
3839
3839
|
var import_echo_pipeline3 = require("@dxos/echo-pipeline");
|
|
3840
|
+
var import_echo_schema = require("@dxos/echo-schema");
|
|
3840
3841
|
var import_invariant15 = require("@dxos/invariant");
|
|
3841
3842
|
var import_keys12 = require("@dxos/keys");
|
|
3842
3843
|
var import_log16 = require("@dxos/log");
|
|
@@ -4439,23 +4440,23 @@ var import_random_access_storage = require("@dxos/random-access-storage");
|
|
|
4439
4440
|
var import_util8 = require("@dxos/util");
|
|
4440
4441
|
var StorageDriver = import_config.Runtime.Client.Storage.StorageDriver;
|
|
4441
4442
|
var createStorageObjects = (config) => {
|
|
4442
|
-
const {
|
|
4443
|
-
if (persistent &&
|
|
4443
|
+
const { persistent = false, keyStore, dataStore, dataRoot = (0, import_util8.isNode)() ? import_client_protocol4.DX_DATA : "dxos/storage" } = config ?? {};
|
|
4444
|
+
if (persistent && dataStore === StorageDriver.RAM) {
|
|
4444
4445
|
throw new import_protocols11.InvalidConfigError("RAM storage cannot be used in persistent mode.");
|
|
4445
4446
|
}
|
|
4446
|
-
if (!persistent &&
|
|
4447
|
+
if (!persistent && dataStore !== void 0 && dataStore !== StorageDriver.RAM) {
|
|
4447
4448
|
throw new import_protocols11.InvalidConfigError("Cannot use a persistent storage in not persistent mode.");
|
|
4448
4449
|
}
|
|
4449
|
-
if (persistent &&
|
|
4450
|
+
if (persistent && keyStore === StorageDriver.RAM) {
|
|
4450
4451
|
throw new import_protocols11.InvalidConfigError("RAM key storage cannot be used in persistent mode.");
|
|
4451
4452
|
}
|
|
4452
|
-
if (!persistent &&
|
|
4453
|
+
if (!persistent && keyStore !== StorageDriver.RAM && keyStore !== void 0) {
|
|
4453
4454
|
throw new import_protocols11.InvalidConfigError("Cannot use a persistent key storage in not persistent mode.");
|
|
4454
4455
|
}
|
|
4455
4456
|
return {
|
|
4456
4457
|
storage: (0, import_random_access_storage.createStorage)({
|
|
4457
|
-
type: persistent ? toStorageType(
|
|
4458
|
-
root: `${
|
|
4458
|
+
type: persistent ? toStorageType(dataStore) : import_random_access_storage.StorageType.RAM,
|
|
4459
|
+
root: `${dataRoot}/`
|
|
4459
4460
|
})
|
|
4460
4461
|
};
|
|
4461
4462
|
};
|
|
@@ -4549,6 +4550,18 @@ var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
|
|
|
4549
4550
|
var createDefaultModelFactory = () => {
|
|
4550
4551
|
return new import_model_factory.ModelFactory().registerModel(import_document_model2.DocumentModel).registerModel(import_text_model.TextModel);
|
|
4551
4552
|
};
|
|
4553
|
+
var createGenesisMutationFromTypedObject = (obj) => {
|
|
4554
|
+
const snapshot = obj[import_echo_schema.base]._createSnapshot();
|
|
4555
|
+
return {
|
|
4556
|
+
objectId: obj[import_echo_schema.base]._id,
|
|
4557
|
+
genesis: {
|
|
4558
|
+
modelType: obj[import_echo_schema.base]._modelConstructor.meta.type
|
|
4559
|
+
},
|
|
4560
|
+
snapshot: {
|
|
4561
|
+
model: snapshot
|
|
4562
|
+
}
|
|
4563
|
+
};
|
|
4564
|
+
};
|
|
4552
4565
|
var ClientServicesHost = class ClientServicesHost2 {
|
|
4553
4566
|
constructor({
|
|
4554
4567
|
config,
|
|
@@ -4635,7 +4648,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4635
4648
|
initialize({ config, ...options }) {
|
|
4636
4649
|
(0, import_invariant15.invariant)(!this._open, "service host is open", {
|
|
4637
4650
|
F: __dxlog_file17,
|
|
4638
|
-
L:
|
|
4651
|
+
L: 201,
|
|
4639
4652
|
S: this,
|
|
4640
4653
|
A: [
|
|
4641
4654
|
"!this._open",
|
|
@@ -4644,14 +4657,14 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4644
4657
|
});
|
|
4645
4658
|
(0, import_log16.log)("initializing...", void 0, {
|
|
4646
4659
|
F: __dxlog_file17,
|
|
4647
|
-
L:
|
|
4660
|
+
L: 202,
|
|
4648
4661
|
S: this,
|
|
4649
4662
|
C: (f, a) => f(...a)
|
|
4650
4663
|
});
|
|
4651
4664
|
if (config) {
|
|
4652
4665
|
(0, import_invariant15.invariant)(!this._config, "config already set", {
|
|
4653
4666
|
F: __dxlog_file17,
|
|
4654
|
-
L:
|
|
4667
|
+
L: 205,
|
|
4655
4668
|
S: this,
|
|
4656
4669
|
A: [
|
|
4657
4670
|
"!this._config",
|
|
@@ -4669,7 +4682,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4669
4682
|
this._signalManager = signalManager;
|
|
4670
4683
|
(0, import_invariant15.invariant)(!this._networkManager, "network manager already set", {
|
|
4671
4684
|
F: __dxlog_file17,
|
|
4672
|
-
L:
|
|
4685
|
+
L: 221,
|
|
4673
4686
|
S: this,
|
|
4674
4687
|
A: [
|
|
4675
4688
|
"!this._networkManager",
|
|
@@ -4683,7 +4696,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4683
4696
|
});
|
|
4684
4697
|
(0, import_log16.log)("initialized", void 0, {
|
|
4685
4698
|
F: __dxlog_file17,
|
|
4686
|
-
L:
|
|
4699
|
+
L: 228,
|
|
4687
4700
|
S: this,
|
|
4688
4701
|
C: (f, a) => f(...a)
|
|
4689
4702
|
});
|
|
@@ -4697,13 +4710,13 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4697
4710
|
id: traceId
|
|
4698
4711
|
}), {
|
|
4699
4712
|
F: __dxlog_file17,
|
|
4700
|
-
L:
|
|
4713
|
+
L: 239,
|
|
4701
4714
|
S: this,
|
|
4702
4715
|
C: (f, a) => f(...a)
|
|
4703
4716
|
});
|
|
4704
4717
|
(0, import_invariant15.invariant)(this._config, "config not set", {
|
|
4705
4718
|
F: __dxlog_file17,
|
|
4706
|
-
L:
|
|
4719
|
+
L: 241,
|
|
4707
4720
|
S: this,
|
|
4708
4721
|
A: [
|
|
4709
4722
|
"this._config",
|
|
@@ -4712,7 +4725,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4712
4725
|
});
|
|
4713
4726
|
(0, import_invariant15.invariant)(this._storage, "storage not set", {
|
|
4714
4727
|
F: __dxlog_file17,
|
|
4715
|
-
L:
|
|
4728
|
+
L: 242,
|
|
4716
4729
|
S: this,
|
|
4717
4730
|
A: [
|
|
4718
4731
|
"this._storage",
|
|
@@ -4721,7 +4734,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4721
4734
|
});
|
|
4722
4735
|
(0, import_invariant15.invariant)(this._signalManager, "signal manager not set", {
|
|
4723
4736
|
F: __dxlog_file17,
|
|
4724
|
-
L:
|
|
4737
|
+
L: 243,
|
|
4725
4738
|
S: this,
|
|
4726
4739
|
A: [
|
|
4727
4740
|
"this._signalManager",
|
|
@@ -4730,7 +4743,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4730
4743
|
});
|
|
4731
4744
|
(0, import_invariant15.invariant)(this._networkManager, "network manager not set", {
|
|
4732
4745
|
F: __dxlog_file17,
|
|
4733
|
-
L:
|
|
4746
|
+
L: 244,
|
|
4734
4747
|
S: this,
|
|
4735
4748
|
A: [
|
|
4736
4749
|
"this._networkManager",
|
|
@@ -4742,7 +4755,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4742
4755
|
lockKey: this._resourceLock?.lockKey
|
|
4743
4756
|
}, {
|
|
4744
4757
|
F: __dxlog_file17,
|
|
4745
|
-
L:
|
|
4758
|
+
L: 247,
|
|
4746
4759
|
S: this,
|
|
4747
4760
|
C: (f, a) => f(...a)
|
|
4748
4761
|
});
|
|
@@ -4751,7 +4764,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4751
4764
|
this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory);
|
|
4752
4765
|
this._serviceRegistry.setServices({
|
|
4753
4766
|
SystemService: this._systemService,
|
|
4754
|
-
IdentityService: new IdentityServiceImpl((params) => this.
|
|
4767
|
+
IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring),
|
|
4755
4768
|
InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitations, (invitation) => this._serviceContext.getInvitationHandler(invitation)),
|
|
4756
4769
|
DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
|
|
4757
4770
|
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, this._serviceContext.dataServiceSubscriptions, async () => {
|
|
@@ -4788,7 +4801,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4788
4801
|
deviceKey
|
|
4789
4802
|
}, {
|
|
4790
4803
|
F: __dxlog_file17,
|
|
4791
|
-
L:
|
|
4804
|
+
L: 316,
|
|
4792
4805
|
S: this,
|
|
4793
4806
|
C: (f, a) => f(...a)
|
|
4794
4807
|
});
|
|
@@ -4796,7 +4809,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4796
4809
|
id: traceId
|
|
4797
4810
|
}), {
|
|
4798
4811
|
F: __dxlog_file17,
|
|
4799
|
-
L:
|
|
4812
|
+
L: 317,
|
|
4800
4813
|
S: this,
|
|
4801
4814
|
C: (f, a) => f(...a)
|
|
4802
4815
|
});
|
|
@@ -4810,7 +4823,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4810
4823
|
deviceKey
|
|
4811
4824
|
}, {
|
|
4812
4825
|
F: __dxlog_file17,
|
|
4813
|
-
L:
|
|
4826
|
+
L: 328,
|
|
4814
4827
|
S: this,
|
|
4815
4828
|
C: (f, a) => f(...a)
|
|
4816
4829
|
});
|
|
@@ -4826,7 +4839,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4826
4839
|
deviceKey
|
|
4827
4840
|
}, {
|
|
4828
4841
|
F: __dxlog_file17,
|
|
4829
|
-
L:
|
|
4842
|
+
L: 335,
|
|
4830
4843
|
S: this,
|
|
4831
4844
|
C: (f, a) => f(...a)
|
|
4832
4845
|
});
|
|
@@ -4837,13 +4850,13 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4837
4850
|
id: traceId
|
|
4838
4851
|
}), {
|
|
4839
4852
|
F: __dxlog_file17,
|
|
4840
|
-
L:
|
|
4853
|
+
L: 340,
|
|
4841
4854
|
S: this,
|
|
4842
4855
|
C: (f, a) => f(...a)
|
|
4843
4856
|
});
|
|
4844
4857
|
(0, import_log16.log)("resetting...", void 0, {
|
|
4845
4858
|
F: __dxlog_file17,
|
|
4846
|
-
L:
|
|
4859
|
+
L: 342,
|
|
4847
4860
|
S: this,
|
|
4848
4861
|
C: (f, a) => f(...a)
|
|
4849
4862
|
});
|
|
@@ -4851,7 +4864,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4851
4864
|
await this._storage.reset();
|
|
4852
4865
|
(0, import_log16.log)("reset", void 0, {
|
|
4853
4866
|
F: __dxlog_file17,
|
|
4854
|
-
L:
|
|
4867
|
+
L: 345,
|
|
4855
4868
|
S: this,
|
|
4856
4869
|
C: (f, a) => f(...a)
|
|
4857
4870
|
});
|
|
@@ -4859,12 +4872,31 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4859
4872
|
id: traceId
|
|
4860
4873
|
}), {
|
|
4861
4874
|
F: __dxlog_file17,
|
|
4862
|
-
L:
|
|
4875
|
+
L: 346,
|
|
4863
4876
|
S: this,
|
|
4864
4877
|
C: (f, a) => f(...a)
|
|
4865
4878
|
});
|
|
4866
4879
|
await this._callbacks?.onReset?.();
|
|
4867
4880
|
}
|
|
4881
|
+
async _createIdentity(params) {
|
|
4882
|
+
const identity = await this._serviceContext.createIdentity(params);
|
|
4883
|
+
await this._serviceContext.initialized.wait();
|
|
4884
|
+
const space = await this._serviceContext.dataSpaceManager.createSpace();
|
|
4885
|
+
const obj = new import_client_protocol5.Properties();
|
|
4886
|
+
obj[import_client_protocol5.defaultKey] = identity.identityKey.toHex();
|
|
4887
|
+
await this._serviceRegistry.services.DataService.write({
|
|
4888
|
+
spaceKey: space.key,
|
|
4889
|
+
batch: {
|
|
4890
|
+
objects: [
|
|
4891
|
+
createGenesisMutationFromTypedObject(obj)
|
|
4892
|
+
]
|
|
4893
|
+
}
|
|
4894
|
+
});
|
|
4895
|
+
await this._serviceRegistry.services.DataService.flush({
|
|
4896
|
+
spaceKey: space.key
|
|
4897
|
+
});
|
|
4898
|
+
return identity;
|
|
4899
|
+
}
|
|
4868
4900
|
};
|
|
4869
4901
|
_ts_decorate7([
|
|
4870
4902
|
import_tracing5.trace.info()
|
|
@@ -5125,7 +5157,7 @@ var TestBuilder = class {
|
|
|
5125
5157
|
};
|
|
5126
5158
|
var TestPeer = class {
|
|
5127
5159
|
constructor(signalContext, opts = {
|
|
5128
|
-
|
|
5160
|
+
dataStore: import_random_access_storage2.StorageType.RAM
|
|
5129
5161
|
}) {
|
|
5130
5162
|
this.signalContext = signalContext;
|
|
5131
5163
|
this.opts = opts;
|
|
@@ -5136,7 +5168,7 @@ var TestPeer = class {
|
|
|
5136
5168
|
}
|
|
5137
5169
|
get storage() {
|
|
5138
5170
|
return this._props.storage ??= (0, import_random_access_storage2.createStorage)({
|
|
5139
|
-
type: this.opts.
|
|
5171
|
+
type: this.opts.dataStore
|
|
5140
5172
|
});
|
|
5141
5173
|
}
|
|
5142
5174
|
get keyring() {
|