@dereekb/firebase 13.10.8 → 13.11.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.
@@ -12,7 +12,8 @@ export interface TestingFirestoreAccessorDriver extends FirestoreAccessorDriver
12
12
  *
13
13
  * This initialization step is useful for the client, where the rules file needs to be updated to reflect the collection names properly in order to ensure rules are correct.
14
14
  *
15
- * @param collectionNames
15
+ * @param collectionNames - The original collection names to register fuzzed entries for.
16
+ * @returns The internal map of original collection names to fuzzed names (same reference as {@link TestingFirestoreAccessorDriver.getFuzzedCollectionsNameMap}).
16
17
  */
17
18
  initWithCollectionNames(collectionNames: string[]): Map<string, string>;
18
19
  }
@@ -31,6 +32,7 @@ export interface TestingFirestoreAccessorDriver extends FirestoreAccessorDriver
31
32
  * ```
32
33
  *
33
34
  * @param driver - The base driver to wrap with fuzzing behavior.
35
+ * @returns A {@link TestingFirestoreAccessorDriver} with `collection`, `subcollection`, and `collectionGroup` rewired to use fuzzed paths, plus helpers to inspect the fuzz map.
34
36
  */
35
37
  export declare function makeTestingFirestoreAccesorDriver(driver: FirestoreAccessorDriver): TestingFirestoreAccessorDriver;
36
38
  /**
@@ -43,8 +45,8 @@ export interface TestingFirestoreDrivers extends FirestoreDrivers {
43
45
  /**
44
46
  * Extends the input drivers to generate new drivers for a testing environment.
45
47
  *
46
- * @param drivers
47
- * @returns
48
+ * @param drivers - The base Firestore drivers to wrap.
49
+ * @returns A {@link TestingFirestoreDrivers} marked with `firestoreDriverType: 'testing'` and a wrapped accessor driver from {@link makeTestingFirestoreAccesorDriver}.
48
50
  */
49
51
  export declare function makeTestingFirestoreDrivers(drivers: FirestoreDrivers): TestingFirestoreDrivers;
50
52
  /**
@@ -14,6 +14,9 @@ export declare class MockItemCollectionFixtureInstance {
14
14
  readonly collections: MockItemCollections;
15
15
  get collection(): CollectionReference<MockItem>;
16
16
  /**
17
+ * Backwards-compatible alias for {@link MockItemCollectionFixtureInstance.mockItemCollection}.
18
+ *
19
+ * @returns The root {@link MockItemFirestoreCollection} from the fixture's underlying {@link MockItemCollections}.
17
20
  * @deprecated Use mockItemCollection instead.
18
21
  */
19
22
  get firestoreCollection(): MockItemFirestoreCollection;
@@ -56,5 +59,8 @@ export interface MockItemCollectionFirebaseContextConfig {
56
59
  * it('should work', () => { ... });
57
60
  * }));
58
61
  * ```
62
+ *
63
+ * @param _config - Reserved for future setup/teardown configuration; currently unused.
64
+ * @returns A factory builder that wraps a parent {@link TestFirestoreContextFixture} with a {@link MockItemCollectionFixture} per test.
59
65
  */
60
66
  export declare function testWithMockItemCollectionFixture(_config?: MockItemCollectionFirebaseContextConfig): TestWrappedContextFactoryBuilder<MockItemCollectionFixture, TestFirestoreContextFixture>;
@@ -72,8 +72,8 @@ export declare const mockItemConverter: import("@dereekb/firebase").SnapshotConv
72
72
  /**
73
73
  * Used to build a mockItemCollection from a firestore instance with a converter setup.
74
74
  *
75
- * @param firestore
76
- * @returns
75
+ * @param context - The Firestore context to resolve the root collection against.
76
+ * @returns A typed {@link CollectionReference} for the root MockItem collection.
77
77
  */
78
78
  export declare function mockItemCollectionReference(context: FirestoreContext): CollectionReference<MockItem>;
79
79
  /**
@@ -88,6 +88,9 @@ export type MockItemFirestoreCollection = FirestoreCollection<MockItem, MockItem
88
88
  * const collection = mockItemFirestoreCollection(firestoreContext);
89
89
  * const doc = collection.documentAccessor().newDocument();
90
90
  * ```
91
+ *
92
+ * @param firestoreContext - The Firestore context (test or production) used to resolve the underlying collection reference.
93
+ * @returns A {@link MockItemFirestoreCollection} wired with the {@link mockItemConverter} and {@link mockItemIdentity}.
91
94
  */
