@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/firebase",
3
- "version": "13.4.0",
3
+ "version": "13.4.2",
4
4
  "exports": {
5
5
  "./test": {
6
6
  "module": "./test/index.esm.js",
@@ -17,10 +17,10 @@
17
17
  }
18
18
  },
19
19
  "peerDependencies": {
20
- "@dereekb/util": "13.4.0",
21
- "@dereekb/date": "13.4.0",
22
- "@dereekb/model": "13.4.0",
23
- "@dereekb/rxjs": "13.4.0",
20
+ "@dereekb/util": "13.4.2",
21
+ "@dereekb/date": "13.4.2",
22
+ "@dereekb/model": "13.4.2",
23
+ "@dereekb/rxjs": "13.4.2",
24
24
  "@firebase/rules-unit-testing": "5.0.0",
25
25
  "arktype": "^2.2.0",
26
26
  "date-fns": "^4.0.0",
@@ -20,4 +20,4 @@ import { type FirebaseError } from 'firebase/app';
20
20
  * }
21
21
  * ```
22
22
  */
23
- export declare function isClientFirebaseError(error: any): error is FirebaseError;
23
+ export declare function isClientFirebaseError(error: unknown): error is FirebaseError;
@@ -22,6 +22,7 @@ export declare class WriteBatchFirestoreDocumentDataAccessor<T> extends DefaultF
22
22
  * into the same batch.
23
23
  *
24
24
  * @param writeBatch - the Firestore `WriteBatch` to queue operations into
25
+ * @returns a factory that creates write-batch-backed document data accessors for any document reference
25
26
  *
26
27
  * @example
27
28
  * ```ts
@@ -50,6 +51,7 @@ export declare class WriteBatchFirestoreDocumentContext<T> implements FirestoreD
50
51
  * Factory function that creates a {@link WriteBatchFirestoreDocumentContext} for the given batch.
51
52
  *
52
53
  * @param batch - the Firestore `WriteBatch` to use for all document operations
54
+ * @returns a new {@link WriteBatchFirestoreDocumentContext} bound to the given batch
53
55
  *
54
56
  * @example
55
57
  * ```ts
@@ -7,6 +7,7 @@ import { type WithFieldValue, type WriteResult } from '../../common/firestore/ty
7
7
  * Checks for document existence first, then calls `set()` if the document is absent.
8
8
  *
9
9
  * @param accessor - the accessor to perform the existence check and set operation on
10
+ * @returns a function that creates the document if it does not exist, or throws if it does
10
11
  * @throws {Error} When the document already exists at the reference path
11
12
  *
12
13
  * @example
@@ -8,6 +8,8 @@ import { type FirestoreAccessorDriver } from '../../common/firestore/driver/acce
8
8
  * - Transaction and write batch context factories for atomic operations
9
9
  * - A default (non-transactional) document context
10
10
  *
11
+ * @returns a {@link FirestoreAccessorDriver} backed by the `firebase/firestore` client SDK
12
+ *
11
13
  * @example
12
14
  * ```ts
13
15
  * const driver = firestoreClientAccessorDriver();
@@ -29,6 +29,8 @@ export declare class DefaultFirestoreDocumentDataAccessor<T> implements Firestor
29
29
  * Creates a {@link FirestoreDocumentDataAccessorFactory} that produces {@link DefaultFirestoreDocumentDataAccessor} instances
30
30
  * for direct (non-batched, non-transactional) Firestore operations.
31
31
  *
32
+ * @returns a factory that creates default (non-transactional) document data accessors
33
+ *
32
34
  * @example
33
35
  * ```ts
34
36
  * const factory = defaultFirestoreAccessorFactory<MyModel>();
@@ -43,6 +45,8 @@ export declare function defaultFirestoreAccessorFactory<T>(): FirestoreDocumentD
43
45
  * The context type is {@link FirestoreDocumentContextType.NONE}, meaning operations execute immediately
44
46
  * against Firestore without transaction or batch grouping.
45
47
  *
48
+ * @returns a default {@link FirestoreDocumentContext} with no transaction or batch semantics
49
+ *
46
50
  * @example
47
51
  * ```ts
48
52
  * const context = defaultFirestoreDocumentContext<MyModel>();
@@ -30,6 +30,7 @@ export declare class TransactionFirestoreDocumentDataAccessor<T> implements Fire
30
30
  * instances bound to the given transaction. All operations from these accessors participate in the same transaction.
31
31
  *
32
32
  * @param transaction - the Firestore `Transaction` to bind operations to
33
+ * @returns a factory that creates transaction-backed document data accessors for any document reference
33
34
  *
34
35
  * @example
