@verdant-web/store 4.1.6 → 4.2.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.
package/src/index.ts CHANGED
@@ -1,60 +1,60 @@
1
+ import { Client } from './client/Client.js';
1
2
  import {
2
3
  ClientDescriptor,
3
4
  ClientDescriptorOptions,
4
5
  } from './client/ClientDescriptor.js';
5
- import { Client } from './client/Client.js';
6
6
  export type { ClientWithCollections } from './client/Client.js';
7
- export { ClientDescriptor };
8
- export { Client };
7
+ export { Client, ClientDescriptor };
9
8
  // backward compat
10
- export { ClientDescriptor as StorageDescriptor };
11
- export { Client as Storage };
12
- export type { ClientDescriptorOptions };
13
- export type { ClientDescriptorOptions as StorageInitOptions };
14
- export { Entity } from './entities/Entity.js';
15
- export type {
16
- ObjectEntity,
17
- ListEntity,
18
- EntityShape,
19
- AccessibleEntityProperty,
20
- AnyEntity,
21
- EntityDestructured,
22
- EntityInit,
23
- } from './entities/types.js';
24
- export { ServerSync } from './sync/Sync.js';
25
- export type { SyncTransportMode } from './sync/Sync.js';
26
- export { EntityFile, type EntityFileSnapshot } from './files/EntityFile.js';
27
- export { schema, createMigration } from '@verdant-web/common';
9
+ export { createMigration, schema } from '@verdant-web/common';
28
10
  export type {
29
- StorageDocument,
30
- StorageSchema,
31
- StorageCollectionSchema,
11
+ CollectionFilter,
12
+ DocumentBaseline,
13
+ FileData,
14
+ IndexValueTag,
15
+ Migration,
16
+ ObjectIdentifier,
32
17
  StorageAnyFieldSchema,
33
18
  StorageArrayFieldSchema,
34
- StorageObjectFieldSchema,
35
19
  StorageBooleanFieldSchema,
20
+ StorageCollectionSchema,
21
+ StorageDocument,
36
22
  StorageFieldSchema,
23
+ StorageFieldsSchema,
37
24
  StorageFileFieldSchema,
38
25
  StorageMapFieldSchema,
39
26
  StorageNumberFieldSchema,
27
+ StorageObjectFieldSchema,
28
+ StorageSchema,
40
29
  StorageStringFieldSchema,
41
- StorageFieldsSchema,
42
- IndexValueTag,
43
- Migration,
30
+ UserInfo,
44
31
  VerdantError,
45
32
  VerdantErrorCode,
46
- ObjectIdentifier,
47
- CollectionFilter,
48
- FileData,
49
- DocumentBaseline,
50
- UserInfo,
51
33
  } from '@verdant-web/common';
52
- export type { Query } from './queries/types.js';
34
+ export * from './authorization.js';
35
+ export { Entity, getEntityClient } from './entities/Entity.js';
36
+ export type {
37
+ AccessibleEntityProperty,
38
+ AnyEntity,
39
+ EntityDestructured,
40
+ EntityInit,
41
+ EntityShape,
42
+ ListEntity,
43
+ ObjectEntity,
44
+ } from './entities/types.js';
45
+ export { EntityFile, type EntityFileSnapshot } from './files/EntityFile.js';
46
+ export { IdbPersistence } from './persistence/idb/idbPersistence.js';
47
+ export type * from './persistence/interfaces.js';
53
48
  export type { QueryStatus } from './queries/BaseQuery.js';
54
49
  export type { CollectionQueries } from './queries/CollectionQueries.js';
55
- export * from './utils/id.js';
56
- export { UndoHistory } from './UndoHistory.js';
57
- export * from './authorization.js';
50
+ export type { Query } from './queries/types.js';
58
51
  export * from './sync/cliSync.js';
59
- export type * from './persistence/interfaces.js';
60
- export { IdbPersistence } from './persistence/idb/idbPersistence.js';
52
+ export { ServerSync } from './sync/Sync.js';
53
+ export type { SyncTransportMode } from './sync/Sync.js';
54
+ export { UndoHistory } from './UndoHistory.js';
55
+ export * from './utils/id.js';
56
+ export { Client as Storage, ClientDescriptor as StorageDescriptor };
57
+ export type {
58
+ ClientDescriptorOptions,
59
+ ClientDescriptorOptions as StorageInitOptions,
60
+ };
@@ -1,4 +1,5 @@
1
1
  import {
2
+ AuthorizationKey,
2
3
  CollectionFilter,
3
4
  Migration,
4
5
  MigrationEngine,
@@ -11,10 +12,9 @@ import {
11
12
  diffToPatches,
12
13
  getOid,
13
14
  removeOidPropertiesFromAllSubObjects,
14
- AuthorizationKey,
15
15
  } from '@verdant-web/common';
16
- import { OpenDocumentDbContext } from './types.js';
17
16
  import { PersistenceDocumentDb, PersistenceNamespace } from '../interfaces.js';
17
+ import { OpenDocumentDbContext } from './types.js';
18
18
 
19
19
  function getMigrationMutations({
20
20
  migration,
@@ -184,7 +184,14 @@ export async function getMigrationEngine({
184
184
  undefined,
185
185
  [],
186
186
  {
187
+ // incoming unknown objects are assumed to be the same
188
+ // as any pre-existing object.
187
189
  mergeUnknownObjects: true,
190
+ // if a field is undefined in the new value, it should be
191
+ // erased. this is the only way to allow users to remove
192
+ // entries in maps during migrations. it is a little
193
+ // dangerous for other types, though.
194
+ defaultUndefined: false,
188
195
  authz,
189
196
  },
190
197
  );