92
95
  export declare function mockItemFirestoreCollection(firestoreContext: FirestoreContext): MockItemFirestoreCollection;
93
96
  /**
@@ -174,15 +177,12 @@ export declare const mockItemPrivateConverter: import("@dereekb/firebase").Snaps
174
177
  settings: MockItemSettingsMap;
175
178
  createdAt: Date;
176
179
  }, import("@dereekb/util").MaybeMap<object>, any>>>;
177
- /**
178
- * Used to build a mockItemCollection from a firestore instance with a converter setup.
179
- *
180
- * @param firestore
181
- * @returns
182
- */
183
180
  /**
184
181
  * Creates a factory that produces {@link CollectionReference} instances for {@link MockItemPrivate}
185
182
  * subcollections under a given {@link MockItemDocument} parent.
183
+ *
184
+ * @param context - The Firestore context used to resolve subcollections.
185
+ * @returns A function that, given a parent {@link MockItemDocument}, returns a typed {@link CollectionReference} for that parent's MockItemPrivate subcollection.
186
186
  */
187
187
  export declare function mockItemPrivateCollectionReferenceFactory(context: FirestoreContext): (parent: MockItemDocument) => CollectionReference<MockItemPrivate>;
188
188
  /**
@@ -195,10 +195,16 @@ export type MockItemPrivateFirestoreCollection = SingleItemFirestoreCollection<M
195
195
  export type MockItemPrivateFirestoreCollectionFactory = (parent: MockItemDocument) => MockItemPrivateFirestoreCollection;
196
196
  /**
197
197
  * Creates a factory for producing {@link MockItemPrivateFirestoreCollection} instances bound to a parent {@link MockItemDocument}.
198
+ *
199
+ * @param firestoreContext - The Firestore context used to resolve the underlying subcollection.
200
+ * @returns A factory that, given a parent {@link MockItemDocument}, returns a single-item collection wired with {@link mockItemPrivateConverter}.
198
201
  */
199
202
  export declare function mockItemPrivateFirestoreCollection(firestoreContext: FirestoreContext): MockItemPrivateFirestoreCollectionFactory;
200
203
  /**
201
204
  * Creates a {@link CollectionGroup} reference for querying all {@link MockItemPrivate} documents across parents.
205
+ *
206
+ * @param context - The Firestore context used to resolve the collection group.
207
+ * @returns A typed {@link CollectionGroup} reference for the MockItemPrivate collection name.
202
208
  */
203
209
  export declare function mockItemPrivateCollectionReference(context: FirestoreContext): CollectionGroup<MockItemPrivate>;
204
210
  /**
@@ -207,6 +213,9 @@ export declare function mockItemPrivateCollectionReference(context: FirestoreCon
207
213
  export type MockItemPrivateFirestoreCollectionGroup = FirestoreCollectionGroup<MockItemPrivate, MockItemPrivateDocument>;
208
214
  /**
209
215
  * Creates a {@link MockItemPrivateFirestoreCollectionGroup} for cross-parent queries on {@link MockItemPrivate}.
216
+ *
217
+ * @param firestoreContext - The Firestore context used to resolve the underlying collection group reference.
218
+ * @returns A typed {@link MockItemPrivateFirestoreCollectionGroup} wired with the {@link mockItemPrivateConverter}.
210
219
  */
211
220
  export declare function mockItemPrivateFirestoreCollectionGroup(firestoreContext: FirestoreContext): MockItemPrivateFirestoreCollectionGroup;
212
221
  /**
@@ -254,10 +263,11 @@ export declare const mockItemUserConverter: import("@dereekb/firebase").Snapshot
254
263
  uid: import("@dereekb/firebase").FirebaseAuthUserId;
255
264
  }, import("@dereekb/util").MaybeMap<object>, any>>>;
256
265
  /**
257
- * Used to build a mockItemCollection from a firestore instance with a converter setup.
266
+ * Creates a factory that produces {@link CollectionReference} instances for {@link MockItemUser}
267
+ * subcollections under a given {@link MockItemDocument} parent.
258
268
  *
259
- * @param firestore
260
- * @returns
269
+ * @param context - The Firestore context used to resolve subcollections.
270
+ * @returns A function that, given a parent {@link MockItemDocument}, returns a typed {@link CollectionReference} for that parent's MockItemUser subcollection.
261
271
  */
