@dereekb/firebase 13.4.0 → 13.4.2

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 (72) hide show
  1. package/index.cjs.js +895 -382
  2. package/index.esm.js +893 -383
  3. package/package.json +5 -5
  4. package/src/lib/client/error/error.d.ts +1 -1
  5. package/src/lib/client/firestore/driver.accessor.batch.d.ts +2 -0
  6. package/src/lib/client/firestore/driver.accessor.create.d.ts +1 -0
  7. package/src/lib/client/firestore/driver.accessor.d.ts +2 -0
  8. package/src/lib/client/firestore/driver.accessor.default.d.ts +4 -0
  9. package/src/lib/client/firestore/driver.accessor.transaction.d.ts +2 -0
  10. package/src/lib/client/firestore/driver.d.ts +2 -0
  11. package/src/lib/client/firestore/driver.query.d.ts +5 -0
  12. package/src/lib/client/function/development.function.factory.d.ts +1 -0
  13. package/src/lib/client/function/error.d.ts +1 -0
  14. package/src/lib/client/function/function.callable.d.ts +9 -2
  15. package/src/lib/client/function/function.factory.d.ts +2 -0
  16. package/src/lib/client/function/model.function.factory.d.ts +11 -4
  17. package/src/lib/client/storage/driver.accessor.d.ts +7 -0
  18. package/src/lib/client/storage/driver.d.ts +2 -0
  19. package/src/lib/common/auth/auth.error.d.ts +25 -4
  20. package/src/lib/common/development/function.d.ts +1 -0
  21. package/src/lib/common/development/function.schedule.d.ts +3 -1
  22. package/src/lib/common/firestore/accessor/accessor.wrap.modify.d.ts +9 -0
  23. package/src/lib/common/firestore/accessor/context.d.ts +9 -3
  24. package/src/lib/common/firestore/accessor/document.d.ts +49 -7
  25. package/src/lib/common/firestore/accessor/document.utility.d.ts +18 -6
  26. package/src/lib/common/firestore/collection/collection.d.ts +76 -11
  27. package/src/lib/common/firestore/driver/query.handler.d.ts +9 -3
  28. package/src/lib/common/firestore/snapshot/snapshot.field.d.ts +32 -1
  29. package/src/lib/common/model/function.d.ts +8 -3
  30. package/src/lib/common/model/model/model.loader.d.ts +1 -0
  31. package/src/lib/common/model/model.service.d.ts +9 -2
  32. package/src/lib/common/model/permission/permission.d.ts +12 -4
  33. package/src/lib/common/model/permission/permission.service.d.ts +1 -0
  34. package/src/lib/common/model/permission/permission.service.grant.d.ts +10 -0
  35. package/src/lib/common/model/permission/permission.service.role.d.ts +9 -7
  36. package/src/lib/common/storage/accessor/path.model.d.ts +1 -0
  37. package/src/lib/common/storage/context.d.ts +1 -0
  38. package/src/lib/common/storage/driver/accessor.iterate.d.ts +7 -0
  39. package/src/lib/common/storage/driver/accessor.util.d.ts +1 -0
  40. package/src/lib/common/storage/driver/error.d.ts +3 -0
  41. package/src/lib/common/storage/driver/list.d.ts +18 -3
  42. package/src/lib/common/storage/storage.d.ts +4 -0
  43. package/src/lib/common/storage/types.d.ts +3 -0
  44. package/src/lib/model/notification/notification.api.error.d.ts +27 -9
  45. package/src/lib/model/notification/notification.api.util.d.ts +12 -0
  46. package/src/lib/model/notification/notification.config.d.ts +28 -0
  47. package/src/lib/model/notification/notification.create.d.ts +24 -0
  48. package/src/lib/model/notification/notification.create.task.d.ts +2 -0
  49. package/src/lib/model/notification/notification.d.ts +42 -0
  50. package/src/lib/model/notification/notification.details.d.ts +3 -0
  51. package/src/lib/model/notification/notification.id.d.ts +4 -3
  52. package/src/lib/model/notification/notification.item.d.ts +2 -1
  53. package/src/lib/model/notification/notification.message.d.ts +6 -3
  54. package/src/lib/model/notification/notification.query.d.ts +12 -0
  55. package/src/lib/model/notification/notification.send.d.ts +4 -0
  56. package/src/lib/model/notification/notification.task.d.ts +7 -0
  57. package/src/lib/model/notification/notification.task.subtask.d.ts +5 -0
  58. package/src/lib/model/notification/notification.util.d.ts +38 -0
  59. package/src/lib/model/oidcmodel/oidcmodel.d.ts +6 -0
  60. package/src/lib/model/oidcmodel/oidcmodel.query.d.ts +18 -0
  61. package/src/lib/model/storagefile/storagefile.create.d.ts +4 -0
  62. package/src/lib/model/storagefile/storagefile.d.ts +16 -0
  63. package/src/lib/model/storagefile/storagefile.file.d.ts +2 -0
  64. package/src/lib/model/storagefile/storagefile.group.d.ts +4 -0
  65. package/src/lib/model/storagefile/storagefile.permission.d.ts +1 -0
  66. package/src/lib/model/storagefile/storagefile.query.d.ts +19 -0
  67. package/src/lib/model/storagefile/storagefile.task.d.ts +1 -0
  68. package/src/lib/model/storagefile/storagefile.upload.d.ts +6 -0
  69. package/src/lib/model/storagefile/storagefile.upload.determiner.d.ts +9 -0
  70. package/src/lib/model/storagefile/storagefile.util.d.ts +4 -0
  71. package/src/lib/model/system/system.d.ts +4 -0
  72. package/test/package.json +6 -6
@@ -24,7 +24,6 @@ export type FirestoreModelType = ModelTypeString;
24
24
  * Each collection name in the app should be unique, as usage of CollectionGroups would cause collections
25
25
  * with the same name to be returned regardless of their location in the document hierarchy.
26
26
  *
27
- *
28
27
  * @example 'u', 'ps', 'or'
29
28
  */
30
29
  export type FirestoreCollectionName = string;
@@ -162,6 +161,7 @@ export declare function firestoreModelIdentity<P extends FirestoreModelIdentity<
162
161
  export type FirestoreModelIdentityTypeMap = Map<FirestoreModelType | FirestoreCollectionName | FirestoreCollectionType, FirestoreModelType>;
