@dxos/client-services 0.3.9-main.ee9a520 → 0.3.9-main.ef334cd
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-QETXI73D.mjs → chunk-5AFGJQGV.mjs} +111 -61
- package/dist/lib/browser/{chunk-QETXI73D.mjs.map → chunk-5AFGJQGV.mjs.map} +4 -4
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +1 -1
- package/dist/lib/node/{chunk-TVYC6AI7.cjs → chunk-RD2EVVPQ.cjs} +120 -73
- package/dist/lib/node/chunk-RD2EVVPQ.cjs.map +7 -0
- package/dist/lib/node/index.cjs +37 -37
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +8 -8
- 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 +8 -0
- package/dist/types/src/packlets/spaces/automerge-space-state.d.ts.map +1 -0
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts +3 -2
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts +7 -2
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +35 -35
- package/src/packlets/services/service-context.ts +5 -0
- package/src/packlets/services/service-host.ts +4 -1
- package/src/packlets/spaces/automerge-space-state.ts +22 -0
- package/src/packlets/spaces/data-space-manager.ts +11 -1
- package/src/packlets/spaces/data-space.ts +53 -6
- package/src/version.ts +1 -1
- package/dist/lib/node/chunk-TVYC6AI7.cjs.map +0 -7
|
@@ -2534,7 +2534,7 @@ var getPlatform = () => {
|
|
|
2534
2534
|
};
|
|
2535
2535
|
|
|
2536
2536
|
// packages/sdk/client-services/src/version.ts
|
|
2537
|
-
var DXOS_VERSION = "0.3.9-main.
|
|
2537
|
+
var DXOS_VERSION = "0.3.9-main.ef334cd";
|
|
2538
2538
|
|
|
2539
2539
|
// packages/sdk/client-services/src/packlets/services/diagnostics.ts
|
|
2540
2540
|
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
|
|
@@ -2668,12 +2668,30 @@ import { createMappedFeedWriter } from "@dxos/echo-pipeline";
|
|
|
2668
2668
|
import { PublicKey as PublicKey8 } from "@dxos/keys";
|
|
2669
2669
|
import { log as log10 } from "@dxos/log";
|
|
2670
2670
|
import { CancelledError, SystemError } from "@dxos/protocols";
|
|
2671
|
-
import { SpaceState } from "@dxos/protocols/proto/dxos/client/services";
|
|
2671
|
+
import { SpaceState, CreateEpochRequest } from "@dxos/protocols/proto/dxos/client/services";
|
|
2672
2672
|
import { AdmittedFeed as AdmittedFeed3 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
2673
2673
|
import { Timeframe as Timeframe2 } from "@dxos/timeframe";
|
|
2674
2674
|
import { trace as trace6 } from "@dxos/tracing";
|
|
2675
2675
|
import { ComplexSet as ComplexSet3 } from "@dxos/util";
|
|
2676
2676
|
|
|
2677
|
+
// packages/sdk/client-services/src/packlets/spaces/automerge-space-state.ts
|
|
2678
|
+
import { checkCredentialType } from "@dxos/credentials";
|
|
2679
|
+
var AutomergeSpaceState = class {
|
|
2680
|
+
constructor() {
|
|
2681
|
+
this.rootUrl = void 0;
|
|
2682
|
+
this.lastEpoch = void 0;
|
|
2683
|
+
}
|
|
2684
|
+
async processCredential(credential) {
|
|
2685
|
+
if (!checkCredentialType(credential, "dxos.halo.credentials.Epoch")) {
|
|
2686
|
+
return;
|
|
2687
|
+
}
|
|
2688
|
+
this.lastEpoch = credential;
|
|
2689
|
+
if (credential.subject.assertion.automergeRoot) {
|
|
2690
|
+
this.rootUrl = credential.subject.assertion.automergeRoot;
|
|
2691
|
+
}
|
|
2692
|
+
}
|
|
2693
|
+
};
|
|
2694
|
+
|
|
2677
2695
|
// packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
|
|
2678
2696
|
import { DeferredTask, Event as Event4, scheduleTask as scheduleTask3, sleep, TimeoutError as TimeoutError2, Trigger as Trigger4 } from "@dxos/async";
|
|
2679
2697
|
import { Context as Context6, rejectOnDispose } from "@dxos/context";
|
|
@@ -2959,6 +2977,10 @@ var DataSpace = class DataSpace2 {
|
|
|
2959
2977
|
constructor(params) {
|
|
2960
2978
|
this._ctx = new Context7();
|
|
2961
2979
|
this._notarizationPlugin = new NotarizationPlugin();
|
|
2980
|
+
this._cache = void 0;
|
|
2981
|
+
this._automergeHost = void 0;
|
|
2982
|
+
// TODO(dmaretskyi): Move into Space?
|
|
2983
|
+
this._automergeSpaceState = new AutomergeSpaceState();
|
|
2962
2984
|
this._state = SpaceState.CLOSED;
|
|
2963
2985
|
/**
|
|
2964
2986
|
* Error for _state === SpaceState.ERROR.
|
|
@@ -2986,7 +3008,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2986
3008
|
state: SpaceState[this._state]
|
|
2987
3009
|
}, {
|
|
2988
3010
|
F: __dxlog_file12,
|
|
2989
|
-
L:
|
|
3011
|
+
L: 138,
|
|
2990
3012
|
S: this,
|
|
2991
3013
|
C: (f, a) => f(...a)
|
|
2992
3014
|
});
|
|
@@ -3016,6 +3038,9 @@ var DataSpace = class DataSpace2 {
|
|
|
3016
3038
|
get cache() {
|
|
3017
3039
|
return this._cache;
|
|
3018
3040
|
}
|
|
3041
|
+
get automergeSpaceState() {
|
|
3042
|
+
return this._automergeSpaceState;
|
|
3043
|
+
}
|
|
3019
3044
|
async open() {
|
|
3020
3045
|
await this._open();
|
|
3021
3046
|
}
|
|
@@ -3023,13 +3048,14 @@ var DataSpace = class DataSpace2 {
|
|
|
3023
3048
|
await this._gossip.open();
|
|
3024
3049
|
await this._notarizationPlugin.open();
|
|
3025
3050
|
await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
|
|
3051
|
+
await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
|
|
3026
3052
|
await this._inner.open(new Context7());
|
|
3027
3053
|
this._state = SpaceState.CONTROL_ONLY;
|
|
3028
3054
|
log10("new state", {
|
|
3029
3055
|
state: SpaceState[this._state]
|
|
3030
3056
|
}, {
|
|
3031
3057
|
F: __dxlog_file12,
|
|
3032
|
-
L:
|
|
3058
|
+
L: 190,
|
|
3033
3059
|
S: this,
|
|
3034
3060
|
C: (f, a) => f(...a)
|
|
3035
3061
|
});
|
|
@@ -3047,7 +3073,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3047
3073
|
state: SpaceState[this._state]
|
|
3048
3074
|
}, {
|
|
3049
3075
|
F: __dxlog_file12,
|
|
3050
|
-
L:
|
|
3076
|
+
L: 204,
|
|
3051
3077
|
S: this,
|
|
3052
3078
|
C: (f, a) => f(...a)
|
|
3053
3079
|
});
|
|
@@ -3055,6 +3081,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3055
3081
|
this._ctx = new Context7();
|
|
3056
3082
|
await this.authVerifier.close();
|
|
3057
3083
|
await this._inner.close();
|
|
3084
|
+
await this._inner.spaceState.removeCredentialProcessor(this._automergeSpaceState);
|
|
3058
3085
|
await this._inner.spaceState.removeCredentialProcessor(this._notarizationPlugin);
|
|
3059
3086
|
await this._notarizationPlugin.close();
|
|
3060
3087
|
await this._presence.destroy();
|
|
@@ -3078,7 +3105,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3078
3105
|
if (err instanceof CancelledError) {
|
|
3079
3106
|
log10("data pipeline initialization cancelled", err, {
|
|
3080
3107
|
F: __dxlog_file12,
|
|
3081
|
-
L:
|
|
3108
|
+
L: 237,
|
|
3082
3109
|
S: this,
|
|
3083
3110
|
C: (f, a) => f(...a)
|
|
3084
3111
|
});
|
|
@@ -3086,7 +3113,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3086
3113
|
}
|
|
3087
3114
|
log10.error("Error initializing data pipeline", err, {
|
|
3088
3115
|
F: __dxlog_file12,
|
|
3089
|
-
L:
|
|
3116
|
+
L: 241,
|
|
3090
3117
|
S: this,
|
|
3091
3118
|
C: (f, a) => f(...a)
|
|
3092
3119
|
});
|
|
@@ -3095,7 +3122,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3095
3122
|
state: SpaceState[this._state]
|
|
3096
3123
|
}, {
|
|
3097
3124
|
F: __dxlog_file12,
|
|
3098
|
-
L:
|
|
3125
|
+
L: 243,
|
|
3099
3126
|
S: this,
|
|
3100
3127
|
C: (f, a) => f(...a)
|
|
3101
3128
|
});
|
|
@@ -3115,7 +3142,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3115
3142
|
state: SpaceState[this._state]
|
|
3116
3143
|
}, {
|
|
3117
3144
|
F: __dxlog_file12,
|
|
3118
|
-
L:
|
|
3145
|
+
L: 259,
|
|
3119
3146
|
S: this,
|
|
3120
3147
|
C: (f, a) => f(...a)
|
|
3121
3148
|
});
|
|
@@ -3126,7 +3153,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3126
3153
|
await cancelWithContext2(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
|
|
3127
3154
|
log10("waiting for data pipeline to reach target timeframe", void 0, {
|
|
3128
3155
|
F: __dxlog_file12,
|
|
3129
|
-
L:
|
|
3156
|
+
L: 273,
|
|
3130
3157
|
S: this,
|
|
3131
3158
|
C: (f, a) => f(...a)
|
|
3132
3159
|
});
|
|
@@ -3137,7 +3164,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3137
3164
|
this.metrics.dataPipelineReady = /* @__PURE__ */ new Date();
|
|
3138
3165
|
log10("data pipeline ready", void 0, {
|
|
3139
3166
|
F: __dxlog_file12,
|
|
3140
|
-
L:
|
|
3167
|
+
L: 282,
|
|
3141
3168
|
S: this,
|
|
3142
3169
|
C: (f, a) => f(...a)
|
|
3143
3170
|
});
|
|
@@ -3147,7 +3174,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3147
3174
|
state: SpaceState[this._state]
|
|
3148
3175
|
}, {
|
|
3149
3176
|
F: __dxlog_file12,
|
|
3150
|
-
L:
|
|
3177
|
+
L: 286,
|
|
3151
3178
|
S: this,
|
|
3152
3179
|
C: (f, a) => f(...a)
|
|
3153
3180
|
});
|
|
@@ -3163,7 +3190,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3163
3190
|
await this._createWritableFeeds();
|
|
3164
3191
|
log10("writable feeds created", void 0, {
|
|
3165
3192
|
F: __dxlog_file12,
|
|
3166
|
-
L:
|
|
3193
|
+
L: 302,
|
|
3167
3194
|
S: this,
|
|
3168
3195
|
C: (f, a) => f(...a)
|
|
3169
3196
|
});
|
|
@@ -3235,8 +3262,28 @@ var DataSpace = class DataSpace2 {
|
|
|
3235
3262
|
}
|
|
3236
3263
|
});
|
|
3237
3264
|
}
|
|
3238
|
-
async createEpoch() {
|
|
3239
|
-
|
|
3265
|
+
async createEpoch(options) {
|
|
3266
|
+
let epoch;
|
|
3267
|
+
switch (options?.migration) {
|
|
3268
|
+
case void 0:
|
|
3269
|
+
case CreateEpochRequest.Migration.NONE:
|
|
3270
|
+
{
|
|
3271
|
+
epoch = await this.dataPipeline.createEpoch();
|
|
3272
|
+
}
|
|
3273
|
+
break;
|
|
3274
|
+
case CreateEpochRequest.Migration.INIT_AUTOMERGE: {
|
|
3275
|
+
const document = this._automergeHost?.repo.create();
|
|
3276
|
+
epoch = {
|
|
3277
|
+
previousId: this._automergeSpaceState.lastEpoch?.id,
|
|
3278
|
+
number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
|
|
3279
|
+
timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new Timeframe2(),
|
|
3280
|
+
automergeRoot: document?.url
|
|
3281
|
+
};
|
|
3282
|
+
}
|
|
3283
|
+
}
|
|
3284
|
+
if (!epoch) {
|
|
3285
|
+
return;
|
|
3286
|
+
}
|
|
3240
3287
|
const receipt = await this.inner.controlPipeline.writer.write({
|
|
3241
3288
|
credential: {
|
|
3242
3289
|
credential: await this._signingContext.credentialSigner.createCredential({
|
|
@@ -3283,7 +3330,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3283
3330
|
state: SpaceState[this._state]
|
|
3284
3331
|
}, {
|
|
3285
3332
|
F: __dxlog_file12,
|
|
3286
|
-
L:
|
|
3333
|
+
L: 451,
|
|
3287
3334
|
S: this,
|
|
3288
3335
|
C: (f, a) => f(...a)
|
|
3289
3336
|
});
|
|
@@ -3415,13 +3462,14 @@ var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
|
|
|
3415
3462
|
var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
3416
3463
|
var PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
3417
3464
|
var DataSpaceManager = class DataSpaceManager2 {
|
|
3418
|
-
constructor(_spaceManager, _metadataStore, _dataServiceSubscriptions, _keyring, _signingContext, _feedStore) {
|
|
3465
|
+
constructor(_spaceManager, _metadataStore, _dataServiceSubscriptions, _keyring, _signingContext, _feedStore, _automergeHost) {
|
|
3419
3466
|
this._spaceManager = _spaceManager;
|
|
3420
3467
|
this._metadataStore = _metadataStore;
|
|
3421
3468
|
this._dataServiceSubscriptions = _dataServiceSubscriptions;
|
|
3422
3469
|
this._keyring = _keyring;
|
|
3423
3470
|
this._signingContext = _signingContext;
|
|
3424
3471
|
this._feedStore = _feedStore;
|
|
3472
|
+
this._automergeHost = _automergeHost;
|
|
3425
3473
|
this._ctx = new Context8();
|
|
3426
3474
|
this.updated = new Event6();
|
|
3427
3475
|
this._spaces = new ComplexMap3(PublicKey9.hash);
|
|
@@ -3435,7 +3483,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3435
3483
|
async open() {
|
|
3436
3484
|
log11("open", void 0, {
|
|
3437
3485
|
F: __dxlog_file13,
|
|
3438
|
-
L:
|
|
3486
|
+
L: 92,
|
|
3439
3487
|
S: this,
|
|
3440
3488
|
C: (f, a) => f(...a)
|
|
3441
3489
|
});
|
|
@@ -3443,7 +3491,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3443
3491
|
id: this._instanceId
|
|
3444
3492
|
}), {
|
|
3445
3493
|
F: __dxlog_file13,
|
|
3446
|
-
L:
|
|
3494
|
+
L: 93,
|
|
3447
3495
|
S: this,
|
|
3448
3496
|
C: (f, a) => f(...a)
|
|
3449
3497
|
});
|
|
@@ -3451,7 +3499,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3451
3499
|
spaces: this._metadataStore.spaces.length
|
|
3452
3500
|
}, {
|
|
3453
3501
|
F: __dxlog_file13,
|
|
3454
|
-
L:
|
|
3502
|
+
L: 94,
|
|
3455
3503
|
S: this,
|
|
3456
3504
|
C: (f, a) => f(...a)
|
|
3457
3505
|
});
|
|
@@ -3461,7 +3509,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3461
3509
|
spaceMetadata
|
|
3462
3510
|
}, {
|
|
3463
3511
|
F: __dxlog_file13,
|
|
3464
|
-
L:
|
|
3512
|
+
L: 98,
|
|
3465
3513
|
S: this,
|
|
3466
3514
|
C: (f, a) => f(...a)
|
|
3467
3515
|
});
|
|
@@ -3472,7 +3520,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3472
3520
|
err
|
|
3473
3521
|
}, {
|
|
3474
3522
|
F: __dxlog_file13,
|
|
3475
|
-
L:
|
|
3523
|
+
L: 101,
|
|
3476
3524
|
S: this,
|
|
3477
3525
|
C: (f, a) => f(...a)
|
|
3478
3526
|
});
|
|
@@ -3489,7 +3537,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3489
3537
|
id: this._instanceId
|
|
3490
3538
|
}), {
|
|
3491
3539
|
F: __dxlog_file13,
|
|
3492
|
-
L:
|
|
3540
|
+
L: 114,
|
|
3493
3541
|
S: this,
|
|
3494
3542
|
C: (f, a) => f(...a)
|
|
3495
3543
|
});
|
|
@@ -3497,7 +3545,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3497
3545
|
async close() {
|
|
3498
3546
|
log11("close", void 0, {
|
|
3499
3547
|
F: __dxlog_file13,
|
|
3500
|
-
L:
|
|
3548
|
+
L: 119,
|
|
3501
3549
|
S: this,
|
|
3502
3550
|
C: (f, a) => f(...a)
|
|
3503
3551
|
});
|
|
@@ -3513,7 +3561,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3513
3561
|
async createSpace() {
|
|
3514
3562
|
invariant11(this._isOpen, "Not open.", {
|
|
3515
3563
|
F: __dxlog_file13,
|
|
3516
|
-
L:
|
|
3564
|
+
L: 132,
|
|
3517
3565
|
S: this,
|
|
3518
3566
|
A: [
|
|
3519
3567
|
"this._isOpen",
|
|
@@ -3534,7 +3582,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3534
3582
|
spaceKey
|
|
3535
3583
|
}, {
|
|
3536
3584
|
F: __dxlog_file13,
|
|
3537
|
-
L:
|
|
3585
|
+
L: 144,
|
|
3538
3586
|
S: this,
|
|
3539
3587
|
C: (f, a) => f(...a)
|
|
3540
3588
|
});
|
|
@@ -3544,7 +3592,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3544
3592
|
const memberCredential = credentials[1];
|
|
3545
3593
|
invariant11(getCredentialAssertion2(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
3546
3594
|
F: __dxlog_file13,
|
|
3547
|
-
L:
|
|
3595
|
+
L: 151,
|
|
3548
3596
|
S: this,
|
|
3549
3597
|
A: [
|
|
3550
3598
|
"getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -3562,13 +3610,13 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3562
3610
|
opts
|
|
3563
3611
|
}, {
|
|
3564
3612
|
F: __dxlog_file13,
|
|
3565
|
-
L:
|
|
3613
|
+
L: 163,
|
|
3566
3614
|
S: this,
|
|
3567
3615
|
C: (f, a) => f(...a)
|
|
3568
3616
|
});
|
|
3569
3617
|
invariant11(this._isOpen, "Not open.", {
|
|
3570
3618
|
F: __dxlog_file13,
|
|
3571
|
-
L:
|
|
3619
|
+
L: 164,
|
|
3572
3620
|
S: this,
|
|
3573
3621
|
A: [
|
|
3574
3622
|
"this._isOpen",
|
|
@@ -3577,7 +3625,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3577
3625
|
});
|
|
3578
3626
|
invariant11(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
3579
3627
|
F: __dxlog_file13,
|
|
3580
|
-
L:
|
|
3628
|
+
L: 165,
|
|
3581
3629
|
S: this,
|
|
3582
3630
|
A: [
|
|
3583
3631
|
"!this._spaces.has(opts.spaceKey)",
|
|
@@ -3612,7 +3660,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3612
3660
|
metadata
|
|
3613
3661
|
}, {
|
|
3614
3662
|
F: __dxlog_file13,
|
|
3615
|
-
L:
|
|
3663
|
+
L: 198,
|
|
3616
3664
|
S: this,
|
|
3617
3665
|
C: (f, a) => f(...a)
|
|
3618
3666
|
});
|
|
@@ -3648,7 +3696,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3648
3696
|
onAuthFailure: () => {
|
|
3649
3697
|
log11.warn("auth failure", void 0, {
|
|
3650
3698
|
F: __dxlog_file13,
|
|
3651
|
-
L:
|
|
3699
|
+
L: 233,
|
|
3652
3700
|
S: this,
|
|
3653
3701
|
C: (f, a) => f(...a)
|
|
3654
3702
|
});
|
|
@@ -3672,7 +3720,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3672
3720
|
space: space.key
|
|
3673
3721
|
}, {
|
|
3674
3722
|
F: __dxlog_file13,
|
|
3675
|
-
L:
|
|
3723
|
+
L: 251,
|
|
3676
3724
|
S: this,
|
|
3677
3725
|
C: (f, a) => f(...a)
|
|
3678
3726
|
});
|
|
@@ -3684,7 +3732,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3684
3732
|
open: this._isOpen
|
|
3685
3733
|
}, {
|
|
3686
3734
|
F: __dxlog_file13,
|
|
3687
|
-
L:
|
|
3735
|
+
L: 258,
|
|
3688
3736
|
S: this,
|
|
3689
3737
|
C: (f, a) => f(...a)
|
|
3690
3738
|
});
|
|
@@ -3697,14 +3745,15 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3697
3745
|
space: space.key
|
|
3698
3746
|
}, {
|
|
3699
3747
|
F: __dxlog_file13,
|
|
3700
|
-
L:
|
|
3748
|
+
L: 264,
|
|
3701
3749
|
S: this,
|
|
3702
3750
|
C: (f, a) => f(...a)
|
|
3703
3751
|
});
|
|
3704
3752
|
await this._dataServiceSubscriptions.unregisterSpace(space.key);
|
|
3705
3753
|
}
|
|
3706
3754
|
},
|
|
3707
|
-
cache: metadata.cache
|
|
3755
|
+
cache: metadata.cache,
|
|
3756
|
+
automergeHost: this._automergeHost
|
|
3708
3757
|
});
|
|
3709
3758
|
if (metadata.state !== SpaceState2.INACTIVE) {
|
|
3710
3759
|
await dataSpace.open();
|
|
@@ -3961,7 +4010,7 @@ import { Trigger as Trigger5 } from "@dxos/async";
|
|
|
3961
4010
|
import { Context as Context9 } from "@dxos/context";
|
|
3962
4011
|
import { getCredentialAssertion as getCredentialAssertion3 } from "@dxos/credentials";
|
|
3963
4012
|
import { failUndefined as failUndefined3 } from "@dxos/debug";
|
|
3964
|
-
import { valueEncoding, MetadataStore, SpaceManager, DataServiceSubscriptions, SnapshotStore } from "@dxos/echo-pipeline";
|
|
4013
|
+
import { valueEncoding, MetadataStore, SpaceManager, DataServiceSubscriptions, SnapshotStore, AutomergeHost } from "@dxos/echo-pipeline";
|
|
3965
4014
|
import { FeedFactory, FeedStore } from "@dxos/feed-store";
|
|
3966
4015
|
import { invariant as invariant13 } from "@dxos/invariant";
|
|
3967
4016
|
import { Keyring } from "@dxos/keyring";
|
|
@@ -4016,6 +4065,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4016
4065
|
snapshotStore: this.snapshotStore
|
|
4017
4066
|
});
|
|
4018
4067
|
this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager);
|
|
4068
|
+
this.automergeHost = new AutomergeHost(storage.createDirectory("automerge"));
|
|
4019
4069
|
this.invitations = new InvitationsHandler(this.networkManager);
|
|
4020
4070
|
this._handlerFactories.set(Invitation6.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? failUndefined3(), this._acceptIdentity.bind(this)));
|
|
4021
4071
|
}
|
|
@@ -4023,7 +4073,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4023
4073
|
await this._checkStorageVersion();
|
|
4024
4074
|
log13("opening...", void 0, {
|
|
4025
4075
|
F: __dxlog_file15,
|
|
4026
|
-
L:
|
|
4076
|
+
L: 133,
|
|
4027
4077
|
S: this,
|
|
4028
4078
|
C: (f, a) => f(...a)
|
|
4029
4079
|
});
|
|
@@ -4031,7 +4081,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4031
4081
|
id: this._instanceId
|
|
4032
4082
|
}), {
|
|
4033
4083
|
F: __dxlog_file15,
|
|
4034
|
-
L:
|
|
4084
|
+
L: 134,
|
|
4035
4085
|
S: this,
|
|
4036
4086
|
C: (f, a) => f(...a)
|
|
4037
4087
|
});
|
|
@@ -4047,13 +4097,13 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4047
4097
|
id: this._instanceId
|
|
4048
4098
|
}), {
|
|
4049
4099
|
F: __dxlog_file15,
|
|
4050
|
-
L:
|
|
4100
|
+
L: 144,
|
|
4051
4101
|
S: this,
|
|
4052
4102
|
C: (f, a) => f(...a)
|
|
4053
4103
|
});
|
|
4054
4104
|
log13("opened", void 0, {
|
|
4055
4105
|
F: __dxlog_file15,
|
|
4056
|
-
L:
|
|
4106
|
+
L: 145,
|
|
4057
4107
|
S: this,
|
|
4058
4108
|
C: (f, a) => f(...a)
|
|
4059
4109
|
});
|
|
@@ -4061,7 +4111,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4061
4111
|
async close() {
|
|
4062
4112
|
log13("closing...", void 0, {
|
|
4063
4113
|
F: __dxlog_file15,
|
|
4064
|
-
L:
|
|
4114
|
+
L: 149,
|
|
4065
4115
|
S: this,
|
|
4066
4116
|
C: (f, a) => f(...a)
|
|
4067
4117
|
});
|
|
@@ -4078,7 +4128,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4078
4128
|
await this.metadataStore.close();
|
|
4079
4129
|
log13("closed", void 0, {
|
|
4080
4130
|
F: __dxlog_file15,
|
|
4081
|
-
L:
|
|
4131
|
+
L: 161,
|
|
4082
4132
|
S: this,
|
|
4083
4133
|
C: (f, a) => f(...a)
|
|
4084
4134
|
});
|
|
@@ -4092,7 +4142,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4092
4142
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
4093
4143
|
invariant13(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
4094
4144
|
F: __dxlog_file15,
|
|
4095
|
-
L:
|
|
4145
|
+
L: 172,
|
|
4096
4146
|
S: this,
|
|
4097
4147
|
A: [
|
|
4098
4148
|
"factory",
|
|
@@ -4124,7 +4174,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4124
4174
|
async _initialize(ctx) {
|
|
4125
4175
|
log13("initializing spaces...", void 0, {
|
|
4126
4176
|
F: __dxlog_file15,
|
|
4127
|
-
L:
|
|
4177
|
+
L: 203,
|
|
4128
4178
|
S: this,
|
|
4129
4179
|
C: (f, a) => f(...a)
|
|
4130
4180
|
});
|
|
@@ -4142,12 +4192,12 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4142
4192
|
});
|
|
4143
4193
|
}
|
|
4144
4194
|
};
|
|
4145
|
-
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore);
|
|
4195
|
+
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore, this.automergeHost);
|
|
4146
4196
|
await this.dataSpaceManager.open();
|
|
4147
4197
|
this._handlerFactories.set(Invitation6.Kind.SPACE, (invitation) => {
|
|
4148
4198
|
invariant13(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
4149
4199
|
F: __dxlog_file15,
|
|
4150
|
-
L:
|
|
4200
|
+
L: 227,
|
|
4151
4201
|
S: this,
|
|
4152
4202
|
A: [
|
|
4153
4203
|
"this.dataSpaceManager",
|
|
@@ -4171,7 +4221,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4171
4221
|
details: assertion
|
|
4172
4222
|
}, {
|
|
4173
4223
|
F: __dxlog_file15,
|
|
4174
|
-
L:
|
|
4224
|
+
L: 243,
|
|
4175
4225
|
S: this,
|
|
4176
4226
|
C: (f, a) => f(...a)
|
|
4177
4227
|
});
|
|
@@ -4182,7 +4232,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4182
4232
|
details: assertion
|
|
4183
4233
|
}, {
|
|
4184
4234
|
F: __dxlog_file15,
|
|
4185
|
-
L:
|
|
4235
|
+
L: 247,
|
|
4186
4236
|
S: this,
|
|
4187
4237
|
C: (f, a) => f(...a)
|
|
4188
4238
|
});
|
|
@@ -4193,7 +4243,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4193
4243
|
details: assertion
|
|
4194
4244
|
}, {
|
|
4195
4245
|
F: __dxlog_file15,
|
|
4196
|
-
L:
|
|
4246
|
+
L: 252,
|
|
4197
4247
|
S: this,
|
|
4198
4248
|
C: (f, a) => f(...a)
|
|
4199
4249
|
});
|
|
@@ -4204,7 +4254,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4204
4254
|
} catch (err) {
|
|
4205
4255
|
log13.catch(err, void 0, {
|
|
4206
4256
|
F: __dxlog_file15,
|
|
4207
|
-
L:
|
|
4257
|
+
L: 258,
|
|
4208
4258
|
S: this,
|
|
4209
4259
|
C: (f, a) => f(...a)
|
|
4210
4260
|
});
|
|
@@ -4924,7 +4974,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4924
4974
|
await this._serviceContext.initialized.wait();
|
|
4925
4975
|
return this._serviceContext.dataSpaceManager;
|
|
4926
4976
|
}),
|
|
4927
|
-
DataService: new DataServiceImpl(this._serviceContext.dataServiceSubscriptions),
|
|
4977
|
+
DataService: new DataServiceImpl(this._serviceContext.dataServiceSubscriptions, this._serviceContext.automergeHost),
|
|
4928
4978
|
NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
|
|
4929
4979
|
LoggingService: this._loggingService,
|
|
4930
4980
|
TracingService: this._tracingService,
|
|
@@ -4954,7 +5004,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4954
5004
|
deviceKey
|
|
4955
5005
|
}, {
|
|
4956
5006
|
F: __dxlog_file17,
|
|
4957
|
-
L:
|
|
5007
|
+
L: 320,
|
|
4958
5008
|
S: this,
|
|
4959
5009
|
C: (f, a) => f(...a)
|
|
4960
5010
|
});
|
|
@@ -4962,7 +5012,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4962
5012
|
id: traceId
|
|
4963
5013
|
}), {
|
|
4964
5014
|
F: __dxlog_file17,
|
|
4965
|
-
L:
|
|
5015
|
+
L: 321,
|
|
4966
5016
|
S: this,
|
|
4967
5017
|
C: (f, a) => f(...a)
|
|
4968
5018
|
});
|
|
@@ -4976,7 +5026,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4976
5026
|
deviceKey
|
|
4977
5027
|
}, {
|
|
4978
5028
|
F: __dxlog_file17,
|
|
4979
|
-
L:
|
|
5029
|
+
L: 332,
|
|
4980
5030
|
S: this,
|
|
4981
5031
|
C: (f, a) => f(...a)
|
|
4982
5032
|
});
|
|
@@ -4992,7 +5042,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4992
5042
|
deviceKey
|
|
4993
5043
|
}, {
|
|
4994
5044
|
F: __dxlog_file17,
|
|
4995
|
-
L:
|
|
5045
|
+
L: 339,
|
|
4996
5046
|
S: this,
|
|
4997
5047
|
C: (f, a) => f(...a)
|
|
4998
5048
|
});
|
|
@@ -5003,13 +5053,13 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
5003
5053
|
id: traceId
|
|
5004
5054
|
}), {
|
|
5005
5055
|
F: __dxlog_file17,
|
|
5006
|
-
L:
|
|
5056
|
+
L: 344,
|
|
5007
5057
|
S: this,
|
|
5008
5058
|
C: (f, a) => f(...a)
|
|
5009
5059
|
});
|
|
5010
5060
|
log16("resetting...", void 0, {
|
|
5011
5061
|
F: __dxlog_file17,
|
|
5012
|
-
L:
|
|
5062
|
+
L: 346,
|
|
5013
5063
|
S: this,
|
|
5014
5064
|
C: (f, a) => f(...a)
|
|
5015
5065
|
});
|
|
@@ -5017,7 +5067,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
5017
5067
|
await this._storage.reset();
|
|
5018
5068
|
log16("reset", void 0, {
|
|
5019
5069
|
F: __dxlog_file17,
|
|
5020
|
-
L:
|
|
5070
|
+
L: 349,
|
|
5021
5071
|
S: this,
|
|
5022
5072
|
C: (f, a) => f(...a)
|
|
5023
5073
|
});
|
|
@@ -5025,7 +5075,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
5025
5075
|
id: traceId
|
|
5026
5076
|
}), {
|
|
5027
5077
|
F: __dxlog_file17,
|
|
5028
|
-
L:
|
|
5078
|
+
L: 350,
|
|
5029
5079
|
S: this,
|
|
5030
5080
|
C: (f, a) => f(...a)
|
|
5031
5081
|
});
|
|
@@ -5102,4 +5152,4 @@ export {
|
|
|
5102
5152
|
createDefaultModelFactory,
|
|
5103
5153
|
ClientServicesHost
|
|
5104
5154
|
};
|
|
5105
|
-
//# sourceMappingURL=chunk-
|
|
5155
|
+
//# sourceMappingURL=chunk-5AFGJQGV.mjs.map
|