@verdant-web/common 1.13.0 → 1.13.1
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/indexes.d.ts +1 -0
- package/dist/cjs/indexes.js +5 -1
- package/dist/cjs/indexes.js.map +1 -1
- package/dist/cjs/migration.js +13 -9
- package/dist/cjs/migration.js.map +1 -1
- package/dist/cjs/oids.js +1 -1
- package/dist/cjs/oids.js.map +1 -1
- package/dist/cjs/oids.test.js +3 -0
- package/dist/cjs/oids.test.js.map +1 -1
- package/dist/cjs/schema/types/fields.d.ts +6 -0
- package/dist/cjs/timestamp.test.js +11 -0
- package/dist/cjs/timestamp.test.js.map +1 -1
- package/dist/esm/indexes.d.ts +1 -0
- package/dist/esm/indexes.js +4 -0
- package/dist/esm/indexes.js.map +1 -1
- package/dist/esm/migration.js +13 -9
- package/dist/esm/migration.js.map +1 -1
- package/dist/esm/oids.js +1 -1
- package/dist/esm/oids.js.map +1 -1
- package/dist/esm/oids.test.js +4 -1
- package/dist/esm/oids.test.js.map +1 -1
- package/dist/esm/schema/types/fields.d.ts +6 -0
- package/dist/esm/timestamp.test.js +12 -1
- package/dist/esm/timestamp.test.js.map +1 -1
- package/dist/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/indexes.ts +5 -0
- package/src/migration.ts +22 -15
- package/src/oids.test.ts +7 -0
- package/src/oids.ts +1 -1
- package/src/schema/types/fields.ts +6 -1
- package/src/timestamp.test.ts +13 -0
package/src/oids.test.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
decomposeOid,
|
|
10
10
|
getOid,
|
|
11
11
|
getOidRange,
|
|
12
|
+
getOidRoot,
|
|
12
13
|
hasOid,
|
|
13
14
|
maybeGetOidProperty,
|
|
14
15
|
normalize,
|
|
@@ -404,3 +405,9 @@ describe('assigning OIDs to sub-objects', () => {
|
|
|
404
405
|
expect(hasOid(obj.bar[0])).toBe(false);
|
|
405
406
|
});
|
|
406
407
|
});
|
|
408
|
+
|
|
409
|
+
it('should get the root OID for a legacy OID', () => [
|
|
410
|
+
expect(getOidRoot('items/clabgyjfh00003968qycsq3ld.inputs.#')).toEqual(
|
|
411
|
+
'items/clabgyjfh00003968qycsq3ld',
|
|
412
|
+
),
|
|
413
|
+
]);
|
package/src/oids.ts
CHANGED
|
@@ -37,7 +37,12 @@ export type StorageMapFieldSchema<V extends NestedStorageFieldSchema> = {
|
|
|
37
37
|
export type StorageFileFieldSchema = {
|
|
38
38
|
type: 'file';
|
|
39
39
|
nullable?: boolean;
|
|
40
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Instructs the client to download synced files to local storage on first request for offline use.
|
|
42
|
+
* Leave this false to save storage space on the client, at the cost of requiring a network
|
|
43
|
+
* connection to use files created by other devices.
|
|
44
|
+
*/
|
|
45
|
+
downloadRemote?: boolean;
|
|
41
46
|
};
|
|
42
47
|
|
|
43
48
|
export type StorageFieldSchema =
|
package/src/timestamp.test.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { describe, expect, it, vitest } from 'vitest';
|
|
|
2
2
|
import {
|
|
3
3
|
convertOldHlcTimestamp,
|
|
4
4
|
deserializeHlcTimestamp,
|
|
5
|
+
encodeVersion,
|
|
5
6
|
HybridLogicalClockTimestampProvider,
|
|
6
7
|
OLD_encodeVersion,
|
|
7
8
|
OLD_serializeHlcTimestamp,
|
|
@@ -111,3 +112,15 @@ describe('the hybrid logical clock', () => {
|
|
|
111
112
|
expect(clock.getWallClockTime(now)).toEqual(time.getTime());
|
|
112
113
|
});
|
|
113
114
|
});
|
|
115
|
+
|
|
116
|
+
describe('version encoding', () => {
|
|
117
|
+
it('orders 1 before 2', () => {
|
|
118
|
+
expect(encodeVersion(1) < encodeVersion(2)).toBe(true);
|
|
119
|
+
});
|
|
120
|
+
it('orders 32 before 33', () => {
|
|
121
|
+
expect(encodeVersion(32) < encodeVersion(33)).toBe(true);
|
|
122
|
+
});
|
|
123
|
+
it('orders 34 before 35', () => {
|
|
124
|
+
expect(encodeVersion(34) < encodeVersion(35)).toBe(true);
|
|
125
|
+
});
|
|
126
|
+
});
|