@dxos/echo-pipeline 0.4.8-main.c4e8b01 → 0.4.8-main.de30065
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-LED7X4WK.mjs → chunk-XR2636AC.mjs} +34 -25
- package/dist/lib/browser/{chunk-LED7X4WK.mjs.map → chunk-XR2636AC.mjs.map} +3 -3
- package/dist/lib/browser/index.mjs +3 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -1
- package/dist/lib/node/{chunk-UKREXVZX.cjs → chunk-LD4R726W.cjs} +46 -36
- package/dist/lib/node/{chunk-UKREXVZX.cjs.map → chunk-LD4R726W.cjs.map} +3 -3
- package/dist/lib/node/index.cjs +31 -29
- package/dist/lib/node/index.cjs.map +2 -2
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +16 -16
- package/dist/types/src/automerge/automerge-host.d.ts +2 -1
- package/dist/types/src/automerge/automerge-host.d.ts.map +1 -1
- package/dist/types/src/automerge/automerge-storage-adapter.d.ts +2 -2
- package/dist/types/src/automerge/automerge-storage-adapter.d.ts.map +1 -1
- package/package.json +33 -33
- package/src/automerge/automerge-host.ts +24 -22
- package/src/automerge/automerge-storage-adapter.ts +8 -10
|
@@ -2793,11 +2793,9 @@ SpaceManager = _ts_decorate8([
|
|
|
2793
2793
|
], SpaceManager);
|
|
2794
2794
|
|
|
2795
2795
|
// packages/core/echo/echo-pipeline/src/automerge/automerge-storage-adapter.ts
|
|
2796
|
-
import { StorageAdapter } from "@dxos/automerge/automerge-repo";
|
|
2797
2796
|
import { arrayToBuffer as arrayToBuffer2, bufferToArray } from "@dxos/util";
|
|
2798
|
-
var AutomergeStorageAdapter = class
|
|
2797
|
+
var AutomergeStorageAdapter = class {
|
|
2799
2798
|
constructor(_directory) {
|
|
2800
|
-
super();
|
|
2801
2799
|
this._directory = _directory;
|
|
2802
2800
|
this._state = "opened";
|
|
2803
2801
|
}
|
|
@@ -3106,7 +3104,7 @@ var MeshNetworkAdapter = class extends NetworkAdapter2 {
|
|
|
3106
3104
|
import { next as automerge, getHeads } from "@dxos/automerge/automerge";
|
|
3107
3105
|
import { Repo } from "@dxos/automerge/automerge-repo";
|
|
3108
3106
|
import { IndexedDBStorageAdapter } from "@dxos/automerge/automerge-repo-storage-indexeddb";
|
|
3109
|
-
import { Context as Context7
|
|
3107
|
+
import { Context as Context7 } from "@dxos/context";
|
|
3110
3108
|
import { PublicKey as PublicKey8 } from "@dxos/keys";
|
|
3111
3109
|
import { log as log15 } from "@dxos/log";
|
|
3112
3110
|
import { idCodec } from "@dxos/protocols";
|
|
@@ -3210,21 +3208,20 @@ var AutomergeHost = class {
|
|
|
3210
3208
|
return isRequested;
|
|
3211
3209
|
}
|
|
3212
3210
|
try {
|
|
3213
|
-
const
|
|
3214
|
-
if (!
|
|
3211
|
+
const spaceKey = getSpaceKeyFromDoc(doc);
|
|
3212
|
+
if (!spaceKey) {
|
|
3215
3213
|
log15("space key not found for share policy check", {
|
|
3216
3214
|
peerId,
|
|
3217
3215
|
documentId
|
|
3218
3216
|
}, {
|
|
3219
3217
|
F: __dxlog_file16,
|
|
3220
|
-
L:
|
|
3218
|
+
L: 103,
|
|
3221
3219
|
S: this,
|
|
3222
3220
|
C: (f, a) => f(...a)
|
|
3223
3221
|
});
|
|
3224
3222
|
return false;
|
|
3225
3223
|
}
|
|
3226
|
-
const
|
|
3227
|
-
const authorizedDevices = this._authorizedDevices.get(spaceKey);
|
|
3224
|
+
const authorizedDevices = this._authorizedDevices.get(PublicKey8.from(spaceKey));
|
|
3228
3225
|
const deviceKeyHex = this.repo.peerMetadataByPeerId[peerId]?.dxos_deviceKey;
|
|
3229
3226
|
if (!deviceKeyHex) {
|
|
3230
3227
|
log15("device key not found for share policy check", {
|
|
@@ -3232,7 +3229,7 @@ var AutomergeHost = class {
|
|
|
3232
3229
|
documentId
|
|
3233
3230
|
}, {
|
|
3234
3231
|
F: __dxlog_file16,
|
|
3235
|
-
L:
|
|
3232
|
+
L: 112,
|
|
3236
3233
|
S: this,
|
|
3237
3234
|
C: (f, a) => f(...a)
|
|
3238
3235
|
});
|
|
@@ -3249,7 +3246,7 @@ var AutomergeHost = class {
|
|
|
3249
3246
|
isAuthorized
|
|
3250
3247
|
}, {
|
|
3251
3248
|
F: __dxlog_file16,
|
|
3252
|
-
L:
|
|
3249
|
+
L: 118,
|
|
3253
3250
|
S: this,
|
|
3254
3251
|
C: (f, a) => f(...a)
|
|
3255
3252
|
});
|
|
@@ -3257,7 +3254,7 @@ var AutomergeHost = class {
|
|
|
3257
3254
|
} catch (err) {
|
|
3258
3255
|
log15.catch(err, void 0, {
|
|
3259
3256
|
F: __dxlog_file16,
|
|
3260
|
-
L:
|
|
3257
|
+
L: 128,
|
|
3261
3258
|
S: this,
|
|
3262
3259
|
C: (f, a) => f(...a)
|
|
3263
3260
|
});
|
|
@@ -3292,8 +3289,8 @@ var AutomergeHost = class {
|
|
|
3292
3289
|
});
|
|
3293
3290
|
}
|
|
3294
3291
|
_onUpdate(event) {
|
|
3295
|
-
const spaceKey = event.doc
|
|
3296
|
-
if (!spaceKey) {
|
|
3292
|
+
const spaceKey = getSpaceKeyFromDoc(event.doc);
|
|
3293
|
+
if (!spaceKey || this._metadata == null) {
|
|
3297
3294
|
return;
|
|
3298
3295
|
}
|
|
3299
3296
|
const objectIds = getInlineChanges(event);
|
|
@@ -3305,17 +3302,21 @@ var AutomergeHost = class {
|
|
|
3305
3302
|
if (!lastAvailableHash) {
|
|
3306
3303
|
return;
|
|
3307
3304
|
}
|
|
3308
|
-
const
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3305
|
+
const encodedIds = objectIds.map((objectId) => idCodec.encode({
|
|
3306
|
+
documentId: event.handle.documentId,
|
|
3307
|
+
objectId,
|
|
3308
|
+
spaceKey
|
|
3309
|
+
}));
|
|
3310
|
+
const idToLastHash = new Map(encodedIds.map((id) => [
|
|
3311
|
+
id,
|
|
3312
|
+
lastAvailableHash
|
|
3313
|
+
]));
|
|
3314
|
+
const markingDirtyPromise = this._metadata.markDirty(idToLastHash).then(() => {
|
|
3314
3315
|
this._updatingMetadata.delete(event.handle.documentId);
|
|
3315
3316
|
}).catch((err) => {
|
|
3316
|
-
|
|
3317
|
+
this._ctx.disposed && log15.catch(err, void 0, {
|
|
3317
3318
|
F: __dxlog_file16,
|
|
3318
|
-
L:
|
|
3319
|
+
L: 191,
|
|
3319
3320
|
S: this,
|
|
3320
3321
|
C: (f, a) => f(...a)
|
|
3321
3322
|
});
|
|
@@ -3376,7 +3377,7 @@ var AutomergeHost = class {
|
|
|
3376
3377
|
deviceKey
|
|
3377
3378
|
}, {
|
|
3378
3379
|
F: __dxlog_file16,
|
|
3379
|
-
L:
|
|
3380
|
+
L: 258,
|
|
3380
3381
|
S: this,
|
|
3381
3382
|
C: (f, a) => f(...a)
|
|
3382
3383
|
});
|
|
@@ -3417,6 +3418,13 @@ var getInlineChanges = (event) => {
|
|
|
3417
3418
|
...inlineChangedObjectIds
|
|
3418
3419
|
];
|
|
3419
3420
|
};
|
|
3421
|
+
var getSpaceKeyFromDoc = (doc) => {
|
|
3422
|
+
const rawSpaceKey = doc.access?.spaceKey ?? doc.experimental_spaceKey;
|
|
3423
|
+
if (rawSpaceKey == null) {
|
|
3424
|
+
return null;
|
|
3425
|
+
}
|
|
3426
|
+
return String(rawSpaceKey);
|
|
3427
|
+
};
|
|
3420
3428
|
|
|
3421
3429
|
export {
|
|
3422
3430
|
codec,
|
|
@@ -3446,6 +3454,7 @@ export {
|
|
|
3446
3454
|
AutomergeStorageAdapter,
|
|
3447
3455
|
LocalHostNetworkAdapter,
|
|
3448
3456
|
MeshNetworkAdapter,
|
|
3449
|
-
AutomergeHost
|
|
3457
|
+
AutomergeHost,
|
|
3458
|
+
getSpaceKeyFromDoc
|
|
3450
3459
|
};
|
|
3451
|
-
//# sourceMappingURL=chunk-
|
|
3460
|
+
//# sourceMappingURL=chunk-XR2636AC.mjs.map
|