@dabble/patches 0.2.2 → 0.2.3
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.
|
@@ -5,7 +5,7 @@ import type { Change, PatchesSnapshot } from '../types.js';
|
|
|
5
5
|
* Manages committed state, pending (local-only) changes, and
|
|
6
6
|
* changes currently being sent to the server.
|
|
7
7
|
*/
|
|
8
|
-
export declare class PatchesDoc<T extends object> {
|
|
8
|
+
export declare class PatchesDoc<T extends object = object> {
|
|
9
9
|
protected _id: string | null;
|
|
10
10
|
protected _state: T;
|
|
11
11
|
protected _committedState: T;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export
|
|
1
|
+
export { Delta } from '@dabble/delta';
|
|
2
|
+
export * from './client/Patches.js';
|
|
3
|
+
export * from './client/PatchesDoc.js';
|
|
4
|
+
export type * from './event-signal';
|
|
5
|
+
export type * from './json-patch/JSONPatch.js';
|
|
6
|
+
export type { ApplyJSONPatchOptions } from './json-patch/types.js';
|
|
7
|
+
export type * from './persist/PatchesStore.js';
|
|
3
8
|
export type * from './types';
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export
|
|
1
|
+
export { Delta } from '@dabble/delta';
|
|
2
|
+
export * from './client/Patches.js';
|
|
3
|
+
export * from './client/PatchesDoc.js';
|
|
@@ -115,12 +115,3 @@ export declare class JSONPatch {
|
|
|
115
115
|
new (ops?: JSONPatchOp[], types?: JSONPatchOpHandlerMap): T;
|
|
116
116
|
}, ops?: JSONPatchOp[], types?: JSONPatchOpHandlerMap): T;
|
|
117
117
|
}
|
|
118
|
-
export type JSONPath<T> = T extends object ? T extends Array<infer U> ? {
|
|
119
|
-
readonly [K in keyof T & number]-?: JSONPathValue<U>;
|
|
120
|
-
} : {
|
|
121
|
-
readonly [K in keyof T as T[K] extends Function ? never : K]-?: JSONPathValue<NonNullable<T[K]>>;
|
|
122
|
-
} : never;
|
|
123
|
-
export type JSONPathValue<T> = {
|
|
124
|
-
toString(): string;
|
|
125
|
-
} & (T extends object ? JSONPath<T> : {});
|
|
126
|
-
export declare function createJSONPath<T = unknown>(): JSONPath<T>;
|
|
@@ -208,14 +208,3 @@ function checkPath(path) {
|
|
|
208
208
|
path = `/${path}`;
|
|
209
209
|
return path;
|
|
210
210
|
}
|
|
211
|
-
export function createJSONPath() {
|
|
212
|
-
const handler = {
|
|
213
|
-
get(target, prop) {
|
|
214
|
-
if (prop === 'toString') {
|
|
215
|
-
return () => target.path ?? '';
|
|
216
|
-
}
|
|
217
|
-
return new Proxy({ path: `${target.path}/${prop}` }, handler);
|
|
218
|
-
},
|
|
219
|
-
};
|
|
220
|
-
return new Proxy({ path: '' }, handler);
|
|
221
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dabble/patches",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
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": {
|