@dabble/patches 0.7.23 → 0.7.24
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/{BaseDoc-CD5wZQMm.d.ts → BaseDoc-BT18xPxU.d.ts} +1 -1
- package/dist/algorithms/ot/server/createVersion.d.ts +1 -1
- package/dist/algorithms/ot/shared/changeBatching.js +3 -3
- package/dist/client/BaseDoc.d.ts +1 -1
- package/dist/client/ClientAlgorithm.d.ts +1 -1
- package/dist/client/LWWAlgorithm.d.ts +1 -1
- package/dist/client/LWWDoc.d.ts +1 -1
- package/dist/client/OTAlgorithm.d.ts +1 -1
- package/dist/client/OTDoc.d.ts +1 -1
- package/dist/client/Patches.d.ts +1 -1
- package/dist/client/Patches.js +1 -0
- package/dist/client/PatchesDoc.d.ts +1 -1
- package/dist/client/factories.d.ts +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/compression/lz.js +3 -4
- package/dist/index.d.ts +1 -1
- package/dist/json-patch/invertPatch.js +2 -1
- package/dist/net/PatchesSync.d.ts +1 -1
- package/dist/net/index.d.ts +1 -1
- package/dist/server/PatchesHistoryManager.js +2 -2
- package/dist/server/branchUtils.js +1 -1
- package/dist/shared/doc-manager.d.ts +1 -1
- package/dist/solid/context.d.ts +1 -1
- package/dist/solid/doc-manager.d.ts +1 -1
- package/dist/solid/index.d.ts +1 -1
- package/dist/solid/primitives.d.ts +1 -1
- package/dist/vue/composables.d.ts +1 -1
- package/dist/vue/doc-manager.d.ts +1 -1
- package/dist/vue/index.d.ts +1 -1
- package/dist/vue/managed-docs.d.ts +2 -2
- package/dist/vue/provider.d.ts +1 -1
- package/package.json +13 -12
|
@@ -237,4 +237,4 @@ declare abstract class BaseDoc<T extends object = object> extends ReadonlyStoreC
|
|
|
237
237
|
abstract import(snapshot: PatchesSnapshot<T>): void;
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
-
export { BaseDoc as B, OTDoc as O, type
|
|
240
|
+
export { BaseDoc as B, OTDoc as O, type PatchesDoc as P, type PatchesDocOptions as a };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OTStoreBackend } from '../../../server/types.js';
|
|
2
|
-
import { EditableVersionMetadata,
|
|
2
|
+
import { EditableVersionMetadata, Change, VersionMetadata } from '../../../types.js';
|
|
3
3
|
import '../../../json-patch/types.js';
|
|
4
4
|
import '../../../json-patch/JSONPatch.js';
|
|
5
5
|
import '@dabble/delta';
|
|
@@ -7,7 +7,7 @@ function getJSONByteSize(data) {
|
|
|
7
7
|
return stringified ? new TextEncoder().encode(stringified).length : 0;
|
|
8
8
|
} catch (e) {
|
|
9
9
|
console.error("Error calculating JSON size:", e);
|
|
10
|
-
throw new Error("Error calculating JSON size
|
|
10
|
+
throw new Error("Error calculating JSON size", { cause: e });
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
function breakChanges(changes, maxBytes, sizeCalculator) {
|
|
@@ -262,14 +262,14 @@ function breakLargeValueOp(origChange, op, maxBytes, startRev, sizeCalculator) {
|
|
|
262
262
|
chunkOp.path = op.path;
|
|
263
263
|
chunkOp.appendArray = currentChunk;
|
|
264
264
|
}
|
|
265
|
-
results.push(deriveNewChange(origChange, rev
|
|
265
|
+
results.push(deriveNewChange(origChange, rev, [chunkOp]));
|
|
266
266
|
}
|
|
267
267
|
return results;
|
|
268
268
|
}
|
|
269
269
|
console.warn(
|
|
270
270
|
`Warning: Single operation of type ${op.op} (path: ${op.path}) could not be split further by breakLargeValueOp despite exceeding maxBytes. Including as is.`
|
|
271
271
|
);
|
|
272
|
-
return [deriveNewChange(origChange, rev
|
|
272
|
+
return [deriveNewChange(origChange, rev, [op])];
|
|
273
273
|
}
|
|
274
274
|
function deriveNewChange(origChange, rev, ops) {
|
|
275
275
|
const { id: _id, ops: _o, rev: _r, baseRev: _br, created: _c, batchId: _bi, ...metadata } = origChange;
|
package/dist/client/BaseDoc.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JSONPatchOp } from '../json-patch/types.js';
|
|
2
2
|
import { PatchesSnapshot, Change } from '../types.js';
|
|
3
|
-
import {
|
|
3
|
+
import { P as PatchesDoc } from '../BaseDoc-BT18xPxU.js';
|
|
4
4
|
import { PatchesStore, TrackedDoc } from './PatchesStore.js';
|
|
5
5
|
import '../json-patch/JSONPatch.js';
|
|
6
6
|
import '@dabble/delta';
|
|
@@ -2,7 +2,7 @@ import { JSONPatchOp } from '../json-patch/types.js';
|
|
|
2
2
|
import { PatchesSnapshot, Change } from '../types.js';
|
|
3
3
|
import { ClientAlgorithm } from './ClientAlgorithm.js';
|
|
4
4
|
import { LWWClientStore } from './LWWClientStore.js';
|
|
5
|
-
import {
|
|
5
|
+
import { P as PatchesDoc } from '../BaseDoc-BT18xPxU.js';
|
|
6
6
|
import { TrackedDoc } from './PatchesStore.js';
|
|
7
7
|
import '../json-patch/JSONPatch.js';
|
|
8
8
|
import '@dabble/delta';
|
package/dist/client/LWWDoc.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { JSONPatchOp } from '../json-patch/types.js';
|
|
|
2
2
|
import { PatchesSnapshot, Change } from '../types.js';
|
|
3
3
|
import { ClientAlgorithm } from './ClientAlgorithm.js';
|
|
4
4
|
import { OTClientStore } from './OTClientStore.js';
|
|
5
|
-
import {
|
|
5
|
+
import { a as PatchesDocOptions, P as PatchesDoc } from '../BaseDoc-BT18xPxU.js';
|
|
6
6
|
import { TrackedDoc } from './PatchesStore.js';
|
|
7
7
|
import '../json-patch/JSONPatch.js';
|
|
8
8
|
import '@dabble/delta';
|
package/dist/client/OTDoc.d.ts
CHANGED
package/dist/client/Patches.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Unsubscriber } from 'easy-signal';
|
|
|
3
3
|
import { JSONPatchOp } from '../json-patch/types.js';
|
|
4
4
|
import { Change } from '../types.js';
|
|
5
5
|
import { ClientAlgorithm } from './ClientAlgorithm.js';
|
|
6
|
-
import {
|
|
6
|
+
import { a as PatchesDocOptions, P as PatchesDoc } from '../BaseDoc-BT18xPxU.js';
|
|
7
7
|
import { AlgorithmName } from './PatchesStore.js';
|
|
8
8
|
import '../json-patch/JSONPatch.js';
|
|
9
9
|
import '@dabble/delta';
|
package/dist/client/Patches.js
CHANGED
|
@@ -208,6 +208,7 @@ class Patches {
|
|
|
208
208
|
const current = prev.then(() => this._processDocChange(docId, ops, doc, algorithm, metadata));
|
|
209
209
|
this._changeQueues.set(
|
|
210
210
|
docId,
|
|
211
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
211
212
|
current.catch(() => {
|
|
212
213
|
})
|
|
213
214
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'easy-signal';
|
|
2
2
|
import '../json-patch/types.js';
|
|
3
3
|
import '../types.js';
|
|
4
|
-
export { O as OTDoc,
|
|
4
|
+
export { O as OTDoc, P as PatchesDoc, O as PatchesDocClass, a as PatchesDocOptions } from '../BaseDoc-BT18xPxU.js';
|
|
5
5
|
import '../json-patch/JSONPatch.js';
|
|
6
6
|
import '@dabble/delta';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AlgorithmName } from './PatchesStore.js';
|
|
2
2
|
import { Patches } from './Patches.js';
|
|
3
|
-
import {
|
|
3
|
+
import { a as PatchesDocOptions } from '../BaseDoc-BT18xPxU.js';
|
|
4
4
|
import '../types.js';
|
|
5
5
|
import '../json-patch/JSONPatch.js';
|
|
6
6
|
import '@dabble/delta';
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { B as BaseDoc, O as OTDoc,
|
|
1
|
+
export { B as BaseDoc, O as OTDoc, P as PatchesDoc, O as PatchesDocClass, a as PatchesDocOptions } from '../BaseDoc-BT18xPxU.js';
|
|
2
2
|
export { IndexedDBFactoryOptions, MultiAlgorithmFactoryOptions, MultiAlgorithmIndexedDBFactoryOptions, PatchesFactoryOptions, createLWWIndexedDBPatches, createLWWPatches, createMultiAlgorithmIndexedDBPatches, createMultiAlgorithmPatches, createOTIndexedDBPatches, createOTPatches } from './factories.js';
|
|
3
3
|
export { IDBStoreWrapper, IDBTransactionWrapper, IndexedDBStore } from './IndexedDBStore.js';
|
|
4
4
|
export { OTIndexedDBStore } from './OTIndexedDBStore.js';
|
package/dist/compression/lz.js
CHANGED
|
@@ -93,8 +93,8 @@ function _compress(uncompressed, bitsPerChar, getCharFromInt) {
|
|
|
93
93
|
let value;
|
|
94
94
|
const context_dictionary = {};
|
|
95
95
|
const context_dictionaryToCreate = {};
|
|
96
|
-
let context_c
|
|
97
|
-
let context_wc
|
|
96
|
+
let context_c;
|
|
97
|
+
let context_wc;
|
|
98
98
|
let context_w = "";
|
|
99
99
|
let context_enlargeIn = 2;
|
|
100
100
|
let context_dictSize = 3;
|
|
@@ -264,7 +264,6 @@ function _compress(uncompressed, bitsPerChar, getCharFromInt) {
|
|
|
264
264
|
}
|
|
265
265
|
context_enlargeIn--;
|
|
266
266
|
if (context_enlargeIn === 0) {
|
|
267
|
-
context_enlargeIn = Math.pow(2, context_numBits);
|
|
268
267
|
context_numBits++;
|
|
269
268
|
}
|
|
270
269
|
}
|
|
@@ -294,7 +293,7 @@ function _decompress(length, resetValue, getNextValue) {
|
|
|
294
293
|
let enlargeIn = 4;
|
|
295
294
|
let dictSize = 4;
|
|
296
295
|
let numBits = 3;
|
|
297
|
-
let entry
|
|
296
|
+
let entry;
|
|
298
297
|
const result = [];
|
|
299
298
|
let w;
|
|
300
299
|
let bits;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { Delta } from '@dabble/delta';
|
|
2
|
-
export { B as BaseDoc, O as OTDoc,
|
|
2
|
+
export { B as BaseDoc, O as OTDoc, P as PatchesDoc, O as PatchesDocClass, a as PatchesDocOptions } from './BaseDoc-BT18xPxU.js';
|
|
3
3
|
export { IndexedDBFactoryOptions, MultiAlgorithmFactoryOptions, MultiAlgorithmIndexedDBFactoryOptions, PatchesFactoryOptions, createLWWIndexedDBPatches, createLWWPatches, createMultiAlgorithmIndexedDBPatches, createMultiAlgorithmPatches, createOTIndexedDBPatches, createOTPatches } from './client/factories.js';
|
|
4
4
|
export { IDBStoreWrapper, IDBTransactionWrapper, IndexedDBStore } from './client/IndexedDBStore.js';
|
|
5
5
|
export { OTIndexedDBStore } from './client/OTIndexedDBStore.js';
|
|
@@ -18,7 +18,8 @@ function invertPatch(object, ops, custom = {}) {
|
|
|
18
18
|
isIndex = prop >= 0;
|
|
19
19
|
} catch (err) {
|
|
20
20
|
throw new Error(
|
|
21
|
-
`Patch mismatch. This patch was not applied to the provided object and cannot be inverted. ${err.message || err}
|
|
21
|
+
`Patch mismatch. This patch was not applied to the provided object and cannot be inverted. ${err.message || err}`,
|
|
22
|
+
{ cause: err }
|
|
22
23
|
);
|
|
23
24
|
}
|
|
24
25
|
const handler = getType(state, op)?.invert;
|
package/dist/net/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ import 'easy-signal';
|
|
|
17
17
|
import '../algorithms/ot/shared/changeBatching.js';
|
|
18
18
|
import '../client/ClientAlgorithm.js';
|
|
19
19
|
import '../json-patch/types.js';
|
|
20
|
-
import '../BaseDoc-
|
|
20
|
+
import '../BaseDoc-BT18xPxU.js';
|
|
21
21
|
import '../client/PatchesStore.js';
|
|
22
22
|
import '../client/Patches.js';
|
|
23
23
|
import '../server/types.js';
|
|
@@ -65,7 +65,7 @@ class PatchesHistoryManager {
|
|
|
65
65
|
return typeof rawState === "string" ? jsonReadable(rawState) : rawState;
|
|
66
66
|
} catch (error) {
|
|
67
67
|
console.error(`Failed to load state for version ${versionId} of doc ${docId}.`, error);
|
|
68
|
-
throw new Error(`Could not load state for version ${versionId}
|
|
68
|
+
throw new Error(`Could not load state for version ${versionId}.`, { cause: error });
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
@@ -108,7 +108,7 @@ class PatchesHistoryManager {
|
|
|
108
108
|
return await this.store.loadVersionChanges?.(docId, versionId) ?? [];
|
|
109
109
|
} catch (error) {
|
|
110
110
|
console.error(`Failed to load changes for version ${versionId} of doc ${docId}.`, error);
|
|
111
|
-
throw new Error(`Could not load changes for version ${versionId}
|
|
111
|
+
throw new Error(`Could not load changes for version ${versionId}.`, { cause: error });
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
// ---------------------------------------------------------------------------
|
|
@@ -48,7 +48,7 @@ async function wrapMergeCommit(branchId, sourceDocId, commitFn) {
|
|
|
48
48
|
return await commitFn();
|
|
49
49
|
} catch (error) {
|
|
50
50
|
console.error(`Failed to merge branch ${branchId} into ${sourceDocId}:`, error);
|
|
51
|
-
throw new Error(`Merge failed: ${error instanceof Error ? error.message : String(error)}
|
|
51
|
+
throw new Error(`Merge failed: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
async function closeBranch(store, branchId, status) {
|
package/dist/solid/context.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import '../types.js';
|
|
|
7
7
|
import '../json-patch/JSONPatch.js';
|
|
8
8
|
import '@dabble/delta';
|
|
9
9
|
import '../client/ClientAlgorithm.js';
|
|
10
|
-
import '../BaseDoc-
|
|
10
|
+
import '../BaseDoc-BT18xPxU.js';
|
|
11
11
|
import '../client/PatchesStore.js';
|
|
12
12
|
import '../net/protocol/types.js';
|
|
13
13
|
import '../net/protocol/JSONRPCClient.js';
|
package/dist/solid/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import '../types.js';
|
|
|
11
11
|
import '../json-patch/JSONPatch.js';
|
|
12
12
|
import '@dabble/delta';
|
|
13
13
|
import '../client/ClientAlgorithm.js';
|
|
14
|
-
import '../BaseDoc-
|
|
14
|
+
import '../BaseDoc-BT18xPxU.js';
|
|
15
15
|
import '../client/PatchesStore.js';
|
|
16
16
|
import '../net/PatchesSync.js';
|
|
17
17
|
import '../net/protocol/types.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Accessor } from 'solid-js';
|
|
2
2
|
import { OpenDocOptions } from '../client/Patches.js';
|
|
3
|
-
import {
|
|
3
|
+
import { P as PatchesDoc } from '../BaseDoc-BT18xPxU.js';
|
|
4
4
|
import { JSONPatch } from '../json-patch/JSONPatch.js';
|
|
5
5
|
import { ChangeMutator } from '../types.js';
|
|
6
6
|
import 'easy-signal';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ShallowRef, Ref, MaybeRef } from 'vue';
|
|
2
2
|
import { OpenDocOptions } from '../client/Patches.js';
|
|
3
|
-
import {
|
|
3
|
+
import { P as PatchesDoc } from '../BaseDoc-BT18xPxU.js';
|
|
4
4
|
import { JSONPatch } from '../json-patch/JSONPatch.js';
|
|
5
5
|
import { ChangeMutator } from '../types.js';
|
|
6
6
|
import 'easy-signal';
|
package/dist/vue/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import '../types.js';
|
|
|
11
11
|
import '../json-patch/JSONPatch.js';
|
|
12
12
|
import '@dabble/delta';
|
|
13
13
|
import '../client/ClientAlgorithm.js';
|
|
14
|
-
import '../BaseDoc-
|
|
14
|
+
import '../BaseDoc-BT18xPxU.js';
|
|
15
15
|
import '../client/PatchesStore.js';
|
|
16
16
|
import '../net/PatchesSync.js';
|
|
17
17
|
import '../net/protocol/types.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ShallowRef, Ref } from 'vue';
|
|
2
2
|
import { OpenDocOptions } from '../client/Patches.js';
|
|
3
3
|
import 'easy-signal';
|
|
4
4
|
import '../json-patch/types.js';
|
|
@@ -6,7 +6,7 @@ import '../types.js';
|
|
|
6
6
|
import '../json-patch/JSONPatch.js';
|
|
7
7
|
import '@dabble/delta';
|
|
8
8
|
import '../client/ClientAlgorithm.js';
|
|
9
|
-
import '../BaseDoc-
|
|
9
|
+
import '../BaseDoc-BT18xPxU.js';
|
|
10
10
|
import '../client/PatchesStore.js';
|
|
11
11
|
|
|
12
12
|
/**
|
package/dist/vue/provider.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import '../types.js';
|
|
|
7
7
|
import '../json-patch/JSONPatch.js';
|
|
8
8
|
import '@dabble/delta';
|
|
9
9
|
import '../client/ClientAlgorithm.js';
|
|
10
|
-
import '../BaseDoc-
|
|
10
|
+
import '../BaseDoc-BT18xPxU.js';
|
|
11
11
|
import '../client/PatchesStore.js';
|
|
12
12
|
import '../net/protocol/types.js';
|
|
13
13
|
import '../net/protocol/JSONRPCClient.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dabble/patches",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.24",
|
|
4
4
|
"description": "Immutable JSON Patch implementation based on RFC 6902 supporting operational transformation and last-writer-wins",
|
|
5
5
|
"author": "Jacob Wright <jacwright@gmail.com>",
|
|
6
6
|
"bugs": {
|
|
@@ -75,27 +75,28 @@
|
|
|
75
75
|
"lint:fix": "eslint src tests --fix"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@dabble/delta": "^1.2.
|
|
78
|
+
"@dabble/delta": "^1.2.5",
|
|
79
79
|
"alphacounter": "^2.1.1",
|
|
80
|
-
"crypto-id": "^0.3.
|
|
81
|
-
"easy-signal": "^5.0.
|
|
80
|
+
"crypto-id": "^0.3.2",
|
|
81
|
+
"easy-signal": "^5.0.5",
|
|
82
82
|
"simple-peer": "^9.11.1",
|
|
83
83
|
"simplified-concurrency": "^0.2.0"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
|
+
"@eslint/js": "^10.0.1",
|
|
86
87
|
"@types/simple-peer": "^9.11.9",
|
|
87
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
88
|
-
"@typescript-eslint/parser": "^8.
|
|
89
|
-
"eslint": "^
|
|
88
|
+
"@typescript-eslint/eslint-plugin": "^8.56.1",
|
|
89
|
+
"@typescript-eslint/parser": "^8.56.1",
|
|
90
|
+
"eslint": "^10.0.2",
|
|
90
91
|
"fake-indexeddb": "^6.2.5",
|
|
91
|
-
"happy-dom": "^20.
|
|
92
|
-
"prettier": "^3.
|
|
93
|
-
"solid-js": "^1.9.
|
|
92
|
+
"happy-dom": "^20.8.3",
|
|
93
|
+
"prettier": "^3.8.1",
|
|
94
|
+
"solid-js": "^1.9.11",
|
|
94
95
|
"tsup": "^8.5.1",
|
|
95
96
|
"typescript": "^5.9.3",
|
|
96
97
|
"vite-plugin-solid": "^2.11.10",
|
|
97
|
-
"vitest": "^4.0.
|
|
98
|
-
"vue": "^3.5.
|
|
98
|
+
"vitest": "^4.0.18",
|
|
99
|
+
"vue": "^3.5.29"
|
|
99
100
|
},
|
|
100
101
|
"peerDependencies": {
|
|
101
102
|
"solid-js": "^1.8.0",
|