@dereekb/firebase 10.0.19 → 10.0.21

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 (31) hide show
  1. package/index.cjs.js +52 -27
  2. package/index.esm.js +57 -31
  3. package/package.json +1 -1
  4. package/src/lib/client/firestore/driver.query.d.ts +2 -2
  5. package/src/lib/client/function/development.function.d.ts +2 -2
  6. package/src/lib/client/function/function.callable.d.ts +2 -2
  7. package/src/lib/client/function/function.d.ts +2 -2
  8. package/src/lib/client/function/function.factory.d.ts +5 -5
  9. package/src/lib/client/function/model.function.factory.d.ts +5 -5
  10. package/src/lib/common/auth/auth.d.ts +21 -9
  11. package/src/lib/common/auth/auth.error.d.ts +3 -3
  12. package/src/lib/common/firestore/accessor/accessor.d.ts +2 -2
  13. package/src/lib/common/firestore/accessor/converter.d.ts +1 -1
  14. package/src/lib/common/firestore/collection/collection.key.d.ts +8 -8
  15. package/src/lib/common/firestore/query/accumulator.d.ts +2 -1
  16. package/src/lib/common/firestore/query/constraint.d.ts +15 -15
  17. package/src/lib/common/firestore/query/iterator.d.ts +3 -3
  18. package/src/lib/common/firestore/query/query.iterate.d.ts +20 -2
  19. package/src/lib/common/firestore/query/query.util.d.ts +3 -3
  20. package/src/lib/common/firestore/snapshot/snapshot.field.d.ts +9 -9
  21. package/src/lib/common/model/model/model.loader.d.ts +2 -2
  22. package/src/lib/common/storage/accessor/path.model.d.ts +1 -1
  23. package/src/lib/common/storage/context.d.ts +2 -2
  24. package/src/lib/common/storage/driver/accessor.d.ts +5 -5
  25. package/src/lib/common/storage/driver/driver.d.ts +2 -2
  26. package/src/lib/common/storage/storage.d.ts +4 -4
  27. package/src/lib/common/storage/types.d.ts +25 -25
  28. package/test/CHANGELOG.md +8 -0
  29. package/test/package.json +1 -1
  30. package/test/src/lib/common/firestore/test.driver.query.js +28 -0
  31. package/test/src/lib/common/firestore/test.driver.query.js.map +1 -1
@@ -9,11 +9,11 @@ export interface FirestoreItemPageIteratorFilter extends ItemPageLimit {
9
9
  /**
10
10
  * Overrides the default limit, if applicable.
11
11
  */
12
- limit?: Maybe<number>;
12
+ readonly limit?: Maybe<number>;
13
13
  /**
14
14
  * Constraints to query on.
15
15
  */
16
- constraints?: Maybe<ArrayOrValue<FirestoreQueryConstraint>>;
16
+ readonly constraints?: Maybe<ArrayOrValue<FirestoreQueryConstraint>>;
17
17
  }
18
18
  export interface FirestoreItemPageIterationBaseConfig<T> extends QueryLikeReferenceRef<T>, FirestoreQueryDriverRef, ItemPageLimit {
19
19
  /**
@@ -21,7 +21,7 @@ export interface FirestoreItemPageIterationBaseConfig<T> extends QueryLikeRefere
21
21
  *
22
22
  * Defaults to 50
23
23
  */
24
- itemsPerPage?: number;
24
+ readonly itemsPerPage?: number;
25
25
  }
26
26
  export interface FirestoreItemPageIterationConfig<T> extends FirestoreItemPageIterationBaseConfig<T>, ItemPageIterationConfig<FirestoreItemPageIteratorFilter> {
27
27
  }
@@ -1,4 +1,4 @@
1
- import { type GetterOrValue, type PromiseOrValue, type IndexRef, type Maybe, type PerformAsyncTasksConfig, type IndexNumber, type PerformAsyncTasksResult, type FactoryWithRequiredInput } from '@dereekb/util';
1
+ import { type GetterOrValue, type PromiseOrValue, type IndexRef, type Maybe, type PerformAsyncTasksConfig, type IndexNumber, type PerformAsyncTasksResult, type FactoryWithRequiredInput, type Milliseconds } from '@dereekb/util';
2
2
  import { type FirestoreDocument, type FirestoreDocumentSnapshotDataPair, type LimitedFirestoreDocumentAccessor } from '../accessor';
