@verdant-web/common 1.11.0 → 1.12.0
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/cjs/EventSubscriber.d.ts +17 -17
- package/dist/cjs/EventSubscriber.js +66 -66
- package/dist/cjs/baseline.d.ts +5 -5
- package/dist/cjs/baseline.js +2 -2
- package/dist/cjs/batching.d.ts +41 -41
- package/dist/cjs/batching.js +88 -88
- package/dist/cjs/files.d.ts +19 -19
- package/dist/cjs/files.js +18 -18
- package/dist/cjs/index.d.ts +18 -18
- package/dist/cjs/index.js +35 -35
- package/dist/cjs/indexes.d.ts +14 -14
- package/dist/cjs/indexes.js +115 -115
- package/dist/cjs/indexes.test.d.ts +1 -1
- package/dist/cjs/indexes.test.js +127 -127
- package/dist/cjs/migration.d.ts +98 -98
- package/dist/cjs/migration.js +127 -127
- package/dist/cjs/oids.d.ts +85 -87
- package/dist/cjs/oids.js +363 -374
- package/dist/cjs/oids.js.map +1 -1
- package/dist/cjs/oids.test.d.ts +1 -1
- package/dist/cjs/oids.test.js +269 -251
- package/dist/cjs/oids.test.js.map +1 -1
- package/dist/cjs/operation.d.ts +139 -139
- package/dist/cjs/operation.js +532 -532
- package/dist/cjs/operation.js.map +1 -1
- package/dist/cjs/operation.test.d.ts +1 -1
- package/dist/cjs/operation.test.js +505 -505
- package/dist/cjs/operation.test.js.map +1 -1
- package/dist/cjs/patch.d.ts +26 -26
- package/dist/cjs/patch.js +226 -226
- package/dist/cjs/patch.js.map +1 -1
- package/dist/cjs/presence.d.ts +27 -27
- package/dist/cjs/presence.js +2 -2
- package/dist/cjs/protocol.d.ts +145 -145
- package/dist/cjs/protocol.js +3 -3
- package/dist/cjs/refs.d.ts +5 -5
- package/dist/cjs/refs.js +21 -21
- package/dist/cjs/replica.d.ts +28 -28
- package/dist/cjs/replica.js +28 -28
- package/dist/cjs/schema/defaults.d.ts +4 -4
- package/dist/cjs/schema/defaults.js +71 -71
- package/dist/cjs/schema/defaults.test.d.ts +1 -1
- package/dist/cjs/schema/defaults.test.js +20 -20
- package/dist/cjs/schema/defaults.test.js.map +1 -1
- package/dist/cjs/schema/index.d.ts +8 -8
- package/dist/cjs/schema/index.js +28 -28
- package/dist/cjs/schema/indexFilters.d.ts +6 -6
- package/dist/cjs/schema/indexFilters.js +30 -30
- package/dist/cjs/schema/types/collection.d.ts +51 -51
- package/dist/cjs/schema/types/collection.js +2 -2
- package/dist/cjs/schema/types/compounds.d.ts +12 -12
- package/dist/cjs/schema/types/compounds.js +2 -2
- package/dist/cjs/schema/types/fields.d.ts +59 -59
- package/dist/cjs/schema/types/fields.js +2 -2
- package/dist/cjs/schema/types/filters.d.ts +29 -29
- package/dist/cjs/schema/types/filters.js +2 -2
- package/dist/cjs/schema/types/shapes.d.ts +21 -21
- package/dist/cjs/schema/types/shapes.js +2 -2
- package/dist/cjs/schema/types/synthetics.d.ts +28 -28
- package/dist/cjs/schema/types/synthetics.js +2 -2
- package/dist/cjs/schema/types.d.ts +18 -18
- package/dist/cjs/schema/types.js +22 -22
- package/dist/cjs/timestamp.d.ts +48 -48
- package/dist/cjs/timestamp.js +243 -243
- package/dist/cjs/timestamp.test.d.ts +1 -1
- package/dist/cjs/timestamp.test.js +93 -93
- package/dist/cjs/undo.d.ts +3 -3
- package/dist/cjs/undo.js +198 -198
- package/dist/cjs/utils.d.ts +15 -15
- package/dist/cjs/utils.js +127 -127
- package/dist/cjs/utils.test.d.ts +1 -1
- package/dist/cjs/utils.test.js +36 -36
- package/dist/esm/EventSubscriber.d.ts +17 -17
- package/dist/esm/EventSubscriber.js +62 -62
- package/dist/esm/baseline.d.ts +5 -5
- package/dist/esm/baseline.js +1 -1
- package/dist/esm/batching.d.ts +41 -41
- package/dist/esm/batching.js +83 -83
- package/dist/esm/files.d.ts +19 -19
- package/dist/esm/files.js +12 -12
- package/dist/esm/index.d.ts +18 -18
- package/dist/esm/index.js +15 -15
- package/dist/esm/indexes.d.ts +14 -14
- package/dist/esm/indexes.js +105 -105
- package/dist/esm/indexes.test.d.ts +1 -1
- package/dist/esm/indexes.test.js +125 -125
- package/dist/esm/migration.d.ts +98 -98
- package/dist/esm/migration.js +121 -121
- package/dist/esm/oids.d.ts +85 -87
- package/dist/esm/oids.js +336 -347
- package/dist/esm/oids.js.map +1 -1
- package/dist/esm/oids.test.d.ts +1 -1
- package/dist/esm/oids.test.js +267 -249
- package/dist/esm/oids.test.js.map +1 -1
- package/dist/esm/operation.d.ts +139 -139
- package/dist/esm/operation.js +517 -517
- package/dist/esm/operation.js.map +1 -1
- package/dist/esm/operation.test.d.ts +1 -1
- package/dist/esm/operation.test.js +503 -503
- package/dist/esm/operation.test.js.map +1 -1
- package/dist/esm/patch.d.ts +26 -26
- package/dist/esm/patch.js +222 -222
- package/dist/esm/patch.js.map +1 -1
- package/dist/esm/presence.d.ts +27 -27
- package/dist/esm/presence.js +1 -1
- package/dist/esm/protocol.d.ts +145 -145
- package/dist/esm/protocol.js +2 -2
- package/dist/esm/refs.d.ts +5 -5
- package/dist/esm/refs.js +16 -16
- package/dist/esm/replica.d.ts +28 -28
- package/dist/esm/replica.js +25 -25
- package/dist/esm/schema/defaults.d.ts +4 -4
- package/dist/esm/schema/defaults.js +65 -65
- package/dist/esm/schema/defaults.test.d.ts +1 -1
- package/dist/esm/schema/defaults.test.js +18 -18
- package/dist/esm/schema/defaults.test.js.map +1 -1
- package/dist/esm/schema/index.d.ts +8 -8
- package/dist/esm/schema/index.js +9 -9
- package/dist/esm/schema/indexFilters.d.ts +6 -6
- package/dist/esm/schema/indexFilters.js +22 -22
- package/dist/esm/schema/types/collection.d.ts +51 -51
- package/dist/esm/schema/types/collection.js +1 -1
- package/dist/esm/schema/types/compounds.d.ts +12 -12
- package/dist/esm/schema/types/compounds.js +1 -1
- package/dist/esm/schema/types/fields.d.ts +59 -59
- package/dist/esm/schema/types/fields.js +1 -1
- package/dist/esm/schema/types/filters.d.ts +29 -29
- package/dist/esm/schema/types/filters.js +1 -1
- package/dist/esm/schema/types/shapes.d.ts +21 -21
- package/dist/esm/schema/types/shapes.js +1 -1
- package/dist/esm/schema/types/synthetics.d.ts +28 -28
- package/dist/esm/schema/types/synthetics.js +1 -1
- package/dist/esm/schema/types.d.ts +18 -18
- package/dist/esm/schema/types.js +6 -6
- package/dist/esm/timestamp.d.ts +48 -48
- package/dist/esm/timestamp.js +228 -228
- package/dist/esm/timestamp.test.d.ts +1 -1
- package/dist/esm/timestamp.test.js +91 -91
- package/dist/esm/undo.d.ts +3 -3
- package/dist/esm/undo.js +194 -194
- package/dist/esm/utils.d.ts +15 -15
- package/dist/esm/utils.js +113 -113
- package/dist/esm/utils.test.d.ts +1 -1
- package/dist/esm/utils.test.js +34 -34
- package/dist/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/oids.test.ts +62 -51
- package/src/oids.ts +7 -26
- package/src/operation.test.ts +32 -40
- package/src/operation.ts +4 -16
- package/src/patch.ts +5 -15
- package/src/schema/defaults.test.ts +1 -1
- package/dist/cjs/files.test.d.ts +0 -1
- package/dist/cjs/files.test.js +0 -81
- package/dist/cjs/files.test.js.map +0 -1
- package/dist/esm/files.test.d.ts +0 -1
- package/dist/esm/files.test.js +0 -79
- package/dist/esm/files.test.js.map +0 -1
package/dist/esm/operation.d.ts
CHANGED
|
@@ -1,139 +1,139 @@
|
|
|
1
|
-
import { DocumentBaseline } from './baseline.js';
|
|
2
|
-
import { FileRef } from './files.js';
|
|
3
|
-
import {
|
|
4
|
-
export declare type ObjectRef = {
|
|
5
|
-
'@@type': 'ref';
|
|
6
|
-
id: ObjectIdentifier;
|
|
7
|
-
};
|
|
8
|
-
export declare function isObjectRef(obj: any): obj is ObjectRef;
|
|
9
|
-
export declare type Normalized<T> = {
|
|
10
|
-
[key in keyof T]: T[key] extends Object ? ObjectRef : T[key];
|
|
11
|
-
};
|
|
12
|
-
export declare type PropertyName = string | number;
|
|
13
|
-
/**
|
|
14
|
-
* List patches can target a particular child list or
|
|
15
|
-
* nested lists. The first path item is the property path
|
|
16
|
-
* of the first child list, any subsequent values are nested
|
|
17
|
-
* list indices.
|
|
18
|
-
*/
|
|
19
|
-
export declare type PropertyValue = string | number | boolean | null | undefined | ObjectRef;
|
|
20
|
-
interface BaseOperationPatch {
|
|
21
|
-
}
|
|
22
|
-
export interface OperationPatchInitialize extends BaseOperationPatch {
|
|
23
|
-
op: 'initialize';
|
|
24
|
-
value: any;
|
|
25
|
-
}
|
|
26
|
-
export interface OperationPatchSet extends BaseOperationPatch {
|
|
27
|
-
op: 'set';
|
|
28
|
-
name: PropertyName;
|
|
29
|
-
value: PropertyValue;
|
|
30
|
-
}
|
|
31
|
-
export interface OperationPatchRemove extends BaseOperationPatch {
|
|
32
|
-
op: 'remove';
|
|
33
|
-
name: PropertyName;
|
|
34
|
-
}
|
|
35
|
-
export interface OperationPatchListPush extends BaseOperationPatch {
|
|
36
|
-
op: 'list-push';
|
|
37
|
-
value: PropertyValue;
|
|
38
|
-
}
|
|
39
|
-
export interface OperationPatchListInsert extends BaseOperationPatch {
|
|
40
|
-
op: 'list-insert';
|
|
41
|
-
index: number;
|
|
42
|
-
value?: PropertyValue;
|
|
43
|
-
values?: PropertyValue[];
|
|
44
|
-
}
|
|
45
|
-
export interface OperationPatchListDelete extends BaseOperationPatch {
|
|
46
|
-
op: 'list-delete';
|
|
47
|
-
index: number;
|
|
48
|
-
count: number;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Optimal for lists of object references. Moves
|
|
52
|
-
* the selected item to the target index even if it
|
|
53
|
-
* is not at the original index anymore.
|
|
54
|
-
*/
|
|
55
|
-
export interface OperationPatchListMoveByRef extends BaseOperationPatch {
|
|
56
|
-
op: 'list-move-by-ref';
|
|
57
|
-
value: ObjectRef;
|
|
58
|
-
index: number;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Suitable for any list move, whether object lists
|
|
62
|
-
* or primitive lists.
|
|
63
|
-
*/
|
|
64
|
-
export interface OperationPatchListMoveByIndex extends BaseOperationPatch {
|
|
65
|
-
op: 'list-move-by-index';
|
|
66
|
-
from: number;
|
|
67
|
-
to: number;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Removes all instances of the value from
|
|
71
|
-
* the list. Good for set behavior or removing
|
|
72
|
-
* a specific item even if it changes index
|
|
73
|
-
* from conflicts.
|
|
74
|
-
*/
|
|
75
|
-
export interface OperationPatchListRemove extends BaseOperationPatch {
|
|
76
|
-
op: 'list-remove';
|
|
77
|
-
value: PropertyValue;
|
|
78
|
-
only?: 'first' | 'last';
|
|
79
|
-
}
|
|
80
|
-
export interface OperationPatchListAdd extends BaseOperationPatch {
|
|
81
|
-
op: 'list-add';
|
|
82
|
-
value: PropertyValue;
|
|
83
|
-
}
|
|
84
|
-
export interface OperationPatchDelete extends BaseOperationPatch {
|
|
85
|
-
op: 'delete';
|
|
86
|
-
}
|
|
87
|
-
export declare type OperationPatch = OperationPatchInitialize | OperationPatchSet | OperationPatchRemove | OperationPatchListPush | OperationPatchListInsert | OperationPatchListDelete | OperationPatchListMoveByRef | OperationPatchListMoveByIndex | OperationPatchListRemove | OperationPatchDelete | OperationPatchListAdd;
|
|
88
|
-
export declare type Operation = {
|
|
89
|
-
oid: ObjectIdentifier;
|
|
90
|
-
timestamp: string;
|
|
91
|
-
data: OperationPatch;
|
|
92
|
-
};
|
|
93
|
-
export declare function diffToPatches<T extends {
|
|
94
|
-
[key: string]: any;
|
|
95
|
-
} | any[]>(from: T, to: T, getNow: () => string,
|
|
96
|
-
/**
|
|
97
|
-
* If an object is merged with another and the new one does not
|
|
98
|
-
* have an OID assigned, assume it is the same identity as previous
|
|
99
|
-
*/
|
|
100
|
-
mergeUnknownObjects?: boolean;
|
|
101
|
-
/**
|
|
102
|
-
* If an incoming value is not assigned on the new object, use the previous value.
|
|
103
|
-
* If false, undefined properties will erase the previous value.
|
|
104
|
-
*/
|
|
105
|
-
defaultUndefined?: boolean;
|
|
106
|
-
}): Operation[];
|
|
107
|
-
export declare function shallowDiffToPatches(from: any, to: any, getNow: () => string, patches?: Operation[]): Operation[];
|
|
108
|
-
/**
|
|
109
|
-
* Takes a basic object and constructs a patch list to create it and
|
|
110
|
-
* all of its nested objects.
|
|
111
|
-
*/
|
|
112
|
-
export declare function initialToPatches(initial: any, rootOid: ObjectIdentifier, getNow: () => string, createSubId?: () => string, patches?: Operation[]): Operation[];
|
|
113
|
-
export declare function shallowInitialToPatches(initial: any, rootOid: ObjectIdentifier, getNow: () => string, patches?: Operation[]): Operation[];
|
|
114
|
-
export declare function groupPatchesByIdentifier(patches: Operation[]): Record<string, Operation[]>;
|
|
115
|
-
export declare function groupPatchesByRootOid(patches: Operation[]): Record<string, Operation[]>;
|
|
116
|
-
export declare function groupBaselinesByRootOid(baselines: DocumentBaseline[]): Record<string, DocumentBaseline<any>[]>;
|
|
117
|
-
export declare type NormalizedObject = {
|
|
118
|
-
[key: PropertyName]: PropertyValue;
|
|
119
|
-
} | Array<PropertyValue>;
|
|
120
|
-
/**
|
|
121
|
-
* The incoming object should already be normalized!
|
|
122
|
-
* This function will mutate the base object.
|
|
123
|
-
*/
|
|
124
|
-
export declare function applyPatch<T extends NormalizedObject>(base: T | undefined, patch: OperationPatch,
|
|
125
|
-
/**
|
|
126
|
-
* Optionally supply a list to which any refs which
|
|
127
|
-
* are removed during the patch will be appended.
|
|
128
|
-
*/
|
|
129
|
-
deletedRefs?: (FileRef | ObjectRef)[]): T | undefined;
|
|
130
|
-
export declare function applyOperations<T extends NormalizedObject>(base: T | undefined, operations: Operation[], deletedRefs?: (ObjectRef | FileRef)[]): T | undefined;
|
|
131
|
-
/**
|
|
132
|
-
* Mutates the original object in place. Returns all referenced
|
|
133
|
-
* objects oids.
|
|
134
|
-
*/
|
|
135
|
-
export declare function substituteRefsWithObjects(base: any, refs: Map<ObjectIdentifier, any>, used?: ObjectIdentifier[]): ObjectIdentifier[];
|
|
136
|
-
export declare function substituteFirstLevelObjectsWithRefs<Base extends {
|
|
137
|
-
[key: string]: any;
|
|
138
|
-
} | any[]>(base: Base, refObjects?: Map<ObjectIdentifier, any>): Map<ObjectIdentifier, any>;
|
|
139
|
-
export {};
|
|
1
|
+
import { DocumentBaseline } from './baseline.js';
|
|
2
|
+
import { FileRef } from './files.js';
|
|
3
|
+
import { ObjectIdentifier } from './oids.js';
|
|
4
|
+
export declare type ObjectRef = {
|
|
5
|
+
'@@type': 'ref';
|
|
6
|
+
id: ObjectIdentifier;
|
|
7
|
+
};
|
|
8
|
+
export declare function isObjectRef(obj: any): obj is ObjectRef;
|
|
9
|
+
export declare type Normalized<T> = {
|
|
10
|
+
[key in keyof T]: T[key] extends Object ? ObjectRef : T[key];
|
|
11
|
+
};
|
|
12
|
+
export declare type PropertyName = string | number;
|
|
13
|
+
/**
|
|
14
|
+
* List patches can target a particular child list or
|
|
15
|
+
* nested lists. The first path item is the property path
|
|
16
|
+
* of the first child list, any subsequent values are nested
|
|
17
|
+
* list indices.
|
|
18
|
+
*/
|
|
19
|
+
export declare type PropertyValue = string | number | boolean | null | undefined | ObjectRef;
|
|
20
|
+
interface BaseOperationPatch {
|
|
21
|
+
}
|
|
22
|
+
export interface OperationPatchInitialize extends BaseOperationPatch {
|
|
23
|
+
op: 'initialize';
|
|
24
|
+
value: any;
|
|
25
|
+
}
|
|
26
|
+
export interface OperationPatchSet extends BaseOperationPatch {
|
|
27
|
+
op: 'set';
|
|
28
|
+
name: PropertyName;
|
|
29
|
+
value: PropertyValue;
|
|
30
|
+
}
|
|
31
|
+
export interface OperationPatchRemove extends BaseOperationPatch {
|
|
32
|
+
op: 'remove';
|
|
33
|
+
name: PropertyName;
|
|
34
|
+
}
|
|
35
|
+
export interface OperationPatchListPush extends BaseOperationPatch {
|
|
36
|
+
op: 'list-push';
|
|
37
|
+
value: PropertyValue;
|
|
38
|
+
}
|
|
39
|
+
export interface OperationPatchListInsert extends BaseOperationPatch {
|
|
40
|
+
op: 'list-insert';
|
|
41
|
+
index: number;
|
|
42
|
+
value?: PropertyValue;
|
|
43
|
+
values?: PropertyValue[];
|
|
44
|
+
}
|
|
45
|
+
export interface OperationPatchListDelete extends BaseOperationPatch {
|
|
46
|
+
op: 'list-delete';
|
|
47
|
+
index: number;
|
|
48
|
+
count: number;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Optimal for lists of object references. Moves
|
|
52
|
+
* the selected item to the target index even if it
|
|
53
|
+
* is not at the original index anymore.
|
|
54
|
+
*/
|
|
55
|
+
export interface OperationPatchListMoveByRef extends BaseOperationPatch {
|
|
56
|
+
op: 'list-move-by-ref';
|
|
57
|
+
value: ObjectRef;
|
|
58
|
+
index: number;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Suitable for any list move, whether object lists
|
|
62
|
+
* or primitive lists.
|
|
63
|
+
*/
|
|
64
|
+
export interface OperationPatchListMoveByIndex extends BaseOperationPatch {
|
|
65
|
+
op: 'list-move-by-index';
|
|
66
|
+
from: number;
|
|
67
|
+
to: number;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Removes all instances of the value from
|
|
71
|
+
* the list. Good for set behavior or removing
|
|
72
|
+
* a specific item even if it changes index
|
|
73
|
+
* from conflicts.
|
|
74
|
+
*/
|
|
75
|
+
export interface OperationPatchListRemove extends BaseOperationPatch {
|
|
76
|
+
op: 'list-remove';
|
|
77
|
+
value: PropertyValue;
|
|
78
|
+
only?: 'first' | 'last';
|
|
79
|
+
}
|
|
80
|
+
export interface OperationPatchListAdd extends BaseOperationPatch {
|
|
81
|
+
op: 'list-add';
|
|
82
|
+
value: PropertyValue;
|
|
83
|
+
}
|
|
84
|
+
export interface OperationPatchDelete extends BaseOperationPatch {
|
|
85
|
+
op: 'delete';
|
|
86
|
+
}
|
|
87
|
+
export declare type OperationPatch = OperationPatchInitialize | OperationPatchSet | OperationPatchRemove | OperationPatchListPush | OperationPatchListInsert | OperationPatchListDelete | OperationPatchListMoveByRef | OperationPatchListMoveByIndex | OperationPatchListRemove | OperationPatchDelete | OperationPatchListAdd;
|
|
88
|
+
export declare type Operation = {
|
|
89
|
+
oid: ObjectIdentifier;
|
|
90
|
+
timestamp: string;
|
|
91
|
+
data: OperationPatch;
|
|
92
|
+
};
|
|
93
|
+
export declare function diffToPatches<T extends {
|
|
94
|
+
[key: string]: any;
|
|
95
|
+
} | any[]>(from: T, to: T, getNow: () => string, createSubId?: () => string, patches?: Operation[], options?: {
|
|
96
|
+
/**
|
|
97
|
+
* If an object is merged with another and the new one does not
|
|
98
|
+
* have an OID assigned, assume it is the same identity as previous
|
|
99
|
+
*/
|
|
100
|
+
mergeUnknownObjects?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* If an incoming value is not assigned on the new object, use the previous value.
|
|
103
|
+
* If false, undefined properties will erase the previous value.
|
|
104
|
+
*/
|
|
105
|
+
defaultUndefined?: boolean;
|
|
106
|
+
}): Operation[];
|
|
107
|
+
export declare function shallowDiffToPatches(from: any, to: any, getNow: () => string, patches?: Operation[]): Operation[];
|
|
108
|
+
/**
|
|
109
|
+
* Takes a basic object and constructs a patch list to create it and
|
|
110
|
+
* all of its nested objects.
|
|
111
|
+
*/
|
|
112
|
+
export declare function initialToPatches(initial: any, rootOid: ObjectIdentifier, getNow: () => string, createSubId?: () => string, patches?: Operation[]): Operation[];
|
|
113
|
+
export declare function shallowInitialToPatches(initial: any, rootOid: ObjectIdentifier, getNow: () => string, patches?: Operation[]): Operation[];
|
|
114
|
+
export declare function groupPatchesByIdentifier(patches: Operation[]): Record<string, Operation[]>;
|
|
115
|
+
export declare function groupPatchesByRootOid(patches: Operation[]): Record<string, Operation[]>;
|
|
116
|
+
export declare function groupBaselinesByRootOid(baselines: DocumentBaseline[]): Record<string, DocumentBaseline<any>[]>;
|
|
117
|
+
export declare type NormalizedObject = {
|
|
118
|
+
[key: PropertyName]: PropertyValue;
|
|
119
|
+
} | Array<PropertyValue>;
|
|
120
|
+
/**
|
|
121
|
+
* The incoming object should already be normalized!
|
|
122
|
+
* This function will mutate the base object.
|
|
123
|
+
*/
|
|
124
|
+
export declare function applyPatch<T extends NormalizedObject>(base: T | undefined, patch: OperationPatch,
|
|
125
|
+
/**
|
|
126
|
+
* Optionally supply a list to which any refs which
|
|
127
|
+
* are removed during the patch will be appended.
|
|
128
|
+
*/
|
|
129
|
+
deletedRefs?: (FileRef | ObjectRef)[]): T | undefined;
|
|
130
|
+
export declare function applyOperations<T extends NormalizedObject>(base: T | undefined, operations: Operation[], deletedRefs?: (ObjectRef | FileRef)[]): T | undefined;
|
|
131
|
+
/**
|
|
132
|
+
* Mutates the original object in place. Returns all referenced
|
|
133
|
+
* objects oids.
|
|
134
|
+
*/
|
|
135
|
+
export declare function substituteRefsWithObjects(base: any, refs: Map<ObjectIdentifier, any>, used?: ObjectIdentifier[]): ObjectIdentifier[];
|
|
136
|
+
export declare function substituteFirstLevelObjectsWithRefs<Base extends {
|
|
137
|
+
[key: string]: any;
|
|
138
|
+
} | any[]>(base: Base, refObjects?: Map<ObjectIdentifier, any>): Map<ObjectIdentifier, any>;
|
|
139
|
+
export {};
|