@dxos/client-services 0.3.9-main.c2ac8a5 → 0.3.9-main.c64f707
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-GX2QS37G.mjs → chunk-LUA2PRME.mjs} +129 -65
- package/dist/lib/browser/chunk-LUA2PRME.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 +7 -3
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/{chunk-V5ZH44RD.cjs → chunk-OTXGXWD2.cjs} +130 -77
- package/dist/lib/node/chunk-OTXGXWD2.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 +11 -8
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/services/automerge-host.test.d.ts +2 -0
- package/dist/types/src/packlets/services/automerge-host.test.d.ts.map +1 -0
- 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/packlets/spaces/genesis.d.ts +1 -1
- package/dist/types/src/packlets/spaces/genesis.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +3 -1
- 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 +35 -35
- package/src/packlets/services/automerge-host.test.ts +56 -0
- package/src/packlets/services/service-context.ts +6 -0
- package/src/packlets/services/service-host.ts +5 -2
- package/src/packlets/spaces/automerge-space-state.ts +22 -0
- package/src/packlets/spaces/data-space-manager.ts +13 -2
- package/src/packlets/spaces/data-space.ts +52 -6
- package/src/packlets/spaces/genesis.ts +7 -1
- package/src/packlets/testing/test-builder.ts +7 -0
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-GX2QS37G.mjs.map +0 -7
- package/dist/lib/node/chunk-V5ZH44RD.cjs.map +0 -7
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import "@dxos/node-std/globals";
|
|
2
2
|
|
|
3
|
+
// inject-globals:@inject-globals
|
|
4
|
+
import {
|
|
5
|
+
global,
|
|
6
|
+
Buffer,
|
|
7
|
+
process
|
|
8
|
+
} from "@dxos/node-std/inject-globals";
|
|
9
|
+
|
|
3
10
|
// packages/sdk/client-services/src/packlets/devtools/feeds.ts
|
|
4
11
|
import { EventSubscriptions } from "@dxos/async";
|
|
5
12
|
import { Stream } from "@dxos/codec-protobuf";
|
|
@@ -2534,7 +2541,7 @@ var getPlatform = () => {
|
|
|
2534
2541
|
};
|
|
2535
2542
|
|
|
2536
2543
|
// packages/sdk/client-services/src/version.ts
|
|
2537
|
-
var DXOS_VERSION = "0.3.9-main.
|
|
2544
|
+
var DXOS_VERSION = "0.3.9-main.c64f707";
|
|
2538
2545
|
|
|
2539
2546
|
// packages/sdk/client-services/src/packlets/services/diagnostics.ts
|
|
2540
2547
|
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
|
|
@@ -2668,12 +2675,30 @@ import { createMappedFeedWriter } from "@dxos/echo-pipeline";
|
|
|
2668
2675
|
import { PublicKey as PublicKey8 } from "@dxos/keys";
|
|
2669
2676
|
import { log as log10 } from "@dxos/log";
|
|
2670
2677
|
import { CancelledError, SystemError } from "@dxos/protocols";
|
|
2671
|
-
import { SpaceState } from "@dxos/protocols/proto/dxos/client/services";
|
|
2678
|
+
import { SpaceState, CreateEpochRequest } from "@dxos/protocols/proto/dxos/client/services";
|
|
2672
2679
|
import { AdmittedFeed as AdmittedFeed3 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
2673
2680
|
import { Timeframe as Timeframe2 } from "@dxos/timeframe";
|
|
2674
2681
|
import { trace as trace6 } from "@dxos/tracing";
|
|
2675
2682
|
import { ComplexSet as ComplexSet3 } from "@dxos/util";
|
|
2676
2683
|
|
|
2684
|
+
// packages/sdk/client-services/src/packlets/spaces/automerge-space-state.ts
|
|
2685
|
+
import { checkCredentialType } from "@dxos/credentials";
|
|
2686
|
+
var AutomergeSpaceState = class {
|
|
2687
|
+
constructor() {
|
|
2688
|
+
this.rootUrl = void 0;
|
|
2689
|
+
this.lastEpoch = void 0;
|
|
2690
|
+
}
|
|
2691
|
+
async processCredential(credential) {
|
|
2692
|
+
if (!checkCredentialType(credential, "dxos.halo.credentials.Epoch")) {
|
|
2693
|
+
return;
|
|
2694
|
+
}
|
|
2695
|
+
this.lastEpoch = credential;
|
|
2696
|
+
if (credential.subject.assertion.automergeRoot) {
|
|
2697
|
+
this.rootUrl = credential.subject.assertion.automergeRoot;
|
|
2698
|
+
}
|
|
2699
|
+
}
|
|
2700
|
+
};
|
|
2701
|
+
|
|
2677
2702
|
// packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
|
|
2678
2703
|
import { DeferredTask, Event as Event4, scheduleTask as scheduleTask3, sleep, TimeoutError as TimeoutError2, Trigger as Trigger4 } from "@dxos/async";
|
|
2679
2704
|
import { Context as Context6, rejectOnDispose } from "@dxos/context";
|
|
@@ -2959,6 +2984,9 @@ var DataSpace = class DataSpace2 {
|
|
|
2959
2984
|
constructor(params) {
|
|
2960
2985
|
this._ctx = new Context7();
|
|
2961
2986
|
this._notarizationPlugin = new NotarizationPlugin();
|
|
2987
|
+
this._cache = void 0;
|
|
2988
|
+
// TODO(dmaretskyi): Move into Space?
|
|
2989
|
+
this._automergeSpaceState = new AutomergeSpaceState();
|
|
2962
2990
|
this._state = SpaceState.CLOSED;
|
|
2963
2991
|
/**
|
|
2964
2992
|
* Error for _state === SpaceState.ERROR.
|
|
@@ -2975,6 +3003,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2975
3003
|
this._metadataStore = params.metadataStore;
|
|
2976
3004
|
this._signingContext = params.signingContext;
|
|
2977
3005
|
this._callbacks = params.callbacks ?? {};
|
|
3006
|
+
this._automergeHost = params.automergeHost;
|
|
2978
3007
|
this.authVerifier = new TrustedKeySetAuthVerifier({
|
|
2979
3008
|
trustedKeysProvider: () => new ComplexSet3(PublicKey8.hash, Array.from(this._inner.spaceState.members.values()).filter((member) => !member.removed).map((member) => member.key)),
|
|
2980
3009
|
update: this._inner.stateUpdate,
|
|
@@ -2986,7 +3015,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2986
3015
|
state: SpaceState[this._state]
|
|
2987
3016
|
}, {
|
|
2988
3017
|
F: __dxlog_file12,
|
|
2989
|
-
L:
|
|
3018
|
+
L: 137,
|
|
2990
3019
|
S: this,
|
|
2991
3020
|
C: (f, a) => f(...a)
|
|
2992
3021
|
});
|
|
@@ -3016,6 +3045,9 @@ var DataSpace = class DataSpace2 {
|
|
|
3016
3045
|
get cache() {
|
|
3017
3046
|
return this._cache;
|
|
3018
3047
|
}
|
|
3048
|
+
get automergeSpaceState() {
|
|
3049
|
+
return this._automergeSpaceState;
|
|
3050
|
+
}
|
|
3019
3051
|
async open() {
|
|
3020
3052
|
await this._open();
|
|
3021
3053
|
}
|
|
@@ -3023,13 +3055,14 @@ var DataSpace = class DataSpace2 {
|
|
|
3023
3055
|
await this._gossip.open();
|
|
3024
3056
|
await this._notarizationPlugin.open();
|
|
3025
3057
|
await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
|
|
3058
|
+
await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
|
|
3026
3059
|
await this._inner.open(new Context7());
|
|
3027
3060
|
this._state = SpaceState.CONTROL_ONLY;
|
|
3028
3061
|
log10("new state", {
|
|
3029
3062
|
state: SpaceState[this._state]
|
|
3030
3063
|
}, {
|
|
3031
3064
|
F: __dxlog_file12,
|
|
3032
|
-
L:
|
|
3065
|
+
L: 189,
|
|
3033
3066
|
S: this,
|
|
3034
3067
|
C: (f, a) => f(...a)
|
|
3035
3068
|
});
|
|
@@ -3047,7 +3080,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3047
3080
|
state: SpaceState[this._state]
|
|
3048
3081
|
}, {
|
|
3049
3082
|
F: __dxlog_file12,
|
|
3050
|
-
L:
|
|
3083
|
+
L: 203,
|
|
3051
3084
|
S: this,
|
|
3052
3085
|
C: (f, a) => f(...a)
|
|
3053
3086
|
});
|
|
@@ -3055,6 +3088,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3055
3088
|
this._ctx = new Context7();
|
|
3056
3089
|
await this.authVerifier.close();
|
|
3057
3090
|
await this._inner.close();
|
|
3091
|
+
await this._inner.spaceState.removeCredentialProcessor(this._automergeSpaceState);
|
|
3058
3092
|
await this._inner.spaceState.removeCredentialProcessor(this._notarizationPlugin);
|
|
3059
3093
|
await this._notarizationPlugin.close();
|
|
3060
3094
|
await this._presence.destroy();
|
|
@@ -3078,7 +3112,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3078
3112
|
if (err instanceof CancelledError) {
|
|
3079
3113
|
log10("data pipeline initialization cancelled", err, {
|
|
3080
3114
|
F: __dxlog_file12,
|
|
3081
|
-
L:
|
|
3115
|
+
L: 236,
|
|
3082
3116
|
S: this,
|
|
3083
3117
|
C: (f, a) => f(...a)
|
|
3084
3118
|
});
|
|
@@ -3086,7 +3120,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3086
3120
|
}
|
|
3087
3121
|
log10.error("Error initializing data pipeline", err, {
|
|
3088
3122
|
F: __dxlog_file12,
|
|
3089
|
-
L:
|
|
3123
|
+
L: 240,
|
|
3090
3124
|
S: this,
|
|
3091
3125
|
C: (f, a) => f(...a)
|
|
3092
3126
|
});
|
|
@@ -3095,7 +3129,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3095
3129
|
state: SpaceState[this._state]
|
|
3096
3130
|
}, {
|
|
3097
3131
|
F: __dxlog_file12,
|
|
3098
|
-
L:
|
|
3132
|
+
L: 242,
|
|
3099
3133
|
S: this,
|
|
3100
3134
|
C: (f, a) => f(...a)
|
|
3101
3135
|
});
|
|
@@ -3115,7 +3149,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3115
3149
|
state: SpaceState[this._state]
|
|
3116
3150
|
}, {
|
|
3117
3151
|
F: __dxlog_file12,
|
|
3118
|
-
L:
|
|
3152
|
+
L: 258,
|
|
3119
3153
|
S: this,
|
|
3120
3154
|
C: (f, a) => f(...a)
|
|
3121
3155
|
});
|
|
@@ -3126,7 +3160,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3126
3160
|
await cancelWithContext2(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
|
|
3127
3161
|
log10("waiting for data pipeline to reach target timeframe", void 0, {
|
|
3128
3162
|
F: __dxlog_file12,
|
|
3129
|
-
L:
|
|
3163
|
+
L: 272,
|
|
3130
3164
|
S: this,
|
|
3131
3165
|
C: (f, a) => f(...a)
|
|
3132
3166
|
});
|
|
@@ -3137,7 +3171,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3137
3171
|
this.metrics.dataPipelineReady = /* @__PURE__ */ new Date();
|
|
3138
3172
|
log10("data pipeline ready", void 0, {
|
|
3139
3173
|
F: __dxlog_file12,
|
|
3140
|
-
L:
|
|
3174
|
+
L: 281,
|
|
3141
3175
|
S: this,
|
|
3142
3176
|
C: (f, a) => f(...a)
|
|
3143
3177
|
});
|
|
@@ -3147,7 +3181,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3147
3181
|
state: SpaceState[this._state]
|
|
3148
3182
|
}, {
|
|
3149
3183
|
F: __dxlog_file12,
|
|
3150
|
-
L:
|
|
3184
|
+
L: 285,
|
|
3151
3185
|
S: this,
|
|
3152
3186
|
C: (f, a) => f(...a)
|
|
3153
3187
|
});
|
|
@@ -3163,7 +3197,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3163
3197
|
await this._createWritableFeeds();
|
|
3164
3198
|
log10("writable feeds created", void 0, {
|
|
3165
3199
|
F: __dxlog_file12,
|
|
3166
|
-
L:
|
|
3200
|
+
L: 301,
|
|
3167
3201
|
S: this,
|
|
3168
3202
|
C: (f, a) => f(...a)
|
|
3169
3203
|
});
|
|
@@ -3235,8 +3269,28 @@ var DataSpace = class DataSpace2 {
|
|
|
3235
3269
|
}
|
|
3236
3270
|
});
|
|
3237
3271
|
}
|
|
3238
|
-
async createEpoch() {
|
|
3239
|
-
|
|
3272
|
+
async createEpoch(options) {
|
|
3273
|
+
let epoch;
|
|
3274
|
+
switch (options?.migration) {
|
|
3275
|
+
case void 0:
|
|
3276
|
+
case CreateEpochRequest.Migration.NONE:
|
|
3277
|
+
{
|
|
3278
|
+
epoch = await this.dataPipeline.createEpoch();
|
|
3279
|
+
}
|
|
3280
|
+
break;
|
|
3281
|
+
case CreateEpochRequest.Migration.INIT_AUTOMERGE: {
|
|
3282
|
+
const document = this._automergeHost.repo.create();
|
|
3283
|
+
epoch = {
|
|
3284
|
+
previousId: this._automergeSpaceState.lastEpoch?.id,
|
|
3285
|
+
number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
|
|
3286
|
+
timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new Timeframe2(),
|
|
3287
|
+
automergeRoot: document.url
|
|
3288
|
+
};
|
|
3289
|
+
}
|
|
3290
|
+
}
|
|
3291
|
+
if (!epoch) {
|
|
3292
|
+
return;
|
|
3293
|
+
}
|
|
3240
3294
|
const receipt = await this.inner.controlPipeline.writer.write({
|
|
3241
3295
|
credential: {
|
|
3242
3296
|
credential: await this._signingContext.credentialSigner.createCredential({
|
|
@@ -3283,7 +3337,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3283
3337
|
state: SpaceState[this._state]
|
|
3284
3338
|
}, {
|
|
3285
3339
|
F: __dxlog_file12,
|
|
3286
|
-
L:
|
|
3340
|
+
L: 450,
|
|
3287
3341
|
S: this,
|
|
3288
3342
|
C: (f, a) => f(...a)
|
|
3289
3343
|
});
|
|
@@ -3336,7 +3390,7 @@ import { createCredential } from "@dxos/credentials";
|
|
|
3336
3390
|
import { failUndefined as failUndefined2 } from "@dxos/debug";
|
|
3337
3391
|
import { AdmittedFeed as AdmittedFeed4, SpaceMember as SpaceMember2 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
3338
3392
|
import { Timeframe as Timeframe3 } from "@dxos/timeframe";
|
|
3339
|
-
var spaceGenesis = async (keyring, signingContext, space) => {
|
|
3393
|
+
var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
|
|
3340
3394
|
const credentials = [
|
|
3341
3395
|
await createCredential({
|
|
3342
3396
|
signer: keyring,
|
|
@@ -3386,7 +3440,8 @@ var spaceGenesis = async (keyring, signingContext, space) => {
|
|
|
3386
3440
|
number: 0,
|
|
3387
3441
|
previousId: void 0,
|
|
3388
3442
|
timeframe: new Timeframe3(),
|
|
3389
|
-
snapshotCid: void 0
|
|
3443
|
+
snapshotCid: void 0,
|
|
3444
|
+
automergeRoot
|
|
3390
3445
|
}
|
|
3391
3446
|
})
|
|
3392
3447
|
];
|
|
@@ -3415,13 +3470,14 @@ var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
|
|
|
3415
3470
|
var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
3416
3471
|
var PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
3417
3472
|
var DataSpaceManager = class DataSpaceManager2 {
|
|
3418
|
-
constructor(_spaceManager, _metadataStore, _dataServiceSubscriptions, _keyring, _signingContext, _feedStore) {
|
|
3473
|
+
constructor(_spaceManager, _metadataStore, _dataServiceSubscriptions, _keyring, _signingContext, _feedStore, _automergeHost) {
|
|
3419
3474
|
this._spaceManager = _spaceManager;
|
|
3420
3475
|
this._metadataStore = _metadataStore;
|
|
3421
3476
|
this._dataServiceSubscriptions = _dataServiceSubscriptions;
|
|
3422
3477
|
this._keyring = _keyring;
|
|
3423
3478
|
this._signingContext = _signingContext;
|
|
3424
3479
|
this._feedStore = _feedStore;
|
|
3480
|
+
this._automergeHost = _automergeHost;
|
|
3425
3481
|
this._ctx = new Context8();
|
|
3426
3482
|
this.updated = new Event6();
|
|
3427
3483
|
this._spaces = new ComplexMap3(PublicKey9.hash);
|
|
@@ -3435,7 +3491,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3435
3491
|
async open() {
|
|
3436
3492
|
log11("open", void 0, {
|
|
3437
3493
|
F: __dxlog_file13,
|
|
3438
|
-
L:
|
|
3494
|
+
L: 90,
|
|
3439
3495
|
S: this,
|
|
3440
3496
|
C: (f, a) => f(...a)
|
|
3441
3497
|
});
|
|
@@ -3443,7 +3499,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3443
3499
|
id: this._instanceId
|
|
3444
3500
|
}), {
|
|
3445
3501
|
F: __dxlog_file13,
|
|
3446
|
-
L:
|
|
3502
|
+
L: 91,
|
|
3447
3503
|
S: this,
|
|
3448
3504
|
C: (f, a) => f(...a)
|
|
3449
3505
|
});
|
|
@@ -3451,7 +3507,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3451
3507
|
spaces: this._metadataStore.spaces.length
|
|
3452
3508
|
}, {
|
|
3453
3509
|
F: __dxlog_file13,
|
|
3454
|
-
L:
|
|
3510
|
+
L: 92,
|
|
3455
3511
|
S: this,
|
|
3456
3512
|
C: (f, a) => f(...a)
|
|
3457
3513
|
});
|
|
@@ -3461,7 +3517,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3461
3517
|
spaceMetadata
|
|
3462
3518
|
}, {
|
|
3463
3519
|
F: __dxlog_file13,
|
|
3464
|
-
L:
|
|
3520
|
+
L: 96,
|
|
3465
3521
|
S: this,
|
|
3466
3522
|
C: (f, a) => f(...a)
|
|
3467
3523
|
});
|
|
@@ -3472,7 +3528,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3472
3528
|
err
|
|
3473
3529
|
}, {
|
|
3474
3530
|
F: __dxlog_file13,
|
|
3475
|
-
L:
|
|
3531
|
+
L: 99,
|
|
3476
3532
|
S: this,
|
|
3477
3533
|
C: (f, a) => f(...a)
|
|
3478
3534
|
});
|
|
@@ -3489,7 +3545,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3489
3545
|
id: this._instanceId
|
|
3490
3546
|
}), {
|
|
3491
3547
|
F: __dxlog_file13,
|
|
3492
|
-
L:
|
|
3548
|
+
L: 112,
|
|
3493
3549
|
S: this,
|
|
3494
3550
|
C: (f, a) => f(...a)
|
|
3495
3551
|
});
|
|
@@ -3497,7 +3553,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3497
3553
|
async close() {
|
|
3498
3554
|
log11("close", void 0, {
|
|
3499
3555
|
F: __dxlog_file13,
|
|
3500
|
-
L:
|
|
3556
|
+
L: 117,
|
|
3501
3557
|
S: this,
|
|
3502
3558
|
C: (f, a) => f(...a)
|
|
3503
3559
|
});
|
|
@@ -3513,7 +3569,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3513
3569
|
async createSpace() {
|
|
3514
3570
|
invariant11(this._isOpen, "Not open.", {
|
|
3515
3571
|
F: __dxlog_file13,
|
|
3516
|
-
L:
|
|
3572
|
+
L: 130,
|
|
3517
3573
|
S: this,
|
|
3518
3574
|
A: [
|
|
3519
3575
|
"this._isOpen",
|
|
@@ -3534,17 +3590,18 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3534
3590
|
spaceKey
|
|
3535
3591
|
}, {
|
|
3536
3592
|
F: __dxlog_file13,
|
|
3537
|
-
L:
|
|
3593
|
+
L: 142,
|
|
3538
3594
|
S: this,
|
|
3539
3595
|
C: (f, a) => f(...a)
|
|
3540
3596
|
});
|
|
3541
3597
|
const space = await this._constructSpace(metadata);
|
|
3542
|
-
const
|
|
3598
|
+
const automergeRoot = this._automergeHost.repo.create();
|
|
3599
|
+
const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner, automergeRoot.url);
|
|
3543
3600
|
await this._metadataStore.addSpace(metadata);
|
|
3544
3601
|
const memberCredential = credentials[1];
|
|
3545
3602
|
invariant11(getCredentialAssertion2(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
3546
3603
|
F: __dxlog_file13,
|
|
3547
|
-
L:
|
|
3604
|
+
L: 151,
|
|
3548
3605
|
S: this,
|
|
3549
3606
|
A: [
|
|
3550
3607
|
"getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -3562,13 +3619,13 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3562
3619
|
opts
|
|
3563
3620
|
}, {
|
|
3564
3621
|
F: __dxlog_file13,
|
|
3565
|
-
L:
|
|
3622
|
+
L: 163,
|
|
3566
3623
|
S: this,
|
|
3567
3624
|
C: (f, a) => f(...a)
|
|
3568
3625
|
});
|
|
3569
3626
|
invariant11(this._isOpen, "Not open.", {
|
|
3570
3627
|
F: __dxlog_file13,
|
|
3571
|
-
L:
|
|
3628
|
+
L: 164,
|
|
3572
3629
|
S: this,
|
|
3573
3630
|
A: [
|
|
3574
3631
|
"this._isOpen",
|
|
@@ -3577,7 +3634,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3577
3634
|
});
|
|
3578
3635
|
invariant11(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
3579
3636
|
F: __dxlog_file13,
|
|
3580
|
-
L:
|
|
3637
|
+
L: 165,
|
|
3581
3638
|
S: this,
|
|
3582
3639
|
A: [
|
|
3583
3640
|
"!this._spaces.has(opts.spaceKey)",
|
|
@@ -3612,7 +3669,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3612
3669
|
metadata
|
|
3613
3670
|
}, {
|
|
3614
3671
|
F: __dxlog_file13,
|
|
3615
|
-
L:
|
|
3672
|
+
L: 198,
|
|
3616
3673
|
S: this,
|
|
3617
3674
|
C: (f, a) => f(...a)
|
|
3618
3675
|
});
|
|
@@ -3644,11 +3701,12 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3644
3701
|
remotePeerId: session.remotePeerId
|
|
3645
3702
|
}));
|
|
3646
3703
|
session.addExtension("dxos.mesh.teleport.notarization", dataSpace.notarizationPlugin.createExtension());
|
|
3704
|
+
session.addExtension("dxos.mesh.teleport.automerge", this._automergeHost.createExtension());
|
|
3647
3705
|
},
|
|
3648
3706
|
onAuthFailure: () => {
|
|
3649
3707
|
log11.warn("auth failure", void 0, {
|
|
3650
3708
|
F: __dxlog_file13,
|
|
3651
|
-
L:
|
|
3709
|
+
L: 234,
|
|
3652
3710
|
S: this,
|
|
3653
3711
|
C: (f, a) => f(...a)
|
|
3654
3712
|
});
|
|
@@ -3672,7 +3730,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3672
3730
|
space: space.key
|
|
3673
3731
|
}, {
|
|
3674
3732
|
F: __dxlog_file13,
|
|
3675
|
-
L:
|
|
3733
|
+
L: 252,
|
|
3676
3734
|
S: this,
|
|
3677
3735
|
C: (f, a) => f(...a)
|
|
3678
3736
|
});
|
|
@@ -3684,7 +3742,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3684
3742
|
open: this._isOpen
|
|
3685
3743
|
}, {
|
|
3686
3744
|
F: __dxlog_file13,
|
|
3687
|
-
L:
|
|
3745
|
+
L: 259,
|
|
3688
3746
|
S: this,
|
|
3689
3747
|
C: (f, a) => f(...a)
|
|
3690
3748
|
});
|
|
@@ -3697,14 +3755,15 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3697
3755
|
space: space.key
|
|
3698
3756
|
}, {
|
|
3699
3757
|
F: __dxlog_file13,
|
|
3700
|
-
L:
|
|
3758
|
+
L: 265,
|
|
3701
3759
|
S: this,
|
|
3702
3760
|
C: (f, a) => f(...a)
|
|
3703
3761
|
});
|
|
3704
3762
|
await this._dataServiceSubscriptions.unregisterSpace(space.key);
|
|
3705
3763
|
}
|
|
3706
3764
|
},
|
|
3707
|
-
cache: metadata.cache
|
|
3765
|
+
cache: metadata.cache,
|
|
3766
|
+
automergeHost: this._automergeHost
|
|
3708
3767
|
});
|
|
3709
3768
|
if (metadata.state !== SpaceState2.INACTIVE) {
|
|
3710
3769
|
await dataSpace.open();
|
|
@@ -3961,7 +4020,7 @@ import { Trigger as Trigger5 } from "@dxos/async";
|
|
|
3961
4020
|
import { Context as Context9 } from "@dxos/context";
|
|
3962
4021
|
import { getCredentialAssertion as getCredentialAssertion3 } from "@dxos/credentials";
|
|
3963
4022
|
import { failUndefined as failUndefined3 } from "@dxos/debug";
|
|
3964
|
-
import { valueEncoding, MetadataStore, SpaceManager, DataServiceSubscriptions, SnapshotStore } from "@dxos/echo-pipeline";
|
|
4023
|
+
import { valueEncoding, MetadataStore, SpaceManager, DataServiceSubscriptions, SnapshotStore, AutomergeHost } from "@dxos/echo-pipeline";
|
|
3965
4024
|
import { FeedFactory, FeedStore } from "@dxos/feed-store";
|
|
3966
4025
|
import { invariant as invariant13 } from "@dxos/invariant";
|
|
3967
4026
|
import { Keyring } from "@dxos/keyring";
|
|
@@ -4016,6 +4075,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4016
4075
|
snapshotStore: this.snapshotStore
|
|
4017
4076
|
});
|
|
4018
4077
|
this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager);
|
|
4078
|
+
this.automergeHost = new AutomergeHost(storage.createDirectory("automerge"));
|
|
4019
4079
|
this.invitations = new InvitationsHandler(this.networkManager);
|
|
4020
4080
|
this._handlerFactories.set(Invitation6.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? failUndefined3(), this._acceptIdentity.bind(this)));
|
|
4021
4081
|
}
|
|
@@ -4023,7 +4083,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4023
4083
|
await this._checkStorageVersion();
|
|
4024
4084
|
log13("opening...", void 0, {
|
|
4025
4085
|
F: __dxlog_file15,
|
|
4026
|
-
L:
|
|
4086
|
+
L: 133,
|
|
4027
4087
|
S: this,
|
|
4028
4088
|
C: (f, a) => f(...a)
|
|
4029
4089
|
});
|
|
@@ -4031,7 +4091,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4031
4091
|
id: this._instanceId
|
|
4032
4092
|
}), {
|
|
4033
4093
|
F: __dxlog_file15,
|
|
4034
|
-
L:
|
|
4094
|
+
L: 134,
|
|
4035
4095
|
S: this,
|
|
4036
4096
|
C: (f, a) => f(...a)
|
|
4037
4097
|
});
|
|
@@ -4047,13 +4107,13 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4047
4107
|
id: this._instanceId
|
|
4048
4108
|
}), {
|
|
4049
4109
|
F: __dxlog_file15,
|
|
4050
|
-
L:
|
|
4110
|
+
L: 144,
|
|
4051
4111
|
S: this,
|
|
4052
4112
|
C: (f, a) => f(...a)
|
|
4053
4113
|
});
|
|
4054
4114
|
log13("opened", void 0, {
|
|
4055
4115
|
F: __dxlog_file15,
|
|
4056
|
-
L:
|
|
4116
|
+
L: 145,
|
|
4057
4117
|
S: this,
|
|
4058
4118
|
C: (f, a) => f(...a)
|
|
4059
4119
|
});
|
|
@@ -4061,13 +4121,14 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4061
4121
|
async close() {
|
|
4062
4122
|
log13("closing...", void 0, {
|
|
4063
4123
|
F: __dxlog_file15,
|
|
4064
|
-
L:
|
|
4124
|
+
L: 149,
|
|
4065
4125
|
S: this,
|
|
4066
4126
|
C: (f, a) => f(...a)
|
|
4067
4127
|
});
|
|
4068
4128
|
if (this._deviceSpaceSync && this.identityManager.identity) {
|
|
4069
4129
|
await this.identityManager.identity.space.spaceState.removeCredentialProcessor(this._deviceSpaceSync);
|
|
4070
4130
|
}
|
|
4131
|
+
await this.automergeHost.close();
|
|
4071
4132
|
await this.dataSpaceManager?.close();
|
|
4072
4133
|
await this.identityManager.close();
|
|
4073
4134
|
await this.spaceManager.close();
|
|
@@ -4078,7 +4139,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4078
4139
|
await this.metadataStore.close();
|
|
4079
4140
|
log13("closed", void 0, {
|
|
4080
4141
|
F: __dxlog_file15,
|
|
4081
|
-
L:
|
|
4142
|
+
L: 162,
|
|
4082
4143
|
S: this,
|
|
4083
4144
|
C: (f, a) => f(...a)
|
|
4084
4145
|
});
|
|
@@ -4092,7 +4153,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4092
4153
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
4093
4154
|
invariant13(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
4094
4155
|
F: __dxlog_file15,
|
|
4095
|
-
L:
|
|
4156
|
+
L: 173,
|
|
4096
4157
|
S: this,
|
|
4097
4158
|
A: [
|
|
4098
4159
|
"factory",
|
|
@@ -4124,7 +4185,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4124
4185
|
async _initialize(ctx) {
|
|
4125
4186
|
log13("initializing spaces...", void 0, {
|
|
4126
4187
|
F: __dxlog_file15,
|
|
4127
|
-
L:
|
|
4188
|
+
L: 204,
|
|
4128
4189
|
S: this,
|
|
4129
4190
|
C: (f, a) => f(...a)
|
|
4130
4191
|
});
|
|
@@ -4142,12 +4203,12 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4142
4203
|
});
|
|
4143
4204
|
}
|
|
4144
4205
|
};
|
|
4145
|
-
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore);
|
|
4206
|
+
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore, this.automergeHost);
|
|
4146
4207
|
await this.dataSpaceManager.open();
|
|
4147
4208
|
this._handlerFactories.set(Invitation6.Kind.SPACE, (invitation) => {
|
|
4148
4209
|
invariant13(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
4149
4210
|
F: __dxlog_file15,
|
|
4150
|
-
L:
|
|
4211
|
+
L: 228,
|
|
4151
4212
|
S: this,
|
|
4152
4213
|
A: [
|
|
4153
4214
|
"this.dataSpaceManager",
|
|
@@ -4171,7 +4232,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4171
4232
|
details: assertion
|
|
4172
4233
|
}, {
|
|
4173
4234
|
F: __dxlog_file15,
|
|
4174
|
-
L:
|
|
4235
|
+
L: 244,
|
|
4175
4236
|
S: this,
|
|
4176
4237
|
C: (f, a) => f(...a)
|
|
4177
4238
|
});
|
|
@@ -4182,7 +4243,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4182
4243
|
details: assertion
|
|
4183
4244
|
}, {
|
|
4184
4245
|
F: __dxlog_file15,
|
|
4185
|
-
L:
|
|
4246
|
+
L: 248,
|
|
4186
4247
|
S: this,
|
|
4187
4248
|
C: (f, a) => f(...a)
|
|
4188
4249
|
});
|
|
@@ -4193,7 +4254,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4193
4254
|
details: assertion
|
|
4194
4255
|
}, {
|
|
4195
4256
|
F: __dxlog_file15,
|
|
4196
|
-
L:
|
|
4257
|
+
L: 253,
|
|
4197
4258
|
S: this,
|
|
4198
4259
|
C: (f, a) => f(...a)
|
|
4199
4260
|
});
|
|
@@ -4204,7 +4265,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4204
4265
|
} catch (err) {
|
|
4205
4266
|
log13.catch(err, void 0, {
|
|
4206
4267
|
F: __dxlog_file15,
|
|
4207
|
-
L:
|
|
4268
|
+
L: 259,
|
|
4208
4269
|
S: this,
|
|
4209
4270
|
C: (f, a) => f(...a)
|
|
4210
4271
|
});
|
|
@@ -4924,7 +4985,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4924
4985
|
await this._serviceContext.initialized.wait();
|
|
4925
4986
|
return this._serviceContext.dataSpaceManager;
|
|
4926
4987
|
}),
|
|
4927
|
-
DataService: new DataServiceImpl(this._serviceContext.dataServiceSubscriptions),
|
|
4988
|
+
DataService: new DataServiceImpl(this._serviceContext.dataServiceSubscriptions, this._serviceContext.automergeHost),
|
|
4928
4989
|
NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
|
|
4929
4990
|
LoggingService: this._loggingService,
|
|
4930
4991
|
TracingService: this._tracingService,
|
|
@@ -4954,7 +5015,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4954
5015
|
deviceKey
|
|
4955
5016
|
}, {
|
|
4956
5017
|
F: __dxlog_file17,
|
|
4957
|
-
L:
|
|
5018
|
+
L: 320,
|
|
4958
5019
|
S: this,
|
|
4959
5020
|
C: (f, a) => f(...a)
|
|
4960
5021
|
});
|
|
@@ -4962,7 +5023,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4962
5023
|
id: traceId
|
|
4963
5024
|
}), {
|
|
4964
5025
|
F: __dxlog_file17,
|
|
4965
|
-
L:
|
|
5026
|
+
L: 321,
|
|
4966
5027
|
S: this,
|
|
4967
5028
|
C: (f, a) => f(...a)
|
|
4968
5029
|
});
|
|
@@ -4976,7 +5037,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4976
5037
|
deviceKey
|
|
4977
5038
|
}, {
|
|
4978
5039
|
F: __dxlog_file17,
|
|
4979
|
-
L:
|
|
5040
|
+
L: 332,
|
|
4980
5041
|
S: this,
|
|
4981
5042
|
C: (f, a) => f(...a)
|
|
4982
5043
|
});
|
|
@@ -4992,7 +5053,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4992
5053
|
deviceKey
|
|
4993
5054
|
}, {
|
|
4994
5055
|
F: __dxlog_file17,
|
|
4995
|
-
L:
|
|
5056
|
+
L: 339,
|
|
4996
5057
|
S: this,
|
|
4997
5058
|
C: (f, a) => f(...a)
|
|
4998
5059
|
});
|
|
@@ -5003,13 +5064,13 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
5003
5064
|
id: traceId
|
|
5004
5065
|
}), {
|
|
5005
5066
|
F: __dxlog_file17,
|
|
5006
|
-
L:
|
|
5067
|
+
L: 344,
|
|
5007
5068
|
S: this,
|
|
5008
5069
|
C: (f, a) => f(...a)
|
|
5009
5070
|
});
|
|
5010
5071
|
log16("resetting...", void 0, {
|
|
5011
5072
|
F: __dxlog_file17,
|
|
5012
|
-
L:
|
|
5073
|
+
L: 346,
|
|
5013
5074
|
S: this,
|
|
5014
5075
|
C: (f, a) => f(...a)
|
|
5015
5076
|
});
|
|
@@ -5017,7 +5078,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
5017
5078
|
await this._storage.reset();
|
|
5018
5079
|
log16("reset", void 0, {
|
|
5019
5080
|
F: __dxlog_file17,
|
|
5020
|
-
L:
|
|
5081
|
+
L: 349,
|
|
5021
5082
|
S: this,
|
|
5022
5083
|
C: (f, a) => f(...a)
|
|
5023
5084
|
});
|
|
@@ -5025,7 +5086,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
5025
5086
|
id: traceId
|
|
5026
5087
|
}), {
|
|
5027
5088
|
F: __dxlog_file17,
|
|
5028
|
-
L:
|
|
5089
|
+
L: 350,
|
|
5029
5090
|
S: this,
|
|
5030
5091
|
C: (f, a) => f(...a)
|
|
5031
5092
|
});
|
|
@@ -5035,7 +5096,9 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
5035
5096
|
const identity = await this._serviceContext.createIdentity(params);
|
|
5036
5097
|
await this._serviceContext.initialized.wait();
|
|
5037
5098
|
const space = await this._serviceContext.dataSpaceManager.createSpace();
|
|
5038
|
-
const obj = new Properties(
|
|
5099
|
+
const obj = new Properties(void 0, {
|
|
5100
|
+
useAutomergeBackend: false
|
|
5101
|
+
});
|
|
5039
5102
|
obj[defaultKey] = identity.identityKey.toHex();
|
|
5040
5103
|
await this._serviceRegistry.services.DataService.write({
|
|
5041
5104
|
spaceKey: space.key,
|
|
@@ -5070,6 +5133,7 @@ ClientServicesHost = _ts_decorate8([
|
|
|
5070
5133
|
], ClientServicesHost);
|
|
5071
5134
|
|
|
5072
5135
|
export {
|
|
5136
|
+
Buffer,
|
|
5073
5137
|
subscribeToFeeds,
|
|
5074
5138
|
subscribeToFeedBlocks,
|
|
5075
5139
|
subscribeToNetworkStatus,
|
|
@@ -5102,4 +5166,4 @@ export {
|
|
|
5102
5166
|
createDefaultModelFactory,
|
|
5103
5167
|
ClientServicesHost
|
|
5104
5168
|
};
|
|
5105
|
-
//# sourceMappingURL=chunk-
|
|
5169
|
+
//# sourceMappingURL=chunk-LUA2PRME.mjs.map
|