@dxos/client-services 0.1.58-main.09c7b08 → 0.1.58-main.0b23736
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-UW5A22QT.mjs → chunk-CNGEFIDZ.mjs} +30 -62
- package/dist/lib/browser/{chunk-UW5A22QT.mjs.map → chunk-CNGEFIDZ.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 +28 -60
- 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 +30 -62
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/services/service-host.d.ts +0 -1
- 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 +34 -35
- package/src/packlets/services/service-host.test.ts +3 -3
- package/src/packlets/services/service-host.ts +3 -39
- 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
|
@@ -2498,7 +2498,7 @@ var getPlatform = () => {
|
|
|
2498
2498
|
};
|
|
2499
2499
|
|
|
2500
2500
|
// packages/sdk/client-services/src/version.ts
|
|
2501
|
-
var DXOS_VERSION = "0.1.58-main.
|
|
2501
|
+
var DXOS_VERSION = "0.1.58-main.0b23736";
|
|
2502
2502
|
|
|
2503
2503
|
// packages/sdk/client-services/src/packlets/services/diagnostics.ts
|
|
2504
2504
|
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
|
|
@@ -4315,23 +4315,23 @@ import { createStorage, StorageType } from "@dxos/random-access-storage";
|
|
|
4315
4315
|
import { isNode } from "@dxos/util";
|
|
4316
4316
|
var StorageDriver = Runtime.Client.Storage.StorageDriver;
|
|
4317
4317
|
var createStorageObjects = (config) => {
|
|
4318
|
-
const {
|
|
4319
|
-
if (persistent &&
|
|
4318
|
+
const { path = isNode() ? DX_DATA : "dxos/storage", storageType, keyStorage, persistent = false } = config ?? {};
|
|
4319
|
+
if (persistent && storageType === StorageDriver.RAM) {
|
|
4320
4320
|
throw new InvalidConfigError("RAM storage cannot be used in persistent mode.");
|
|
4321
4321
|
}
|
|
4322
|
-
if (!persistent &&
|
|
4322
|
+
if (!persistent && storageType !== void 0 && storageType !== StorageDriver.RAM) {
|
|
4323
4323
|
throw new InvalidConfigError("Cannot use a persistent storage in not persistent mode.");
|
|
4324
4324
|
}
|
|
4325
|
-
if (persistent &&
|
|
4325
|
+
if (persistent && keyStorage === StorageDriver.RAM) {
|
|
4326
4326
|
throw new InvalidConfigError("RAM key storage cannot be used in persistent mode.");
|
|
4327
4327
|
}
|
|
4328
|
-
if (!persistent &&
|
|
4328
|
+
if (!persistent && keyStorage !== StorageDriver.RAM && keyStorage !== void 0) {
|
|
4329
4329
|
throw new InvalidConfigError("Cannot use a persistent key storage in not persistent mode.");
|
|
4330
4330
|
}
|
|
4331
4331
|
return {
|
|
4332
4332
|
storage: createStorage({
|
|
4333
|
-
type: persistent ? toStorageType(
|
|
4334
|
-
root: `${
|
|
4333
|
+
type: persistent ? toStorageType(storageType) : StorageType.RAM,
|
|
4334
|
+
root: `${path}/`
|
|
4335
4335
|
})
|
|
4336
4336
|
};
|
|
4337
4337
|
};
|
|
@@ -4358,11 +4358,10 @@ var toStorageType = (type) => {
|
|
|
4358
4358
|
|
|
4359
4359
|
// packages/sdk/client-services/src/packlets/services/service-host.ts
|
|
4360
4360
|
import { Event as Event8, synchronized as synchronized3 } from "@dxos/async";
|
|
4361
|
-
import { clientServiceBundle
|
|
4361
|
+
import { clientServiceBundle } from "@dxos/client-protocol";
|
|
4362
4362
|
import { Context as Context10 } from "@dxos/context";
|
|
4363
4363
|
import { DocumentModel as DocumentModel2 } from "@dxos/document-model";
|
|
4364
4364
|
import { DataServiceImpl } from "@dxos/echo-pipeline";
|
|
4365
|
-
import { base } from "@dxos/echo-schema";
|
|
4366
4365
|
import { invariant as invariant14 } from "@dxos/invariant";
|
|
4367
4366
|
import { PublicKey as PublicKey10 } from "@dxos/keys";
|
|
4368
4367
|
import { log as log16 } from "@dxos/log";
|
|
@@ -4636,18 +4635,6 @@ var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
|
|
|
4636
4635
|
var createDefaultModelFactory = () => {
|
|
4637
4636
|
return new ModelFactory().registerModel(DocumentModel2).registerModel(TextModel);
|
|
4638
4637
|
};
|
|
4639
|
-
var createGenesisMutationFromTypedObject = (obj) => {
|
|
4640
|
-
const snapshot = obj[base]._createSnapshot();
|
|
4641
|
-
return {
|
|
4642
|
-
objectId: obj[base]._id,
|
|
4643
|
-
genesis: {
|
|
4644
|
-
modelType: obj[base]._modelConstructor.meta.type
|
|
4645
|
-
},
|
|
4646
|
-
snapshot: {
|
|
4647
|
-
model: snapshot
|
|
4648
|
-
}
|
|
4649
|
-
};
|
|
4650
|
-
};
|
|
4651
4638
|
var ClientServicesHost = class ClientServicesHost2 {
|
|
4652
4639
|
constructor({
|
|
4653
4640
|
config,
|
|
@@ -4734,7 +4721,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4734
4721
|
initialize({ config, ...options }) {
|
|
4735
4722
|
invariant14(!this._open, "service host is open", {
|
|
4736
4723
|
F: __dxlog_file17,
|
|
4737
|
-
L:
|
|
4724
|
+
L: 184,
|
|
4738
4725
|
S: this,
|
|
4739
4726
|
A: [
|
|
4740
4727
|
"!this._open",
|
|
@@ -4743,14 +4730,14 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4743
4730
|
});
|
|
4744
4731
|
log16("initializing...", void 0, {
|
|
4745
4732
|
F: __dxlog_file17,
|
|
4746
|
-
L:
|
|
4733
|
+
L: 185,
|
|
4747
4734
|
S: this,
|
|
4748
4735
|
C: (f, a) => f(...a)
|
|
4749
4736
|
});
|
|
4750
4737
|
if (config) {
|
|
4751
4738
|
invariant14(!this._config, "config already set", {
|
|
4752
4739
|
F: __dxlog_file17,
|
|
4753
|
-
L:
|
|
4740
|
+
L: 188,
|
|
4754
4741
|
S: this,
|
|
4755
4742
|
A: [
|
|
4756
4743
|
"!this._config",
|
|
@@ -4768,7 +4755,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4768
4755
|
this._signalManager = signalManager;
|
|
4769
4756
|
invariant14(!this._networkManager, "network manager already set", {
|
|
4770
4757
|
F: __dxlog_file17,
|
|
4771
|
-
L:
|
|
4758
|
+
L: 204,
|
|
4772
4759
|
S: this,
|
|
4773
4760
|
A: [
|
|
4774
4761
|
"!this._networkManager",
|
|
@@ -4782,7 +4769,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4782
4769
|
});
|
|
4783
4770
|
log16("initialized", void 0, {
|
|
4784
4771
|
F: __dxlog_file17,
|
|
4785
|
-
L:
|
|
4772
|
+
L: 211,
|
|
4786
4773
|
S: this,
|
|
4787
4774
|
C: (f, a) => f(...a)
|
|
4788
4775
|
});
|
|
@@ -4796,13 +4783,13 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4796
4783
|
id: traceId
|
|
4797
4784
|
}), {
|
|
4798
4785
|
F: __dxlog_file17,
|
|
4799
|
-
L:
|
|
4786
|
+
L: 222,
|
|
4800
4787
|
S: this,
|
|
4801
4788
|
C: (f, a) => f(...a)
|
|
4802
4789
|
});
|
|
4803
4790
|
invariant14(this._config, "config not set", {
|
|
4804
4791
|
F: __dxlog_file17,
|
|
4805
|
-
L:
|
|
4792
|
+
L: 224,
|
|
4806
4793
|
S: this,
|
|
4807
4794
|
A: [
|
|
4808
4795
|
"this._config",
|
|
@@ -4811,7 +4798,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4811
4798
|
});
|
|
4812
4799
|
invariant14(this._storage, "storage not set", {
|
|
4813
4800
|
F: __dxlog_file17,
|
|
4814
|
-
L:
|
|
4801
|
+
L: 225,
|
|
4815
4802
|
S: this,
|
|
4816
4803
|
A: [
|
|
4817
4804
|
"this._storage",
|
|
@@ -4820,7 +4807,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4820
4807
|
});
|
|
4821
4808
|
invariant14(this._signalManager, "signal manager not set", {
|
|
4822
4809
|
F: __dxlog_file17,
|
|
4823
|
-
L:
|
|
4810
|
+
L: 226,
|
|
4824
4811
|
S: this,
|
|
4825
4812
|
A: [
|
|
4826
4813
|
"this._signalManager",
|
|
@@ -4829,7 +4816,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4829
4816
|
});
|
|
4830
4817
|
invariant14(this._networkManager, "network manager not set", {
|
|
4831
4818
|
F: __dxlog_file17,
|
|
4832
|
-
L:
|
|
4819
|
+
L: 227,
|
|
4833
4820
|
S: this,
|
|
4834
4821
|
A: [
|
|
4835
4822
|
"this._networkManager",
|
|
@@ -4841,7 +4828,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4841
4828
|
lockKey: this._resourceLock?.lockKey
|
|
4842
4829
|
}, {
|
|
4843
4830
|
F: __dxlog_file17,
|
|
4844
|
-
L:
|
|
4831
|
+
L: 230,
|
|
4845
4832
|
S: this,
|
|
4846
4833
|
C: (f, a) => f(...a)
|
|
4847
4834
|
});
|
|
@@ -4850,7 +4837,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4850
4837
|
this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory);
|
|
4851
4838
|
this._serviceRegistry.setServices({
|
|
4852
4839
|
SystemService: this._systemService,
|
|
4853
|
-
IdentityService: new IdentityServiceImpl((params) => this.
|
|
4840
|
+
IdentityService: new IdentityServiceImpl((params) => this._serviceContext.createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring),
|
|
4854
4841
|
InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitations, (invitation) => this._serviceContext.getInvitationHandler(invitation)),
|
|
4855
4842
|
DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
|
|
4856
4843
|
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, this._serviceContext.dataServiceSubscriptions, async () => {
|
|
@@ -4887,7 +4874,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4887
4874
|
deviceKey
|
|
4888
4875
|
}, {
|
|
4889
4876
|
F: __dxlog_file17,
|
|
4890
|
-
L:
|
|
4877
|
+
L: 299,
|
|
4891
4878
|
S: this,
|
|
4892
4879
|
C: (f, a) => f(...a)
|
|
4893
4880
|
});
|
|
@@ -4895,7 +4882,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4895
4882
|
id: traceId
|
|
4896
4883
|
}), {
|
|
4897
4884
|
F: __dxlog_file17,
|
|
4898
|
-
L:
|
|
4885
|
+
L: 300,
|
|
4899
4886
|
S: this,
|
|
4900
4887
|
C: (f, a) => f(...a)
|
|
4901
4888
|
});
|
|
@@ -4909,7 +4896,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4909
4896
|
deviceKey
|
|
4910
4897
|
}, {
|
|
4911
4898
|
F: __dxlog_file17,
|
|
4912
|
-
L:
|
|
4899
|
+
L: 311,
|
|
4913
4900
|
S: this,
|
|
4914
4901
|
C: (f, a) => f(...a)
|
|
4915
4902
|
});
|
|
@@ -4925,7 +4912,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4925
4912
|
deviceKey
|
|
4926
4913
|
}, {
|
|
4927
4914
|
F: __dxlog_file17,
|
|
4928
|
-
L:
|
|
4915
|
+
L: 318,
|
|
4929
4916
|
S: this,
|
|
4930
4917
|
C: (f, a) => f(...a)
|
|
4931
4918
|
});
|
|
@@ -4936,13 +4923,13 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4936
4923
|
id: traceId
|
|
4937
4924
|
}), {
|
|
4938
4925
|
F: __dxlog_file17,
|
|
4939
|
-
L:
|
|
4926
|
+
L: 323,
|
|
4940
4927
|
S: this,
|
|
4941
4928
|
C: (f, a) => f(...a)
|
|
4942
4929
|
});
|
|
4943
4930
|
log16("resetting...", void 0, {
|
|
4944
4931
|
F: __dxlog_file17,
|
|
4945
|
-
L:
|
|
4932
|
+
L: 325,
|
|
4946
4933
|
S: this,
|
|
4947
4934
|
C: (f, a) => f(...a)
|
|
4948
4935
|
});
|
|
@@ -4950,7 +4937,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4950
4937
|
await this._storage.reset();
|
|
4951
4938
|
log16("reset", void 0, {
|
|
4952
4939
|
F: __dxlog_file17,
|
|
4953
|
-
L:
|
|
4940
|
+
L: 328,
|
|
4954
4941
|
S: this,
|
|
4955
4942
|
C: (f, a) => f(...a)
|
|
4956
4943
|
});
|
|
@@ -4958,31 +4945,12 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4958
4945
|
id: traceId
|
|
4959
4946
|
}), {
|
|
4960
4947
|
F: __dxlog_file17,
|
|
4961
|
-
L:
|
|
4948
|
+
L: 329,
|
|
4962
4949
|
S: this,
|
|
4963
4950
|
C: (f, a) => f(...a)
|
|
4964
4951
|
});
|
|
4965
4952
|
await this._callbacks?.onReset?.();
|
|
4966
4953
|
}
|
|
4967
|
-
async _createIdentity(params) {
|
|
4968
|
-
const identity = await this._serviceContext.createIdentity(params);
|
|
4969
|
-
await this._serviceContext.initialized.wait();
|
|
4970
|
-
const space = await this._serviceContext.dataSpaceManager.createSpace();
|
|
4971
|
-
const obj = new Properties();
|
|
4972
|
-
obj[defaultKey] = identity.identityKey.toHex();
|
|
4973
|
-
await this._serviceRegistry.services.DataService.write({
|
|
4974
|
-
spaceKey: space.key,
|
|
4975
|
-
batch: {
|
|
4976
|
-
objects: [
|
|
4977
|
-
createGenesisMutationFromTypedObject(obj)
|
|
4978
|
-
]
|
|
4979
|
-
}
|
|
4980
|
-
});
|
|
4981
|
-
await this._serviceRegistry.services.DataService.flush({
|
|
4982
|
-
spaceKey: space.key
|
|
4983
|
-
});
|
|
4984
|
-
return identity;
|
|
4985
|
-
}
|
|
4986
4954
|
};
|
|
4987
4955
|
_ts_decorate7([
|
|
4988
4956
|
Trace3.info()
|
|
@@ -5035,4 +5003,4 @@ export {
|
|
|
5035
5003
|
createDefaultModelFactory,
|
|
5036
5004
|
ClientServicesHost
|
|
5037
5005
|
};
|
|
5038
|
-
//# sourceMappingURL=chunk-
|
|
5006
|
+
//# sourceMappingURL=chunk-CNGEFIDZ.mjs.map
|