@dxos/client-services 0.4.9-main.76223f7 → 0.4.9-main.7750cb2
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-IVUA3ZSF.mjs → chunk-D6LYSGMU.mjs} +193 -254
- package/dist/lib/browser/chunk-D6LYSGMU.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +4 -10
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/{chunk-XLFW2D2Q.cjs → chunk-FSN25IYL.cjs} +212 -273
- package/dist/lib/node/chunk-FSN25IYL.cjs.map +7 -0
- package/dist/lib/node/index.cjs +38 -38
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +10 -17
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/services/diagnostics.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts +2 -3
- 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 +3 -0
- package/dist/types/src/packlets/spaces/automerge-space-state.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts +2 -3
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts +5 -3
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts +2 -3
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +2 -6
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +37 -37
- package/src/packlets/indexing/util.ts +2 -2
- package/src/packlets/invitations/space-invitation-protocol.test.ts +3 -12
- package/src/packlets/invitations/space-invitation-protocol.ts +0 -1
- package/src/packlets/services/automerge-host.test.ts +2 -5
- package/src/packlets/services/diagnostics.ts +2 -41
- package/src/packlets/services/service-context.test.ts +3 -76
- package/src/packlets/services/service-context.ts +5 -15
- package/src/packlets/services/service-host.ts +1 -5
- package/src/packlets/spaces/automerge-space-state.ts +9 -0
- package/src/packlets/spaces/data-space-manager.test.ts +3 -145
- package/src/packlets/spaces/data-space-manager.ts +3 -18
- package/src/packlets/spaces/data-space.ts +11 -43
- package/src/packlets/spaces/spaces-service.test.ts +4 -9
- package/src/packlets/spaces/spaces-service.ts +11 -15
- package/src/packlets/testing/test-builder.ts +2 -22
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-IVUA3ZSF.mjs.map +0 -7
- package/dist/lib/node/chunk-XLFW2D2Q.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_FSN25IYL_exports = {};
|
|
30
|
+
__export(chunk_FSN25IYL_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
DataSpace: () => DataSpace,
|
|
@@ -61,7 +61,7 @@ __export(chunk_XLFW2D2Q_exports, {
|
|
|
61
61
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
62
62
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
63
63
|
});
|
|
64
|
-
module.exports = __toCommonJS(
|
|
64
|
+
module.exports = __toCommonJS(chunk_FSN25IYL_exports);
|
|
65
65
|
var import_async = require("@dxos/async");
|
|
66
66
|
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
67
67
|
var import_feed_store = require("@dxos/feed-store");
|
|
@@ -150,10 +150,7 @@ var import_rpc = require("@dxos/rpc");
|
|
|
150
150
|
var import_tracing3 = require("@dxos/tracing");
|
|
151
151
|
var import_codec_protobuf10 = require("@dxos/codec-protobuf");
|
|
152
152
|
var import_credentials9 = require("@dxos/credentials");
|
|
153
|
-
var import_document_model = require("@dxos/document-model");
|
|
154
|
-
var import_echo_db = require("@dxos/echo-db");
|
|
155
153
|
var import_invariant9 = require("@dxos/invariant");
|
|
156
|
-
var import_log8 = require("@dxos/log");
|
|
157
154
|
var import_protocols7 = require("@dxos/protocols");
|
|
158
155
|
var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
|
|
159
156
|
var import_tracing4 = require("@dxos/tracing");
|
|
@@ -165,28 +162,29 @@ var import_debug3 = require("@dxos/debug");
|
|
|
165
162
|
var import_echo_pipeline = require("@dxos/echo-pipeline");
|
|
166
163
|
var import_invariant10 = require("@dxos/invariant");
|
|
167
164
|
var import_keys7 = require("@dxos/keys");
|
|
168
|
-
var
|
|
165
|
+
var import_log8 = require("@dxos/log");
|
|
169
166
|
var import_protocols8 = require("@dxos/protocols");
|
|
170
167
|
var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
|
|
171
168
|
var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
172
169
|
var import_timeframe2 = require("@dxos/timeframe");
|
|
173
170
|
var import_tracing5 = require("@dxos/tracing");
|
|
174
171
|
var import_util4 = require("@dxos/util");
|
|
175
|
-
var import_credentials11 = require("@dxos/credentials");
|
|
176
172
|
var import_async11 = require("@dxos/async");
|
|
173
|
+
var import_credentials11 = require("@dxos/credentials");
|
|
174
|
+
var import_async12 = require("@dxos/async");
|
|
177
175
|
var import_context8 = require("@dxos/context");
|
|
178
176
|
var import_invariant11 = require("@dxos/invariant");
|
|
179
177
|
var import_keys8 = require("@dxos/keys");
|
|
180
|
-
var
|
|
178
|
+
var import_log9 = require("@dxos/log");
|
|
181
179
|
var import_protocols9 = require("@dxos/protocols");
|
|
182
180
|
var import_teleport2 = require("@dxos/teleport");
|
|
183
181
|
var import_util5 = require("@dxos/util");
|
|
184
|
-
var
|
|
182
|
+
var import_async13 = require("@dxos/async");
|
|
185
183
|
var import_context9 = require("@dxos/context");
|
|
186
184
|
var import_credentials12 = require("@dxos/credentials");
|
|
187
185
|
var import_invariant12 = require("@dxos/invariant");
|
|
188
186
|
var import_keys9 = require("@dxos/keys");
|
|
189
|
-
var
|
|
187
|
+
var import_log10 = require("@dxos/log");
|
|
190
188
|
var import_protocols10 = require("@dxos/protocols");
|
|
191
189
|
var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
|
|
192
190
|
var import_teleport_extension_gossip2 = require("@dxos/teleport-extension-gossip");
|
|
@@ -195,14 +193,14 @@ var import_credentials13 = require("@dxos/credentials");
|
|
|
195
193
|
var import_debug4 = require("@dxos/debug");
|
|
196
194
|
var import_credentials14 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
197
195
|
var import_timeframe3 = require("@dxos/timeframe");
|
|
198
|
-
var
|
|
196
|
+
var import_async14 = require("@dxos/async");
|
|
199
197
|
var import_codec_protobuf11 = require("@dxos/codec-protobuf");
|
|
200
198
|
var import_debug5 = require("@dxos/debug");
|
|
201
199
|
var import_invariant13 = require("@dxos/invariant");
|
|
202
|
-
var
|
|
200
|
+
var import_log11 = require("@dxos/log");
|
|
203
201
|
var import_protocols11 = require("@dxos/protocols");
|
|
204
202
|
var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
|
|
205
|
-
var
|
|
203
|
+
var import_async15 = require("@dxos/async");
|
|
206
204
|
var import_context10 = require("@dxos/context");
|
|
207
205
|
var import_credentials15 = require("@dxos/credentials");
|
|
208
206
|
var import_debug6 = require("@dxos/debug");
|
|
@@ -212,7 +210,7 @@ var import_indexing = require("@dxos/indexing");
|
|
|
212
210
|
var import_invariant14 = require("@dxos/invariant");
|
|
213
211
|
var import_keyring = require("@dxos/keyring");
|
|
214
212
|
var import_keys10 = require("@dxos/keys");
|
|
215
|
-
var
|
|
213
|
+
var import_log12 = require("@dxos/log");
|
|
216
214
|
var import_protocols12 = require("@dxos/protocols");
|
|
217
215
|
var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
|
|
218
216
|
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
@@ -223,22 +221,22 @@ var import_debug7 = require("@dxos/debug");
|
|
|
223
221
|
var import_protocols13 = require("@dxos/protocols");
|
|
224
222
|
var import_invariant15 = require("@dxos/invariant");
|
|
225
223
|
var import_lock_file = require("@dxos/lock-file");
|
|
226
|
-
var
|
|
224
|
+
var import_log13 = require("@dxos/log");
|
|
227
225
|
var import_client_protocol4 = require("@dxos/client-protocol");
|
|
228
226
|
var import_protocols14 = require("@dxos/protocols");
|
|
229
227
|
var import_config = require("@dxos/protocols/proto/dxos/config");
|
|
230
228
|
var import_random_access_storage = require("@dxos/random-access-storage");
|
|
231
229
|
var import_util8 = require("@dxos/util");
|
|
232
|
-
var
|
|
230
|
+
var import_async16 = require("@dxos/async");
|
|
233
231
|
var import_client_protocol5 = require("@dxos/client-protocol");
|
|
234
232
|
var import_context11 = require("@dxos/context");
|
|
235
|
-
var
|
|
233
|
+
var import_document_model = require("@dxos/document-model");
|
|
236
234
|
var import_echo_pipeline3 = require("@dxos/echo-pipeline");
|
|
237
235
|
var import_echo_schema = require("@dxos/echo-schema");
|
|
238
236
|
var import_indexing2 = require("@dxos/indexing");
|
|
239
237
|
var import_invariant16 = require("@dxos/invariant");
|
|
240
238
|
var import_keys11 = require("@dxos/keys");
|
|
241
|
-
var
|
|
239
|
+
var import_log14 = require("@dxos/log");
|
|
242
240
|
var import_messaging = require("@dxos/messaging");
|
|
243
241
|
var import_model_factory = require("@dxos/model-factory");
|
|
244
242
|
var import_network_manager2 = require("@dxos/network-manager");
|
|
@@ -248,14 +246,14 @@ var import_text_model = require("@dxos/text-model");
|
|
|
248
246
|
var import_tracing7 = require("@dxos/tracing");
|
|
249
247
|
var import_util9 = require("@dxos/util");
|
|
250
248
|
var import_websocket_rpc = require("@dxos/websocket-rpc");
|
|
251
|
-
var
|
|
249
|
+
var import_async17 = require("@dxos/async");
|
|
252
250
|
var import_codec_protobuf12 = require("@dxos/codec-protobuf");
|
|
253
251
|
var import_invariant17 = require("@dxos/invariant");
|
|
254
252
|
var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
|
|
255
|
-
var
|
|
253
|
+
var import_async18 = require("@dxos/async");
|
|
256
254
|
var import_codec_protobuf13 = require("@dxos/codec-protobuf");
|
|
257
255
|
var import_keys12 = require("@dxos/keys");
|
|
258
|
-
var
|
|
256
|
+
var import_log15 = require("@dxos/log");
|
|
259
257
|
var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
|
|
260
258
|
var import_util10 = require("@dxos/util");
|
|
261
259
|
var import_codec_protobuf14 = require("@dxos/codec-protobuf");
|
|
@@ -2717,8 +2715,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2717
2715
|
return {
|
|
2718
2716
|
space: {
|
|
2719
2717
|
credential: spaceMemberCredential,
|
|
2720
|
-
controlTimeframe: space.inner.controlPipeline.state.timeframe
|
|
2721
|
-
dataTimeframe: space.dataPipeline.pipelineState?.timeframe
|
|
2718
|
+
controlTimeframe: space.inner.controlPipeline.state.timeframe
|
|
2722
2719
|
}
|
|
2723
2720
|
};
|
|
2724
2721
|
}
|
|
@@ -2747,7 +2744,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2747
2744
|
async accept(response) {
|
|
2748
2745
|
(0, import_invariant8.invariant)(response.space, void 0, {
|
|
2749
2746
|
F: __dxlog_file9,
|
|
2750
|
-
L:
|
|
2747
|
+
L: 107,
|
|
2751
2748
|
S: this,
|
|
2752
2749
|
A: [
|
|
2753
2750
|
"response.space",
|
|
@@ -2758,7 +2755,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2758
2755
|
const assertion = (0, import_credentials8.getCredentialAssertion)(credential);
|
|
2759
2756
|
(0, import_invariant8.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
2760
2757
|
F: __dxlog_file9,
|
|
2761
|
-
L:
|
|
2758
|
+
L: 110,
|
|
2762
2759
|
S: this,
|
|
2763
2760
|
A: [
|
|
2764
2761
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2767,7 +2764,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2767
2764
|
});
|
|
2768
2765
|
(0, import_invariant8.invariant)(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
2769
2766
|
F: __dxlog_file9,
|
|
2770
|
-
L:
|
|
2767
|
+
L: 111,
|
|
2771
2768
|
S: this,
|
|
2772
2769
|
A: [
|
|
2773
2770
|
"credential.subject.id.equals(this._signingContext.identityKey)",
|
|
@@ -2891,7 +2888,7 @@ var getPlatform = () => {
|
|
|
2891
2888
|
};
|
|
2892
2889
|
}
|
|
2893
2890
|
};
|
|
2894
|
-
var DXOS_VERSION = "0.4.9-main.
|
|
2891
|
+
var DXOS_VERSION = "0.4.9-main.7750cb2";
|
|
2895
2892
|
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
|
|
2896
2893
|
var DEFAULT_TIMEOUT = 1e3;
|
|
2897
2894
|
var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
@@ -2909,7 +2906,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
2909
2906
|
{
|
|
2910
2907
|
(0, import_invariant9.invariant)(clientServices.LoggingService, "SystemService is not available.", {
|
|
2911
2908
|
F: __dxlog_file10,
|
|
2912
|
-
L:
|
|
2909
|
+
L: 108,
|
|
2913
2910
|
S: void 0,
|
|
2914
2911
|
A: [
|
|
2915
2912
|
"clientServices.LoggingService",
|
|
@@ -2966,22 +2963,6 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
2966
2963
|
diagnostics.config = config.values;
|
|
2967
2964
|
return diagnostics;
|
|
2968
2965
|
};
|
|
2969
|
-
var getProperties = (space) => {
|
|
2970
|
-
let properties = {};
|
|
2971
|
-
try {
|
|
2972
|
-
const propertiesItem = space.dataPipeline.itemManager.items.find((item) => item.modelMeta?.type === import_document_model.DocumentModel.meta.type && item.state?.type?.itemId === import_echo_db.TYPE_PROPERTIES);
|
|
2973
|
-
const state = propertiesItem?.state;
|
|
2974
|
-
properties = state?.data;
|
|
2975
|
-
} catch (err) {
|
|
2976
|
-
import_log8.log.warn(err.message, void 0, {
|
|
2977
|
-
F: __dxlog_file10,
|
|
2978
|
-
L: 196,
|
|
2979
|
-
S: void 0,
|
|
2980
|
-
C: (f, a) => f(...a)
|
|
2981
|
-
});
|
|
2982
|
-
}
|
|
2983
|
-
return properties;
|
|
2984
|
-
};
|
|
2985
2966
|
var getSpaceStats = async (space) => {
|
|
2986
2967
|
const stats = {
|
|
2987
2968
|
key: space.key,
|
|
@@ -3001,28 +2982,14 @@ var getSpaceStats = async (space) => {
|
|
|
3001
2982
|
})),
|
|
3002
2983
|
pipeline: {
|
|
3003
2984
|
// TODO(burdon): Pick properties from credentials if needed.
|
|
3004
|
-
|
|
3005
|
-
|
|
2985
|
+
currentEpoch: space.automergeSpaceState.lastEpoch,
|
|
2986
|
+
appliedEpoch: space.automergeSpaceState.lastEpoch,
|
|
3006
2987
|
controlFeeds: space.inner.controlPipeline.state.feeds.map((feed) => feed.key),
|
|
3007
2988
|
currentControlTimeframe: space.inner.controlPipeline.state.timeframe,
|
|
3008
2989
|
targetControlTimeframe: space.inner.controlPipeline.state.targetTimeframe,
|
|
3009
|
-
totalControlTimeframe: space.inner.controlPipeline.state.endTimeframe
|
|
3010
|
-
// TODO(burdon): Empty?
|
|
3011
|
-
dataFeeds: space.dataPipeline.pipelineState?.feeds.map((feed) => feed.key) ?? [],
|
|
3012
|
-
startDataTimeframe: space.dataPipeline.pipelineState?.startTimeframe,
|
|
3013
|
-
currentDataTimeframe: space.dataPipeline.pipelineState?.timeframe,
|
|
3014
|
-
targetDataTimeframe: space.dataPipeline.pipelineState?.targetTimeframe,
|
|
3015
|
-
totalDataTimeframe: space.dataPipeline.pipelineState?.endTimeframe
|
|
2990
|
+
totalControlTimeframe: space.inner.controlPipeline.state.endTimeframe
|
|
3016
2991
|
}
|
|
3017
2992
|
};
|
|
3018
|
-
if (space.dataPipeline.itemManager) {
|
|
3019
|
-
Object.assign(stats, {
|
|
3020
|
-
properties: getProperties(space),
|
|
3021
|
-
db: {
|
|
3022
|
-
objects: space.dataPipeline.itemManager.entities.size
|
|
3023
|
-
}
|
|
3024
|
-
});
|
|
3025
|
-
}
|
|
3026
2993
|
if (stats.metrics) {
|
|
3027
2994
|
const { open, ready } = stats.metrics;
|
|
3028
2995
|
stats.metrics.startupTime = open && ready && ready.getTime() - open.getTime();
|
|
@@ -3034,6 +3001,7 @@ var AutomergeSpaceState = class {
|
|
|
3034
3001
|
this._onNewRoot = _onNewRoot;
|
|
3035
3002
|
this.rootUrl = void 0;
|
|
3036
3003
|
this.lastEpoch = void 0;
|
|
3004
|
+
this.onNewEpoch = new import_async11.Event();
|
|
3037
3005
|
this._isProcessingRootDocs = false;
|
|
3038
3006
|
}
|
|
3039
3007
|
async processCredential(credential) {
|
|
@@ -3047,6 +3015,7 @@ var AutomergeSpaceState = class {
|
|
|
3047
3015
|
this._onNewRoot(this.rootUrl);
|
|
3048
3016
|
}
|
|
3049
3017
|
}
|
|
3018
|
+
this.onNewEpoch.emit(credential);
|
|
3050
3019
|
}
|
|
3051
3020
|
startProcessingRootDocs() {
|
|
3052
3021
|
if (this._isProcessingRootDocs) {
|
|
@@ -3057,6 +3026,9 @@ var AutomergeSpaceState = class {
|
|
|
3057
3026
|
}
|
|
3058
3027
|
this._isProcessingRootDocs = true;
|
|
3059
3028
|
}
|
|
3029
|
+
async ensureEpochInitialized() {
|
|
3030
|
+
await this.onNewEpoch.waitForCondition(() => !!this.lastEpoch);
|
|
3031
|
+
}
|
|
3060
3032
|
};
|
|
3061
3033
|
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
|
|
3062
3034
|
var DEFAULT_RETRY_TIMEOUT = 1e3;
|
|
@@ -3066,7 +3038,7 @@ var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
|
|
|
3066
3038
|
var NotarizationPlugin = class {
|
|
3067
3039
|
constructor() {
|
|
3068
3040
|
this._ctx = new import_context8.Context();
|
|
3069
|
-
this._extensionOpened = new
|
|
3041
|
+
this._extensionOpened = new import_async12.Event();
|
|
3070
3042
|
this._extensions = /* @__PURE__ */ new Set();
|
|
3071
3043
|
this._processedCredentials = new import_util5.ComplexSet(import_keys8.PublicKey.hash);
|
|
3072
3044
|
this._processCredentialsTriggers = new import_util5.ComplexMap(import_keys8.PublicKey.hash);
|
|
@@ -3083,7 +3055,7 @@ var NotarizationPlugin = class {
|
|
|
3083
3055
|
* Request credentials to be notarized.
|
|
3084
3056
|
*/
|
|
3085
3057
|
async notarize({ ctx: opCtx, credentials, timeout = DEFAULT_NOTARIZE_TIMEOUT, retryTimeout = DEFAULT_RETRY_TIMEOUT, successDelay = DEFAULT_SUCCESS_DELAY }) {
|
|
3086
|
-
(0,
|
|
3058
|
+
(0, import_log9.log)("notarize", {
|
|
3087
3059
|
credentials
|
|
3088
3060
|
}, {
|
|
3089
3061
|
F: __dxlog_file11,
|
|
@@ -3100,10 +3072,10 @@ var NotarizationPlugin = class {
|
|
|
3100
3072
|
"'Credentials must have an id'"
|
|
3101
3073
|
]
|
|
3102
3074
|
});
|
|
3103
|
-
const errors = new
|
|
3075
|
+
const errors = new import_async12.Trigger();
|
|
3104
3076
|
const ctx = this._ctx.derive({
|
|
3105
3077
|
onError: (err) => {
|
|
3106
|
-
|
|
3078
|
+
import_log9.log.warn("Notarization error", {
|
|
3107
3079
|
err
|
|
3108
3080
|
}, {
|
|
3109
3081
|
F: __dxlog_file11,
|
|
@@ -3117,8 +3089,8 @@ var NotarizationPlugin = class {
|
|
|
3117
3089
|
});
|
|
3118
3090
|
opCtx?.onDispose(() => ctx.dispose());
|
|
3119
3091
|
if (timeout !== 0) {
|
|
3120
|
-
(0,
|
|
3121
|
-
|
|
3092
|
+
(0, import_async12.scheduleTask)(ctx, () => {
|
|
3093
|
+
import_log9.log.warn("Notarization timeout", {
|
|
3122
3094
|
timeout,
|
|
3123
3095
|
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
3124
3096
|
}, {
|
|
@@ -3128,12 +3100,12 @@ var NotarizationPlugin = class {
|
|
|
3128
3100
|
C: (f, a) => f(...a)
|
|
3129
3101
|
});
|
|
3130
3102
|
void ctx.dispose();
|
|
3131
|
-
errors.throw(new
|
|
3103
|
+
errors.throw(new import_async12.TimeoutError(timeout, "Notarization timed out"));
|
|
3132
3104
|
}, timeout);
|
|
3133
3105
|
}
|
|
3134
3106
|
const allNotarized = Promise.all(credentials.map((credential) => this._waitUntilProcessed(credential.id)));
|
|
3135
3107
|
const peersTried = /* @__PURE__ */ new Set();
|
|
3136
|
-
const notarizeTask = new
|
|
3108
|
+
const notarizeTask = new import_async12.DeferredTask(ctx, async () => {
|
|
3137
3109
|
try {
|
|
3138
3110
|
if (this._extensions.size === 0) {
|
|
3139
3111
|
return;
|
|
@@ -3142,7 +3114,7 @@ var NotarizationPlugin = class {
|
|
|
3142
3114
|
...this._extensions
|
|
3143
3115
|
].find((peer2) => !peersTried.has(peer2));
|
|
3144
3116
|
if (!peer) {
|
|
3145
|
-
|
|
3117
|
+
import_log9.log.info("Exhausted all peers to notarize with", {
|
|
3146
3118
|
retryIn: retryTimeout
|
|
3147
3119
|
}, {
|
|
3148
3120
|
F: __dxlog_file11,
|
|
@@ -3151,11 +3123,11 @@ var NotarizationPlugin = class {
|
|
|
3151
3123
|
C: (f, a) => f(...a)
|
|
3152
3124
|
});
|
|
3153
3125
|
peersTried.clear();
|
|
3154
|
-
(0,
|
|
3126
|
+
(0, import_async12.scheduleTask)(ctx, () => notarizeTask.schedule(), retryTimeout);
|
|
3155
3127
|
return;
|
|
3156
3128
|
}
|
|
3157
3129
|
peersTried.add(peer);
|
|
3158
|
-
(0,
|
|
3130
|
+
(0, import_log9.log)("try notarizing", {
|
|
3159
3131
|
peer: peer.localPeerId,
|
|
3160
3132
|
credentialId: credentials.map((credential) => credential.id)
|
|
3161
3133
|
}, {
|
|
@@ -3167,16 +3139,16 @@ var NotarizationPlugin = class {
|
|
|
3167
3139
|
await peer.rpc.NotarizationService.notarize({
|
|
3168
3140
|
credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
|
|
3169
3141
|
});
|
|
3170
|
-
(0,
|
|
3142
|
+
(0, import_log9.log)("success", void 0, {
|
|
3171
3143
|
F: __dxlog_file11,
|
|
3172
3144
|
L: 147,
|
|
3173
3145
|
S: this,
|
|
3174
3146
|
C: (f, a) => f(...a)
|
|
3175
3147
|
});
|
|
3176
|
-
await (0,
|
|
3148
|
+
await (0, import_async12.sleep)(successDelay);
|
|
3177
3149
|
} catch (err) {
|
|
3178
3150
|
if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
|
|
3179
|
-
|
|
3151
|
+
import_log9.log.info("error notarizing (recoverable)", err, {
|
|
3180
3152
|
F: __dxlog_file11,
|
|
3181
3153
|
L: 151,
|
|
3182
3154
|
S: this,
|
|
@@ -3194,7 +3166,7 @@ var NotarizationPlugin = class {
|
|
|
3194
3166
|
allNotarized,
|
|
3195
3167
|
errors.wait()
|
|
3196
3168
|
]);
|
|
3197
|
-
(0,
|
|
3169
|
+
(0, import_log9.log)("done", void 0, {
|
|
3198
3170
|
F: __dxlog_file11,
|
|
3199
3171
|
L: 162,
|
|
3200
3172
|
S: this,
|
|
@@ -3231,7 +3203,7 @@ var NotarizationPlugin = class {
|
|
|
3231
3203
|
if (this._processedCredentials.has(id)) {
|
|
3232
3204
|
return;
|
|
3233
3205
|
}
|
|
3234
|
-
await (0, import_util5.entry)(this._processCredentialsTriggers, id).orInsert(new
|
|
3206
|
+
await (0, import_util5.entry)(this._processCredentialsTriggers, id).orInsert(new import_async12.Trigger()).value.wait();
|
|
3235
3207
|
}
|
|
3236
3208
|
/**
|
|
3237
3209
|
* Requests from other peers to notarize credentials.
|
|
@@ -3259,7 +3231,7 @@ var NotarizationPlugin = class {
|
|
|
3259
3231
|
createExtension() {
|
|
3260
3232
|
const extension = new NotarizationTeleportExtension({
|
|
3261
3233
|
onOpen: async () => {
|
|
3262
|
-
(0,
|
|
3234
|
+
(0, import_log9.log)("extension opened", {
|
|
3263
3235
|
peer: extension.localPeerId
|
|
3264
3236
|
}, {
|
|
3265
3237
|
F: __dxlog_file11,
|
|
@@ -3271,7 +3243,7 @@ var NotarizationPlugin = class {
|
|
|
3271
3243
|
this._extensionOpened.emit();
|
|
3272
3244
|
},
|
|
3273
3245
|
onClose: async () => {
|
|
3274
|
-
(0,
|
|
3246
|
+
(0, import_log9.log)("extension closed", {
|
|
3275
3247
|
peer: extension.localPeerId
|
|
3276
3248
|
}, {
|
|
3277
3249
|
F: __dxlog_file11,
|
|
@@ -3327,7 +3299,6 @@ function _ts_decorate4(decorators, target, key, desc) {
|
|
|
3327
3299
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3328
3300
|
}
|
|
3329
3301
|
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
|
|
3330
|
-
var ENABLE_FEED_PURGE = false;
|
|
3331
3302
|
var DataSpace = class {
|
|
3332
3303
|
constructor(params) {
|
|
3333
3304
|
this._ctx = new import_context7.Context();
|
|
@@ -3355,11 +3326,11 @@ var DataSpace = class {
|
|
|
3355
3326
|
});
|
|
3356
3327
|
this._cache = params.cache;
|
|
3357
3328
|
this._state = params.initialState;
|
|
3358
|
-
(0,
|
|
3329
|
+
(0, import_log8.log)("new state", {
|
|
3359
3330
|
state: import_services9.SpaceState[this._state]
|
|
3360
3331
|
}, {
|
|
3361
3332
|
F: __dxlog_file12,
|
|
3362
|
-
L:
|
|
3333
|
+
L: 132,
|
|
3363
3334
|
S: this,
|
|
3364
3335
|
C: (f, a) => f(...a)
|
|
3365
3336
|
});
|
|
@@ -3377,9 +3348,6 @@ var DataSpace = class {
|
|
|
3377
3348
|
get inner() {
|
|
3378
3349
|
return this._inner;
|
|
3379
3350
|
}
|
|
3380
|
-
get dataPipeline() {
|
|
3381
|
-
return this._inner.dataPipeline;
|
|
3382
|
-
}
|
|
3383
3351
|
get presence() {
|
|
3384
3352
|
return this._presence;
|
|
3385
3353
|
}
|
|
@@ -3408,11 +3376,11 @@ var DataSpace = class {
|
|
|
3408
3376
|
await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
|
|
3409
3377
|
await this._inner.open(new import_context7.Context());
|
|
3410
3378
|
this._state = import_services9.SpaceState.CONTROL_ONLY;
|
|
3411
|
-
(0,
|
|
3379
|
+
(0, import_log8.log)("new state", {
|
|
3412
3380
|
state: import_services9.SpaceState[this._state]
|
|
3413
3381
|
}, {
|
|
3414
3382
|
F: __dxlog_file12,
|
|
3415
|
-
L:
|
|
3383
|
+
L: 190,
|
|
3416
3384
|
S: this,
|
|
3417
3385
|
C: (f, a) => f(...a)
|
|
3418
3386
|
});
|
|
@@ -3426,11 +3394,11 @@ var DataSpace = class {
|
|
|
3426
3394
|
async _close() {
|
|
3427
3395
|
await this._callbacks.beforeClose?.();
|
|
3428
3396
|
this._state = import_services9.SpaceState.CLOSED;
|
|
3429
|
-
(0,
|
|
3397
|
+
(0, import_log8.log)("new state", {
|
|
3430
3398
|
state: import_services9.SpaceState[this._state]
|
|
3431
3399
|
}, {
|
|
3432
3400
|
F: __dxlog_file12,
|
|
3433
|
-
L:
|
|
3401
|
+
L: 204,
|
|
3434
3402
|
S: this,
|
|
3435
3403
|
C: (f, a) => f(...a)
|
|
3436
3404
|
});
|
|
@@ -3460,26 +3428,26 @@ var DataSpace = class {
|
|
|
3460
3428
|
await this.initializeDataPipeline();
|
|
3461
3429
|
} catch (err) {
|
|
3462
3430
|
if (err instanceof import_protocols8.CancelledError || err instanceof import_context7.ContextDisposedError) {
|
|
3463
|
-
(0,
|
|
3431
|
+
(0, import_log8.log)("data pipeline initialization cancelled", err, {
|
|
3464
3432
|
F: __dxlog_file12,
|
|
3465
|
-
L:
|
|
3433
|
+
L: 237,
|
|
3466
3434
|
S: this,
|
|
3467
3435
|
C: (f, a) => f(...a)
|
|
3468
3436
|
});
|
|
3469
3437
|
return;
|
|
3470
3438
|
}
|
|
3471
|
-
|
|
3439
|
+
import_log8.log.error("Error initializing data pipeline", err, {
|
|
3472
3440
|
F: __dxlog_file12,
|
|
3473
|
-
L:
|
|
3441
|
+
L: 241,
|
|
3474
3442
|
S: this,
|
|
3475
3443
|
C: (f, a) => f(...a)
|
|
3476
3444
|
});
|
|
3477
3445
|
this._state = import_services9.SpaceState.ERROR;
|
|
3478
|
-
(0,
|
|
3446
|
+
(0, import_log8.log)("new state", {
|
|
3479
3447
|
state: import_services9.SpaceState[this._state]
|
|
3480
3448
|
}, {
|
|
3481
3449
|
F: __dxlog_file12,
|
|
3482
|
-
L:
|
|
3450
|
+
L: 243,
|
|
3483
3451
|
S: this,
|
|
3484
3452
|
C: (f, a) => f(...a)
|
|
3485
3453
|
});
|
|
@@ -3495,44 +3463,31 @@ var DataSpace = class {
|
|
|
3495
3463
|
throw new import_protocols8.SystemError("Invalid operation");
|
|
3496
3464
|
}
|
|
3497
3465
|
this._state = import_services9.SpaceState.INITIALIZING;
|
|
3498
|
-
(0,
|
|
3466
|
+
(0, import_log8.log)("new state", {
|
|
3499
3467
|
state: import_services9.SpaceState[this._state]
|
|
3500
3468
|
}, {
|
|
3501
3469
|
F: __dxlog_file12,
|
|
3502
|
-
L:
|
|
3470
|
+
L: 259,
|
|
3503
3471
|
S: this,
|
|
3504
3472
|
C: (f, a) => f(...a)
|
|
3505
3473
|
});
|
|
3506
3474
|
await this._initializeAndReadControlPipeline();
|
|
3507
3475
|
await (0, import_async10.sleep)(1);
|
|
3508
3476
|
this._automergeSpaceState.startProcessingRootDocs();
|
|
3509
|
-
await this.
|
|
3510
|
-
|
|
3511
|
-
await (0, import_context7.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
|
|
3512
|
-
(0, import_log9.log)("waiting for data pipeline to reach target timeframe", void 0, {
|
|
3477
|
+
await (0, import_context7.cancelWithContext)(this._ctx, this.automergeSpaceState.ensureEpochInitialized());
|
|
3478
|
+
(0, import_log8.log)("data pipeline ready", void 0, {
|
|
3513
3479
|
F: __dxlog_file12,
|
|
3514
|
-
L:
|
|
3515
|
-
S: this,
|
|
3516
|
-
C: (f, a) => f(...a)
|
|
3517
|
-
});
|
|
3518
|
-
await this._inner.dataPipeline.pipelineState.waitUntilReachedTargetTimeframe({
|
|
3519
|
-
ctx: this._ctx,
|
|
3520
|
-
breakOnStall: false
|
|
3521
|
-
});
|
|
3522
|
-
this.metrics.dataPipelineReady = /* @__PURE__ */ new Date();
|
|
3523
|
-
(0, import_log9.log)("data pipeline ready", void 0, {
|
|
3524
|
-
F: __dxlog_file12,
|
|
3525
|
-
L: 296,
|
|
3480
|
+
L: 271,
|
|
3526
3481
|
S: this,
|
|
3527
3482
|
C: (f, a) => f(...a)
|
|
3528
3483
|
});
|
|
3529
3484
|
await this._callbacks.beforeReady?.();
|
|
3530
3485
|
this._state = import_services9.SpaceState.READY;
|
|
3531
|
-
(0,
|
|
3486
|
+
(0, import_log8.log)("new state", {
|
|
3532
3487
|
state: import_services9.SpaceState[this._state]
|
|
3533
3488
|
}, {
|
|
3534
3489
|
F: __dxlog_file12,
|
|
3535
|
-
L:
|
|
3490
|
+
L: 275,
|
|
3536
3491
|
S: this,
|
|
3537
3492
|
C: (f, a) => f(...a)
|
|
3538
3493
|
});
|
|
@@ -3546,9 +3501,9 @@ var DataSpace = class {
|
|
|
3546
3501
|
});
|
|
3547
3502
|
this.metrics.controlPipelineReady = /* @__PURE__ */ new Date();
|
|
3548
3503
|
await this._createWritableFeeds();
|
|
3549
|
-
(0,
|
|
3504
|
+
(0, import_log8.log)("writable feeds created", void 0, {
|
|
3550
3505
|
F: __dxlog_file12,
|
|
3551
|
-
L:
|
|
3506
|
+
L: 291,
|
|
3552
3507
|
S: this,
|
|
3553
3508
|
C: (f, a) => f(...a)
|
|
3554
3509
|
});
|
|
@@ -3606,12 +3561,12 @@ var DataSpace = class {
|
|
|
3606
3561
|
}
|
|
3607
3562
|
}
|
|
3608
3563
|
_onNewAutomergeRoot(rootUrl) {
|
|
3609
|
-
(0,
|
|
3564
|
+
(0, import_log8.log)("loading automerge root doc for space", {
|
|
3610
3565
|
space: this.key,
|
|
3611
3566
|
rootUrl
|
|
3612
3567
|
}, {
|
|
3613
3568
|
F: __dxlog_file12,
|
|
3614
|
-
L:
|
|
3569
|
+
L: 357,
|
|
3615
3570
|
S: this,
|
|
3616
3571
|
C: (f, a) => f(...a)
|
|
3617
3572
|
});
|
|
@@ -3637,13 +3592,13 @@ var DataSpace = class {
|
|
|
3637
3592
|
if (err instanceof import_context7.ContextDisposedError) {
|
|
3638
3593
|
return;
|
|
3639
3594
|
}
|
|
3640
|
-
|
|
3595
|
+
import_log8.log.warn("error loading automerge root doc", {
|
|
3641
3596
|
space: this.key,
|
|
3642
3597
|
rootUrl,
|
|
3643
3598
|
err
|
|
3644
3599
|
}, {
|
|
3645
3600
|
F: __dxlog_file12,
|
|
3646
|
-
L:
|
|
3601
|
+
L: 380,
|
|
3647
3602
|
S: this,
|
|
3648
3603
|
C: (f, a) => f(...a)
|
|
3649
3604
|
});
|
|
@@ -3671,7 +3626,12 @@ var DataSpace = class {
|
|
|
3671
3626
|
case void 0:
|
|
3672
3627
|
case import_services9.CreateEpochRequest.Migration.NONE:
|
|
3673
3628
|
{
|
|
3674
|
-
epoch =
|
|
3629
|
+
epoch = {
|
|
3630
|
+
previousId: this._automergeSpaceState.lastEpoch?.id,
|
|
3631
|
+
number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
|
|
3632
|
+
timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe2.Timeframe(),
|
|
3633
|
+
automergeRoot: this._automergeSpaceState.lastEpoch?.subject.assertion?.automergeRoot
|
|
3634
|
+
};
|
|
3675
3635
|
}
|
|
3676
3636
|
break;
|
|
3677
3637
|
case import_services9.CreateEpochRequest.Migration.INIT_AUTOMERGE:
|
|
@@ -3693,7 +3653,7 @@ var DataSpace = class {
|
|
|
3693
3653
|
const newRoot = this._automergeHost.repo.create(rootHandle.docSync());
|
|
3694
3654
|
(0, import_invariant10.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
3695
3655
|
F: __dxlog_file12,
|
|
3696
|
-
L:
|
|
3656
|
+
L: 430,
|
|
3697
3657
|
S: this,
|
|
3698
3658
|
A: [
|
|
3699
3659
|
"typeof newRoot.url === 'string' && newRoot.url.length > 0",
|
|
@@ -3729,15 +3689,6 @@ var DataSpace = class {
|
|
|
3729
3689
|
receipt.seq
|
|
3730
3690
|
]
|
|
3731
3691
|
]));
|
|
3732
|
-
if (ENABLE_FEED_PURGE) {
|
|
3733
|
-
for (const feed of this.inner.dataPipeline.pipelineState?.feeds ?? []) {
|
|
3734
|
-
const indexBeforeEpoch = epoch.timeframe.get(feed.key);
|
|
3735
|
-
if (indexBeforeEpoch === void 0) {
|
|
3736
|
-
continue;
|
|
3737
|
-
}
|
|
3738
|
-
await feed.safeClear(0, indexBeforeEpoch + 1);
|
|
3739
|
-
}
|
|
3740
|
-
}
|
|
3741
3692
|
}
|
|
3742
3693
|
async activate() {
|
|
3743
3694
|
if (this._state !== import_services9.SpaceState.INACTIVE) {
|
|
@@ -3754,11 +3705,11 @@ var DataSpace = class {
|
|
|
3754
3705
|
await this._metadataStore.setSpaceState(this.key, import_services9.SpaceState.INACTIVE);
|
|
3755
3706
|
await this._close();
|
|
3756
3707
|
this._state = import_services9.SpaceState.INACTIVE;
|
|
3757
|
-
(0,
|
|
3708
|
+
(0, import_log8.log)("new state", {
|
|
3758
3709
|
state: import_services9.SpaceState[this._state]
|
|
3759
3710
|
}, {
|
|
3760
3711
|
F: __dxlog_file12,
|
|
3761
|
-
L:
|
|
3712
|
+
L: 482,
|
|
3762
3713
|
S: this,
|
|
3763
3714
|
C: (f, a) => f(...a)
|
|
3764
3715
|
});
|
|
@@ -3888,16 +3839,15 @@ var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
|
|
|
3888
3839
|
var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
3889
3840
|
var PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
3890
3841
|
var DataSpaceManager = class {
|
|
3891
|
-
constructor(_spaceManager, _metadataStore,
|
|
3842
|
+
constructor(_spaceManager, _metadataStore, _keyring, _signingContext, _feedStore, _automergeHost, params) {
|
|
3892
3843
|
this._spaceManager = _spaceManager;
|
|
3893
3844
|
this._metadataStore = _metadataStore;
|
|
3894
|
-
this._dataServiceSubscriptions = _dataServiceSubscriptions;
|
|
3895
3845
|
this._keyring = _keyring;
|
|
3896
3846
|
this._signingContext = _signingContext;
|
|
3897
3847
|
this._feedStore = _feedStore;
|
|
3898
3848
|
this._automergeHost = _automergeHost;
|
|
3899
3849
|
this._ctx = new import_context9.Context();
|
|
3900
|
-
this.updated = new
|
|
3850
|
+
this.updated = new import_async13.Event();
|
|
3901
3851
|
this._spaces = new import_util6.ComplexMap(import_keys9.PublicKey.hash);
|
|
3902
3852
|
this._isOpen = false;
|
|
3903
3853
|
this._instanceId = import_keys9.PublicKey.random().toHex();
|
|
@@ -3910,46 +3860,46 @@ var DataSpaceManager = class {
|
|
|
3910
3860
|
return this._spaces;
|
|
3911
3861
|
}
|
|
3912
3862
|
async open() {
|
|
3913
|
-
(0,
|
|
3863
|
+
(0, import_log10.log)("open", void 0, {
|
|
3914
3864
|
F: __dxlog_file13,
|
|
3915
|
-
L:
|
|
3865
|
+
L: 98,
|
|
3916
3866
|
S: this,
|
|
3917
3867
|
C: (f, a) => f(...a)
|
|
3918
3868
|
});
|
|
3919
|
-
|
|
3869
|
+
import_log10.log.trace("dxos.echo.data-space-manager.open", import_protocols10.trace.begin({
|
|
3920
3870
|
id: this._instanceId
|
|
3921
3871
|
}), {
|
|
3922
3872
|
F: __dxlog_file13,
|
|
3923
|
-
L:
|
|
3873
|
+
L: 99,
|
|
3924
3874
|
S: this,
|
|
3925
3875
|
C: (f, a) => f(...a)
|
|
3926
3876
|
});
|
|
3927
|
-
(0,
|
|
3877
|
+
(0, import_log10.log)("metadata loaded", {
|
|
3928
3878
|
spaces: this._metadataStore.spaces.length
|
|
3929
3879
|
}, {
|
|
3930
3880
|
F: __dxlog_file13,
|
|
3931
|
-
L:
|
|
3881
|
+
L: 100,
|
|
3932
3882
|
S: this,
|
|
3933
3883
|
C: (f, a) => f(...a)
|
|
3934
3884
|
});
|
|
3935
3885
|
await (0, import_util6.forEachAsync)(this._metadataStore.spaces, async (spaceMetadata) => {
|
|
3936
3886
|
try {
|
|
3937
|
-
(0,
|
|
3887
|
+
(0, import_log10.log)("load space", {
|
|
3938
3888
|
spaceMetadata
|
|
3939
3889
|
}, {
|
|
3940
3890
|
F: __dxlog_file13,
|
|
3941
|
-
L:
|
|
3891
|
+
L: 104,
|
|
3942
3892
|
S: this,
|
|
3943
3893
|
C: (f, a) => f(...a)
|
|
3944
3894
|
});
|
|
3945
3895
|
await this._constructSpace(spaceMetadata);
|
|
3946
3896
|
} catch (err) {
|
|
3947
|
-
|
|
3897
|
+
import_log10.log.error("Error loading space", {
|
|
3948
3898
|
spaceMetadata,
|
|
3949
3899
|
err
|
|
3950
3900
|
}, {
|
|
3951
3901
|
F: __dxlog_file13,
|
|
3952
|
-
L:
|
|
3902
|
+
L: 107,
|
|
3953
3903
|
S: this,
|
|
3954
3904
|
C: (f, a) => f(...a)
|
|
3955
3905
|
});
|
|
@@ -3962,19 +3912,19 @@ var DataSpaceManager = class {
|
|
|
3962
3912
|
space.initializeDataPipelineAsync();
|
|
3963
3913
|
}
|
|
3964
3914
|
}
|
|
3965
|
-
|
|
3915
|
+
import_log10.log.trace("dxos.echo.data-space-manager.open", import_protocols10.trace.end({
|
|
3966
3916
|
id: this._instanceId
|
|
3967
3917
|
}), {
|
|
3968
3918
|
F: __dxlog_file13,
|
|
3969
|
-
L:
|
|
3919
|
+
L: 120,
|
|
3970
3920
|
S: this,
|
|
3971
3921
|
C: (f, a) => f(...a)
|
|
3972
3922
|
});
|
|
3973
3923
|
}
|
|
3974
3924
|
async close() {
|
|
3975
|
-
(0,
|
|
3925
|
+
(0, import_log10.log)("close", void 0, {
|
|
3976
3926
|
F: __dxlog_file13,
|
|
3977
|
-
L:
|
|
3927
|
+
L: 125,
|
|
3978
3928
|
S: this,
|
|
3979
3929
|
C: (f, a) => f(...a)
|
|
3980
3930
|
});
|
|
@@ -3990,7 +3940,7 @@ var DataSpaceManager = class {
|
|
|
3990
3940
|
async createSpace() {
|
|
3991
3941
|
(0, import_invariant12.invariant)(this._isOpen, "Not open.", {
|
|
3992
3942
|
F: __dxlog_file13,
|
|
3993
|
-
L:
|
|
3943
|
+
L: 138,
|
|
3994
3944
|
S: this,
|
|
3995
3945
|
A: [
|
|
3996
3946
|
"this._isOpen",
|
|
@@ -4007,11 +3957,11 @@ var DataSpaceManager = class {
|
|
|
4007
3957
|
dataFeedKey,
|
|
4008
3958
|
state: import_services10.SpaceState.ACTIVE
|
|
4009
3959
|
};
|
|
4010
|
-
(0,
|
|
3960
|
+
(0, import_log10.log)("creating space...", {
|
|
4011
3961
|
spaceKey
|
|
4012
3962
|
}, {
|
|
4013
3963
|
F: __dxlog_file13,
|
|
4014
|
-
L:
|
|
3964
|
+
L: 150,
|
|
4015
3965
|
S: this,
|
|
4016
3966
|
C: (f, a) => f(...a)
|
|
4017
3967
|
});
|
|
@@ -4027,7 +3977,7 @@ var DataSpaceManager = class {
|
|
|
4027
3977
|
const memberCredential = credentials[1];
|
|
4028
3978
|
(0, import_invariant12.invariant)((0, import_credentials12.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
4029
3979
|
F: __dxlog_file13,
|
|
4030
|
-
L:
|
|
3980
|
+
L: 163,
|
|
4031
3981
|
S: this,
|
|
4032
3982
|
A: [
|
|
4033
3983
|
"getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -4041,17 +3991,17 @@ var DataSpaceManager = class {
|
|
|
4041
3991
|
}
|
|
4042
3992
|
// TODO(burdon): Rename join space.
|
|
4043
3993
|
async acceptSpace(opts) {
|
|
4044
|
-
(0,
|
|
3994
|
+
(0, import_log10.log)("accept space", {
|
|
4045
3995
|
opts
|
|
4046
3996
|
}, {
|
|
4047
3997
|
F: __dxlog_file13,
|
|
4048
|
-
L:
|
|
3998
|
+
L: 175,
|
|
4049
3999
|
S: this,
|
|
4050
4000
|
C: (f, a) => f(...a)
|
|
4051
4001
|
});
|
|
4052
4002
|
(0, import_invariant12.invariant)(this._isOpen, "Not open.", {
|
|
4053
4003
|
F: __dxlog_file13,
|
|
4054
|
-
L:
|
|
4004
|
+
L: 176,
|
|
4055
4005
|
S: this,
|
|
4056
4006
|
A: [
|
|
4057
4007
|
"this._isOpen",
|
|
@@ -4060,7 +4010,7 @@ var DataSpaceManager = class {
|
|
|
4060
4010
|
});
|
|
4061
4011
|
(0, import_invariant12.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
4062
4012
|
F: __dxlog_file13,
|
|
4063
|
-
L:
|
|
4013
|
+
L: 177,
|
|
4064
4014
|
S: this,
|
|
4065
4015
|
A: [
|
|
4066
4016
|
"!this._spaces.has(opts.spaceKey)",
|
|
@@ -4091,11 +4041,11 @@ var DataSpaceManager = class {
|
|
|
4091
4041
|
}));
|
|
4092
4042
|
}
|
|
4093
4043
|
async _constructSpace(metadata) {
|
|
4094
|
-
(0,
|
|
4044
|
+
(0, import_log10.log)("construct space", {
|
|
4095
4045
|
metadata
|
|
4096
4046
|
}, {
|
|
4097
4047
|
F: __dxlog_file13,
|
|
4098
|
-
L:
|
|
4048
|
+
L: 210,
|
|
4099
4049
|
S: this,
|
|
4100
4050
|
C: (f, a) => f(...a)
|
|
4101
4051
|
});
|
|
@@ -4131,9 +4081,9 @@ var DataSpaceManager = class {
|
|
|
4131
4081
|
session.addExtension("dxos.mesh.teleport.automerge", this._automergeHost.createExtension());
|
|
4132
4082
|
},
|
|
4133
4083
|
onAuthFailure: () => {
|
|
4134
|
-
|
|
4084
|
+
import_log10.log.warn("auth failure", void 0, {
|
|
4135
4085
|
F: __dxlog_file13,
|
|
4136
|
-
L:
|
|
4086
|
+
L: 247,
|
|
4137
4087
|
S: this,
|
|
4138
4088
|
C: (f, a) => f(...a)
|
|
4139
4089
|
});
|
|
@@ -4153,23 +4103,22 @@ var DataSpaceManager = class {
|
|
|
4153
4103
|
signingContext: this._signingContext,
|
|
4154
4104
|
callbacks: {
|
|
4155
4105
|
beforeReady: async () => {
|
|
4156
|
-
(0,
|
|
4106
|
+
(0, import_log10.log)("before space ready", {
|
|
4157
4107
|
space: space.key
|
|
4158
4108
|
}, {
|
|
4159
4109
|
F: __dxlog_file13,
|
|
4160
|
-
L:
|
|
4110
|
+
L: 265,
|
|
4161
4111
|
S: this,
|
|
4162
4112
|
C: (f, a) => f(...a)
|
|
4163
4113
|
});
|
|
4164
|
-
await this._dataServiceSubscriptions.registerSpace(space.key, dataSpace.dataPipeline.databaseHost.createDataServiceHost());
|
|
4165
4114
|
},
|
|
4166
4115
|
afterReady: async () => {
|
|
4167
|
-
(0,
|
|
4116
|
+
(0, import_log10.log)("after space ready", {
|
|
4168
4117
|
space: space.key,
|
|
4169
4118
|
open: this._isOpen
|
|
4170
4119
|
}, {
|
|
4171
4120
|
F: __dxlog_file13,
|
|
4172
|
-
L:
|
|
4121
|
+
L: 268,
|
|
4173
4122
|
S: this,
|
|
4174
4123
|
C: (f, a) => f(...a)
|
|
4175
4124
|
});
|
|
@@ -4178,15 +4127,14 @@ var DataSpaceManager = class {
|
|
|
4178
4127
|
}
|
|
4179
4128
|
},
|
|
4180
4129
|
beforeClose: async () => {
|
|
4181
|
-
(0,
|
|
4130
|
+
(0, import_log10.log)("before space close", {
|
|
4182
4131
|
space: space.key
|
|
4183
4132
|
}, {
|
|
4184
4133
|
F: __dxlog_file13,
|
|
4185
|
-
L:
|
|
4134
|
+
L: 274,
|
|
4186
4135
|
S: this,
|
|
4187
4136
|
C: (f, a) => f(...a)
|
|
4188
4137
|
});
|
|
4189
|
-
await this._dataServiceSubscriptions.unregisterSpace(space.key);
|
|
4190
4138
|
}
|
|
4191
4139
|
},
|
|
4192
4140
|
cache: metadata.cache,
|
|
@@ -4198,34 +4146,30 @@ var DataSpaceManager = class {
|
|
|
4198
4146
|
if (metadata.controlTimeframe) {
|
|
4199
4147
|
dataSpace.inner.controlPipeline.state.setTargetTimeframe(metadata.controlTimeframe);
|
|
4200
4148
|
}
|
|
4201
|
-
if (metadata.dataTimeframe) {
|
|
4202
|
-
dataSpace.dataPipeline.setTargetTimeframe(metadata.dataTimeframe);
|
|
4203
|
-
}
|
|
4204
4149
|
this._spaces.set(metadata.key, dataSpace);
|
|
4205
4150
|
return dataSpace;
|
|
4206
4151
|
}
|
|
4207
4152
|
};
|
|
4208
4153
|
_ts_decorate5([
|
|
4209
|
-
|
|
4154
|
+
import_async13.synchronized
|
|
4210
4155
|
], DataSpaceManager.prototype, "open", null);
|
|
4211
4156
|
_ts_decorate5([
|
|
4212
|
-
|
|
4157
|
+
import_async13.synchronized
|
|
4213
4158
|
], DataSpaceManager.prototype, "close", null);
|
|
4214
4159
|
_ts_decorate5([
|
|
4215
|
-
|
|
4160
|
+
import_async13.synchronized
|
|
4216
4161
|
], DataSpaceManager.prototype, "createSpace", null);
|
|
4217
4162
|
_ts_decorate5([
|
|
4218
|
-
|
|
4163
|
+
import_async13.synchronized
|
|
4219
4164
|
], DataSpaceManager.prototype, "acceptSpace", null);
|
|
4220
4165
|
DataSpaceManager = _ts_decorate5([
|
|
4221
|
-
(0,
|
|
4166
|
+
(0, import_async13.trackLeaks)("open", "close")
|
|
4222
4167
|
], DataSpaceManager);
|
|
4223
4168
|
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
|
|
4224
4169
|
var SpacesServiceImpl = class {
|
|
4225
|
-
constructor(_identityManager, _spaceManager,
|
|
4170
|
+
constructor(_identityManager, _spaceManager, _getDataSpaceManager) {
|
|
4226
4171
|
this._identityManager = _identityManager;
|
|
4227
4172
|
this._spaceManager = _spaceManager;
|
|
4228
|
-
this._dataServiceSubscriptions = _dataServiceSubscriptions;
|
|
4229
4173
|
this._getDataSpaceManager = _getDataSpaceManager;
|
|
4230
4174
|
}
|
|
4231
4175
|
async createSpace() {
|
|
@@ -4254,14 +4198,14 @@ var SpacesServiceImpl = class {
|
|
|
4254
4198
|
}
|
|
4255
4199
|
querySpaces() {
|
|
4256
4200
|
return new import_codec_protobuf11.Stream(({ next, ctx }) => {
|
|
4257
|
-
const scheduler = new
|
|
4201
|
+
const scheduler = new import_async14.UpdateScheduler(ctx, async () => {
|
|
4258
4202
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
4259
4203
|
const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
|
|
4260
|
-
(0,
|
|
4204
|
+
(0, import_log11.log)("update", {
|
|
4261
4205
|
spaces
|
|
4262
4206
|
}, {
|
|
4263
4207
|
F: __dxlog_file14,
|
|
4264
|
-
L:
|
|
4208
|
+
L: 77,
|
|
4265
4209
|
S: this,
|
|
4266
4210
|
C: (f, a) => f(...a)
|
|
4267
4211
|
});
|
|
@@ -4271,20 +4215,17 @@ var SpacesServiceImpl = class {
|
|
|
4271
4215
|
}, {
|
|
4272
4216
|
maxFrequency: process.env.NODE_ENV === "test" ? void 0 : 2
|
|
4273
4217
|
});
|
|
4274
|
-
(0,
|
|
4218
|
+
(0, import_async14.scheduleTask)(ctx, async () => {
|
|
4275
4219
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
4276
|
-
const subscriptions = new
|
|
4220
|
+
const subscriptions = new import_async14.EventSubscriptions();
|
|
4277
4221
|
ctx.onDispose(() => subscriptions.clear());
|
|
4278
4222
|
const subscribeSpaces = () => {
|
|
4279
4223
|
subscriptions.clear();
|
|
4280
4224
|
for (const space of dataSpaceManager.spaces.values()) {
|
|
4281
4225
|
subscriptions.add(space.stateUpdate.on(ctx, () => scheduler.forceTrigger()));
|
|
4282
4226
|
subscriptions.add(space.presence.updated.on(ctx, () => scheduler.trigger()));
|
|
4283
|
-
subscriptions.add(space.
|
|
4227
|
+
subscriptions.add(space.automergeSpaceState.onNewEpoch.on(ctx, () => scheduler.trigger()));
|
|
4284
4228
|
subscriptions.add(space.inner.controlPipeline.state.timeframeUpdate.on(ctx, () => scheduler.trigger()));
|
|
4285
|
-
if (space.dataPipeline.pipelineState) {
|
|
4286
|
-
subscriptions.add(space.dataPipeline.pipelineState.timeframeUpdate.on(ctx, () => scheduler.trigger()));
|
|
4287
|
-
}
|
|
4288
4229
|
}
|
|
4289
4230
|
};
|
|
4290
4231
|
dataSpaceManager.updated.on(ctx, () => {
|
|
@@ -4308,7 +4249,7 @@ var SpacesServiceImpl = class {
|
|
|
4308
4249
|
}
|
|
4309
4250
|
subscribeMessages({ spaceKey, channel }) {
|
|
4310
4251
|
return new import_codec_protobuf11.Stream(({ ctx, next }) => {
|
|
4311
|
-
(0,
|
|
4252
|
+
(0, import_async14.scheduleTask)(ctx, async () => {
|
|
4312
4253
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
4313
4254
|
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
|
|
4314
4255
|
const handle = space.listen(getChannelId(channel), (message) => {
|
|
@@ -4327,7 +4268,7 @@ var SpacesServiceImpl = class {
|
|
|
4327
4268
|
}
|
|
4328
4269
|
};
|
|
4329
4270
|
ctx.onDispose(() => space.spaceState.removeCredentialProcessor(processor));
|
|
4330
|
-
(0,
|
|
4271
|
+
(0, import_async14.scheduleTask)(ctx, async () => {
|
|
4331
4272
|
await space.spaceState.addCredentialProcessor(processor);
|
|
4332
4273
|
if (noTail) {
|
|
4333
4274
|
close();
|
|
@@ -4347,7 +4288,7 @@ var SpacesServiceImpl = class {
|
|
|
4347
4288
|
} else {
|
|
4348
4289
|
(0, import_invariant13.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
4349
4290
|
F: __dxlog_file14,
|
|
4350
|
-
L:
|
|
4291
|
+
L: 164,
|
|
4351
4292
|
S: this,
|
|
4352
4293
|
A: [
|
|
4353
4294
|
"!credential.id",
|
|
@@ -4356,7 +4297,7 @@ var SpacesServiceImpl = class {
|
|
|
4356
4297
|
});
|
|
4357
4298
|
(0, import_invariant13.invariant)(this._identityManager.identity, "Identity is not available", {
|
|
4358
4299
|
F: __dxlog_file14,
|
|
4359
|
-
L:
|
|
4300
|
+
L: 165,
|
|
4360
4301
|
S: this,
|
|
4361
4302
|
A: [
|
|
4362
4303
|
"this._identityManager.identity",
|
|
@@ -4366,7 +4307,7 @@ var SpacesServiceImpl = class {
|
|
|
4366
4307
|
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
4367
4308
|
(0, import_invariant13.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
4368
4309
|
F: __dxlog_file14,
|
|
4369
|
-
L:
|
|
4310
|
+
L: 167,
|
|
4370
4311
|
S: this,
|
|
4371
4312
|
A: [
|
|
4372
4313
|
"credential.issuer.equals(signer.getIssuer())",
|
|
@@ -4398,17 +4339,17 @@ var SpacesServiceImpl = class {
|
|
|
4398
4339
|
state: space.state,
|
|
4399
4340
|
error: space.error ? (0, import_protocols11.encodeError)(space.error) : void 0,
|
|
4400
4341
|
pipeline: {
|
|
4401
|
-
currentEpoch: space.
|
|
4402
|
-
appliedEpoch: space.
|
|
4342
|
+
currentEpoch: space.automergeSpaceState.lastEpoch,
|
|
4343
|
+
appliedEpoch: space.automergeSpaceState.lastEpoch,
|
|
4403
4344
|
controlFeeds: space.inner.controlPipeline.state.feeds.map((feed) => feed.key),
|
|
4404
4345
|
currentControlTimeframe: space.inner.controlPipeline.state.timeframe,
|
|
4405
4346
|
targetControlTimeframe: space.inner.controlPipeline.state.targetTimeframe,
|
|
4406
4347
|
totalControlTimeframe: space.inner.controlPipeline.state.endTimeframe,
|
|
4407
|
-
dataFeeds:
|
|
4408
|
-
startDataTimeframe:
|
|
4409
|
-
currentDataTimeframe:
|
|
4410
|
-
targetDataTimeframe:
|
|
4411
|
-
totalDataTimeframe:
|
|
4348
|
+
dataFeeds: void 0,
|
|
4349
|
+
startDataTimeframe: void 0,
|
|
4350
|
+
currentDataTimeframe: void 0,
|
|
4351
|
+
targetDataTimeframe: void 0,
|
|
4352
|
+
totalDataTimeframe: void 0
|
|
4412
4353
|
},
|
|
4413
4354
|
members: Array.from(space.inner.spaceState.members.values()).map((member) => {
|
|
4414
4355
|
const peers = space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key));
|
|
@@ -4444,12 +4385,12 @@ var createLoadDocuments = (automergeHost) => (
|
|
|
4444
4385
|
const handle = automergeHost.repo.find(documentId);
|
|
4445
4386
|
await (0, import_debug7.warnAfterTimeout)(5e3, "to long to load doc", () => handle.whenReady());
|
|
4446
4387
|
const doc = handle.docSync();
|
|
4447
|
-
const
|
|
4388
|
+
const hash = (0, import_automerge.getHeads)(doc).join("");
|
|
4448
4389
|
yield [
|
|
4449
4390
|
{
|
|
4450
4391
|
id,
|
|
4451
4392
|
object: doc.objects[objectId],
|
|
4452
|
-
currentHash:
|
|
4393
|
+
currentHash: hash
|
|
4453
4394
|
}
|
|
4454
4395
|
];
|
|
4455
4396
|
}
|
|
@@ -4524,8 +4465,7 @@ var ServiceContext = class {
|
|
|
4524
4465
|
this.signalManager = signalManager;
|
|
4525
4466
|
this.modelFactory = modelFactory;
|
|
4526
4467
|
this._runtimeParams = _runtimeParams;
|
|
4527
|
-
this.initialized = new
|
|
4528
|
-
this.dataServiceSubscriptions = new import_echo_pipeline2.DataServiceSubscriptions();
|
|
4468
|
+
this.initialized = new import_async15.Trigger();
|
|
4529
4469
|
this._handlerFactories = /* @__PURE__ */ new Map();
|
|
4530
4470
|
this._instanceId = import_keys10.PublicKey.random().toHex();
|
|
4531
4471
|
this.metadataStore = new import_echo_pipeline2.MetadataStore(storage.createDirectory("metadata"));
|
|
@@ -4571,17 +4511,17 @@ var ServiceContext = class {
|
|
|
4571
4511
|
}
|
|
4572
4512
|
async open(ctx) {
|
|
4573
4513
|
await this._checkStorageVersion();
|
|
4574
|
-
(0,
|
|
4514
|
+
(0, import_log12.log)("opening...", void 0, {
|
|
4575
4515
|
F: __dxlog_file15,
|
|
4576
|
-
L:
|
|
4516
|
+
L: 154,
|
|
4577
4517
|
S: this,
|
|
4578
4518
|
C: (f, a) => f(...a)
|
|
4579
4519
|
});
|
|
4580
|
-
|
|
4520
|
+
import_log12.log.trace("dxos.sdk.service-context.open", import_protocols12.trace.begin({
|
|
4581
4521
|
id: this._instanceId
|
|
4582
4522
|
}), {
|
|
4583
4523
|
F: __dxlog_file15,
|
|
4584
|
-
L:
|
|
4524
|
+
L: 155,
|
|
4585
4525
|
S: this,
|
|
4586
4526
|
C: (f, a) => f(...a)
|
|
4587
4527
|
});
|
|
@@ -4593,25 +4533,25 @@ var ServiceContext = class {
|
|
|
4593
4533
|
if (this.identityManager.identity) {
|
|
4594
4534
|
await this._initialize(ctx);
|
|
4595
4535
|
}
|
|
4596
|
-
|
|
4536
|
+
import_log12.log.trace("dxos.sdk.service-context.open", import_protocols12.trace.end({
|
|
4597
4537
|
id: this._instanceId
|
|
4598
4538
|
}), {
|
|
4599
4539
|
F: __dxlog_file15,
|
|
4600
|
-
L:
|
|
4540
|
+
L: 165,
|
|
4601
4541
|
S: this,
|
|
4602
4542
|
C: (f, a) => f(...a)
|
|
4603
4543
|
});
|
|
4604
|
-
(0,
|
|
4544
|
+
(0, import_log12.log)("opened", void 0, {
|
|
4605
4545
|
F: __dxlog_file15,
|
|
4606
|
-
L:
|
|
4546
|
+
L: 166,
|
|
4607
4547
|
S: this,
|
|
4608
4548
|
C: (f, a) => f(...a)
|
|
4609
4549
|
});
|
|
4610
4550
|
}
|
|
4611
4551
|
async close() {
|
|
4612
|
-
(0,
|
|
4552
|
+
(0, import_log12.log)("closing...", void 0, {
|
|
4613
4553
|
F: __dxlog_file15,
|
|
4614
|
-
L:
|
|
4554
|
+
L: 170,
|
|
4615
4555
|
S: this,
|
|
4616
4556
|
C: (f, a) => f(...a)
|
|
4617
4557
|
});
|
|
@@ -4625,12 +4565,11 @@ var ServiceContext = class {
|
|
|
4625
4565
|
await this.feedStore.close();
|
|
4626
4566
|
await this.networkManager.close();
|
|
4627
4567
|
await this.signalManager.close();
|
|
4628
|
-
this.dataServiceSubscriptions.clear();
|
|
4629
4568
|
await this.metadataStore.close();
|
|
4630
4569
|
await this.indexer.destroy();
|
|
4631
|
-
(0,
|
|
4570
|
+
(0, import_log12.log)("closed", void 0, {
|
|
4632
4571
|
F: __dxlog_file15,
|
|
4633
|
-
L:
|
|
4572
|
+
L: 183,
|
|
4634
4573
|
S: this,
|
|
4635
4574
|
C: (f, a) => f(...a)
|
|
4636
4575
|
});
|
|
@@ -4644,7 +4583,7 @@ var ServiceContext = class {
|
|
|
4644
4583
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
4645
4584
|
(0, import_invariant14.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
4646
4585
|
F: __dxlog_file15,
|
|
4647
|
-
L:
|
|
4586
|
+
L: 194,
|
|
4648
4587
|
S: this,
|
|
4649
4588
|
A: [
|
|
4650
4589
|
"factory",
|
|
@@ -4674,9 +4613,9 @@ var ServiceContext = class {
|
|
|
4674
4613
|
}
|
|
4675
4614
|
// Called when identity is created.
|
|
4676
4615
|
async _initialize(ctx) {
|
|
4677
|
-
(0,
|
|
4616
|
+
(0, import_log12.log)("initializing spaces...", void 0, {
|
|
4678
4617
|
F: __dxlog_file15,
|
|
4679
|
-
L:
|
|
4618
|
+
L: 225,
|
|
4680
4619
|
S: this,
|
|
4681
4620
|
C: (f, a) => f(...a)
|
|
4682
4621
|
});
|
|
@@ -4694,12 +4633,12 @@ var ServiceContext = class {
|
|
|
4694
4633
|
});
|
|
4695
4634
|
}
|
|
4696
4635
|
};
|
|
4697
|
-
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.
|
|
4636
|
+
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.keyring, signingContext, this.feedStore, this.automergeHost, this._runtimeParams);
|
|
4698
4637
|
await this.dataSpaceManager.open();
|
|
4699
4638
|
this._handlerFactories.set(import_services12.Invitation.Kind.SPACE, (invitation) => {
|
|
4700
4639
|
(0, import_invariant14.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
4701
4640
|
F: __dxlog_file15,
|
|
4702
|
-
L:
|
|
4641
|
+
L: 249,
|
|
4703
4642
|
S: this,
|
|
4704
4643
|
A: [
|
|
4705
4644
|
"this.dataSpaceManager",
|
|
@@ -4719,33 +4658,33 @@ var ServiceContext = class {
|
|
|
4719
4658
|
return;
|
|
4720
4659
|
}
|
|
4721
4660
|
if (!this.dataSpaceManager) {
|
|
4722
|
-
(0,
|
|
4661
|
+
(0, import_log12.log)("dataSpaceManager not initialized yet, ignoring space admission", {
|
|
4723
4662
|
details: assertion
|
|
4724
4663
|
}, {
|
|
4725
4664
|
F: __dxlog_file15,
|
|
4726
|
-
L:
|
|
4665
|
+
L: 265,
|
|
4727
4666
|
S: this,
|
|
4728
4667
|
C: (f, a) => f(...a)
|
|
4729
4668
|
});
|
|
4730
4669
|
return;
|
|
4731
4670
|
}
|
|
4732
4671
|
if (this.dataSpaceManager.spaces.has(assertion.spaceKey)) {
|
|
4733
|
-
(0,
|
|
4672
|
+
(0, import_log12.log)("space already exists, ignoring space admission", {
|
|
4734
4673
|
details: assertion
|
|
4735
4674
|
}, {
|
|
4736
4675
|
F: __dxlog_file15,
|
|
4737
|
-
L:
|
|
4676
|
+
L: 269,
|
|
4738
4677
|
S: this,
|
|
4739
4678
|
C: (f, a) => f(...a)
|
|
4740
4679
|
});
|
|
4741
4680
|
return;
|
|
4742
4681
|
}
|
|
4743
4682
|
try {
|
|
4744
|
-
(0,
|
|
4683
|
+
(0, import_log12.log)("accepting space recorded in halo", {
|
|
4745
4684
|
details: assertion
|
|
4746
4685
|
}, {
|
|
4747
4686
|
F: __dxlog_file15,
|
|
4748
|
-
L:
|
|
4687
|
+
L: 274,
|
|
4749
4688
|
S: this,
|
|
4750
4689
|
C: (f, a) => f(...a)
|
|
4751
4690
|
});
|
|
@@ -4754,9 +4693,9 @@ var ServiceContext = class {
|
|
|
4754
4693
|
genesisFeedKey: assertion.genesisFeedKey
|
|
4755
4694
|
});
|
|
4756
4695
|
} catch (err) {
|
|
4757
|
-
|
|
4696
|
+
import_log12.log.catch(err, void 0, {
|
|
4758
4697
|
F: __dxlog_file15,
|
|
4759
|
-
L:
|
|
4698
|
+
L: 280,
|
|
4760
4699
|
S: this,
|
|
4761
4700
|
C: (f, a) => f(...a)
|
|
4762
4701
|
});
|
|
@@ -4819,7 +4758,7 @@ var Lock = class {
|
|
|
4819
4758
|
return this._lockPath;
|
|
4820
4759
|
}
|
|
4821
4760
|
async acquire() {
|
|
4822
|
-
(0,
|
|
4761
|
+
(0, import_log13.log)("acquiring lock...", void 0, {
|
|
4823
4762
|
F: __dxlog_file16,
|
|
4824
4763
|
L: 32,
|
|
4825
4764
|
S: this,
|
|
@@ -4827,7 +4766,7 @@ var Lock = class {
|
|
|
4827
4766
|
});
|
|
4828
4767
|
this._fileHandle = await import_lock_file.LockFile.acquire(this._lockPath);
|
|
4829
4768
|
await this._onAcquire?.();
|
|
4830
|
-
(0,
|
|
4769
|
+
(0, import_log13.log)("acquired lock", void 0, {
|
|
4831
4770
|
F: __dxlog_file16,
|
|
4832
4771
|
L: 37,
|
|
4833
4772
|
S: this,
|
|
@@ -4849,7 +4788,7 @@ var Lock = class {
|
|
|
4849
4788
|
}
|
|
4850
4789
|
};
|
|
4851
4790
|
_ts_decorate7([
|
|
4852
|
-
|
|
4791
|
+
import_log13.logInfo
|
|
4853
4792
|
], Lock.prototype, "lockKey", null);
|
|
4854
4793
|
var isLocked = (lockPath) => import_lock_file.LockFile.isLocked(lockPath);
|
|
4855
4794
|
var StorageDriver = import_config.Runtime.Client.Storage.StorageDriver;
|
|
@@ -4953,7 +4892,7 @@ var DevicesServiceImpl = class {
|
|
|
4953
4892
|
presenceSubscribed = true;
|
|
4954
4893
|
}
|
|
4955
4894
|
};
|
|
4956
|
-
const subscriptions = new
|
|
4895
|
+
const subscriptions = new import_async17.EventSubscriptions();
|
|
4957
4896
|
if (this._identityManager.identity) {
|
|
4958
4897
|
subscribeIdentity();
|
|
4959
4898
|
subscribePresence();
|
|
@@ -4972,7 +4911,7 @@ var DevicesServiceImpl = class {
|
|
|
4972
4911
|
};
|
|
4973
4912
|
var LoggingServiceImpl = class {
|
|
4974
4913
|
constructor() {
|
|
4975
|
-
this._logs = new
|
|
4914
|
+
this._logs = new import_async18.Event();
|
|
4976
4915
|
this._started = Date.now();
|
|
4977
4916
|
this._sessionId = import_keys12.PublicKey.random().toHex();
|
|
4978
4917
|
this._logProcessor = (_config, entry2) => {
|
|
@@ -4980,11 +4919,11 @@ var LoggingServiceImpl = class {
|
|
|
4980
4919
|
};
|
|
4981
4920
|
}
|
|
4982
4921
|
async open() {
|
|
4983
|
-
|
|
4922
|
+
import_log15.log.runtimeConfig.processors.push(this._logProcessor);
|
|
4984
4923
|
}
|
|
4985
4924
|
async close() {
|
|
4986
|
-
const index =
|
|
4987
|
-
|
|
4925
|
+
const index = import_log15.log.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
|
|
4926
|
+
import_log15.log.runtimeConfig.processors.splice(index, 1);
|
|
4988
4927
|
}
|
|
4989
4928
|
async controlMetrics({ reset, record }) {
|
|
4990
4929
|
if (reset) {
|
|
@@ -5045,7 +4984,7 @@ var LoggingServiceImpl = class {
|
|
|
5045
4984
|
}
|
|
5046
4985
|
const record = {
|
|
5047
4986
|
...entry2,
|
|
5048
|
-
context: (0, import_util10.jsonify)((0,
|
|
4987
|
+
context: (0, import_util10.jsonify)((0, import_log15.getContextFromEntry)(entry2)),
|
|
5049
4988
|
timestamp: /* @__PURE__ */ new Date(),
|
|
5050
4989
|
meta: {
|
|
5051
4990
|
// TODO(dmaretskyi): Fix proto.
|
|
@@ -5180,7 +5119,7 @@ function _ts_decorate8(decorators, target, key, desc) {
|
|
|
5180
5119
|
}
|
|
5181
5120
|
var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
|
|
5182
5121
|
var createDefaultModelFactory = () => {
|
|
5183
|
-
return new import_model_factory.ModelFactory().registerModel(
|
|
5122
|
+
return new import_model_factory.ModelFactory().registerModel(import_document_model.DocumentModel).registerModel(import_text_model.TextModel);
|
|
5184
5123
|
};
|
|
5185
5124
|
var ClientServicesHost = class {
|
|
5186
5125
|
constructor({
|
|
@@ -5195,7 +5134,7 @@ var ClientServicesHost = class {
|
|
|
5195
5134
|
runtimeParams
|
|
5196
5135
|
} = {}) {
|
|
5197
5136
|
this._tracingService = import_tracing7.TRACE_PROCESSOR.createTraceSender();
|
|
5198
|
-
this._statusUpdate = new
|
|
5137
|
+
this._statusUpdate = new import_async16.Event();
|
|
5199
5138
|
this._opening = false;
|
|
5200
5139
|
this._open = false;
|
|
5201
5140
|
this._storage = storage;
|
|
@@ -5277,7 +5216,7 @@ var ClientServicesHost = class {
|
|
|
5277
5216
|
"'service host is open'"
|
|
5278
5217
|
]
|
|
5279
5218
|
});
|
|
5280
|
-
(0,
|
|
5219
|
+
(0, import_log14.log)("initializing...", void 0, {
|
|
5281
5220
|
F: __dxlog_file18,
|
|
5282
5221
|
L: 192,
|
|
5283
5222
|
S: this,
|
|
@@ -5316,7 +5255,7 @@ var ClientServicesHost = class {
|
|
|
5316
5255
|
transportFactory,
|
|
5317
5256
|
signalManager
|
|
5318
5257
|
});
|
|
5319
|
-
(0,
|
|
5258
|
+
(0, import_log14.log)("initialized", void 0, {
|
|
5320
5259
|
F: __dxlog_file18,
|
|
5321
5260
|
L: 218,
|
|
5322
5261
|
S: this,
|
|
@@ -5328,7 +5267,7 @@ var ClientServicesHost = class {
|
|
|
5328
5267
|
return;
|
|
5329
5268
|
}
|
|
5330
5269
|
const traceId = import_keys11.PublicKey.random().toHex();
|
|
5331
|
-
|
|
5270
|
+
import_log14.log.trace("dxos.client-services.host.open", import_protocols15.trace.begin({
|
|
5332
5271
|
id: traceId
|
|
5333
5272
|
}), {
|
|
5334
5273
|
F: __dxlog_file18,
|
|
@@ -5373,7 +5312,7 @@ var ClientServicesHost = class {
|
|
|
5373
5312
|
]
|
|
5374
5313
|
});
|
|
5375
5314
|
this._opening = true;
|
|
5376
|
-
(0,
|
|
5315
|
+
(0, import_log14.log)("opening...", {
|
|
5377
5316
|
lockKey: this._resourceLock?.lockKey
|
|
5378
5317
|
}, {
|
|
5379
5318
|
F: __dxlog_file18,
|
|
@@ -5389,11 +5328,11 @@ var ClientServicesHost = class {
|
|
|
5389
5328
|
IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
|
|
5390
5329
|
InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitations, (invitation) => this._serviceContext.getInvitationHandler(invitation), this._serviceContext.metadataStore),
|
|
5391
5330
|
DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
|
|
5392
|
-
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager,
|
|
5331
|
+
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, async () => {
|
|
5393
5332
|
await this._serviceContext.initialized.wait();
|
|
5394
5333
|
return this._serviceContext.dataSpaceManager;
|
|
5395
5334
|
}),
|
|
5396
|
-
DataService: new import_echo_pipeline3.DataServiceImpl(this._serviceContext.
|
|
5335
|
+
DataService: new import_echo_pipeline3.DataServiceImpl(this._serviceContext.automergeHost),
|
|
5397
5336
|
IndexService: new import_indexing2.IndexServiceImpl({
|
|
5398
5337
|
indexer: this._serviceContext.indexer,
|
|
5399
5338
|
automergeHost: this._serviceContext.automergeHost
|
|
@@ -5411,7 +5350,7 @@ var ClientServicesHost = class {
|
|
|
5411
5350
|
await this._serviceContext.open(ctx);
|
|
5412
5351
|
(0, import_invariant16.invariant)(this.serviceRegistry.services.InvitationsService, void 0, {
|
|
5413
5352
|
F: __dxlog_file18,
|
|
5414
|
-
L:
|
|
5353
|
+
L: 299,
|
|
5415
5354
|
S: this,
|
|
5416
5355
|
A: [
|
|
5417
5356
|
"this.serviceRegistry.services.InvitationsService",
|
|
@@ -5419,11 +5358,11 @@ var ClientServicesHost = class {
|
|
|
5419
5358
|
]
|
|
5420
5359
|
});
|
|
5421
5360
|
const loadedInvitations = await this.serviceRegistry.services.InvitationsService.loadPersistentInvitations();
|
|
5422
|
-
(0,
|
|
5361
|
+
(0, import_log14.log)("loaded persistent invitations", {
|
|
5423
5362
|
count: loadedInvitations.invitations?.length
|
|
5424
5363
|
}, {
|
|
5425
5364
|
F: __dxlog_file18,
|
|
5426
|
-
L:
|
|
5365
|
+
L: 302,
|
|
5427
5366
|
S: this,
|
|
5428
5367
|
C: (f, a) => f(...a)
|
|
5429
5368
|
});
|
|
@@ -5441,19 +5380,19 @@ var ClientServicesHost = class {
|
|
|
5441
5380
|
this._open = true;
|
|
5442
5381
|
this._statusUpdate.emit();
|
|
5443
5382
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
5444
|
-
(0,
|
|
5383
|
+
(0, import_log14.log)("opened", {
|
|
5445
5384
|
deviceKey
|
|
5446
5385
|
}, {
|
|
5447
5386
|
F: __dxlog_file18,
|
|
5448
|
-
L:
|
|
5387
|
+
L: 319,
|
|
5449
5388
|
S: this,
|
|
5450
5389
|
C: (f, a) => f(...a)
|
|
5451
5390
|
});
|
|
5452
|
-
|
|
5391
|
+
import_log14.log.trace("dxos.client-services.host.open", import_protocols15.trace.end({
|
|
5453
5392
|
id: traceId
|
|
5454
5393
|
}), {
|
|
5455
5394
|
F: __dxlog_file18,
|
|
5456
|
-
L:
|
|
5395
|
+
L: 320,
|
|
5457
5396
|
S: this,
|
|
5458
5397
|
C: (f, a) => f(...a)
|
|
5459
5398
|
});
|
|
@@ -5463,11 +5402,11 @@ var ClientServicesHost = class {
|
|
|
5463
5402
|
return;
|
|
5464
5403
|
}
|
|
5465
5404
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
5466
|
-
(0,
|
|
5405
|
+
(0, import_log14.log)("closing...", {
|
|
5467
5406
|
deviceKey
|
|
5468
5407
|
}, {
|
|
5469
5408
|
F: __dxlog_file18,
|
|
5470
|
-
L:
|
|
5409
|
+
L: 331,
|
|
5471
5410
|
S: this,
|
|
5472
5411
|
C: (f, a) => f(...a)
|
|
5473
5412
|
});
|
|
@@ -5479,44 +5418,44 @@ var ClientServicesHost = class {
|
|
|
5479
5418
|
await this._serviceContext.close();
|
|
5480
5419
|
this._open = false;
|
|
5481
5420
|
this._statusUpdate.emit();
|
|
5482
|
-
(0,
|
|
5421
|
+
(0, import_log14.log)("closed", {
|
|
5483
5422
|
deviceKey
|
|
5484
5423
|
}, {
|
|
5485
5424
|
F: __dxlog_file18,
|
|
5486
|
-
L:
|
|
5425
|
+
L: 338,
|
|
5487
5426
|
S: this,
|
|
5488
5427
|
C: (f, a) => f(...a)
|
|
5489
5428
|
});
|
|
5490
5429
|
}
|
|
5491
5430
|
async reset() {
|
|
5492
5431
|
const traceId = import_keys11.PublicKey.random().toHex();
|
|
5493
|
-
|
|
5432
|
+
import_log14.log.trace("dxos.sdk.client-services-host.reset", import_protocols15.trace.begin({
|
|
5494
5433
|
id: traceId
|
|
5495
5434
|
}), {
|
|
5496
5435
|
F: __dxlog_file18,
|
|
5497
|
-
L:
|
|
5436
|
+
L: 343,
|
|
5498
5437
|
S: this,
|
|
5499
5438
|
C: (f, a) => f(...a)
|
|
5500
5439
|
});
|
|
5501
|
-
(0,
|
|
5440
|
+
(0, import_log14.log)("resetting...", void 0, {
|
|
5502
5441
|
F: __dxlog_file18,
|
|
5503
|
-
L:
|
|
5442
|
+
L: 345,
|
|
5504
5443
|
S: this,
|
|
5505
5444
|
C: (f, a) => f(...a)
|
|
5506
5445
|
});
|
|
5507
5446
|
await this._serviceContext?.close();
|
|
5508
5447
|
await this._storage.reset();
|
|
5509
|
-
(0,
|
|
5448
|
+
(0, import_log14.log)("reset", void 0, {
|
|
5510
5449
|
F: __dxlog_file18,
|
|
5511
|
-
L:
|
|
5450
|
+
L: 348,
|
|
5512
5451
|
S: this,
|
|
5513
5452
|
C: (f, a) => f(...a)
|
|
5514
5453
|
});
|
|
5515
|
-
|
|
5454
|
+
import_log14.log.trace("dxos.sdk.client-services-host.reset", import_protocols15.trace.end({
|
|
5516
5455
|
id: traceId
|
|
5517
5456
|
}), {
|
|
5518
5457
|
F: __dxlog_file18,
|
|
5519
|
-
L:
|
|
5458
|
+
L: 349,
|
|
5520
5459
|
S: this,
|
|
5521
5460
|
C: (f, a) => f(...a)
|
|
5522
5461
|
});
|
|
@@ -5531,7 +5470,7 @@ var ClientServicesHost = class {
|
|
|
5531
5470
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
5532
5471
|
(0, import_invariant16.invariant)(automergeIndex, void 0, {
|
|
5533
5472
|
F: __dxlog_file18,
|
|
5534
|
-
L:
|
|
5473
|
+
L: 364,
|
|
5535
5474
|
S: this,
|
|
5536
5475
|
A: [
|
|
5537
5476
|
"automergeIndex",
|
|
@@ -5556,11 +5495,11 @@ _ts_decorate8([
|
|
|
5556
5495
|
import_tracing7.trace.info()
|
|
5557
5496
|
], ClientServicesHost.prototype, "_open", void 0);
|
|
5558
5497
|
_ts_decorate8([
|
|
5559
|
-
|
|
5498
|
+
import_async16.synchronized,
|
|
5560
5499
|
import_tracing7.trace.span()
|
|
5561
5500
|
], ClientServicesHost.prototype, "open", null);
|
|
5562
5501
|
_ts_decorate8([
|
|
5563
|
-
|
|
5502
|
+
import_async16.synchronized,
|
|
5564
5503
|
import_tracing7.trace.span()
|
|
5565
5504
|
], ClientServicesHost.prototype, "close", null);
|
|
5566
5505
|
ClientServicesHost = _ts_decorate8([
|
|
@@ -5601,4 +5540,4 @@ ClientServicesHost = _ts_decorate8([
|
|
|
5601
5540
|
subscribeToSpaces,
|
|
5602
5541
|
subscribeToSwarmInfo
|
|
5603
5542
|
});
|
|
5604
|
-
//# sourceMappingURL=chunk-
|
|
5543
|
+
//# sourceMappingURL=chunk-FSN25IYL.cjs.map
|