163
162
  /**
164
163
  * Creates a FirestoreModelIdentityTypeMap from the input identities.
164
+ *
165
165
  * @param identities
166
166
  * @returns
167
167
  */
@@ -222,7 +222,7 @@ export type FirestoreModelId = string;
222
222
  /**
223
223
  * Input for firestoreModelId()
224
224
  */
225
- export type FirestoreModelIdInput = FirestoreModelId | FirestoreModelKey | DocumentReferenceRef<any> | FirestoreModelKeyRef | FirestoreModelIdRef;
225
+ export type FirestoreModelIdInput = FirestoreModelId | FirestoreModelKey | DocumentReferenceRef<object> | FirestoreModelKeyRef | FirestoreModelIdRef;
226
226
  /**
227
227
  * Reads a firestoreModelId from the input.
228
228
  *
@@ -287,7 +287,8 @@ export declare const FIRESTORE_MODEL_ID_REGEX: RegExp;
287
287
  /**
288
288
  * Returns true if the input string is a FirestoreModelId.
289
289
  *
290
- * @param input
290
+ * @param input - The string to test
291
+ * @returns True if the input is a valid FirestoreModelId
291
292
  */
292
293
  export declare function isFirestoreModelId(input: string | FirestoreModelId): input is FirestoreModelId;
293
294
  /**
@@ -329,13 +330,15 @@ export declare const FIRESTORE_MODEL_KEY_REGEX_STRICT: RegExp;
329
330
  /**
330
331
  * Returns true if the input string is a FirestoreModelKey.
331
332
  *
332
- * @param input
333
+ * @param input - The string to test
334
+ * @returns True if the input is a valid FirestoreModelKey
333
335
  */
334
336
  export declare function isFirestoreModelKey(input: string | FirestoreModelKey): input is FirestoreModelKey;
335
337
  /**
336
- * Returns true if the input string is a FirestoreModelId.
338
+ * Returns true if the input string is a FirestoreModelId or a FirestoreModelKey.
337
339
  *
338
- * @param input
340
+ * @param input - The string to test
341
+ * @returns True if the input is a valid FirestoreModelId or FirestoreModelKey
339
342
  */
340
343
  export declare function isFirestoreModelIdOrKey(input: string | FirestoreModelId | FirestoreModelKey): input is FirestoreModelId | FirestoreModelKey;
341
344
  /**
@@ -369,6 +372,9 @@ export declare const firestoreModelKey: <I extends RootFirestoreModelIdentity, K
369
372
  export type FirestoreModelKeyFactory<I extends RootFirestoreModelIdentity, K extends FirestoreModelId = FirestoreModelId> = (id: K) => FirestoreCollectionModelKey<I, K>;
370
373
  /**
371
374
  * Creates a FirestoreModelKeyFactory for the input root identity.
375
+ *
376
+ * @param identity - The root FirestoreModelIdentity to bind the factory to
377
+ * @returns A factory function that creates FirestoreModelKey values for the given identity and a provided id
372
378
  */
373
379
  export declare function firestoreModelKeyFactory<I extends RootFirestoreModelIdentity, K extends FirestoreModelId = FirestoreModelId>(identity: I): (id: K) => FirestoreCollectionModelKeyPart<I, K>;
374
380
  /**
@@ -413,6 +419,12 @@ export declare function firestoreModelKeyPath(...parts: FirestoreModelKeyPart[])
413
419
  */
414
420
  export declare function childFirestoreModelKeyPath(parent: FirestoreModelKeyPart, children: ArrayOrValue<FirestoreModelKeyPart>): FirestoreModelKey[];
415
421
  export type FirestoreModelCollectionAndIdPairObject = Record<FirestoreCollectionName, FirestoreModelId>;
422
+ /**
423
+ * Converts a FirestoreModelKey or reference into a record mapping each collection name to its document id.
424
+ *
425
+ * @param input - The FirestoreModelKey, DocumentReferenceRef, or FirestoreModelKeyRef to convert
426
+ * @returns An object mapping collection names to document ids, or undefined if the key is unavailable
427
+ */
416
428
  export declare function firestoreModelKeyPairObject(input: FirestoreModelKey | DocumentReferenceRef<unknown> | FirestoreModelKeyRef): Maybe<FirestoreModelCollectionAndIdPairObject>;
417
429
  /**
418
430
  * String that is composed of the FirestoreCollectionNames derived from an input FirestoreModelKey and joined together via a separator.
@@ -420,28 +432,68 @@ export declare function firestoreModelKeyPairObject(input: FirestoreModelKey | D
420
432
  * Is equivalent to a FirestoreCollectionType if the FIRESTORE_COLLECTION_NAME_SEPARATOR is used as the separator.
421
433
  */
422
434
  export type FirestoreModelCollectionTypeArrayName = string;
435
+ /**
436
+ * Returns the FirestoreCollectionType derived from the input FirestoreModelKey.
437
+ *
438
+ * @param input - The key or reference to extract the collection type from
439
+ * @returns The FirestoreCollectionType string, or undefined if the key is unavailable
440
+ */
423
441
  export declare function firestoreModelKeyCollectionType<T = unknown>(input: ReadFirestoreModelKeyInput<T>): Maybe<FirestoreCollectionType>;
442
+ /**
443
+ * Returns the collection type array name string derived from the input key, joined by the given separator.
444
+ *
445
+ * @param input - The key or reference to extract collection names from
446
+ * @param separator - The separator to join collection names with; defaults to the Firestore collection name separator
447
+ * @returns The joined collection type array name string, or undefined if the key is unavailable
448
+ */
424
449
  export declare function firestoreModelKeyCollectionTypeArrayName<T = unknown>(input: ReadFirestoreModelKeyInput<T>, separator?: string): Maybe<FirestoreModelCollectionTypeArrayName>;
450
+ /**
451
+ * Returns the collection type array name string derived from a FirestoreModelIdentity, joined by the given separator.
452
+ *
453
+ * @param input - The FirestoreModelIdentity to derive collection names from
454
+ * @param separator - The separator to join collection names with; defaults to the Firestore collection name separator
455
+ * @returns The joined collection type array name string
456
+ */
425
457
  export declare function firestoreIdentityTypeArrayName(input: FirestoreModelIdentity, separator?: string): FirestoreModelCollectionTypeArrayName;
