@verdant-web/store 4.1.0 → 4.1.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.
@@ -74,16 +74,16 @@ export declare class Client<Presence = any, Profile = any> extends EventSubscrib
74
74
  * a short delay or if they reach a maximum size.
75
75
  */
76
76
  get batch(): ({ undoable, batchName, max, timeout, }?: {
77
- undoable?: boolean | undefined;
78
- batchName?: string | undefined;
79
- max?: number | null | undefined;
80
- timeout?: number | null | undefined;
77
+ undoable?: boolean;
78
+ batchName?: string;
79
+ max?: number | null;
80
+ timeout?: number | null;
81
81
  }) => import("../entities/OperationBatcher.js").OperationBatch;
82
82
  stats: () => Promise<ClientStats>;
83
83
  close: () => Promise<void>;
84
84
  __dangerous__resetLocal: () => Promise<void>;
85
85
  export: ({ downloadRemoteFiles }?: {
86
- downloadRemoteFiles?: boolean | undefined;
86
+ downloadRemoteFiles?: boolean;
87
87
  }) => Promise<ExportedData>;
88
88
  import: ({ data, fileData, files }: ExportedData) => Promise<void>;
89
89
  /**
@@ -110,7 +110,7 @@ export declare class Entity<Init = any, KeyValue extends BaseEntityValue = any,
110
110
  private changeNested;
111
111
  protected deepChange: (target: Entity, ev: EntityChange) => void;
112
112
  private getChild;
113
- subscribeToField: <K extends keyof KeyValue>(key: K, event: 'change', callback: (value: KeyValue[K], info: {
113
+ subscribeToField: <K extends keyof KeyValue>(key: K, event: "change", callback: (value: KeyValue[K], info: {
114
114
  previousValue: KeyValue[K];
115
115
  isLocal?: boolean;
116
116
  }) => void) => () => void;
@@ -166,9 +166,9 @@ export declare class Entity<Init = any, KeyValue extends BaseEntityValue = any,
166
166
  values: () => Exclude<KeyValue[keyof KeyValue], undefined>[];
167
167
  get size(): number;
168
168
  update: (data: any, { merge, replaceSubObjects, preserveUndefined, }?: {
169
- replaceSubObjects?: boolean | undefined;
170
- merge?: boolean | undefined;
171
- preserveUndefined?: boolean | undefined;
169
+ replaceSubObjects?: boolean;
170
+ merge?: boolean;
171
+ preserveUndefined?: boolean;
172
172
  }) => void;
173
173
  get length(): number;
174
174
  push: (value: ListItemInit<Init>) => void;
@@ -209,7 +209,7 @@ export declare class Entity<Init = any, KeyValue extends BaseEntityValue = any,
209
209
  * call delete from there.
210
210
  */
211
211
  deleteSelf: () => void;
212
- __getViewData__: (oid: ObjectIdentifier, type: 'confirmed' | 'pending') => EntityMetadataView;
212
+ __getViewData__: (oid: ObjectIdentifier, type: "confirmed" | "pending") => EntityMetadataView;
213
213
  __getFamilyOids__: () => string[];
214
214
  __discardPendingOperation__: (operation: Operation) => void;
215
215
  }
@@ -54,9 +54,9 @@ export declare class EntityFamilyMetadata {
54
54
  get: (oid: ObjectIdentifier) => EntityMetadata;
55
55
  getAllOids: () => string[];
56
56
  addConfirmedData: ({ baselines, operations, isLocal, }: {
57
- baselines?: DocumentBaseline[] | undefined;
58
- operations?: Record<string, Operation[]> | undefined;
59
- isLocal?: boolean | undefined;
57
+ baselines?: DocumentBaseline[];
58
+ operations?: Record<ObjectIdentifier, Operation[]>;
59
+ isLocal?: boolean;
60
60
  }) => EntityChange[];
61
61
  /**
62
62
  * Adds local, unconfirmed operations to the system.
@@ -65,8 +65,8 @@ export declare class EntityFamilyMetadata {
65
65
  */
66
66
  addPendingData: (operations: Operation[]) => EntityChange[];
67
67
  replaceAllData: ({ operations, baselines, }: {
68
- operations?: Record<string, Operation[]> | undefined;
69
- baselines?: DocumentBaseline[] | undefined;
68
+ operations?: Record<ObjectIdentifier, Operation[]>;
69
+ baselines?: DocumentBaseline[];
70
70
  }) => EntityChange[];
71
71
  discardPendingOperation: (operation: Operation) => void;
72
72
  }
@@ -40,10 +40,10 @@ export declare class EntityStore extends Disposable {
40
40
  files: FileManager;
41
41
  });
42
42
  get batch(): ({ undoable, batchName, max, timeout, }?: {
43
- undoable?: boolean | undefined;
44
- batchName?: string | undefined;
45
- max?: number | null | undefined;
46
- timeout?: number | null | undefined;
43
+ undoable?: boolean;
44
+ batchName?: string;
45
+ max?: number | null;
46
+ timeout?: number | null;
47
47
  }) => import("./OperationBatcher.js").OperationBatch;
