@dxos/client-services 0.1.58-main.88259d8 → 0.1.58-main.9626f9e
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-EHKBX7QL.mjs → chunk-WQTWAJOX.mjs} +82 -36
- package/dist/lib/browser/chunk-WQTWAJOX.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 +87 -41
- 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 +85 -39
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +35 -35
- package/src/packlets/identity/authenticator.ts +1 -1
- package/src/packlets/spaces/data-space.ts +7 -1
- package/src/packlets/spaces/spaces-service.ts +27 -5
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-EHKBX7QL.mjs.map +0 -7
|
@@ -2473,7 +2473,7 @@ import { STORAGE_VERSION } from "@dxos/protocols";
|
|
|
2473
2473
|
import { SpaceMember } from "@dxos/protocols/proto/dxos/client/services";
|
|
2474
2474
|
|
|
2475
2475
|
// packages/sdk/client-services/src/version.ts
|
|
2476
|
-
var DXOS_VERSION = "0.1.58-main.
|
|
2476
|
+
var DXOS_VERSION = "0.1.58-main.9626f9e";
|
|
2477
2477
|
|
|
2478
2478
|
// packages/sdk/client-services/src/packlets/services/platform.ts
|
|
2479
2479
|
var getPlatform = () => {
|
|
@@ -2938,7 +2938,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2938
2938
|
this._signingContext = params.signingContext;
|
|
2939
2939
|
this._callbacks = params.callbacks ?? {};
|
|
2940
2940
|
this.authVerifier = new TrustedKeySetAuthVerifier({
|
|
2941
|
-
trustedKeysProvider: () => new ComplexSet2(PublicKey7.hash, Array.from(this._inner.spaceState.members.
|
|
2941
|
+
trustedKeysProvider: () => new ComplexSet2(PublicKey7.hash, Array.from(this._inner.spaceState.members.values()).filter((member) => !member.removed).map((member) => member.key)),
|
|
2942
2942
|
update: this._inner.stateUpdate,
|
|
2943
2943
|
authTimeout: AUTH_TIMEOUT2
|
|
2944
2944
|
});
|
|
@@ -2948,7 +2948,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2948
2948
|
state: SpaceState[this._state]
|
|
2949
2949
|
}, {
|
|
2950
2950
|
F: __dxlog_file12,
|
|
2951
|
-
L:
|
|
2951
|
+
L: 118,
|
|
2952
2952
|
S: this,
|
|
2953
2953
|
C: (f, a) => f(...a)
|
|
2954
2954
|
});
|
|
@@ -2991,7 +2991,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2991
2991
|
state: SpaceState[this._state]
|
|
2992
2992
|
}, {
|
|
2993
2993
|
F: __dxlog_file12,
|
|
2994
|
-
L:
|
|
2994
|
+
L: 165,
|
|
2995
2995
|
S: this,
|
|
2996
2996
|
C: (f, a) => f(...a)
|
|
2997
2997
|
});
|
|
@@ -3009,7 +3009,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3009
3009
|
state: SpaceState[this._state]
|
|
3010
3010
|
}, {
|
|
3011
3011
|
F: __dxlog_file12,
|
|
3012
|
-
L:
|
|
3012
|
+
L: 179,
|
|
3013
3013
|
S: this,
|
|
3014
3014
|
C: (f, a) => f(...a)
|
|
3015
3015
|
});
|
|
@@ -3040,7 +3040,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3040
3040
|
if (err instanceof CancelledError) {
|
|
3041
3041
|
log10("data pipeline initialization cancelled", err, {
|
|
3042
3042
|
F: __dxlog_file12,
|
|
3043
|
-
L:
|
|
3043
|
+
L: 211,
|
|
3044
3044
|
S: this,
|
|
3045
3045
|
C: (f, a) => f(...a)
|
|
3046
3046
|
});
|
|
@@ -3048,7 +3048,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3048
3048
|
}
|
|
3049
3049
|
log10.error("Error initializing data pipeline", err, {
|
|
3050
3050
|
F: __dxlog_file12,
|
|
3051
|
-
L:
|
|
3051
|
+
L: 215,
|
|
3052
3052
|
S: this,
|
|
3053
3053
|
C: (f, a) => f(...a)
|
|
3054
3054
|
});
|
|
@@ -3057,7 +3057,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3057
3057
|
state: SpaceState[this._state]
|
|
3058
3058
|
}, {
|
|
3059
3059
|
F: __dxlog_file12,
|
|
3060
|
-
L:
|
|
3060
|
+
L: 217,
|
|
3061
3061
|
S: this,
|
|
3062
3062
|
C: (f, a) => f(...a)
|
|
3063
3063
|
});
|
|
@@ -3077,7 +3077,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3077
3077
|
state: SpaceState[this._state]
|
|
3078
3078
|
}, {
|
|
3079
3079
|
F: __dxlog_file12,
|
|
3080
|
-
L:
|
|
3080
|
+
L: 233,
|
|
3081
3081
|
S: this,
|
|
3082
3082
|
C: (f, a) => f(...a)
|
|
3083
3083
|
});
|
|
@@ -3088,7 +3088,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3088
3088
|
await cancelWithContext2(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
|
|
3089
3089
|
log10("waiting for data pipeline to reach target timeframe", void 0, {
|
|
3090
3090
|
F: __dxlog_file12,
|
|
3091
|
-
L:
|
|
3091
|
+
L: 247,
|
|
3092
3092
|
S: this,
|
|
3093
3093
|
C: (f, a) => f(...a)
|
|
3094
3094
|
});
|
|
@@ -3099,7 +3099,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3099
3099
|
this.metrics.dataPipelineReady = /* @__PURE__ */ new Date();
|
|
3100
3100
|
log10("data pipeline ready", void 0, {
|
|
3101
3101
|
F: __dxlog_file12,
|
|
3102
|
-
L:
|
|
3102
|
+
L: 256,
|
|
3103
3103
|
S: this,
|
|
3104
3104
|
C: (f, a) => f(...a)
|
|
3105
3105
|
});
|
|
@@ -3109,7 +3109,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3109
3109
|
state: SpaceState[this._state]
|
|
3110
3110
|
}, {
|
|
3111
3111
|
F: __dxlog_file12,
|
|
3112
|
-
L:
|
|
3112
|
+
L: 260,
|
|
3113
3113
|
S: this,
|
|
3114
3114
|
C: (f, a) => f(...a)
|
|
3115
3115
|
});
|
|
@@ -3125,7 +3125,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3125
3125
|
await this._createWritableFeeds();
|
|
3126
3126
|
log10("writable feeds created", void 0, {
|
|
3127
3127
|
F: __dxlog_file12,
|
|
3128
|
-
L:
|
|
3128
|
+
L: 276,
|
|
3129
3129
|
S: this,
|
|
3130
3130
|
C: (f, a) => f(...a)
|
|
3131
3131
|
});
|
|
@@ -3230,7 +3230,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3230
3230
|
state: SpaceState[this._state]
|
|
3231
3231
|
}, {
|
|
3232
3232
|
F: __dxlog_file12,
|
|
3233
|
-
L:
|
|
3233
|
+
L: 392,
|
|
3234
3234
|
S: this,
|
|
3235
3235
|
C: (f, a) => f(...a)
|
|
3236
3236
|
});
|
|
@@ -3686,6 +3686,7 @@ import { Stream as Stream10 } from "@dxos/codec-protobuf";
|
|
|
3686
3686
|
import { raise as raise2 } from "@dxos/debug";
|
|
3687
3687
|
import { SpaceNotFoundError } from "@dxos/echo-pipeline";
|
|
3688
3688
|
import { ApiError } from "@dxos/errors";
|
|
3689
|
+
import { invariant as invariant12 } from "@dxos/invariant";
|
|
3689
3690
|
import { log as log12 } from "@dxos/log";
|
|
3690
3691
|
import { encodeError } from "@dxos/protocols";
|
|
3691
3692
|
import { SpaceMember as SpaceMember3, SpaceState as SpaceState3 } from "@dxos/protocols/proto/dxos/client/services";
|
|
@@ -3730,7 +3731,7 @@ var SpacesServiceImpl = class {
|
|
|
3730
3731
|
spaces
|
|
3731
3732
|
}, {
|
|
3732
3733
|
F: __dxlog_file14,
|
|
3733
|
-
L:
|
|
3734
|
+
L: 79,
|
|
3734
3735
|
S: this,
|
|
3735
3736
|
C: (f, a) => f(...a)
|
|
3736
3737
|
});
|
|
@@ -3787,8 +3788,8 @@ var SpacesServiceImpl = class {
|
|
|
3787
3788
|
});
|
|
3788
3789
|
});
|
|
3789
3790
|
}
|
|
3790
|
-
queryCredentials({ spaceKey }) {
|
|
3791
|
-
return new Stream10(({ ctx, next }) => {
|
|
3791
|
+
queryCredentials({ spaceKey, noTail }) {
|
|
3792
|
+
return new Stream10(({ ctx, next, close }) => {
|
|
3792
3793
|
const space = this._spaceManager.spaces.get(spaceKey) ?? raise2(new SpaceNotFoundError(spaceKey));
|
|
3793
3794
|
const processor = {
|
|
3794
3795
|
processCredential: async (credential) => {
|
|
@@ -3796,17 +3797,62 @@ var SpacesServiceImpl = class {
|
|
|
3796
3797
|
}
|
|
3797
3798
|
};
|
|
3798
3799
|
ctx.onDispose(() => space.spaceState.removeCredentialProcessor(processor));
|
|
3799
|
-
scheduleTask5(ctx, () =>
|
|
3800
|
+
scheduleTask5(ctx, async () => {
|
|
3801
|
+
await space.spaceState.addCredentialProcessor(processor);
|
|
3802
|
+
if (noTail) {
|
|
3803
|
+
close();
|
|
3804
|
+
}
|
|
3805
|
+
});
|
|
3800
3806
|
});
|
|
3801
3807
|
}
|
|
3802
3808
|
async writeCredentials({ spaceKey, credentials }) {
|
|
3803
3809
|
const space = this._spaceManager.spaces.get(spaceKey) ?? raise2(new SpaceNotFoundError(spaceKey));
|
|
3804
3810
|
for (const credential of credentials ?? []) {
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
credential
|
|
3808
|
-
|
|
3809
|
-
|
|
3811
|
+
if (credential.proof) {
|
|
3812
|
+
await space.controlPipeline.writer.write({
|
|
3813
|
+
credential: {
|
|
3814
|
+
credential
|
|
3815
|
+
}
|
|
3816
|
+
});
|
|
3817
|
+
} else {
|
|
3818
|
+
invariant12(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
3819
|
+
F: __dxlog_file14,
|
|
3820
|
+
L: 169,
|
|
3821
|
+
S: this,
|
|
3822
|
+
A: [
|
|
3823
|
+
"!credential.id",
|
|
3824
|
+
"'Id on unsigned credentials is not allowed'"
|
|
3825
|
+
]
|
|
3826
|
+
});
|
|
3827
|
+
invariant12(this._identityManager.identity, "Identity is not available", {
|
|
3828
|
+
F: __dxlog_file14,
|
|
3829
|
+
L: 170,
|
|
3830
|
+
S: this,
|
|
3831
|
+
A: [
|
|
3832
|
+
"this._identityManager.identity",
|
|
3833
|
+
"'Identity is not available'"
|
|
3834
|
+
]
|
|
3835
|
+
});
|
|
3836
|
+
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
3837
|
+
invariant12(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
3838
|
+
F: __dxlog_file14,
|
|
3839
|
+
L: 172,
|
|
3840
|
+
S: this,
|
|
3841
|
+
A: [
|
|
3842
|
+
"credential.issuer.equals(signer.getIssuer())",
|
|
3843
|
+
""
|
|
3844
|
+
]
|
|
3845
|
+
});
|
|
3846
|
+
const signedCredential = await signer.createCredential({
|
|
3847
|
+
subject: credential.subject.id,
|
|
3848
|
+
assertion: credential.subject.assertion
|
|
3849
|
+
});
|
|
3850
|
+
await space.controlPipeline.writer.write({
|
|
3851
|
+
credential: {
|
|
3852
|
+
credential: signedCredential
|
|
3853
|
+
}
|
|
3854
|
+
});
|
|
3855
|
+
}
|
|
3810
3856
|
}
|
|
3811
3857
|
}
|
|
3812
3858
|
async createEpoch({ spaceKey }) {
|
|
@@ -3845,7 +3891,7 @@ var SpacesServiceImpl = class {
|
|
|
3845
3891
|
displayName: member.assertion.profile?.displayName
|
|
3846
3892
|
}
|
|
3847
3893
|
},
|
|
3848
|
-
presence: isMe || peers.length > 0 ? SpaceMember3.PresenceState.ONLINE : SpaceMember3.PresenceState.OFFLINE,
|
|
3894
|
+
presence: member.removed ? SpaceMember3.PresenceState.REMOVED : isMe || peers.length > 0 ? SpaceMember3.PresenceState.ONLINE : SpaceMember3.PresenceState.OFFLINE,
|
|
3849
3895
|
peerStates: peers
|
|
3850
3896
|
};
|
|
3851
3897
|
}),
|
|
@@ -3864,7 +3910,7 @@ import { getCredentialAssertion as getCredentialAssertion3 } from "@dxos/credent
|
|
|
3864
3910
|
import { failUndefined as failUndefined3 } from "@dxos/debug";
|
|
3865
3911
|
import { valueEncoding, MetadataStore, SpaceManager, DataServiceSubscriptions, SnapshotStore } from "@dxos/echo-pipeline";
|
|
3866
3912
|
import { FeedFactory, FeedStore } from "@dxos/feed-store";
|
|
3867
|
-
import { invariant as
|
|
3913
|
+
import { invariant as invariant13 } from "@dxos/invariant";
|
|
3868
3914
|
import { Keyring } from "@dxos/keyring";
|
|
3869
3915
|
import { PublicKey as PublicKey9 } from "@dxos/keys";
|
|
3870
3916
|
import { log as log13 } from "@dxos/log";
|
|
@@ -3992,7 +4038,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
3992
4038
|
}
|
|
3993
4039
|
getInvitationHandler(invitation) {
|
|
3994
4040
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
3995
|
-
|
|
4041
|
+
invariant13(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
3996
4042
|
F: __dxlog_file15,
|
|
3997
4043
|
L: 174,
|
|
3998
4044
|
S: this,
|
|
@@ -4039,7 +4085,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4039
4085
|
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore);
|
|
4040
4086
|
await this.dataSpaceManager.open();
|
|
4041
4087
|
this._handlerFactories.set(Invitation6.Kind.SPACE, (invitation) => {
|
|
4042
|
-
|
|
4088
|
+
invariant13(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
4043
4089
|
F: __dxlog_file15,
|
|
4044
4090
|
L: 218,
|
|
4045
4091
|
S: this,
|
|
@@ -4322,7 +4368,7 @@ import { clientServiceBundle } from "@dxos/client-protocol";
|
|
|
4322
4368
|
import { Context as Context10 } from "@dxos/context";
|
|
4323
4369
|
import { DocumentModel as DocumentModel2 } from "@dxos/document-model";
|
|
4324
4370
|
import { DataServiceImpl } from "@dxos/echo-pipeline";
|
|
4325
|
-
import { invariant as
|
|
4371
|
+
import { invariant as invariant14 } from "@dxos/invariant";
|
|
4326
4372
|
import { PublicKey as PublicKey10 } from "@dxos/keys";
|
|
4327
4373
|
import { log as log16 } from "@dxos/log";
|
|
4328
4374
|
import { WebsocketSignalManager } from "@dxos/messaging";
|
|
@@ -4679,7 +4725,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4679
4725
|
* Can only be called once.
|
|
4680
4726
|
*/
|
|
4681
4727
|
initialize({ config, ...options }) {
|
|
4682
|
-
|
|
4728
|
+
invariant14(!this._open, "service host is open", {
|
|
4683
4729
|
F: __dxlog_file17,
|
|
4684
4730
|
L: 184,
|
|
4685
4731
|
S: this,
|
|
@@ -4695,7 +4741,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4695
4741
|
C: (f, a) => f(...a)
|
|
4696
4742
|
});
|
|
4697
4743
|
if (config) {
|
|
4698
|
-
|
|
4744
|
+
invariant14(!this._config, "config already set", {
|
|
4699
4745
|
F: __dxlog_file17,
|
|
4700
4746
|
L: 188,
|
|
4701
4747
|
S: this,
|
|
@@ -4713,7 +4759,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4713
4759
|
iceServers: this._config?.get("runtime.services.ice")
|
|
4714
4760
|
}), signalManager = new WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
|
|
4715
4761
|
this._signalManager = signalManager;
|
|
4716
|
-
|
|
4762
|
+
invariant14(!this._networkManager, "network manager already set", {
|
|
4717
4763
|
F: __dxlog_file17,
|
|
4718
4764
|
L: 204,
|
|
4719
4765
|
S: this,
|
|
@@ -4747,7 +4793,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4747
4793
|
S: this,
|
|
4748
4794
|
C: (f, a) => f(...a)
|
|
4749
4795
|
});
|
|
4750
|
-
|
|
4796
|
+
invariant14(this._config, "config not set", {
|
|
4751
4797
|
F: __dxlog_file17,
|
|
4752
4798
|
L: 224,
|
|
4753
4799
|
S: this,
|
|
@@ -4756,7 +4802,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4756
4802
|
"'config not set'"
|
|
4757
4803
|
]
|
|
4758
4804
|
});
|
|
4759
|
-
|
|
4805
|
+
invariant14(this._storage, "storage not set", {
|
|
4760
4806
|
F: __dxlog_file17,
|
|
4761
4807
|
L: 225,
|
|
4762
4808
|
S: this,
|
|
@@ -4765,7 +4811,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4765
4811
|
"'storage not set'"
|
|
4766
4812
|
]
|
|
4767
4813
|
});
|
|
4768
|
-
|
|
4814
|
+
invariant14(this._signalManager, "signal manager not set", {
|
|
4769
4815
|
F: __dxlog_file17,
|
|
4770
4816
|
L: 226,
|
|
4771
4817
|
S: this,
|
|
@@ -4774,7 +4820,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4774
4820
|
"'signal manager not set'"
|
|
4775
4821
|
]
|
|
4776
4822
|
});
|
|
4777
|
-
|
|
4823
|
+
invariant14(this._networkManager, "network manager not set", {
|
|
4778
4824
|
F: __dxlog_file17,
|
|
4779
4825
|
L: 227,
|
|
4780
4826
|
S: this,
|
|
@@ -4963,4 +5009,4 @@ export {
|
|
|
4963
5009
|
createDefaultModelFactory,
|
|
4964
5010
|
ClientServicesHost
|
|
4965
5011
|
};
|
|
4966
|
-
//# sourceMappingURL=chunk-
|
|
5012
|
+
//# sourceMappingURL=chunk-WQTWAJOX.mjs.map
|