426
458
  export type FirestoreModelCollectionTypeArray = FirestoreCollectionName[];
459
+ /**
460
+ * Returns an ordered array of collection names derived from a FirestoreModelIdentity, from root to leaf.
461
+ *
462
+ * @param input - The FirestoreModelIdentity to traverse
463
+ * @returns An array of FirestoreCollectionName values ordered from root to leaf
464
+ */
427
465
  export declare function firestoreIdentityTypeArray(input: FirestoreModelIdentity): FirestoreModelCollectionTypeArray;
466
+ /**
467
+ * Returns an ordered array of collection names derived from the input FirestoreModelKey.
468
+ *
469
+ * @param input - The key or reference to extract collection names from
470
+ * @returns An array of FirestoreCollectionName values, or undefined if the key is unavailable
471
+ */
428
472
  export declare function firestoreModelKeyCollectionTypeArray<T = unknown>(input: ReadFirestoreModelKeyInput<T>): Maybe<FirestoreModelCollectionTypeArray>;
429
473
  export interface FirestoreModelCollectionAndIdPair extends FirestoreModelIdRef, FirestoreCollectionNameRef {
430
474
  }
431
475
  /**
432
476
  * Returns the collection name of the input key.
433
477
  *
434
- * @param input
435
- * @returns
478
+ * @param input - The key or reference to extract the collection name from
479
+ * @returns The FirestoreCollectionName from the deepest key pair, or undefined if unavailable
436
480
  */
437
481
  export declare function firestoreModelKeyCollectionName<T = unknown>(input: ReadFirestoreModelKeyInput<T>): Maybe<FirestoreCollectionName>;
438
482
  /**
439
483
  * Returns the parent model key from up the specified amount of levels.
440
484
  *
441
- * @param input
442
- * @param maxLevelsUp
485
+ * @param input - The key or reference to extract the parent key from
486
+ * @param maxLevelsUp - The number of levels to traverse up the key hierarchy; defaults to 1
487
+ * @returns The parent FirestoreModelKey, or undefined if no parent exists
443
488
  */
444
489
  export declare function firestoreModelKeyParentKey<T = unknown>(input: ReadFirestoreModelKeyInput<T>, maxLevelsUp?: number): Maybe<FirestoreModelKey>;
490
+ /**
491
+ * Returns the collection/id pair array truncated by the specified number of levels from the end.
492
+ *
493
+ * @param input - The key or reference to extract pairs from
494
+ * @param maxLevelsUp - The number of levels to remove from the end; defaults to 1
495
+ * @returns An array of FirestoreModelCollectionAndIdPair values up to the parent level, or undefined if unavailable
496
+ */
445
497
  export declare function firestoreModelKeyParentKeyPartPairs<T = unknown>(input: ReadFirestoreModelKeyInput<T>, maxLevelsUp?: number): Maybe<FirestoreModelCollectionAndIdPair[]>;
446
498
  /**
447
499
  * Returns the last pair type from all generated pairs from the input.
@@ -450,6 +502,12 @@ export declare function firestoreModelKeyParentKeyPartPairs<T = unknown>(input:
450
502
  * @returns
451
503
  */
452
504
  export declare function firestoreModelKeyTypePair<T = unknown>(input: ReadFirestoreModelKeyInput<T>): Maybe<FirestoreModelCollectionAndIdPair>;
505
+ /**
506
+ * Parses a FirestoreModelKey into an ordered array of collection/id pair objects.
507
+ *
508
+ * @param input - The key or reference to parse
509
+ * @returns An array of FirestoreModelCollectionAndIdPair values, or undefined if the key is unavailable
510
+ */
453
511
  export declare function firestoreModelKeyPartPairs<T = unknown>(input: ReadFirestoreModelKeyInput<T>): Maybe<FirestoreModelCollectionAndIdPair[]>;
454
512
  /**
455
513
  * Creates a FirestoreModelKey from the input pairs.
@@ -466,6 +524,13 @@ export declare function firestoreModelKeyPartPairsKeyPath(input: FirestoreModelC
466
524
  */
467
525
  export declare function firestoreModelKeyPartPairsPaths(input: FirestoreModelCollectionAndIdPair[]): FirestoreModelKeyPart[];
468
526
  export type ReadFirestoreModelKeyInput<T = unknown> = FirestoreModelKey | FirestoreModelKeyRef | DocumentReferenceRef<T>;
527
+ /**
528
+ * Reads a FirestoreModelKey from the input, which may be a raw key string, a key ref, or a document reference ref.
529
+ *
530
+ * @param input - The key, key ref, or document reference ref to read
531
+ * @param required - Whether to throw if the key is not available; defaults to false
532
+ * @returns The FirestoreModelKey string, or undefined if unavailable and not required
533
+ */
469
534
  export declare function readFirestoreModelKey<T = unknown>(input: ReadFirestoreModelKeyInput<T>, required: true): FirestoreModelKey;
470
535
  export declare function readFirestoreModelKey<T = unknown>(input: ReadFirestoreModelKeyInput<T>, required: false): Maybe<FirestoreModelKey>;
471
536
  export declare function readFirestoreModelKey<T = unknown>(input: ReadFirestoreModelKeyInput<T>, required?: boolean): Maybe<FirestoreModelKey>;
@@ -548,7 +613,7 @@ export interface FirestoreCollectionRef<T, D extends FirestoreDocument<T> = Fire
548
613
  *
549
614
  * @template T - The data type of documents in the collection
550
615
  * @template D - The FirestoreDocument type that wraps the data
551
- * @param config - Configuration for the collection
616
+ * @param inputConfig - Configuration for the collection
552
617
  * @returns A fully configured FirestoreCollection instance
553
618
  */
554
619
  export declare function makeFirestoreCollection<T, D extends FirestoreDocument<T>>(inputConfig: FirestoreCollectionConfig<T, D>): FirestoreCollection<T, D>;
@@ -9,11 +9,17 @@ import { type FirestoreQueryConstraintFunctionsDriver } from './query';
9
9
  * @template B - The platform-specific query builder type (e.g., the Firestore Query itself)