3
3
  import { type QueryDocumentSnapshot, type QuerySnapshot, type DocumentSnapshot } from '../types';
4
4
  import { type FirestoreQueryConstraint } from './constraint';
@@ -26,7 +26,7 @@ export declare function iterateFirestoreDocumentSnapshotPairs<T, R, D extends Fi
26
26
  /**
27
27
  * Config for iterateFirestoreDocumentSnapshots().
28
28
  */
29
- export interface IterateFirestoreDocumentSnapshotsConfig<T, R> extends Omit<IterateFirestoreDocumentSnapshotBatchesConfig<T, IterateFirestoreDocumentSnapshotsResult<T, R>>, 'iterateSnapshotBatch'> {
29
+ export interface IterateFirestoreDocumentSnapshotsConfig<T, R> extends Omit<IterateFirestoreDocumentSnapshotBatchesConfig<T, IterateFirestoreDocumentSnapshotsResult<T, R>>, 'iterateSnapshotBatch' | 'maxParallelCheckpoints'> {
30
30
  /**
31
31
  * The iterate function per each snapshot individually
32
32
  */
@@ -134,6 +134,12 @@ export declare function iterateFirestoreDocumentSnapshotBatches<T, R>(config: It
134
134
  export interface IterateFirestoreDocumentSnapshotCheckpointsConfig<T, R> {
135
135
  readonly queryFactory: FirestoreQueryFactory<T>;
136
136
  readonly constraintsFactory: GetterOrValue<FirestoreQueryConstraint[]>;
137
+ /**
138
+ * Whether or not to call the constraints factory each time.
139
+ *
140
+ * If the constraintsFactory is a getter then this defaults to true. If constraintsFactory is a value then this is set to false.
141
+ */
142
+ readonly dynamicConstraints?: boolean;
137
143
  /**
138
144
  * Convenience paramenter to add a limit constraint to the query.
139
145
  */
@@ -142,6 +148,18 @@ export interface IterateFirestoreDocumentSnapshotCheckpointsConfig<T, R> {
142
148
  * The total number of snapshots allowed. Ends on the checkpoint that
143
149
  */
144
150
  readonly totalSnapshotsLimit?: number;
151
+ /**
152
+ * The number of max parallel checkpoints to run.
153
+ *
154
+ * By default checkpoints are run serially (max of 1), but can be run in parallel.
155
+ */
156
+ readonly maxParallelCheckpoints?: number;
157
+ /**
158
+ * The amount of time to add as a delay between beginning a new checkpoint.
159
+ *
160
+ * If in parallel this is the minimum amount of time to wait before starting a new checkpoint.
161
+ */
162
+ readonly waitBetweenCheckpoints?: Milliseconds;
145
163
  /**
146
164
  * The iterate function per each snapshot.
147
165
  */
@@ -1,9 +1,9 @@
1
1
  import { type DocumentReference, type QuerySnapshot } from './../types';
2
2
  import { Observable } from 'rxjs';
3
3
  export interface StreamDocsWithOnSnapshotFunctionParams<O> {
4
- next: (value?: O | undefined) => void;
5
- error: (err?: unknown) => void;
6
- complete: () => void;
4
+ readonly next: (value?: O | undefined) => void;
5
+ readonly error: (err?: unknown) => void;
6
+ readonly complete: () => void;
7
7
  }
8
8
  export type StreamDocsUnsubscribeFunction = () => void;
9
9
  /**
@@ -108,7 +108,7 @@ export type MapConfiguredFirestoreFieldConfig<V, D = unknown> = MapConfiguredFir
108
108
  export type DefaultMapConfiguredFirestoreFieldConfig<V, D = unknown> = Omit<FirestoreFieldConfigWithDefault<V, D>, 'fromData' | 'toData' | 'default'> & Partial<Pick<FirestoreFieldConfigWithDefault<V, D>, 'default'>>;
109
109
  export type OptionalMapConfiguredFirestoreFieldConfig<V, D = unknown> = Omit<BaseFirestoreFieldConfig<V, D>, 'fromData' | 'toData' | 'defaultBeforeSave'>;
110
110
  export interface FirestoreStringConfig<S extends string = string> extends DefaultMapConfiguredFirestoreFieldConfig<S, S> {
111
- transform?: TransformStringFunctionConfigInput<S>;
111
+ readonly transform?: TransformStringFunctionConfigInput<S>;
112
112
  }
113
113
  export declare const DEFAULT_FIRESTORE_STRING_FIELD_VALUE = "";
114
114
  export declare function firestoreString<S extends string = string>(config?: FirestoreStringConfig<S>): FirestoreModelFieldMapFunctionsConfig<S, S>;
@@ -123,7 +123,7 @@ export declare function optionalFirestoreUID(): ModelFieldMapFunctionsConfig<May
123
123
  export declare const firestoreModelKeyString: FirestoreModelFieldMapFunctionsConfig<string, string>;
124
124
  export declare const firestoreModelIdString: FirestoreModelFieldMapFunctionsConfig<string, string>;
125
125
  export type FirestoreDateFieldConfig = DefaultMapConfiguredFirestoreFieldConfig<Date, string> & {
126
- saveDefaultAsNow?: boolean;
126
+ readonly saveDefaultAsNow?: boolean;
127
127
  };
128
128
  export declare function firestoreDate(config?: FirestoreDateFieldConfig): FirestoreModelFieldMapFunctionsConfig<Date, string>;
129
129
  export type OptionalFirestoreDateFieldConfig = OptionalFirestoreFieldConfig<Date, ISO8601DateString>;
@@ -133,8 +133,8 @@ export declare function firestoreBoolean(config: FirestoreBooleanFieldConfig): F
133
133
  export type OptionalFirestoreBooleanFieldConfig = OptionalOneTypeFirestoreFieldConfig<boolean>;
134
134
  export declare function optionalFirestoreBoolean(config?: OptionalFirestoreBooleanFieldConfig): ModelFieldMapFunctionsConfig<Maybe<boolean>, Maybe<boolean>>;
135
135
  export interface FirestoreNumberConfig<N extends number = number> extends MapConfiguredFirestoreFieldConfigWithDefault<N, N> {
136
- saveDefault?: Maybe<boolean>;
137
- transform?: TransformNumberFunctionConfigInput<N>;
136
+ readonly saveDefault?: Maybe<boolean>;
137
+ readonly transform?: TransformNumberFunctionConfigInput<N>;
138
138
  }
139
139
  export declare function firestoreNumber<N extends number = number>(config: FirestoreNumberConfig<N>): FirestoreModelFieldMapFunctionsConfig<N, N>;
140
140
  export type OptionalFirestoreNumberFieldConfig<N extends number = number> = OptionalOneTypeFirestoreFieldConfig<N> & Pick<FirestoreNumberConfig<N>, 'transform'>;
@@ -353,11 +353,11 @@ export type FirestoreSubObjectFieldConfig<T extends object, O extends object = F
353
353
  *
354
354
  * Is false by default.
355
355
  */
356
- saveDefaultObject?: boolean;
356
+ readonly saveDefaultObject?: boolean;
357
357
  /**
358
358
  * The fields to use for conversion.
359
359
  */
360
- objectField: ToModelMapFunctionsInput<T, O>;
360
+ readonly objectField: ToModelMapFunctionsInput<T, O>;
361
361
  };
362
362
  export type FirestoreSubObjectFieldMapFunctionsConfig<T extends object, O extends object = FirestoreModelData<T>> = FirestoreModelFieldMapFunctionsConfig<T, O> & ModelMapFunctionsRef<T, O>;
363
363
  /**
@@ -422,15 +422,15 @@ export declare const MAX_FIRESTORE_MAP_ZOOM_LEVEL_VALUE: ZoomLevel;
422
422
  */
423
423
  export declare const firestoreMapZoomLevel: FirestoreModelFieldMapFunctionsConfig<number, number>;
424
424
  export interface FirestoreBitwiseSetConfig<D extends number = number> extends DefaultMapConfiguredFirestoreFieldConfig<Set<D>, BitwiseEncodedSet> {
425
- maxIndex?: number;
425
+ readonly maxIndex?: number;
426
426
  }
427
427
  export declare function firestoreBitwiseSet<D extends number = number>(config: FirestoreBitwiseSetConfig<D>): FirestoreModelFieldMapFunctionsConfig<Set<D>, number>;
428
428
  export interface FirestoreBitwiseSetMapConfig<D extends number = number, K extends string = string> extends Omit<FirestoreEncodedObjectMapFieldConfig<Set<D>, BitwiseEncodedSet, K>, 'encoder' | 'decoder'> {
429
- maxIndex?: number;
429
+ readonly maxIndex?: number;
430
430
  }
431
431
  export declare function firestoreBitwiseSetMap<D extends number = number, K extends string = string>(config: FirestoreBitwiseSetMapConfig<D, K>): FirestoreModelFieldMapFunctionsConfig<FirestoreEncodedObjectMapFieldValueType<Set<D>, K>, FirestoreMapFieldType<number, K>>;
432
432
  export interface FirestoreBitwiseObjectMapConfig<T extends object, K extends string = string> extends Omit<FirestoreEncodedObjectMapFieldConfig<T, BitwiseEncodedSet, K>, 'encoder' | 'decoder'> {
433
- dencoder: BitwiseObjectDencoder<T>;
433
+ readonly dencoder: BitwiseObjectDencoder<T>;
434
434
  }
435
435
  export declare function firestoreBitwiseObjectMap<T extends object, K extends string = string>(config: FirestoreBitwiseObjectMapConfig<T, K>): FirestoreModelFieldMapFunctionsConfig<FirestoreEncodedObjectMapFieldValueType<T, K>, FirestoreMapFieldType<number, K>>;
436
436
  /**
@@ -4,7 +4,7 @@ import { type Getter } from '@dereekb/util';
4
4
  export type FirebaseModelLoaderContext = FirebaseTransactionContext;
5
5
  export type FirebaseModelGetFirestoreCollectionFunction<C extends FirebaseModelLoaderContext, T, D extends FirestoreDocument<T>> = (context: C) => FirestoreCollectionLike<T, D>;
6
6
  export interface FirebaseModelCollectionLoader<C extends FirebaseModelLoaderContext, T, D extends FirestoreDocument<T>> {
7
- getFirestoreCollection: FirebaseModelGetFirestoreCollectionFunction<C, T, D>;
7
+ readonly getFirestoreCollection: FirebaseModelGetFirestoreCollectionFunction<C, T, D>;
8
8
  }
9
9
  export interface FirebaseModelLoader<C extends FirebaseModelLoaderContext, T, D extends FirestoreDocument<T>> extends ModelLoader<C, D> {
10
10
  /**
@@ -19,7 +19,7 @@ export interface FirebaseModelLoader<C extends FirebaseModelLoaderContext, T, D
19
19
  }
20
20
  export declare function firebaseModelLoader<C extends FirebaseModelLoaderContext, T, D extends FirestoreDocument<T>>(getFirestoreCollection: FirebaseModelGetFirestoreCollectionFunction<C, T, D>): FirebaseModelLoader<C, T, D>;
21
21
  export interface InContextFirebaseModelCollectionLoader<T, D extends FirestoreDocument<T>> {
22
- getFirestoreCollection: Getter<FirestoreCollectionLike<T, D>>;
22
+ readonly getFirestoreCollection: Getter<FirestoreCollectionLike<T, D>>;
23
23
  }
24
24
  export interface InContextFirebaseModelLoader<T, D extends FirestoreDocument<T>> extends InContextModelLoader<D> {
25
25
  loadModelForKey(key: FirestoreModelKey): D;
@@ -11,7 +11,7 @@ export interface ModelStorageSlashPathFactoryConfig {
11
11
  *
12
12
  * This value is merged with the BASE_MODEL_STORAGE_FILE_PATH (/model/) base path configured for all ModelStorageSlashPathFactory values
13
13
  */
14
- basePath?: string;
14
+ readonly basePath?: string;
15
15
  }
16
16
  /**
17
17
  * Factory for SlashPath values using input ReadFirestoreModelKeyInput values.
@@ -20,11 +20,11 @@ export interface FirebaseStorageContextFactoryConfig {
20
20
  /**
21
21
  * The default bucket
22
22
  */
23
- defaultBucketId?: StorageBucketId;
23
+ readonly defaultBucketId?: StorageBucketId;
24
24
  /**
25
25
  * Whether or not to force using the default bucket id.
26
26
  */
27
- forceBucket?: boolean;
27
+ readonly forceBucket?: boolean;
28
28
  }
29
29
  /**
30
30
  * Creates a new FirebaseStorageContextFactory given the input FirebaseStorageDrivers.
@@ -74,12 +74,12 @@ export interface StorageListFilesOptions {
74
74
  * If set, limits the total number of `prefixes` and `items` to return.
75
75
  * The default and maximum maxResults is 1000.
76
76
  */
77
- maxResults?: number;
77
+ readonly maxResults?: number;
78
78
  /**
79
79
  * The `nextPageToken` from a previous call to `list()`. If provided,
80
80
  * listing is resumed from the previous position.
81
81
  */
82
- pageToken?: string;
82
+ readonly pageToken?: string;
83
83
  }
84
84
  export interface StorageListItemResult extends StoragePathRef {
85
85
  /**
@@ -107,15 +107,15 @@ export interface StorageListFilesResult<R = unknown> {
107
107
  /**
108
108
  * The raw result.
109
109
  */
110
- raw: R;
110
+ readonly raw: R;
111
111
  /**
112
112
  * Options used to retrieve the result.
113
113
  */
114
- options: StorageListFilesOptions | undefined;
114
+ readonly options: StorageListFilesOptions | undefined;
115
115
  /**
116
116
  * Whether or not there are more results available.
117
117
  */
118
- hasNext: boolean;
118
+ readonly hasNext: boolean;
119
119
  /**
120
120
  * Returns true if any files or folders exist in the results.
121
121
  */
@@ -5,6 +5,6 @@ export type FirebaseStorageDriverType = 'production' | 'testing';
5
5
  * Implements all FirebaseStorage related driver reference interfaces.
6
6
  */
7
7
  export interface FirebaseStorageDrivers extends FirebaseStorageAccessorDriverRef {
8
- storageDriverIdentifier?: FirebaseStorageDriverIdentifier;
9
- storageDriverType: FirebaseStorageDriverType;
8
+ readonly storageDriverIdentifier?: FirebaseStorageDriverIdentifier;
9
+ readonly storageDriverType: FirebaseStorageDriverType;
10
10
  }
@@ -9,7 +9,7 @@ export type StorageBucketId = string;
9
9
  * A reference to a StorageBucketId
10
10
  */
11
11
  export interface StorageBucketIdRef {
12
- bucketId: StorageBucketId;
12
+ readonly bucketId: StorageBucketId;
13
13
  }
14
14
  /**
15
15
  * A filepath to a file or folder.
@@ -24,7 +24,7 @@ export interface StorageSlashPathRef {
24
24
  *
25
25
  * For example, if a file is at the path '<bucket>/full/path/image.png', the pathString is 'full/path/image.png'.
26
26
  */
27
- pathString: StorageSlashPath;
27
+ readonly pathString: StorageSlashPath;
28
28
  }
29
29
  /**
30
30
  * A bucket and path pair.
@@ -47,7 +47,7 @@ export interface StoragePathFactoryConfig extends StorageBucketIdRef {
47
47
  *
48
48
  * False by default.
49
49
  */
50
- replaceBucket?: boolean;
50
+ readonly replaceBucket?: boolean;
51
51
  }
