@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.
Files changed (181) hide show
  1. package/dist/algorithms/client/applyCommittedChanges.d.ts +8 -2
  2. package/dist/algorithms/client/applyCommittedChanges.js +30 -38
  3. package/dist/algorithms/client/batching.d.ts +8 -2
  4. package/dist/algorithms/client/batching.js +38 -37
  5. package/dist/algorithms/client/breakChange.d.ts +8 -2
  6. package/dist/algorithms/client/breakChange.js +191 -240
  7. package/dist/algorithms/client/createStateFromSnapshot.d.ts +8 -2
  8. package/dist/algorithms/client/createStateFromSnapshot.js +7 -8
  9. package/dist/algorithms/client/getJSONByteSize.d.ts +3 -1
  10. package/dist/algorithms/client/getJSONByteSize.js +12 -11
  11. package/dist/algorithms/client/makeChange.d.ts +8 -2
  12. package/dist/algorithms/client/makeChange.js +28 -36
  13. package/dist/algorithms/server/commitChanges.d.ts +9 -3
  14. package/dist/algorithms/server/commitChanges.js +69 -78
  15. package/dist/algorithms/server/createVersion.d.ts +9 -3
  16. package/dist/algorithms/server/createVersion.js +21 -27
  17. package/dist/algorithms/server/getSnapshotAtRevision.d.ts +9 -3
  18. package/dist/algorithms/server/getSnapshotAtRevision.js +27 -28
  19. package/dist/algorithms/server/getStateAtRevision.d.ts +9 -3
  20. package/dist/algorithms/server/getStateAtRevision.js +13 -17
  21. package/dist/algorithms/server/handleOfflineSessionsAndBatches.d.ts +9 -3
  22. package/dist/algorithms/server/handleOfflineSessionsAndBatches.js +60 -77
  23. package/dist/algorithms/server/transformIncomingChanges.d.ts +8 -2
  24. package/dist/algorithms/server/transformIncomingChanges.js +27 -39
  25. package/dist/algorithms/shared/applyChanges.d.ts +8 -2
  26. package/dist/algorithms/shared/applyChanges.js +11 -16
  27. package/dist/algorithms/shared/rebaseChanges.d.ts +8 -2
  28. package/dist/algorithms/shared/rebaseChanges.js +30 -49
  29. package/dist/chunk-IZ2YBCUP.js +56 -0
  30. package/dist/client/InMemoryStore.d.ts +9 -3
  31. package/dist/client/InMemoryStore.js +92 -101
  32. package/dist/client/IndexedDBStore.d.ts +9 -3
  33. package/dist/client/IndexedDBStore.js +378 -491
  34. package/dist/client/Patches.d.ts +18 -13
  35. package/dist/client/Patches.js +152 -207
  36. package/dist/client/PatchesDoc.d.ts +14 -8
  37. package/dist/client/PatchesDoc.js +147 -154
  38. package/dist/client/PatchesHistoryClient.d.ts +12 -5
  39. package/dist/client/PatchesHistoryClient.js +110 -117
  40. package/dist/client/PatchesStore.d.ts +9 -3
  41. package/dist/client/PatchesStore.js +0 -1
  42. package/dist/client/index.d.ts +12 -6
  43. package/dist/client/index.js +5 -5
  44. package/dist/data/change.d.ts +9 -3
  45. package/dist/data/change.js +23 -15
  46. package/dist/data/version.d.ts +9 -3
  47. package/dist/data/version.js +11 -15
  48. package/dist/event-signal.d.ts +7 -6
  49. package/dist/event-signal.js +24 -39
  50. package/dist/index-CvQws3AB.d.ts +36 -0
  51. package/dist/index.d.ts +27 -5
  52. package/dist/index.js +10 -4
  53. package/dist/json-patch/JSONPatch.d.ts +9 -5
  54. package/dist/json-patch/JSONPatch.js +175 -183
  55. package/dist/json-patch/applyPatch.d.ts +5 -2
  56. package/dist/json-patch/applyPatch.js +27 -35
  57. package/dist/json-patch/composePatch.d.ts +5 -2
  58. package/dist/json-patch/composePatch.js +34 -34
  59. package/dist/json-patch/createJSONPatch.d.ts +7 -2
  60. package/dist/json-patch/createJSONPatch.js +11 -38
  61. package/dist/json-patch/index.d.ts +14 -6
  62. package/dist/json-patch/index.js +20 -9
  63. package/dist/json-patch/invertPatch.d.ts +5 -2
  64. package/dist/json-patch/invertPatch.js +31 -30
  65. package/dist/json-patch/ops/add.d.ts +5 -2
  66. package/dist/json-patch/ops/add.js +53 -51
  67. package/dist/json-patch/ops/bitmask.d.ts +8 -5
  68. package/dist/json-patch/ops/bitmask.js +41 -44
  69. package/dist/json-patch/ops/copy.d.ts +5 -2
  70. package/dist/json-patch/ops/copy.js +32 -33
  71. package/dist/json-patch/ops/increment.d.ts +5 -2
  72. package/dist/json-patch/ops/increment.js +21 -20
  73. package/dist/json-patch/ops/index.d.ts +10 -21
  74. package/dist/json-patch/ops/index.js +34 -24
  75. package/dist/json-patch/ops/move.d.ts +5 -2
  76. package/dist/json-patch/ops/move.js +132 -198
  77. package/dist/json-patch/ops/remove.d.ts +5 -2
  78. package/dist/json-patch/ops/remove.js +33 -30
  79. package/dist/json-patch/ops/replace.d.ts +5 -2
  80. package/dist/json-patch/ops/replace.js +45 -43
  81. package/dist/json-patch/ops/test.d.ts +5 -2
  82. package/dist/json-patch/ops/test.js +25 -21
  83. package/dist/json-patch/ops/text.d.ts +5 -2
  84. package/dist/json-patch/ops/text.js +54 -54
  85. package/dist/json-patch/pathProxy.d.ts +9 -3
  86. package/dist/json-patch/pathProxy.js +27 -48
  87. package/dist/json-patch/state.d.ts +5 -2
  88. package/dist/json-patch/state.js +11 -7
  89. package/dist/json-patch/transformPatch.d.ts +6 -2
  90. package/dist/json-patch/transformPatch.js +21 -24
  91. package/dist/json-patch/types.d.ts +9 -7
  92. package/dist/json-patch/types.js +0 -1
  93. package/dist/json-patch/utils/deepEqual.d.ts +3 -1
  94. package/dist/json-patch/utils/deepEqual.js +32 -28
  95. package/dist/json-patch/utils/exit.d.ts +5 -2
  96. package/dist/json-patch/utils/exit.js +7 -3
  97. package/dist/json-patch/utils/get.d.ts +5 -2
  98. package/dist/json-patch/utils/get.js +8 -4
  99. package/dist/json-patch/utils/getOpData.d.ts +5 -2
  100. package/dist/json-patch/utils/getOpData.js +12 -9
  101. package/dist/json-patch/utils/getType.d.ts +6 -3
  102. package/dist/json-patch/utils/getType.js +9 -4
  103. package/dist/json-patch/utils/index.d.ts +15 -14
  104. package/dist/json-patch/utils/index.js +14 -14
  105. package/dist/json-patch/utils/log.d.ts +4 -2
  106. package/dist/json-patch/utils/log.js +8 -3
  107. package/dist/json-patch/utils/ops.d.ts +8 -5
  108. package/dist/json-patch/utils/ops.js +83 -100
  109. package/dist/json-patch/utils/paths.d.ts +12 -9
  110. package/dist/json-patch/utils/paths.js +54 -51
  111. package/dist/json-patch/utils/pluck.d.ts +8 -5
  112. package/dist/json-patch/utils/pluck.js +32 -26
  113. package/dist/json-patch/utils/shallowCopy.d.ts +3 -1
  114. package/dist/json-patch/utils/shallowCopy.js +22 -18
  115. package/dist/json-patch/utils/softWrites.d.ts +6 -3
  116. package/dist/json-patch/utils/softWrites.js +17 -16
  117. package/dist/json-patch/utils/toArrayIndex.d.ts +3 -1
  118. package/dist/json-patch/utils/toArrayIndex.js +14 -10
  119. package/dist/json-patch/utils/toKeys.d.ts +3 -1
  120. package/dist/json-patch/utils/toKeys.js +15 -11
  121. package/dist/json-patch/utils/updateArrayIndexes.d.ts +5 -2
  122. package/dist/json-patch/utils/updateArrayIndexes.js +33 -37
  123. package/dist/json-patch/utils/updateArrayPath.d.ts +5 -2
  124. package/dist/json-patch/utils/updateArrayPath.js +29 -42
  125. package/dist/net/PatchesClient.d.ts +128 -0
  126. package/dist/net/PatchesClient.js +161 -0
  127. package/dist/net/PatchesSync.d.ts +19 -9
  128. package/dist/net/PatchesSync.js +291 -386
  129. package/dist/net/error.d.ts +3 -1
  130. package/dist/net/error.js +9 -6
  131. package/dist/net/http/FetchTransport.d.ts +21 -0
  132. package/dist/net/http/FetchTransport.js +34 -0
  133. package/dist/net/index.d.ts +26 -12
  134. package/dist/net/index.js +12 -10
  135. package/dist/net/protocol/JSONRPCClient.d.ts +11 -4
  136. package/dist/net/protocol/JSONRPCClient.js +95 -103
  137. package/dist/net/protocol/JSONRPCServer.d.ts +15 -8
  138. package/dist/net/protocol/JSONRPCServer.js +101 -123
  139. package/dist/net/protocol/types.d.ts +21 -15
  140. package/dist/net/protocol/types.js +0 -1
  141. package/dist/net/protocol/utils.d.ts +12 -0
  142. package/dist/net/protocol/utils.js +15 -0
  143. package/dist/net/types.d.ts +4 -2
  144. package/dist/net/types.js +0 -1
  145. package/dist/net/webrtc/WebRTCAwareness.d.ts +14 -4
  146. package/dist/net/webrtc/WebRTCAwareness.js +111 -120
  147. package/dist/net/webrtc/WebRTCTransport.d.ts +16 -8
  148. package/dist/net/webrtc/WebRTCTransport.js +149 -157
  149. package/dist/net/webrtc/index.d.ts +10 -2
  150. package/dist/net/webrtc/index.js +2 -2
  151. package/dist/net/websocket/AuthorizationProvider.d.ts +7 -5
  152. package/dist/net/websocket/AuthorizationProvider.js +12 -17
  153. package/dist/net/websocket/PatchesWebSocket.d.ts +14 -109
  154. package/dist/net/websocket/PatchesWebSocket.js +37 -184
  155. package/dist/net/websocket/RPCServer.d.ts +19 -10
  156. package/dist/net/websocket/RPCServer.js +190 -192
  157. package/dist/net/websocket/SignalingService.d.ts +12 -32
  158. package/dist/net/websocket/SignalingService.js +126 -133
  159. package/dist/net/websocket/WebSocketServer.d.ts +17 -4
  160. package/dist/net/websocket/WebSocketServer.js +64 -72
  161. package/dist/net/websocket/WebSocketTransport.d.ts +13 -5
  162. package/dist/net/websocket/WebSocketTransport.js +178 -207
  163. package/dist/net/websocket/onlineState.d.ts +6 -3
  164. package/dist/net/websocket/onlineState.js +25 -21
  165. package/dist/server/PatchesBranchManager.d.ts +12 -5
  166. package/dist/server/PatchesBranchManager.js +132 -142
  167. package/dist/server/PatchesHistoryManager.d.ts +11 -3
  168. package/dist/server/PatchesHistoryManager.js +81 -84
  169. package/dist/server/PatchesServer.d.ts +16 -10
  170. package/dist/server/PatchesServer.js +131 -137
  171. package/dist/server/index.d.ts +7 -2
  172. package/dist/server/index.js +9 -3
  173. package/dist/server/types.d.ts +9 -3
  174. package/dist/server/types.js +0 -1
  175. package/dist/types.d.ts +38 -19
  176. package/dist/types.js +1 -1
  177. package/dist/utils/concurrency.d.ts +7 -5
  178. package/dist/utils/concurrency.js +43 -53
  179. package/dist/utils/deferred.d.ts +4 -2
  180. package/dist/utils/deferred.js +25 -21
  181. package/package.json +5 -7