10
10
  */
11
11
  export interface MakeFirestoreQueryConstraintFunctionsDriver<B> extends Omit<FirestoreQueryConstraintFunctionsDriver, 'query' | 'availableConstraintTypes'> {
12
- /** Maps constraint type names to handler functions that apply them to the builder. */
12
+ /**
13
+ * Maps constraint type names to handler functions that apply them to the builder.
14
+ */
13
15
  mapping: FirestoreQueryConstraintHandlerMap<B>;
14
- /** Initializes a builder from a base query. */
16
+ /**
17
+ * Initializes a builder from a base query.
18
+ */
15
19
  init: <T>(query: Query<T>) => B;
16
- /** Converts the finalized builder back to a query. */
20
+ /**
21
+ * Converts the finalized builder back to a query.
22
+ */
17
23
  build: <T>(builder: B) => Query<T>;
18
24
  }
19
25
  /**
@@ -852,6 +852,8 @@ export declare function firestoreMap<T, K extends string = string>(config?: Fire
852
852
  * FirestoreField configuration for a map of granted roles, keyed by model keys.
853
853
  *
854
854
  * Filters out models with no/null roles by default.
855
+ *
856
+ * @returns A field mapping configuration for a map of granted roles keyed by FirestoreModelKey
855
857
  */
856
858
  export declare function firestoreModelKeyGrantedRoleMap<R extends GrantedRole>(): FirestoreModelFieldMapFunctionsConfig<FirestoreMapFieldType<R, string>, FirestoreMapFieldType<R, string>>;
857
859
  /**
@@ -917,6 +919,9 @@ export declare function firestoreDencoderMap<D extends PrimativeKey, E extends P
917
919
  * FirestoreField configuration for a map of encoded granted roles, keyed by model keys.
918
920
  *
919
921
  * Filters out models with empty/no roles by default.
922
+ *
923
+ * @param dencoder - The dencoder function used to encode and decode the role values
924
+ * @returns A field mapping configuration for an encoded granted role map keyed by FirestoreModelKey
920
925
  */
921
926
  export declare function firestoreModelKeyEncodedGrantedRoleMap<D extends GrantedRole, E extends string>(dencoder: PrimativeKeyStringDencoderFunction<D, E>): FirestoreModelFieldMapFunctionsConfig<FirestoreEncodedObjectMapFieldValueType<D[], string>, FirestoreMapFieldType<E, string>>;
922
927
  /**
@@ -939,6 +944,8 @@ export declare function firestoreArrayMap<T, K extends string = string>(config?:
939
944
  * FirestoreField configuration for a map of granted roles, keyed by models keys.
940
945
  *
941
946
  * Filters empty roles/arrays by default.
947
+ *
948
+ * @returns A field mapping configuration for a map of granted role arrays keyed by FirestoreModelKey
942
949
  */
943
950
  export declare function firestoreModelKeyGrantedRoleArrayMap<R extends GrantedRole>(): FirestoreModelFieldMapFunctionsConfig<FirestoreMapFieldType<R[], string>, FirestoreMapFieldType<R[], string>>;
944
951
  /**
@@ -977,6 +984,9 @@ export type FirestoreObjectArrayFieldConfigFirestoreFieldInput<T extends object,
977
984
  *
978
985
  * Used internally by {@link firestoreObjectArray} to adapt field configs into the map functions
979
986
  * format needed for array element conversion.
987
+ *
988
+ * @param config - The FirestoreModelFieldMapFunctionsConfig to convert
989
+ * @returns A ModelMapFunctionsRef wrapping the derived map functions
980
990
  */
981
991
  export declare function firestoreFieldConfigToModelMapFunctionsRef<T extends object, O extends object = FirestoreModelData<T>>(config: FirestoreModelFieldMapFunctionsConfig<T, O>): ModelMapFunctionsRef<T, O>;
982
992
  /**
@@ -1065,7 +1075,10 @@ export type FirestoreTimezoneStringConfig = DefaultMapConfiguredFirestoreFieldCo
1065
1075
  /**
1066
1076
  * Default configuration for a TimezoneString.
1067
1077
  *
1068
- * The value defaults to UTC
1078
+ * The value defaults to UTC.
1079
+ *
1080
+ * @param config - Optional configuration for the timezone string field, including default value and pre-save default.
1081
+ * @returns A configured Firestore field that stores a TimezoneString value.
1069
1082
  */
1070
1083
  export declare function firestoreTimezoneString(config?: FirestoreTimezoneStringConfig): FirestoreModelFieldMapFunctionsConfig<string, string>;
1071
1084
  export declare const DEFAULT_WEBSITE_LINK: WebsiteLink;
@@ -1077,6 +1090,11 @@ export declare const firestoreWebsiteLinkAssignFn: MapFunction<WebsiteLink, Webs
1077
1090
  * @returns A field mapping configuration for website link values
1078
1091
  */
1079
1092
  export declare function firestoreWebsiteLink(): FirestoreModelFieldMapFunctionsConfig<WebsiteLink, WebsiteLink>;
1093
+ /**
1094
+ * Creates a field mapping configuration for Firestore arrays of WebsiteLink values.
1095
+ *
1096
+ * @returns A field mapping configuration for WebsiteLink array values
1097
+ */
1080
1098
  export declare function firestoreWebsiteLinkArray(): FirestoreModelFieldMapFunctionsConfig<WebsiteLink[], WebsiteLink[]>;
1081
1099
  export declare const DEFAULT_FIRESTORE_WEBSITE_FILE_LINK_VALUE: WebsiteFileLink;
1082
1100
  export declare const assignWebsiteFileLinkFunction: import("@dereekb/util").AssignValuesToPOJOFunction<WebsiteFileLink>;
@@ -1089,10 +1107,14 @@ export declare const firestoreWebsiteFileLinkAssignFn: MapFunction<WebsiteFileLi
1089
1107
  export declare function firestoreWebsiteFileLink(): FirestoreModelFieldMapFunctionsConfig<WebsiteFileLink, WebsiteFileLink>;
1090
1108
  /**
1091
1109
  * Stores the array of WebsiteFileLink values as an array of objects.
1110
+ *
1111
+ * @returns A field mapping configuration for WebsiteFileLink array values stored as objects
1092
1112
  */