52
52
  /**
53
53
  * Creates a StoragePathFactory.
@@ -60,7 +60,7 @@ export declare function storagePathFactory(config: StoragePathFactoryConfig): St
60
60
  * A reference to a StoragePath
61
61
  */
62
62
  export interface StoragePathRef {
63
- storagePath: StoragePath;
63
+ readonly storagePath: StoragePath;
64
64
  }
65
65
  export type GoogleCloudStorageBucketPrefix<S extends StorageBucketId = StorageBucketId> = `gs://${S}`;
66
66
  export type GoogleCloudStorageDefaultBucketFilePath<P extends StorageSlashPath = StorageSlashPath> = P;
@@ -4,16 +4,16 @@ export type FirebaseStorageLikeStorage = {
4
4
  /**
5
5
  * The maximum time to retry uploads in milliseconds.
6
6
  */
7
- maxUploadRetryTime: number;
7
+ readonly maxUploadRetryTime: number;
8
8
  /**
9
9
  * The maximum time to retry operations other than uploads or downloads in
10
10
  * milliseconds.
11
11
  */
12
- maxOperationRetryTime: number;
12
+ readonly maxOperationRetryTime: number;
13
13
  };
14
14
  export type GoogleCloudLikeStorage = {
15
- baseUrl: string;
16
- projectId: string;
15
+ readonly baseUrl: string;
16
+ readonly projectId: string;
17
17
  };