48
48
  get flushAllBatches(): () => Promise<any[]>;
49
49
  addData: (data: IncomingData) => Promise<void>;
@@ -39,7 +39,7 @@ export declare class OperationBatcher {
39
39
  addOperations: (operations: Operation[]) => void;
40
40
  batch: ({ undoable, batchName, max, timeout, }?: {
41
41
  /** Allows turning off undo for this batch, making it 'permanent' */
42
- undoable?: boolean | undefined;
42
+ undoable?: boolean;
43
43
  /**
44
44
  * Provide a stable name to any invocation of .batch() and the changes made
45
45
  * within run() will all be added to the same batch. If a batch hits the max
@@ -52,13 +52,13 @@ export declare class OperationBatcher {
52
52
  * recommended to provide limits in one place and only provide a name
53
53
  * in others.
54
54
  */
55
- batchName?: string | undefined;
55
+ batchName?: string;
56
56
  /**
57
57
  * The maximum number of operations the batch will hold before flushing
58
58
  * automatically. If null, the batch will not flush automatically based
59
59
  * on operation count.
60
60
  */
61
- max?: number | null | undefined;
61
+ max?: number | null;
62
62
  /**
63
63
  * The number of milliseconds to wait before flushing the batch automatically.
64
64
  * If null, the batch will not flush automatically based on time. It is not
@@ -66,7 +66,7 @@ export declare class OperationBatcher {
66
66
  * to storage or sync. If you do require undefined timing in a batch, make sure
67
67
  * to always call .commit() on the batch yourself.
68
68
  */
69
- timeout?: number | null | undefined;
69
+ timeout?: number | null;
70
70
  }) => OperationBatch;
71
71
  flushAll: () => Promise<any[]>;
72
72
  private createUndo;
@@ -7,7 +7,7 @@ export declare class MessageCreator {
7
7
  private meta;
8
8
  private ctx;
9
9
  constructor(db: PersistenceMetadataDb, meta: PersistenceMetadata, ctx: Pick<Context, 'time' | 'schema' | 'log'>);
10
- createOperation: (init: Pick<OperationMessage, 'operations'> & {
10
+ createOperation: (init: Pick<OperationMessage, "operations"> & {
11
11
  timestamp?: string;
12
12
  }) => Promise<OperationMessage>;
13
13
  /**
@@ -25,7 +25,7 @@ export declare class PersistenceFiles {
25
25
  files: File[];
26
26
  }>;
27
27
  import: ({ fileData, files, }: {
28
- fileData: Array<Omit<PersistedFileData, 'file'>>;
28
+ fileData: Array<Omit<PersistedFileData, "file">>;
29
29
  files: File[];
30
30
  }) => Promise<void>;
31
31
  private parseFileExportname;
@@ -44,12 +44,12 @@ export declare class PersistenceMetadata {
44
44
  transaction?: AbstractTransaction;
45
45
  }) => Promise<void>;
46
46
  iterateLocalOperations: (iterator: import("./interfaces.js").Iterator<ClientOperation>, opts?: (CommonQueryOptions<any> & {
47
- before?: string | null | undefined;
48
- after?: string | null | undefined;
47
+ before?: string | null;
48
+ after?: string | null;
49
49
  }) | undefined) => Promise<void>;
50
50
  iterateAllOperations: (iterator: import("./interfaces.js").Iterator<ClientOperation>, opts?: (CommonQueryOptions<any> & {
51
- before?: string | null | undefined;
52
- from?: string | null | undefined;
51
+ before?: string | null;
52
+ from?: string | null;
53
53
  }) | undefined) => Promise<void>;
54
54
  iterateAllBaselines: (iterator: import("./interfaces.js").Iterator<DocumentBaseline>, opts?: CommonQueryOptions<any> | undefined) => Promise<void>;
55
55
  reset: () => Promise<void>;
@@ -15,15 +15,15 @@ export declare class PersistenceDocuments {
15
15
  }) => Promise<void>;
16
16
  findOneOid: (opts: {
17
17
  collection: string;
18
- index?: import("@verdant-web/common").CollectionIndexFilter | undefined;
19
- }) => Promise<string | null>;
18
+ index?: import("@verdant-web/common").CollectionFilter;
19
+ }) => Promise<ObjectIdentifier | null>;
20
20
  findAllOids: (opts: {
21
21
  collection: string;
22
- index?: import("@verdant-web/common").CollectionIndexFilter | undefined;
23
- limit?: number | undefined;
24
- offset?: number | undefined;
22
+ index?: import("@verdant-web/common").CollectionFilter;
23
+ limit?: number;
24
+ offset?: number;
25
25
  }) => Promise<{
26
- result: string[];
26
+ result: ObjectIdentifier[];
27
27
  hasNextPage: boolean;
28
28
  }>;
29
29
  stats: () => Promise<Record<string, {
@@ -8,21 +8,21 @@ export declare class IdbService extends Disposable {
8
8
  log?: Context['log'];
9
9
  });
10
10
  createTransaction: (storeNames: string[], opts?: {
11
- mode?: 'readonly' | 'readwrite';
11
+ mode?: "readonly" | "readwrite";
12
12
  abort?: AbortSignal;
13
13
  }) => IDBTransaction;
14
14
  run: <T = any>(storeName: string, getRequest: (store: IDBObjectStore) => IDBRequest<T>, opts?: {
15
- mode?: 'readonly' | 'readwrite';
15
+ mode?: "readonly" | "readwrite";
16
16
  transaction?: IDBTransaction;
17
17
  abort?: AbortSignal;
18
18
  }) => Promise<T>;
19
19
  runAll: <T>(storeName: string, getRequests: (store: IDBObjectStore) => IDBRequest<T>[], opts?: {
20
- mode?: 'readonly' | 'readwrite';
20
+ mode?: "readonly" | "readwrite";
21
21
  transaction?: IDBTransaction;
22
22
  abort?: AbortSignal;
23
23
  }) => Promise<T[]>;
24
24
  iterate: <T>(storeName: string, getRequest: (store: IDBObjectStore) => IDBRequest<IDBCursorWithValue | null> | IDBRequest<IDBCursorWithValue | null>[], iterator: (value: T, store: IDBObjectStore, cursor: IDBCursorWithValue) => boolean | void, opts?: {
25
- mode?: 'readonly' | 'readwrite';
25
+ mode?: "readonly" | "readwrite";
26
26
  transaction?: IDBTransaction;
27
27
  abort?: AbortSignal;
28
28
  }) => Promise<void>;
@@ -16,7 +16,7 @@ export declare class IdbMetadataDb extends IdbService implements PersistenceMeta
16
16
  private ctx;
17
17
  constructor(db: IDBDatabase, ctx: Pick<Context, 'log' | 'namespace'>);
18
18
  transaction: <T>(opts: {
19
- mode?: 'readwrite' | 'readonly';
19
+ mode?: "readwrite" | "readonly";
20
20
  storeNames: string[];
21
21
  abort?: AbortSignal;
22
22
  }, procedure: (tx: IDBTransaction) => Promise<T>) => Promise<T>;
@@ -49,7 +49,7 @@ export declare class IdbMetadataDb extends IdbService implements PersistenceMeta
49
49
  }) => Promise<void>;
50
50
  addOperations: (ops: StoredClientOperation[], opts?: CommonQueryOptions) => Promise<ObjectIdentifier[]>;
51
51
  reset: ({ clearReplica, transaction, }?: {
52
- clearReplica?: boolean | undefined;
52
+ clearReplica?: boolean;
53
53
  transaction?: AbstractTransaction;
54
54
  }) => Promise<void>;
55
55
  stats: () => Promise<{
@@ -16,9 +16,9 @@ export declare class IdbDocumentDb extends IdbService implements PersistenceDocu
16
16
  }) => Promise<ObjectIdentifier | null>;
17
17
  findAllOids: ({ collection, index, offset, limit, }: {
18
18
  collection: string;
19
- index?: import("@verdant-web/common").CollectionIndexFilter | undefined;
20
- limit?: number | undefined;
21
- offset?: number | undefined;
19
+ index?: CollectionFilter;
20
+ limit?: number;
21
+ offset?: number;
22
22
  }) => Promise<{
23
23
  result: ObjectIdentifier[];
24
24
  hasNextPage: boolean;
@@ -40,22 +40,22 @@ export declare class CollectionQueries<T extends ObjectEntity<any, any>, Init, F
40
40
  private serializeIndex;
41
41
  get: (id: string) => GetQuery<T>;
42
42
  findOne: ({ index, key: providedKey, }?: {
43
- index?: Filter | undefined;
44
- key?: string | undefined;
43
+ index?: Filter;
44
+ key?: string;
45
45
  }) => FindOneQuery<T>;
46
46
  findAll: ({ index, key: providedKey, }?: {
47
- index?: Filter | undefined;
48
- key?: string | undefined;
47
+ index?: Filter;
48
+ key?: string;
49
49
  }) => FindAllQuery<T>;
50
50
  findPage: ({ index, pageSize, page, key: providedKey, }: {
51
- index?: Filter | undefined;
51
+ index?: Filter;
52
52
  pageSize: number;
53
53
  page: number;
54
- key?: string | undefined;
54
+ key?: string;
55
55
  }) => FindPageQuery<T>;
56
56
  findAllInfinite: ({ index, pageSize, key: providedKey, }: {
57
- index?: Filter | undefined;
57
+ index?: Filter;
58
58
  pageSize: number;
59
- key?: string | undefined;
59
+ key?: string;
60
60
  }) => FindInfiniteQuery<T>;
61
61
  }
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@verdant-web/store",
3
- "version": "4.1.0",
3
+ "version": "4.1.1",
4
4
  "access": "public",
5
5
  "type": "module",
6
+ "main": "dist/esm/index.js",
6
7
  "exports": {
7
8
  ".": {
8
9
  "import": "./dist/esm/index.js",