@@ -1,3 +1,9 @@
1
- import type { JSONPatchOp } from '../json-patch/types.js';
2
- import type { Change } from '../types.js';
3
- export declare function createChange(baseRev: number, rev: number, ops: JSONPatchOp[], metadata?: Record<string, any>): Change;
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 };
@@ -1,20 +1,28 @@
1
- import { inc } from 'alphacounter';
2
- import { createId } from 'crypto-id';
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
- return inc.from(rev) + createId(4);
5
+ return inc.from(rev) + createId(4);
10
6
  }
11
- export function createChange(baseRev, rev, ops, metadata) {
7
+ function createChange(baseRev, rev, ops, metadata) {
8
+ if (typeof baseRev !== "number" && typeof rev !== "number") {
12
9
  return {
13
- id: createChangeId(rev),
14
- baseRev,
15
- rev,
16
- ops,
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
+ };
@@ -1,12 +1,18 @@
1
- import type { VersionMetadata } from '../types.js';
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
- export declare function createVersionId(): string;
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
- export declare function createVersionMetadata(data: Omit<VersionMetadata, 'id'>): VersionMetadata;
16
+ declare function createVersionMetadata(data: Omit<VersionMetadata, 'id'>): VersionMetadata;
17
+
18
+ export { createVersionId, createVersionMetadata };
@@ -1,17 +1,13 @@
1
- import { createSortableId } from 'crypto-id';
2
- /**
3
- * Create a version id for a given document. Uses a sortable 16 character id.
4
- * @returns The version id.
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
- * Create a version.
11
- * @param data - The version data.
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
+ };
@@ -1,8 +1,8 @@
1
- export type SignalSubscriber = (...args: any[]) => any;
2
- export type ErrorSubscriber = (error: Error) => any;
3
- export type Unsubscriber = () => void;
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
- export type Signal<T extends SignalSubscriber = SignalSubscriber> = {
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
- export declare function signal<T extends SignalSubscriber = SignalSubscriber>(): Signal<T>;
31
- export {};
30
+ declare function signal<T extends SignalSubscriber = SignalSubscriber>(): Signal<T>;
31
+
32
+ export { type ErrorSubscriber, type Signal, type SignalSubscriber, type Unsubscriber, signal };
@@ -1,40 +1,25 @@
1
- /**
2
- * Creates a signal, a function that can be used to subscribe to events. The signal can be called with a subscriber
3
- * function to register event listeners. It has methods for emitting events, handling errors, and managing subscriptions.
4
- *
5
- * @example
6
- * const onLoad = signal<(data: MyData) => void>();
7
- *
8
- * // Subscribe to data
9
- * onLoad((data) => console.log('loaded', data));
10
- *
11
- * // Subscribe to errors
12
- * onLoad.error((error) => console.error('error', error));
13
- *
14
- * // Emit data to subscribers
15
- * await onLoad.emit('data'); // logs 'loaded data'
16
- *
17
- * // Clear all subscribers
18
- * onLoad.clear();
19
- */
20
- export function signal() {
21
- const subscribers = new Set();
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 * from './client/index.js';
3
- export * from './event-signal.js';
4
- export * from './json-patch/index.js';
5
- export type { ApplyJSONPatchOptions } from './json-patch/types.js';
6
- export type * from './types.js';
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
- export { Delta } from '@dabble/delta';
2
- export * from './client/index.js';
3
- export * from './event-signal.js';
4
- export * from './json-patch/index.js';
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
- import { Delta } from '@dabble/delta';
14
- import type { ApplyJSONPatchOptions, JSONPatchOp, JSONPatchOpHandlerMap } from './types.js';
15
- export type PathLike = string | {
16
+
17
+ type PathLike = string | {
16
18
  toString(): string;
17
19
  };
18
- export interface WriteOptions {
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
- export declare class JSONPatch {
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 };