262
272
  export declare function mockItemUserCollectionReferenceFactory(context: FirestoreContext): (parent: MockItemDocument) => CollectionReference<MockItemUser>;
263
273
  /**
@@ -274,10 +284,16 @@ export type MockItemUserFirestoreCollection = FirestoreCollectionWithParent<Mock
274
284
  export type MockItemUserFirestoreCollectionFactory = (parent: MockItemDocument) => MockItemUserFirestoreCollection;
275
285
  /**
276
286
  * Creates a factory for producing {@link MockItemUserFirestoreCollection} instances bound to a parent {@link MockItemDocument}.
287
+ *
288
+ * @param firestoreContext - The Firestore context used to resolve the underlying subcollection.
289
+ * @returns A factory that, given a parent {@link MockItemDocument}, returns a per-parent collection wired with {@link mockItemUserConverter} and {@link mockItemUserAccessorFactory}.
277
290
  */
278
291
  export declare function mockItemUserFirestoreCollection(firestoreContext: FirestoreContext): MockItemUserFirestoreCollectionFactory;
279
292
  /**
280
293
  * Creates a {@link CollectionGroup} reference for querying all {@link MockItemUser} documents across parents.
294
+ *
295
+ * @param context - The Firestore context used to resolve the collection group.
296
+ * @returns A typed {@link CollectionGroup} reference for the MockItemUser collection name.
281
297
  */
282
298
  export declare function mockItemUserCollectionReference(context: FirestoreContext): CollectionGroup<MockItemUser>;
283
299
  /**
@@ -286,6 +302,9 @@ export declare function mockItemUserCollectionReference(context: FirestoreContex
286
302
  export type MockItemUserFirestoreCollectionGroup = FirestoreCollectionGroup<MockItemUser, MockItemUserDocument>;
287
303
  /**
288
304
  * Creates a {@link MockItemUserFirestoreCollectionGroup} for cross-parent queries on {@link MockItemUser}.
305
+ *
306
+ * @param firestoreContext - The Firestore context used to resolve the underlying collection group reference.
307
+ * @returns A typed {@link MockItemUserFirestoreCollectionGroup} wired with the {@link mockItemUserConverter} and {@link mockItemUserAccessorFactory}.
289
308
  */
290
309
  export declare function mockItemUserFirestoreCollectionGroup(firestoreContext: FirestoreContext): MockItemUserFirestoreCollectionGroup;
291
310
  /**
@@ -326,6 +345,9 @@ export declare const mockItemSubItemConverter: import("@dereekb/firebase").Snaps
326
345
  /**
327
346
  * Creates a factory that produces {@link CollectionReference} instances for {@link MockItemSubItem}
328
347
  * subcollections under a given {@link MockItemDocument} parent.
348
+ *
349
+ * @param context - The Firestore context used to resolve subcollections.
350
+ * @returns A function that, given a parent {@link MockItemDocument}, returns a typed {@link CollectionReference} for that parent's MockItemSubItem subcollection.
329
351
  */
330
352
  export declare function mockItemSubItemCollectionReferenceFactory(context: FirestoreContext): (parent: MockItemDocument) => CollectionReference<MockItemSubItem>;
331
353
  /**
@@ -338,10 +360,16 @@ export type MockItemSubItemFirestoreCollection = FirestoreCollectionWithParent<M
338
360
  export type MockItemSubItemFirestoreCollectionFactory = (parent: MockItemDocument) => MockItemSubItemFirestoreCollection;
339
361
  /**
340
362
  * Creates a factory for producing {@link MockItemSubItemFirestoreCollection} instances bound to a parent {@link MockItemDocument}.
363
+ *
364
+ * @param firestoreContext - The Firestore context used to resolve the underlying subcollection.
365
+ * @returns A factory that, given a parent {@link MockItemDocument}, returns a per-parent collection wired with {@link mockItemSubItemConverter}.
341
366
  */
342
367
  export declare function mockItemSubItemFirestoreCollection(firestoreContext: FirestoreContext): MockItemSubItemFirestoreCollectionFactory;
343
368
  /**
344
369
  * Creates a {@link CollectionGroup} reference for querying all {@link MockItemSubItem} documents across parents.
370
+ *
371
+ * @param context - The Firestore context used to resolve the collection group.
372
+ * @returns A typed {@link CollectionGroup} reference for the MockItemSubItem collection name.
345
373
  */
346
374
  export declare function mockItemSubItemCollectionReference(context: FirestoreContext): CollectionGroup<MockItemSubItem>;