18
18
  /**
19
19
  * Cast to the local type's Storage if direct access is needed. In most cases, direct access to this type is unncessary.
@@ -114,19 +114,19 @@ export type StorageUploadTask = {
114
114
  export type StorageClientUploadResult = unknown;
115
115
  export type StorageUploadResult = StorageClientUploadResult | unknown;
116
116
  export interface StorageUploadOptions {
117
- resumable?: boolean;
117
+ readonly resumable?: boolean;
118
118
  /**
119
119
  * String format to handle the upload as. Required if the input is a string.
120
120
  */
121
- stringFormat?: StorageDataStringType;
121
+ readonly stringFormat?: StorageDataStringType;
122
122
  /**
123
123
  * ContentType for the upload.
124
124
  */
125
- contentType?: string;
125
+ readonly contentType?: string;
126
126
  /**
127
127
  * other metadata to attach to the file.
128
128
  */
129
- metadata?: StorageMetadata;
129
+ readonly metadata?: StorageMetadata;
130
130
  }
131
131
  /**
132
132
  * Storage metadata for a Storage object.
@@ -137,78 +137,78 @@ export interface StorageMetadata {
137
137
  /**
138
138
  * The bucket this object is contained in.
139
139
  */
140
- bucket: string;
140
+ readonly bucket: string;
141
141
  /**
142
142
  * The full path of this object.
143
143
  *
144
144
  * For example, if a file is at the path '<bucket>/full/path/image.png', the pathString is 'full/path/image.png'.
145
145
  */
