@dabble/patches 0.4.5 → 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/algorithms/client/applyCommittedChanges.d.ts +8 -2
- package/dist/algorithms/client/applyCommittedChanges.js +30 -38
- package/dist/algorithms/client/batching.d.ts +8 -2
- package/dist/algorithms/client/batching.js +38 -37
- package/dist/algorithms/client/breakChange.d.ts +8 -2
- package/dist/algorithms/client/breakChange.js +191 -240
- package/dist/algorithms/client/createStateFromSnapshot.d.ts +8 -2
- package/dist/algorithms/client/createStateFromSnapshot.js +7 -8
- package/dist/algorithms/client/getJSONByteSize.d.ts +3 -1
- package/dist/algorithms/client/getJSONByteSize.js +12 -11
- package/dist/algorithms/client/makeChange.d.ts +8 -2
- package/dist/algorithms/client/makeChange.js +28 -36
- package/dist/algorithms/server/commitChanges.d.ts +9 -3
- package/dist/algorithms/server/commitChanges.js +69 -78
- package/dist/algorithms/server/createVersion.d.ts +9 -3
- package/dist/algorithms/server/createVersion.js +21 -27
- package/dist/algorithms/server/getSnapshotAtRevision.d.ts +9 -3
- package/dist/algorithms/server/getSnapshotAtRevision.js +27 -28
- package/dist/algorithms/server/getStateAtRevision.d.ts +9 -3
- package/dist/algorithms/server/getStateAtRevision.js +13 -17
- package/dist/algorithms/server/handleOfflineSessionsAndBatches.d.ts +9 -3
- package/dist/algorithms/server/handleOfflineSessionsAndBatches.js +60 -77
- package/dist/algorithms/server/transformIncomingChanges.d.ts +8 -2
- package/dist/algorithms/server/transformIncomingChanges.js +27 -39
- package/dist/algorithms/shared/applyChanges.d.ts +8 -2
- package/dist/algorithms/shared/applyChanges.js +11 -16
- package/dist/algorithms/shared/rebaseChanges.d.ts +8 -2
- package/dist/algorithms/shared/rebaseChanges.js +30 -49
- package/dist/chunk-IZ2YBCUP.js +56 -0
- package/dist/client/InMemoryStore.d.ts +9 -3
- package/dist/client/InMemoryStore.js +92 -101
- package/dist/client/IndexedDBStore.d.ts +9 -3
- package/dist/client/IndexedDBStore.js +378 -491
- package/dist/client/Patches.d.ts +18 -13
- package/dist/client/Patches.js +152 -207
- package/dist/client/PatchesDoc.d.ts +14 -8
- package/dist/client/PatchesDoc.js +147 -154
- package/dist/client/PatchesHistoryClient.d.ts +12 -5
- package/dist/client/PatchesHistoryClient.js +110 -117
- package/dist/client/PatchesStore.d.ts +9 -3
- package/dist/client/PatchesStore.js +0 -1
- package/dist/client/index.d.ts +12 -6
- package/dist/client/index.js +5 -5
- package/dist/data/change.d.ts +9 -3
- package/dist/data/change.js +23 -15
- package/dist/data/version.d.ts +9 -3
- package/dist/data/version.js +11 -15
- package/dist/event-signal.d.ts +7 -6
- package/dist/event-signal.js +24 -39
- package/dist/index-CvQws3AB.d.ts +36 -0
- package/dist/index.d.ts +27 -5
- package/dist/index.js +10 -4
- package/dist/json-patch/JSONPatch.d.ts +9 -5
- package/dist/json-patch/JSONPatch.js +175 -183
- package/dist/json-patch/applyPatch.d.ts +5 -2
- package/dist/json-patch/applyPatch.js +27 -35
- package/dist/json-patch/composePatch.d.ts +5 -2
- package/dist/json-patch/composePatch.js +34 -34
- package/dist/json-patch/createJSONPatch.d.ts +7 -2
- package/dist/json-patch/createJSONPatch.js +11 -38
- package/dist/json-patch/index.d.ts +14 -6
- package/dist/json-patch/index.js +20 -9
- package/dist/json-patch/invertPatch.d.ts +5 -2
- package/dist/json-patch/invertPatch.js +31 -30
- package/dist/json-patch/ops/add.d.ts +5 -2
- package/dist/json-patch/ops/add.js +53 -51
- package/dist/json-patch/ops/bitmask.d.ts +8 -5
- package/dist/json-patch/ops/bitmask.js +41 -44
- package/dist/json-patch/ops/copy.d.ts +5 -2
- package/dist/json-patch/ops/copy.js +32 -33
- package/dist/json-patch/ops/increment.d.ts +5 -2
- package/dist/json-patch/ops/increment.js +21 -20
- package/dist/json-patch/ops/index.d.ts +10 -21
- package/dist/json-patch/ops/index.js +34 -24
- package/dist/json-patch/ops/move.d.ts +5 -2
- package/dist/json-patch/ops/move.js +132 -198
- package/dist/json-patch/ops/remove.d.ts +5 -2
- package/dist/json-patch/ops/remove.js +33 -30
- package/dist/json-patch/ops/replace.d.ts +5 -2
- package/dist/json-patch/ops/replace.js +45 -43
- package/dist/json-patch/ops/test.d.ts +5 -2
- package/dist/json-patch/ops/test.js +25 -21
- package/dist/json-patch/ops/text.d.ts +5 -2
- package/dist/json-patch/ops/text.js +54 -54
- package/dist/json-patch/pathProxy.d.ts +9 -3
- package/dist/json-patch/pathProxy.js +27 -48
- package/dist/json-patch/state.d.ts +5 -2
- package/dist/json-patch/state.js +11 -7
- package/dist/json-patch/transformPatch.d.ts +6 -2
- package/dist/json-patch/transformPatch.js +21 -24
- package/dist/json-patch/types.d.ts +9 -7
- package/dist/json-patch/types.js +0 -1
- package/dist/json-patch/utils/deepEqual.d.ts +3 -1
- package/dist/json-patch/utils/deepEqual.js +32 -28
- package/dist/json-patch/utils/exit.d.ts +5 -2
- package/dist/json-patch/utils/exit.js +7 -3
- package/dist/json-patch/utils/get.d.ts +5 -2
- package/dist/json-patch/utils/get.js +8 -4
- package/dist/json-patch/utils/getOpData.d.ts +5 -2
- package/dist/json-patch/utils/getOpData.js +12 -9
- package/dist/json-patch/utils/getType.d.ts +6 -3
- package/dist/json-patch/utils/getType.js +9 -4
- package/dist/json-patch/utils/index.d.ts +15 -14
- package/dist/json-patch/utils/index.js +14 -14
- package/dist/json-patch/utils/log.d.ts +4 -2
- package/dist/json-patch/utils/log.js +8 -3
- package/dist/json-patch/utils/ops.d.ts +8 -5
- package/dist/json-patch/utils/ops.js +83 -100
- package/dist/json-patch/utils/paths.d.ts +12 -9
- package/dist/json-patch/utils/paths.js +54 -51
- package/dist/json-patch/utils/pluck.d.ts +8 -5
- package/dist/json-patch/utils/pluck.js +32 -26
- package/dist/json-patch/utils/shallowCopy.d.ts +3 -1
- package/dist/json-patch/utils/shallowCopy.js +22 -18
- package/dist/json-patch/utils/softWrites.d.ts +6 -3
- package/dist/json-patch/utils/softWrites.js +17 -16
- package/dist/json-patch/utils/toArrayIndex.d.ts +3 -1
- package/dist/json-patch/utils/toArrayIndex.js +14 -10
- package/dist/json-patch/utils/toKeys.d.ts +3 -1
- package/dist/json-patch/utils/toKeys.js +15 -11
- package/dist/json-patch/utils/updateArrayIndexes.d.ts +5 -2
- package/dist/json-patch/utils/updateArrayIndexes.js +33 -37
- package/dist/json-patch/utils/updateArrayPath.d.ts +5 -2
- package/dist/json-patch/utils/updateArrayPath.js +29 -42
- package/dist/net/PatchesClient.d.ts +128 -0
- package/dist/net/PatchesClient.js +161 -0
- package/dist/net/PatchesSync.d.ts +19 -9
- package/dist/net/PatchesSync.js +291 -386
- package/dist/net/error.d.ts +3 -1
- package/dist/net/error.js +9 -6
- package/dist/net/http/FetchTransport.d.ts +21 -0
- package/dist/net/http/FetchTransport.js +34 -0
- package/dist/net/index.d.ts +26 -12
- package/dist/net/index.js +12 -10
- package/dist/net/protocol/JSONRPCClient.d.ts +11 -4
- package/dist/net/protocol/JSONRPCClient.js +95 -103
- package/dist/net/protocol/JSONRPCServer.d.ts +15 -8
- package/dist/net/protocol/JSONRPCServer.js +101 -123
- package/dist/net/protocol/types.d.ts +21 -15
- package/dist/net/protocol/types.js +0 -1
- package/dist/net/protocol/utils.d.ts +12 -0
- package/dist/net/protocol/utils.js +15 -0
- package/dist/net/types.d.ts +4 -2
- package/dist/net/types.js +0 -1
- package/dist/net/webrtc/WebRTCAwareness.d.ts +14 -4
- package/dist/net/webrtc/WebRTCAwareness.js +111 -120
- package/dist/net/webrtc/WebRTCTransport.d.ts +16 -8
- package/dist/net/webrtc/WebRTCTransport.js +149 -157
- package/dist/net/webrtc/index.d.ts +10 -2
- package/dist/net/webrtc/index.js +2 -2
- package/dist/net/websocket/AuthorizationProvider.d.ts +7 -5
- package/dist/net/websocket/AuthorizationProvider.js +12 -17
- package/dist/net/websocket/PatchesWebSocket.d.ts +14 -109
- package/dist/net/websocket/PatchesWebSocket.js +37 -184
- package/dist/net/websocket/RPCServer.d.ts +19 -10
- package/dist/net/websocket/RPCServer.js +190 -192
- package/dist/net/websocket/SignalingService.d.ts +12 -32
- package/dist/net/websocket/SignalingService.js +126 -133
- package/dist/net/websocket/WebSocketServer.d.ts +17 -4
- package/dist/net/websocket/WebSocketServer.js +64 -72
- package/dist/net/websocket/WebSocketTransport.d.ts +13 -5
- package/dist/net/websocket/WebSocketTransport.js +178 -207
- package/dist/net/websocket/onlineState.d.ts +6 -3
- package/dist/net/websocket/onlineState.js +25 -21
- package/dist/server/PatchesBranchManager.d.ts +12 -5
- package/dist/server/PatchesBranchManager.js +132 -142
- package/dist/server/PatchesHistoryManager.d.ts +11 -3
- package/dist/server/PatchesHistoryManager.js +81 -84
- package/dist/server/PatchesServer.d.ts +16 -10
- package/dist/server/PatchesServer.js +131 -137
- package/dist/server/index.d.ts +7 -2
- package/dist/server/index.js +9 -3
- package/dist/server/types.d.ts +9 -3
- package/dist/server/types.js +0 -1
- package/dist/types.d.ts +38 -19
- package/dist/types.js +1 -1
- package/dist/utils/concurrency.d.ts +7 -5
- package/dist/utils/concurrency.js +43 -53
- package/dist/utils/deferred.d.ts +4 -2
- package/dist/utils/deferred.js +25 -21
- package/package.json +5 -7
package/dist/data/change.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { JSONPatchOp } from '../json-patch/types.js';
|
|
2
|
+
import { ChangeInput, Change } from '../types.js';
|
|
3
|
+
import '../json-patch/JSONPatch.js';
|
|
4
|
+
import '@dabble/delta';
|
|
5
|
+
|
|
6
|
+
declare function createChange(ops: JSONPatchOp[], metadata?: Record<string, any>): ChangeInput;
|
|
7
|
+
declare function createChange(baseRev: number, rev: number, ops: JSONPatchOp[], metadata?: Record<string, any>): Change;
|
|
8
|
+
|
|
9
|
+
export { createChange };
|
package/dist/data/change.js
CHANGED
|
@@ -1,20 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
* Create a change id for a given revision. Uses a random 4 character id, prefixed with a revision number string.
|
|
5
|
-
* @param rev - The revision number.
|
|
6
|
-
* @returns The change id.
|
|
7
|
-
*/
|
|
1
|
+
import "../chunk-IZ2YBCUP.js";
|
|
2
|
+
import { inc } from "alphacounter";
|
|
3
|
+
import { createId } from "crypto-id";
|
|
8
4
|
function createChangeId(rev) {
|
|
9
|
-
|
|
5
|
+
return inc.from(rev) + createId(4);
|
|
10
6
|
}
|
|
11
|
-
|
|
7
|
+
function createChange(baseRev, rev, ops, metadata) {
|
|
8
|
+
if (typeof baseRev !== "number" && typeof rev !== "number") {
|
|
12
9
|
return {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
created: Date.now(),
|
|
18
|
-
...metadata,
|
|
10
|
+
id: createId(8),
|
|
11
|
+
ops: baseRev,
|
|
12
|
+
created: Date.now(),
|
|
13
|
+
...rev
|
|
19
14
|
};
|
|
15
|
+
} else {
|
|
16
|
+
return {
|
|
17
|
+
id: createChangeId(rev),
|
|
18
|
+
baseRev,
|
|
19
|
+
rev,
|
|
20
|
+
ops,
|
|
21
|
+
created: Date.now(),
|
|
22
|
+
...metadata
|
|
23
|
+
};
|
|
24
|
+
}
|
|
20
25
|
}
|
|
26
|
+
export {
|
|
27
|
+
createChange
|
|
28
|
+
};
|
package/dist/data/version.d.ts
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { VersionMetadata } from '../types.js';
|
|
2
|
+
import '../json-patch/JSONPatch.js';
|
|
3
|
+
import '@dabble/delta';
|
|
4
|
+
import '../json-patch/types.js';
|
|
5
|
+
|
|
2
6
|
/**
|
|
3
7
|
* Create a version id for a given document. Uses a sortable 16 character id.
|
|
4
8
|
* @returns The version id.
|
|
5
9
|
*/
|
|
6
|
-
|
|
10
|
+
declare function createVersionId(): string;
|
|
7
11
|
/**
|
|
8
12
|
* Create a version.
|
|
9
13
|
* @param data - The version data.
|
|
10
14
|
* @returns The version.
|
|
11
15
|
*/
|
|
12
|
-
|
|
16
|
+
declare function createVersionMetadata(data: Omit<VersionMetadata, 'id'>): VersionMetadata;
|
|
17
|
+
|
|
18
|
+
export { createVersionId, createVersionMetadata };
|
package/dist/data/version.js
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*/
|
|
6
|
-
export function createVersionId() {
|
|
7
|
-
return createSortableId();
|
|
1
|
+
import "../chunk-IZ2YBCUP.js";
|
|
2
|
+
import { createSortableId } from "crypto-id";
|
|
3
|
+
function createVersionId() {
|
|
4
|
+
return createSortableId();
|
|
8
5
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
* @returns The version.
|
|
13
|
-
*/
|
|
14
|
-
export function createVersionMetadata(data) {
|
|
15
|
-
data.id = createVersionId();
|
|
16
|
-
return data;
|
|
6
|
+
function createVersionMetadata(data) {
|
|
7
|
+
data.id = createVersionId();
|
|
8
|
+
return data;
|
|
17
9
|
}
|
|
10
|
+
export {
|
|
11
|
+
createVersionId,
|
|
12
|
+
createVersionMetadata
|
|
13
|
+
};
|
package/dist/event-signal.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
type SignalSubscriber = (...args: any[]) => any;
|
|
2
|
+
type ErrorSubscriber = (error: Error) => any;
|
|
3
|
+
type Unsubscriber = () => void;
|
|
4
4
|
type Args<T> = T extends (...args: infer A) => any ? A : never;
|
|
5
|
-
|
|
5
|
+
type Signal<T extends SignalSubscriber = SignalSubscriber> = {
|
|
6
6
|
(subscriber: T): Unsubscriber;
|
|
7
7
|
error: (errorListener: ErrorSubscriber) => Unsubscriber;
|
|
8
8
|
emit: (...args: Args<T>) => Promise<void>;
|
|
@@ -27,5 +27,6 @@ export type Signal<T extends SignalSubscriber = SignalSubscriber> = {
|
|
|
27
27
|
* // Clear all subscribers
|
|
28
28
|
* onLoad.clear();
|
|
29
29
|
*/
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
declare function signal<T extends SignalSubscriber = SignalSubscriber>(): Signal<T>;
|
|
31
|
+
|
|
32
|
+
export { type ErrorSubscriber, type Signal, type SignalSubscriber, type Unsubscriber, signal };
|
package/dist/event-signal.js
CHANGED
|
@@ -1,40 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const errorListeners = new Set();
|
|
23
|
-
function signal(subscriber) {
|
|
24
|
-
subscribers.add(subscriber);
|
|
25
|
-
return () => subscribers.delete(subscriber);
|
|
26
|
-
}
|
|
27
|
-
signal.emit = async (...args) => {
|
|
28
|
-
const listeners = args[0] instanceof Error ? errorListeners : subscribers;
|
|
29
|
-
await Promise.all(Array.from(listeners).map(listener => listener(...args)));
|
|
30
|
-
};
|
|
31
|
-
signal.error = (errorListener) => {
|
|
32
|
-
errorListeners.add(errorListener);
|
|
33
|
-
return () => errorListeners.delete(errorListener);
|
|
34
|
-
};
|
|
35
|
-
signal.clear = () => {
|
|
36
|
-
subscribers.clear();
|
|
37
|
-
errorListeners.clear();
|
|
38
|
-
};
|
|
39
|
-
return signal;
|
|
1
|
+
import "./chunk-IZ2YBCUP.js";
|
|
2
|
+
function signal() {
|
|
3
|
+
const subscribers = /* @__PURE__ */ new Set();
|
|
4
|
+
const errorListeners = /* @__PURE__ */ new Set();
|
|
5
|
+
function signal2(subscriber) {
|
|
6
|
+
subscribers.add(subscriber);
|
|
7
|
+
return () => subscribers.delete(subscriber);
|
|
8
|
+
}
|
|
9
|
+
signal2.emit = async (...args) => {
|
|
10
|
+
const listeners = args[0] instanceof Error ? errorListeners : subscribers;
|
|
11
|
+
await Promise.all(Array.from(listeners).map((listener) => listener(...args)));
|
|
12
|
+
};
|
|
13
|
+
signal2.error = (errorListener) => {
|
|
14
|
+
errorListeners.add(errorListener);
|
|
15
|
+
return () => errorListeners.delete(errorListener);
|
|
16
|
+
};
|
|
17
|
+
signal2.clear = () => {
|
|
18
|
+
subscribers.clear();
|
|
19
|
+
errorListeners.clear();
|
|
20
|
+
};
|
|
21
|
+
return signal2;
|
|
40
22
|
}
|
|
23
|
+
export {
|
|
24
|
+
signal
|
|
25
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { JSONPatchOpHandlerMap, JSONPatchOpHandler } from './json-patch/types.js';
|
|
2
|
+
import { add } from './json-patch/ops/add.js';
|
|
3
|
+
import { bit } from './json-patch/ops/bitmask.js';
|
|
4
|
+
import { copy } from './json-patch/ops/copy.js';
|
|
5
|
+
import { increment } from './json-patch/ops/increment.js';
|
|
6
|
+
import { move } from './json-patch/ops/move.js';
|
|
7
|
+
import { remove } from './json-patch/ops/remove.js';
|
|
8
|
+
import { replace } from './json-patch/ops/replace.js';
|
|
9
|
+
import { test } from './json-patch/ops/test.js';
|
|
10
|
+
|
|
11
|
+
declare function getTypes(custom?: JSONPatchOpHandlerMap): {
|
|
12
|
+
test: JSONPatchOpHandler;
|
|
13
|
+
add: JSONPatchOpHandler;
|
|
14
|
+
remove: JSONPatchOpHandler;
|
|
15
|
+
replace: JSONPatchOpHandler;
|
|
16
|
+
copy: JSONPatchOpHandler;
|
|
17
|
+
move: JSONPatchOpHandler;
|
|
18
|
+
'@inc': JSONPatchOpHandler;
|
|
19
|
+
'@bit': JSONPatchOpHandler;
|
|
20
|
+
'@txt': JSONPatchOpHandler;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
declare const index_add: typeof add;
|
|
24
|
+
declare const index_bit: typeof bit;
|
|
25
|
+
declare const index_copy: typeof copy;
|
|
26
|
+
declare const index_getTypes: typeof getTypes;
|
|
27
|
+
declare const index_increment: typeof increment;
|
|
28
|
+
declare const index_move: typeof move;
|
|
29
|
+
declare const index_remove: typeof remove;
|
|
30
|
+
declare const index_replace: typeof replace;
|
|
31
|
+
declare const index_test: typeof test;
|
|
32
|
+
declare namespace index {
|
|
33
|
+
export { index_add as add, index_bit as bit, index_copy as copy, index_getTypes as getTypes, index_increment as increment, index_move as move, index_remove as remove, index_replace as replace, index_test as test };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { getTypes as g, index as i };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
export { Delta } from '@dabble/delta';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
2
|
+
export { IndexedDBStore } from './client/IndexedDBStore.js';
|
|
3
|
+
export { InMemoryStore } from './client/InMemoryStore.js';
|
|
4
|
+
export { Patches, PatchesOptions } from './client/Patches.js';
|
|
5
|
+
export { PatchesDoc, PatchesDocOptions } from './client/PatchesDoc.js';
|
|
6
|
+
export { PatchesHistoryClient } from './client/PatchesHistoryClient.js';
|
|
7
|
+
export { PatchesStore, TrackedDoc } from './client/PatchesStore.js';
|
|
8
|
+
export { createChange } from './data/change.js';
|
|
9
|
+
export { createVersionId, createVersionMetadata } from './data/version.js';
|
|
10
|
+
export { ErrorSubscriber, Signal, SignalSubscriber, Unsubscriber, signal } from './event-signal.js';
|
|
11
|
+
export { applyPatch } from './json-patch/applyPatch.js';
|
|
12
|
+
export { composePatch } from './json-patch/composePatch.js';
|
|
13
|
+
export { invertPatch } from './json-patch/invertPatch.js';
|
|
14
|
+
export { applyBitmask, bit, bitmask, combineBitmasks } from './json-patch/ops/bitmask.js';
|
|
15
|
+
export { i as defaultOps, g as getTypes } from './index-CvQws3AB.js';
|
|
16
|
+
export { createPathProxy, pathProxy } from './json-patch/pathProxy.js';
|
|
17
|
+
export { transformPatch } from './json-patch/transformPatch.js';
|
|
18
|
+
export { JSONPatch, PathLike, WriteOptions } from './json-patch/JSONPatch.js';
|
|
19
|
+
export { ApplyJSONPatchOptions, JSONPatchOpHandlerMap as JSONPatchCustomTypes, JSONPatchOp } from './json-patch/types.js';
|
|
20
|
+
export { Branch, BranchStatus, Change, ChangeInput, ChangeMutator, EditableBranchMetadata, EditableVersionMetadata, ListChangesOptions, ListVersionsOptions, PatchesSnapshot, PatchesState, PathProxy, SyncingState, VersionMetadata } from './types.js';
|
|
21
|
+
export { add } from './json-patch/ops/add.js';
|
|
22
|
+
export { copy } from './json-patch/ops/copy.js';
|
|
23
|
+
export { increment } from './json-patch/ops/increment.js';
|
|
24
|
+
export { move } from './json-patch/ops/move.js';
|
|
25
|
+
export { remove } from './json-patch/ops/remove.js';
|
|
26
|
+
export { replace } from './json-patch/ops/replace.js';
|
|
27
|
+
export { test } from './json-patch/ops/test.js';
|
|
28
|
+
import './net/protocol/types.js';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
1
|
+
import "./chunk-IZ2YBCUP.js";
|
|
2
|
+
import { Delta } from "@dabble/delta";
|
|
3
|
+
export * from "./client/index.js";
|
|
4
|
+
export * from "./data/change.js";
|
|
5
|
+
export * from "./data/version.js";
|
|
6
|
+
export * from "./event-signal.js";
|
|
7
|
+
export * from "./json-patch/index.js";
|
|
8
|
+
export {
|
|
9
|
+
Delta
|
|
10
|
+
};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { Delta } from '@dabble/delta';
|
|
2
|
+
import { JSONPatchOp, JSONPatchOpHandlerMap, ApplyJSONPatchOptions } from './types.js';
|
|
3
|
+
|
|
1
4
|
/*!
|
|
2
5
|
* Based on work from
|
|
3
6
|
* https://github.com/mohayonao/json-touch-patch
|
|
@@ -10,19 +13,18 @@
|
|
|
10
13
|
* WARNING: using /array/- syntax to indicate the end of the array makes it impossible to transform arrays correctly in
|
|
11
14
|
* all situaions. Please avoid using this syntax when using Operational Transformations.
|
|
12
15
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export type PathLike = string | {
|
|
16
|
+
|
|
17
|
+
type PathLike = string | {
|
|
16
18
|
toString(): string;
|
|
17
19
|
};
|
|
18
|
-
|
|
20
|
+
interface WriteOptions {
|
|
19
21
|
soft?: boolean;
|
|
20
22
|
}
|
|
21
23
|
/**
|
|
22
24
|
* A JSONPatch helps with creating and applying one or more "JSON patches". It can track one or more changes
|
|
23
25
|
* together which may form a single operation or transaction.
|
|
24
26
|
*/
|
|
25
|
-
|
|
27
|
+
declare class JSONPatch {
|
|
26
28
|
ops: JSONPatchOp[];
|
|
27
29
|
custom: JSONPatchOpHandlerMap;
|
|
28
30
|
/**
|
|
@@ -111,3 +113,5 @@ export declare class JSONPatch {
|
|
|
111
113
|
new (ops?: JSONPatchOp[], types?: JSONPatchOpHandlerMap): T;
|
|
112
114
|
}, ops?: JSONPatchOp[], types?: JSONPatchOpHandlerMap): T;
|
|
113
115
|
}
|
|
116
|
+
|
|
117
|
+
export { JSONPatch, type PathLike, type WriteOptions };
|