35
36
  * ```ts
@@ -59,6 +60,7 @@ export declare class TransactionFirestoreDocumentContext<T> implements Firestore
59
60
  * Factory function that creates a {@link TransactionFirestoreDocumentContext} for the given transaction.
60
61
  *
61
62
  * @param transaction - the Firestore `Transaction` to use for all document operations
63
+ * @returns a new {@link TransactionFirestoreDocumentContext} bound to the given transaction
62
64
  *
63
65
  * @example
64
66
  * ```ts
@@ -10,6 +10,8 @@ export type FirebaseFirestoreClientDrivers = FirestoreDrivers;
10
10
  * Provides accessor drivers (default, batch, transaction) and query drivers for use
11
11
  * with {@link clientFirebaseFirestoreContextFactory}.
12
12
  *
13
+ * @returns the client-side {@link FirebaseFirestoreClientDrivers} for the `firebase/firestore` SDK
14
+ *
13
15
  * @example
14
16
  * ```ts
15
17
  * const drivers = firebaseFirestoreClientDrivers();
@@ -18,6 +18,7 @@ export interface FirebaseFirestoreQueryBuilder {
18
18
  *
19
19
  * @param builder - current query builder state
20
20
  * @param constraint - constraint(s) to append
21
+ * @returns a new {@link FirebaseFirestoreQueryBuilder} with the added constraint(s)
21
22
  */
22
23
  export declare function addConstraintToBuilder(builder: FirebaseFirestoreQueryBuilder, constraint: ArrayOrValue<QueryConstraint>): FirebaseFirestoreQueryBuilder;
23
24
  /**
@@ -31,6 +32,8 @@ export declare const FIRESTORE_CLIENT_QUERY_CONSTRAINT_HANDLER_MAPPING: FullFire
31
32
  *
32
33
  * Converts abstract query constraints into `firebase/firestore` `QueryConstraint` objects
33
34
  * and composes them into an executable `Query`.
35
+ *
36
+ * @returns a {@link FirestoreQueryConstraintFunctionsDriver} backed by the `firebase/firestore` client SDK
34
37
  */
35
38
  export declare function firebaseFirestoreQueryConstraintFunctionsDriver(): FirestoreQueryConstraintFunctionsDriver;
36
39
  /**
@@ -40,6 +43,8 @@ export declare function firebaseFirestoreQueryConstraintFunctionsDriver(): Fires
40
43
  * Note: Transactions are not supported for queries on the client; passing a `transaction` to `getDocs`
41
44
  * will throw an error.
42
45
  *
46
+ * @returns a {@link FirestoreQueryDriver} backed by the `firebase/firestore` client SDK
47
+ *
43
48
  * @example
44
49
  * ```ts
45
50
  * const queryDriver = firebaseFirestoreQueryDriver();
@@ -25,6 +25,7 @@ export type DevelopmentFirebaseFunctionMapFactory<M extends DevelopmentFirebaseF
25
25
  * through a single endpoint. The function specifier and data are wrapped via {@link onCallDevelopmentParams}.
26
26
  *
27
27
  * @param configMap - maps each development function key to optional configuration
28
+ * @returns a factory that creates a {@link DevelopmentFirebaseFunctionMap} for a given `Functions` instance
28
29
  *
29
30
  * @example
30
31
  * ```ts
@@ -28,6 +28,7 @@ export declare class FirebaseServerError<T extends ServerErrorResponseData = Ser
28
28
  * structured error details from the error's `details` property if available.
29
29
  *
30
30
  * @param error - the Firebase error from an `HttpsCallable` failure
31
+ * @returns a new {@link FirebaseServerError} wrapping the given Firebase error with structured server error details
31
32
  */
32
33
  static fromFirebaseError(error: FirebaseError): FirebaseServerError;
33
34
  constructor(firebaseError: FirebaseError, serverError: ServerError<T>);
@@ -9,9 +9,13 @@ import { type HttpsCallable } from 'firebase/functions';
9
9
  * @template B - the internal output type (what the callable returns)
10
10
  */
11
11
  export interface MapHttpsCallable<I, O, A, B> {
12
- /** Transforms the caller's input into the format expected by the underlying callable. */
12
+ /**
13
+ * Transforms the caller's input into the format expected by the underlying callable.
14
+ */
13
15
  readonly mapInput?: FactoryWithInput<PromiseOrValue<A>, Maybe<I>>;
14
- /** Transforms the callable's raw output into the format returned to callers. */
16
+ /**
17
+ * Transforms the callable's raw output into the format returned to callers.
18
+ */
15
19
  readonly mapOutput?: FactoryWithInput<PromiseOrValue<O>, Maybe<B>>;
16
20
  }
17
21
  /**
@@ -24,6 +28,7 @@ export interface MapHttpsCallable<I, O, A, B> {
24
28
  * @param callable - the underlying Firebase `HttpsCallable` to wrap
25
29
  * @param wrap - input/output mapping functions
26
30
  * @param directData - when `true`, returns the unwrapped data instead of `HttpsCallableResult`
31
+ * @returns a wrapped callable that applies input/output transformations and converts errors to readable forms
27
32
  *
28
33
  * @example
29
34
  * ```ts
