@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.
Files changed (159) 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 +41 -41
  6. package/dist/cjs/batching.js +88 -88
  7. package/dist/cjs/files.d.ts +19 -19
  8. package/dist/cjs/files.js +18 -18
  9. package/dist/cjs/index.d.ts +18 -18
  10. package/dist/cjs/index.js +35 -35
  11. package/dist/cjs/indexes.d.ts +14 -14
  12. package/dist/cjs/indexes.js +115 -115
  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 +98 -98
  16. package/dist/cjs/migration.js +127 -127
  17. package/dist/cjs/oids.d.ts +85 -87
  18. package/dist/cjs/oids.js +363 -374
  19. package/dist/cjs/oids.js.map +1 -1
  20. package/dist/cjs/oids.test.d.ts +1 -1
  21. package/dist/cjs/oids.test.js +269 -251
  22. package/dist/cjs/oids.test.js.map +1 -1
  23. package/dist/cjs/operation.d.ts +139 -139
  24. package/dist/cjs/operation.js +532 -532
  25. package/dist/cjs/operation.js.map +1 -1
  26. package/dist/cjs/operation.test.d.ts +1 -1
  27. package/dist/cjs/operation.test.js +505 -505
  28. package/dist/cjs/operation.test.js.map +1 -1
  29. package/dist/cjs/patch.d.ts +26 -26
  30. package/dist/cjs/patch.js +226 -226
  31. package/dist/cjs/patch.js.map +1 -1
  32. package/dist/cjs/presence.d.ts +27 -27
  33. package/dist/cjs/presence.js +2 -2
  34. package/dist/cjs/protocol.d.ts +145 -145
  35. package/dist/cjs/protocol.js +3 -3
  36. package/dist/cjs/refs.d.ts +5 -5
  37. package/dist/cjs/refs.js +21 -21
  38. package/dist/cjs/replica.d.ts +28 -28
  39. package/dist/cjs/replica.js +28 -28
  40. package/dist/cjs/schema/defaults.d.ts +4 -4
  41. package/dist/cjs/schema/defaults.js +71 -71
  42. package/dist/cjs/schema/defaults.test.d.ts +1 -1
  43. package/dist/cjs/schema/defaults.test.js +20 -20
  44. package/dist/cjs/schema/defaults.test.js.map +1 -1
  45. package/dist/cjs/schema/index.d.ts +8 -8
  46. package/dist/cjs/schema/index.js +28 -28
  47. package/dist/cjs/schema/indexFilters.d.ts +6 -6
  48. package/dist/cjs/schema/indexFilters.js +30 -30
  49. package/dist/cjs/schema/types/collection.d.ts +51 -51
  50. package/dist/cjs/schema/types/collection.js +2 -2
  51. package/dist/cjs/schema/types/compounds.d.ts +12 -12
  52. package/dist/cjs/schema/types/compounds.js +2 -2
  53. package/dist/cjs/schema/types/fields.d.ts +59 -59
  54. package/dist/cjs/schema/types/fields.js +2 -2
  55. package/dist/cjs/schema/types/filters.d.ts +29 -29
  56. package/dist/cjs/schema/types/filters.js +2 -2
  57. package/dist/cjs/schema/types/shapes.d.ts +21 -21
  58. package/dist/cjs/schema/types/shapes.js +2 -2
  59. package/dist/cjs/schema/types/synthetics.d.ts +28 -28
  60. package/dist/cjs/schema/types/synthetics.js +2 -2
  61. package/dist/cjs/schema/types.d.ts +18 -18
  62. package/dist/cjs/schema/types.js +22 -22
  63. package/dist/cjs/timestamp.d.ts +48 -48
  64. package/dist/cjs/timestamp.js +243 -243
  65. package/dist/cjs/timestamp.test.d.ts +1 -1
  66. package/dist/cjs/timestamp.test.js +93 -93
  67. package/dist/cjs/undo.d.ts +3 -3
  68. package/dist/cjs/undo.js +198 -198
  69. package/dist/cjs/utils.d.ts +15 -15
  70. package/dist/cjs/utils.js +127 -127
  71. package/dist/cjs/utils.test.d.ts +1 -1
  72. package/dist/cjs/utils.test.js +36 -36
  73. package/dist/esm/EventSubscriber.d.ts +17 -17
  74. package/dist/esm/EventSubscriber.js +62 -62
  75. package/dist/esm/baseline.d.ts +5 -5
  76. package/dist/esm/baseline.js +1 -1
  77. package/dist/esm/batching.d.ts +41 -41
  78. package/dist/esm/batching.js +83 -83
  79. package/dist/esm/files.d.ts +19 -19
  80. package/dist/esm/files.js +12 -12
  81. package/dist/esm/index.d.ts +18 -18
  82. package/dist/esm/index.js +15 -15
  83. package/dist/esm/indexes.d.ts +14 -14
  84. package/dist/esm/indexes.js +105 -105
  85. package/dist/esm/indexes.test.d.ts +1 -1
  86. package/dist/esm/indexes.test.js +125 -125
  87. package/dist/esm/migration.d.ts +98 -98
  88. package/dist/esm/migration.js +121 -121
  89. package/dist/esm/oids.d.ts +85 -87
  90. package/dist/esm/oids.js +336 -347
  91. package/dist/esm/oids.js.map +1 -1
  92. package/dist/esm/oids.test.d.ts +1 -1
  93. package/dist/esm/oids.test.js +267 -249
  94. package/dist/esm/oids.test.js.map +1 -1
  95. package/dist/esm/operation.d.ts +139 -139
  96. package/dist/esm/operation.js +517 -517
  97. package/dist/esm/operation.js.map +1 -1
  98. package/dist/esm/operation.test.d.ts +1 -1
  99. package/dist/esm/operation.test.js +503 -503
  100. package/dist/esm/operation.test.js.map +1 -1
  101. package/dist/esm/patch.d.ts +26 -26
  102. package/dist/esm/patch.js +222 -222
  103. package/dist/esm/patch.js.map +1 -1
  104. package/dist/esm/presence.d.ts +27 -27
  105. package/dist/esm/presence.js +1 -1
  106. package/dist/esm/protocol.d.ts +145 -145
  107. package/dist/esm/protocol.js +2 -2
  108. package/dist/esm/refs.d.ts +5 -5
  109. package/dist/esm/refs.js +16 -16
  110. package/dist/esm/replica.d.ts +28 -28
  111. package/dist/esm/replica.js +25 -25
  112. package/dist/esm/schema/defaults.d.ts +4 -4
  113. package/dist/esm/schema/defaults.js +65 -65
  114. package/dist/esm/schema/defaults.test.d.ts +1 -1
  115. package/dist/esm/schema/defaults.test.js +18 -18
  116. package/dist/esm/schema/defaults.test.js.map +1 -1
  117. package/dist/esm/schema/index.d.ts +8 -8
  118. package/dist/esm/schema/index.js +9 -9
  119. package/dist/esm/schema/indexFilters.d.ts +6 -6
  120. package/dist/esm/schema/indexFilters.js +22 -22
  121. package/dist/esm/schema/types/collection.d.ts +51 -51
  122. package/dist/esm/schema/types/collection.js +1 -1
  123. package/dist/esm/schema/types/compounds.d.ts +12 -12
  124. package/dist/esm/schema/types/compounds.js +1 -1
  125. package/dist/esm/schema/types/fields.d.ts +59 -59
  126. package/dist/esm/schema/types/fields.js +1 -1
  127. package/dist/esm/schema/types/filters.d.ts +29 -29
  128. package/dist/esm/schema/types/filters.js +1 -1
  129. package/dist/esm/schema/types/shapes.d.ts +21 -21
  130. package/dist/esm/schema/types/shapes.js +1 -1
  131. package/dist/esm/schema/types/synthetics.d.ts +28 -28
  132. package/dist/esm/schema/types/synthetics.js +1 -1
  133. package/dist/esm/schema/types.d.ts +18 -18
  134. package/dist/esm/schema/types.js +6 -6
  135. package/dist/esm/timestamp.d.ts +48 -48
  136. package/dist/esm/timestamp.js +228 -228
  137. package/dist/esm/timestamp.test.d.ts +1 -1
  138. package/dist/esm/timestamp.test.js +91 -91
  139. package/dist/esm/undo.d.ts +3 -3
  140. package/dist/esm/undo.js +194 -194
  141. package/dist/esm/utils.d.ts +15 -15
  142. package/dist/esm/utils.js +113 -113
  143. package/dist/esm/utils.test.d.ts +1 -1
  144. package/dist/esm/utils.test.js +34 -34
  145. package/dist/tsconfig-cjs.tsbuildinfo +1 -1
  146. package/dist/tsconfig.tsbuildinfo +1 -1
  147. package/package.json +1 -1
  148. package/src/oids.test.ts +62 -51
  149. package/src/oids.ts +7 -26
  150. package/src/operation.test.ts +32 -40
  151. package/src/operation.ts +4 -16
  152. package/src/patch.ts +5 -15
  153. package/src/schema/defaults.test.ts +1 -1
  154. package/dist/cjs/files.test.d.ts +0 -1
  155. package/dist/cjs/files.test.js +0 -81
  156. package/dist/cjs/files.test.js.map +0 -1
  157. package/dist/esm/files.test.d.ts +0 -1
  158. package/dist/esm/files.test.js +0 -79
  159. package/dist/esm/files.test.js.map +0 -1
