@verdant-web/common 1.13.4 → 1.14.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/src/operation.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { DocumentBaseline } from './baseline.js';
2
- import { FileRef } from './files.js';
2
+ import { FileRef, isFileRef } from './files.js';
3
3
  import {
4
4
  areOidsRelated,
5
5
  assignOid,
@@ -689,6 +689,8 @@ export function substituteRefsWithObjects(
689
689
  substituteRefsWithObjects(base[i], refs, used);
690
690
  }
691
691
  }
692
+ } else if (isFileRef(base)) {
693
+ // don't do anything with file refs
692
694
  } else if (isObject(base)) {
693
695
  // not sure where to put this assertion but it's important to make
694
696
  // sure all nested objects include an OID
@@ -15,7 +15,7 @@ export type StorageSchema<
15
15
  Collections extends {
16
16
  [k: string]: StorageCollectionSchema;
17
17
  } = any,
18
- > = { version: number; collections: Collections };
18
+ > = { version: number; wip?: true; collections: Collections };
19
19
 
20
20
  export type SchemaCollectionName<Schema extends StorageSchema<any>> =
21
21
  Schema extends StorageSchema<infer Cs>
package/src/utils.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { v4 } from 'uuid';
2
2
  import { assignOid, maybeGetOid } from './oids.js';
3
+ import hash from 'object-hash';
3
4
 
4
5
  export function take<T extends object, Keys extends keyof T>(
5
6
  obj: T,
@@ -86,7 +87,8 @@ export function cloneDeep<T>(obj: T, copyOids = true): T {
86
87
 
87
88
  // TODO: better hash
88
89
  export function hashObject(obj: any) {
89
- return stableStringify(obj);
90
+ // hash the object into a unique string
91
+ return hash(obj);
90
92
  }
91
93
 
92
94
  export function isObject(obj: any) {