@@ -49,6 +54,7 @@ export type DirectDataHttpsCallable<C extends HttpsCallable<any, any>> = C exten
49
54
  * Errors are converted to readable errors via {@link convertHttpsCallableErrorToReadableError}.
50
55
  *
51
56
  * @param callable - the `HttpsCallable` to wrap
57
+ * @returns a {@link DirectDataHttpsCallable} that resolves to the response data directly
52
58
  *
53
59
  * @example
54
60
  * ```ts
@@ -64,5 +70,6 @@ export declare function directDataHttpsCallable<I, O, C extends HttpsCallable<I,
64
70
  * to preserve server-side error context. Otherwise, converts it to a generic readable error via `toReadableError`.
65
71
  *
66
72
  * @param error - the caught error from an `HttpsCallable` invocation
73
+ * @returns a {@link FirebaseServerError} if the error has structured details, or a generic readable error otherwise
67
74
  */
68
75
  export declare function convertHttpsCallableErrorToReadableError(error: unknown): unknown;
@@ -28,6 +28,7 @@ export type FirebaseFunctionMapFactory<M extends FirebaseFunctionTypeMap> = (fun
28
28
  * for direct data access. Per-key options (e.g., timeout) are applied if provided.
29
29
  *
30
30
  * @param configMap - maps function keys to their optional configuration
31
+ * @returns a {@link FirebaseFunctionMapFactory} that creates a typed callable function map for a given `Functions` instance
31
32
  *
32
33
  * @example
33
34
  * ```ts