347
375
  /**
@@ -350,6 +378,9 @@ export declare function mockItemSubItemCollectionReference(context: FirestoreCon
350
378
  export type MockItemSubItemFirestoreCollectionGroup = FirestoreCollectionGroup<MockItemSubItem, MockItemSubItemDocument>;
351
379
  /**
352
380
  * Creates a {@link MockItemSubItemFirestoreCollectionGroup} for cross-parent queries on {@link MockItemSubItem}.
381
+ *
382
+ * @param firestoreContext - The Firestore context used to resolve the underlying collection group reference.
383
+ * @returns A typed {@link MockItemSubItemFirestoreCollectionGroup} wired with the {@link mockItemSubItemConverter}.
353
384
  */
354
385
  export declare function mockItemSubItemFirestoreCollectionGroup(firestoreContext: FirestoreContext): MockItemSubItemFirestoreCollectionGroup;
355
386
  /**
@@ -390,6 +421,9 @@ export declare const mockItemSubItemDeepConverter: import("@dereekb/firebase").S
390
421
  /**
391
422
  * Creates a factory that produces {@link CollectionReference} instances for {@link MockItemSubItemDeep}
392
423
  * subcollections under a given {@link MockItemSubItemDocument} parent.
424
+ *
425
+ * @param context - The Firestore context used to resolve subcollections.
426
+ * @returns A function that, given a parent {@link MockItemSubItemDocument}, returns a typed {@link CollectionReference} for that parent's MockItemSubItemDeep subcollection.
393
427
  */
394
428
  export declare function mockItemSubItemDeepCollectionReferenceFactory(context: FirestoreContext): (parent: MockItemSubItemDocument) => CollectionReference<MockItemSubItemDeep>;
395
429
  /**
@@ -402,10 +436,16 @@ export type MockItemSubItemDeepFirestoreCollection = FirestoreCollectionWithPare
402
436
  export type MockItemSubItemDeepFirestoreCollectionFactory = (parent: MockItemSubItemDocument) => MockItemSubItemDeepFirestoreCollection;
403
437
  /**
404
438
  * Creates a factory for producing {@link MockItemSubItemDeepFirestoreCollection} instances bound to a parent {@link MockItemSubItemDocument}.
439
+ *
440
+ * @param firestoreContext - The Firestore context used to resolve the underlying subcollection.
441
+ * @returns A factory that, given a parent {@link MockItemSubItemDocument}, returns a per-parent collection wired with {@link mockItemSubItemDeepConverter}.
405
442
  */
406
443
  export declare function mockItemSubItemDeepFirestoreCollection(firestoreContext: FirestoreContext): MockItemSubItemDeepFirestoreCollectionFactory;
407
444
  /**
408
445
  * Creates a {@link CollectionGroup} reference for querying all {@link MockItemSubItemDeep} documents across parents.
446
+ *
447
+ * @param context - The Firestore context used to resolve the collection group.
448
+ * @returns A typed {@link CollectionGroup} reference for the MockItemSubItemDeep collection name.
409
449
  */
410
450
  export declare function mockItemSubItemDeepCollectionReference(context: FirestoreContext): CollectionGroup<MockItemSubItemDeep>;
411
451
  /**
@@ -414,6 +454,9 @@ export declare function mockItemSubItemDeepCollectionReference(context: Firestor
414
454
  export type MockItemSubItemDeepFirestoreCollectionGroup = FirestoreCollectionGroup<MockItemSubItemDeep, MockItemSubItemDeepDocument>;
415
455
  /**
416
456
  * Creates a {@link MockItemSubItemDeepFirestoreCollectionGroup} for cross-parent queries on {@link MockItemSubItemDeep}.
457
+ *
458
+ * @param firestoreContext - The Firestore context used to resolve the underlying collection group reference.
459
+ * @returns A typed {@link MockItemSubItemDeepFirestoreCollectionGroup} wired with the {@link mockItemSubItemDeepConverter}.
417
460
  */
418
461
  export declare function mockItemSubItemDeepFirestoreCollectionGroup(firestoreContext: FirestoreContext): MockItemSubItemDeepFirestoreCollectionGroup;
419
462
  /**
@@ -8,10 +8,16 @@ import { type FirestoreQueryConstraint, type DocumentReference } from '@dereekb/
8
8
  * const constraint = mockItemWithValue('hello');
9
9
  * const results = await collection.query(constraint);
10
10
  * ```
11
+ *
12
+ * @param value - The exact `value` to match.
13
+ * @returns A `where('value', '==', value)` constraint typed for {@link MockItem}.
11
14
  */