146
- fullPath: string;
146
+ readonly fullPath: string;
147
147
  /**
148
148
  * The object's generation.
149
149
  * {@link https://cloud.google.com/storage/docs/metadata#generation-number}
150
150
  */
151
- generation: string;
151
+ readonly generation: string;
152
152
  /**
153
153
  * The object's metageneration.
154
154
  * {@link https://cloud.google.com/storage/docs/metadata#generation-number}
155
155
  */
156
- metageneration: string;
156
+ readonly metageneration: string;
157
157
  /**
158
158
  * The short name of this object, which is the last component of the full path.
159
159
  * For example, if fullPath is 'full/path/image.png', name is 'image.png'.
160
160
  */
161
- name: string;
161
+ readonly name: string;
162
162
  /**
163
163
  * The size of this object, in bytes.
164
164
  */
165
- size: number;
165
+ readonly size: number;
166
166
  /**
167
167
  * A date string representing when this object was created.
168
168
  */
169
- timeCreated: ISO8601DateString;
169
+ readonly timeCreated: ISO8601DateString;
170
170
  /**
171
171
  * A date string representing when this object was last updated.
172
172
  */
173
- updated: ISO8601DateString;
173
+ readonly updated: ISO8601DateString;
174
174
  /**
175
175
  * A Base64-encoded MD5 hash of the object being uploaded.
176
176
  */
