@dxos/client-services 0.4.7 → 0.4.8-main.00e6f19
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-NI6XJLUJ.mjs → chunk-EQPR3Z5Y.mjs} +413 -158
- package/dist/lib/browser/chunk-EQPR3Z5Y.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +3 -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 +1 -1
- package/dist/lib/node/{chunk-RH65IX2V.cjs → chunk-VDSDEN45.cjs} +396 -144
- package/dist/lib/node/chunk-VDSDEN45.cjs.map +7 -0
- package/dist/lib/node/index.cjs +39 -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 +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/invitations/invitations-handler.d.ts +1 -0
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-service.d.ts +9 -1
- package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts +2 -1
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/automerge-space-state.d.ts +2 -0
- package/dist/types/src/packlets/spaces/automerge-space-state.d.ts.map +1 -1
- 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/dist/types/src/version.d.ts.map +1 -1
- package/package.json +37 -35
- package/src/packlets/identity/identity-manager.ts +1 -1
- package/src/packlets/indexing/index.ts +5 -0
- package/src/packlets/indexing/util.ts +89 -0
- package/src/packlets/invitations/invitations-handler.ts +37 -2
- package/src/packlets/invitations/invitations-service.ts +83 -5
- package/src/packlets/services/service-context.ts +13 -2
- package/src/packlets/services/service-host.ts +15 -2
- package/src/packlets/spaces/automerge-space-state.ts +15 -0
- package/src/packlets/spaces/data-space.ts +33 -11
- package/src/packlets/spaces/spaces-service.ts +2 -2
- package/src/version.ts +1 -5
- package/dist/lib/browser/chunk-NI6XJLUJ.mjs.map +0 -7
- package/dist/lib/node/chunk-RH65IX2V.cjs.map +0 -7
|
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_VDSDEN45_exports = {};
|
|
30
|
+
__export(chunk_VDSDEN45_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
DataSpace: () => DataSpace,
|
|
@@ -51,6 +51,7 @@ __export(chunk_RH65IX2V_exports, {
|
|
|
51
51
|
createDiagnostics: () => createDiagnostics,
|
|
52
52
|
createStorageObjects: () => createStorageObjects,
|
|
53
53
|
getNetworkPeers: () => getNetworkPeers,
|
|
54
|
+
invitationExpired: () => invitationExpired,
|
|
54
55
|
isLocked: () => isLocked,
|
|
55
56
|
subscribeToFeedBlocks: () => subscribeToFeedBlocks,
|
|
56
57
|
subscribeToFeeds: () => subscribeToFeeds,
|
|
@@ -60,7 +61,7 @@ __export(chunk_RH65IX2V_exports, {
|
|
|
60
61
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
61
62
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
62
63
|
});
|
|
63
|
-
module.exports = __toCommonJS(
|
|
64
|
+
module.exports = __toCommonJS(chunk_VDSDEN45_exports);
|
|
64
65
|
var import_async = require("@dxos/async");
|
|
65
66
|
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
66
67
|
var import_feed_store = require("@dxos/feed-store");
|
|
@@ -133,6 +134,7 @@ var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations")
|
|
|
133
134
|
var import_teleport = require("@dxos/teleport");
|
|
134
135
|
var import_async9 = require("@dxos/async");
|
|
135
136
|
var import_codec_protobuf8 = require("@dxos/codec-protobuf");
|
|
137
|
+
var import_context6 = require("@dxos/context");
|
|
136
138
|
var import_invariant7 = require("@dxos/invariant");
|
|
137
139
|
var import_log6 = require("@dxos/log");
|
|
138
140
|
var import_services5 = require("@dxos/protocols/proto/dxos/client/services");
|
|
@@ -158,7 +160,7 @@ var import_tracing4 = require("@dxos/tracing");
|
|
|
158
160
|
var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
|
|
159
161
|
var import_async10 = require("@dxos/async");
|
|
160
162
|
var import_client_protocol3 = require("@dxos/client-protocol");
|
|
161
|
-
var
|
|
163
|
+
var import_context7 = require("@dxos/context");
|
|
162
164
|
var import_debug3 = require("@dxos/debug");
|
|
163
165
|
var import_echo_pipeline = require("@dxos/echo-pipeline");
|
|
164
166
|
var import_invariant10 = require("@dxos/invariant");
|
|
@@ -172,7 +174,7 @@ var import_tracing5 = require("@dxos/tracing");
|
|
|
172
174
|
var import_util4 = require("@dxos/util");
|
|
173
175
|
var import_credentials11 = require("@dxos/credentials");
|
|
174
176
|
var import_async11 = require("@dxos/async");
|
|
175
|
-
var
|
|
177
|
+
var import_context8 = require("@dxos/context");
|
|
176
178
|
var import_invariant11 = require("@dxos/invariant");
|
|
177
179
|
var import_keys8 = require("@dxos/keys");
|
|
178
180
|
var import_log10 = require("@dxos/log");
|
|
@@ -180,7 +182,7 @@ var import_protocols9 = require("@dxos/protocols");
|
|
|
180
182
|
var import_teleport2 = require("@dxos/teleport");
|
|
181
183
|
var import_util5 = require("@dxos/util");
|
|
182
184
|
var import_async12 = require("@dxos/async");
|
|
183
|
-
var
|
|
185
|
+
var import_context9 = require("@dxos/context");
|
|
184
186
|
var import_credentials12 = require("@dxos/credentials");
|
|
185
187
|
var import_invariant12 = require("@dxos/invariant");
|
|
186
188
|
var import_keys9 = require("@dxos/keys");
|
|
@@ -201,12 +203,12 @@ var import_log12 = require("@dxos/log");
|
|
|
201
203
|
var import_protocols11 = require("@dxos/protocols");
|
|
202
204
|
var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
|
|
203
205
|
var import_async14 = require("@dxos/async");
|
|
204
|
-
var
|
|
206
|
+
var import_context10 = require("@dxos/context");
|
|
205
207
|
var import_credentials15 = require("@dxos/credentials");
|
|
206
208
|
var import_debug6 = require("@dxos/debug");
|
|
207
209
|
var import_echo_pipeline2 = require("@dxos/echo-pipeline");
|
|
208
|
-
var import_echo_schema = require("@dxos/echo-schema");
|
|
209
210
|
var import_feed_store4 = require("@dxos/feed-store");
|
|
211
|
+
var import_indexing = require("@dxos/indexing");
|
|
210
212
|
var import_invariant14 = require("@dxos/invariant");
|
|
211
213
|
var import_keyring = require("@dxos/keyring");
|
|
212
214
|
var import_keys10 = require("@dxos/keys");
|
|
@@ -216,27 +218,31 @@ var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
|
|
|
216
218
|
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
217
219
|
var import_tracing6 = require("@dxos/tracing");
|
|
218
220
|
var import_util7 = require("@dxos/util");
|
|
221
|
+
var import_automerge = require("@dxos/automerge/automerge");
|
|
222
|
+
var import_debug7 = require("@dxos/debug");
|
|
223
|
+
var import_protocols13 = require("@dxos/protocols");
|
|
219
224
|
var import_invariant15 = require("@dxos/invariant");
|
|
220
225
|
var import_lock_file = require("@dxos/lock-file");
|
|
221
226
|
var import_log14 = require("@dxos/log");
|
|
222
227
|
var import_client_protocol4 = require("@dxos/client-protocol");
|
|
223
|
-
var
|
|
228
|
+
var import_protocols14 = require("@dxos/protocols");
|
|
224
229
|
var import_config = require("@dxos/protocols/proto/dxos/config");
|
|
225
230
|
var import_random_access_storage = require("@dxos/random-access-storage");
|
|
226
231
|
var import_util8 = require("@dxos/util");
|
|
227
232
|
var import_async15 = require("@dxos/async");
|
|
228
233
|
var import_client_protocol5 = require("@dxos/client-protocol");
|
|
229
|
-
var
|
|
234
|
+
var import_context11 = require("@dxos/context");
|
|
230
235
|
var import_document_model2 = require("@dxos/document-model");
|
|
231
236
|
var import_echo_pipeline3 = require("@dxos/echo-pipeline");
|
|
232
|
-
var
|
|
237
|
+
var import_echo_schema = require("@dxos/echo-schema");
|
|
238
|
+
var import_indexing2 = require("@dxos/indexing");
|
|
233
239
|
var import_invariant16 = require("@dxos/invariant");
|
|
234
240
|
var import_keys11 = require("@dxos/keys");
|
|
235
241
|
var import_log15 = require("@dxos/log");
|
|
236
242
|
var import_messaging = require("@dxos/messaging");
|
|
237
243
|
var import_model_factory = require("@dxos/model-factory");
|
|
238
244
|
var import_network_manager2 = require("@dxos/network-manager");
|
|
239
|
-
var
|
|
245
|
+
var import_protocols15 = require("@dxos/protocols");
|
|
240
246
|
var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
|
|
241
247
|
var import_text_model = require("@dxos/text-model");
|
|
242
248
|
var import_tracing7 = require("@dxos/tracing");
|
|
@@ -1230,7 +1236,7 @@ var IdentityManager = class {
|
|
|
1230
1236
|
identityKey: identityRecord.identityKey
|
|
1231
1237
|
});
|
|
1232
1238
|
await space.setControlFeed(controlFeed);
|
|
1233
|
-
|
|
1239
|
+
await space.setDataFeed(dataFeed);
|
|
1234
1240
|
const identity = new Identity({
|
|
1235
1241
|
space,
|
|
1236
1242
|
presence,
|
|
@@ -1788,11 +1794,11 @@ var InvitationsHandler = class {
|
|
|
1788
1794
|
this._networkManager = _networkManager;
|
|
1789
1795
|
}
|
|
1790
1796
|
createInvitation(protocol, options) {
|
|
1791
|
-
const { invitationId = import_keys5.PublicKey.random().toHex(), type = import_services3.Invitation.Type.INTERACTIVE, authMethod = import_services3.Invitation.AuthMethod.SHARED_SECRET, state = import_services3.Invitation.State.INIT, timeout = import_client_protocol2.INVITATION_TIMEOUT, swarmKey = import_keys5.PublicKey.random() } = options ?? {};
|
|
1797
|
+
const { invitationId = import_keys5.PublicKey.random().toHex(), type = import_services3.Invitation.Type.INTERACTIVE, authMethod = import_services3.Invitation.AuthMethod.SHARED_SECRET, state = import_services3.Invitation.State.INIT, timeout = import_client_protocol2.INVITATION_TIMEOUT, swarmKey = import_keys5.PublicKey.random(), persistent = true, created = /* @__PURE__ */ new Date(), lifetime = 86400 } = options ?? {};
|
|
1792
1798
|
const authCode = options?.authCode ?? (authMethod === import_services3.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials7.generatePasscode)(import_client_protocol2.AUTHENTICATION_CODE_LENGTH) : void 0);
|
|
1793
1799
|
(0, import_invariant5.invariant)(protocol, void 0, {
|
|
1794
1800
|
F: __dxlog_file7,
|
|
1795
|
-
L:
|
|
1801
|
+
L: 84,
|
|
1796
1802
|
S: this,
|
|
1797
1803
|
A: [
|
|
1798
1804
|
"protocol",
|
|
@@ -1807,13 +1813,16 @@ var InvitationsHandler = class {
|
|
|
1807
1813
|
swarmKey,
|
|
1808
1814
|
authCode,
|
|
1809
1815
|
timeout,
|
|
1816
|
+
persistent,
|
|
1817
|
+
created,
|
|
1818
|
+
lifetime,
|
|
1810
1819
|
...protocol.getInvitationContext()
|
|
1811
1820
|
};
|
|
1812
1821
|
const stream = new import_async7.PushStream();
|
|
1813
1822
|
const ctx = new import_context4.Context({
|
|
1814
1823
|
onError: (err) => {
|
|
1815
|
-
void ctx.dispose();
|
|
1816
1824
|
stream.error(err);
|
|
1825
|
+
void ctx.dispose();
|
|
1817
1826
|
}
|
|
1818
1827
|
});
|
|
1819
1828
|
ctx.onDispose(() => {
|
|
@@ -1821,7 +1830,7 @@ var InvitationsHandler = class {
|
|
|
1821
1830
|
...protocol.toJSON()
|
|
1822
1831
|
}, {
|
|
1823
1832
|
F: __dxlog_file7,
|
|
1824
|
-
L:
|
|
1833
|
+
L: 109,
|
|
1825
1834
|
S: this,
|
|
1826
1835
|
C: (f, a) => f(...a)
|
|
1827
1836
|
});
|
|
@@ -1846,7 +1855,7 @@ var InvitationsHandler = class {
|
|
|
1846
1855
|
const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
|
|
1847
1856
|
(0, import_invariant5.invariant)(deviceKey, void 0, {
|
|
1848
1857
|
F: __dxlog_file7,
|
|
1849
|
-
L:
|
|
1858
|
+
L: 130,
|
|
1850
1859
|
S: this,
|
|
1851
1860
|
A: [
|
|
1852
1861
|
"deviceKey",
|
|
@@ -1869,7 +1878,7 @@ var InvitationsHandler = class {
|
|
|
1869
1878
|
id: traceId
|
|
1870
1879
|
}), {
|
|
1871
1880
|
F: __dxlog_file7,
|
|
1872
|
-
L:
|
|
1881
|
+
L: 148,
|
|
1873
1882
|
S: this,
|
|
1874
1883
|
C: (f, a) => f(...a)
|
|
1875
1884
|
});
|
|
@@ -1877,7 +1886,7 @@ var InvitationsHandler = class {
|
|
|
1877
1886
|
...protocol.toJSON()
|
|
1878
1887
|
}, {
|
|
1879
1888
|
F: __dxlog_file7,
|
|
1880
|
-
L:
|
|
1889
|
+
L: 149,
|
|
1881
1890
|
S: this,
|
|
1882
1891
|
C: (f, a) => f(...a)
|
|
1883
1892
|
});
|
|
@@ -1893,7 +1902,7 @@ var InvitationsHandler = class {
|
|
|
1893
1902
|
...protocol.toJSON()
|
|
1894
1903
|
}, {
|
|
1895
1904
|
F: __dxlog_file7,
|
|
1896
|
-
L:
|
|
1905
|
+
L: 152,
|
|
1897
1906
|
S: this,
|
|
1898
1907
|
C: (f, a) => f(...a)
|
|
1899
1908
|
});
|
|
@@ -1905,7 +1914,7 @@ var InvitationsHandler = class {
|
|
|
1905
1914
|
id: traceId
|
|
1906
1915
|
}), {
|
|
1907
1916
|
F: __dxlog_file7,
|
|
1908
|
-
L:
|
|
1917
|
+
L: 154,
|
|
1909
1918
|
S: this,
|
|
1910
1919
|
C: (f, a) => f(...a)
|
|
1911
1920
|
});
|
|
@@ -1915,7 +1924,7 @@ var InvitationsHandler = class {
|
|
|
1915
1924
|
...protocol.toJSON()
|
|
1916
1925
|
}, {
|
|
1917
1926
|
F: __dxlog_file7,
|
|
1918
|
-
L:
|
|
1927
|
+
L: 157,
|
|
1919
1928
|
S: this,
|
|
1920
1929
|
C: (f, a) => f(...a)
|
|
1921
1930
|
});
|
|
@@ -1926,7 +1935,7 @@ var InvitationsHandler = class {
|
|
|
1926
1935
|
} else {
|
|
1927
1936
|
import_log4.log.error("failed", err, {
|
|
1928
1937
|
F: __dxlog_file7,
|
|
1929
|
-
L:
|
|
1938
|
+
L: 160,
|
|
1930
1939
|
S: this,
|
|
1931
1940
|
C: (f, a) => f(...a)
|
|
1932
1941
|
});
|
|
@@ -1937,7 +1946,7 @@ var InvitationsHandler = class {
|
|
|
1937
1946
|
error: err
|
|
1938
1947
|
}), {
|
|
1939
1948
|
F: __dxlog_file7,
|
|
1940
|
-
L:
|
|
1949
|
+
L: 163,
|
|
1941
1950
|
S: this,
|
|
1942
1951
|
C: (f, a) => f(...a)
|
|
1943
1952
|
});
|
|
@@ -1958,7 +1967,7 @@ var InvitationsHandler = class {
|
|
|
1958
1967
|
...protocol.toJSON()
|
|
1959
1968
|
}, {
|
|
1960
1969
|
F: __dxlog_file7,
|
|
1961
|
-
L:
|
|
1970
|
+
L: 178,
|
|
1962
1971
|
S: this,
|
|
1963
1972
|
C: (f, a) => f(...a)
|
|
1964
1973
|
});
|
|
@@ -1969,7 +1978,7 @@ var InvitationsHandler = class {
|
|
|
1969
1978
|
} else {
|
|
1970
1979
|
import_log4.log.error("failed", err, {
|
|
1971
1980
|
F: __dxlog_file7,
|
|
1972
|
-
L:
|
|
1981
|
+
L: 181,
|
|
1973
1982
|
S: this,
|
|
1974
1983
|
C: (f, a) => f(...a)
|
|
1975
1984
|
});
|
|
@@ -1979,7 +1988,27 @@ var InvitationsHandler = class {
|
|
|
1979
1988
|
});
|
|
1980
1989
|
return extension;
|
|
1981
1990
|
};
|
|
1991
|
+
if (invitation.lifetime && invitation.created && invitation.lifetime !== 0) {
|
|
1992
|
+
if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
|
|
1993
|
+
import_log4.log.warn("invitation has already expired", void 0, {
|
|
1994
|
+
F: __dxlog_file7,
|
|
1995
|
+
L: 192,
|
|
1996
|
+
S: this,
|
|
1997
|
+
C: (f, a) => f(...a)
|
|
1998
|
+
});
|
|
1999
|
+
} else {
|
|
2000
|
+
(0, import_async7.scheduleTask)(ctx, async () => {
|
|
2001
|
+
await swarmConnection.close();
|
|
2002
|
+
stream.next({
|
|
2003
|
+
...invitation,
|
|
2004
|
+
state: import_services3.Invitation.State.EXPIRED
|
|
2005
|
+
});
|
|
2006
|
+
await ctx.dispose();
|
|
2007
|
+
}, invitation.created.getTime() + invitation.lifetime * 1e3 - Date.now());
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
1982
2010
|
let swarmConnection;
|
|
2011
|
+
const invitationLabel = "invitation host for " + (invitation.kind === import_services3.Invitation.Kind.DEVICE ? "device" : `space ${invitation.spaceKey?.truncate()}`);
|
|
1983
2012
|
(0, import_async7.scheduleTask)(ctx, async () => {
|
|
1984
2013
|
const topic = invitation.swarmKey;
|
|
1985
2014
|
swarmConnection = await this._networkManager.joinSwarm({
|
|
@@ -1989,7 +2018,7 @@ var InvitationsHandler = class {
|
|
|
1989
2018
|
teleport.addExtension("dxos.halo.invitations", createExtension());
|
|
1990
2019
|
}),
|
|
1991
2020
|
topology: new import_network_manager.StarTopology(topic),
|
|
1992
|
-
label:
|
|
2021
|
+
label: invitationLabel
|
|
1993
2022
|
});
|
|
1994
2023
|
ctx.onDispose(() => swarmConnection.close());
|
|
1995
2024
|
stream.next({
|
|
@@ -2014,7 +2043,7 @@ var InvitationsHandler = class {
|
|
|
2014
2043
|
const { timeout = import_client_protocol2.INVITATION_TIMEOUT } = invitation;
|
|
2015
2044
|
(0, import_invariant5.invariant)(protocol, void 0, {
|
|
2016
2045
|
F: __dxlog_file7,
|
|
2017
|
-
L:
|
|
2046
|
+
L: 246,
|
|
2018
2047
|
S: this,
|
|
2019
2048
|
A: [
|
|
2020
2049
|
"protocol",
|
|
@@ -2024,7 +2053,7 @@ var InvitationsHandler = class {
|
|
|
2024
2053
|
if (deviceProfile) {
|
|
2025
2054
|
(0, import_invariant5.invariant)(invitation.kind === import_services3.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
2026
2055
|
F: __dxlog_file7,
|
|
2027
|
-
L:
|
|
2056
|
+
L: 250,
|
|
2028
2057
|
S: this,
|
|
2029
2058
|
A: [
|
|
2030
2059
|
"invitation.kind === Invitation.Kind.DEVICE",
|
|
@@ -2039,7 +2068,7 @@ var InvitationsHandler = class {
|
|
|
2039
2068
|
const setState = (newData) => {
|
|
2040
2069
|
(0, import_invariant5.invariant)(newData.state !== void 0, void 0, {
|
|
2041
2070
|
F: __dxlog_file7,
|
|
2042
|
-
L:
|
|
2071
|
+
L: 261,
|
|
2043
2072
|
S: this,
|
|
2044
2073
|
A: [
|
|
2045
2074
|
"newData.state !== undefined",
|
|
@@ -2059,7 +2088,7 @@ var InvitationsHandler = class {
|
|
|
2059
2088
|
...protocol.toJSON()
|
|
2060
2089
|
}, {
|
|
2061
2090
|
F: __dxlog_file7,
|
|
2062
|
-
L:
|
|
2091
|
+
L: 269,
|
|
2063
2092
|
S: this,
|
|
2064
2093
|
C: (f, a) => f(...a)
|
|
2065
2094
|
});
|
|
@@ -2069,7 +2098,7 @@ var InvitationsHandler = class {
|
|
|
2069
2098
|
} else {
|
|
2070
2099
|
import_log4.log.warn("auth failed", err, {
|
|
2071
2100
|
F: __dxlog_file7,
|
|
2072
|
-
L:
|
|
2101
|
+
L: 272,
|
|
2073
2102
|
S: this,
|
|
2074
2103
|
C: (f, a) => f(...a)
|
|
2075
2104
|
});
|
|
@@ -2083,7 +2112,7 @@ var InvitationsHandler = class {
|
|
|
2083
2112
|
...protocol.toJSON()
|
|
2084
2113
|
}, {
|
|
2085
2114
|
F: __dxlog_file7,
|
|
2086
|
-
L:
|
|
2115
|
+
L: 280,
|
|
2087
2116
|
S: this,
|
|
2088
2117
|
C: (f, a) => f(...a)
|
|
2089
2118
|
});
|
|
@@ -2098,7 +2127,7 @@ var InvitationsHandler = class {
|
|
|
2098
2127
|
currentState
|
|
2099
2128
|
}, {
|
|
2100
2129
|
F: __dxlog_file7,
|
|
2101
|
-
L:
|
|
2130
|
+
L: 290,
|
|
2102
2131
|
S: this,
|
|
2103
2132
|
C: (f, a) => f(...a)
|
|
2104
2133
|
});
|
|
@@ -2113,7 +2142,7 @@ var InvitationsHandler = class {
|
|
|
2113
2142
|
id: traceId
|
|
2114
2143
|
}), {
|
|
2115
2144
|
F: __dxlog_file7,
|
|
2116
|
-
L:
|
|
2145
|
+
L: 299,
|
|
2117
2146
|
S: this,
|
|
2118
2147
|
C: (f, a) => f(...a)
|
|
2119
2148
|
});
|
|
@@ -2125,7 +2154,7 @@ var InvitationsHandler = class {
|
|
|
2125
2154
|
...protocol.toJSON()
|
|
2126
2155
|
}, {
|
|
2127
2156
|
F: __dxlog_file7,
|
|
2128
|
-
L:
|
|
2157
|
+
L: 307,
|
|
2129
2158
|
S: this,
|
|
2130
2159
|
C: (f, a) => f(...a)
|
|
2131
2160
|
});
|
|
@@ -2136,7 +2165,7 @@ var InvitationsHandler = class {
|
|
|
2136
2165
|
...protocol.toJSON()
|
|
2137
2166
|
}, {
|
|
2138
2167
|
F: __dxlog_file7,
|
|
2139
|
-
L:
|
|
2168
|
+
L: 311,
|
|
2140
2169
|
S: this,
|
|
2141
2170
|
C: (f, a) => f(...a)
|
|
2142
2171
|
});
|
|
@@ -2146,7 +2175,7 @@ var InvitationsHandler = class {
|
|
|
2146
2175
|
response: introductionResponse
|
|
2147
2176
|
}, {
|
|
2148
2177
|
F: __dxlog_file7,
|
|
2149
|
-
L:
|
|
2178
|
+
L: 315,
|
|
2150
2179
|
S: this,
|
|
2151
2180
|
C: (f, a) => f(...a)
|
|
2152
2181
|
});
|
|
@@ -2155,7 +2184,7 @@ var InvitationsHandler = class {
|
|
|
2155
2184
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
2156
2185
|
(0, import_log4.log)("guest waiting for authentication code...", void 0, {
|
|
2157
2186
|
F: __dxlog_file7,
|
|
2158
|
-
L:
|
|
2187
|
+
L: 321,
|
|
2159
2188
|
S: this,
|
|
2160
2189
|
C: (f, a) => f(...a)
|
|
2161
2190
|
});
|
|
@@ -2167,7 +2196,7 @@ var InvitationsHandler = class {
|
|
|
2167
2196
|
});
|
|
2168
2197
|
(0, import_log4.log)("sending authentication request", void 0, {
|
|
2169
2198
|
F: __dxlog_file7,
|
|
2170
|
-
L:
|
|
2199
|
+
L: 325,
|
|
2171
2200
|
S: this,
|
|
2172
2201
|
C: (f, a) => f(...a)
|
|
2173
2202
|
});
|
|
@@ -2188,7 +2217,7 @@ var InvitationsHandler = class {
|
|
|
2188
2217
|
attempt
|
|
2189
2218
|
}, {
|
|
2190
2219
|
F: __dxlog_file7,
|
|
2191
|
-
L:
|
|
2220
|
+
L: 336,
|
|
2192
2221
|
S: this,
|
|
2193
2222
|
C: (f, a) => f(...a)
|
|
2194
2223
|
});
|
|
@@ -2201,7 +2230,7 @@ var InvitationsHandler = class {
|
|
|
2201
2230
|
...protocol.toJSON()
|
|
2202
2231
|
}, {
|
|
2203
2232
|
F: __dxlog_file7,
|
|
2204
|
-
L:
|
|
2233
|
+
L: 344,
|
|
2205
2234
|
S: this,
|
|
2206
2235
|
C: (f, a) => f(...a)
|
|
2207
2236
|
});
|
|
@@ -2213,7 +2242,7 @@ var InvitationsHandler = class {
|
|
|
2213
2242
|
...protocol.toJSON()
|
|
2214
2243
|
}, {
|
|
2215
2244
|
F: __dxlog_file7,
|
|
2216
|
-
L:
|
|
2245
|
+
L: 355,
|
|
2217
2246
|
S: this,
|
|
2218
2247
|
C: (f, a) => f(...a)
|
|
2219
2248
|
});
|
|
@@ -2226,7 +2255,7 @@ var InvitationsHandler = class {
|
|
|
2226
2255
|
id: traceId
|
|
2227
2256
|
}), {
|
|
2228
2257
|
F: __dxlog_file7,
|
|
2229
|
-
L:
|
|
2258
|
+
L: 357,
|
|
2230
2259
|
S: this,
|
|
2231
2260
|
C: (f, a) => f(...a)
|
|
2232
2261
|
});
|
|
@@ -2236,7 +2265,7 @@ var InvitationsHandler = class {
|
|
|
2236
2265
|
...protocol.toJSON()
|
|
2237
2266
|
}, {
|
|
2238
2267
|
F: __dxlog_file7,
|
|
2239
|
-
L:
|
|
2268
|
+
L: 360,
|
|
2240
2269
|
S: this,
|
|
2241
2270
|
C: (f, a) => f(...a)
|
|
2242
2271
|
});
|
|
@@ -2246,7 +2275,7 @@ var InvitationsHandler = class {
|
|
|
2246
2275
|
} else {
|
|
2247
2276
|
(0, import_log4.log)("auth failed", err, {
|
|
2248
2277
|
F: __dxlog_file7,
|
|
2249
|
-
L:
|
|
2278
|
+
L: 363,
|
|
2250
2279
|
S: this,
|
|
2251
2280
|
C: (f, a) => f(...a)
|
|
2252
2281
|
});
|
|
@@ -2257,7 +2286,7 @@ var InvitationsHandler = class {
|
|
|
2257
2286
|
error: err
|
|
2258
2287
|
}), {
|
|
2259
2288
|
F: __dxlog_file7,
|
|
2260
|
-
L:
|
|
2289
|
+
L: 366,
|
|
2261
2290
|
S: this,
|
|
2262
2291
|
C: (f, a) => f(...a)
|
|
2263
2292
|
});
|
|
@@ -2275,7 +2304,7 @@ var InvitationsHandler = class {
|
|
|
2275
2304
|
...protocol.toJSON()
|
|
2276
2305
|
}, {
|
|
2277
2306
|
F: __dxlog_file7,
|
|
2278
|
-
L:
|
|
2307
|
+
L: 377,
|
|
2279
2308
|
S: this,
|
|
2280
2309
|
C: (f, a) => f(...a)
|
|
2281
2310
|
});
|
|
@@ -2285,7 +2314,7 @@ var InvitationsHandler = class {
|
|
|
2285
2314
|
} else {
|
|
2286
2315
|
(0, import_log4.log)("auth failed", err, {
|
|
2287
2316
|
F: __dxlog_file7,
|
|
2288
|
-
L:
|
|
2317
|
+
L: 380,
|
|
2289
2318
|
S: this,
|
|
2290
2319
|
C: (f, a) => f(...a)
|
|
2291
2320
|
});
|
|
@@ -2302,7 +2331,7 @@ var InvitationsHandler = class {
|
|
|
2302
2331
|
} else {
|
|
2303
2332
|
(0, import_invariant5.invariant)(invitation.swarmKey, void 0, {
|
|
2304
2333
|
F: __dxlog_file7,
|
|
2305
|
-
L:
|
|
2334
|
+
L: 394,
|
|
2306
2335
|
S: this,
|
|
2307
2336
|
A: [
|
|
2308
2337
|
"invitation.swarmKey",
|
|
@@ -2341,17 +2370,24 @@ var InvitationsHandler = class {
|
|
|
2341
2370
|
return observable;
|
|
2342
2371
|
}
|
|
2343
2372
|
};
|
|
2373
|
+
var invitationExpired = (invitation) => {
|
|
2374
|
+
return invitation.created && invitation.lifetime && invitation.lifetime !== 0 && invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now();
|
|
2375
|
+
};
|
|
2344
2376
|
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-service.ts";
|
|
2345
2377
|
var InvitationsServiceImpl = class {
|
|
2346
|
-
constructor(_invitationsHandler, _getHandler) {
|
|
2378
|
+
constructor(_invitationsHandler, _getHandler, _metadataStore) {
|
|
2347
2379
|
this._invitationsHandler = _invitationsHandler;
|
|
2348
2380
|
this._getHandler = _getHandler;
|
|
2381
|
+
this._metadataStore = _metadataStore;
|
|
2349
2382
|
this._createInvitations = /* @__PURE__ */ new Map();
|
|
2350
2383
|
this._acceptInvitations = /* @__PURE__ */ new Map();
|
|
2351
2384
|
this._invitationCreated = new import_async9.Event();
|
|
2352
2385
|
this._invitationAccepted = new import_async9.Event();
|
|
2353
2386
|
this._removedCreated = new import_async9.Event();
|
|
2354
2387
|
this._removedAccepted = new import_async9.Event();
|
|
2388
|
+
this._saved = new import_async9.Event();
|
|
2389
|
+
this._persistentInvitationsLoadedEvent = new import_async9.Event();
|
|
2390
|
+
this._persistentInvitationsLoaded = false;
|
|
2355
2391
|
}
|
|
2356
2392
|
// TODO(burdon): Guest/host label.
|
|
2357
2393
|
getLoggingContext() {
|
|
@@ -2359,6 +2395,7 @@ var InvitationsServiceImpl = class {
|
|
|
2359
2395
|
}
|
|
2360
2396
|
createInvitation(options) {
|
|
2361
2397
|
let invitation;
|
|
2398
|
+
const savePersistentInvitationCtx = new import_context6.Context();
|
|
2362
2399
|
const existingInvitation = this._createInvitations.get(options.invitationId);
|
|
2363
2400
|
if (existingInvitation) {
|
|
2364
2401
|
invitation = existingInvitation;
|
|
@@ -2369,12 +2406,27 @@ var InvitationsServiceImpl = class {
|
|
|
2369
2406
|
this._invitationCreated.emit(invitation.get());
|
|
2370
2407
|
}
|
|
2371
2408
|
return new import_codec_protobuf8.Stream(({ next, close }) => {
|
|
2409
|
+
if (invitation.get().persistent) {
|
|
2410
|
+
(0, import_async9.scheduleTask)(savePersistentInvitationCtx, async () => {
|
|
2411
|
+
try {
|
|
2412
|
+
await this._metadataStore.addInvitation(invitation.get());
|
|
2413
|
+
this._saved.emit(invitation.get());
|
|
2414
|
+
} catch (err) {
|
|
2415
|
+
close(err);
|
|
2416
|
+
}
|
|
2417
|
+
});
|
|
2418
|
+
}
|
|
2372
2419
|
invitation.subscribe((invitation2) => {
|
|
2373
2420
|
next(invitation2);
|
|
2374
|
-
}, (err) => {
|
|
2421
|
+
}, async (err) => {
|
|
2422
|
+
await savePersistentInvitationCtx.dispose();
|
|
2375
2423
|
close(err);
|
|
2376
|
-
}, () => {
|
|
2424
|
+
}, async () => {
|
|
2377
2425
|
close();
|
|
2426
|
+
if (invitation.get().persistent) {
|
|
2427
|
+
await savePersistentInvitationCtx.dispose();
|
|
2428
|
+
await this._metadataStore.removeInvitation(invitation.get().invitationId);
|
|
2429
|
+
}
|
|
2378
2430
|
this._createInvitations.delete(invitation.get().invitationId);
|
|
2379
2431
|
if (invitation.get().type !== import_services5.Invitation.Type.MULTIUSE) {
|
|
2380
2432
|
this._removedCreated.emit(invitation.get());
|
|
@@ -2382,12 +2434,37 @@ var InvitationsServiceImpl = class {
|
|
|
2382
2434
|
});
|
|
2383
2435
|
});
|
|
2384
2436
|
}
|
|
2437
|
+
async loadPersistentInvitations() {
|
|
2438
|
+
const persistentInvitations = this._metadataStore.getInvitations();
|
|
2439
|
+
const freshInvitations = persistentInvitations.filter(async (invitation) => !invitationExpired(invitation));
|
|
2440
|
+
const cInvitations = freshInvitations.map((persistentInvitation) => {
|
|
2441
|
+
(0, import_invariant7.invariant)(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
|
|
2442
|
+
F: __dxlog_file8,
|
|
2443
|
+
L: 109,
|
|
2444
|
+
S: this,
|
|
2445
|
+
A: [
|
|
2446
|
+
"!this._createInvitations.get(persistentInvitation.invitationId)",
|
|
2447
|
+
"'invitation already exists'"
|
|
2448
|
+
]
|
|
2449
|
+
});
|
|
2450
|
+
const handler = this._getHandler(persistentInvitation);
|
|
2451
|
+
const invitation = this._invitationsHandler.createInvitation(handler, persistentInvitation);
|
|
2452
|
+
this._createInvitations.set(invitation.get().invitationId, invitation);
|
|
2453
|
+
this._invitationCreated.emit(invitation.get());
|
|
2454
|
+
return persistentInvitation;
|
|
2455
|
+
});
|
|
2456
|
+
this._persistentInvitationsLoadedEvent.emit();
|
|
2457
|
+
this._persistentInvitationsLoaded = true;
|
|
2458
|
+
return {
|
|
2459
|
+
invitations: cInvitations
|
|
2460
|
+
};
|
|
2461
|
+
}
|
|
2385
2462
|
acceptInvitation({ invitation: options, deviceProfile }) {
|
|
2386
2463
|
let invitation;
|
|
2387
2464
|
if (deviceProfile) {
|
|
2388
2465
|
(0, import_invariant7.invariant)(options.kind === import_services5.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
2389
2466
|
F: __dxlog_file8,
|
|
2390
|
-
L:
|
|
2467
|
+
L: 127,
|
|
2391
2468
|
S: this,
|
|
2392
2469
|
A: [
|
|
2393
2470
|
"options.kind === Invitation.Kind.DEVICE",
|
|
@@ -2421,13 +2498,13 @@ var InvitationsServiceImpl = class {
|
|
|
2421
2498
|
async authenticate({ invitationId, authCode }) {
|
|
2422
2499
|
(0, import_log6.log)("authenticating...", void 0, {
|
|
2423
2500
|
F: __dxlog_file8,
|
|
2424
|
-
L:
|
|
2501
|
+
L: 160,
|
|
2425
2502
|
S: this,
|
|
2426
2503
|
C: (f, a) => f(...a)
|
|
2427
2504
|
});
|
|
2428
2505
|
(0, import_invariant7.invariant)(invitationId, void 0, {
|
|
2429
2506
|
F: __dxlog_file8,
|
|
2430
|
-
L:
|
|
2507
|
+
L: 161,
|
|
2431
2508
|
S: this,
|
|
2432
2509
|
A: [
|
|
2433
2510
|
"invitationId",
|
|
@@ -2440,7 +2517,7 @@ var InvitationsServiceImpl = class {
|
|
|
2440
2517
|
invitationId
|
|
2441
2518
|
}, {
|
|
2442
2519
|
F: __dxlog_file8,
|
|
2443
|
-
L:
|
|
2520
|
+
L: 164,
|
|
2444
2521
|
S: this,
|
|
2445
2522
|
C: (f, a) => f(...a)
|
|
2446
2523
|
});
|
|
@@ -2449,15 +2526,17 @@ var InvitationsServiceImpl = class {
|
|
|
2449
2526
|
}
|
|
2450
2527
|
}
|
|
2451
2528
|
async cancelInvitation({ invitationId }) {
|
|
2452
|
-
(0, import_log6.log)("
|
|
2529
|
+
(0, import_log6.log)("cancelInvitation...", {
|
|
2530
|
+
invitationId
|
|
2531
|
+
}, {
|
|
2453
2532
|
F: __dxlog_file8,
|
|
2454
|
-
L:
|
|
2533
|
+
L: 171,
|
|
2455
2534
|
S: this,
|
|
2456
2535
|
C: (f, a) => f(...a)
|
|
2457
2536
|
});
|
|
2458
2537
|
(0, import_invariant7.invariant)(invitationId, void 0, {
|
|
2459
2538
|
F: __dxlog_file8,
|
|
2460
|
-
L:
|
|
2539
|
+
L: 172,
|
|
2461
2540
|
S: this,
|
|
2462
2541
|
A: [
|
|
2463
2542
|
"invitationId",
|
|
@@ -2470,6 +2549,9 @@ var InvitationsServiceImpl = class {
|
|
|
2470
2549
|
await created.cancel();
|
|
2471
2550
|
this._createInvitations.delete(invitationId);
|
|
2472
2551
|
this._removedCreated.emit(created.get());
|
|
2552
|
+
if (created.get().persistent) {
|
|
2553
|
+
await this._metadataStore.removeInvitation(created.get().invitationId);
|
|
2554
|
+
}
|
|
2473
2555
|
} else if (accepted) {
|
|
2474
2556
|
await accepted.cancel();
|
|
2475
2557
|
this._acceptInvitations.delete(invitationId);
|
|
@@ -2514,16 +2596,40 @@ var InvitationsServiceImpl = class {
|
|
|
2514
2596
|
]
|
|
2515
2597
|
});
|
|
2516
2598
|
});
|
|
2599
|
+
this._saved.on(ctx, (invitation) => {
|
|
2600
|
+
next({
|
|
2601
|
+
action: import_services5.QueryInvitationsResponse.Action.SAVED,
|
|
2602
|
+
type: import_services5.QueryInvitationsResponse.Type.CREATED,
|
|
2603
|
+
invitations: [
|
|
2604
|
+
invitation
|
|
2605
|
+
]
|
|
2606
|
+
});
|
|
2607
|
+
});
|
|
2517
2608
|
next({
|
|
2518
2609
|
action: import_services5.QueryInvitationsResponse.Action.ADDED,
|
|
2519
2610
|
type: import_services5.QueryInvitationsResponse.Type.CREATED,
|
|
2520
|
-
invitations: Array.from(this._createInvitations.values()).map((invitation) => invitation.get())
|
|
2611
|
+
invitations: Array.from(this._createInvitations.values()).map((invitation) => invitation.get()),
|
|
2612
|
+
existing: true
|
|
2521
2613
|
});
|
|
2522
2614
|
next({
|
|
2523
2615
|
action: import_services5.QueryInvitationsResponse.Action.ADDED,
|
|
2524
2616
|
type: import_services5.QueryInvitationsResponse.Type.ACCEPTED,
|
|
2525
|
-
invitations: Array.from(this._acceptInvitations.values()).map((invitation) => invitation.get())
|
|
2617
|
+
invitations: Array.from(this._acceptInvitations.values()).map((invitation) => invitation.get()),
|
|
2618
|
+
existing: true
|
|
2526
2619
|
});
|
|
2620
|
+
if (this._persistentInvitationsLoaded) {
|
|
2621
|
+
next({
|
|
2622
|
+
action: import_services5.QueryInvitationsResponse.Action.LOAD_COMPLETE,
|
|
2623
|
+
type: import_services5.QueryInvitationsResponse.Type.CREATED
|
|
2624
|
+
});
|
|
2625
|
+
} else {
|
|
2626
|
+
this._persistentInvitationsLoadedEvent.on(ctx, () => {
|
|
2627
|
+
next({
|
|
2628
|
+
action: import_services5.QueryInvitationsResponse.Action.LOAD_COMPLETE,
|
|
2629
|
+
type: import_services5.QueryInvitationsResponse.Type.CREATED
|
|
2630
|
+
});
|
|
2631
|
+
});
|
|
2632
|
+
}
|
|
2527
2633
|
});
|
|
2528
2634
|
}
|
|
2529
2635
|
};
|
|
@@ -2784,7 +2890,7 @@ var getPlatform = () => {
|
|
|
2784
2890
|
};
|
|
2785
2891
|
}
|
|
2786
2892
|
};
|
|
2787
|
-
var DXOS_VERSION = "0.4.
|
|
2893
|
+
var DXOS_VERSION = "0.4.8-main.00e6f19";
|
|
2788
2894
|
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
|
|
2789
2895
|
var DEFAULT_TIMEOUT = 1e3;
|
|
2790
2896
|
var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
@@ -2927,6 +3033,7 @@ var AutomergeSpaceState = class {
|
|
|
2927
3033
|
this._onNewRoot = _onNewRoot;
|
|
2928
3034
|
this.rootUrl = void 0;
|
|
2929
3035
|
this.lastEpoch = void 0;
|
|
3036
|
+
this._isProcessingRootDocs = false;
|
|
2930
3037
|
}
|
|
2931
3038
|
async processCredential(credential) {
|
|
2932
3039
|
if (!(0, import_credentials11.checkCredentialType)(credential, "dxos.halo.credentials.Epoch")) {
|
|
@@ -2935,8 +3042,19 @@ var AutomergeSpaceState = class {
|
|
|
2935
3042
|
this.lastEpoch = credential;
|
|
2936
3043
|
if (credential.subject.assertion.automergeRoot) {
|
|
2937
3044
|
this.rootUrl = credential.subject.assertion.automergeRoot;
|
|
3045
|
+
if (this._isProcessingRootDocs) {
|
|
3046
|
+
this._onNewRoot(this.rootUrl);
|
|
3047
|
+
}
|
|
3048
|
+
}
|
|
3049
|
+
}
|
|
3050
|
+
startProcessingRootDocs() {
|
|
3051
|
+
if (this._isProcessingRootDocs) {
|
|
3052
|
+
return;
|
|
3053
|
+
}
|
|
3054
|
+
if (this.rootUrl) {
|
|
2938
3055
|
this._onNewRoot(this.rootUrl);
|
|
2939
3056
|
}
|
|
3057
|
+
this._isProcessingRootDocs = true;
|
|
2940
3058
|
}
|
|
2941
3059
|
};
|
|
2942
3060
|
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
|
|
@@ -2946,7 +3064,7 @@ var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
|
|
|
2946
3064
|
var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
|
|
2947
3065
|
var NotarizationPlugin = class {
|
|
2948
3066
|
constructor() {
|
|
2949
|
-
this._ctx = new
|
|
3067
|
+
this._ctx = new import_context8.Context();
|
|
2950
3068
|
this._extensionOpened = new import_async11.Event();
|
|
2951
3069
|
this._extensions = /* @__PURE__ */ new Set();
|
|
2952
3070
|
this._processedCredentials = new import_util5.ComplexSet(import_keys8.PublicKey.hash);
|
|
@@ -3071,7 +3189,7 @@ var NotarizationPlugin = class {
|
|
|
3071
3189
|
this._extensionOpened.on(ctx, () => notarizeTask.schedule());
|
|
3072
3190
|
try {
|
|
3073
3191
|
await Promise.race([
|
|
3074
|
-
(0,
|
|
3192
|
+
(0, import_context8.rejectOnDispose)(ctx),
|
|
3075
3193
|
allNotarized,
|
|
3076
3194
|
errors.wait()
|
|
3077
3195
|
]);
|
|
@@ -3211,7 +3329,7 @@ var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
|
|
|
3211
3329
|
var ENABLE_FEED_PURGE = false;
|
|
3212
3330
|
var DataSpace = class {
|
|
3213
3331
|
constructor(params) {
|
|
3214
|
-
this._ctx = new
|
|
3332
|
+
this._ctx = new import_context7.Context();
|
|
3215
3333
|
this._notarizationPlugin = new NotarizationPlugin();
|
|
3216
3334
|
this._cache = void 0;
|
|
3217
3335
|
this._automergeSpaceState = new AutomergeSpaceState((rootUrl) => this._onNewAutomergeRoot(rootUrl));
|
|
@@ -3287,7 +3405,7 @@ var DataSpace = class {
|
|
|
3287
3405
|
await this._notarizationPlugin.open();
|
|
3288
3406
|
await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
|
|
3289
3407
|
await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
|
|
3290
|
-
await this._inner.open(new
|
|
3408
|
+
await this._inner.open(new import_context7.Context());
|
|
3291
3409
|
this._state = import_services9.SpaceState.CONTROL_ONLY;
|
|
3292
3410
|
(0, import_log9.log)("new state", {
|
|
3293
3411
|
state: import_services9.SpaceState[this._state]
|
|
@@ -3316,7 +3434,7 @@ var DataSpace = class {
|
|
|
3316
3434
|
C: (f, a) => f(...a)
|
|
3317
3435
|
});
|
|
3318
3436
|
await this._ctx.dispose();
|
|
3319
|
-
this._ctx = new
|
|
3437
|
+
this._ctx = new import_context7.Context();
|
|
3320
3438
|
await this.authVerifier.close();
|
|
3321
3439
|
await this._inner.close();
|
|
3322
3440
|
await this._inner.spaceState.removeCredentialProcessor(this._automergeSpaceState);
|
|
@@ -3340,7 +3458,7 @@ var DataSpace = class {
|
|
|
3340
3458
|
this.metrics.pipelineInitBegin = /* @__PURE__ */ new Date();
|
|
3341
3459
|
await this.initializeDataPipeline();
|
|
3342
3460
|
} catch (err) {
|
|
3343
|
-
if (err instanceof import_protocols8.CancelledError || err instanceof
|
|
3461
|
+
if (err instanceof import_protocols8.CancelledError || err instanceof import_context7.ContextDisposedError) {
|
|
3344
3462
|
(0, import_log9.log)("data pipeline initialization cancelled", err, {
|
|
3345
3463
|
F: __dxlog_file12,
|
|
3346
3464
|
L: 250,
|
|
@@ -3386,12 +3504,13 @@ var DataSpace = class {
|
|
|
3386
3504
|
});
|
|
3387
3505
|
await this._initializeAndReadControlPipeline();
|
|
3388
3506
|
await (0, import_async10.sleep)(1);
|
|
3507
|
+
this._automergeSpaceState.startProcessingRootDocs();
|
|
3389
3508
|
await this._inner.initializeDataPipeline();
|
|
3390
3509
|
this.metrics.dataPipelineOpen = /* @__PURE__ */ new Date();
|
|
3391
|
-
await (0,
|
|
3510
|
+
await (0, import_context7.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
|
|
3392
3511
|
(0, import_log9.log)("waiting for data pipeline to reach target timeframe", void 0, {
|
|
3393
3512
|
F: __dxlog_file12,
|
|
3394
|
-
L:
|
|
3513
|
+
L: 288,
|
|
3395
3514
|
S: this,
|
|
3396
3515
|
C: (f, a) => f(...a)
|
|
3397
3516
|
});
|
|
@@ -3402,7 +3521,7 @@ var DataSpace = class {
|
|
|
3402
3521
|
this.metrics.dataPipelineReady = /* @__PURE__ */ new Date();
|
|
3403
3522
|
(0, import_log9.log)("data pipeline ready", void 0, {
|
|
3404
3523
|
F: __dxlog_file12,
|
|
3405
|
-
L:
|
|
3524
|
+
L: 296,
|
|
3406
3525
|
S: this,
|
|
3407
3526
|
C: (f, a) => f(...a)
|
|
3408
3527
|
});
|
|
@@ -3412,7 +3531,7 @@ var DataSpace = class {
|
|
|
3412
3531
|
state: import_services9.SpaceState[this._state]
|
|
3413
3532
|
}, {
|
|
3414
3533
|
F: __dxlog_file12,
|
|
3415
|
-
L:
|
|
3534
|
+
L: 300,
|
|
3416
3535
|
S: this,
|
|
3417
3536
|
C: (f, a) => f(...a)
|
|
3418
3537
|
});
|
|
@@ -3428,7 +3547,7 @@ var DataSpace = class {
|
|
|
3428
3547
|
await this._createWritableFeeds();
|
|
3429
3548
|
(0, import_log9.log)("writable feeds created", void 0, {
|
|
3430
3549
|
F: __dxlog_file12,
|
|
3431
|
-
L:
|
|
3550
|
+
L: 316,
|
|
3432
3551
|
S: this,
|
|
3433
3552
|
C: (f, a) => f(...a)
|
|
3434
3553
|
});
|
|
@@ -3491,7 +3610,7 @@ var DataSpace = class {
|
|
|
3491
3610
|
rootUrl
|
|
3492
3611
|
}, {
|
|
3493
3612
|
F: __dxlog_file12,
|
|
3494
|
-
L:
|
|
3613
|
+
L: 382,
|
|
3495
3614
|
S: this,
|
|
3496
3615
|
C: (f, a) => f(...a)
|
|
3497
3616
|
});
|
|
@@ -3500,7 +3619,7 @@ var DataSpace = class {
|
|
|
3500
3619
|
queueMicrotask(async () => {
|
|
3501
3620
|
try {
|
|
3502
3621
|
await (0, import_debug3.warnAfterTimeout)(5e3, "Automerge root doc load timeout (DataSpace)", async () => {
|
|
3503
|
-
await (0,
|
|
3622
|
+
await (0, import_context7.cancelWithContext)(this._ctx, handle.whenReady());
|
|
3504
3623
|
});
|
|
3505
3624
|
if (this._ctx.disposed) {
|
|
3506
3625
|
return;
|
|
@@ -3514,7 +3633,7 @@ var DataSpace = class {
|
|
|
3514
3633
|
});
|
|
3515
3634
|
}
|
|
3516
3635
|
} catch (err) {
|
|
3517
|
-
if (err instanceof
|
|
3636
|
+
if (err instanceof import_context7.ContextDisposedError) {
|
|
3518
3637
|
return;
|
|
3519
3638
|
}
|
|
3520
3639
|
import_log9.log.warn("error loading automerge root doc", {
|
|
@@ -3523,7 +3642,7 @@ var DataSpace = class {
|
|
|
3523
3642
|
err
|
|
3524
3643
|
}, {
|
|
3525
3644
|
F: __dxlog_file12,
|
|
3526
|
-
L:
|
|
3645
|
+
L: 405,
|
|
3527
3646
|
S: this,
|
|
3528
3647
|
C: (f, a) => f(...a)
|
|
3529
3648
|
});
|
|
@@ -3554,15 +3673,40 @@ var DataSpace = class {
|
|
|
3554
3673
|
epoch = await this.dataPipeline.createEpoch();
|
|
3555
3674
|
}
|
|
3556
3675
|
break;
|
|
3557
|
-
case import_services9.CreateEpochRequest.Migration.INIT_AUTOMERGE:
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3676
|
+
case import_services9.CreateEpochRequest.Migration.INIT_AUTOMERGE:
|
|
3677
|
+
{
|
|
3678
|
+
const document = this._automergeHost.repo.create();
|
|
3679
|
+
epoch = {
|
|
3680
|
+
previousId: this._automergeSpaceState.lastEpoch?.id,
|
|
3681
|
+
number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
|
|
3682
|
+
timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe2.Timeframe(),
|
|
3683
|
+
automergeRoot: document.url
|
|
3684
|
+
};
|
|
3685
|
+
}
|
|
3686
|
+
break;
|
|
3687
|
+
case import_services9.CreateEpochRequest.Migration.PRUNE_AUTOMERGE_ROOT_HISTORY:
|
|
3688
|
+
{
|
|
3689
|
+
const currentRootUrl = this._automergeSpaceState.rootUrl;
|
|
3690
|
+
const rootHandle = this._automergeHost.repo.find(currentRootUrl);
|
|
3691
|
+
await (0, import_context7.cancelWithContext)(this._ctx, (0, import_async10.asyncTimeout)(rootHandle.whenReady(), 1e4));
|
|
3692
|
+
const newRoot = this._automergeHost.repo.create(rootHandle.docSync());
|
|
3693
|
+
(0, import_invariant10.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
3694
|
+
F: __dxlog_file12,
|
|
3695
|
+
L: 450,
|
|
3696
|
+
S: this,
|
|
3697
|
+
A: [
|
|
3698
|
+
"typeof newRoot.url === 'string' && newRoot.url.length > 0",
|
|
3699
|
+
""
|
|
3700
|
+
]
|
|
3701
|
+
});
|
|
3702
|
+
epoch = {
|
|
3703
|
+
previousId: this._automergeSpaceState.lastEpoch?.id,
|
|
3704
|
+
number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
|
|
3705
|
+
timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe2.Timeframe(),
|
|
3706
|
+
automergeRoot: newRoot.url
|
|
3707
|
+
};
|
|
3708
|
+
}
|
|
3709
|
+
break;
|
|
3566
3710
|
}
|
|
3567
3711
|
if (!epoch) {
|
|
3568
3712
|
return;
|
|
@@ -3613,7 +3757,7 @@ var DataSpace = class {
|
|
|
3613
3757
|
state: import_services9.SpaceState[this._state]
|
|
3614
3758
|
}, {
|
|
3615
3759
|
F: __dxlog_file12,
|
|
3616
|
-
L:
|
|
3760
|
+
L: 514,
|
|
3617
3761
|
S: this,
|
|
3618
3762
|
C: (f, a) => f(...a)
|
|
3619
3763
|
});
|
|
@@ -3751,7 +3895,7 @@ var DataSpaceManager = class {
|
|
|
3751
3895
|
this._signingContext = _signingContext;
|
|
3752
3896
|
this._feedStore = _feedStore;
|
|
3753
3897
|
this._automergeHost = _automergeHost;
|
|
3754
|
-
this._ctx = new
|
|
3898
|
+
this._ctx = new import_context9.Context();
|
|
3755
3899
|
this.updated = new import_async12.Event();
|
|
3756
3900
|
this._spaces = new import_util6.ComplexMap(import_keys9.PublicKey.hash);
|
|
3757
3901
|
this._isOpen = false;
|
|
@@ -3940,7 +4084,7 @@ var DataSpaceManager = class {
|
|
|
3940
4084
|
* TODO(dmaretskyi): Consider removing.
|
|
3941
4085
|
*/
|
|
3942
4086
|
async waitUntilSpaceReady(spaceKey) {
|
|
3943
|
-
await (0,
|
|
4087
|
+
await (0, import_context9.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
|
|
3944
4088
|
const space = this._spaces.get(spaceKey);
|
|
3945
4089
|
return !!space && space.state === import_services10.SpaceState.READY;
|
|
3946
4090
|
}));
|
|
@@ -4240,10 +4384,12 @@ var SpacesServiceImpl = class {
|
|
|
4240
4384
|
}
|
|
4241
4385
|
}
|
|
4242
4386
|
}
|
|
4243
|
-
async createEpoch({ spaceKey }) {
|
|
4387
|
+
async createEpoch({ spaceKey, migration }) {
|
|
4244
4388
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
4245
4389
|
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
|
|
4246
|
-
await space.createEpoch(
|
|
4390
|
+
await space.createEpoch({
|
|
4391
|
+
migration
|
|
4392
|
+
});
|
|
4247
4393
|
}
|
|
4248
4394
|
_serializeSpace(space) {
|
|
4249
4395
|
return {
|
|
@@ -4285,6 +4431,80 @@ var SpacesServiceImpl = class {
|
|
|
4285
4431
|
}
|
|
4286
4432
|
};
|
|
4287
4433
|
var getChannelId = (channel) => `user-channel/${channel}`;
|
|
4434
|
+
var createLoadDocuments = (automergeHost) => (
|
|
4435
|
+
/**
|
|
4436
|
+
* Get object data blobs from Automerge Repo by ids.
|
|
4437
|
+
* @param ids
|
|
4438
|
+
*/
|
|
4439
|
+
// TODO(mykola): Unload automerge handles after usage.
|
|
4440
|
+
async function* loadDocuments(ids) {
|
|
4441
|
+
for (const id of ids) {
|
|
4442
|
+
const { documentId, objectId } = import_protocols13.idCodec.decode(id);
|
|
4443
|
+
const handle = automergeHost.repo.find(documentId);
|
|
4444
|
+
await (0, import_debug7.warnAfterTimeout)(5e3, "to long to load doc", () => handle.whenReady());
|
|
4445
|
+
const doc = handle.docSync();
|
|
4446
|
+
const heads = (0, import_automerge.getHeads)(doc);
|
|
4447
|
+
yield [
|
|
4448
|
+
{
|
|
4449
|
+
id,
|
|
4450
|
+
object: doc.objects[objectId],
|
|
4451
|
+
currentHash: heads.at(-1)
|
|
4452
|
+
}
|
|
4453
|
+
];
|
|
4454
|
+
}
|
|
4455
|
+
}
|
|
4456
|
+
);
|
|
4457
|
+
var createGetAllDocuments = (automergeHost) => (
|
|
4458
|
+
/**
|
|
4459
|
+
* Recursively get all object data blobs from Automerge Repo.
|
|
4460
|
+
* @param ids
|
|
4461
|
+
*/
|
|
4462
|
+
// TODO(mykola): Unload automerge handles after usage.
|
|
4463
|
+
async function* getAllDocuments() {
|
|
4464
|
+
const visited = /* @__PURE__ */ new Set();
|
|
4465
|
+
async function* getObjectsFromHandle(handle) {
|
|
4466
|
+
if (visited.has(handle.documentId)) {
|
|
4467
|
+
return;
|
|
4468
|
+
}
|
|
4469
|
+
await (0, import_debug7.warnAfterTimeout)(5e3, "to long to load doc", () => handle.whenReady());
|
|
4470
|
+
const doc = handle.docSync();
|
|
4471
|
+
const heads = (0, import_automerge.getHeads)(doc);
|
|
4472
|
+
if (doc.objects) {
|
|
4473
|
+
yield Object.entries(doc.objects).map(([objectId, object]) => {
|
|
4474
|
+
return {
|
|
4475
|
+
id: import_protocols13.idCodec.encode({
|
|
4476
|
+
documentId: handle.documentId,
|
|
4477
|
+
objectId
|
|
4478
|
+
}),
|
|
4479
|
+
object,
|
|
4480
|
+
currentHash: heads.at(-1)
|
|
4481
|
+
};
|
|
4482
|
+
});
|
|
4483
|
+
}
|
|
4484
|
+
if (doc.links) {
|
|
4485
|
+
for (const id of Object.values(doc.links)) {
|
|
4486
|
+
if (visited.has(id)) {
|
|
4487
|
+
continue;
|
|
4488
|
+
}
|
|
4489
|
+
const linkHandle = automergeHost.repo.find(id);
|
|
4490
|
+
for await (const result of getObjectsFromHandle(linkHandle)) {
|
|
4491
|
+
yield result;
|
|
4492
|
+
}
|
|
4493
|
+
}
|
|
4494
|
+
}
|
|
4495
|
+
visited.add(handle.documentId);
|
|
4496
|
+
}
|
|
4497
|
+
for (const handle of Object.values(automergeHost.repo.handles)) {
|
|
4498
|
+
if (visited.has(handle.documentId)) {
|
|
4499
|
+
continue;
|
|
4500
|
+
}
|
|
4501
|
+
for await (const result of getObjectsFromHandle(handle)) {
|
|
4502
|
+
yield result;
|
|
4503
|
+
}
|
|
4504
|
+
visited.add(handle.documentId);
|
|
4505
|
+
}
|
|
4506
|
+
}
|
|
4507
|
+
);
|
|
4288
4508
|
function _ts_decorate6(decorators, target, key, desc) {
|
|
4289
4509
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4290
4510
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -4308,9 +4528,6 @@ var ServiceContext = class {
|
|
|
4308
4528
|
this._handlerFactories = /* @__PURE__ */ new Map();
|
|
4309
4529
|
this._instanceId = import_keys10.PublicKey.random().toHex();
|
|
4310
4530
|
this.metadataStore = new import_echo_pipeline2.MetadataStore(storage.createDirectory("metadata"));
|
|
4311
|
-
this.indexMetadata = new import_echo_schema.IndexMetadataStore({
|
|
4312
|
-
directory: storage.createDirectory("index-metadata")
|
|
4313
|
-
});
|
|
4314
4531
|
this.snapshotStore = new import_echo_pipeline2.SnapshotStore(storage.createDirectory("snapshots"));
|
|
4315
4532
|
this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
|
|
4316
4533
|
this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
|
|
@@ -4333,10 +4550,21 @@ var ServiceContext = class {
|
|
|
4333
4550
|
snapshotStore: this.snapshotStore
|
|
4334
4551
|
});
|
|
4335
4552
|
this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager, this._runtimeParams);
|
|
4553
|
+
this.indexMetadata = new import_indexing.IndexMetadataStore({
|
|
4554
|
+
directory: storage.createDirectory("index-metadata")
|
|
4555
|
+
});
|
|
4336
4556
|
this.automergeHost = new import_echo_pipeline2.AutomergeHost({
|
|
4337
4557
|
directory: storage.createDirectory("automerge"),
|
|
4338
4558
|
metadata: this.indexMetadata
|
|
4339
4559
|
});
|
|
4560
|
+
this.indexer = new import_indexing.Indexer({
|
|
4561
|
+
indexStore: new import_indexing.IndexStore({
|
|
4562
|
+
directory: storage.createDirectory("index-store")
|
|
4563
|
+
}),
|
|
4564
|
+
metadataStore: this.indexMetadata,
|
|
4565
|
+
loadDocuments: createLoadDocuments(this.automergeHost),
|
|
4566
|
+
getAllDocuments: createGetAllDocuments(this.automergeHost)
|
|
4567
|
+
});
|
|
4340
4568
|
this.invitations = new InvitationsHandler(this.networkManager);
|
|
4341
4569
|
this._handlerFactories.set(import_services12.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? (0, import_debug6.failUndefined)(), this._acceptIdentity.bind(this)));
|
|
4342
4570
|
}
|
|
@@ -4344,7 +4572,7 @@ var ServiceContext = class {
|
|
|
4344
4572
|
await this._checkStorageVersion();
|
|
4345
4573
|
(0, import_log13.log)("opening...", void 0, {
|
|
4346
4574
|
F: __dxlog_file15,
|
|
4347
|
-
L:
|
|
4575
|
+
L: 162,
|
|
4348
4576
|
S: this,
|
|
4349
4577
|
C: (f, a) => f(...a)
|
|
4350
4578
|
});
|
|
@@ -4352,7 +4580,7 @@ var ServiceContext = class {
|
|
|
4352
4580
|
id: this._instanceId
|
|
4353
4581
|
}), {
|
|
4354
4582
|
F: __dxlog_file15,
|
|
4355
|
-
L:
|
|
4583
|
+
L: 163,
|
|
4356
4584
|
S: this,
|
|
4357
4585
|
C: (f, a) => f(...a)
|
|
4358
4586
|
});
|
|
@@ -4368,13 +4596,13 @@ var ServiceContext = class {
|
|
|
4368
4596
|
id: this._instanceId
|
|
4369
4597
|
}), {
|
|
4370
4598
|
F: __dxlog_file15,
|
|
4371
|
-
L:
|
|
4599
|
+
L: 173,
|
|
4372
4600
|
S: this,
|
|
4373
4601
|
C: (f, a) => f(...a)
|
|
4374
4602
|
});
|
|
4375
4603
|
(0, import_log13.log)("opened", void 0, {
|
|
4376
4604
|
F: __dxlog_file15,
|
|
4377
|
-
L:
|
|
4605
|
+
L: 174,
|
|
4378
4606
|
S: this,
|
|
4379
4607
|
C: (f, a) => f(...a)
|
|
4380
4608
|
});
|
|
@@ -4382,7 +4610,7 @@ var ServiceContext = class {
|
|
|
4382
4610
|
async close() {
|
|
4383
4611
|
(0, import_log13.log)("closing...", void 0, {
|
|
4384
4612
|
F: __dxlog_file15,
|
|
4385
|
-
L:
|
|
4613
|
+
L: 178,
|
|
4386
4614
|
S: this,
|
|
4387
4615
|
C: (f, a) => f(...a)
|
|
4388
4616
|
});
|
|
@@ -4398,23 +4626,24 @@ var ServiceContext = class {
|
|
|
4398
4626
|
await this.signalManager.close();
|
|
4399
4627
|
this.dataServiceSubscriptions.clear();
|
|
4400
4628
|
await this.metadataStore.close();
|
|
4629
|
+
await this.indexer.destroy();
|
|
4401
4630
|
(0, import_log13.log)("closed", void 0, {
|
|
4402
4631
|
F: __dxlog_file15,
|
|
4403
|
-
L:
|
|
4632
|
+
L: 192,
|
|
4404
4633
|
S: this,
|
|
4405
4634
|
C: (f, a) => f(...a)
|
|
4406
4635
|
});
|
|
4407
4636
|
}
|
|
4408
4637
|
async createIdentity(params = {}) {
|
|
4409
4638
|
const identity = await this.identityManager.createIdentity(params);
|
|
4410
|
-
await this._initialize(new
|
|
4639
|
+
await this._initialize(new import_context10.Context());
|
|
4411
4640
|
return identity;
|
|
4412
4641
|
}
|
|
4413
4642
|
getInvitationHandler(invitation) {
|
|
4414
4643
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
4415
4644
|
(0, import_invariant14.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
4416
4645
|
F: __dxlog_file15,
|
|
4417
|
-
L:
|
|
4646
|
+
L: 203,
|
|
4418
4647
|
S: this,
|
|
4419
4648
|
A: [
|
|
4420
4649
|
"factory",
|
|
@@ -4433,7 +4662,7 @@ var ServiceContext = class {
|
|
|
4433
4662
|
}
|
|
4434
4663
|
async _acceptIdentity(params) {
|
|
4435
4664
|
const identity = await this.identityManager.acceptIdentity(params);
|
|
4436
|
-
await this._initialize(new
|
|
4665
|
+
await this._initialize(new import_context10.Context());
|
|
4437
4666
|
return identity;
|
|
4438
4667
|
}
|
|
4439
4668
|
async _checkStorageVersion() {
|
|
@@ -4446,7 +4675,7 @@ var ServiceContext = class {
|
|
|
4446
4675
|
async _initialize(ctx) {
|
|
4447
4676
|
(0, import_log13.log)("initializing spaces...", void 0, {
|
|
4448
4677
|
F: __dxlog_file15,
|
|
4449
|
-
L:
|
|
4678
|
+
L: 234,
|
|
4450
4679
|
S: this,
|
|
4451
4680
|
C: (f, a) => f(...a)
|
|
4452
4681
|
});
|
|
@@ -4469,7 +4698,7 @@ var ServiceContext = class {
|
|
|
4469
4698
|
this._handlerFactories.set(import_services12.Invitation.Kind.SPACE, (invitation) => {
|
|
4470
4699
|
(0, import_invariant14.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
4471
4700
|
F: __dxlog_file15,
|
|
4472
|
-
L:
|
|
4701
|
+
L: 259,
|
|
4473
4702
|
S: this,
|
|
4474
4703
|
A: [
|
|
4475
4704
|
"this.dataSpaceManager",
|
|
@@ -4493,7 +4722,7 @@ var ServiceContext = class {
|
|
|
4493
4722
|
details: assertion
|
|
4494
4723
|
}, {
|
|
4495
4724
|
F: __dxlog_file15,
|
|
4496
|
-
L:
|
|
4725
|
+
L: 275,
|
|
4497
4726
|
S: this,
|
|
4498
4727
|
C: (f, a) => f(...a)
|
|
4499
4728
|
});
|
|
@@ -4504,7 +4733,7 @@ var ServiceContext = class {
|
|
|
4504
4733
|
details: assertion
|
|
4505
4734
|
}, {
|
|
4506
4735
|
F: __dxlog_file15,
|
|
4507
|
-
L:
|
|
4736
|
+
L: 279,
|
|
4508
4737
|
S: this,
|
|
4509
4738
|
C: (f, a) => f(...a)
|
|
4510
4739
|
});
|
|
@@ -4515,7 +4744,7 @@ var ServiceContext = class {
|
|
|
4515
4744
|
details: assertion
|
|
4516
4745
|
}, {
|
|
4517
4746
|
F: __dxlog_file15,
|
|
4518
|
-
L:
|
|
4747
|
+
L: 284,
|
|
4519
4748
|
S: this,
|
|
4520
4749
|
C: (f, a) => f(...a)
|
|
4521
4750
|
});
|
|
@@ -4526,7 +4755,7 @@ var ServiceContext = class {
|
|
|
4526
4755
|
} catch (err) {
|
|
4527
4756
|
import_log13.log.catch(err, void 0, {
|
|
4528
4757
|
F: __dxlog_file15,
|
|
4529
|
-
L:
|
|
4758
|
+
L: 290,
|
|
4530
4759
|
S: this,
|
|
4531
4760
|
C: (f, a) => f(...a)
|
|
4532
4761
|
});
|
|
@@ -4626,16 +4855,16 @@ var StorageDriver = import_config.Runtime.Client.Storage.StorageDriver;
|
|
|
4626
4855
|
var createStorageObjects = (config) => {
|
|
4627
4856
|
const { persistent = false, keyStore, dataStore, dataRoot = (0, import_util8.isNode)() ? import_client_protocol4.DX_DATA : "dxos/storage" } = config ?? {};
|
|
4628
4857
|
if (persistent && dataStore === StorageDriver.RAM) {
|
|
4629
|
-
throw new
|
|
4858
|
+
throw new import_protocols14.InvalidConfigError("RAM storage cannot be used in persistent mode.");
|
|
4630
4859
|
}
|
|
4631
4860
|
if (!persistent && dataStore !== void 0 && dataStore !== StorageDriver.RAM) {
|
|
4632
|
-
throw new
|
|
4861
|
+
throw new import_protocols14.InvalidConfigError("Cannot use a persistent storage in not persistent mode.");
|
|
4633
4862
|
}
|
|
4634
4863
|
if (persistent && keyStore === StorageDriver.RAM) {
|
|
4635
|
-
throw new
|
|
4864
|
+
throw new import_protocols14.InvalidConfigError("RAM key storage cannot be used in persistent mode.");
|
|
4636
4865
|
}
|
|
4637
4866
|
if (!persistent && keyStore !== StorageDriver.RAM && keyStore !== void 0) {
|
|
4638
|
-
throw new
|
|
4867
|
+
throw new import_protocols14.InvalidConfigError("Cannot use a persistent key storage in not persistent mode.");
|
|
4639
4868
|
}
|
|
4640
4869
|
return {
|
|
4641
4870
|
storage: (0, import_random_access_storage.createStorage)({
|
|
@@ -4984,7 +5213,7 @@ var ClientServicesHost = class {
|
|
|
4984
5213
|
lockKey,
|
|
4985
5214
|
onAcquire: () => {
|
|
4986
5215
|
if (!this._opening) {
|
|
4987
|
-
void this.open(new
|
|
5216
|
+
void this.open(new import_context11.Context());
|
|
4988
5217
|
}
|
|
4989
5218
|
},
|
|
4990
5219
|
onRelease: () => this.close()
|
|
@@ -5040,7 +5269,7 @@ var ClientServicesHost = class {
|
|
|
5040
5269
|
initialize({ config, ...options }) {
|
|
5041
5270
|
(0, import_invariant16.invariant)(!this._open, "service host is open", {
|
|
5042
5271
|
F: __dxlog_file18,
|
|
5043
|
-
L:
|
|
5272
|
+
L: 191,
|
|
5044
5273
|
S: this,
|
|
5045
5274
|
A: [
|
|
5046
5275
|
"!this._open",
|
|
@@ -5049,14 +5278,14 @@ var ClientServicesHost = class {
|
|
|
5049
5278
|
});
|
|
5050
5279
|
(0, import_log15.log)("initializing...", void 0, {
|
|
5051
5280
|
F: __dxlog_file18,
|
|
5052
|
-
L:
|
|
5281
|
+
L: 192,
|
|
5053
5282
|
S: this,
|
|
5054
5283
|
C: (f, a) => f(...a)
|
|
5055
5284
|
});
|
|
5056
5285
|
if (config) {
|
|
5057
5286
|
(0, import_invariant16.invariant)(!this._config, "config already set", {
|
|
5058
5287
|
F: __dxlog_file18,
|
|
5059
|
-
L:
|
|
5288
|
+
L: 195,
|
|
5060
5289
|
S: this,
|
|
5061
5290
|
A: [
|
|
5062
5291
|
"!this._config",
|
|
@@ -5074,7 +5303,7 @@ var ClientServicesHost = class {
|
|
|
5074
5303
|
this._signalManager = signalManager;
|
|
5075
5304
|
(0, import_invariant16.invariant)(!this._networkManager, "network manager already set", {
|
|
5076
5305
|
F: __dxlog_file18,
|
|
5077
|
-
L:
|
|
5306
|
+
L: 211,
|
|
5078
5307
|
S: this,
|
|
5079
5308
|
A: [
|
|
5080
5309
|
"!this._networkManager",
|
|
@@ -5088,7 +5317,7 @@ var ClientServicesHost = class {
|
|
|
5088
5317
|
});
|
|
5089
5318
|
(0, import_log15.log)("initialized", void 0, {
|
|
5090
5319
|
F: __dxlog_file18,
|
|
5091
|
-
L:
|
|
5320
|
+
L: 218,
|
|
5092
5321
|
S: this,
|
|
5093
5322
|
C: (f, a) => f(...a)
|
|
5094
5323
|
});
|
|
@@ -5098,17 +5327,17 @@ var ClientServicesHost = class {
|
|
|
5098
5327
|
return;
|
|
5099
5328
|
}
|
|
5100
5329
|
const traceId = import_keys11.PublicKey.random().toHex();
|
|
5101
|
-
import_log15.log.trace("dxos.client-services.host.open",
|
|
5330
|
+
import_log15.log.trace("dxos.client-services.host.open", import_protocols15.trace.begin({
|
|
5102
5331
|
id: traceId
|
|
5103
5332
|
}), {
|
|
5104
5333
|
F: __dxlog_file18,
|
|
5105
|
-
L:
|
|
5334
|
+
L: 229,
|
|
5106
5335
|
S: this,
|
|
5107
5336
|
C: (f, a) => f(...a)
|
|
5108
5337
|
});
|
|
5109
5338
|
(0, import_invariant16.invariant)(this._config, "config not set", {
|
|
5110
5339
|
F: __dxlog_file18,
|
|
5111
|
-
L:
|
|
5340
|
+
L: 231,
|
|
5112
5341
|
S: this,
|
|
5113
5342
|
A: [
|
|
5114
5343
|
"this._config",
|
|
@@ -5117,7 +5346,7 @@ var ClientServicesHost = class {
|
|
|
5117
5346
|
});
|
|
5118
5347
|
(0, import_invariant16.invariant)(this._storage, "storage not set", {
|
|
5119
5348
|
F: __dxlog_file18,
|
|
5120
|
-
L:
|
|
5349
|
+
L: 232,
|
|
5121
5350
|
S: this,
|
|
5122
5351
|
A: [
|
|
5123
5352
|
"this._storage",
|
|
@@ -5126,7 +5355,7 @@ var ClientServicesHost = class {
|
|
|
5126
5355
|
});
|
|
5127
5356
|
(0, import_invariant16.invariant)(this._signalManager, "signal manager not set", {
|
|
5128
5357
|
F: __dxlog_file18,
|
|
5129
|
-
L:
|
|
5358
|
+
L: 233,
|
|
5130
5359
|
S: this,
|
|
5131
5360
|
A: [
|
|
5132
5361
|
"this._signalManager",
|
|
@@ -5135,7 +5364,7 @@ var ClientServicesHost = class {
|
|
|
5135
5364
|
});
|
|
5136
5365
|
(0, import_invariant16.invariant)(this._networkManager, "network manager not set", {
|
|
5137
5366
|
F: __dxlog_file18,
|
|
5138
|
-
L:
|
|
5367
|
+
L: 234,
|
|
5139
5368
|
S: this,
|
|
5140
5369
|
A: [
|
|
5141
5370
|
"this._networkManager",
|
|
@@ -5147,7 +5376,7 @@ var ClientServicesHost = class {
|
|
|
5147
5376
|
lockKey: this._resourceLock?.lockKey
|
|
5148
5377
|
}, {
|
|
5149
5378
|
F: __dxlog_file18,
|
|
5150
|
-
L:
|
|
5379
|
+
L: 237,
|
|
5151
5380
|
S: this,
|
|
5152
5381
|
C: (f, a) => f(...a)
|
|
5153
5382
|
});
|
|
@@ -5157,13 +5386,17 @@ var ClientServicesHost = class {
|
|
|
5157
5386
|
this._serviceRegistry.setServices({
|
|
5158
5387
|
SystemService: this._systemService,
|
|
5159
5388
|
IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
|
|
5160
|
-
InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitations, (invitation) => this._serviceContext.getInvitationHandler(invitation)),
|
|
5389
|
+
InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitations, (invitation) => this._serviceContext.getInvitationHandler(invitation), this._serviceContext.metadataStore),
|
|
5161
5390
|
DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
|
|
5162
5391
|
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, this._serviceContext.dataServiceSubscriptions, async () => {
|
|
5163
5392
|
await this._serviceContext.initialized.wait();
|
|
5164
5393
|
return this._serviceContext.dataSpaceManager;
|
|
5165
5394
|
}),
|
|
5166
5395
|
DataService: new import_echo_pipeline3.DataServiceImpl(this._serviceContext.dataServiceSubscriptions, this._serviceContext.automergeHost),
|
|
5396
|
+
IndexService: new import_indexing2.IndexServiceImpl({
|
|
5397
|
+
indexer: this._serviceContext.indexer,
|
|
5398
|
+
automergeHost: this._serviceContext.automergeHost
|
|
5399
|
+
}),
|
|
5167
5400
|
NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
|
|
5168
5401
|
LoggingService: this._loggingService,
|
|
5169
5402
|
TracingService: this._tracingService,
|
|
@@ -5175,6 +5408,24 @@ var ClientServicesHost = class {
|
|
|
5175
5408
|
})
|
|
5176
5409
|
});
|
|
5177
5410
|
await this._serviceContext.open(ctx);
|
|
5411
|
+
(0, import_invariant16.invariant)(this.serviceRegistry.services.InvitationsService, void 0, {
|
|
5412
|
+
F: __dxlog_file18,
|
|
5413
|
+
L: 303,
|
|
5414
|
+
S: this,
|
|
5415
|
+
A: [
|
|
5416
|
+
"this.serviceRegistry.services.InvitationsService",
|
|
5417
|
+
""
|
|
5418
|
+
]
|
|
5419
|
+
});
|
|
5420
|
+
const loadedInvitations = await this.serviceRegistry.services.InvitationsService.loadPersistentInvitations();
|
|
5421
|
+
(0, import_log15.log)("loaded persistent invitations", {
|
|
5422
|
+
count: loadedInvitations.invitations?.length
|
|
5423
|
+
}, {
|
|
5424
|
+
F: __dxlog_file18,
|
|
5425
|
+
L: 306,
|
|
5426
|
+
S: this,
|
|
5427
|
+
C: (f, a) => f(...a)
|
|
5428
|
+
});
|
|
5178
5429
|
const devtoolsProxy = this._config?.get("runtime.client.devtoolsProxy");
|
|
5179
5430
|
if (devtoolsProxy) {
|
|
5180
5431
|
this._devtoolsProxy = new import_websocket_rpc.WebsocketRpcClient({
|
|
@@ -5193,15 +5444,15 @@ var ClientServicesHost = class {
|
|
|
5193
5444
|
deviceKey
|
|
5194
5445
|
}, {
|
|
5195
5446
|
F: __dxlog_file18,
|
|
5196
|
-
L:
|
|
5447
|
+
L: 323,
|
|
5197
5448
|
S: this,
|
|
5198
5449
|
C: (f, a) => f(...a)
|
|
5199
5450
|
});
|
|
5200
|
-
import_log15.log.trace("dxos.client-services.host.open",
|
|
5451
|
+
import_log15.log.trace("dxos.client-services.host.open", import_protocols15.trace.end({
|
|
5201
5452
|
id: traceId
|
|
5202
5453
|
}), {
|
|
5203
5454
|
F: __dxlog_file18,
|
|
5204
|
-
L:
|
|
5455
|
+
L: 324,
|
|
5205
5456
|
S: this,
|
|
5206
5457
|
C: (f, a) => f(...a)
|
|
5207
5458
|
});
|
|
@@ -5215,7 +5466,7 @@ var ClientServicesHost = class {
|
|
|
5215
5466
|
deviceKey
|
|
5216
5467
|
}, {
|
|
5217
5468
|
F: __dxlog_file18,
|
|
5218
|
-
L:
|
|
5469
|
+
L: 335,
|
|
5219
5470
|
S: this,
|
|
5220
5471
|
C: (f, a) => f(...a)
|
|
5221
5472
|
});
|
|
@@ -5231,24 +5482,24 @@ var ClientServicesHost = class {
|
|
|
5231
5482
|
deviceKey
|
|
5232
5483
|
}, {
|
|
5233
5484
|
F: __dxlog_file18,
|
|
5234
|
-
L:
|
|
5485
|
+
L: 342,
|
|
5235
5486
|
S: this,
|
|
5236
5487
|
C: (f, a) => f(...a)
|
|
5237
5488
|
});
|
|
5238
5489
|
}
|
|
5239
5490
|
async reset() {
|
|
5240
5491
|
const traceId = import_keys11.PublicKey.random().toHex();
|
|
5241
|
-
import_log15.log.trace("dxos.sdk.client-services-host.reset",
|
|
5492
|
+
import_log15.log.trace("dxos.sdk.client-services-host.reset", import_protocols15.trace.begin({
|
|
5242
5493
|
id: traceId
|
|
5243
5494
|
}), {
|
|
5244
5495
|
F: __dxlog_file18,
|
|
5245
|
-
L:
|
|
5496
|
+
L: 347,
|
|
5246
5497
|
S: this,
|
|
5247
5498
|
C: (f, a) => f(...a)
|
|
5248
5499
|
});
|
|
5249
5500
|
(0, import_log15.log)("resetting...", void 0, {
|
|
5250
5501
|
F: __dxlog_file18,
|
|
5251
|
-
L:
|
|
5502
|
+
L: 349,
|
|
5252
5503
|
S: this,
|
|
5253
5504
|
C: (f, a) => f(...a)
|
|
5254
5505
|
});
|
|
@@ -5256,15 +5507,15 @@ var ClientServicesHost = class {
|
|
|
5256
5507
|
await this._storage.reset();
|
|
5257
5508
|
(0, import_log15.log)("reset", void 0, {
|
|
5258
5509
|
F: __dxlog_file18,
|
|
5259
|
-
L:
|
|
5510
|
+
L: 352,
|
|
5260
5511
|
S: this,
|
|
5261
5512
|
C: (f, a) => f(...a)
|
|
5262
5513
|
});
|
|
5263
|
-
import_log15.log.trace("dxos.sdk.client-services-host.reset",
|
|
5514
|
+
import_log15.log.trace("dxos.sdk.client-services-host.reset", import_protocols15.trace.end({
|
|
5264
5515
|
id: traceId
|
|
5265
5516
|
}), {
|
|
5266
5517
|
F: __dxlog_file18,
|
|
5267
|
-
L:
|
|
5518
|
+
L: 353,
|
|
5268
5519
|
S: this,
|
|
5269
5520
|
C: (f, a) => f(...a)
|
|
5270
5521
|
});
|
|
@@ -5279,7 +5530,7 @@ var ClientServicesHost = class {
|
|
|
5279
5530
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
5280
5531
|
(0, import_invariant16.invariant)(automergeIndex, void 0, {
|
|
5281
5532
|
F: __dxlog_file18,
|
|
5282
|
-
L:
|
|
5533
|
+
L: 368,
|
|
5283
5534
|
S: this,
|
|
5284
5535
|
A: [
|
|
5285
5536
|
"automergeIndex",
|
|
@@ -5291,8 +5542,8 @@ var ClientServicesHost = class {
|
|
|
5291
5542
|
document.change((doc) => {
|
|
5292
5543
|
(0, import_util9.assignDeep)(doc, [
|
|
5293
5544
|
"objects",
|
|
5294
|
-
(0,
|
|
5295
|
-
], (0,
|
|
5545
|
+
(0, import_echo_schema.getAutomergeObjectCore)(obj).id
|
|
5546
|
+
], (0, import_echo_schema.getRawDoc)(obj).handle.docSync());
|
|
5296
5547
|
});
|
|
5297
5548
|
return identity;
|
|
5298
5549
|
}
|
|
@@ -5339,6 +5590,7 @@ ClientServicesHost = _ts_decorate8([
|
|
|
5339
5590
|
createDiagnostics,
|
|
5340
5591
|
createStorageObjects,
|
|
5341
5592
|
getNetworkPeers,
|
|
5593
|
+
invitationExpired,
|
|
5342
5594
|
isLocked,
|
|
5343
5595
|
subscribeToFeedBlocks,
|
|
5344
5596
|
subscribeToFeeds,
|
|
@@ -5348,4 +5600,4 @@ ClientServicesHost = _ts_decorate8([
|
|
|
5348
5600
|
subscribeToSpaces,
|
|
5349
5601
|
subscribeToSwarmInfo
|
|
5350
5602
|
});
|
|
5351
|
-
//# sourceMappingURL=chunk-
|
|
5603
|
+
//# sourceMappingURL=chunk-VDSDEN45.cjs.map
|