1093
1113
  export declare function firestoreWebsiteFileLinkObjectArray(): FirestoreModelFieldMapFunctionsConfig<WebsiteFileLink[], WebsiteFileLink[]>;
1094
1114
  /**
1095
1115
  * Stores the array of WebsiteFileLink values as an array of EncodedWebsiteFileLink values.
1116
+ *
1117
+ * @returns A field mapping configuration for WebsiteFileLink array values stored in encoded form
1096
1118
  */
1097
1119
  export declare function firestoreWebsiteFileLinkEncodedArray(): FirestoreModelFieldMapFunctionsConfig<WebsiteFileLink[], string[]>;
1098
1120
  export declare const DEFAULT_DATE_CELL_RANGE_VALUE: DateCellRange;
@@ -1104,6 +1126,12 @@ export declare const firestoreDateCellRangeAssignFn: MapFunction<DateCellRange,
1104
1126
  * @returns A field mapping configuration for date cell range values
1105
1127
  */
1106
1128
  export declare function firestoreDateCellRange(): FirestoreModelFieldMapFunctionsConfig<DateCellRange, DateCellRange>;
1129
+ /**
1130
+ * Creates a field mapping configuration for Firestore arrays of DateCellRange values.
1131
+ *
1132
+ * @param sort - Whether to sort the array by index number; defaults to true
1133
+ * @returns A field mapping configuration for DateCellRange array values
1134
+ */
1107
1135
  export declare function firestoreDateCellRangeArray(sort?: boolean): FirestoreModelFieldMapFunctionsConfig<DateCellRange[], DateCellRange[]>;
1108
1136
  export declare const DEFAULT_FIRESTORE_DATE_CELL_SCHEDULE_VALUE: DateCellSchedule;
1109
1137
  export declare const assignDateCellScheduleFunction: import("@dereekb/util").AssignValuesToPOJOFunction<DateCellSchedule>;
@@ -1121,6 +1149,9 @@ export declare const DEFAULT_FIRESTORE_UNITED_STATES_ADDRESS_VALUE: UnitedStates
1121
1149
  export declare const assignUnitedStatesAddressFunction: import("@dereekb/util").AssignValuesToPOJOFunction<UnitedStatesAddress>;
1122
1150
  /**
1123
1151
  * Function to assign values from an input UnitedStatesAddress to a default UnitedStatesAddress.
1152
+ *
1153
+ * @param input - The source UnitedStatesAddress to copy values from
1154
+ * @returns A new UnitedStatesAddress with values assigned from the input
1124
1155
  */
1125
1156
  export declare const firestoreUnitedStatesAddressAssignFn: MapFunction<UnitedStatesAddress, UnitedStatesAddress>;
1126
1157
  /**
@@ -41,6 +41,7 @@ export type OnCallTypeModelParamsFunction = <T>(modelTypeInput: FirestoreModelTy
41
41
  * The returned function builds {@link OnCallTypedModelParams} for any model type.
42
42
  *
43
43
  * @param call - the CRUD call type to embed in generated params
44
+ * @returns an {@link OnCallTypeModelParamsFunction} pre-configured with the given call type
44
45
  * @throws {Error} When `modelType` is not provided or empty.
45
46
  *
46
47
  * @example
@@ -58,9 +59,11 @@ export declare function onCallTypedModelParamsFunction(call?: Maybe<OnCallFuncti
58
59
  *
59
60
  * @deprecated Move towards using onCallTypedModelParamsFunction directly with the call type instead of using this function. Will not be removed in the future.
60
61
  *
61
- * @param modelType
62
- * @param data
63
- * @returns
62
+ * @param modelTypeInput - the model type string or ref
63
+ * @param data - the call payload
64
+ * @param specifier - optional sub-function specifier
65
+ * @param call - the CRUD call type
66
+ * @returns the constructed {@link OnCallTypedModelParams}
64
67
  */
65
68
  export declare function onCallTypedModelParams<T>(modelTypeInput: FirestoreModelType | FirestoreModelTypeRef, data: T, specifier?: string, call?: OnCallFunctionType): OnCallTypedModelParams<T>;
66
69
  /**
@@ -112,6 +115,7 @@ export interface OnCallCreateModelResult {
112
115
  * Creates an {@link OnCallCreateModelResult} from document references by extracting their paths as model keys.
113
116
  *
114
117
  * @param result - document reference(s) from a create operation
118
+ * @returns an {@link OnCallCreateModelResult} with model keys extracted from document paths
115
119
  *
116
120
  * @example
117
121
  * ```ts
@@ -124,5 +128,6 @@ export declare function onCallCreateModelResultWithDocs(result: ArrayOrValue<Doc
124
128
  * Creates an {@link OnCallCreateModelResult} from model key(s), normalizing to an array.
125
129
  *
126
130
  * @param modelKeys - the model key(s) of the created document(s)
131
+ * @returns an {@link OnCallCreateModelResult} containing the keys as an array
127
132
  */
128
133
  export declare function onCallCreateModelResult(modelKeys: ArrayOrValue<FirestoreModelKey>): OnCallCreateModelResult;
@@ -38,6 +38,7 @@ export interface FirebaseModelLoader<C extends FirebaseModelLoaderContext, T, D
38
38
  * Automatically uses a transaction accessor when the context has an active transaction.
39
39
  *
40
40
  * @param getFirestoreCollection - function to retrieve the Firestore collection from context
41
+ * @returns a {@link FirebaseModelLoader} that loads document wrappers for given keys
41
42
  *
42
43
  * @example
43
44
  * ```ts
@@ -38,6 +38,7 @@ export interface FirebaseModelServiceConfig<C extends FirebaseModelServiceContex
38
38
  * Creates a {@link FirebaseModelService} that wires together model loading and permission evaluation.
39
39
  *
40
40
  * @param config - collection loader and role mapping functions
41
+ * @returns a {@link FirebaseModelService} combining model loading and permission evaluation
41
42
  *
42
43
  * @example
43
44
  * ```ts
@@ -56,6 +57,7 @@ export type FirebaseModelServiceFactory<C extends FirebaseModelServiceContext, T
56
57
  * Creates a {@link FirebaseModelServiceFactory} that lazily instantiates and caches the service.