177
- md5Hash?: string | undefined;
177
+ readonly md5Hash?: string | undefined;
178
178
  /**
179
179
  * Served as the 'Cache-Control' header on object download.
180
180
  */
181
- cacheControl?: string | undefined;
181
+ readonly cacheControl?: string | undefined;
182
182
  /**
183
183
  * Served as the 'Content-Disposition' header on object download.
184
184
  */
185
- contentDisposition?: string | undefined;
185
+ readonly contentDisposition?: string | undefined;
186
186
  /**
187
187
  * Served as the 'Content-Encoding' header on object download.
188
188
  */
189
- contentEncoding?: string | undefined;
189
+ readonly contentEncoding?: string | undefined;
190
190
  /**
191
191
  * Served as the 'Content-Language' header on object download.
192
192
  */
193
- contentLanguage?: string | undefined;
193
+ readonly contentLanguage?: string | undefined;
194
194
  /**
195
195
  * Served as the 'Content-Type' header on object download.
196
196
  */
197
- contentType?: string | undefined;
197
+ readonly contentType?: string | undefined;
198
198
  /**
199
199
  * Any user-specified custom metdata.
200
200
  */
201
- customMetadata?: StorageCustomMetadata | undefined;
201
+ readonly customMetadata?: StorageCustomMetadata | undefined;
202
202
  }