12
15
  export declare function mockItemWithValue(value: string): FirestoreQueryConstraint;
13
16
  /**
14
17
  * Creates a Firestore query constraint that filters {@link MockItem} documents by their `test` boolean field.
18
+ *
19
+ * @param test - The boolean value of the `test` field to match.
20
+ * @returns A `where('test', '==', test)` constraint.
15
21
  */
16
22
  export declare function mockItemWithTestValue(test: boolean): FirestoreQueryConstraint;
17
23
  /**
@@ -28,7 +34,7 @@ export declare function mockItemWithTestValue(test: boolean): FirestoreQueryCons
28
34
  * From:
29
35
  * https://medium.com/firebase-developers/how-to-query-collections-in-firestore-under-a-certain-path-6a0d686cebd2
30
36
  *
31
- * @param parent
32
- * @returns
37
+ * @param mockItem - The parent {@link MockItem} document reference whose descendant documents the constraint should bound to.
38
+ * @returns An array of constraints (suitable for use on a collection group query) that restricts results to documents under the given parent path.
33
39
  */
34
40
  export declare function allChildMockItemSubItemDeepsWithinMockItem(mockItem: DocumentReference<MockItem>): FirestoreQueryConstraint[];
@@ -24,6 +24,9 @@ export declare abstract class MockItemCollections {
24
24
  * Creates a concrete {@link MockItemCollections} instance with all collections bound to the given {@link FirestoreContext}.
25
25
  *
26
26
  * This is the primary way to instantiate the full set of mock collections for a test run.
27
+ *
28
+ * @param firestoreContext - The Firestore context (typically a {@link TestFirestoreContext}) that backs every collection.
29
+ * @returns A fully populated {@link MockItemCollections} with each mock collection, factory, and collection group wired to `firestoreContext`.
27
30
  */
28
31
  export declare function makeMockItemCollections(firestoreContext: FirestoreContext): MockItemCollections;
29
32
  /**
@@ -41,5 +41,8 @@ export interface MockItemStorageFirebaseStorageContextConfig {
41
41
  * it('should upload', () => { ... });
42
42
  * }));
43
43
  * ```
44
+ *
45
+ * @param _config - Reserved for future setup/teardown configuration; currently unused.
46
+ * @returns A factory builder that wraps a parent {@link TestFirebaseStorageContextFixture} with a {@link MockItemStorageFixture} per test.
44
47
  */
45
48
  export declare function testWithMockItemStorageFixture(_config?: MockItemStorageFirebaseStorageContextConfig): TestWrappedContextFactoryBuilder<MockItemStorageFixture, TestFirebaseStorageContextFixture>;
@@ -21,6 +21,7 @@ export interface MakeTestingFirebaseStorageAccessorDriverConfig {
21
21
  *
22
22
  * @param driver - The base storage accessor driver to wrap.
23
23
  * @param config - Optional configuration controlling test bucket behavior.
24
+ * @returns A driver with the same surface as `driver`, but with `getDefaultBucket` overridden to return a unique test bucket name when {@link MakeTestingFirebaseStorageAccessorDriverConfig.useTestDefaultBucket} requires it.
24
25
  */
25
26
  export declare function makeTestingFirebaseStorageAccesorDriver(driver: FirebaseStorageAccessorDriver, config?: MakeTestingFirebaseStorageAccessorDriverConfig): TestingFirebaseStorageAccessorDriver;
26
27
  /**
@@ -37,8 +38,9 @@ export interface TestingFirebaseStorageDrivers extends FirebaseStorageDrivers {
37
38
  /**
38
39
  * Extends the input drivers to generate new drivers for a testing environment.
39
40
  *
40
- * @param drivers
41
- * @returns
41
+ * @param drivers - The base Firebase Storage drivers to wrap.
42
+ * @param config - Optional config forwarded to {@link makeTestingFirebaseStorageAccesorDriver}; controls test-bucket override behavior.
43
+ * @returns A {@link TestingFirebaseStorageDrivers} marked with `storageDriverType: 'testing'` and a wrapped accessor driver.
42
44
  */
43
45
  export declare function makeTestingFirebaseStorageDrivers(drivers: FirebaseStorageDrivers, config?: MakeTestingFirebaseStorageAccessorDriverConfig): TestingFirebaseStorageDrivers;
44
46
  /**