@verdant-web/common 1.15.2 → 1.15.3-next.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 (163) 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/files.test.d.ts +1 -0
  10. package/dist/cjs/files.test.js +81 -0
  11. package/dist/cjs/files.test.js.map +1 -0
  12. package/dist/cjs/index.d.ts +19 -18
  13. package/dist/cjs/index.js +41 -36
  14. package/dist/cjs/index.js.map +1 -1
  15. package/dist/cjs/indexes.d.ts +17 -17
  16. package/dist/cjs/indexes.js +142 -142
  17. package/dist/cjs/indexes.test.d.ts +1 -1
  18. package/dist/cjs/indexes.test.js +127 -127
  19. package/dist/cjs/migration.d.ts +172 -172
  20. package/dist/cjs/migration.js +301 -301
  21. package/dist/cjs/oids.d.ts +100 -96
  22. package/dist/cjs/oids.js +457 -439
  23. package/dist/cjs/oids.js.map +1 -1
  24. package/dist/cjs/oids.test.d.ts +1 -1
  25. package/dist/cjs/oids.test.js +348 -272
  26. package/dist/cjs/oids.test.js.map +1 -1
  27. package/dist/cjs/operation.d.ts +139 -139
  28. package/dist/cjs/operation.js +545 -545
  29. package/dist/cjs/operation.test.d.ts +1 -1
  30. package/dist/cjs/operation.test.js +529 -529
  31. package/dist/cjs/patch.d.ts +26 -26
  32. package/dist/cjs/patch.js +226 -226
  33. package/dist/cjs/presence.d.ts +27 -27
  34. package/dist/cjs/presence.js +2 -2
  35. package/dist/cjs/protocol.d.ts +145 -145
  36. package/dist/cjs/protocol.js +3 -3
  37. package/dist/cjs/refs.d.ts +7 -5
  38. package/dist/cjs/refs.js +29 -21
  39. package/dist/cjs/refs.js.map +1 -1
  40. package/dist/cjs/replica.d.ts +28 -28
  41. package/dist/cjs/replica.js +28 -28
  42. package/dist/cjs/schema/defaults.d.ts +4 -0
  43. package/dist/cjs/schema/defaults.js +72 -0
  44. package/dist/cjs/schema/defaults.js.map +1 -0
  45. package/dist/cjs/schema/defaults.test.d.ts +1 -1
  46. package/dist/cjs/schema/defaults.test.js +20 -20
  47. package/dist/cjs/schema/fields.d.ts +9 -9
  48. package/dist/cjs/schema/fields.js +144 -144
  49. package/dist/cjs/schema/index.d.ts +8 -8
  50. package/dist/cjs/schema/index.js +51 -51
  51. package/dist/cjs/schema/indexFilters.d.ts +6 -6
  52. package/dist/cjs/schema/indexFilters.js +30 -30
  53. package/dist/cjs/schema/types/collection.d.ts +23 -23
  54. package/dist/cjs/schema/types/collection.js +2 -2
  55. package/dist/cjs/schema/types/compounds.d.ts +11 -11
  56. package/dist/cjs/schema/types/compounds.js +2 -2
  57. package/dist/cjs/schema/types/fields.d.ts +75 -75
  58. package/dist/cjs/schema/types/fields.js +2 -2
  59. package/dist/cjs/schema/types/filters.d.ts +29 -29
  60. package/dist/cjs/schema/types/filters.js +2 -2
  61. package/dist/cjs/schema/types/shapes.d.ts +21 -21
  62. package/dist/cjs/schema/types/shapes.js +2 -2
  63. package/dist/cjs/schema/types/synthetics.d.ts +37 -37
  64. package/dist/cjs/schema/types/synthetics.js +2 -2
  65. package/dist/cjs/schema/types.d.ts +18 -18
  66. package/dist/cjs/schema/types.js +22 -22
  67. package/dist/cjs/schema/validation.d.ts +3 -3
  68. package/dist/cjs/schema/validation.js +86 -86
  69. package/dist/cjs/timestamp.d.ts +50 -50
  70. package/dist/cjs/timestamp.js +251 -251
  71. package/dist/cjs/timestamp.test.d.ts +1 -1
  72. package/dist/cjs/timestamp.test.js +104 -104
  73. package/dist/cjs/undo.d.ts +3 -3
  74. package/dist/cjs/undo.js +198 -198
  75. package/dist/cjs/utils.d.ts +20 -20
  76. package/dist/cjs/utils.js +145 -145
  77. package/dist/cjs/utils.test.d.ts +1 -1
  78. package/dist/cjs/utils.test.js +36 -36
  79. package/dist/esm/EventSubscriber.d.ts +17 -17
  80. package/dist/esm/EventSubscriber.js +62 -62
  81. package/dist/esm/baseline.d.ts +5 -5
  82. package/dist/esm/baseline.js +1 -1
  83. package/dist/esm/batching.d.ts +42 -42
  84. package/dist/esm/batching.js +86 -86
  85. package/dist/esm/files.d.ts +19 -19
  86. package/dist/esm/files.js +12 -12
  87. package/dist/esm/files.test.d.ts +1 -0
  88. package/dist/esm/files.test.js +79 -0
  89. package/dist/esm/files.test.js.map +1 -0
  90. package/dist/esm/index.d.ts +19 -18
  91. package/dist/esm/index.js +16 -15
  92. package/dist/esm/index.js.map +1 -1
  93. package/dist/esm/indexes.d.ts +17 -17
  94. package/dist/esm/indexes.js +130 -130
  95. package/dist/esm/indexes.test.d.ts +1 -1
  96. package/dist/esm/indexes.test.js +125 -125
  97. package/dist/esm/migration.d.ts +172 -172
  98. package/dist/esm/migration.js +294 -294
  99. package/dist/esm/oids.d.ts +100 -96
  100. package/dist/esm/oids.js +422 -407
  101. package/dist/esm/oids.js.map +1 -1
  102. package/dist/esm/oids.test.d.ts +1 -1
  103. package/dist/esm/oids.test.js +346 -270
  104. package/dist/esm/oids.test.js.map +1 -1
  105. package/dist/esm/operation.d.ts +139 -139
  106. package/dist/esm/operation.js +530 -530
  107. package/dist/esm/operation.test.d.ts +1 -1
  108. package/dist/esm/operation.test.js +527 -527
  109. package/dist/esm/patch.d.ts +26 -26
  110. package/dist/esm/patch.js +222 -222
  111. package/dist/esm/presence.d.ts +27 -27
  112. package/dist/esm/presence.js +1 -1
  113. package/dist/esm/protocol.d.ts +145 -145
  114. package/dist/esm/protocol.js +2 -2
  115. package/dist/esm/refs.d.ts +7 -5
  116. package/dist/esm/refs.js +22 -16
  117. package/dist/esm/refs.js.map +1 -1
  118. package/dist/esm/replica.d.ts +28 -28
  119. package/dist/esm/replica.js +25 -25
  120. package/dist/esm/schema/defaults.d.ts +4 -0
  121. package/dist/esm/schema/defaults.js +66 -0
  122. package/dist/esm/schema/defaults.js.map +1 -0
  123. package/dist/esm/schema/defaults.test.d.ts +1 -1
  124. package/dist/esm/schema/defaults.test.js +18 -18
  125. package/dist/esm/schema/fields.d.ts +9 -9
  126. package/dist/esm/schema/fields.js +133 -133
  127. package/dist/esm/schema/index.d.ts +8 -8
  128. package/dist/esm/schema/index.js +32 -32
  129. package/dist/esm/schema/indexFilters.d.ts +6 -6
  130. package/dist/esm/schema/indexFilters.js +22 -22
  131. package/dist/esm/schema/types/collection.d.ts +23 -23
  132. package/dist/esm/schema/types/collection.js +1 -1
  133. package/dist/esm/schema/types/compounds.d.ts +11 -11
  134. package/dist/esm/schema/types/compounds.js +1 -1
  135. package/dist/esm/schema/types/fields.d.ts +75 -75
  136. package/dist/esm/schema/types/fields.js +1 -1
  137. package/dist/esm/schema/types/filters.d.ts +29 -29
  138. package/dist/esm/schema/types/filters.js +1 -1
  139. package/dist/esm/schema/types/shapes.d.ts +21 -21
  140. package/dist/esm/schema/types/shapes.js +1 -1
  141. package/dist/esm/schema/types/synthetics.d.ts +37 -37
  142. package/dist/esm/schema/types/synthetics.js +1 -1
  143. package/dist/esm/schema/types.d.ts +18 -18
  144. package/dist/esm/schema/types.js +6 -6
  145. package/dist/esm/schema/validation.d.ts +3 -3
  146. package/dist/esm/schema/validation.js +81 -81
  147. package/dist/esm/timestamp.d.ts +50 -50
  148. package/dist/esm/timestamp.js +234 -234
  149. package/dist/esm/timestamp.test.d.ts +1 -1
  150. package/dist/esm/timestamp.test.js +102 -102
  151. package/dist/esm/undo.d.ts +3 -3
  152. package/dist/esm/undo.js +194 -194
  153. package/dist/esm/utils.d.ts +20 -20
  154. package/dist/esm/utils.js +127 -127
  155. package/dist/esm/utils.test.d.ts +1 -1
  156. package/dist/esm/utils.test.js +34 -34
  157. package/dist/tsconfig-cjs.tsbuildinfo +1 -1
  158. package/dist/tsconfig.tsbuildinfo +1 -1
  159. package/package.json +1 -1
  160. package/src/index.ts +1 -0
  161. package/src/oids.test.ts +82 -0
  162. package/src/oids.ts +17 -0
  163. package/src/refs.ts +8 -0