@@ -1,19 +1,19 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { createFileRef } from './files.js';
3
- import { assignOid, assignOidsToAllSubObjects, createRef, getOid, } from './oids.js';
4
- import { applyPatch, applyOperations, diffToPatches, initialToPatches, substituteRefsWithObjects, } from './operation.js';
5
- function createClock(init = 0) {
6
- let i = init;
7
- return () => (i++).toString();
8
- }
9
- describe('creating diff patch operations', () => {
10
- describe('on flat objects', () => {
11
- it('generates and applies set and remove operations', () => {
12
- const from = { foo: 'bar', baz: 'qux', zing: 1 };
13
- assignOid(from, 'test/a');
14
- const to = { foo: 'bar', baz: 'pop' };
15
- assignOid(to, 'test/a');
16
- const ops = diffToPatches(from, to, createClock(), []);
1
+ import { describe, expect, it } from 'vitest';
2
+ import { createFileRef } from './files.js';
3
+ import { assignOid, assignOidsToAllSubObjects, createRef, getOid, } from './oids.js';
4
+ import { applyPatch, applyOperations, diffToPatches, initialToPatches, substituteRefsWithObjects, } from './operation.js';
5
+ function createClock(init = 0) {
6
+ let i = init;
7
+ return () => (i++).toString();
8
+ }
9
+ describe('creating diff patch operations', () => {
10
+ describe('on flat objects', () => {
11
+ it('generates and applies set and remove operations', () => {
12
+ const from = { foo: 'bar', baz: 'qux', zing: 1 };
13
+ assignOid(from, 'test/a');
14
+ const to = { foo: 'bar', baz: 'pop' };
15
+ assignOid(to, 'test/a');
16
+ const ops = diffToPatches(from, to, createClock());
17
17
  expect(ops).toMatchInlineSnapshot(`
18
18
  [
19
19
  {
@@ -34,22 +34,22 @@ describe('creating diff patch operations', () => {
34
34
  "timestamp": "1",
35
35
  },
36
36
  ]
37
- `);
38
- const result = applyOperations(from, ops);
39
- expect(result).toEqual(to);
40
- });
41
- });
42
- describe('on nested objects', () => {
43
- it('replaces whole nested objects', () => {
44
- const from = assignOid({
45
- foo: 'bar',
46
- baz: assignOid({ qux: 'corge' }, 'test/a:0'),
47
- }, 'test/a');
48
- const to = assignOid({
49
- foo: 'bar',
50
- baz: assignOid({ qux: 'grault' }, 'test/a:1'),
51
- }, 'test/a');
52
- const patches = diffToPatches(from, to, createClock(), []);
37
+ `);
38
+ const result = applyOperations(from, ops);
39
+ expect(result).toEqual(to);
40
+ });
41
+ });
42
+ describe('on nested objects', () => {
43
+ it('replaces whole nested objects', () => {
44
+ const from = assignOid({
45
+ foo: 'bar',
46
+ baz: assignOid({ qux: 'corge' }, 'test/a:0'),
47
+ }, 'test/a');
48
+ const to = assignOid({
49
+ foo: 'bar',
50
+ baz: assignOid({ qux: 'grault' }, 'test/a:1'),
51
+ }, 'test/a');
52
+ const patches = diffToPatches(from, to, createClock());
53
53
  expect(patches).toMatchInlineSnapshot(`
54
54
  [
55
55
  {
@@ -82,22 +82,22 @@ describe('creating diff patch operations', () => {
82
82
  "timestamp": "2",
83
83
  },
84
84
  ]
85
- `);
86
- });
87
- it('replaces whole nested objects with different ids even if fields are the same', () => {
88
- const from = {
89
- foo: 'bar',
90
- baz: { qux: 'corge' },
91
- };
92
- assignOid(from, 'test/a');
93
- assignOid(from.baz, 'test/a:0');
94
- const to = {
95
- foo: 'bar',
96
- baz: { qux: 'corge' },
97
- };
98
- assignOid(to, 'test/a');
99
- assignOid(to.baz, 'test/a:1');
100
- const patches = diffToPatches(from, to, createClock(), []);
85
+ `);
86
+ });
87
+ it('replaces whole nested objects with different ids even if fields are the same', () => {
88
+ const from = {
89
+ foo: 'bar',
90
+ baz: { qux: 'corge' },
91
+ };
92
+ assignOid(from, 'test/a');
93
+ assignOid(from.baz, 'test/a:0');
94
+ const to = {
95
+ foo: 'bar',
96
+ baz: { qux: 'corge' },
97
+ };
98
+ assignOid(to, 'test/a');
99
+ assignOid(to.baz, 'test/a:1');
100
+ const patches = diffToPatches(from, to, createClock());
101
101
  expect(patches).toMatchInlineSnapshot(`
102
102
  [
103
103
  {
@@ -130,38 +130,38 @@ describe('creating diff patch operations', () => {
130
130
  "timestamp": "2",
131
131
  },
132
132
  ]
133
- `);
134
- });
135
- it('does not replace objects with the same identity and same fields', () => {
136
- const from = {
137
- foo: 'bar',
138
- baz: { qux: 'corge' },
139
- };
140
- assignOid(from, 'test/a');
141
- assignOid(from.baz, 'test/a:0');
142
- const to = {
143
- foo: 'bar',
144
- baz: { qux: 'corge' },
145
- };
146
- assignOid(to, 'test/a');
147
- assignOid(to.baz, 'test/a:0');
148
- const patches = diffToPatches(from, to, createClock(), []);
149
- expect(patches).toEqual([]);
150
- });
151
- it('patches sub-objects with same identity', () => {
152
- const from = {
153
- foo: 'bar',
154
- baz: { qux: 'corge' },
155
- };
156
- assignOid(from, 'test/a');
157
- assignOid(from.baz, 'test/a:0');
158
- const to = {
159
- foo: 'bar',
160
- baz: { qux: 'fig' },
161
- };
162
- assignOid(to, 'test/a');
163
- assignOid(to.baz, 'test/a:0');
164
- const patches = diffToPatches(from, to, createClock(), []);
133
+ `);
134
+ });
135
+ it('does not replace objects with the same identity and same fields', () => {
136
+ const from = {
137
+ foo: 'bar',
138
+ baz: { qux: 'corge' },
139
+ };
140
+ assignOid(from, 'test/a');
141
+ assignOid(from.baz, 'test/a:0');
142
+ const to = {
143
+ foo: 'bar',
144
+ baz: { qux: 'corge' },
145
+ };
146
+ assignOid(to, 'test/a');
147
+ assignOid(to.baz, 'test/a:0');
148
+ const patches = diffToPatches(from, to, createClock());
149
+ expect(patches).toEqual([]);
150
+ });
151
+ it('patches sub-objects with same identity', () => {
152
+ const from = {
153
+ foo: 'bar',
154
+ baz: { qux: 'corge' },
155
+ };
156
+ assignOid(from, 'test/a');
157
+ assignOid(from.baz, 'test/a:0');
158
+ const to = {
159
+ foo: 'bar',
160
+ baz: { qux: 'fig' },
161
+ };
162
+ assignOid(to, 'test/a');
163
+ assignOid(to.baz, 'test/a:0');
164
+ const patches = diffToPatches(from, to, createClock());
165
165
  expect(patches).toMatchInlineSnapshot(`
166
166
  [
167
167
  {
@@ -174,23 +174,23 @@ describe('creating diff patch operations', () => {
174
174
  "timestamp": "0",
175
175
  },
176
176
  ]
177
- `);
178
- });
179
- it('retains keys which are undefined in new object if defaultUndefined is set', () => {
180
- const from = {
181
- foo: 'bar',
182
- baz: { qux: 'corge' },
183
- };
184
- assignOid(from, 'test/a');
185
- assignOid(from.baz, 'test/a:0');
186
- const to = {
187
- foo: 'bip',
188
- };
189
- assignOid(to, 'test/a');
190
- const patches = diffToPatches(from, to, createClock(), [], undefined, [], {
191
- defaultUndefined: true,
192
- mergeUnknownObjects: true,
193
- });
177
+ `);
178
+ });
179
+ it('retains keys which are undefined in new object if defaultUndefined is set', () => {
180
+ const from = {
181
+ foo: 'bar',
182
+ baz: { qux: 'corge' },
183
+ };
184
+ assignOid(from, 'test/a');
185
+ assignOid(from.baz, 'test/a:0');
186
+ const to = {
187
+ foo: 'bip',
188
+ };
189
+ assignOid(to, 'test/a');
190
+ const patches = diffToPatches(from, to, createClock(), undefined, [], {
191
+ defaultUndefined: true,
192
+ mergeUnknownObjects: true,
193
+ });
194
194
  expect(patches).toMatchInlineSnapshot(`
195
195
  [
196
196
  {
@@ -203,75 +203,75 @@ describe('creating diff patch operations', () => {
203
203
  "timestamp": "0",
204
204
  },
205
205
  ]
206
- `);
207
- });
208
- });
209
- describe('on lists of primitives', () => {
210
- it('pushes items', async () => {
211
- expect(applyOperations(assignOid(['foo', 'bar'], 'test/a'), [
212
- {
213
- oid: 'test/a',
214
- timestamp: 'meh',
215
- data: {
216
- op: 'list-push',
217
- value: 'baz',
218
- },
219
- },
220
- ])).toEqual(assignOid(['foo', 'bar', 'baz'], 'test/a'));
221
- });
222
- it.todo('sets items');
223
- it.todo('inserts items');
224
- it.todo('removes items by index');
225
- it.todo('removes items by value');
226
- it.todo('moves items by index');
227
- it.todo('moves items by value');
228
- });
229
- describe.todo('on lists of objects', () => {
230
- it.todo('pushes items');
231
- it.todo('moves objects by identity');
232
- it.todo('removes objects by identity');
233
- });
234
- describe.todo('on lists of lists', () => {
235
- it.todo('rejects operations by value or identity');
236
- });
237
- it('should work for complex nested arrays and objects', () => {
238
- const from = {
239
- foo: {
240
- bar: [1, 2, 3],
241
- },
242
- baz: [
243
- {
244
- corge: true,
245
- },
246
- ],
247
- };
248
- assignOid(from, 'test/a');
249
- assignOid(from.foo, 'test/a:1');
250
- assignOid(from.foo.bar, 'test/a:2');
251
- assignOid(from.baz, 'test/a:3');
252
- assignOid(from.baz[0], 'test/a:4');
253
- const to = {
254
- foo: {
255
- bar: [1, 2],
256
- bop: [0],
257
- },
258
- baz: [
259
- {
260
- corge: false,
261
- },
262
- {
263
- corge: false,
264
- },
265
- ],
266
- };
267
- assignOid(to, 'test/a');
268
- assignOid(to.foo, 'test/a:1');
269
- assignOid(to.foo.bar, 'test/a:2');
270
- assignOid(to.foo.bop, 'test/a:6');
271
- assignOid(to.baz, 'test/a:3');
272
- assignOid(to.baz[0], 'test/a:4');
273
- assignOid(to.baz[1], 'test/a:5');
274
- expect(diffToPatches(from, to, createClock(), [])).toMatchInlineSnapshot(`
206
+ `);
207
+ });
208
+ });
209
+ describe('on lists of primitives', () => {
210
+ it('pushes items', async () => {
211
+ expect(applyOperations(assignOid(['foo', 'bar'], 'test/a'), [
212
+ {
213
+ oid: 'test/a',
214
+ timestamp: 'meh',
215
+ data: {
216
+ op: 'list-push',
217
+ value: 'baz',
218
+ },
219
+ },
220
+ ])).toEqual(assignOid(['foo', 'bar', 'baz'], 'test/a'));
221
+ });
222
+ it.todo('sets items');
223
+ it.todo('inserts items');
224
+ it.todo('removes items by index');
225
+ it.todo('removes items by value');
226
+ it.todo('moves items by index');
227
+ it.todo('moves items by value');
228
+ });
229
+ describe.todo('on lists of objects', () => {
230
+ it.todo('pushes items');
231
+ it.todo('moves objects by identity');
232
+ it.todo('removes objects by identity');
233
+ });
234
+ describe.todo('on lists of lists', () => {
235
+ it.todo('rejects operations by value or identity');
236
+ });
237
+ it('should work for complex nested arrays and objects', () => {
238
+ const from = {
239
+ foo: {
240
+ bar: [1, 2, 3],
241
+ },
242
+ baz: [
243
+ {
244
+ corge: true,
245
+ },
246
+ ],
247
+ };
248
+ assignOid(from, 'test/a');
249
+ assignOid(from.foo, 'test/a:1');
250
+ assignOid(from.foo.bar, 'test/a:2');
251
+ assignOid(from.baz, 'test/a:3');
252
+ assignOid(from.baz[0], 'test/a:4');
253
+ const to = {
254
+ foo: {
255
+ bar: [1, 2],
256
+ bop: [0],
257
+ },
258
+ baz: [
259
+ {
260
+ corge: false,
261
+ },
262
+ {
263
+ corge: false,
264
+ },
265
+ ],
266
+ };
267
+ assignOid(to, 'test/a');
268
+ assignOid(to.foo, 'test/a:1');
269
+ assignOid(to.foo.bar, 'test/a:2');
270
+ assignOid(to.foo.bop, 'test/a:6');
271
+ assignOid(to.baz, 'test/a:3');
272
+ assignOid(to.baz[0], 'test/a:4');
273
+ assignOid(to.baz[1], 'test/a:5');
274
+ expect(diffToPatches(from, to, createClock())).toMatchInlineSnapshot(`
275
275
  [
276
276
  {
277
277
  "data": {
@@ -336,37 +336,37 @@ describe('creating diff patch operations', () => {
336
336
  "timestamp": "5",
337
337
  },
338
338
  ]
339
- `);
340
- });
341
- it('should try to merge unknown objects if specified to do so', () => {
342
- const from = {
343
- foo: {
344
- bar: [1, 2, 3],
345
- },
346
- baz: [
347
- {
348
- corge: true,
349
- },
350
- ],
351
- };
352
- assignOid(from, 'test/a');
353
- assignOidsToAllSubObjects(from, createClock());
354
- const to = {
355
- foo: {
356
- bar: [1, 2],
357
- bop: [0],
358
- },
359
- baz: [
360
- {
361
- corge: false,
362
- },
363
- {
364
- corge: false,
365
- },
366
- ],
367
- };
368
- expect(diffToPatches(from, to, createClock(), [], createClock(5), [], {
369
- mergeUnknownObjects: true,
339
+ `);
340
+ });
341
+ it('should try to merge unknown objects if specified to do so', () => {
342
+ const from = {
343
+ foo: {
344
+ bar: [1, 2, 3],
345
+ },
346
+ baz: [
347
+ {
348
+ corge: true,
349
+ },
350
+ ],
351
+ };
352
+ assignOid(from, 'test/a');
353
+ assignOidsToAllSubObjects(from, createClock());
354
+ const to = {
355
+ foo: {
356
+ bar: [1, 2],
357
+ bop: [0],
358
+ },
359
+ baz: [
360
+ {
361
+ corge: false,
362
+ },
363
+ {
364
+ corge: false,
365
+ },
366
+ ],
367
+ };
368
+ expect(diffToPatches(from, to, createClock(), createClock(5), [], {
369
+ mergeUnknownObjects: true,
370
370
  })).toMatchInlineSnapshot(`
371
371
  [
372
372
  {
@@ -375,7 +375,7 @@ describe('creating diff patch operations', () => {
375
375
  "index": 2,
376
376
  "op": "list-delete",
377
377
  },
378
- "oid": "test/a.foo.bar:1",
378
+ "oid": "test/a:1",
379
379
  "timestamp": "0",
380
380
  },
381
381
  {
@@ -385,7 +385,7 @@ describe('creating diff patch operations', () => {
385
385
  0,
386
386
  ],
387
387
  },
388
- "oid": "test/a.foo.bop:5",
388
+ "oid": "test/a:5",
389
389
  "timestamp": "1",
390
390
  },
391
391
  {
@@ -394,10 +394,10 @@ describe('creating diff patch operations', () => {
394
394
  "op": "set",
395
395
  "value": {
396
396
  "@@type": "ref",
397
- "id": "test/a.foo.bop:5",
397
+ "id": "test/a:5",
398
398
  },
399
399
  },
400
- "oid": "test/a.foo:0",
400
+ "oid": "test/a:0",
401
401
  "timestamp": "2",
402
402
  },
403
403
  {
@@ -406,7 +406,7 @@ describe('creating diff patch operations', () => {
406
406
  "op": "set",
407
407
  "value": false,
408
408
  },
409
- "oid": "test/a.baz.#:3",
409
+ "oid": "test/a:3",
410
410
  "timestamp": "3",
411
411
  },
412
412
  {
@@ -416,7 +416,7 @@ describe('creating diff patch operations', () => {
416
416
  "corge": false,
417
417
  },
418
418
  },
419
- "oid": "test/a.baz.#:6",
419
+ "oid": "test/a:6",
420
420
  "timestamp": "4",
421
421
  },
422
422
  {
@@ -425,32 +425,32 @@ describe('creating diff patch operations', () => {
425
425
  "op": "set",
426
426
  "value": {
427
427
  "@@type": "ref",
428
- "id": "test/a.baz.#:6",
428
+ "id": "test/a:6",
429
429
  },
430
430
  },
431
- "oid": "test/a.baz:2",
431
+ "oid": "test/a:2",
432
432
  "timestamp": "5",
433
433
  },
434
434
  ]
435
- `);
436
- });
437
- it('should not diff file refs', () => {
438
- const from = {
439
- foo: {
440
- file: createFileRef('abc123'),
441
- },
442
- bar: [createFileRef('def456'), createFileRef('ghi789')],
443
- };
444
- assignOid(from, 'test/a');
445
- assignOidsToAllSubObjects(from, createClock());
446
- const to = {
447
- foo: {
448
- file: createFileRef('abc456'),
449
- },
450
- bar: [createFileRef('def456')],
451
- };
452
- expect(diffToPatches(from, to, createClock(), [], createClock(5), [], {
453
- mergeUnknownObjects: true,
435
+ `);
436
+ });
437
+ it('should not diff file refs', () => {
438
+ const from = {
439
+ foo: {
440
+ file: createFileRef('abc123'),
441
+ },
442
+ bar: [createFileRef('def456'), createFileRef('ghi789')],
443
+ };
444
+ assignOid(from, 'test/a');
445
+ assignOidsToAllSubObjects(from, createClock());
446
+ const to = {
447
+ foo: {
448
+ file: createFileRef('abc456'),
449
+ },
450
+ bar: [createFileRef('def456')],
451
+ };
452
+ expect(diffToPatches(from, to, createClock(), createClock(5), [], {
453
+ mergeUnknownObjects: true,
454
454
  })).toMatchInlineSnapshot(`
455
455
  [
456
456
  {
@@ -462,7 +462,7 @@ describe('creating diff patch operations', () => {
462
462
  "id": "abc456",
463
463
  },
464
464
  },
465
- "oid": "test/a.foo:0",
465
+ "oid": "test/a:0",
466
466
  "timestamp": "0",
467
467
  },
468
468
  {
@@ -471,161 +471,161 @@ describe('creating diff patch operations', () => {
471
471
  "index": 1,
472
472
  "op": "list-delete",
473
473
  },
474
- "oid": "test/a.bar:1",
474
+ "oid": "test/a:1",
475
475
  "timestamp": "1",
476
476
  },
477
477
  ]
478
- `);
479
- });
480
- });
481
- describe('substituting refs with objects', () => {
482
- it('does nothing when no refs exist', () => {
483
- const root = {
484
- foo: 'bar',
485
- };
486
- assignOid(root, 'test/a');
487
- const substituted = substituteRefsWithObjects(root, new Map());
488
- expect(root).toEqual(assignOid({
489
- foo: 'bar',
490
- }, 'test/a'));
491
- expect(substituted).toEqual([]);
492
- });
493
- it('inserts top level objects with oids', () => {
494
- const root = {
495
- foo: {
496
- '@@type': 'ref',
497
- id: 'test/1:a',
498
- },
499
- qux: 1,
500
- };
501
- assignOid(root, 'test/1');
502
- const substituted = substituteRefsWithObjects(root, new Map([['test/1:a', { foo: 'bar' }]]));
503
- expect(root).toEqual(assignOid({
504
- foo: assignOid({
505
- foo: 'bar',
506
- }, 'test/1:a'),
507
- qux: 1,
508
- }, 'test/1'));
509
- expect(substituted).toEqual(['test/1:a']);
510
- expect(getOid(root)).toEqual('test/1');
511
- expect(getOid(root.foo)).toEqual('test/1:a');
512
- });
513
- it('inserts nested objects with oids', () => {
514
- const root = {
515
- foo: {
516
- '@@type': 'ref',
517
- id: 'test/1:a',
518
- },
519
- };
520
- assignOid(root, 'test/1');
521
- const substituted = substituteRefsWithObjects(root, new Map([
522
- [
523
- 'test/1:a',
524
- {
525
- foo: 'bar',
526
- baz: {
527
- '@@type': 'ref',
528
- id: 'test/1:b',
529
- },
530
- },
531
- ],
532
- [
533
- 'test/1:b',
534
- {
535
- qux: 'corge',
536
- },
537
- ],
538
- ]));
539
- expect(root).toEqual(assignOid({
540
- foo: assignOid({
541
- foo: 'bar',
542
- baz: assignOid({
543
- qux: 'corge',
544
- }, 'test/1:b'),
545
- }, 'test/1:a'),
546
- }, 'test/1'));
547
- expect(substituted).toEqual(['test/1:a', 'test/1:b']);
548
- expect(getOid(root)).toEqual('test/1');
549
- expect(getOid(root.foo)).toEqual('test/1:a');
550
- expect(getOid(root.foo.baz)).toEqual('test/1:b');
551
- });
552
- it('substitutes arrays of objects', () => {
553
- const root = {
554
- foo: {
555
- '@@type': 'ref',
556
- id: 'test/1:c',
557
- },
558
- };
559
- assignOid(root, 'test/1');
560
- const substituted = substituteRefsWithObjects(root, new Map([
561
- [
562
- 'test/1:c',
563
- [
564
- {
565
- '@@type': 'ref',
566
- id: 'test/1:a',
567
- },
568
- {
569
- '@@type': 'ref',
570
- id: 'test/1:b',
571
- },
572
- ],
573
- ],
574
- [
575
- 'test/1:a',
576
- {
577
- foo: 'bar',
578
- },
579
- ],
580
- [
581
- 'test/1:b',
582
- {
583
- qux: 'corge',
584
- },
585
- ],
586
- ]));
587
- expect(root).toEqual({
588
- foo: assignOid([
589
- assignOid({
590
- foo: 'bar',
591
- }, 'test/1:a'),
592
- assignOid({
593
- qux: 'corge',
594
- }, 'test/1:b'),
595
- ], 'test/1:c'),
596
- });
597
- expect(substituted).toEqual(['test/1:c', 'test/1:a', 'test/1:b']);
598
- expect(getOid(root)).toEqual('test/1');
599
- expect(getOid(root.foo)).toEqual('test/1:c');
600
- expect(getOid(root.foo[0])).toEqual('test/1:a');
601
- expect(getOid(root.foo[1])).toEqual('test/1:b');
602
- });
603
- it.todo('substitutes arrays of arrays of objects');
604
- });
605
- describe('creating patches from initial state', () => {
606
- it('adds oids to all sub-objects', async () => {
607
- let i = 0;
608
- function createSubId() {
609
- return (i++).toString();
610
- }
611
- const result = initialToPatches({
612
- foo: {
613
- bar: 'baz',
614
- },
615
- qux: [
616
- {
617
- corge: 'grault',
618
- },
619
- {
620
- bin: {
621
- oof: 1,
622
- },
623
- },
624
- ],
625
- }, 'test/a', createClock(), createSubId);
626
- /**
627
- * Patches should not include assigned OID property
628
- */
478
+ `);
479
+ });
480
+ });
481
+ describe('substituting refs with objects', () => {
482
+ it('does nothing when no refs exist', () => {
483
+ const root = {
484
+ foo: 'bar',
485
+ };
486
+ assignOid(root, 'test/a');
487
+ const substituted = substituteRefsWithObjects(root, new Map());
488
+ expect(root).toEqual(assignOid({
489
+ foo: 'bar',
490
+ }, 'test/a'));
491
+ expect(substituted).toEqual([]);
492
+ });
493
+ it('inserts top level objects with oids', () => {
494
+ const root = {
495
+ foo: {
496
+ '@@type': 'ref',
497
+ id: 'test/1:a',
498
+ },
499
+ qux: 1,
500
+ };
501
+ assignOid(root, 'test/1');
502
+ const substituted = substituteRefsWithObjects(root, new Map([['test/1:a', { foo: 'bar' }]]));
503
+ expect(root).toEqual(assignOid({
504
+ foo: assignOid({
505
+ foo: 'bar',
506
+ }, 'test/1:a'),
507
+ qux: 1,
508
+ }, 'test/1'));
509
+ expect(substituted).toEqual(['test/1:a']);
510
+ expect(getOid(root)).toEqual('test/1');
511
+ expect(getOid(root.foo)).toEqual('test/1:a');
512
+ });
513
+ it('inserts nested objects with oids', () => {
514
+ const root = {
515
+ foo: {
516
+ '@@type': 'ref',
517
+ id: 'test/1:a',
518
+ },
519
+ };
520
+ assignOid(root, 'test/1');
521
+ const substituted = substituteRefsWithObjects(root, new Map([
522
+ [
523
+ 'test/1:a',
524
+ {
525
+ foo: 'bar',
526
+ baz: {
527
+ '@@type': 'ref',
528
+ id: 'test/1:b',
529
+ },
530
+ },
531
+ ],
532
+ [
533
+ 'test/1:b',
534
+ {
535
+ qux: 'corge',
536
+ },
537
+ ],
538
+ ]));
539
+ expect(root).toEqual(assignOid({
540
+ foo: assignOid({
541
+ foo: 'bar',
542
+ baz: assignOid({
543
+ qux: 'corge',
544
+ }, 'test/1:b'),
545
+ }, 'test/1:a'),
546
+ }, 'test/1'));
547
+ expect(substituted).toEqual(['test/1:a', 'test/1:b']);
548
+ expect(getOid(root)).toEqual('test/1');
549
+ expect(getOid(root.foo)).toEqual('test/1:a');
550
+ expect(getOid(root.foo.baz)).toEqual('test/1:b');
551
+ });
552
+ it('substitutes arrays of objects', () => {
553
+ const root = {
554
+ foo: {
555
+ '@@type': 'ref',
556
+ id: 'test/1:c',
557
+ },
558
+ };
559
+ assignOid(root, 'test/1');
560
+ const substituted = substituteRefsWithObjects(root, new Map([
561
+ [
562
+ 'test/1:c',
563
+ [
564
+ {
565
+ '@@type': 'ref',
566
+ id: 'test/1:a',
567
+ },
568
+ {
569
+ '@@type': 'ref',
570
+ id: 'test/1:b',
571
+ },
572
+ ],
573
+ ],
574
+ [
575
+ 'test/1:a',
576
+ {
577
+ foo: 'bar',
578
+ },
579
+ ],
580
+ [
581
+ 'test/1:b',
582
+ {
583
+ qux: 'corge',
584
+ },
585
+ ],
586
+ ]));
587
+ expect(root).toEqual({
588
+ foo: assignOid([
589
+ assignOid({
590
+ foo: 'bar',
591
+ }, 'test/1:a'),
592
+ assignOid({
593
+ qux: 'corge',
594
+ }, 'test/1:b'),
595
+ ], 'test/1:c'),
596
+ });
597
+ expect(substituted).toEqual(['test/1:c', 'test/1:a', 'test/1:b']);
598
+ expect(getOid(root)).toEqual('test/1');
599
+ expect(getOid(root.foo)).toEqual('test/1:c');
600
+ expect(getOid(root.foo[0])).toEqual('test/1:a');
601
+ expect(getOid(root.foo[1])).toEqual('test/1:b');
602
+ });
603
+ it.todo('substitutes arrays of arrays of objects');
604
+ });
605
+ describe('creating patches from initial state', () => {
606
+ it('adds oids to all sub-objects', async () => {
607
+ let i = 0;
608
+ function createSubId() {
609
+ return (i++).toString();
610
+ }
611
+ const result = initialToPatches({
612
+ foo: {
613
+ bar: 'baz',
614
+ },
615
+ qux: [
616
+ {
617
+ corge: 'grault',
618
+ },
619
+ {
620
+ bin: {
621
+ oof: 1,
622
+ },
623
+ },
624
+ ],
625
+ }, 'test/a', createClock(), createSubId);
626
+ /**
627
+ * Patches should not include assigned OID property
628
+ */
629
629
  expect(result).toMatchInlineSnapshot(`
630
630
  [
631
631
  {
@@ -635,7 +635,7 @@ describe('creating patches from initial state', () => {
635
635
  "bar": "baz",
636
636
  },
637
637
  },
638
- "oid": "test/a.foo:0",
638
+ "oid": "test/a:0",
639
639
  "timestamp": "0",
640
640
  },
641
641
  {
@@ -645,7 +645,7 @@ describe('creating patches from initial state', () => {
645
645
  "corge": "grault",
646
646
  },
647
647
  },
648
- "oid": "test/a.qux.#:2",
648
+ "oid": "test/a:2",
649
649
  "timestamp": "1",
650
650
  },
651
651
  {
@@ -655,7 +655,7 @@ describe('creating patches from initial state', () => {
655
655
  "oof": 1,
656
656
  },
657
657
  },
658
- "oid": "test/a.qux.#.bin:4",
658
+ "oid": "test/a:4",
659
659
  "timestamp": "2",
660
660
  },
661
661
  {
@@ -664,11 +664,11 @@ describe('creating patches from initial state', () => {
664
664
  "value": {
665
665
  "bin": {
666
666
  "@@type": "ref",
667
- "id": "test/a.qux.#.bin:4",
667
+ "id": "test/a:4",
668
668
  },
669
669
  },
670
670
  },
671
- "oid": "test/a.qux.#:3",
671
+ "oid": "test/a:3",
672
672
  "timestamp": "3",
673
673
  },
674
674
  {
@@ -677,15 +677,15 @@ describe('creating patches from initial state', () => {
677
677
  "value": [
678
678
  {
679
679
  "@@type": "ref",
680
- "id": "test/a.qux.#:2",
680
+ "id": "test/a:2",
681
681
  },
682
682
  {
683
683
  "@@type": "ref",
684
- "id": "test/a.qux.#:3",
684
+ "id": "test/a:3",
685
685
  },
686
686
  ],
687
687
  },
688
- "oid": "test/a.qux:1",
688
+ "oid": "test/a:1",
689
689
  "timestamp": "4",
690
690
  },
691
691
  {
@@ -694,11 +694,11 @@ describe('creating patches from initial state', () => {
694
694
  "value": {
695
695
  "foo": {
696
696
  "@@type": "ref",
697
- "id": "test/a.foo:0",
697
+ "id": "test/a:0",
698
698
  },
699
699
  "qux": {
700
700
  "@@type": "ref",
701
- "id": "test/a.qux:1",
701
+ "id": "test/a:1",
702
702
  },
703
703
  },
704
704
  },
@@ -706,120 +706,120 @@ describe('creating patches from initial state', () => {
706
706
  "timestamp": "5",
707
707
  },
708
708
  ]
709
- `);
710
- });
711
- });
712
- describe('applying individual operations', () => {
713
- it('applies a list-remove of only the last instance', () => {
714
- expect(applyPatch(['a', 'b', 'c', 'a', 'b'], {
715
- op: 'list-remove',
716
- value: 'a',
717
- only: 'last',
718
- })).toEqual(['a', 'b', 'c', 'b']);
719
- });
720
- it('applies a list-remove of only the first instance', () => {
721
- expect(applyPatch(['a', 'b', 'c', 'a', 'b'], {
722
- op: 'list-remove',
723
- value: 'a',
724
- only: 'first',
725
- })).toEqual(['b', 'c', 'a', 'b']);
726
- });
727
- it('applies a list-remove of all instances', () => {
728
- expect(applyPatch(['a', 'b', 'c', 'a', 'b'], {
729
- op: 'list-remove',
730
- value: 'a',
731
- })).toEqual(['b', 'c', 'b']);
732
- });
733
- it('applies a list-remove of an object ref', () => {
734
- expect(applyPatch([
735
- createRef('a'),
736
- createRef('b'),
737
- createRef('c'),
738
- createRef('a'),
739
- createRef('b'),
740
- ], {
741
- op: 'list-remove',
742
- value: createRef('a'),
743
- only: 'last',
744
- })).toEqual([createRef('a'), createRef('b'), createRef('c'), createRef('b')]);
745
- });
746
- it('applies a list-add of a nonexistent item', () => {
747
- expect(applyPatch(['a', 'b', 'c'], {
748
- op: 'list-add',
749
- value: 'd',
750
- })).toEqual(['a', 'b', 'c', 'd']);
751
- });
752
- it('does not apply a list-add if the item is already present', () => {
753
- expect(applyPatch(['a', 'b', 'c'], {
754
- op: 'list-add',
755
- value: 'b',
756
- })).toEqual(['a', 'b', 'c']);
757
- });
758
- });
759
- describe('collecting deleted refs during patch application', () => {
760
- it('collects refs that are removed from a list', () => {
761
- const refs = [];
762
- expect(applyPatch([
763
- createRef('a'),
764
- createRef('b'),
765
- createRef('c'),
766
- createRef('d'),
767
- createRef('e'),
768
- ], {
769
- op: 'list-remove',
770
- value: createRef('c'),
771
- }, refs)).toEqual([createRef('a'), createRef('b'), createRef('d'), createRef('e')]);
772
- expect(refs).toEqual([createRef('c')]);
773
- });
774
- it('collects a deleted ref field from an object', () => {
775
- const refs = [];
776
- expect(applyPatch({
777
- a: createRef('a'),
778
- b: createRef('b'),
779
- c: createRef('c'),
780
- }, {
781
- op: 'remove',
782
- name: 'b',
783
- }, refs)).toEqual({
784
- a: createRef('a'),
785
- c: createRef('c'),
786
- });
787
- expect(refs).toEqual([createRef('b')]);
788
- });
789
- it('collects all refs in a deleted object', () => {
790
- const refs = [];
791
- expect(applyPatch({
792
- a: createRef('a'),
793
- b: createRef('b'),
794
- c: createRef('c'),
795
- }, {
796
- op: 'delete',
797
- }, refs)).toEqual(undefined);
798
- expect(refs).toEqual([createRef('a'), createRef('b'), createRef('c')]);
799
- });
800
- it('collects all refs in a deleted list', () => {
801
- const refs = [];
802
- expect(applyPatch([createRef('a'), createRef('b'), createRef('c')], {
803
- op: 'delete',
804
- }, refs)).toEqual(undefined);
805
- expect(refs).toEqual([createRef('a'), createRef('b'), createRef('c')]);
806
- });
807
- it('collects a ref in a replaced field', () => {
808
- const refs = [];
809
- expect(applyPatch({
810
- a: createRef('a'),
811
- b: createRef('b'),
812
- c: createRef('c'),
813
- }, {
814
- op: 'set',
815
- name: 'b',
816
- value: createRef('d'),
817
- }, refs)).toEqual({
818
- a: createRef('a'),
819
- b: createRef('d'),
820
- c: createRef('c'),
821
- });
822
- expect(refs).toEqual([createRef('b')]);
823
- });
824
- });
709
+ `);
710
+ });
711
+ });
712
+ describe('applying individual operations', () => {
713
+ it('applies a list-remove of only the last instance', () => {
714
+ expect(applyPatch(['a', 'b', 'c', 'a', 'b'], {
715
+ op: 'list-remove',
716
+ value: 'a',
717
+ only: 'last',
718
+ })).toEqual(['a', 'b', 'c', 'b']);
719
+ });
720
+ it('applies a list-remove of only the first instance', () => {
721
+ expect(applyPatch(['a', 'b', 'c', 'a', 'b'], {
722
+ op: 'list-remove',
723
+ value: 'a',
724
+ only: 'first',
725
+ })).toEqual(['b', 'c', 'a', 'b']);
726
+ });
727
+ it('applies a list-remove of all instances', () => {
728
+ expect(applyPatch(['a', 'b', 'c', 'a', 'b'], {
729
+ op: 'list-remove',
730
+ value: 'a',
731
+ })).toEqual(['b', 'c', 'b']);
732
+ });
733
+ it('applies a list-remove of an object ref', () => {
734
+ expect(applyPatch([
735
+ createRef('a'),
736
+ createRef('b'),
737
+ createRef('c'),
738
+ createRef('a'),
739
+ createRef('b'),
740
+ ], {
741
+ op: 'list-remove',
742
+ value: createRef('a'),
743
+ only: 'last',
744
+ })).toEqual([createRef('a'), createRef('b'), createRef('c'), createRef('b')]);
745
+ });
746
+ it('applies a list-add of a nonexistent item', () => {
747
+ expect(applyPatch(['a', 'b', 'c'], {
748
+ op: 'list-add',
749
+ value: 'd',
750
+ })).toEqual(['a', 'b', 'c', 'd']);
751
+ });
752
+ it('does not apply a list-add if the item is already present', () => {
753
+ expect(applyPatch(['a', 'b', 'c'], {
754
+ op: 'list-add',
755
+ value: 'b',
756
+ })).toEqual(['a', 'b', 'c']);
757
+ });
758
+ });
759
+ describe('collecting deleted refs during patch application', () => {
760
+ it('collects refs that are removed from a list', () => {
761
+ const refs = [];
762
+ expect(applyPatch([
763
+ createRef('a'),
764
+ createRef('b'),
765
+ createRef('c'),
766
+ createRef('d'),
767
+ createRef('e'),
768
+ ], {
769
+ op: 'list-remove',
770
+ value: createRef('c'),
771
+ }, refs)).toEqual([createRef('a'), createRef('b'), createRef('d'), createRef('e')]);
772
+ expect(refs).toEqual([createRef('c')]);
773
+ });
774
+ it('collects a deleted ref field from an object', () => {
775
+ const refs = [];
776
+ expect(applyPatch({
777
+ a: createRef('a'),
778
+ b: createRef('b'),
779
+ c: createRef('c'),
780
+ }, {
781
+ op: 'remove',
782
+ name: 'b',
783
+ }, refs)).toEqual({
784
+ a: createRef('a'),
785
+ c: createRef('c'),
786
+ });
787
+ expect(refs).toEqual([createRef('b')]);
788
+ });
789
+ it('collects all refs in a deleted object', () => {
790
+ const refs = [];
791
+ expect(applyPatch({
792
+ a: createRef('a'),
793
+ b: createRef('b'),
794
+ c: createRef('c'),
795
+ }, {
796
+ op: 'delete',
797
+ }, refs)).toEqual(undefined);
798
+ expect(refs).toEqual([createRef('a'), createRef('b'), createRef('c')]);
799
+ });
800
+ it('collects all refs in a deleted list', () => {
801
+ const refs = [];
802
+ expect(applyPatch([createRef('a'), createRef('b'), createRef('c')], {
803
+ op: 'delete',
804
+ }, refs)).toEqual(undefined);
805
+ expect(refs).toEqual([createRef('a'), createRef('b'), createRef('c')]);
806
+ });
807
+ it('collects a ref in a replaced field', () => {
808
+ const refs = [];
809
+ expect(applyPatch({
810
+ a: createRef('a'),
811
+ b: createRef('b'),
812
+ c: createRef('c'),
813
+ }, {
814
+ op: 'set',
815
+ name: 'b',
816
+ value: createRef('d'),
817
+ }, refs)).toEqual({
818
+ a: createRef('a'),
819
+ b: createRef('d'),
820
+ c: createRef('c'),
821
+ });
822
+ expect(refs).toEqual([createRef('b')]);
823
+ });
824
+ });
825
825
  //# sourceMappingURL=operation.test.js.map