@@ -91,6 +92,7 @@ export type LazyFirebaseFunctions<M extends FirebaseFunctionsMap> = {
91
92
  * so `httpsCallable` instances are only created when actually needed.
92
93
  *
93
94
  * @param configMap - maps each function group key to its `[ClassType, Factory]` tuple
95
+ * @returns a {@link LazyFirebaseFunctionsFactory} that creates a lazy-loaded function map for a given `Functions` instance
94
96
  *
95
97
  * @example
96
98
  * ```ts
@@ -26,11 +26,17 @@ export type ModelFirebaseCrudFunction<I, O = void> = FirebaseFunction<I, O>;
26
26
  * Create function for a model. Returns {@link OnCallCreateModelResult} containing the created document's key by default.
27
27
  */
28
28
  export type ModelFirebaseCreateFunction<I, O extends OnCallCreateModelResult = OnCallCreateModelResult> = ModelFirebaseCrudFunction<I, O>;
29
- /** Read function for a model, returning the read data. */
29
+ /**
30
+ * Read function for a model, returning the read data.
31
+ */
30
32
  export type ModelFirebaseReadFunction<I, O> = ModelFirebaseCrudFunction<I, O>;
31
- /** Update function for a model. Returns void by default. */
33
+ /**
34
+ * Update function for a model. Returns void by default.
35
+ */
32
36
  export type ModelFirebaseUpdateFunction<I, O = void> = ModelFirebaseCrudFunction<I, O>;
33
- /** Delete function for a model. Returns void by default. */
37
+ /**
38
+ * Delete function for a model. Returns void by default.
39
+ */
34
40
  export type ModelFirebaseDeleteFunction<I, O = void> = ModelFirebaseCrudFunction<I, O>;
35
41
  /**
36
42
  * Maps each model type (from a {@link FirestoreModelIdentity}) to its CRUD function type configuration.
@@ -101,7 +107,7 @@ export type ModelFirebaseCrudFunctionMapEntry<MODEL extends string, E extends Mo
101
107
  export type ModelFirebaseCrudFunctionMapEntrySpecifier<MODEL extends string, CRUD extends string, M extends unknown | ModelFirebaseCrudFunctionTypeSpecifierConfig> = {
102
108
  [SPECIFIER in keyof M as SPECIFIER extends string ? (CRUD extends string ? (SPECIFIER extends ModelFirebaseCrudFunctionSpecifierDefault ? ModelFirebaseCrudFunctionName<MODEL, CRUD> : ModelFirebaseCrudFunctionWithSpecifierName<MODEL, CRUD, SPECIFIER>) : never) : never]: ModelFirebaseCrudFunctionMapEntryFunction<M, SPECIFIER, CRUD>;
103
109
  };
104
- export type ModelFirebaseCrudFunctionMapEntrySpecifierShort<MODEL extends string, CRUD extends string, M extends unknown | ModelFirebaseCrudFunctionTypeSpecifierConfig> = {
110
+ export type ModelFirebaseCrudFunctionMapEntrySpecifierShort<_MODEL extends string, CRUD extends string, M extends unknown | ModelFirebaseCrudFunctionTypeSpecifierConfig> = {
105
111
  [SPECIFIER in keyof M as SPECIFIER extends string ? (CRUD extends string ? (SPECIFIER extends ModelFirebaseCrudFunctionSpecifierDefault ? CRUD : SPECIFIER) : never) : never]: ModelFirebaseCrudFunctionMapEntryFunction<M, SPECIFIER, CRUD>;
106
112
  };
107
113
  export declare type ModelFirebaseCrudFunctionMapEntryFunction<E extends unknown | ModelFirebaseCrudFunctionTypeSpecifierConfig, K extends keyof E, CRUD extends string> = E[K] extends ModelFirebaseCrudFunctionTypeMapEntryWithReturnType<infer I, infer O> ? ModelFirebaseCrudFunction<I, O> : CRUD extends 'create' ? ModelFirebaseCreateFunction<E[K]> : ModelFirebaseCrudFunction<E[K]>;
@@ -127,6 +133,7 @@ export type ModelFirebaseFunctionMapFactory<M extends FirebaseFunctionTypeMap, U
127
133
  *
128
134
  * @param configMap - configuration for custom (non-CRUD) functions
129
135
  * @param crudConfigMap - configuration for model CRUD functions with optional specifiers
136
+ * @returns a {@link ModelFirebaseFunctionMapFactory} that creates a combined custom and CRUD function map for a given `Functions` instance
130
137
  *
131
138
  * @example
132
139
  * ```ts
@@ -9,6 +9,7 @@ import { type ErrorInput, type Maybe } from '@dereekb/util';
9
9
  * e.g., to silently handle deletion of already-deleted files.
10
10
  *
11
11
  * @param input - the error or error message to check
12
+ * @returns `true` if the error message contains `'storage/object-not-found'`, `false` otherwise
12
13
  *
13
14
  * @example
14
15
  * ```ts
@@ -27,6 +28,7 @@ export declare function isFirebaseStorageObjectNotFoundError(input: Maybe<ErrorI
27
28
  *
28
29
  * @param storage - the client Firebase Storage instance
29
30
  * @param path - abstract storage path to resolve
31
+ * @returns a `StorageReference` pointing to the resolved storage path
30
32
  */
31
33
  export declare function firebaseStorageRefForStorageFilePath(storage: ClientFirebaseStorage, path: StoragePath): StorageReference;
32
34
  /**
@@ -35,6 +37,7 @@ export declare function firebaseStorageRefForStorageFilePath(storage: ClientFire
35
37
  * Returns `true` if metadata is successfully retrieved, `false` for any error (including permission errors).
36
38
  *
37
39
  * @param ref - the storage reference to check
40
+ * @returns a promise that resolves to `true` if the file exists, `false` otherwise
38
41
  */
39
42
  export declare function firebaseStorageFileExists(ref: StorageReference): Promise<boolean>;
40
43
  /**
@@ -49,6 +52,7 @@ export type FirebaseStorageClientAccessorFile = FirebaseStorageAccessorFile<Stor
49
52
  *
50
53
  * @param storage - the client Firebase Storage instance
51
54
  * @param storagePath - the abstract storage path for the file
55
+ * @returns a {@link FirebaseStorageClientAccessorFile} providing CRUD and upload operations for the given path
52
56
  *
53
57
  * @example
54
58
  * ```ts
@@ -85,6 +89,7 @@ export declare const firebaseStorageClientListFilesResultFactory: import("../.."
85
89
  *
86
90
  * @param storage - the client Firebase Storage instance
87
91
  * @param storagePath - the abstract storage path for the folder
92
+ * @returns a {@link FirebaseStorageClientAccessorFolder} providing listing and existence operations for the given path
88
93
  *
89
94
  * @example
90
95
  * ```ts
@@ -101,6 +106,8 @@ export declare function firebaseStorageClientAccessorFolder(storage: ClientFireb
101
106
  * Provides file and folder accessor factories and default bucket resolution.
102
107
  * Used internally by {@link firebaseStorageClientDrivers}.
103
108
  *
109
+ * @returns a {@link FirebaseStorageAccessorDriver} backed by the `firebase/storage` client SDK
110
+ *
104
111
  * @example
105
112
  * ```ts
106
113
  * const driver = firebaseStorageClientAccessorDriver();
@@ -9,6 +9,8 @@ export type FirebaseStorageClientDrivers = FirebaseStorageDrivers;
9
9
  *
10
10
  * Provides file and folder accessor operations for use with {@link clientFirebaseStorageContextFactory}.
11
11
  *
12
+ * @returns the client-side {@link FirebaseStorageClientDrivers} for the `firebase/storage` SDK
13
+ *
12
14
  * @example
13
15
  * ```ts
14
16
  * const drivers = firebaseStorageClientDrivers();
@@ -8,14 +8,34 @@ export interface FirebaseAuthError {
8
8
  readonly name: string;
9
9
  readonly customData: unknown;
10
10
  }
11
- /** Error code when the user account is not found. */
11
+ /**
12
+ * Error code when the user account is not found.
13
+ */
12
14
  export declare const FIREBASE_AUTH_USER_NOT_FOUND_ERROR = "auth/user-not-found";
13
- /** Error code when the password is incorrect. */
15
+ /**
16
+ * Error code when the password is incorrect.
17
+ */
14
18
  export declare const FIREBASE_AUTH_WRONG_PASSWORD = "auth/wrong-password";
15
- /** Error code for a network request error (client SDK). */
19
+ /**
20
+ * Error code for a network request error (client SDK).
21
+ */
16
22
  export declare const FIREBASE_AUTH_NETWORK_REQUEST_ERROR = "auth/network-request-error";
17
- /** Error code for a failed network request (client SDK). */
23
+ /**
24
+ * Error code for a failed network request (client SDK).
25
+ */
18
26
  export declare const FIREBASE_AUTH_NETWORK_REQUEST_FAILED = "auth/network-request-failed";
27
+ /**
28
+ * Error code when a phone number is already associated with another account.
29
+ */
30
+ export declare const FIREBASE_AUTH_PHONE_NUMBER_ALREADY_EXISTS_ERROR = "auth/phone-number-already-exists";
31
+ /**
32
+ * Error code when an email is already associated with another account.
33
+ */
34
+ export declare const FIREBASE_AUTH_EMAIL_ALREADY_EXISTS_ERROR = "auth/email-already-exists";
35
+ /**
36
+ * Error code when the provided phone number is not a valid E.164 string.
37
+ */
38
+ export declare const FIREBASE_AUTH_INVALID_PHONE_NUMBER_ERROR = "auth/invalid-phone-number";
19
39
  /**
20
40
  * Converts a {@link FirebaseAuthError} into a user-friendly {@link ReadableError} with a human-readable message.
21
41
  *
@@ -23,6 +43,7 @@ export declare const FIREBASE_AUTH_NETWORK_REQUEST_FAILED = "auth/network-reques
23
43
  * suitable for display in the UI.
24
44
  *
25
45
  * @param inputError - the Firebase Auth error to convert
46
+ * @returns a {@link ReadableError} with a human-readable message suitable for display
26
47
  *
27
48
  * @example
28
49
  * ```ts
@@ -24,6 +24,7 @@ export interface OnCallDevelopmentParams<T = unknown> {
24
24
  *
25
25
  * @param specifier - the development function to invoke
26
26
  * @param data - the call payload
27
+ * @returns an {@link OnCallDevelopmentParams} envelope ready to send to the dev endpoint
27
28
  *
28
29
  * @example
29
30
  * ```ts
@@ -17,7 +17,9 @@ export declare enum ScheduledFunctionDevelopmentFunctionTypeEnum {
17
17
  */
18
18
  export interface ScheduledFunctionDevelopmentFirebaseFunctionParams {
19
19
  readonly type: ScheduledFunctionDevelopmentFunctionTypeEnum;
20
- /** Name of the scheduled function to run (required when type is 'run'). */
20
+ /**
21
+ * Name of the scheduled function to run (required when type is 'run').
22
+ */
21
23
  readonly run?: string;
22
24
  }
23
25
  /**
@@ -65,15 +65,22 @@ export declare function copyDocumentIdToFieldModifierFunction<T extends object>(
65
65
  /**
66
66
  * Creates an {@link InterceptAccessorFactoryFunction} that wraps all created accessors with
67
67
  * {@link ModifyBeforeSetFirestoreDocumentDataAccessorWrapper} using the provided config.
68
+ *
69
+ * @param config - The ModifyBeforeSetConfig defining when and how to modify documents
70
+ * @returns An InterceptAccessorFactoryFunction that wraps accessors with the modify-before-set behavior
68
71
  */
69
72
  export declare function modifyBeforeSetInterceptAccessorFactoryFunction<T extends object, D = DocumentData>(config: ModifyBeforeSetConfig<T>): InterceptAccessorFactoryFunction<T, D>;
70
73
  /**
71
74
  * Creates a modifier that copies the document ID to the `uid` field for {@link UserRelated} models.
75
+ *
76
+ * @returns A ModifyBeforeSetModifierFunction that sets the `uid` field to the document's ID
72
77
  */
73
78
  export declare function copyDocumentIdForUserRelatedModifierFunction<T extends UserRelated>(): ModifyBeforeSetModifierFunction<T>;
74
79
  /**
75
80
  * Returns a pre-configured {@link ModifyBeforeSetConfig} for {@link UserRelated} models
76
81
  * that copies the document ID to the `uid` field on set operations (new document creation).
82
+ *
83
+ * @returns A ModifyBeforeSetConfig configured to copy the document ID to the `uid` field on set
77
84
  */
78
85
  export declare function copyUserRelatedDataModifierConfig<T extends UserRelated>(): ModifyBeforeSetConfig<T>;
79
86
  /**
@@ -83,5 +90,7 @@ export declare const COPY_USER_RELATED_DATA_ACCESSOR_FACTORY_FUNCTION: import("@
83
90
  /**
84
91
  * Returns a typed {@link InterceptAccessorFactoryFunction} that applies the UserRelated
85
92
  * document ID copy modifier to all accessors created by the factory.
93
+ *
94
+ * @returns A typed InterceptAccessorFactoryFunction with the UserRelated document ID copy modifier applied
86
95
  */
87
96
  export declare function copyUserRelatedDataAccessorFactoryFunction<T extends UserRelated, D = DocumentData>(): InterceptAccessorFactoryFunction<T, D>;
@@ -11,11 +11,17 @@ import { type FirestoreDocumentDataAccessorFactory } from './accessor';
11
11
  * - BATCH: Operations within a Firestore write batch (atomic writes only, no reads)
12
12
  */
13
13
  export declare enum FirestoreDocumentContextType {
14
- /** Standard context with no special transactional semantics */
14
+ /**
15
+ * Standard context with no special transactional semantics
16
+ */
15
17
  NONE = "none",
16
- /** Operations within a Firestore transaction (atomic reads and writes) */
18
+ /**
19
+ * Operations within a Firestore transaction (atomic reads and writes)
20
+ */
17
21
  TRANSACTION = "transaction",
18
- /** Operations within a Firestore write batch (atomic writes only) */
22
+ /**
23
+ * Operations within a Firestore write batch (atomic writes only)
24
+ */
19
25
  BATCH = "batch"
20
26
  }
21
27
  /**
@@ -76,23 +76,27 @@ export declare abstract class AbstractFirestoreDocument<T, D extends AbstractFir
76
76
  /**
77
77
  * Retrieves a DocumentSnapshot of the document as an Observable. Streams based on the input mode.
78
78
  *
79
- * @returns
79
+ * @param mode - The stream mode controlling how the Observable emits snapshot updates
80
+ * @returns An Observable that emits DocumentSnapshot values based on the given mode
80
81
  */
81
82
  snapshotStream(mode: FirestoreAccessorStreamMode): Observable<DocumentSnapshot<T>>;
82
83
  /**
83
84
  * Retrieves the data of the DocumentSnapshot of the document as an Observable. Streams based on the input mode.
84
85
  *
85
- * @param options
86
- * @returns
86
+ * @param mode - The stream mode controlling how the Observable emits snapshot data updates
87
+ * @param options - Optional SnapshotOptions for reading the document data
88
+ * @returns An Observable that emits the document data or undefined based on the given mode
87
89
  */
88
90
  snapshotDataStream(mode: FirestoreAccessorStreamMode, options?: SnapshotOptions): Observable<Maybe<T>>;
89
91
  /**
90
92
  * Retrieves a DocumentSnapshot of the document.
93
+ *
91
94
  * @returns
92
95
  */
93
96
  snapshot(): Promise<DocumentSnapshot<T>>;
94
97
  /**
95
98
  * Retrieves the data of the DocumentSnapshot of the document.
99
+ *
96
100
  * @param options
97
101
  * @returns
98
102
  */
@@ -118,20 +122,23 @@ export declare abstract class AbstractFirestoreDocument<T, D extends AbstractFir
118
122
  *
119
123
  * Throws an exception when it does not exist.
120
124
  *
121
- * @param data
122
- * @returns
125
+ * @param data - Partial document data to update
126
+ * @param params - Optional update parameters
127
+ * @returns A Promise that resolves when the update completes
123
128
  */
124
129
  update(data: Partial<T>, params?: FirestoreDocumentUpdateParams): Promise<WriteResult | void>;
125
130
  /**
126
131
  * Updates the document using the accessor's increment functionality.
127
132
  *
128
- * @param data
133
+ * @param data - The increment update to apply to numeric fields
134
+ * @returns A Promise that resolves when the increment update completes
129
135
  */
130
136
  increment(data: FirestoreAccessorIncrementUpdate<T>): Promise<WriteResult | void>;
131
137
  /**
132
138
  * Updates the document using the accessor's array field update functionality.
133
139
  *
134
- * @param data
140
+ * @param data - The array field update to apply (union or remove elements)
141
+ * @returns A Promise that resolves when the array update completes
135
142
  */
136
143
  arrayUpdate(data: FirestoreAccessorArrayUpdate<T>): Promise<WriteResult | void>;
137
144
  }
@@ -254,6 +261,12 @@ export interface LimitedFirestoreDocumentAccessorFactoryConfig<T, D extends Fire
254
261
  readonly converterFactory?: InterceptFirestoreDataConverterFactory<T>;
255
262
  readonly makeDocument: FirestoreDocumentFactoryFunction<T, D>;
256
263
  }
264
+ /**
265
+ * Creates a {@link LimitedFirestoreDocumentAccessorFactoryFunction} from the provided configuration.
266
+ *
267
+ * @param config - Configuration including converter, accessor factory, and document factory
268
+ * @returns A factory function for creating LimitedFirestoreDocumentAccessor instances
269
+ */
257
270
  export declare function limitedFirestoreDocumentAccessorFactory<T, D extends FirestoreDocument<T> = FirestoreDocument<T>>(config: LimitedFirestoreDocumentAccessorFactoryConfig<T, D>): LimitedFirestoreDocumentAccessorFactoryFunction<T, D>;
258
271
  /**
259
272
  * Factory function used for creating a FirestoreDocumentAccessor.
@@ -269,6 +282,15 @@ export type FirestoreDocumentAccessorFactory<T, D extends FirestoreDocument<T> =
269
282
  export interface FirestoreDocumentAccessorFactoryConfig<T, D extends FirestoreDocument<T> = FirestoreDocument<T>> extends CollectionReferenceRef<T>, LimitedFirestoreDocumentAccessorFactoryConfig<T, D> {
270
283
  readonly makeDocument: FirestoreDocumentFactoryFunction<T, D>;
271
284
  }
285
+ /**
286
+ * Creates a {@link FirestoreDocumentAccessorFactoryFunction} from the provided configuration.
287
+ *
288
+ * Extends the limited accessor factory with collection-level operations such as creating new documents
289
+ * and loading documents by ID.
290
+ *
291
+ * @param config - Configuration including the collection reference and document factory
292
+ * @returns A factory function for creating FirestoreDocumentAccessor instances
293
+ */
272
294
  export declare function firestoreDocumentAccessorFactory<T, D extends FirestoreDocument<T> = FirestoreDocument<T>>(config: FirestoreDocumentAccessorFactoryConfig<T, D>): FirestoreDocumentAccessorFactoryFunction<T, D>;
273
295
  export interface LimitedFirestoreDocumentAccessorForTransactionFactory<T, D extends FirestoreDocument<T> = FirestoreDocument<T>, A extends LimitedFirestoreDocumentAccessor<T, D> = LimitedFirestoreDocumentAccessor<T, D>> {
274
296
  /**
@@ -294,6 +316,14 @@ export interface LimitedFirestoreDocumentAccessorContextExtension<T, D extends F
294
316
  }
295
317
  export interface FirestoreDocumentAccessorContextExtension<T, D extends FirestoreDocument<T> = FirestoreDocument<T>> extends FirestoreDocumentAccessorFactory<T, D>, FirestoreDocumentAccessorForTransactionFactory<T, D>, FirestoreDocumentAccessorForWriteBatchFactory<T, D> {
296
318
  }
319
+ /**
320
+ * Creates a context extension object that adds transaction and write batch accessor support to a document accessor.
321
+ *
322
+ * @param config - Configuration containing the document accessor and firestore accessor driver
323
+ * @param config.documentAccessor - The document accessor factory function
324
+ * @param config.firestoreAccessorDriver - The firestore accessor driver used to create transaction and write batch contexts
325
+ * @returns An extension object with document accessor factory methods for default, transaction, and write batch contexts
326
+ */
297
327
  export declare function firestoreDocumentAccessorContextExtension<T, D extends FirestoreDocument<T> = FirestoreDocument<T>>({ documentAccessor, firestoreAccessorDriver }: FirestoreDocumentAccessorContextExtensionConfig<T, D>): FirestoreDocumentAccessorContextExtension<T, D>;
298
328
  export declare function firestoreDocumentAccessorContextExtension<T, D extends FirestoreDocument<T> = FirestoreDocument<T>>({ documentAccessor, firestoreAccessorDriver }: LimitedFirestoreDocumentAccessorContextExtensionConfig<T, D>): LimitedFirestoreDocumentAccessorContextExtension<T, D>;
299
329
  /**
@@ -330,6 +360,12 @@ export interface FirestoreSingleDocumentAccessorConfig<T, D extends FirestoreDoc
330
360
  readonly singleItemIdentifier: string;
331
361
  readonly accessors: FirestoreDocumentAccessorContextExtension<T, D>;
332
362
  }
363
+ /**
364
+ * Creates a {@link FirestoreSingleDocumentAccessor} for a collection that contains a single known document.
365
+ *
366
+ * @param config - Configuration specifying the single item identifier and the document accessor context extension
367
+ * @returns A FirestoreSingleDocumentAccessor providing convenient access to the single document
368
+ */
333
369
  export declare function firestoreSingleDocumentAccessor<T, D extends FirestoreDocument<T> = FirestoreDocument<T>>(config: FirestoreSingleDocumentAccessorConfig<T, D>): FirestoreSingleDocumentAccessor<T, D>;
334
370
  /**
335
371
  * Default document ID used for single-document collections. The document is stored at path `<collection>/0`.
@@ -342,4 +378,10 @@ export interface SingleItemFirestoreCollectionDocumentIdentifierRef {
342
378
  */
343
379
  readonly singleItemIdentifier: SingleItemFirestoreCollectionDocumentIdentifier;
344
380
  }
381
+ /**
382
+ * Extends a Firestore collection object in-place with single-document accessor methods.
383
+ *
384
+ * @param x - The collection object to extend with single-document accessor methods
385
+ * @param singleItemIdentifier - Optional identifier for the single document; defaults to {@link DEFAULT_SINGLE_ITEM_FIRESTORE_COLLECTION_DOCUMENT_IDENTIFIER}
386
+ */
345
387
  export declare function extendFirestoreCollectionWithSingleDocumentAccessor<X extends FirestoreSingleDocumentAccessor<T, D> & FirestoreDocumentAccessorContextExtension<T, D>, T, D extends FirestoreDocument<T> = FirestoreDocument<T>>(x: Building<X>, singleItemIdentifier?: SingleItemFirestoreCollectionDocumentIdentifier): void;
@@ -79,9 +79,13 @@ export declare function getDocumentSnapshots<D extends FirestoreDocument<any>>(d
79
79
  * when you need both the document's methods (e.g. `update`, `create`) and its current data state.
80
80
  */
81
81
  export type FirestoreDocumentSnapshotPair<D extends FirestoreDocument<any>> = {
82
- /** The document instance used to fetch the snapshot. */
82
+ /**
83
+ * The document instance used to fetch the snapshot.
84
+ */
83
85
  readonly document: D;
84
- /** The fetched snapshot reflecting the document's current state in Firestore. */
86
+ /**
87
+ * The fetched snapshot reflecting the document's current state in Firestore.
88
+ */
85
89
  readonly snapshot: DocumentSnapshot<FirestoreDocumentData<D>>;
86
90
  };
87
91
  /**
@@ -106,11 +110,17 @@ export declare function getDocumentSnapshotPairs<D extends FirestoreDocument<any
106
110
  * in Firestore, `data` will be `undefined`.
107
111
  */
108
112
  export interface FirestoreDocumentSnapshotDataPair<D extends FirestoreDocument<any>> {
109
- /** The document instance used to fetch the snapshot. */
113
+ /**
114
+ * The document instance used to fetch the snapshot.
115
+ */
110
116
  readonly document: D;
111
- /** The fetched snapshot reflecting the document's current state in Firestore. */
117
+ /**
118
+ * The fetched snapshot reflecting the document's current state in Firestore.
119
+ */
112
120
  readonly snapshot: DocumentSnapshot<FirestoreDocumentData<D>>;
113
- /** The snapshot's data with `id` and `key` fields injected, or `undefined` if the document does not exist. */
121
+ /**
122
+ * The snapshot's data with `id` and `key` fields injected, or `undefined` if the document does not exist.
123
+ */
114
124
  readonly data: Maybe<DocumentDataWithIdAndKey<FirestoreDocumentData<D>>>;
115
125
  }
116
126
  /**
@@ -119,7 +129,9 @@ export interface FirestoreDocumentSnapshotDataPair<D extends FirestoreDocument<a
119
129
  * Used by functions like {@link getDocumentSnapshotDataPairsWithData} that filter out non-existent documents.
120
130
  */
121
131
  export interface FirestoreDocumentSnapshotDataPairWithData<D extends FirestoreDocument<any>> extends Omit<FirestoreDocumentSnapshotDataPair<D>, 'data'> {
122
- /** The snapshot's data with `id` and `key` fields injected (guaranteed to exist). */
132
+ /**
133
+ * The snapshot's data with `id` and `key` fields injected (guaranteed to exist).
134
+ */
123
135
  readonly data: DocumentDataWithIdAndKey<FirestoreDocumentData<D>>;
124
136
  }
125
137
  /**