@dxos/echo-pipeline 0.4.6-main.e47f68d → 0.4.6
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-6VWKRT66.mjs → chunk-2AAHNMOH.mjs} +32 -13
- package/dist/lib/browser/{chunk-6VWKRT66.mjs.map → chunk-2AAHNMOH.mjs.map} +3 -3
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -1
- package/dist/lib/node/{chunk-YOF3R6KU.cjs → chunk-CZ5KWO66.cjs} +35 -16
- package/dist/lib/node/{chunk-YOF3R6KU.cjs.map → chunk-CZ5KWO66.cjs.map} +3 -3
- package/dist/lib/node/index.cjs +29 -29
- package/dist/lib/node/index.cjs.map +1 -1
- 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 +1 -0
- package/dist/types/src/automerge/automerge-host.d.ts.map +1 -1
- package/package.json +33 -33
- package/src/automerge/automerge-host.ts +27 -5
|
@@ -3105,9 +3105,9 @@ var AutomergeHost = class {
|
|
|
3105
3105
|
this._meshNetwork = new MeshNetworkAdapter();
|
|
3106
3106
|
this._clientNetwork = new LocalHostNetworkAdapter();
|
|
3107
3107
|
this._storage = storageDirectory.type === StorageType.IDB ? new IndexedDBStorageAdapter(storageDirectory.path, "data") : new AutomergeStorageAdapter(storageDirectory);
|
|
3108
|
-
|
|
3108
|
+
this._peerId = `host-${PublicKey8.random().toHex()}`;
|
|
3109
3109
|
this._repo = new Repo({
|
|
3110
|
-
peerId:
|
|
3110
|
+
peerId: this._peerId,
|
|
3111
3111
|
network: [
|
|
3112
3112
|
this._clientNetwork,
|
|
3113
3113
|
this._meshNetwork
|
|
@@ -3131,26 +3131,27 @@ var AutomergeHost = class {
|
|
|
3131
3131
|
isRequested
|
|
3132
3132
|
}, {
|
|
3133
3133
|
F: __dxlog_file16,
|
|
3134
|
-
L:
|
|
3134
|
+
L: 69,
|
|
3135
3135
|
S: this,
|
|
3136
3136
|
C: (f, a) => f(...a)
|
|
3137
3137
|
});
|
|
3138
3138
|
return isRequested;
|
|
3139
3139
|
}
|
|
3140
3140
|
try {
|
|
3141
|
-
|
|
3141
|
+
const rawSpaceKey = doc.access?.spaceKey ?? doc.experimental_spaceKey;
|
|
3142
|
+
if (!rawSpaceKey) {
|
|
3142
3143
|
log15("space key not found for share policy check", {
|
|
3143
3144
|
peerId,
|
|
3144
3145
|
documentId
|
|
3145
3146
|
}, {
|
|
3146
3147
|
F: __dxlog_file16,
|
|
3147
|
-
L:
|
|
3148
|
+
L: 77,
|
|
3148
3149
|
S: this,
|
|
3149
3150
|
C: (f, a) => f(...a)
|
|
3150
3151
|
});
|
|
3151
3152
|
return false;
|
|
3152
3153
|
}
|
|
3153
|
-
const spaceKey = PublicKey8.from(
|
|
3154
|
+
const spaceKey = PublicKey8.from(rawSpaceKey);
|
|
3154
3155
|
const authorizedDevices = this._authorizedDevices.get(spaceKey);
|
|
3155
3156
|
const deviceKeyHex = this.repo.peerMetadataByPeerId[peerId]?.dxos_deviceKey;
|
|
3156
3157
|
if (!deviceKeyHex) {
|
|
@@ -3159,7 +3160,7 @@ var AutomergeHost = class {
|
|
|
3159
3160
|
documentId
|
|
3160
3161
|
}, {
|
|
3161
3162
|
F: __dxlog_file16,
|
|
3162
|
-
L:
|
|
3163
|
+
L: 87,
|
|
3163
3164
|
S: this,
|
|
3164
3165
|
C: (f, a) => f(...a)
|
|
3165
3166
|
});
|
|
@@ -3168,7 +3169,7 @@ var AutomergeHost = class {
|
|
|
3168
3169
|
const deviceKey = PublicKey8.from(deviceKeyHex);
|
|
3169
3170
|
const isAuthorized = authorizedDevices?.has(deviceKey) ?? false;
|
|
3170
3171
|
log15("share policy check", {
|
|
3171
|
-
localPeer:
|
|
3172
|
+
localPeer: this._peerId,
|
|
3172
3173
|
remotePeer: peerId,
|
|
3173
3174
|
documentId,
|
|
3174
3175
|
deviceKey,
|
|
@@ -3176,7 +3177,7 @@ var AutomergeHost = class {
|
|
|
3176
3177
|
isAuthorized
|
|
3177
3178
|
}, {
|
|
3178
3179
|
F: __dxlog_file16,
|
|
3179
|
-
L:
|
|
3180
|
+
L: 93,
|
|
3180
3181
|
S: this,
|
|
3181
3182
|
C: (f, a) => f(...a)
|
|
3182
3183
|
});
|
|
@@ -3184,7 +3185,7 @@ var AutomergeHost = class {
|
|
|
3184
3185
|
} catch (err) {
|
|
3185
3186
|
log15.catch(err, void 0, {
|
|
3186
3187
|
F: __dxlog_file16,
|
|
3187
|
-
L:
|
|
3188
|
+
L: 103,
|
|
3188
3189
|
S: this,
|
|
3189
3190
|
C: (f, a) => f(...a)
|
|
3190
3191
|
});
|
|
@@ -3202,7 +3203,22 @@ var AutomergeHost = class {
|
|
|
3202
3203
|
return mapValues(this._repo.handles, (handle) => ({
|
|
3203
3204
|
state: handle.state,
|
|
3204
3205
|
hasDoc: !!handle.docSync(),
|
|
3205
|
-
heads: handle.docSync() ? automerge.getHeads(handle.docSync()) : null
|
|
3206
|
+
heads: handle.docSync() ? automerge.getHeads(handle.docSync()) : null,
|
|
3207
|
+
data: handle.docSync()?.doc && mapValues(handle.docSync()?.doc, (value, key) => {
|
|
3208
|
+
try {
|
|
3209
|
+
switch (key) {
|
|
3210
|
+
case "access":
|
|
3211
|
+
case "links":
|
|
3212
|
+
return value;
|
|
3213
|
+
case "objects":
|
|
3214
|
+
return Object.keys(value);
|
|
3215
|
+
default:
|
|
3216
|
+
return `${value}`;
|
|
3217
|
+
}
|
|
3218
|
+
} catch (err) {
|
|
3219
|
+
return `${err}`;
|
|
3220
|
+
}
|
|
3221
|
+
})
|
|
3206
3222
|
}));
|
|
3207
3223
|
}
|
|
3208
3224
|
_automergePeers() {
|
|
@@ -3236,13 +3252,16 @@ var AutomergeHost = class {
|
|
|
3236
3252
|
deviceKey
|
|
3237
3253
|
}, {
|
|
3238
3254
|
F: __dxlog_file16,
|
|
3239
|
-
L:
|
|
3255
|
+
L: 177,
|
|
3240
3256
|
S: this,
|
|
3241
3257
|
C: (f, a) => f(...a)
|
|
3242
3258
|
});
|
|
3243
3259
|
defaultMap(this._authorizedDevices, spaceKey, () => new ComplexSet(PublicKey8.hash)).add(deviceKey);
|
|
3244
3260
|
}
|
|
3245
3261
|
};
|
|
3262
|
+
_ts_decorate9([
|
|
3263
|
+
trace6.info()
|
|
3264
|
+
], AutomergeHost.prototype, "_peerId", void 0);
|
|
3246
3265
|
_ts_decorate9([
|
|
3247
3266
|
trace6.info({
|
|
3248
3267
|
depth: null
|
|
@@ -3287,4 +3306,4 @@ export {
|
|
|
3287
3306
|
MeshNetworkAdapter,
|
|
3288
3307
|
AutomergeHost
|
|
3289
3308
|
};
|
|
3290
|
-
//# sourceMappingURL=chunk-
|
|
3309
|
+
//# sourceMappingURL=chunk-2AAHNMOH.mjs.map
|