57
58
  *
58
59
  * @param config - the service configuration
60
+ * @returns a {@link FirebaseModelServiceFactory} that lazily creates and caches the service
59
61
  */
60
62
  export declare function firebaseModelServiceFactory<C extends FirebaseModelServiceContext, T, D extends FirestoreDocument<T> = FirestoreDocument<T>, R extends GrantedRole = GrantedRole>(config: FirebaseModelServiceConfig<C, T, D, R>): FirebaseModelServiceFactory<C, T, D, R>;
61
63
  /**
@@ -101,6 +103,7 @@ export type InModelContextFirebaseModelServiceUseFunction<C extends FirebasePerm
101
103
  * with a model or key to perform permission-checked operations.
102
104
  *
103
105
  * @param factory - lazy getter for the underlying model service
106
+ * @returns an {@link InContextFirebaseModelServiceFactory} that binds contexts to the service
104
107
  */
105
108
  export declare function inContextFirebaseModelServiceFactory<C extends FirebaseModelServiceContext, T, D extends FirestoreDocument<T> = FirestoreDocument<T>, R extends GrantedRole = GrantedRole>(factory: FirebaseModelServiceGetter<C, T, D, R>): InContextFirebaseModelServiceFactory<C, T, D, R>;
106
109
  /**
@@ -140,8 +143,8 @@ export type FirebaseModelsServiceTypes<S extends FirebaseModelsService<any, any>
140
143
  * export const demoFirebaseModelServices = firebaseModelsService<typeof DEMO_FIREBASE_MODEL_SERVICE_FACTORIES, DemoFirebaseBaseContext, DemoFirebaseModelTypes>(DEMO_FIREBASE_MODEL_SERVICE_FACTORIES);
141
144
  * export type DemoFirebaseContext = DemoFirebaseBaseContext & { service: typeof demoFirebaseModelServices };
142
145
  *
143
- * @param services
144
- * @returns
146
+ * @param services - the map of model service getter factories
147
+ * @returns a {@link FirebaseModelsService} that dispatches to the appropriate model service by type
145
148
  */
146
149
  export declare function firebaseModelsService<X extends FirebaseModelsServiceFactory<C, I>, C extends FirebaseModelServiceContext, I extends FirestoreModelIdentity = FirestoreModelIdentity>(services: X): FirebaseModelsService<X, C>;
147
150
  /**
@@ -158,6 +161,7 @@ export type InContextFirebaseModelsServiceFactory<Y> = FirebaseModelsServiceType
158
161
  * The returned factory binds a context, so callers can then select individual model services by type.
159
162
  *
160
163
  * @param service - the multi-model service to wrap
164
+ * @returns an {@link InContextFirebaseModelsServiceFactory} that binds a context to the service
161
165
  */
162
166
  export declare function inContextFirebaseModelsServiceFactory<X extends FirebaseModelsServiceFactory<C, I>, C extends FirebaseModelServiceContext, I extends FirestoreModelIdentity = FirestoreModelIdentity>(service: FirebaseModelsService<X, C>): InContextFirebaseModelsServiceFactory<FirebaseModelsService<X, C>>;
163
167
  /**
@@ -181,6 +185,7 @@ export type UseFirebaseModelsServiceSelectionUseFunction<Y extends FirebaseModel
181
185
  * @param service - the multi-model service
182
186
  * @param type - the model type to select
183
187
  * @param select - selection params including context and key
188
+ * @returns the {@link FirebaseModelsServiceSelectionResult} bound to the specified model
184
189
  */
185
190
  export declare function selectFromFirebaseModelsService<Y extends FirebaseModelsService<any, any>, T extends FirebaseModelsServiceTypes<Y>>(service: Y, type: T, select: FirebaseModelsServiceSelection<Y, T>): FirebaseModelsServiceSelectionResult<Y, T>;
186
191
  /**
@@ -191,6 +196,7 @@ export declare function selectFromFirebaseModelsService<Y extends FirebaseModels
191
196
  * @param service - the multi-model service
192
197
  * @param type - the model type to select
193
198
  * @param select - selection params including context, key, and optional role requirements
199
+ * @returns a {@link UsePromiseFunction} for the resolved roles reader
194
200
  */
195
201
  export declare function useFirebaseModelsService<Y extends FirebaseModelsService<any, any>, T extends FirebaseModelsServiceTypes<Y>>(service: Y, type: T, select: UseFirebaseModelsServiceSelection<Y, T>): UseFirebaseModelsServiceSelectionResult<Y, T>;
196
202
  /**
@@ -199,5 +205,6 @@ export declare function useFirebaseModelsService<Y extends FirebaseModelsService
199
205
  * Useful for routing incoming requests to the correct model service by collection path.
200
206
  *
201
207
  * @param inContextFirebaseModelsService - context-bound multi-model service
208
+ * @returns a map of collection type strings to their {@link FirestoreModelIdentity} objects
202
209
  */
203
210
  export declare function buildFirebaseCollectionTypeModelTypeMap<Y extends FirebaseModelsService<any, any>>(inContextFirebaseModelsService: InContextFirebaseModelsService<Y>): import("..").FirestoreModelIdentityTypeMap;
@@ -9,13 +9,21 @@ import { type FirebasePermissionErrorContext } from './permission.context';
9
9
  * Passed to role-mapping functions so they can inspect the model's state to determine permissions.
10
10
  */
11
11
  export interface FirebasePermissionServiceModel<T, D extends FirestoreDocument<T> = FirestoreDocument<T>> {
12
- /** The {@link FirestoreDocument} wrapper. */
12
+ /**
13
+ * The {@link FirestoreDocument} wrapper.
14
+ */
13
15
  readonly document: D;
14
- /** The raw Firestore document snapshot. */
16
+ /**
17
+ * The raw Firestore document snapshot.
18
+ */
15
19
  readonly snapshot: DocumentSnapshot<T>;
16
- /** Whether the document exists in Firestore. */
20
+ /**
21
+ * Whether the document exists in Firestore.
22
+ */
17
23
  readonly exists: boolean;
18
- /** The deserialized document data, or `undefined` if it doesn't exist. */
24
+ /**
25
+ * The deserialized document data, or `undefined` if it doesn't exist.
26
+ */
19
27
  readonly data: Maybe<T>;
20
28
  }
