@dxos/client-services 0.3.11-main.d7d4c52 → 0.3.11-main.d8f9aa0
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-CKB4252E.mjs → chunk-YRC7RQJ3.mjs} +134 -78
- package/dist/lib/browser/chunk-YRC7RQJ3.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/index.mjs.map +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +4 -11
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/{chunk-5EUWM7NI.cjs → chunk-L6XRQW63.cjs} +191 -135
- package/dist/lib/node/chunk-L6XRQW63.cjs.map +7 -0
- package/dist/lib/node/index.cjs +37 -37
- package/dist/lib/node/index.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +11 -18
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/identity/identity-service.d.ts +3 -3
- package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts +2 -0
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-protocol.d.ts +28 -3
- package/dist/types/src/packlets/invitations/invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts +2 -0
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/services/diagnostics.d.ts +4 -0
- package/dist/types/src/packlets/services/diagnostics.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +35 -35
- package/src/packlets/identity/identity-service.test.ts +1 -1
- package/src/packlets/identity/identity-service.ts +6 -3
- package/src/packlets/invitations/device-invitation-protocol.test.ts +14 -0
- package/src/packlets/invitations/device-invitation-protocol.ts +14 -0
- package/src/packlets/invitations/invitation-protocol.ts +44 -6
- package/src/packlets/invitations/invitations-handler.ts +20 -18
- package/src/packlets/invitations/space-invitation-protocol.test.ts +28 -0
- package/src/packlets/invitations/space-invitation-protocol.ts +11 -0
- package/src/packlets/services/diagnostics.ts +18 -0
- package/src/packlets/services/service-host.ts +27 -12
- package/src/packlets/spaces/spaces-service.ts +1 -1
- package/src/packlets/testing/invitation-utils.ts +2 -10
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-CKB4252E.mjs.map +0 -7
- package/dist/lib/node/chunk-5EUWM7NI.cjs.map +0 -7
|
@@ -483,7 +483,7 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
483
483
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
484
484
|
}
|
|
485
485
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
|
|
486
|
-
var Identity = class
|
|
486
|
+
var Identity = class {
|
|
487
487
|
constructor({ space, signer, identityKey, deviceKey }) {
|
|
488
488
|
this.stateUpdate = new Event();
|
|
489
489
|
this.space = space;
|
|
@@ -665,7 +665,7 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
665
665
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
666
666
|
}
|
|
667
667
|
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
|
|
668
|
-
var IdentityManager = class
|
|
668
|
+
var IdentityManager = class {
|
|
669
669
|
// TODO(burdon): IdentityManagerParams.
|
|
670
670
|
// TODO(dmaretskyi): Perhaps this should take/generate the peerKey outside of an initialized identity.
|
|
671
671
|
constructor(_metadataStore, _keyring, _feedStore, _spaceManager) {
|
|
@@ -1025,6 +1025,7 @@ import { signPresentation } from "@dxos/credentials";
|
|
|
1025
1025
|
import { todo } from "@dxos/debug";
|
|
1026
1026
|
import { invariant as invariant3 } from "@dxos/invariant";
|
|
1027
1027
|
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
|
|
1028
|
+
var CREATE_PROFILE_WITH_AUTOMERGE_DEFAULT = true;
|
|
1028
1029
|
var IdentityServiceImpl = class {
|
|
1029
1030
|
constructor(_createIdentity, _identityManager, _keyring, _onProfileUpdate) {
|
|
1030
1031
|
this._createIdentity = _createIdentity;
|
|
@@ -1033,7 +1034,7 @@ var IdentityServiceImpl = class {
|
|
|
1033
1034
|
this._onProfileUpdate = _onProfileUpdate;
|
|
1034
1035
|
}
|
|
1035
1036
|
async createIdentity(request) {
|
|
1036
|
-
await this._createIdentity(request);
|
|
1037
|
+
await this._createIdentity(request.profile ?? {}, request.useAutomerge ?? CREATE_PROFILE_WITH_AUTOMERGE_DEFAULT);
|
|
1037
1038
|
return this._getIdentity();
|
|
1038
1039
|
}
|
|
1039
1040
|
async recoverIdentity(request) {
|
|
@@ -1061,7 +1062,7 @@ var IdentityServiceImpl = class {
|
|
|
1061
1062
|
async updateProfile(profile) {
|
|
1062
1063
|
invariant3(this._identityManager.identity, "Identity not initialized.", {
|
|
1063
1064
|
F: __dxlog_file4,
|
|
1064
|
-
L:
|
|
1065
|
+
L: 63,
|
|
1065
1066
|
S: this,
|
|
1066
1067
|
A: [
|
|
1067
1068
|
"this._identityManager.identity",
|
|
@@ -1075,7 +1076,7 @@ var IdentityServiceImpl = class {
|
|
|
1075
1076
|
async signPresentation({ presentation, nonce }) {
|
|
1076
1077
|
invariant3(this._identityManager.identity, "Identity not initialized.", {
|
|
1077
1078
|
F: __dxlog_file4,
|
|
1078
|
-
L:
|
|
1079
|
+
L: 70,
|
|
1079
1080
|
S: this,
|
|
1080
1081
|
A: [
|
|
1081
1082
|
"this._identityManager.identity",
|
|
@@ -1094,6 +1095,7 @@ var IdentityServiceImpl = class {
|
|
|
1094
1095
|
|
|
1095
1096
|
// packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts
|
|
1096
1097
|
import { invariant as invariant4 } from "@dxos/invariant";
|
|
1098
|
+
import { AlreadyJoinedError } from "@dxos/protocols";
|
|
1097
1099
|
import { Invitation } from "@dxos/protocols/proto/dxos/client/services";
|
|
1098
1100
|
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts";
|
|
1099
1101
|
var DeviceInvitationProtocol = class {
|
|
@@ -1113,7 +1115,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1113
1115
|
async admit(request) {
|
|
1114
1116
|
invariant4(request.device, void 0, {
|
|
1115
1117
|
F: __dxlog_file5,
|
|
1116
|
-
L:
|
|
1118
|
+
L: 36,
|
|
1117
1119
|
S: this,
|
|
1118
1120
|
A: [
|
|
1119
1121
|
"request.device",
|
|
@@ -1131,6 +1133,15 @@ var DeviceInvitationProtocol = class {
|
|
|
1131
1133
|
}
|
|
1132
1134
|
};
|
|
1133
1135
|
}
|
|
1136
|
+
checkInvitation(invitation) {
|
|
1137
|
+
try {
|
|
1138
|
+
const identity = this._getIdentity();
|
|
1139
|
+
if (identity) {
|
|
1140
|
+
return new AlreadyJoinedError("Currently only one identity per client is supported.");
|
|
1141
|
+
}
|
|
1142
|
+
} catch {
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1134
1145
|
createIntroduction() {
|
|
1135
1146
|
return {};
|
|
1136
1147
|
}
|
|
@@ -1149,7 +1160,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1149
1160
|
async accept(response, request) {
|
|
1150
1161
|
invariant4(response.device, void 0, {
|
|
1151
1162
|
F: __dxlog_file5,
|
|
1152
|
-
L:
|
|
1163
|
+
L: 80,
|
|
1153
1164
|
S: this,
|
|
1154
1165
|
A: [
|
|
1155
1166
|
"response.device",
|
|
@@ -1159,7 +1170,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1159
1170
|
const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
|
|
1160
1171
|
invariant4(request.device, void 0, {
|
|
1161
1172
|
F: __dxlog_file5,
|
|
1162
|
-
L:
|
|
1173
|
+
L: 83,
|
|
1163
1174
|
S: this,
|
|
1164
1175
|
A: [
|
|
1165
1176
|
"request.device",
|
|
@@ -1941,16 +1952,12 @@ var InvitationsHandler = class {
|
|
|
1941
1952
|
}
|
|
1942
1953
|
}
|
|
1943
1954
|
}
|
|
1944
|
-
} else {
|
|
1945
|
-
setState({
|
|
1946
|
-
state: Invitation3.State.READY_FOR_AUTHENTICATION
|
|
1947
|
-
});
|
|
1948
1955
|
}
|
|
1949
1956
|
log5("request admission", {
|
|
1950
1957
|
...protocol.toJSON()
|
|
1951
1958
|
}, {
|
|
1952
1959
|
F: __dxlog_file7,
|
|
1953
|
-
L:
|
|
1960
|
+
L: 309,
|
|
1954
1961
|
S: this,
|
|
1955
1962
|
C: (f, a) => f(...a)
|
|
1956
1963
|
});
|
|
@@ -1962,19 +1969,20 @@ var InvitationsHandler = class {
|
|
|
1962
1969
|
...protocol.toJSON()
|
|
1963
1970
|
}, {
|
|
1964
1971
|
F: __dxlog_file7,
|
|
1965
|
-
L:
|
|
1972
|
+
L: 320,
|
|
1966
1973
|
S: this,
|
|
1967
1974
|
C: (f, a) => f(...a)
|
|
1968
1975
|
});
|
|
1969
1976
|
setState({
|
|
1970
1977
|
...result,
|
|
1978
|
+
target: invitation.target,
|
|
1971
1979
|
state: Invitation3.State.SUCCESS
|
|
1972
1980
|
});
|
|
1973
1981
|
log5.trace("dxos.sdk.invitations-handler.guest.onOpen", trace4.end({
|
|
1974
1982
|
id: traceId
|
|
1975
1983
|
}), {
|
|
1976
1984
|
F: __dxlog_file7,
|
|
1977
|
-
L:
|
|
1985
|
+
L: 322,
|
|
1978
1986
|
S: this,
|
|
1979
1987
|
C: (f, a) => f(...a)
|
|
1980
1988
|
});
|
|
@@ -1984,7 +1992,7 @@ var InvitationsHandler = class {
|
|
|
1984
1992
|
...protocol.toJSON()
|
|
1985
1993
|
}, {
|
|
1986
1994
|
F: __dxlog_file7,
|
|
1987
|
-
L:
|
|
1995
|
+
L: 325,
|
|
1988
1996
|
S: this,
|
|
1989
1997
|
C: (f, a) => f(...a)
|
|
1990
1998
|
});
|
|
@@ -1994,7 +2002,7 @@ var InvitationsHandler = class {
|
|
|
1994
2002
|
} else {
|
|
1995
2003
|
log5("auth failed", err, {
|
|
1996
2004
|
F: __dxlog_file7,
|
|
1997
|
-
L:
|
|
2005
|
+
L: 328,
|
|
1998
2006
|
S: this,
|
|
1999
2007
|
C: (f, a) => f(...a)
|
|
2000
2008
|
});
|
|
@@ -2005,7 +2013,7 @@ var InvitationsHandler = class {
|
|
|
2005
2013
|
error: err
|
|
2006
2014
|
}), {
|
|
2007
2015
|
F: __dxlog_file7,
|
|
2008
|
-
L:
|
|
2016
|
+
L: 331,
|
|
2009
2017
|
S: this,
|
|
2010
2018
|
C: (f, a) => f(...a)
|
|
2011
2019
|
});
|
|
@@ -2023,7 +2031,7 @@ var InvitationsHandler = class {
|
|
|
2023
2031
|
...protocol.toJSON()
|
|
2024
2032
|
}, {
|
|
2025
2033
|
F: __dxlog_file7,
|
|
2026
|
-
L:
|
|
2034
|
+
L: 342,
|
|
2027
2035
|
S: this,
|
|
2028
2036
|
C: (f, a) => f(...a)
|
|
2029
2037
|
});
|
|
@@ -2033,7 +2041,7 @@ var InvitationsHandler = class {
|
|
|
2033
2041
|
} else {
|
|
2034
2042
|
log5("auth failed", err, {
|
|
2035
2043
|
F: __dxlog_file7,
|
|
2036
|
-
L:
|
|
2044
|
+
L: 345,
|
|
2037
2045
|
S: this,
|
|
2038
2046
|
C: (f, a) => f(...a)
|
|
2039
2047
|
});
|
|
@@ -2044,29 +2052,34 @@ var InvitationsHandler = class {
|
|
|
2044
2052
|
return extension;
|
|
2045
2053
|
};
|
|
2046
2054
|
scheduleTask2(ctx, async () => {
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2055
|
+
const error = protocol.checkInvitation(invitation);
|
|
2056
|
+
if (error) {
|
|
2057
|
+
stream.error(error);
|
|
2058
|
+
} else {
|
|
2059
|
+
invariant6(invitation.swarmKey, void 0, {
|
|
2060
|
+
F: __dxlog_file7,
|
|
2061
|
+
L: 359,
|
|
2062
|
+
S: this,
|
|
2063
|
+
A: [
|
|
2064
|
+
"invitation.swarmKey",
|
|
2065
|
+
""
|
|
2066
|
+
]
|
|
2067
|
+
});
|
|
2068
|
+
const topic = invitation.swarmKey;
|
|
2069
|
+
const swarmConnection = await this._networkManager.joinSwarm({
|
|
2070
|
+
topic,
|
|
2071
|
+
peerId: PublicKey6.random(),
|
|
2072
|
+
protocolProvider: createTeleportProtocolFactory(async (teleport) => {
|
|
2073
|
+
teleport.addExtension("dxos.halo.invitations", createExtension());
|
|
2074
|
+
}),
|
|
2075
|
+
topology: new StarTopology(topic),
|
|
2076
|
+
label: "invitation guest"
|
|
2077
|
+
});
|
|
2078
|
+
ctx.onDispose(() => swarmConnection.close());
|
|
2079
|
+
setState({
|
|
2080
|
+
state: Invitation3.State.CONNECTING
|
|
2081
|
+
});
|
|
2082
|
+
}
|
|
2070
2083
|
});
|
|
2071
2084
|
const observable = new AuthenticatingInvitation({
|
|
2072
2085
|
initialInvitation: invitation,
|
|
@@ -2272,6 +2285,7 @@ import { createAdmissionCredentials, getCredentialAssertion } from "@dxos/creden
|
|
|
2272
2285
|
import { writeMessages as writeMessages2 } from "@dxos/feed-store";
|
|
2273
2286
|
import { invariant as invariant8 } from "@dxos/invariant";
|
|
2274
2287
|
import { log as log7 } from "@dxos/log";
|
|
2288
|
+
import { AlreadyJoinedError as AlreadyJoinedError2 } from "@dxos/protocols";
|
|
2275
2289
|
import { Invitation as Invitation5 } from "@dxos/protocols/proto/dxos/client/services";
|
|
2276
2290
|
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
|
|
2277
2291
|
var SpaceInvitationProtocol = class {
|
|
@@ -2296,7 +2310,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2296
2310
|
async admit(request, guestProfile) {
|
|
2297
2311
|
invariant8(this._spaceKey, void 0, {
|
|
2298
2312
|
F: __dxlog_file9,
|
|
2299
|
-
L:
|
|
2313
|
+
L: 47,
|
|
2300
2314
|
S: this,
|
|
2301
2315
|
A: [
|
|
2302
2316
|
"this._spaceKey",
|
|
@@ -2306,7 +2320,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2306
2320
|
const space = await this._spaceManager.spaces.get(this._spaceKey);
|
|
2307
2321
|
invariant8(space, void 0, {
|
|
2308
2322
|
F: __dxlog_file9,
|
|
2309
|
-
L:
|
|
2323
|
+
L: 49,
|
|
2310
2324
|
S: this,
|
|
2311
2325
|
A: [
|
|
2312
2326
|
"space",
|
|
@@ -2315,7 +2329,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2315
2329
|
});
|
|
2316
2330
|
invariant8(request.space, void 0, {
|
|
2317
2331
|
F: __dxlog_file9,
|
|
2318
|
-
L:
|
|
2332
|
+
L: 51,
|
|
2319
2333
|
S: this,
|
|
2320
2334
|
A: [
|
|
2321
2335
|
"request.space",
|
|
@@ -2328,14 +2342,14 @@ var SpaceInvitationProtocol = class {
|
|
|
2328
2342
|
guest: deviceKey
|
|
2329
2343
|
}, {
|
|
2330
2344
|
F: __dxlog_file9,
|
|
2331
|
-
L:
|
|
2345
|
+
L: 54,
|
|
2332
2346
|
S: this,
|
|
2333
2347
|
C: (f, a) => f(...a)
|
|
2334
2348
|
});
|
|
2335
2349
|
const credentials = await createAdmissionCredentials(this._signingContext.credentialSigner, identityKey, space.key, space.inner.genesisFeedKey, guestProfile);
|
|
2336
2350
|
invariant8(credentials[0].credential, void 0, {
|
|
2337
2351
|
F: __dxlog_file9,
|
|
2338
|
-
L:
|
|
2352
|
+
L: 65,
|
|
2339
2353
|
S: this,
|
|
2340
2354
|
A: [
|
|
2341
2355
|
"credentials[0].credential",
|
|
@@ -2345,7 +2359,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2345
2359
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
2346
2360
|
invariant8(getCredentialAssertion(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
2347
2361
|
F: __dxlog_file9,
|
|
2348
|
-
L:
|
|
2362
|
+
L: 67,
|
|
2349
2363
|
S: this,
|
|
2350
2364
|
A: [
|
|
2351
2365
|
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2361,6 +2375,11 @@ var SpaceInvitationProtocol = class {
|
|
|
2361
2375
|
}
|
|
2362
2376
|
};
|
|
2363
2377
|
}
|
|
2378
|
+
checkInvitation(invitation) {
|
|
2379
|
+
if (invitation.spaceKey && this._spaceManager.spaces.has(invitation.spaceKey)) {
|
|
2380
|
+
return new AlreadyJoinedError2("Already joined space.");
|
|
2381
|
+
}
|
|
2382
|
+
}
|
|
2364
2383
|
createIntroduction() {
|
|
2365
2384
|
return {
|
|
2366
2385
|
profile: this._signingContext.getProfile()
|
|
@@ -2381,7 +2400,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2381
2400
|
async accept(response) {
|
|
2382
2401
|
invariant8(response.space, void 0, {
|
|
2383
2402
|
F: __dxlog_file9,
|
|
2384
|
-
L:
|
|
2403
|
+
L: 108,
|
|
2385
2404
|
S: this,
|
|
2386
2405
|
A: [
|
|
2387
2406
|
"response.space",
|
|
@@ -2392,7 +2411,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2392
2411
|
const assertion = getCredentialAssertion(credential);
|
|
2393
2412
|
invariant8(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
2394
2413
|
F: __dxlog_file9,
|
|
2395
|
-
L:
|
|
2414
|
+
L: 111,
|
|
2396
2415
|
S: this,
|
|
2397
2416
|
A: [
|
|
2398
2417
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2401,13 +2420,16 @@ var SpaceInvitationProtocol = class {
|
|
|
2401
2420
|
});
|
|
2402
2421
|
invariant8(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
2403
2422
|
F: __dxlog_file9,
|
|
2404
|
-
L:
|
|
2423
|
+
L: 112,
|
|
2405
2424
|
S: this,
|
|
2406
2425
|
A: [
|
|
2407
2426
|
"credential.subject.id.equals(this._signingContext.identityKey)",
|
|
2408
2427
|
""
|
|
2409
2428
|
]
|
|
2410
2429
|
});
|
|
2430
|
+
if (this._spaceManager.spaces.has(assertion.spaceKey)) {
|
|
2431
|
+
throw new AlreadyJoinedError2("Already joined space.");
|
|
2432
|
+
}
|
|
2411
2433
|
await this._spaceManager.acceptSpace({
|
|
2412
2434
|
spaceKey: assertion.spaceKey,
|
|
2413
2435
|
genesisFeedKey: assertion.genesisFeedKey,
|
|
@@ -2436,7 +2458,7 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
2436
2458
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2437
2459
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2438
2460
|
}
|
|
2439
|
-
var ClientRpcServer = class
|
|
2461
|
+
var ClientRpcServer = class {
|
|
2440
2462
|
constructor(params) {
|
|
2441
2463
|
this._handlerCache = /* @__PURE__ */ new Map();
|
|
2442
2464
|
this._callMetrics = new MapCounter();
|
|
@@ -2541,7 +2563,7 @@ var getPlatform = () => {
|
|
|
2541
2563
|
};
|
|
2542
2564
|
|
|
2543
2565
|
// packages/sdk/client-services/src/version.ts
|
|
2544
|
-
var DXOS_VERSION = "0.3.11-main.
|
|
2566
|
+
var DXOS_VERSION = "0.3.11-main.d8f9aa0";
|
|
2545
2567
|
|
|
2546
2568
|
// packages/sdk/client-services/src/packlets/services/diagnostics.ts
|
|
2547
2569
|
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
|
|
@@ -2560,7 +2582,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
2560
2582
|
{
|
|
2561
2583
|
invariant9(clientServices.LoggingService, "SystemService is not available.", {
|
|
2562
2584
|
F: __dxlog_file10,
|
|
2563
|
-
L:
|
|
2585
|
+
L: 93,
|
|
2564
2586
|
S: void 0,
|
|
2565
2587
|
A: [
|
|
2566
2588
|
"clientServices.LoggingService",
|
|
@@ -2571,6 +2593,21 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
2571
2593
|
timeout: DEFAULT_TIMEOUT
|
|
2572
2594
|
}).catch(() => void 0);
|
|
2573
2595
|
}
|
|
2596
|
+
if (typeof navigator !== "undefined" && navigator.storage) {
|
|
2597
|
+
const map = /* @__PURE__ */ new Map();
|
|
2598
|
+
const dir = await navigator.storage.getDirectory();
|
|
2599
|
+
for await (const filename of dir?.keys()) {
|
|
2600
|
+
const idx = filename.indexOf("-", filename.indexOf("-") + 1);
|
|
2601
|
+
if (idx === -1) {
|
|
2602
|
+
continue;
|
|
2603
|
+
}
|
|
2604
|
+
map.set(filename.slice(0, idx), (map.get(filename.slice(0, idx)) ?? 0) + 1);
|
|
2605
|
+
}
|
|
2606
|
+
diagnostics.storage = Array.from(map.entries()).sort((a, b) => b[1] - a[1]).map(([file, count]) => ({
|
|
2607
|
+
file,
|
|
2608
|
+
count
|
|
2609
|
+
}));
|
|
2610
|
+
}
|
|
2574
2611
|
const identity = serviceContext.identityManager.identity;
|
|
2575
2612
|
if (identity) {
|
|
2576
2613
|
diagnostics.identity = {
|
|
@@ -2611,7 +2648,7 @@ var getProperties = (space) => {
|
|
|
2611
2648
|
} catch (err) {
|
|
2612
2649
|
log8.warn(err.message, void 0, {
|
|
2613
2650
|
F: __dxlog_file10,
|
|
2614
|
-
L:
|
|
2651
|
+
L: 178,
|
|
2615
2652
|
S: void 0,
|
|
2616
2653
|
C: (f, a) => f(...a)
|
|
2617
2654
|
});
|
|
@@ -2980,7 +3017,7 @@ function _ts_decorate4(decorators, target, key, desc) {
|
|
|
2980
3017
|
}
|
|
2981
3018
|
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
|
|
2982
3019
|
var ENABLE_FEED_PURGE = false;
|
|
2983
|
-
var DataSpace = class
|
|
3020
|
+
var DataSpace = class {
|
|
2984
3021
|
constructor(params) {
|
|
2985
3022
|
this._ctx = new Context7();
|
|
2986
3023
|
this._notarizationPlugin = new NotarizationPlugin();
|
|
@@ -3469,7 +3506,7 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
3469
3506
|
var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
|
|
3470
3507
|
var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
3471
3508
|
var PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
3472
|
-
var DataSpaceManager = class
|
|
3509
|
+
var DataSpaceManager = class {
|
|
3473
3510
|
constructor(_spaceManager, _metadataStore, _dataServiceSubscriptions, _keyring, _signingContext, _feedStore, _automergeHost) {
|
|
3474
3511
|
this._spaceManager = _spaceManager;
|
|
3475
3512
|
this._metadataStore = _metadataStore;
|
|
@@ -3812,7 +3849,7 @@ var SpacesServiceImpl = class {
|
|
|
3812
3849
|
}
|
|
3813
3850
|
async createSpace() {
|
|
3814
3851
|
if (!this._identityManager.identity) {
|
|
3815
|
-
throw new Error("This device has no HALO identity available. See https://docs.dxos.org/guide/halo");
|
|
3852
|
+
throw new Error("This device has no HALO identity available. See https://docs.dxos.org/guide/platform/halo");
|
|
3816
3853
|
}
|
|
3817
3854
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3818
3855
|
const space = await dataSpaceManager.createSpace();
|
|
@@ -4042,7 +4079,7 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
4042
4079
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4043
4080
|
}
|
|
4044
4081
|
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
4045
|
-
var ServiceContext = class
|
|
4082
|
+
var ServiceContext = class {
|
|
4046
4083
|
constructor(storage, networkManager, signalManager, modelFactory) {
|
|
4047
4084
|
this.storage = storage;
|
|
4048
4085
|
this.networkManager = networkManager;
|
|
@@ -4343,7 +4380,7 @@ var Lock = class {
|
|
|
4343
4380
|
}
|
|
4344
4381
|
async acquire() {
|
|
4345
4382
|
this._broadcastChannel.postMessage({
|
|
4346
|
-
message:
|
|
4383
|
+
message: "acquiring"
|
|
4347
4384
|
});
|
|
4348
4385
|
try {
|
|
4349
4386
|
log14("aquiring lock...", void 0, {
|
|
@@ -4379,7 +4416,7 @@ var Lock = class {
|
|
|
4379
4416
|
this._releaseTrigger.wake();
|
|
4380
4417
|
}
|
|
4381
4418
|
_onMessage(event) {
|
|
4382
|
-
if (event.data.message ===
|
|
4419
|
+
if (event.data.message === "acquiring") {
|
|
4383
4420
|
this._releaseTrigger.wake();
|
|
4384
4421
|
}
|
|
4385
4422
|
}
|
|
@@ -4489,7 +4526,7 @@ import { clientServiceBundle, defaultKey, Properties } from "@dxos/client-protoc
|
|
|
4489
4526
|
import { Context as Context10 } from "@dxos/context";
|
|
4490
4527
|
import { DocumentModel as DocumentModel2 } from "@dxos/document-model";
|
|
4491
4528
|
import { DataServiceImpl } from "@dxos/echo-pipeline";
|
|
4492
|
-
import { base } from "@dxos/echo-schema";
|
|
4529
|
+
import { base, getRawDoc } from "@dxos/echo-schema";
|
|
4493
4530
|
import { invariant as invariant14 } from "@dxos/invariant";
|
|
4494
4531
|
import { PublicKey as PublicKey11 } from "@dxos/keys";
|
|
4495
4532
|
import { log as log16 } from "@dxos/log";
|
|
@@ -4776,7 +4813,7 @@ var createGenesisMutationFromTypedObject = (obj) => {
|
|
|
4776
4813
|
}
|
|
4777
4814
|
};
|
|
4778
4815
|
};
|
|
4779
|
-
var ClientServicesHost = class
|
|
4816
|
+
var ClientServicesHost = class {
|
|
4780
4817
|
constructor({
|
|
4781
4818
|
config,
|
|
4782
4819
|
modelFactory = createDefaultModelFactory(),
|
|
@@ -4978,7 +5015,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4978
5015
|
this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory);
|
|
4979
5016
|
this._serviceRegistry.setServices({
|
|
4980
5017
|
SystemService: this._systemService,
|
|
4981
|
-
IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
|
|
5018
|
+
IdentityService: new IdentityServiceImpl((params, useAutomerge) => this._createIdentity(params, useAutomerge), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
|
|
4982
5019
|
InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitations, (invitation) => this._serviceContext.getInvitationHandler(invitation)),
|
|
4983
5020
|
DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
|
|
4984
5021
|
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, this._serviceContext.dataServiceSubscriptions, async () => {
|
|
@@ -5092,25 +5129,44 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
5092
5129
|
});
|
|
5093
5130
|
await this._callbacks?.onReset?.();
|
|
5094
5131
|
}
|
|
5095
|
-
async _createIdentity(params) {
|
|
5132
|
+
async _createIdentity(params, useAutomerge) {
|
|
5096
5133
|
const identity = await this._serviceContext.createIdentity(params);
|
|
5097
5134
|
await this._serviceContext.initialized.wait();
|
|
5098
5135
|
const space = await this._serviceContext.dataSpaceManager.createSpace();
|
|
5099
5136
|
const obj = new Properties(void 0, {
|
|
5100
|
-
automerge:
|
|
5137
|
+
automerge: useAutomerge
|
|
5101
5138
|
});
|
|
5102
5139
|
obj[defaultKey] = identity.identityKey.toHex();
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5140
|
+
if (!useAutomerge) {
|
|
5141
|
+
await this._serviceRegistry.services.DataService.write({
|
|
5142
|
+
spaceKey: space.key,
|
|
5143
|
+
batch: {
|
|
5144
|
+
objects: [
|
|
5145
|
+
createGenesisMutationFromTypedObject(obj)
|
|
5146
|
+
]
|
|
5147
|
+
}
|
|
5148
|
+
});
|
|
5149
|
+
await this._serviceRegistry.services.DataService.flush({
|
|
5150
|
+
spaceKey: space.key
|
|
5151
|
+
});
|
|
5152
|
+
} else {
|
|
5153
|
+
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
5154
|
+
invariant14(automergeIndex, void 0, {
|
|
5155
|
+
F: __dxlog_file17,
|
|
5156
|
+
L: 375,
|
|
5157
|
+
S: this,
|
|
5158
|
+
A: [
|
|
5159
|
+
"automergeIndex",
|
|
5160
|
+
""
|
|
5108
5161
|
]
|
|
5109
|
-
}
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5162
|
+
});
|
|
5163
|
+
const document = await this._serviceContext.automergeHost.repo.find(automergeIndex);
|
|
5164
|
+
await document.whenReady();
|
|
5165
|
+
document.change((doc) => {
|
|
5166
|
+
doc.objects ??= {};
|
|
5167
|
+
doc.objects[obj[base]._id] = getRawDoc(obj).handle.docSync();
|
|
5168
|
+
});
|
|
5169
|
+
}
|
|
5114
5170
|
return identity;
|
|
5115
5171
|
}
|
|
5116
5172
|
};
|
|
@@ -5166,4 +5222,4 @@ export {
|
|
|
5166
5222
|
createDefaultModelFactory,
|
|
5167
5223
|
ClientServicesHost
|
|
5168
5224
|
};
|
|
5169
|
-
//# sourceMappingURL=chunk-
|
|
5225
|
+
//# sourceMappingURL=chunk-YRC7RQJ3.mjs.map
|