@verdant-web/common 1.15.3-next.0 → 1.15.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.
Files changed (151) hide show
  1. package/dist/cjs/EventSubscriber.d.ts +17 -17
  2. package/dist/cjs/EventSubscriber.js +66 -66
  3. package/dist/cjs/baseline.d.ts +5 -5
  4. package/dist/cjs/baseline.js +2 -2
  5. package/dist/cjs/batching.d.ts +42 -42
  6. package/dist/cjs/batching.js +91 -91
  7. package/dist/cjs/files.d.ts +19 -19
  8. package/dist/cjs/files.js +18 -18
  9. package/dist/cjs/index.d.ts +19 -19
  10. package/dist/cjs/index.js +41 -41
  11. package/dist/cjs/indexes.d.ts +17 -17
  12. package/dist/cjs/indexes.js +142 -142
  13. package/dist/cjs/indexes.test.d.ts +1 -1
  14. package/dist/cjs/indexes.test.js +127 -127
  15. package/dist/cjs/migration.d.ts +172 -172
  16. package/dist/cjs/migration.js +301 -301
  17. package/dist/cjs/oids.d.ts +100 -100
  18. package/dist/cjs/oids.js +457 -457
  19. package/dist/cjs/oids.test.d.ts +1 -1
  20. package/dist/cjs/oids.test.js +348 -348
  21. package/dist/cjs/operation.d.ts +139 -139
  22. package/dist/cjs/operation.js +545 -545
  23. package/dist/cjs/operation.test.d.ts +1 -1
  24. package/dist/cjs/operation.test.js +529 -529
  25. package/dist/cjs/patch.d.ts +26 -26
  26. package/dist/cjs/patch.js +226 -226
  27. package/dist/cjs/presence.d.ts +27 -27
  28. package/dist/cjs/presence.js +2 -2
  29. package/dist/cjs/protocol.d.ts +145 -145
  30. package/dist/cjs/protocol.js +3 -3
  31. package/dist/cjs/refs.d.ts +7 -7
  32. package/dist/cjs/refs.js +29 -29
  33. package/dist/cjs/replica.d.ts +28 -28
  34. package/dist/cjs/replica.js +28 -28
  35. package/dist/cjs/schema/defaults.test.d.ts +1 -1
  36. package/dist/cjs/schema/defaults.test.js +20 -20
  37. package/dist/cjs/schema/fields.d.ts +9 -9
  38. package/dist/cjs/schema/fields.js +144 -144
  39. package/dist/cjs/schema/index.d.ts +8 -8
  40. package/dist/cjs/schema/index.js +51 -51
  41. package/dist/cjs/schema/indexFilters.d.ts +6 -6
  42. package/dist/cjs/schema/indexFilters.js +30 -30
  43. package/dist/cjs/schema/types/collection.d.ts +23 -23
  44. package/dist/cjs/schema/types/collection.js +2 -2
  45. package/dist/cjs/schema/types/compounds.d.ts +11 -11
  46. package/dist/cjs/schema/types/compounds.js +2 -2
  47. package/dist/cjs/schema/types/fields.d.ts +75 -75
  48. package/dist/cjs/schema/types/fields.js +2 -2
  49. package/dist/cjs/schema/types/filters.d.ts +29 -29
  50. package/dist/cjs/schema/types/filters.js +2 -2
  51. package/dist/cjs/schema/types/shapes.d.ts +21 -21
  52. package/dist/cjs/schema/types/shapes.js +2 -2
  53. package/dist/cjs/schema/types/synthetics.d.ts +37 -37
  54. package/dist/cjs/schema/types/synthetics.js +2 -2
  55. package/dist/cjs/schema/types.d.ts +18 -18
  56. package/dist/cjs/schema/types.js +22 -22
  57. package/dist/cjs/schema/validation.d.ts +3 -3
  58. package/dist/cjs/schema/validation.js +86 -86
  59. package/dist/cjs/timestamp.d.ts +50 -50
  60. package/dist/cjs/timestamp.js +251 -251
  61. package/dist/cjs/timestamp.test.d.ts +1 -1
  62. package/dist/cjs/timestamp.test.js +104 -104
  63. package/dist/cjs/undo.d.ts +3 -3
  64. package/dist/cjs/undo.js +198 -198
  65. package/dist/cjs/utils.d.ts +20 -20
  66. package/dist/cjs/utils.js +145 -145
  67. package/dist/cjs/utils.test.d.ts +1 -1
  68. package/dist/cjs/utils.test.js +36 -36
  69. package/dist/esm/EventSubscriber.d.ts +17 -17
  70. package/dist/esm/EventSubscriber.js +62 -62
  71. package/dist/esm/baseline.d.ts +5 -5
  72. package/dist/esm/baseline.js +1 -1
  73. package/dist/esm/batching.d.ts +42 -42
  74. package/dist/esm/batching.js +86 -86
  75. package/dist/esm/files.d.ts +19 -19
  76. package/dist/esm/files.js +12 -12
  77. package/dist/esm/index.d.ts +19 -19
  78. package/dist/esm/index.js +16 -16
  79. package/dist/esm/indexes.d.ts +17 -17
  80. package/dist/esm/indexes.js +130 -130
  81. package/dist/esm/indexes.test.d.ts +1 -1
  82. package/dist/esm/indexes.test.js +125 -125
  83. package/dist/esm/migration.d.ts +172 -172
  84. package/dist/esm/migration.js +294 -294
  85. package/dist/esm/oids.d.ts +100 -100
  86. package/dist/esm/oids.js +422 -422
  87. package/dist/esm/oids.test.d.ts +1 -1
  88. package/dist/esm/oids.test.js +346 -346
  89. package/dist/esm/operation.d.ts +139 -139
  90. package/dist/esm/operation.js +530 -530
  91. package/dist/esm/operation.test.d.ts +1 -1
  92. package/dist/esm/operation.test.js +527 -527
  93. package/dist/esm/patch.d.ts +26 -26
  94. package/dist/esm/patch.js +222 -222
  95. package/dist/esm/presence.d.ts +27 -27
  96. package/dist/esm/presence.js +1 -1
  97. package/dist/esm/protocol.d.ts +145 -145
  98. package/dist/esm/protocol.js +2 -2
  99. package/dist/esm/refs.d.ts +7 -7
  100. package/dist/esm/refs.js +22 -22
  101. package/dist/esm/replica.d.ts +28 -28
  102. package/dist/esm/replica.js +25 -25
  103. package/dist/esm/schema/defaults.test.d.ts +1 -1
  104. package/dist/esm/schema/defaults.test.js +18 -18
  105. package/dist/esm/schema/fields.d.ts +9 -9
  106. package/dist/esm/schema/fields.js +133 -133
  107. package/dist/esm/schema/index.d.ts +8 -8
  108. package/dist/esm/schema/index.js +32 -32
  109. package/dist/esm/schema/indexFilters.d.ts +6 -6
  110. package/dist/esm/schema/indexFilters.js +22 -22
  111. package/dist/esm/schema/types/collection.d.ts +23 -23
  112. package/dist/esm/schema/types/collection.js +1 -1
  113. package/dist/esm/schema/types/compounds.d.ts +11 -11
  114. package/dist/esm/schema/types/compounds.js +1 -1
  115. package/dist/esm/schema/types/fields.d.ts +75 -75
  116. package/dist/esm/schema/types/fields.js +1 -1
  117. package/dist/esm/schema/types/filters.d.ts +29 -29
  118. package/dist/esm/schema/types/filters.js +1 -1
  119. package/dist/esm/schema/types/shapes.d.ts +21 -21
  120. package/dist/esm/schema/types/shapes.js +1 -1
  121. package/dist/esm/schema/types/synthetics.d.ts +37 -37
  122. package/dist/esm/schema/types/synthetics.js +1 -1
  123. package/dist/esm/schema/types.d.ts +18 -18
  124. package/dist/esm/schema/types.js +6 -6
  125. package/dist/esm/schema/validation.d.ts +3 -3
  126. package/dist/esm/schema/validation.js +81 -81
  127. package/dist/esm/timestamp.d.ts +50 -50
  128. package/dist/esm/timestamp.js +234 -234
  129. package/dist/esm/timestamp.test.d.ts +1 -1
  130. package/dist/esm/timestamp.test.js +102 -102
  131. package/dist/esm/undo.d.ts +3 -3
  132. package/dist/esm/undo.js +194 -194
  133. package/dist/esm/utils.d.ts +20 -20
  134. package/dist/esm/utils.js +127 -127
  135. package/dist/esm/utils.test.d.ts +1 -1
  136. package/dist/esm/utils.test.js +34 -34
  137. package/dist/tsconfig-cjs.tsbuildinfo +1 -1
  138. package/dist/tsconfig.tsbuildinfo +1 -1
  139. package/package.json +1 -1
  140. package/dist/cjs/files.test.d.ts +0 -1
  141. package/dist/cjs/files.test.js +0 -81
  142. package/dist/cjs/files.test.js.map +0 -1
  143. package/dist/cjs/schema/defaults.d.ts +0 -4
  144. package/dist/cjs/schema/defaults.js +0 -72
  145. package/dist/cjs/schema/defaults.js.map +0 -1
  146. package/dist/esm/files.test.d.ts +0 -1
  147. package/dist/esm/files.test.js +0 -79
  148. package/dist/esm/files.test.js.map +0 -1
  149. package/dist/esm/schema/defaults.d.ts +0 -4
  150. package/dist/esm/schema/defaults.js +0 -66
  151. package/dist/esm/schema/defaults.js.map +0 -1