21
29
  /**
@@ -35,6 +35,7 @@ export declare class FirebaseModelPermissionServiceInstance<C extends FirebaseMo
35
35
  * Creates a {@link FirebaseModelPermissionServiceInstance} from a delegate.
36
36
  *
37
37
  * @param delegate - provides model loading and role computation
38
+ * @returns a {@link FirebaseModelPermissionServiceInstance} configured with the given delegate
38
39
  */
39
40
  export declare function firebaseModelPermissionService<C extends FirebaseModelContext, T, D extends FirestoreDocument<T> = FirestoreDocument<T>, R extends string = string>(delegate: FirebasePermissionServiceInstanceDelegate<C, T, D, R>): FirebaseModelPermissionServiceInstance<C, T, D, R>;
40
41
  /**
@@ -7,12 +7,16 @@ import { type UserRelated } from '../../../model/user';
7
7
  * Decision function that checks if the current user is an admin in the given context.
8
8
  *
9
9
  * Returns `false` if no auth is present.
10
+ *
11
+ * @param context - the Firebase model context to evaluate
12
+ * @returns a promise resolving to `true` if the user is an admin, `false` otherwise
10
13
  */
11
14
  export declare const isAdminInFirebaseModelContext: AsyncDecisionFunction<FirebaseModelContext>;
12
15
  /**
13
16
  * Creates a {@link GrantRolesIfFunction} that grants the specified roles when the user is an admin.
14
17
  *
15
18
  * @param rolesToGrantToAdmin - roles to grant if the user is an admin
19
+ * @returns a {@link GrantRolesIfFunction} that grants the given roles when the user is an admin
16
20
  *
17
21
  * @example
18
22
  * ```ts
@@ -31,6 +35,7 @@ export declare const grantFullAccessIfAdmin: GeneralGrantRolesIfFunction<Firebas
31
35
  * @param context - the model context to check
32
36
  * @param rolesToGrantToAdmin - roles to grant if admin
33
37
  * @param otherwise - fallback role computation when not admin
38
+ * @returns a promise or value resolving to the granted role map
34
39
  */
35
40
  export declare function grantModelRolesIfAdmin<R extends string = string>(context: FirebaseModelContext, rolesToGrantToAdmin: GetterOrValue<GrantedRoleMap<R>>, otherwise?: GrantRolesOtherwiseFunction<R>): PromiseOrValue<GrantedRoleMap<R>>;
36
41
  /**
@@ -38,6 +43,7 @@ export declare function grantModelRolesIfAdmin<R extends string = string>(contex
38
43
  *
39
44
  * @param authRoles - the auth roles the user must have
40
45
  * @param rolesToGrantToAdmin - the model roles to grant if the auth roles are present
46
+ * @returns a {@link GrantRolesIfFunction} that grants the given roles when the user has the required auth roles
41
47
  */
42
48
  export declare function grantModelRolesIfHasAuthRolesFunction<R extends string = string>(authRoles: AuthRole[], rolesToGrantToAdmin: GetterOrValue<GrantedRoleMap<R>>): GrantRolesIfFunction<FirebaseModelContext, R>;
43
49
  /**
@@ -48,6 +54,7 @@ export type GrantModelRolesIfHasAuthRolesFactory = <R extends string = string>(c
48
54
  * Creates a reusable factory pre-configured with specific auth roles to check for.
49
55
  *
50
56
  * @param authRoles - the auth roles the user must have
57
+ * @returns a {@link GrantModelRolesIfHasAuthRolesFactory} pre-configured to check the given auth roles
51
58
  */
52
59
  export declare function grantModelRolesIfHasAuthRolesFactory(authRoles: IterableOrValue<AuthRole>): GrantModelRolesIfHasAuthRolesFactory;
53
60
  /**
@@ -80,6 +87,7 @@ export declare const isOwnerOfUserRelatedModelInFirebaseModelContext: AsyncDecis
80
87
  * Creates a {@link GrantRolesIfFunction} that grants roles when the authenticated user's UID matches the model's `uid` field.
81
88
  *
82
89
  * @param rolesToGrant - the roles to grant if the user owns the model
90
+ * @returns a {@link GrantRolesIfFunction} that grants roles when the authenticated user is the model owner
83
91
  *
84
92
  * @example
85
93
  * ```ts
@@ -107,6 +115,7 @@ export type GeneralGrantRolesOnlyIfFunction<C> = <R extends string = string>(con
107
115
  *
108
116
  * @param grantIf - decision function to evaluate
109
117
  * @param grantedRoles - roles to grant if the decision is `true`
118
+ * @returns a {@link GrantRolesOnlyIfFunction} that grants roles or returns no-access with no fallback
110
119
  */
111
120
  export declare function grantModelRolesOnlyIfFunction<C, R extends string = string>(grantIf: AsyncDecisionFunction<C>, grantedRoles: GetterOrValue<GrantedRoleMap<R>>): GrantRolesOnlyIfFunction<C, R>;
112
121
  /**
@@ -132,6 +141,7 @@ export type GrantRolesOtherwiseFunction<R extends string = string> = Getter<Gran
132
141
  *
133
142
  * @param grantIf - async decision function to evaluate
134
143
  * @param grantedRoles - roles to grant if the decision is `true`
144
+ * @returns a {@link GrantRolesIfFunction} that evaluates the condition and grants roles or falls back
135
145
  * @throws {Error} When `grantIf` is not provided.
136
146
  *
137
147
  * @example
@@ -39,7 +39,7 @@ export declare class ContextGrantedModelRolesReaderInstance<C extends FirebasePe
39
39
  get snapshot(): import("../..").DocumentSnapshot<T>;
40
40
  get exists(): boolean;
41
41
  get roleMap(): GrantedRoleMap<R>;
42
- truthMap<M extends GrantedRoleTruthMapObject<any, R>>(input: M): GrantedRoleTruthMap<M>;
42
+ truthMap<M extends GrantedRoleTruthMapObject<unknown, R>>(input: M): GrantedRoleTruthMap<M>;
43
43
  hasNoAccess(): boolean;
44
44
  hasRole(role: R): boolean;
45
45
  hasRoles(setIncludes: SetIncludesMode, roles: ArrayOrValue<R>): boolean;
@@ -53,21 +53,23 @@ export declare class ContextGrantedModelRolesReaderInstance<C extends FirebasePe
53
53
  }
54
54
  /**
55
55
  * Creates a new ContextGrantedModelRolesReader for the input model.
56
+ *
57
+ * @param service - the in-model-context permission service to read roles from
58
+ * @returns a promise resolving to a {@link ContextGrantedModelRolesReader} for the model
56
59
  */