@@ -1,87 +1,87 @@
1
- export class Batcher {
2
- constructor(flusher) {
3
- this.flusher = flusher;
4
- this.batches = new Map();
5
- this.flush = (key) => {
6
- const batch = this.batches.get(key);
7
- if (!batch)
8
- return;
9
- return batch.flush();
10
- };
11
- this.discard = (key) => {
12
- const batch = this.batches.get(key);
13
- if (!batch)
14
- return;
15
- batch.discard();
16
- this.batches.delete(key);
17
- };
18
- this.flushAll = () => {
19
- return [...this.batches.values()].map((batch) => batch.flush());
20
- };
21
- }
22
- add({ key, userData, items, max, timeout, }) {
23
- let batch = this.batches.get(key);
24
- if (!batch) {
25
- batch = new Batch({
26
- max: max || null,
27
- startedAt: Date.now(),
28
- userData,
29
- timeout: timeout || null,
30
- flusher: this.flusher,
31
- key,
32
- });
33
- this.batches.set(key, batch);
34
- }
35
- batch.update({
36
- items,
37
- max,
38
- timeout,
39
- userData,
40
- });
41
- return batch;
42
- }
43
- }
44
- export class Batch {
45
- constructor({ max, startedAt, timeout, userData, flusher, key, }) {
46
- this.items = [];
47
- this.update = ({ items, max, timeout, userData, }) => {
48
- this.items.push(...items);
49
- if (max !== undefined)
50
- this.max = max;
51
- if (timeout !== undefined)
52
- this.timeout = timeout;
53
- if (userData)
54
- this.userData = userData;
55
- // if the batch has items and a timeout but has not
56
- // scheduled yet, schedule it
57
- const needsSchedule = this.items.length !== 0 && this.timeout !== null && !this.flushTimeout;
58
- // if the batch has already reached its max, skip scheduling
59
- // and flush immediately
60
- if (this.max !== null && this.items.length >= this.max) {
61
- this.flush();
62
- }
63
- else if (needsSchedule && this.timeout !== null) {
64
- this.flushTimeout = setTimeout(this.flush, this.timeout);
65
- }
66
- };
67
- this.flush = () => {
68
- this.flushTimeout && clearTimeout(this.flushTimeout);
69
- this.flushTimeout = undefined;
70
- const items = this.items;
71
- this.items = [];
72
- return this.flusher(items, this.key, this.userData);
73
- };
74
- this.discard = () => {
75
- this.flushTimeout && clearTimeout(this.flushTimeout);
76
- this.flushTimeout = undefined;
77
- this.items = [];
78
- };
79
- this.max = max;
80
- this.startedAt = startedAt;
81
- this.timeout = timeout;
82
- this.userData = userData;
83
- this.flusher = flusher;
84
- this.key = key;
85
- }
86
- }
1
+ export class Batcher {
2
+ constructor(flusher) {
3
+ this.flusher = flusher;
4
+ this.batches = new Map();
5
+ this.flush = (key) => {
6
+ const batch = this.batches.get(key);
7
+ if (!batch)
8
+ return;
9
+ return batch.flush();
10
+ };
11
+ this.discard = (key) => {
12
+ const batch = this.batches.get(key);
13
+ if (!batch)
14
+ return;
15
+ batch.discard();
16
+ this.batches.delete(key);
17
+ };
18
+ this.flushAll = () => {
19
+ return [...this.batches.values()].map((batch) => batch.flush());
20
+ };
21
+ }
22
+ add({ key, userData, items, max, timeout, }) {
23
+ let batch = this.batches.get(key);
24
+ if (!batch) {
25
+ batch = new Batch({
26
+ max: max || null,
27
+ startedAt: Date.now(),
28
+ userData,
29
+ timeout: timeout || null,
30
+ flusher: this.flusher,
31
+ key,
32
+ });
33
+ this.batches.set(key, batch);
34
+ }
35
+ batch.update({
36
+ items,
37
+ max,
38
+ timeout,
39
+ userData,
40
+ });
41
+ return batch;
42
+ }
43
+ }
44
+ export class Batch {
45
+ constructor({ max, startedAt, timeout, userData, flusher, key, }) {
46
+ this.items = [];
47
+ this.update = ({ items, max, timeout, userData, }) => {
48
+ this.items.push(...items);
49
+ if (max !== undefined)
50
+ this.max = max;
51
+ if (timeout !== undefined)
52
+ this.timeout = timeout;
53
+ if (userData)
54
+ this.userData = userData;
55
+ // if the batch has items and a timeout but has not
56
+ // scheduled yet, schedule it
57
+ const needsSchedule = this.items.length !== 0 && this.timeout !== null && !this.flushTimeout;
58
+ // if the batch has already reached its max, skip scheduling
59
+ // and flush immediately
60
+ if (this.max !== null && this.items.length >= this.max) {
61
+ this.flush();
62
+ }
63
+ else if (needsSchedule && this.timeout !== null) {
64
+ this.flushTimeout = setTimeout(this.flush, this.timeout);
65
+ }
66
+ };
67
+ this.flush = () => {
68
+ this.flushTimeout && clearTimeout(this.flushTimeout);
69
+ this.flushTimeout = undefined;
70
+ const items = this.items;
71
+ this.items = [];
72
+ return this.flusher(items, this.key, this.userData);
73
+ };
74
+ this.discard = () => {
75
+ this.flushTimeout && clearTimeout(this.flushTimeout);
76
+ this.flushTimeout = undefined;
77
+ this.items = [];
78
+ };
79
+ this.max = max;
80
+ this.startedAt = startedAt;
81
+ this.timeout = timeout;
82
+ this.userData = userData;
83
+ this.flusher = flusher;
84
+ this.key = key;
85
+ }
86
+ }
87
87
  //# sourceMappingURL=batching.js.map