203
203
  /**
204
204
  * Additional user-defined custom metadata.
205
205
  */
206
206
  export type StorageCustomMetadata = {
207
- [key: string]: string;
207
+ readonly [key: string]: string;
208
208
  };
209
209
  export interface StorageDeleteFileOptions {
210
210
  /**
211
211
  * Ignores errors related to the file not existing.
212
212
  */
213
- ignoreNotFound?: boolean;
213
+ readonly ignoreNotFound?: boolean;
214
214
  }
package/test/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [10.0.21](https://github.com/dereekb/dbx-components/compare/v10.0.20-dev...v10.0.21) (2024-02-17)
6
+
7
+
8
+
9
+ ## [10.0.20](https://github.com/dereekb/dbx-components/compare/v10.0.19-dev...v10.0.20) (2024-02-15)
10
+
11
+
12
+
5
13
  ## [10.0.19](https://github.com/dereekb/dbx-components/compare/v10.0.18-dev...v10.0.19) (2024-02-13)
6
14
 
7
15
 
package/test/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/firebase/test",
3
- "version": "10.0.19",
3
+ "version": "10.0.21",
4
4
  "type": "commonjs",
5
5
  "peerDependencies": {
6
6
  "@dereekb/util": "*",
@@ -187,6 +187,34 @@ function describeFirestoreQueryDriverTests(f) {
187
187
  expect(result.totalSnapshotsVisited).toBe(allMockUserItems.length);
188
188
  expect(mockUserItemsVisited.size).toBe(allMockUserItems.length);
189
189
  }));
190
+ describe('maxParallelCheckpoints>1', () => {
191
+ it('should process the checkpoints in parallel.', () => tslib_1.__awaiter(this, void 0, void 0, function* () {
192
+ const mockUserItemsVisited = new Set();
193
+ const batchSize = 1;
194
+ const maxParallelCheckpoints = 4;
195
+ let currentRunningTasks = 0;
196
+ let maxRunningTasks = 0;
197
+ const result = yield (0, firebase_1.iterateFirestoreDocumentSnapshotBatches)({
198
+ batchSize,
199
+ limitPerCheckpoint: 1,
200
+ maxParallelCheckpoints,
201
+ iterateSnapshotBatch: (x, batchIndex) => tslib_1.__awaiter(this, void 0, void 0, function* () {
202
+ currentRunningTasks += 1;
203
+ yield (0, util_1.waitForMs)(1000);
204
+ maxRunningTasks = Math.max(maxRunningTasks, currentRunningTasks);
205
+ currentRunningTasks -= 1;
206
+ }),
207
+ useCheckpointResult: (x) => tslib_1.__awaiter(this, void 0, void 0, function* () {
208
+ x.docSnapshots.forEach((y) => mockUserItemsVisited.add(y.ref.path));
209
+ }),
210
+ queryFactory: f.instance.mockItemUserCollectionGroup,
211
+ constraintsFactory: [] // no constraints
212
+ });
213
+ expect(maxRunningTasks).toBe(maxParallelCheckpoints);
214
+ expect(result.totalSnapshotsVisited).toBe(allMockUserItems.length);
215
+ expect(mockUserItemsVisited.size).toBe(allMockUserItems.length);
216
+ }));
217
+ });
190
218
  describe('batchSize=null', () => {
191
219
  it('should iterate with a single batch', () => tslib_1.__awaiter(this, void 0, void 0, function* () {
192
220
  const mockUserItemsVisited = new Set();