57
60
  export declare function contextGrantedModelRolesReader<C extends FirebasePermissionErrorContext, T, D extends FirestoreDocument<T> = FirestoreDocument<T>, R extends GrantedRole = GrantedRole>(service: InModelContextFirebaseModelPermissionService<C, T, D, R>): Promise<ContextGrantedModelRolesReader<C, T, D, R>>;
58
61
  /**
59
62
  * Creates the default permission error message.
60
63
  *
61
- * @param contextGrantedModelRoles
62
- * @param role
63
- * @returns
64
+ * @param contextGrantedModelRoles - the granted model roles context to generate the message from
65
+ * @param roles - the required role(s) that were not satisfied
66
+ * @returns a human-readable permission error message string
64
67
  */
65
68
  export declare function contextGrantedModelRolesReaderPermissionErrorMessage(contextGrantedModelRoles: FirebaseContextGrantedModelRoles<FirebasePermissionErrorContext, unknown>, roles?: ArrayOrValue<GrantedRole>): string;
66
69
  /**
67
70
  * Creates the default does not exist error message.
68
71
  *
69
- * @param contextGrantedModelRoles
70
- * @param role
71
- * @returns
72
+ * @param contextGrantedModelRoles - the granted model roles context to generate the message from
73
+ * @returns a human-readable does-not-exist error message string
72
74
  */
73
75
  export declare function contextGrantedModelRolesReaderDoesNotExistErrorMessage(contextGrantedModelRoles: FirebaseContextGrantedModelRoles<FirebasePermissionErrorContext, unknown>): string;
@@ -34,6 +34,7 @@ export type ModelStorageSlashPathFactory<T extends object = object> = (input: Re
34
34
  * The generated paths follow the convention `/model/[basePath/]<modelKey>/[path]`.
35
35
  *
36
36
  * @param config - optional base path to nest under
37
+ * @returns a {@link ModelStorageSlashPathFactory} that maps Firestore model keys to storage paths
37
38
  *
38
39
  * @example
39
40
  * ```ts
@@ -40,6 +40,7 @@ export interface FirebaseStorageContextFactoryConfig {
40
40
  * a {@link StoragePathFactory} to normalize all path inputs.
41
41
  *
42
42
  * @param drivers - the storage driver implementations to use
43
+ * @returns a {@link FirebaseStorageContextFactory} that creates storage contexts for a given storage instance
43
44
  * @throws {Error} When a default bucket ID cannot be resolved from the driver or config.
44
45
  *
45
46
  * @example
@@ -25,6 +25,7 @@ export type IterateStorageListFilesFactory = FetchPageFactory<IterateStorageList
25
25
  * Wraps the folder's `list()` API with cursor-based pagination via {@link fetchPageFactory}.
26
26
  *
27
27
  * @param config - default listing options (e.g., maxResults)
28
+ * @returns an {@link IterateStorageListFilesFactory} for paginated file listing
28
29
  *
29
30
  * @example
30
31
  * ```ts
@@ -41,6 +42,9 @@ export type IterateStorageListFilesByEachFileConfig<T, R> = Omit<IterateFetchPag
41
42
  * Iterates through every file in a storage folder, invoking a callback for each individual file result.
42
43
  *
43
44
  * Convenience wrapper around {@link iterateFetchPagesByEachItem} pre-configured for storage listing.
45
+ *
46
+ * @param input - iteration configuration including folder, listing options, and per-item callback
47
+ * @returns the result of the paginated per-item iteration
44
48
  */
45
49
  export declare function iterateStorageListFilesByEachFile<T, R>(input: IterateStorageListFilesByEachFileConfig<T, R>): Promise<{
46
50
  totalItemsLoaded: number;
@@ -57,5 +61,8 @@ export type IterateStorageListFilesConfig<R> = Omit<IterateFetchPagesConfigWithF
57
61
  * Iterates through pages of file results in a storage folder, invoking a callback for each page.
58
62
  *
59
63
  * Convenience wrapper around {@link iterateFetchPages} pre-configured for storage listing.
64
+ *
65
+ * @param input - iteration configuration including folder, listing options, and per-page callback
66
+ * @returns the result of the paginated page-level iteration
60
67
  */
61
68
  export declare function iterateStorageListFiles<R>(input: IterateStorageListFilesConfig<R>): Promise<import("@dereekb/util/fetch").IterateFetchPagesResult>;
@@ -9,6 +9,7 @@ import { type FirebaseStorageAccessorFile } from './accessor';
9
9
  * @param file - the target file accessor to upload to
10
10
  * @param readableStream - the source stream to pipe
11
11
  * @param options - optional upload configuration (content type, metadata, etc.)
12
+ * @returns a promise that resolves when the upload stream has finished
12
13
  * @throws {StorageFileUploadStreamUnsupportedError} When the file accessor does not support stream uploads.
13
14
  *
14
15
  * @example
@@ -6,11 +6,14 @@ import { BaseError } from 'make-error';
6
6
  * Required when the upload input is a string, since the format (raw, base64, etc.) must be explicit.
7
7
  *
8
8
  * @param options - the upload options to extract from
9
+ * @returns the {@link StorageDataStringType} extracted from the options
9
10
  * @throws {Error} When `stringFormat` is not set in the options.
10
11
  */
11
12
  export declare function assertStorageUploadOptionsStringFormat(options?: StorageUploadOptions): StorageDataStringType;
12
13
  /**
13
14
  * Creates an error indicating that `stringFormat` was missing from upload options.
15
+ *
16
+ * @returns an {@link Error} describing the missing `stringFormat` in upload options
14
17
  */
15
18
  export declare function noStringFormatInStorageUploadOptionsError(): Error;
16
19
  /**