@@ -1,19 +1,19 @@
1
- export declare type FileRef = {
2
- '@@type': 'file';
3
- id: string;
4
- };
5
- export declare function isFileRef(value: any): value is FileRef;
6
- export declare function createFileRef(id: string): FileRef;
7
- export declare type FileData = {
8
- id: string;
9
- /**
10
- * For locally created files, this starts false, until it's uploaded
11
- * Remote files this is always true
12
- */
13
- remote: boolean;
14
- name: string;
15
- type: string;
16
- file?: Blob;
17
- url?: string;
18
- };
19
- export declare function getAllFileFields(snapshot: any): [string, FileRef][];
1
+ export declare type FileRef = {
2
+ '@@type': 'file';
3
+ id: string;
4
+ };
5
+ export declare function isFileRef(value: any): value is FileRef;
6
+ export declare function createFileRef(id: string): FileRef;
7
+ export declare type FileData = {
8
+ id: string;
9
+ /**
10
+ * For locally created files, this starts false, until it's uploaded
11
+ * Remote files this is always true
12
+ */
13
+ remote: boolean;
14
+ name: string;
15
+ type: string;
16
+ file?: Blob;
17
+ url?: string;
18
+ };
19
+ export declare function getAllFileFields(snapshot: any): [string, FileRef][];
package/dist/esm/files.js CHANGED
@@ -1,13 +1,13 @@
1
- export function isFileRef(value) {
2
- return value && value['@@type'] === 'file';
3
- }
4
- export function createFileRef(id) {
5
- return {
6
- '@@type': 'file',
7
- id,
8
- };
9
- }
10
- export function getAllFileFields(snapshot) {
11
- return Object.entries(snapshot).filter((entry) => isFileRef(entry[1]));
12
- }
1
+ export function isFileRef(value) {
2
+ return value && value['@@type'] === 'file';
3
+ }
4
+ export function createFileRef(id) {
5
+ return {
6
+ '@@type': 'file',
7
+ id,
8
+ };
9
+ }
10
+ export function getAllFileFields(snapshot) {
11
+ return Object.entries(snapshot).filter((entry) => isFileRef(entry[1]));
12
+ }
13
13
  //# sourceMappingURL=files.js.map
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,79 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { processValueFiles } from './files.js';
3
+ function makeFile() {
4
+ return new File([''], 'test.txt', { type: 'text/plain' });
5
+ }
6
+ describe('processing files in a value', () => {
7
+ it('replaces a single file with a reference', () => {
8
+ const file = makeFile();
9
+ const list = [];
10
+ const result = processValueFiles(file, list.push.bind(list));
11
+ expect(result).toEqual({
12
+ '@@type': 'file',
13
+ id: expect.stringContaining(''),
14
+ });
15
+ expect(list).toEqual([
16
+ {
17
+ id: expect.stringContaining(''),
18
+ blob: file,
19
+ url: null,
20
+ remote: false,
21
+ name: 'test.txt',
22
+ type: 'text/plain',
23
+ },
24
+ ]);
25
+ });
26
+ it('replaces a list of files with references', () => {
27
+ const file1 = makeFile();
28
+ const file2 = makeFile();
29
+ const list = [];
30
+ const result = processValueFiles([file1, file2], list.push.bind(list));
31
+ expect(result).toEqual([
32
+ { '@@type': 'file', id: expect.stringContaining('') },
33
+ { '@@type': 'file', id: expect.stringContaining('') },
34
+ ]);
35
+ expect(list).toEqual([
36
+ {
37
+ id: expect.stringContaining(''),
38
+ blob: file1,
39
+ url: null,
40
+ remote: false,
41
+ name: 'test.txt',
42
+ type: 'text/plain',
43
+ },
44
+ {
45
+ id: expect.stringContaining(''),
46
+ blob: file2,
47
+ url: null,
48
+ remote: false,
49
+ name: 'test.txt',
50
+ type: 'text/plain',
51
+ },
52
+ ]);
53
+ expect(result[0].id).not.toEqual(result[1].id);
54
+ });
55
+ it('replaces nested files with references', () => {
56
+ const file = makeFile();
57
+ const list = [];
58
+ const result = processValueFiles({ a: { b: file } }, list.push.bind(list));
59
+ expect(result).toEqual({
60
+ a: {
61
+ b: {
62
+ '@@type': 'file',
63
+ id: expect.stringContaining(''),
64
+ },
65
+ },
66
+ });
67
+ expect(list).toEqual([
68
+ {
69
+ id: expect.stringContaining(''),
70
+ blob: file,
71
+ url: null,
72
+ remote: false,
73
+ name: 'test.txt',
74
+ type: 'text/plain',
75
+ },
76
+ ]);
77
+ });
78
+ });
79
+ //# sourceMappingURL=files.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.test.js","sourceRoot":"","sources":["../../src/files.test.ts"],"names":[],"mappings":"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"}
@@ -1,18 +1,19 @@
1
- export * from './protocol.js';
2
- export * from './timestamp.js';
3
- export * from './operation.js';
4
- export * from './baseline.js';
5
- export * from './replica.js';
6
- export * from './schema/index.js';
7
- export * from './utils.js';
8
- export * from './indexes.js';
9
- export { migrate, migrationRange, createDefaultMigration, createMigration, } from './migration.js';
10
- export type { Migration, MigrationIndexDescription, MigrationEngine, } from './migration.js';
11
- export type { UserInfo } from './presence.js';
12
- export * from './patch.js';
13
- export * from './oids.js';
14
- export * from './EventSubscriber.js';
15
- export * from './undo.js';
16
- export * from './batching.js';
17
- export * from './files.js';
18
- export type { Ref } from './refs.js';
1
+ export * from './protocol.js';
2
+ export * from './timestamp.js';
3
+ export * from './operation.js';
4
+ export * from './baseline.js';
5
+ export * from './replica.js';
6
+ export * from './schema/index.js';
7
+ export * from './utils.js';
8
+ export * from './indexes.js';
9
+ export { migrate, migrationRange, createDefaultMigration, createMigration, } from './migration.js';
10
+ export type { Migration, MigrationIndexDescription, MigrationEngine, } from './migration.js';
11
+ export type { UserInfo } from './presence.js';
12
+ export * from './patch.js';
13
+ export * from './oids.js';
14
+ export * from './EventSubscriber.js';
15
+ export * from './undo.js';
16
+ export * from './batching.js';
17
+ export * from './files.js';
18
+ export type { Ref } from './refs.js';
19
+ export { makeObjectRef, makeFileRef, isRef, compareRefs } from './refs.js';
package/dist/esm/index.js CHANGED
@@ -1,16 +1,17 @@
1
- export * from './protocol.js';
2
- export * from './timestamp.js';
3
- export * from './operation.js';
4
- export * from './baseline.js';
5
- export * from './replica.js';
6
- export * from './schema/index.js';
7
- export * from './utils.js';
8
- export * from './indexes.js';
9
- export { migrate, migrationRange, createDefaultMigration, createMigration, } from './migration.js';
10
- export * from './patch.js';
11
- export * from './oids.js';
12
- export * from './EventSubscriber.js';
13
- export * from './undo.js';
14
- export * from './batching.js';
15
- export * from './files.js';
1
+ export * from './protocol.js';
2
+ export * from './timestamp.js';
3
+ export * from './operation.js';
4
+ export * from './baseline.js';
5
+ export * from './replica.js';
6
+ export * from './schema/index.js';
7
+ export * from './utils.js';
8
+ export * from './indexes.js';
9
+ export { migrate, migrationRange, createDefaultMigration, createMigration, } from './migration.js';
10
+ export * from './patch.js';
11
+ export * from './oids.js';
12
+ export * from './EventSubscriber.js';
13
+ export * from './undo.js';
14
+ export * from './batching.js';
15
+ export * from './files.js';
16
+ export { makeObjectRef, makeFileRef, isRef, compareRefs } from './refs.js';
16
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,OAAO,EACN,OAAO,EACP,cAAc,EACd,sBAAsB,EACtB,eAAe,GACf,MAAM,gBAAgB,CAAC;AAOxB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,OAAO,EACN,OAAO,EACP,cAAc,EACd,sBAAsB,EACtB,eAAe,GACf,MAAM,gBAAgB,CAAC;AAOxB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAE3B,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC"}
@@ -1,17 +1,17 @@
1
- import { StorageCollectionSchema, StorageDirectSyntheticSchema } from './index.js';
2
- export declare const COMPOUND_INDEX_SEPARATOR = "\uFFFFFE";
3
- export declare const COMPOUND_INDEX_LOWER_BOUND_SEPARATOR = "\0";
4
- export declare const COMPOUND_INDEX_UPPER_BOUND_SEPARATOR = "\uFFFFFF";
5
- declare type IndexableFieldValue = string | number | boolean | any[];
6
- export declare type CompoundIndexValue = string | string[];
7
- export declare function createCompoundIndexValue(...fields: IndexableFieldValue[]): CompoundIndexValue;
8
- export declare function createUpperBoundIndexValue(...fields: IndexableFieldValue[]): string;
9
- export declare function createLowerBoundIndexValue(...fields: IndexableFieldValue[]): string;
10
- export declare function isDirectSynthetic(index: any): index is StorageDirectSyntheticSchema<any>;
11
- export declare function computeSynthetics(schema: StorageCollectionSchema, obj: any): Record<string, any>;
12
- export declare function computeCompoundIndices(schema: StorageCollectionSchema<any, any, any>, doc: any): any;
13
- export declare function getIndexValues(schema: StorageCollectionSchema<any, any, any>, doc: any): any;
14
- export declare function assignIndexValues(schema: StorageCollectionSchema<any, any, any>, doc: any): any;
15
- export declare const NULL_INDEX_VALUE = "null";
16
- export declare function sanitizeIndexValue(value: unknown): string | number | (string | number)[];
17
- export {};
1
+ import { StorageCollectionSchema, StorageDirectSyntheticSchema } from './index.js';
2
+ export declare const COMPOUND_INDEX_SEPARATOR = "\uFFFFFE";
3
+ export declare const COMPOUND_INDEX_LOWER_BOUND_SEPARATOR = "\0";
4
+ export declare const COMPOUND_INDEX_UPPER_BOUND_SEPARATOR = "\uFFFFFF";
5
+ declare type IndexableFieldValue = string | number | boolean | any[];
6
+ export declare type CompoundIndexValue = string | string[];
7
+ export declare function createCompoundIndexValue(...fields: IndexableFieldValue[]): CompoundIndexValue;
8
+ export declare function createUpperBoundIndexValue(...fields: IndexableFieldValue[]): string;
9
+ export declare function createLowerBoundIndexValue(...fields: IndexableFieldValue[]): string;
10
+ export declare function isDirectSynthetic(index: any): index is StorageDirectSyntheticSchema<any>;
11
+ export declare function computeSynthetics(schema: StorageCollectionSchema, obj: any): Record<string, any>;
12
+ export declare function computeCompoundIndices(schema: StorageCollectionSchema<any, any, any>, doc: any): any;
13
+ export declare function getIndexValues(schema: StorageCollectionSchema<any, any, any>, doc: any): any;
14
+ export declare function assignIndexValues(schema: StorageCollectionSchema<any, any, any>, doc: any): any;
15
+ export declare const NULL_INDEX_VALUE = "null";
16
+ export declare function sanitizeIndexValue(value: unknown): string | number | (string | number)[];
17
+ export {};