@@ -1,26 +1,26 @@
1
- /**
2
- * High-level patch creation for use with complex nested objects.
3
- */
4
- import { ObjectIdentifier } from './oids.js';
5
- import { ObjectRef, Operation, PropertyName } from './operation.js';
6
- export declare class PatchCreator {
7
- private getNow;
8
- private createSubId?;
9
- constructor(getNow: () => string, createSubId?: (() => string) | undefined);
10
- createDiff: (from: any, to: any, options?: {
11
- mergeUnknownObjects?: boolean;
12
- defaultUndefined?: boolean;
13
- }) => Operation[];
14
- createInitialize: (obj: any, oid: ObjectIdentifier) => Operation[];
15
- createSet: (oid: ObjectIdentifier, key: PropertyName, value: any) => Operation[];
16
- createRemove: (oid: ObjectIdentifier, key: PropertyName) => Operation[];
17
- createListPush: (oid: ObjectIdentifier, value: any) => Operation[];
18
- createListAdd: (oid: ObjectIdentifier, value: any) => Operation[];
19
- createListInsert: (oid: ObjectIdentifier, index: number, value: any) => Operation[];
20
- createListRemove: (oid: ObjectIdentifier, value: any, only?: 'first' | 'last') => Operation[];
21
- createListDelete: (oid: ObjectIdentifier, index: number, count?: number) => Operation[];
22
- createListMoveByRef: (oid: ObjectIdentifier, value: ObjectRef, index: number) => Operation[];
23
- createListMoveByIndex: (oid: ObjectIdentifier, fromIndex: number, toIndex: number) => Operation[];
24
- createDelete: (oid: ObjectIdentifier) => Operation[];
25
- createDeleteAll: (oids: ObjectIdentifier[]) => Operation[];
26
- }
1
+ /**
2
+ * High-level patch creation for use with complex nested objects.
3
+ */
4
+ import { ObjectIdentifier } from './oids.js';
5
+ import { ObjectRef, Operation, PropertyName } from './operation.js';
6
+ export declare class PatchCreator {
7
+ private getNow;
8
+ private createSubId?;
9
+ constructor(getNow: () => string, createSubId?: (() => string) | undefined);
10
+ createDiff: (from: any, to: any, options?: {
11
+ mergeUnknownObjects?: boolean;
12
+ defaultUndefined?: boolean;
13
+ }) => Operation[];
14
+ createInitialize: (obj: any, oid: ObjectIdentifier) => Operation[];
15
+ createSet: (oid: ObjectIdentifier, key: PropertyName, value: any) => Operation[];
16
+ createRemove: (oid: ObjectIdentifier, key: PropertyName) => Operation[];
17
+ createListPush: (oid: ObjectIdentifier, value: any) => Operation[];
18
+ createListAdd: (oid: ObjectIdentifier, value: any) => Operation[];
19
+ createListInsert: (oid: ObjectIdentifier, index: number, value: any) => Operation[];
20
+ createListRemove: (oid: ObjectIdentifier, value: any, only?: 'first' | 'last') => Operation[];
21
+ createListDelete: (oid: ObjectIdentifier, index: number, count?: number) => Operation[];
22
+ createListMoveByRef: (oid: ObjectIdentifier, value: ObjectRef, index: number) => Operation[];
23
+ createListMoveByIndex: (oid: ObjectIdentifier, fromIndex: number, toIndex: number) => Operation[];
24
+ createDelete: (oid: ObjectIdentifier) => Operation[];
25
+ createDeleteAll: (oids: ObjectIdentifier[]) => Operation[];
26
+ }
package/dist/cjs/patch.js CHANGED
@@ -1,227 +1,227 @@
1
- "use strict";
2
- /**
3
- * High-level patch creation for use with complex nested objects.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.PatchCreator = void 0;
7
- const oids_js_1 = require("./oids.js");
8
- const operation_js_1 = require("./operation.js");
9
- const refs_js_1 = require("./refs.js");
10
- const utils_js_1 = require("./utils.js");
11
- class PatchCreator {
12
- constructor(getNow, createSubId) {
13
- this.getNow = getNow;
14
- this.createSubId = createSubId;
15
- this.createDiff = (from, to, options = {}) => {
16
- return (0, operation_js_1.diffToPatches)(from, to, this.getNow, this.createSubId, [], options);
17
- };
18
- this.createInitialize = (obj, oid) => {
19
- return (0, operation_js_1.initialToPatches)(obj, oid, this.getNow, this.createSubId);
20
- };
21
- this.createSet = (oid, key, value) => {
22
- // incoming value must be normalized. if it's not a primitive, it and all sub-objects
23
- // must be created
24
- if (!(0, utils_js_1.isObject)(value) || (0, refs_js_1.isRef)(value)) {
25
- return [
26
- {
27
- oid,
28
- timestamp: this.getNow(),
29
- data: {
30
- op: 'set',
31
- name: key,
32
- value,
33
- },
34
- },
35
- ];
36
- }
37
- else {
38
- const itemOid = (0, oids_js_1.createSubOid)(oid, this.createSubId);
39
- return [
40
- // since we're setting a complex nested object, we can initialize it wholesale.
41
- // no diffing to do.
42
- ...(0, operation_js_1.initialToPatches)(value, itemOid, this.getNow),
43
- // then set the reference to the object
44
- {
45
- oid,
46
- timestamp: this.getNow(),
47
- data: {
48
- op: 'set',
49
- value: (0, oids_js_1.createRef)(itemOid),
50
- name: key,
51
- },
52
- },
53
- ];
54
- }
55
- };
56
- this.createRemove = (oid, key) => {
57
- return [
58
- {
59
- oid,
60
- timestamp: this.getNow(),
61
- data: {
62
- op: 'remove',
63
- name: key,
64
- },
65
- },
66
- ];
67
- };
68
- this.createListPush = (oid, value) => {
69
- if (!(0, utils_js_1.isObject)(value)) {
70
- return [
71
- {
72
- oid,
73
- timestamp: this.getNow(),
74
- data: {
75
- op: 'list-push',
76
- value,
77
- },
78
- },
79
- ];
80
- }
81
- else {
82
- const itemOid = (0, oids_js_1.createSubOid)(oid, this.createSubId);
83
- return [
84
- ...(0, operation_js_1.initialToPatches)(value, itemOid, this.getNow),
85
- {
86
- oid,
87
- timestamp: this.getNow(),
88
- data: {
89
- op: 'list-push',
90
- value: (0, oids_js_1.createRef)(itemOid),
91
- },
92
- },
93
- ];
94
- }
95
- };
96
- this.createListAdd = (oid, value) => {
97
- if ((0, utils_js_1.isObject)(value)) {
98
- return [
99
- {
100
- oid,
101
- timestamp: this.getNow(),
102
- data: {
103
- op: 'list-add',
104
- value: (0, oids_js_1.createRef)(value),
105
- },
106
- },
107
- ];
108
- }
109
- else {
110
- return [
111
- {
112
- oid,
113
- timestamp: this.getNow(),
114
- data: {
115
- op: 'list-add',
116
- value,
117
- },
118
- },
119
- ];
120
- }
121
- };
122
- this.createListInsert = (oid, index, value) => {
123
- if (!(0, utils_js_1.isObject)(value)) {
124
- return [
125
- {
126
- oid,
127
- timestamp: this.getNow(),
128
- data: {
129
- op: 'list-insert',
130
- value,
131
- index,
132
- },
133
- },
134
- ];
135
- }
136
- else {
137
- const itemOid = (0, oids_js_1.createSubOid)(oid, this.createSubId);
138
- return [
139
- ...(0, operation_js_1.initialToPatches)(value, itemOid, this.getNow),
140
- {
141
- oid,
142
- timestamp: this.getNow(),
143
- data: {
144
- op: 'list-insert',
145
- value: (0, oids_js_1.createRef)(itemOid),
146
- index,
147
- },
148
- },
149
- ];
150
- }
151
- };
152
- this.createListRemove = (oid, value, only) => {
153
- return [
154
- {
155
- oid,
156
- timestamp: this.getNow(),
157
- data: {
158
- op: 'list-remove',
159
- value,
160
- only,
161
- },
162
- },
163
- ];
164
- };
165
- this.createListDelete = (oid, index, count = 1) => {
166
- return [
167
- {
168
- oid,
169
- timestamp: this.getNow(),
170
- data: {
171
- op: 'list-delete',
172
- index,
173
- count,
174
- },
175
- },
176
- ];
177
- };
178
- this.createListMoveByRef = (oid, value, index) => {
179
- return [
180
- {
181
- oid,
182
- timestamp: this.getNow(),
183
- data: {
184
- op: 'list-move-by-ref',
185
- value,
186
- index,
187
- },
188
- },
189
- ];
190
- };
191
- this.createListMoveByIndex = (oid, fromIndex, toIndex) => {
192
- return [
193
- {
194
- oid,
195
- timestamp: this.getNow(),
196
- data: {
197
- op: 'list-move-by-index',
198
- from: fromIndex,
199
- to: toIndex,
200
- },
201
- },
202
- ];
203
- };
204
- this.createDelete = (oid) => {
205
- return [
206
- {
207
- oid,
208
- timestamp: this.getNow(),
209
- data: {
210
- op: 'delete',
211
- },
212
- },
213
- ];
214
- };
215
- this.createDeleteAll = (oids) => {
216
- return oids.map((oid) => ({
217
- oid,
218
- timestamp: this.getNow(),
219
- data: {
220
- op: 'delete',
221
- },
222
- }));
223
- };
224
- }
225
- }
226
- exports.PatchCreator = PatchCreator;
1
+ "use strict";
2
+ /**
3
+ * High-level patch creation for use with complex nested objects.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.PatchCreator = void 0;
7
+ const oids_js_1 = require("./oids.js");
8
+ const operation_js_1 = require("./operation.js");
9
+ const refs_js_1 = require("./refs.js");
10
+ const utils_js_1 = require("./utils.js");
11
+ class PatchCreator {
12
+ constructor(getNow, createSubId) {
13
+ this.getNow = getNow;
14
+ this.createSubId = createSubId;
15
+ this.createDiff = (from, to, options = {}) => {
16
+ return (0, operation_js_1.diffToPatches)(from, to, this.getNow, this.createSubId, [], options);
17
+ };
18
+ this.createInitialize = (obj, oid) => {
19
+ return (0, operation_js_1.initialToPatches)(obj, oid, this.getNow, this.createSubId);
20
+ };
21
+ this.createSet = (oid, key, value) => {
22
+ // incoming value must be normalized. if it's not a primitive, it and all sub-objects
23
+ // must be created
24
+ if (!(0, utils_js_1.isObject)(value) || (0, refs_js_1.isRef)(value)) {
25
+ return [
26
+ {
27
+ oid,
28
+ timestamp: this.getNow(),
29
+ data: {
30
+ op: 'set',
31
+ name: key,
32
+ value,
33
+ },
34
+ },
35
+ ];
36
+ }
37
+ else {
38
+ const itemOid = (0, oids_js_1.createSubOid)(oid, this.createSubId);
39
+ return [
40
+ // since we're setting a complex nested object, we can initialize it wholesale.
41
+ // no diffing to do.
42
+ ...(0, operation_js_1.initialToPatches)(value, itemOid, this.getNow),
43
+ // then set the reference to the object
44
+ {
45
+ oid,
46
+ timestamp: this.getNow(),
47
+ data: {
48
+ op: 'set',
49
+ value: (0, oids_js_1.createRef)(itemOid),
50
+ name: key,
51
+ },
52
+ },
53
+ ];
54
+ }
55
+ };
56
+ this.createRemove = (oid, key) => {
57
+ return [
58
+ {
59
+ oid,
60
+ timestamp: this.getNow(),
61
+ data: {
62
+ op: 'remove',
63
+ name: key,
64
+ },
65
+ },
66
+ ];
67
+ };
68
+ this.createListPush = (oid, value) => {
69
+ if (!(0, utils_js_1.isObject)(value)) {
70
+ return [
71
+ {
72
+ oid,
73
+ timestamp: this.getNow(),
74
+ data: {
75
+ op: 'list-push',
76
+ value,
77
+ },
78
+ },
79
+ ];
80
+ }
81
+ else {
82
+ const itemOid = (0, oids_js_1.createSubOid)(oid, this.createSubId);
83
+ return [
84
+ ...(0, operation_js_1.initialToPatches)(value, itemOid, this.getNow),
85
+ {
86
+ oid,
87
+ timestamp: this.getNow(),
88
+ data: {
89
+ op: 'list-push',
90
+ value: (0, oids_js_1.createRef)(itemOid),
91
+ },
92
+ },
93
+ ];
94
+ }
95
+ };
96
+ this.createListAdd = (oid, value) => {
97
+ if ((0, utils_js_1.isObject)(value)) {
98
+ return [
99
+ {
100
+ oid,
101
+ timestamp: this.getNow(),
102
+ data: {
103
+ op: 'list-add',
104
+ value: (0, oids_js_1.createRef)(value),
105
+ },
106
+ },
107
+ ];
108
+ }
109
+ else {
110
+ return [
111
+ {
112
+ oid,
113
+ timestamp: this.getNow(),
114
+ data: {
115
+ op: 'list-add',
116
+ value,
117
+ },
118
+ },
119
+ ];
120
+ }
121
+ };
122
+ this.createListInsert = (oid, index, value) => {
123
+ if (!(0, utils_js_1.isObject)(value)) {
124
+ return [
125
+ {
126
+ oid,
127
+ timestamp: this.getNow(),
128
+ data: {
129
+ op: 'list-insert',
130
+ value,
131
+ index,
132
+ },
133
+ },
134
+ ];
135
+ }
136
+ else {
137
+ const itemOid = (0, oids_js_1.createSubOid)(oid, this.createSubId);
138
+ return [
139
+ ...(0, operation_js_1.initialToPatches)(value, itemOid, this.getNow),
140
+ {
141
+ oid,
142
+ timestamp: this.getNow(),
143
+ data: {
144
+ op: 'list-insert',
145
+ value: (0, oids_js_1.createRef)(itemOid),
146
+ index,
147
+ },
148
+ },
149
+ ];
150
+ }
151
+ };
152
+ this.createListRemove = (oid, value, only) => {
153
+ return [
154
+ {
155
+ oid,
156
+ timestamp: this.getNow(),
157
+ data: {
158
+ op: 'list-remove',
159
+ value,
160
+ only,
161
+ },
162
+ },
163
+ ];
164
+ };
165
+ this.createListDelete = (oid, index, count = 1) => {
166
+ return [
167
+ {
168
+ oid,
169
+ timestamp: this.getNow(),
170
+ data: {
171
+ op: 'list-delete',
172
+ index,
173
+ count,
174
+ },
175
+ },
176
+ ];
177
+ };
178
+ this.createListMoveByRef = (oid, value, index) => {
179
+ return [
180
+ {
181
+ oid,
182
+ timestamp: this.getNow(),
183
+ data: {
184
+ op: 'list-move-by-ref',
185
+ value,
186
+ index,
187
+ },
188
+ },
189
+ ];
190
+ };
191
+ this.createListMoveByIndex = (oid, fromIndex, toIndex) => {
192
+ return [
193
+ {
194
+ oid,
195
+ timestamp: this.getNow(),
196
+ data: {
197
+ op: 'list-move-by-index',
198
+ from: fromIndex,
199
+ to: toIndex,
200
+ },
201
+ },
202
+ ];
203
+ };
204
+ this.createDelete = (oid) => {
205
+ return [
206
+ {
207
+ oid,
208
+ timestamp: this.getNow(),
209
+ data: {
210
+ op: 'delete',
211
+ },
212
+ },
213
+ ];
214
+ };
215
+ this.createDeleteAll = (oids) => {
216
+ return oids.map((oid) => ({
217
+ oid,
218
+ timestamp: this.getNow(),
219
+ data: {
220
+ op: 'delete',
221
+ },
222
+ }));
223
+ };
224
+ }
225
+ }
226
+ exports.PatchCreator = PatchCreator;
227
227
  //# sourceMappingURL=patch.js.map
@@ -1,27 +1,27 @@
1
- export interface UserInfo<Profile, Presence> {
2
- /**
3
- * This is the ID representing the user who is utilizing a
4
- * replica client to connect to the storage network.
5
- * One user may have multiple replica clients active at once,
6
- * but their presence will only reflect the most recent
7
- * replica used.
8
- */
9
- id: string;
10
- /**
11
- * This is the ID representing the replica client that is
12
- * connected to the storage network. This is used to
13
- * identify the client when sending messages to it.
14
- */
15
- replicaId: string;
16
- /**
17
- * This is the user's server profile. This data is associated
18
- * with the logged in user of the app and cannot be modified
19
- * by the local replica directly.
20
- */
21
- profile: Profile;
22
- /**
23
- * Presence info which can update frequently as a replica
24
- * makes changes. The shape of presence is up to you.
25
- */
26
- presence: Presence;
27
- }
1
+ export interface UserInfo<Profile, Presence> {
2
+ /**
3
+ * This is the ID representing the user who is utilizing a
4
+ * replica client to connect to the storage network.
5
+ * One user may have multiple replica clients active at once,
6
+ * but their presence will only reflect the most recent
7
+ * replica used.
8
+ */
9
+ id: string;
10
+ /**
11
+ * This is the ID representing the replica client that is
12
+ * connected to the storage network. This is used to
13
+ * identify the client when sending messages to it.
14
+ */
15
+ replicaId: string;
16
+ /**
17
+ * This is the user's server profile. This data is associated
18
+ * with the logged in user of the app and cannot be modified
19
+ * by the local replica directly.
20
+ */
21
+ profile: Profile;
22
+ /**
23
+ * Presence info which can update frequently as a replica
24
+ * makes changes. The shape of presence is up to you.
25
+ */
26
+ presence: Presence;
27
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=presence.js.map