@dereekb/firebase-server 13.4.1 → 13.5.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.
Files changed (101) hide show
  1. package/index.cjs.js +405 -93
  2. package/index.esm.js +406 -94
  3. package/mailgun/package.json +9 -9
  4. package/model/index.cjs.js +639 -348
  5. package/model/index.esm.js +640 -349
  6. package/model/package.json +10 -10
  7. package/model/src/lib/mailgun/notification.send.service.mailgun.d.ts +1 -0
  8. package/model/src/lib/notification/index.d.ts +2 -2
  9. package/model/src/lib/notification/{notification.action.service.d.ts → notification.action.server.d.ts} +53 -1
  10. package/model/src/lib/notification/{notification.action.init.service.d.ts → notification.action.server.init.d.ts} +20 -0
  11. package/model/src/lib/notification/notification.config.service.d.ts +2 -0
  12. package/model/src/lib/notification/notification.create.run.d.ts +1 -0
  13. package/model/src/lib/notification/notification.error.d.ts +16 -0
  14. package/model/src/lib/notification/notification.expedite.service.d.ts +11 -3
  15. package/model/src/lib/notification/notification.module.d.ts +19 -6
  16. package/model/src/lib/notification/notification.send.service.notificationsummary.d.ts +1 -0
  17. package/model/src/lib/notification/notification.send.service.text.d.ts +2 -0
  18. package/model/src/lib/notification/notification.task.service.handler.d.ts +1 -0
  19. package/model/src/lib/notification/notification.task.service.util.d.ts +1 -0
  20. package/model/src/lib/notification/notification.task.subtask.handler.d.ts +3 -0
  21. package/model/src/lib/notification/notification.util.d.ts +4 -2
  22. package/model/src/lib/storagefile/index.d.ts +1 -1
  23. package/model/src/lib/storagefile/storagefile.action.server.d.ts +98 -1
  24. package/model/src/lib/storagefile/{storagefile.action.init.service.d.ts → storagefile.action.server.init.d.ts} +13 -2
  25. package/model/src/lib/storagefile/storagefile.error.d.ts +27 -0
  26. package/model/src/lib/storagefile/storagefile.module.d.ts +14 -4
  27. package/model/src/lib/storagefile/storagefile.task.service.handler.d.ts +29 -7
  28. package/model/src/lib/storagefile/storagefile.upload.service.initializer.d.ts +2 -0
  29. package/oidc/index.cjs.js +141 -31
  30. package/oidc/index.esm.js +141 -31
  31. package/oidc/package.json +11 -11
  32. package/oidc/src/lib/controller/oidc.interaction.controller.d.ts +12 -0
  33. package/oidc/src/lib/controller/oidc.wellknown.controller.d.ts +6 -0
  34. package/oidc/src/lib/model/jwks/jwks.d.ts +9 -0
  35. package/oidc/src/lib/model/jwks/jwks.query.d.ts +9 -0
  36. package/oidc/src/lib/model/oidc/oidcmodel.action.server.d.ts +13 -0
  37. package/oidc/src/lib/model/oidc/oidcmodel.module.d.ts +5 -1
  38. package/oidc/src/lib/oidc.config.d.ts +2 -1
  39. package/oidc/src/lib/oidc.module.d.ts +9 -2
  40. package/oidc/src/lib/service/oidc.account.service.d.ts +7 -0
  41. package/oidc/src/lib/service/oidc.adapter.service.d.ts +1 -0
  42. package/oidc/src/lib/service/oidc.config.service.d.ts +1 -0
  43. package/oidc/src/lib/service/oidc.encryption.service.d.ts +6 -0
  44. package/oidc/src/lib/service/oidc.interaction.service.d.ts +15 -0
  45. package/oidc/src/lib/service/oidc.jwks.service.d.ts +18 -2
  46. package/oidc/src/lib/service/oidc.service.d.ts +7 -3
  47. package/package.json +13 -13
  48. package/src/lib/auth/auth.context.d.ts +1 -0
  49. package/src/lib/auth/auth.service.d.ts +13 -0
  50. package/src/lib/env/env.config.d.ts +2 -0
  51. package/src/lib/env/env.service.d.ts +21 -7
  52. package/src/lib/firestore/array.d.ts +1 -0
  53. package/src/lib/firestore/driver.accessor.batch.d.ts +4 -0
  54. package/src/lib/firestore/driver.accessor.d.ts +4 -0
  55. package/src/lib/firestore/driver.accessor.default.d.ts +5 -1
  56. package/src/lib/firestore/driver.accessor.transaction.d.ts +4 -0
  57. package/src/lib/firestore/driver.d.ts +2 -0
  58. package/src/lib/firestore/driver.query.d.ts +4 -0
  59. package/src/lib/firestore/increment.d.ts +1 -0
  60. package/src/lib/function/assert.d.ts +7 -0
  61. package/src/lib/function/context.d.ts +4 -0
  62. package/src/lib/function/error.auth.d.ts +2 -0
  63. package/src/lib/function/error.d.ts +86 -11
  64. package/src/lib/index.d.ts +0 -1
  65. package/src/lib/nest/analytics/analytics.service.listener.d.ts +2 -0
  66. package/src/lib/nest/app.d.ts +6 -3
  67. package/src/lib/nest/auth/auth.module.d.ts +6 -0
  68. package/src/lib/nest/auth/auth.util.d.ts +19 -1
  69. package/src/lib/nest/development/development.app.function.d.ts +12 -4
  70. package/src/lib/nest/development/development.assert.function.d.ts +6 -2
  71. package/src/lib/nest/development/development.function.d.ts +6 -1
  72. package/src/lib/nest/development/development.schedule.function.d.ts +3 -1
  73. package/src/lib/nest/development/development.schedule.function.error.d.ts +8 -0
  74. package/src/lib/nest/env/env.service.d.ts +2 -0
  75. package/src/lib/nest/env/env.util.d.ts +6 -0
  76. package/src/lib/nest/firebase/firebase.module.d.ts +1 -0
  77. package/src/lib/nest/firestore/firestore.module.d.ts +8 -0
  78. package/src/lib/nest/function/context.d.ts +2 -0
  79. package/src/lib/nest/model/analytics.details.d.ts +21 -7
  80. package/src/lib/nest/model/analytics.emit.d.ts +3 -0
  81. package/src/lib/nest/model/analytics.handler.d.ts +30 -10
  82. package/src/lib/nest/model/api.details.d.ts +34 -1
  83. package/src/lib/nest/model/call.model.function.d.ts +20 -4
  84. package/src/lib/nest/model/create.model.function.d.ts +6 -1
  85. package/src/lib/nest/model/crud.assert.function.d.ts +12 -4
  86. package/src/lib/nest/model/delete.model.function.d.ts +6 -1
  87. package/src/lib/nest/model/permission.error.d.ts +7 -0
  88. package/src/lib/nest/model/read.model.function.d.ts +6 -1
  89. package/src/lib/nest/model/specifier.function.d.ts +3 -0
  90. package/src/lib/nest/model/update.model.function.d.ts +6 -1
  91. package/src/lib/nest/nest.provider.d.ts +10 -0
  92. package/src/lib/nest/storage/storage.module.d.ts +9 -0
  93. package/src/lib/storage/driver.accessor.d.ts +22 -0
  94. package/src/lib/storage/driver.d.ts +2 -0
  95. package/src/lib/storage/storage.d.ts +1 -0
  96. package/test/package.json +11 -11
  97. package/zoho/index.cjs.js +8 -6
  98. package/zoho/index.esm.js +8 -6
  99. package/zoho/package.json +9 -9
  100. package/zoho/src/lib/zoho.accounts.firebase.d.ts +2 -1
  101. package/zoho/src/lib/zoho.accounts.firebase.system.d.ts +2 -1
package/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { DBX_FIREBASE_SERVER_NO_AUTH_ERROR_CODE, FIREBASE_AUTH_USER_NOT_FOUND_ERROR, FIREBASE_SERVER_AUTH_CLAIMS_RESET_PASSWORD_KEY, FIREBASE_SERVER_AUTH_CLAIMS_RESET_LAST_COM_DATE_KEY, FIREBASE_SERVER_AUTH_CLAIMS_SETUP_PASSWORD_KEY, FIREBASE_AUTH_PHONE_NUMBER_ALREADY_EXISTS_ERROR, FIREBASE_AUTH_EMAIL_ALREADY_EXISTS_ERROR, FIREBASE_AUTH_INVALID_PHONE_NUMBER_ERROR, FIREBASE_SERVER_AUTH_CLAIMS_SETUP_LAST_COM_DATE_KEY, FirestoreDocumentContextType, streamFromOnSnapshot, makeFirestoreQueryConstraintFunctionsDriver, FIRESTORE_LIMIT_QUERY_CONSTRAINT_TYPE, FIRESTORE_LIMIT_TO_LAST_QUERY_CONSTRAINT_TYPE, FIRESTORE_ORDER_BY_QUERY_CONSTRAINT_TYPE, FIRESTORE_ORDER_BY_DOCUMENT_ID_QUERY_CONSTRAINT_TYPE, FIRESTORE_WHERE_QUERY_CONSTRAINT_TYPE, FIRESTORE_WHERE_DOCUMENT_ID_QUERY_CONSTRAINT_TYPE, FIRESTORE_OFFSET_QUERY_CONSTRAINT_TYPE, FIRESTORE_START_AT_QUERY_CONSTRAINT_TYPE, FIRESTORE_START_AT_VALUE_QUERY_CONSTRAINT_TYPE, FIRESTORE_START_AFTER_QUERY_CONSTRAINT_TYPE, FIRESTORE_END_AT_QUERY_CONSTRAINT_TYPE, FIRESTORE_END_AT_VALUE_QUERY_CONSTRAINT_TYPE, FIRESTORE_END_BEFORE_QUERY_CONSTRAINT_TYPE, firestoreContextFactory, firestoreField, optionalFirestoreField, setIdAndKeyFromKeyIdRefOnDocumentData, MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_DEFAULT, SCHEDULED_FUNCTION_DEV_FUNCTION_SPECIFIER, storageListFilesResultFactory, assertStorageUploadOptionsStringFormat, firebaseStorageContextFactory, inContextFirebaseModelsServiceFactory, useFirebaseModelsService } from '@dereekb/firebase';
1
+ import { DBX_FIREBASE_SERVER_NO_AUTH_ERROR_CODE, FIREBASE_AUTH_USER_NOT_FOUND_ERROR, FIREBASE_SERVER_AUTH_CLAIMS_RESET_PASSWORD_KEY, FIREBASE_SERVER_AUTH_CLAIMS_RESET_LAST_COM_DATE_KEY, FIREBASE_SERVER_AUTH_CLAIMS_SETUP_PASSWORD_KEY, FIREBASE_AUTH_PHONE_NUMBER_ALREADY_EXISTS_ERROR, FIREBASE_AUTH_EMAIL_ALREADY_EXISTS_ERROR, FIREBASE_AUTH_INVALID_PHONE_NUMBER_ERROR, FIREBASE_SERVER_AUTH_CLAIMS_SETUP_LAST_COM_DATE_KEY, FirestoreDocumentContextType, streamFromOnSnapshot, makeFirestoreQueryConstraintFunctionsDriver, FIRESTORE_LIMIT_QUERY_CONSTRAINT_TYPE, FIRESTORE_LIMIT_TO_LAST_QUERY_CONSTRAINT_TYPE, FIRESTORE_ORDER_BY_QUERY_CONSTRAINT_TYPE, FIRESTORE_ORDER_BY_DOCUMENT_ID_QUERY_CONSTRAINT_TYPE, FIRESTORE_WHERE_QUERY_CONSTRAINT_TYPE, FIRESTORE_WHERE_DOCUMENT_ID_QUERY_CONSTRAINT_TYPE, FIRESTORE_OFFSET_QUERY_CONSTRAINT_TYPE, FIRESTORE_START_AT_QUERY_CONSTRAINT_TYPE, FIRESTORE_START_AT_VALUE_QUERY_CONSTRAINT_TYPE, FIRESTORE_START_AFTER_QUERY_CONSTRAINT_TYPE, FIRESTORE_END_AT_QUERY_CONSTRAINT_TYPE, FIRESTORE_END_AT_VALUE_QUERY_CONSTRAINT_TYPE, FIRESTORE_END_BEFORE_QUERY_CONSTRAINT_TYPE, firestoreContextFactory, firestoreField, optionalFirestoreField, setIdAndKeyFromKeyIdRefOnDocumentData, MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_DEFAULT, ScheduledFunctionDevelopmentFunctionTypeEnum, SCHEDULED_FUNCTION_DEV_FUNCTION_SPECIFIER, storageListFilesResultFactory, assertStorageUploadOptionsStringFormat, firebaseStorageContextFactory, inContextFirebaseModelsServiceFactory, useFirebaseModelsService } from '@dereekb/firebase';
2
2
  import { partialServerError, isServerError, randomNumberFactory, cachedGetter, filterNullAndUndefinedValues, asSet, AUTH_ADMIN_ROLE, AUTH_TOS_SIGNED_ROLE, forEachKeyValue, KeyValueTypleValueFilter, filterUndefinedValues, isThrottled, mapObjectMap, batch, objectToMap, serverError, asArray, containsAllValues, websiteUrlDetails, mergeObjects, cronExpressionRepeatingEveryNMinutes, mapIdentityFunction, slashPathName, toRelativeSlashPathStartType, fixMultiSlashesInSlashPath, SLASH_PATH_SEPARATOR, objectHasNoKeys, pushItemOrArrayItemsIntoArray, makeGetter, asGetter, build } from '@dereekb/util';
3
3
  import { HttpsError } from 'firebase-functions/https';
4
4
  import { hoursToMs, toISODateString } from '@dereekb/date';
@@ -72,6 +72,8 @@ function _type_of$7(obj) {
72
72
  }
73
73
  /**
74
74
  * Creates an unauthenticated {@link HttpsError} indicating the request context has no auth data.
75
+ *
76
+ * @returns A new unauthenticated {@link HttpsError} with the no-auth error code.
75
77
  */ function unauthenticatedContextHasNoAuthData() {
76
78
  return unauthenticatedError({
77
79
  message: 'expected auth',
@@ -80,6 +82,8 @@ function _type_of$7(obj) {
80
82
  }
81
83
  /**
82
84
  * Creates an unauthenticated {@link HttpsError} indicating the request context has no user UID.
85
+ *
86
+ * @returns A new unauthenticated {@link HttpsError} with the no-auth error code.
83
87
  */ function unauthenticatedContextHasNoUidError() {
84
88
  return unauthenticatedError({
85
89
  message: 'no user uid',
@@ -93,9 +97,15 @@ function _type_of$7(obj) {
93
97
  * Each factory wraps the Firebase `HttpsError` with a consistent shape: an HTTP status code,
94
98
  * a string error code, and an optional {@link ServerError} detail object.
95
99
  */ var UNAUTHENTICATED_ERROR_CODE = 'UNAUTHENTICATED';
96
- /** Creates an unauthenticated (401) {@link HttpsError}. */ function unauthenticatedError(messageOrError) {
100
+ /**
101
+ * Creates an unauthenticated (401) {@link HttpsError}.
102
+ *
103
+ * @param messageOrError - Optional error message string or partial server error object.
104
+ * @returns A new unauthenticated (401) {@link HttpsError}.
105
+ */ function unauthenticatedError(messageOrError) {
106
+ var _serverError_message;
97
107
  var serverError = partialServerError(messageOrError);
98
- return new HttpsError('unauthenticated', (serverError === null || serverError === void 0 ? void 0 : serverError.message) || 'unauthenticated', _object_spread_props$c(_object_spread$g({
108
+ return new HttpsError('unauthenticated', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'unauthenticated', _object_spread_props$c(_object_spread$g({
99
109
  status: 401,
100
110
  code: UNAUTHENTICATED_ERROR_CODE
101
111
  }, serverError), {
@@ -103,9 +113,15 @@ function _type_of$7(obj) {
103
113
  }));
104
114
  }
105
115
  var FORBIDDEN_ERROR_CODE = 'FORBIDDEN';
106
- /** Creates a forbidden (403) {@link HttpsError}. */ function forbiddenError(messageOrError) {
116
+ /**
117
+ * Creates a forbidden (403) {@link HttpsError}.
118
+ *
119
+ * @param messageOrError - Optional error message string or partial server error object.
120
+ * @returns A new forbidden (403) {@link HttpsError}.
121
+ */ function forbiddenError(messageOrError) {
122
+ var _serverError_message;
107
123
  var serverError = partialServerError(messageOrError);
108
- return new HttpsError('permission-denied', (serverError === null || serverError === void 0 ? void 0 : serverError.message) || 'forbidden', _object_spread_props$c(_object_spread$g({
124
+ return new HttpsError('permission-denied', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'forbidden', _object_spread_props$c(_object_spread$g({
109
125
  status: 403,
110
126
  code: FORBIDDEN_ERROR_CODE
111
127
  }, serverError), {
@@ -113,9 +129,15 @@ var FORBIDDEN_ERROR_CODE = 'FORBIDDEN';
113
129
  }));
114
130
  }
115
131
  var PERMISSION_DENIED_ERROR_CODE = 'PERMISSION_DENIED';
116
- /** Creates a permission-denied (403) {@link HttpsError}. */ function permissionDeniedError(messageOrError) {
132
+ /**
133
+ * Creates a permission-denied (403) {@link HttpsError}.
134
+ *
135
+ * @param messageOrError - Optional error message string or partial server error object.
136
+ * @returns A new permission-denied (403) {@link HttpsError}.
137
+ */ function permissionDeniedError(messageOrError) {
138
+ var _serverError_message;
117
139
  var serverError = partialServerError(messageOrError);
118
- return new HttpsError('permission-denied', (serverError === null || serverError === void 0 ? void 0 : serverError.message) || 'permission denied', _object_spread_props$c(_object_spread$g({
140
+ return new HttpsError('permission-denied', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'permission denied', _object_spread_props$c(_object_spread$g({
119
141
  status: 403,
120
142
  code: PERMISSION_DENIED_ERROR_CODE
121
143
  }, serverError), {
@@ -123,9 +145,15 @@ var PERMISSION_DENIED_ERROR_CODE = 'PERMISSION_DENIED';
123
145
  }));
124
146
  }
125
147
  var NOT_FOUND_ERROR_CODE = 'NOT_FOUND';
126
- /** Creates a not-found (404) {@link HttpsError}. */ function notFoundError(messageOrError) {
148
+ /**
149
+ * Creates a not-found (404) {@link HttpsError}.
150
+ *
151
+ * @param messageOrError - Optional error message string or partial server error object.
152
+ * @returns A new not-found (404) {@link HttpsError}.
153
+ */ function notFoundError(messageOrError) {
154
+ var _serverError_message;
127
155
  var serverError = partialServerError(messageOrError);
128
- return new HttpsError('not-found', (serverError === null || serverError === void 0 ? void 0 : serverError.message) || 'not found', _object_spread_props$c(_object_spread$g({
156
+ return new HttpsError('not-found', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'not found', _object_spread_props$c(_object_spread$g({
129
157
  status: 404,
130
158
  code: NOT_FOUND_ERROR_CODE
131
159
  }, serverError), {
@@ -133,9 +161,15 @@ var NOT_FOUND_ERROR_CODE = 'NOT_FOUND';
133
161
  }));
134
162
  }
135
163
  var MODEL_NOT_AVAILABLE_ERROR_CODE = 'MODEL_NOT_AVAILABLE';
136
- /** Creates a model-not-available (404) {@link HttpsError}, used when a Firestore document does not exist. */ function modelNotAvailableError(messageOrError) {
164
+ /**
165
+ * Creates a model-not-available (404) {@link HttpsError}, used when a Firestore document does not exist.
166
+ *
167
+ * @param messageOrError - Optional error message string or partial server error object.
168
+ * @returns A new model-not-available (404) {@link HttpsError}.
169
+ */ function modelNotAvailableError(messageOrError) {
170
+ var _serverError_message;
137
171
  var serverError = partialServerError(messageOrError);
138
- return new HttpsError('not-found', (serverError === null || serverError === void 0 ? void 0 : serverError.message) || 'model was not available', _object_spread_props$c(_object_spread$g({
172
+ return new HttpsError('not-found', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'model was not available', _object_spread_props$c(_object_spread$g({
139
173
  status: 404,
140
174
  code: MODEL_NOT_AVAILABLE_ERROR_CODE
141
175
  }, serverError), {
@@ -143,9 +177,15 @@ var MODEL_NOT_AVAILABLE_ERROR_CODE = 'MODEL_NOT_AVAILABLE';
143
177
  }));
144
178
  }
145
179
  var BAD_REQUEST_ERROR_CODE = 'BAD_REQUEST';
146
- /** Creates a bad-request (400) {@link HttpsError}. */ function badRequestError(messageOrError) {
180
+ /**
181
+ * Creates a bad-request (400) {@link HttpsError}.
182
+ *
183
+ * @param messageOrError - Optional error message string or partial server error object.
184
+ * @returns A new bad-request (400) {@link HttpsError}.
185
+ */ function badRequestError(messageOrError) {
186
+ var _serverError_message;
147
187
  var serverError = partialServerError(messageOrError);
148
- return new HttpsError('invalid-argument', (serverError === null || serverError === void 0 ? void 0 : serverError.message) || 'bad request', _object_spread_props$c(_object_spread$g({
188
+ return new HttpsError('invalid-argument', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'bad request', _object_spread_props$c(_object_spread$g({
149
189
  status: 400,
150
190
  code: BAD_REQUEST_ERROR_CODE
151
191
  }, serverError), {
@@ -153,9 +193,15 @@ var BAD_REQUEST_ERROR_CODE = 'BAD_REQUEST';
153
193
  }));
154
194
  }
155
195
  var CONFLICT_ERROR_CODE = 'CONFLICT';
156
- /** Creates a precondition-conflict (409) {@link HttpsError}. */ function preconditionConflictError(messageOrError) {
196
+ /**
197
+ * Creates a precondition-conflict (409) {@link HttpsError}.
198
+ *
199
+ * @param messageOrError - Optional error message string or partial server error object.
200
+ * @returns A new precondition-conflict (409) {@link HttpsError}.
201
+ */ function preconditionConflictError(messageOrError) {
202
+ var _serverError_message;
157
203
  var serverError = partialServerError(messageOrError);
158
- return new HttpsError('failed-precondition', (serverError === null || serverError === void 0 ? void 0 : serverError.message) || 'conflict', _object_spread_props$c(_object_spread$g({
204
+ return new HttpsError('failed-precondition', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'conflict', _object_spread_props$c(_object_spread$g({
159
205
  status: 409,
160
206
  code: CONFLICT_ERROR_CODE
161
207
  }, serverError), {
@@ -163,9 +209,15 @@ var CONFLICT_ERROR_CODE = 'CONFLICT';
163
209
  }));
164
210
  }
165
211
  var ALREADY_EXISTS_ERROR_CODE = 'ALREADY_EXISTS';
166
- /** Creates an already-exists (409) {@link HttpsError}. */ function alreadyExistsError(messageOrError) {
212
+ /**
213
+ * Creates an already-exists (409) {@link HttpsError}.
214
+ *
215
+ * @param messageOrError - Optional error message string or partial server error object.
216
+ * @returns A new already-exists (409) {@link HttpsError}.
217
+ */ function alreadyExistsError(messageOrError) {
218
+ var _serverError_message;
167
219
  var serverError = partialServerError(messageOrError);
168
- return new HttpsError('already-exists', (serverError === null || serverError === void 0 ? void 0 : serverError.message) || 'already exists', _object_spread_props$c(_object_spread$g({
220
+ return new HttpsError('already-exists', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'already exists', _object_spread_props$c(_object_spread$g({
169
221
  status: 409,
170
222
  code: ALREADY_EXISTS_ERROR_CODE
171
223
  }, serverError), {
@@ -173,9 +225,15 @@ var ALREADY_EXISTS_ERROR_CODE = 'ALREADY_EXISTS';
173
225
  }));
174
226
  }
175
227
  var UNAVAILABLE_ERROR_CODE = 'UNAVAILABLE';
176
- /** Creates an unavailable (503) {@link HttpsError}. */ function unavailableError(messageOrError) {
228
+ /**
229
+ * Creates an unavailable (503) {@link HttpsError}.
230
+ *
231
+ * @param messageOrError - Optional error message string or partial server error object.
232
+ * @returns A new unavailable (503) {@link HttpsError}.
233
+ */ function unavailableError(messageOrError) {
234
+ var _serverError_message;
177
235
  var serverError = partialServerError(messageOrError);
178
- return new HttpsError('unavailable', (serverError === null || serverError === void 0 ? void 0 : serverError.message) || 'service unavailable', _object_spread_props$c(_object_spread$g({
236
+ return new HttpsError('unavailable', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'service unavailable', _object_spread_props$c(_object_spread$g({
179
237
  status: 503,
180
238
  code: UNAVAILABLE_ERROR_CODE
181
239
  }, serverError), {
@@ -183,9 +241,15 @@ var UNAVAILABLE_ERROR_CODE = 'UNAVAILABLE';
183
241
  }));
184
242
  }
185
243
  var UNAVAILABLE_OR_DEACTIVATED_FUNCTION_ERROR_CODE = 'UNAVAILABLE_OR_DEACTIVATED_FUNCTION';
186
- /** Creates an unimplemented (501) {@link HttpsError} for deactivated or unavailable functions. */ function unavailableOrDeactivatedFunctionError(messageOrError) {
244
+ /**
245
+ * Creates an unimplemented (501) {@link HttpsError} for deactivated or unavailable functions.
246
+ *
247
+ * @param messageOrError - Optional error message string or partial server error object.
248
+ * @returns A new unimplemented (501) {@link HttpsError}.
249
+ */ function unavailableOrDeactivatedFunctionError(messageOrError) {
250
+ var _serverError_message;
187
251
  var serverError = partialServerError(messageOrError);
188
- return new HttpsError('unimplemented', (serverError === null || serverError === void 0 ? void 0 : serverError.message) || 'the requested function is not available or has been deactivated for use', _object_spread_props$c(_object_spread$g({
252
+ return new HttpsError('unimplemented', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'the requested function is not available or has been deactivated for use', _object_spread_props$c(_object_spread$g({
189
253
  status: 501,
190
254
  code: UNAVAILABLE_OR_DEACTIVATED_FUNCTION_ERROR_CODE
191
255
  }, serverError), {
@@ -193,9 +257,15 @@ var UNAVAILABLE_OR_DEACTIVATED_FUNCTION_ERROR_CODE = 'UNAVAILABLE_OR_DEACTIVATED
193
257
  }));
194
258
  }
195
259
  var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
196
- /** Creates an internal-error (500) {@link HttpsError}. */ function internalServerError(messageOrError) {
260
+ /**
261
+ * Creates an internal-error (500) {@link HttpsError}.
262
+ *
263
+ * @param messageOrError - Optional error message string or partial server error object.
264
+ * @returns A new internal-error (500) {@link HttpsError}.
265
+ */ function internalServerError(messageOrError) {
266
+ var _serverError_message;
197
267
  var serverError = partialServerError(messageOrError);
198
- return new HttpsError('internal', (serverError === null || serverError === void 0 ? void 0 : serverError.message) || 'internal error', _object_spread_props$c(_object_spread$g({
268
+ return new HttpsError('internal', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'internal error', _object_spread_props$c(_object_spread$g({
199
269
  status: 500,
200
270
  code: INTERNAL_SERVER_ERROR_CODE
201
271
  }, serverError), {
@@ -204,13 +274,19 @@ var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
204
274
  }
205
275
  /**
206
276
  * Type guard for Firebase {@link HttpsError} instances.
277
+ *
278
+ * @param input - The value to check.
279
+ * @returns `true` if the input is a Firebase {@link HttpsError}.
207
280
  */ function isFirebaseHttpsError(input) {
208
- return (typeof input === "undefined" ? "undefined" : _type_of$7(input)) === 'object' && input.code != null && input.httpErrorCode != null && input.toJSON != null;
281
+ return (typeof input === "undefined" ? "undefined" : _type_of$7(input)) === 'object' && input != null && 'code' in input && 'httpErrorCode' in input && 'toJSON' in input;
209
282
  }
210
283
  /**
211
284
  * Type guard for Firebase Admin {@link admin.FirebaseError} instances.
285
+ *
286
+ * @param input - The value to check.
287
+ * @returns `true` if the input is a Firebase Admin {@link admin.FirebaseError}.
212
288
  */ function isFirebaseError(input) {
213
- return (typeof input === "undefined" ? "undefined" : _type_of$7(input)) === 'object' && input.code != null && input.message != null && input.toJSON != null;
289
+ return (typeof input === "undefined" ? "undefined" : _type_of$7(input)) === 'object' && input != null && 'code' in input && 'message' in input && 'toJSON' in input;
214
290
  }
215
291
  /**
216
292
  * Analyzes a caught error and extracts structured Firebase error information.
@@ -219,6 +295,7 @@ var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
219
295
  * and extracts any embedded error codes and {@link ServerError} details.
220
296
  *
221
297
  * @param e - The caught error to analyze.
298
+ * @returns Structured {@link FirebaseServerErrorInfo} with classified error details.
222
299
  *
223
300
  * @example
224
301
  * ```typescript
@@ -263,6 +340,9 @@ var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
263
340
  }
264
341
  /**
265
342
  * Returns a tuple of [firebaseErrorCode, errorInfo] for pattern-matching on Firebase error codes.
343
+ *
344
+ * @param e - The caught error to analyze.
345
+ * @returns A tuple of the Firebase error code (if present) and the full error info.
266
346
  */ function firebaseServerErrorInfoCodePair(e) {
267
347
  var info = firebaseServerErrorInfo(e);
268
348
  return [
@@ -272,6 +352,9 @@ var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
272
352
  }
273
353
  /**
274
354
  * Returns a tuple of [serverError, errorInfo] for pattern-matching on embedded server error details.
355
+ *
356
+ * @param e - The caught error to analyze.
357
+ * @returns A tuple of the server error (if present) and the full error info.
275
358
  */ function firebaseServerErrorInfoServerErrorPair(e) {
276
359
  var info = firebaseServerErrorInfo(e);
277
360
  return [
@@ -281,6 +364,9 @@ var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
281
364
  }
282
365
  /**
283
366
  * Returns a tuple of [serverErrorCode, errorInfo] for pattern-matching on server error string codes.
367
+ *
368
+ * @param e - The caught error to analyze.
369
+ * @returns A tuple of the server error code (if present) and the full error info.
284
370
  */ function firebaseServerErrorInfoServerErrorCodePair(e) {
285
371
  var info = firebaseServerErrorInfo(e);
286
372
  return [
@@ -305,6 +391,9 @@ var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
305
391
  /**
306
392
  * Type guard that checks whether the given callable context contains authenticated user data (non-null auth with a uid).
307
393
  *
394
+ * @param context - The callable context to check.
395
+ * @returns `true` if the context has authenticated user data with a valid UID.
396
+ *
308
397
  * @example
309
398
  * ```typescript
310
399
  * if (isContextWithAuthData(context)) {
@@ -313,11 +402,12 @@ var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
313
402
  * ```
314
403
  */ function isContextWithAuthData(context) {
315
404
  var _context_auth;
316
- return Boolean(context.auth !== null && ((_context_auth = context.auth) === null || _context_auth === void 0 ? void 0 : _context_auth.uid));
405
+ return Boolean((_context_auth = context.auth) === null || _context_auth === void 0 ? void 0 : _context_auth.uid);
317
406
  }
318
407
  /**
319
408
  * Asserts that the callable context contains authenticated user data.
320
409
  *
410
+ * @param context - The callable context to assert on.
321
411
  * @throws {HttpsError} Throws an unauthenticated error if auth data is missing.
322
412
  *
323
413
  * @example
@@ -338,6 +428,7 @@ var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
338
428
  * including email, phone, and sign-in timestamps.
339
429
  *
340
430
  * @param token - The decoded ID token from Firebase Admin Auth.
431
+ * @returns A normalized {@link FirebaseAuthToken} with camelCase fields.
341
432
  *
342
433
  * @example
343
434
  * ```typescript
@@ -521,7 +612,7 @@ function _ts_generator$c(thisArg, body) {
521
612
  ];
522
613
  case 2:
523
614
  error = _state.sent();
524
- if ((error === null || error === void 0 ? void 0 : error.code) === FIREBASE_AUTH_USER_NOT_FOUND_ERROR) {
615
+ if (error.code === FIREBASE_AUTH_USER_NOT_FOUND_ERROR) {
525
616
  return [
526
617
  2,
527
618
  undefined
@@ -717,6 +808,9 @@ function _array_like_to_array$a(arr, len) {
717
808
  function _array_with_holes$3(arr) {
718
809
  if (Array.isArray(arr)) return arr;
719
810
  }
811
+ function _array_without_holes$7(arr) {
812
+ if (Array.isArray(arr)) return _array_like_to_array$a(arr);
813
+ }
720
814
  function _assert_this_initialized$4(self) {
721
815
  if (self === void 0) {
722
816
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
@@ -806,6 +900,9 @@ function _inherits$4(subClass, superClass) {
806
900
  });
807
901
  if (superClass) _set_prototype_of$4(subClass, superClass);
808
902
  }
903
+ function _iterable_to_array$7(iter) {
904
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
905
+ }
809
906
  function _iterable_to_array_limit$3(arr, i) {
810
907
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
811
908
  if (_i == null) return;
@@ -833,6 +930,9 @@ function _iterable_to_array_limit$3(arr, i) {
833
930
  function _non_iterable_rest$3() {
834
931
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
835
932
  }
933
+ function _non_iterable_spread$7() {
934
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
935
+ }
836
936
  function _object_spread$f(target) {
837
937
  for(var i = 1; i < arguments.length; i++){
838
938
  var source = arguments[i] != null ? arguments[i] : {};
@@ -864,6 +964,9 @@ function _set_prototype_of$4(o, p) {
864
964
  function _sliced_to_array$3(arr, i) {
865
965
  return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$a(arr, i) || _non_iterable_rest$3();
866
966
  }
967
+ function _to_consumable_array$7(arr) {
968
+ return _array_without_holes$7(arr) || _iterable_to_array$7(arr) || _unsupported_iterable_to_array$a(arr) || _non_iterable_spread$7();
969
+ }
867
970
  function _type_of$5(obj) {
868
971
  "@swc/helpers - typeof";
869
972
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
@@ -1071,6 +1174,8 @@ function _ts_generator$b(thisArg, body) {
1071
1174
  {
1072
1175
  /**
1073
1176
  * Generates a random numeric string for use as a temporary reset password.
1177
+ *
1178
+ * @returns A random numeric string suitable as a temporary password.
1074
1179
  */ key: "_generateResetPasswordKey",
1075
1180
  value: function _generateResetPasswordKey() {
1076
1181
  return String(DEFAULT_FIREBASE_PASSWORD_NUMBER_GENERATOR());
@@ -1251,6 +1356,7 @@ function _ts_generator$b(thisArg, body) {
1251
1356
  *
1252
1357
  * @param roles - The complete set of roles to assign.
1253
1358
  * @param claimsToRetain - Additional claims to merge in alongside the role-derived claims.
1359
+ * @returns Resolves when the claims have been replaced.
1254
1360
  *
1255
1361
  * @example
1256
1362
  * ```typescript
@@ -1261,7 +1367,7 @@ function _ts_generator$b(thisArg, body) {
1261
1367
  return _async_to_generator$b(function() {
1262
1368
  var claims;
1263
1369
  return _ts_generator$b(this, function(_state) {
1264
- claims = _object_spread$f({}, claimsToRetain, this._claimsForRolesChange(Array.from(roles)));
1370
+ claims = _object_spread$f({}, claimsToRetain, this._claimsForRolesChange(_to_consumable_array$7(roles)));
1265
1371
  return [
1266
1372
  2,
1267
1373
  this.setClaims(claims)
@@ -1274,6 +1380,9 @@ function _ts_generator$b(thisArg, body) {
1274
1380
  /**
1275
1381
  * Converts roles to their corresponding claim keys, filtering out null/undefined entries
1276
1382
  * that represent unrelated claims in the service's {@link FirebaseServerAuthService.claimsForRoles} output.
1383
+ *
1384
+ * @param roles - The roles to convert to claims.
1385
+ * @returns Filtered claims object with only the relevant role-based entries.
1277
1386
  */ key: "_claimsForRolesChange",
1278
1387
  value: function _claimsForRolesChange(roles) {
1279
1388
  return filterNullAndUndefinedValues(this.service.claimsForRoles(asSet(roles)));
@@ -1302,12 +1411,8 @@ function _ts_generator$b(thisArg, body) {
1302
1411
  ];
1303
1412
  case 1:
1304
1413
  currentClaims = _state.sent();
1305
- if (currentClaims) {
1306
- newClaims = _object_spread$f({}, currentClaims, filterUndefinedValues(claims, false));
1307
- newClaims = filterNullAndUndefinedValues(newClaims);
1308
- } else {
1309
- newClaims = claims;
1310
- }
1414
+ newClaims = _object_spread$f({}, currentClaims, filterUndefinedValues(claims, false));
1415
+ newClaims = filterNullAndUndefinedValues(newClaims);
1311
1416
  return [
1312
1417
  2,
1313
1418
  this.setClaims(newClaims)
@@ -1436,6 +1541,7 @@ function _ts_generator$b(thisArg, body) {
1436
1541
  *
1437
1542
  * @param authService - The auth service to create a context from if needed.
1438
1543
  * @param userContextOrUid - A user context or UID string.
1544
+ * @returns The resolved user context instance.
1439
1545
  *
1440
1546
  * @example
1441
1547
  * ```typescript
@@ -1619,6 +1725,7 @@ function _ts_generator$b(thisArg, body) {
1619
1725
  3,
1620
1726
  7
1621
1727
  ];
1728
+ // Cast to string | undefined because claims are cast from raw custom claims which may not have this field at runtime
1622
1729
  setupCommunicationAt = setupDetails.claims.setupCommunicationAt;
1623
1730
  hasSentCommunication = Boolean(setupCommunicationAt);
1624
1731
  if (!((config === null || config === void 0 ? void 0 : config.sendSetupDetailsOnce) && hasSentCommunication)) return [
@@ -1626,7 +1733,7 @@ function _ts_generator$b(thisArg, body) {
1626
1733
  2
1627
1734
  ];
1628
1735
  // do not send.
1629
- if (config === null || config === void 0 ? void 0 : config.throwErrors) {
1736
+ if (config.throwErrors) {
1630
1737
  throw new FirebaseServerAuthNewUserSendSetupDetailsSendOnceError();
1631
1738
  }
1632
1739
  return [
@@ -1756,6 +1863,8 @@ function _ts_generator$b(thisArg, body) {
1756
1863
  key: "updateSetupContentSentTime",
1757
1864
  value: /**
1758
1865
  * Records the current timestamp as the last setup content communication date in the user's claims.
1866
+ *
1867
+ * @param details - The user's setup details containing the user context.
1759
1868
  */ function updateSetupContentSentTime(details) {
1760
1869
  return _async_to_generator$b(function() {
1761
1870
  var setupCommunicationAt;
@@ -1822,6 +1931,8 @@ function _ts_generator$b(thisArg, body) {
1822
1931
  *
1823
1932
  * Generates a random setup password if none is provided. Override to customize user creation behavior.
1824
1933
  *
1934
+ * @param input - The initialization configuration for the new user.
1935
+ * @returns The created user record and the setup password used.
1825
1936
  * @throws Throws if the Firebase Admin SDK rejects the user creation.
1826
1937
  */ function createNewUser(input) {
1827
1938
  return _async_to_generator$b(function() {
@@ -1858,7 +1969,7 @@ function _ts_generator$b(thisArg, body) {
1858
1969
  case 3:
1859
1970
  e = _state.sent();
1860
1971
  firebaseError = e;
1861
- errorCode = firebaseError === null || firebaseError === void 0 ? void 0 : firebaseError.code;
1972
+ errorCode = firebaseError.code;
1862
1973
  if (errorCode === FIREBASE_AUTH_PHONE_NUMBER_ALREADY_EXISTS_ERROR && phoneNumber) {
1863
1974
  throw new FirebaseServerAuthUserExistsError(errorCode, 'phone', phoneNumber);
1864
1975
  } else if (errorCode === FIREBASE_AUTH_EMAIL_ALREADY_EXISTS_ERROR && email) {
@@ -1890,6 +2001,8 @@ function _ts_generator$b(thisArg, body) {
1890
2001
  key: "updateClaimsToClearUser",
1891
2002
  value: /**
1892
2003
  * Clears setup-related claims (setup password and last communication date) from the user.
2004
+ *
2005
+ * @param userContext - The user context to clear setup claims from.
1893
2006
  */ function updateClaimsToClearUser(userContext) {
1894
2007
  return _async_to_generator$b(function() {
1895
2008
  var _obj;
@@ -2095,6 +2208,7 @@ function _ts_generator$b(thisArg, body) {
2095
2208
  * Creates a NestJS provider that binds the given config to the {@link FIREBASE_SERVER_ENV_TOKEN} injection token.
2096
2209
  *
2097
2210
  * @param env - The Firebase server environment configuration.
2211
+ * @returns A NestJS provider binding the config to the {@link FIREBASE_SERVER_ENV_TOKEN} token.
2098
2212
  *
2099
2213
  * @example
2100
2214
  * ```typescript
@@ -2113,6 +2227,7 @@ function _ts_generator$b(thisArg, body) {
2113
2227
  * Use this when the NestJS app needs the config accessible via either token.
2114
2228
  *
2115
2229
  * @param env - The Firebase server environment configuration.
2230
+ * @returns An array of providers binding the config to both Firebase and base server env tokens.
2116
2231
  *
2117
2232
  * @example
2118
2233
  * ```typescript
@@ -2154,6 +2269,7 @@ function _class_call_check$m(instance, Constructor) {
2154
2269
  * Each field in the input maps to an atomic increment operation. Null/undefined values default to 0.
2155
2270
  *
2156
2271
  * @param input - The increment specification mapping field names to numeric deltas.
2272
+ * @returns Firestore {@link UpdateData} with atomic increment operations.
2157
2273
  *
2158
2274
  * @example
2159
2275
  * ```typescript
@@ -2226,6 +2342,7 @@ function _unsupported_iterable_to_array$9(o, minLen) {
2226
2342
  * Google Cloud Firestore's {@link FieldValue.arrayUnion} and {@link FieldValue.arrayRemove}.
2227
2343
  *
2228
2344
  * @param input - The array update specification with `union` and/or `remove` field maps.
2345
+ * @returns Firestore {@link UpdateData} with array union/remove operations.
2229
2346
  *
2230
2347
  * @example
2231
2348
  * ```typescript
@@ -2235,8 +2352,8 @@ function _unsupported_iterable_to_array$9(o, minLen) {
2235
2352
  * });
2236
2353
  * ```
2237
2354
  */ function firestoreServerArrayUpdateToUpdateData(input) {
2238
- var union = input === null || input === void 0 ? void 0 : input.union;
2239
- var remove = input === null || input === void 0 ? void 0 : input.remove;
2355
+ var union = input.union;
2356
+ var remove = input.remove;
2240
2357
  function createUpdatesWithArrayFunction(fieldUpdate, arrayUpdateFunction) {
2241
2358
  var result;
2242
2359
  if (fieldUpdate) {
@@ -2370,7 +2487,7 @@ function _define_property$p(obj, key, value) {
2370
2487
  key: "update",
2371
2488
  value: function update(data, params) {
2372
2489
  if ((params === null || params === void 0 ? void 0 : params.precondition) != null) {
2373
- this.batch.update(this.documentRef, data, params === null || params === void 0 ? void 0 : params.precondition);
2490
+ this.batch.update(this.documentRef, data, params.precondition);
2374
2491
  } else {
2375
2492
  this.batch.update(this.documentRef, data);
2376
2493
  }
@@ -2387,6 +2504,7 @@ function _define_property$p(obj, key, value) {
2387
2504
  * the batch applies all queued writes atomically.
2388
2505
  *
2389
2506
  * @param writeBatch - The Google Cloud WriteBatch to queue operations into.
2507
+ * @returns A factory that creates batch-backed accessors sharing the given WriteBatch.
2390
2508
  *
2391
2509
  * @example
2392
2510
  * ```typescript
@@ -2429,6 +2547,9 @@ function _define_property$p(obj, key, value) {
2429
2547
  }();
2430
2548
  /**
2431
2549
  * Creates a {@link WriteBatchFirestoreDocumentContext} wrapping the given batch.
2550
+ *
2551
+ * @param batch - The Google Cloud WriteBatch to use.
2552
+ * @returns A new {@link WriteBatchFirestoreDocumentContext} for the given batch.
2432
2553
  */ function writeBatchDocumentContext(batch) {
2433
2554
  return new WriteBatchFirestoreDocumentContext(batch);
2434
2555
  }
@@ -2555,6 +2676,8 @@ function _define_property$o(obj, key, value) {
2555
2676
  /**
2556
2677
  * Creates a {@link FirestoreDocumentDataAccessorFactory} that produces default (non-batched, non-transactional) accessors.
2557
2678
  *
2679
+ * @returns A factory that creates default (non-batched, non-transactional) accessors.
2680
+ *
2558
2681
  * @example
2559
2682
  * ```typescript
2560
2683
  * const factory = defaultFirestoreAccessorFactory<User>();
@@ -2572,6 +2695,8 @@ function _define_property$o(obj, key, value) {
2572
2695
  * Creates a {@link FirestoreDocumentContext} with no special execution context (no batch, no transaction).
2573
2696
  *
2574
2697
  * Operations performed through this context execute immediately against Firestore.
2698
+ *
2699
+ * @returns A {@link FirestoreDocumentContext} for direct Firestore operations.
2575
2700
  */ function defaultFirestoreDocumentContext() {
2576
2701
  return {
2577
2702
  contextType: FirestoreDocumentContextType.NONE,
@@ -2701,7 +2826,7 @@ function _define_property$n(obj, key, value) {
2701
2826
  key: "update",
2702
2827
  value: function update(data, params) {
2703
2828
  if (params === null || params === void 0 ? void 0 : params.precondition) {
2704
- this.transaction.update(this.documentRef, data, params === null || params === void 0 ? void 0 : params.precondition);
2829
+ this.transaction.update(this.documentRef, data, params.precondition);
2705
2830
  } else {
2706
2831
  this.transaction.update(this.documentRef, data);
2707
2832
  }
@@ -2718,6 +2843,7 @@ function _define_property$n(obj, key, value) {
2718
2843
  * atomic operation.
2719
2844
  *
2720
2845
  * @param transaction - The Google Cloud Transaction to execute operations within.
2846
+ * @returns A factory that creates transaction-backed accessors sharing the given transaction.
2721
2847
  *
2722
2848
  * @example
2723
2849
  * ```typescript
@@ -2761,6 +2887,9 @@ function _define_property$n(obj, key, value) {
2761
2887
  }();
2762
2888
  /**
2763
2889
  * Creates a {@link TransactionFirestoreDocumentContext} wrapping the given transaction.
2890
+ *
2891
+ * @param transaction - The Google Cloud Transaction to use.
2892
+ * @returns A new {@link TransactionFirestoreDocumentContext} for the given transaction.
2764
2893
  */ function transactionDocumentContext(transaction) {
2765
2894
  return new TransactionFirestoreDocumentContext(transaction);
2766
2895
  }
@@ -2947,6 +3076,7 @@ function _ts_generator$a(thisArg, body) {
2947
3076
  * @param start - A Firestore object that can resolve collection paths (e.g., Firestore instance, DocumentReference).
2948
3077
  * @param path - The initial collection path.
2949
3078
  * @param pathSegments - Optional pairs of [docId, collectionName] for subcollection traversal.
3079
+ * @returns The resolved {@link CollectionReference} at the given path.
2950
3080
  * @throws Error if pathSegments length is odd (segments must come in pairs).
2951
3081
  *
2952
3082
  * @example
@@ -2957,7 +3087,7 @@ function _ts_generator$a(thisArg, body) {
2957
3087
  */ function collectionRefForPath(start, path, pathSegments) {
2958
3088
  var ref = start.collection(path);
2959
3089
  if (pathSegments === null || pathSegments === void 0 ? void 0 : pathSegments.length) {
2960
- if ((pathSegments === null || pathSegments === void 0 ? void 0 : pathSegments.length) % 2 !== 0) {
3090
+ if (pathSegments.length % 2 !== 0) {
2961
3091
  throw new Error('Invalid number of path segments provided for collection. Path: "'.concat(path, '" + "').concat(pathSegments, '"'));
2962
3092
  }
2963
3093
  var batches = batch(pathSegments, 2); // batch to tuple [string, string]
@@ -2977,6 +3107,7 @@ function _ts_generator$a(thisArg, body) {
2977
3107
  * @param start - A Firestore object that can resolve document paths (e.g., CollectionReference).
2978
3108
  * @param path - Optional document ID or path within the collection.
2979
3109
  * @param pathSegments - Optional pairs of [collectionName, docId] for subcollection traversal.
3110
+ * @returns The resolved {@link DocumentReference} at the given path.
2980
3111
  *
2981
3112
  * @example
2982
3113
  * ```typescript
@@ -3001,6 +3132,8 @@ function _ts_generator$a(thisArg, body) {
3001
3132
  * Implements document/collection resolution, transaction/batch factories, and context factories
3002
3133
  * using the `@google-cloud/firestore` library.
3003
3134
  *
3135
+ * @returns A {@link FirestoreAccessorDriver} for the Google Cloud Admin SDK.
3136
+ *
3004
3137
  * @example
3005
3138
  * ```typescript
3006
3139
  * const accessorDriver = googleCloudFirestoreAccessorDriver();
@@ -3035,18 +3168,10 @@ function _ts_generator$a(thisArg, body) {
3035
3168
  return function(fn) {
3036
3169
  return _async_to_generator$a(function() {
3037
3170
  return _ts_generator$a(this, function(_state) {
3038
- switch(_state.label){
3039
- case 0:
3040
- return [
3041
- 4,
3042
- firestore.runTransaction(fn)
3043
- ];
3044
- case 1:
3045
- return [
3046
- 2,
3047
- _state.sent()
3048
- ];
3049
- }
3171
+ return [
3172
+ 2,
3173
+ firestore.runTransaction(fn)
3174
+ ];
3050
3175
  });
3051
3176
  })();
3052
3177
  };
@@ -3171,6 +3296,8 @@ var _obj;
3171
3296
  * Creates a {@link FirestoreQueryConstraintFunctionsDriver} for the Google Cloud Firestore server SDK.
3172
3297
  *
3173
3298
  * Translates abstract query constraints into Google Cloud Firestore query builder calls.
3299
+ *
3300
+ * @returns A {@link FirestoreQueryConstraintFunctionsDriver} for the server SDK.
3174
3301
  */ function firestoreClientQueryConstraintFunctionsDriver() {
3175
3302
  return makeFirestoreQueryConstraintFunctionsDriver({
3176
3303
  mapping: FIRESTORE_CLIENT_QUERY_CONSTRAINT_HANDLER_MAPPING,
@@ -3192,6 +3319,8 @@ var _obj;
3192
3319
  * streaming (streamDocs) via `onSnapshot`. Transaction-aware reads are supported
3193
3320
  * through the optional transaction parameter in `getDocs`.
3194
3321
  *
3322
+ * @returns A complete {@link FirestoreQueryDriver} for the Google Cloud Admin SDK.
3323
+ *
3195
3324
  * @example
3196
3325
  * ```typescript
3197
3326
  * const queryDriver = googleCloudFirestoreQueryDriver();
@@ -3226,6 +3355,8 @@ var _obj;
3226
3355
  *
3227
3356
  * Bundles the server-side accessor driver and query driver, identified as `@google-cloud/firestore`.
3228
3357
  *
3358
+ * @returns A complete set of {@link FirestoreDrivers} for the Google Cloud Admin SDK.
3359
+ *
3229
3360
  * @example
3230
3361
  * ```typescript
3231
3362
  * const drivers = googleCloudFirestoreDrivers();
@@ -3436,6 +3567,7 @@ function _ts_generator$9(thisArg, body) {
3436
3567
  /**
3437
3568
  * Asserts that the callable context contains auth data with a valid UID.
3438
3569
  *
3570
+ * @param context - The callable context to check for auth data.
3439
3571
  * @throws {HttpsError} Throws unauthenticated error if no auth data is present.
3440
3572
  *
3441
3573
  * @example
@@ -3453,6 +3585,7 @@ function _ts_generator$9(thisArg, body) {
3453
3585
  *
3454
3586
  * @param document - The Firestore document to load data from.
3455
3587
  * @param message - Optional custom error message.
3588
+ * @returns The document's snapshot data.
3456
3589
  * @throws {HttpsError} Throws a {@link modelNotAvailableError} (404) if the document has no data.
3457
3590
  *
3458
3591
  * @example
@@ -3491,6 +3624,7 @@ function _ts_generator$9(thisArg, body) {
3491
3624
  *
3492
3625
  * @param document - The Firestore document to load data from.
3493
3626
  * @param message - Optional custom error message.
3627
+ * @returns The document's snapshot data with `id` and `key` attached.
3494
3628
  * @throws {HttpsError} Throws a {@link modelNotAvailableError} (404) if the document has no data.
3495
3629
  */ function assertSnapshotDataWithKey(document, message) {
3496
3630
  return _async_to_generator$9(function() {
@@ -3544,6 +3678,10 @@ function _ts_generator$9(thisArg, body) {
3544
3678
  * Creates a {@link modelNotAvailableError} for the given document's model type.
3545
3679
  *
3546
3680
  * Used by {@link assertDocumentExists} and other assertion functions.
3681
+ *
3682
+ * @param document - The document (or object with `modelType`) to generate the error for.
3683
+ * @param message - Optional custom error message.
3684
+ * @returns A {@link modelNotAvailableError} with the document's model type in the message.
3547
3685
  */ function documentModelNotAvailableError(document, message) {
3548
3686
  return modelNotAvailableError({
3549
3687
  message: message !== null && message !== void 0 ? message : "The ".concat(document.modelType, " was unavailable.")
@@ -3555,6 +3693,8 @@ function _ts_generator$9(thisArg, body) {
3555
3693
  */ var PHONE_NUMBER_ALREADY_EXISTS_ERROR_CODE = 'PHONE_NUMBER_ALREADY_EXISTS';
3556
3694
  /**
3557
3695
  * Creates a precondition conflict (409) error indicating the phone number already exists.
3696
+ *
3697
+ * @returns A new precondition-conflict (409) {@link HttpsError} with the phone-number-exists code.
3558
3698
  */ function phoneNumberAlreadyExistsError() {
3559
3699
  return preconditionConflictError({
3560
3700
  code: PHONE_NUMBER_ALREADY_EXISTS_ERROR_CODE,
@@ -3638,7 +3778,10 @@ function _class_call_check$h(instance, Constructor) {
3638
3778
  * Creates a default no-op {@link FirebaseServerAnalyticsServiceListener}.
3639
3779
  *
3640
3780
  * Used when no analytics provider is configured. All methods are no-ops.
3781
+ *
3782
+ * @returns A no-op listener that silently discards all analytics events.
3641
3783
  */ function noopFirebaseServerAnalyticsServiceListener() {
3784
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
3642
3785
  var noop = function noop() {};
3643
3786
  return {
3644
3787
  handleOnCallAnalyticsEvent: noop,
@@ -3946,6 +4089,9 @@ function _ts_generator$8(thisArg, body) {
3946
4089
  * emitter('triggered').sendEventType('Handler Starting');
3947
4090
  * emitter('success').sendEvent('Widget Created', { id: result.id });
3948
4091
  * ```
4092
+ *
4093
+ * @param config - The service and context to bind to the emitter factory.
4094
+ * @returns A factory function that creates lifecycle-stage-specific emitters.
3949
4095
  */ function onCallAnalyticsEmitterInstance(config) {
3950
4096
  var service = config.service, context = config.context;
3951
4097
  return function(lifecycle) {
@@ -4152,22 +4298,34 @@ function _unsupported_iterable_to_array$6(o, minLen) {
4152
4298
  // MARK: Type Guards
4153
4299
  /**
4154
4300
  * Whether the details are specifier-level (has specifiers map).
4301
+ *
4302
+ * @param details - The API details to check.
4303
+ * @returns True if the details contain a specifiers map.
4155
4304
  */ function isOnCallModelTypeApiDetails(details) {
4156
4305
  return details != null && 'specifiers' in details;
4157
4306
  }
4158
4307
  /**
4159
4308
  * Whether the details are CRUD-model-level (has modelTypes map).
4309
+ *
4310
+ * @param details - The API details to check.
4311
+ * @returns True if the details contain a modelTypes map.
4160
4312
  */ function isOnCallCrudModelApiDetails(details) {
4161
4313
  return details != null && 'modelTypes' in details;
4162
4314
  }
4163
4315
  /**
4164
4316
  * Whether the details are handler-level (leaf node — no specifiers or modelTypes).
4317
+ *
4318
+ * @param details - The API details to check.
4319
+ * @returns True if the details are handler-level (no specifiers or modelTypes).
4165
4320
  */ function isOnCallHandlerApiDetails(details) {
4166
4321
  return details != null && !('specifiers' in details) && !('modelTypes' in details);
4167
4322
  }
4168
4323
  /**
4169
4324
  * Whether the specifier-level details represent a true specifier (multiple sub-operations)
4170
4325
  * vs a wrapped direct handler (`isSpecifier: false`, details under `_`).
4326
+ *
4327
+ * @param details - The specifier-level API details to check.
4328
+ * @returns True if the details represent a true specifier with multiple sub-operations.
4171
4329
  */ function isActualSpecifier(details) {
4172
4330
  return details.isSpecifier;
4173
4331
  }
@@ -4200,6 +4358,9 @@ function _unsupported_iterable_to_array$6(o, minLen) {
4200
4358
  * fn: async (request) => { ... }
4201
4359
  * });
4202
4360
  * ```
4361
+ *
4362
+ * @param config - The API details configuration including the handler function.
4363
+ * @returns The handler function with _apiDetails attached.
4203
4364
  */ function withApiDetails(config) {
4204
4365
  var optionalAuth = config.optionalAuth, fn = config.fn, apiDetails = _object_without_properties(config, [
4205
4366
  "optionalAuth",
@@ -4214,6 +4375,9 @@ function _unsupported_iterable_to_array$6(o, minLen) {
4214
4375
  // MARK: Aggregation Utilities
4215
4376
  /**
4216
4377
  * Reads _apiDetails from a function if present.
4378
+ *
4379
+ * @param fn - The function or object that may carry _apiDetails.
4380
+ * @returns The API details if present, otherwise undefined.
4217
4381
  */ function readApiDetails(fn) {
4218
4382
  return fn === null || fn === void 0 ? void 0 : fn._apiDetails;
4219
4383
  }
@@ -4221,6 +4385,9 @@ function _unsupported_iterable_to_array$6(o, minLen) {
4221
4385
  * Aggregates _apiDetails from a specifier handler config object.
4222
4386
  *
4223
4387
  * Returns OnCallModelTypeApiDetails if any handlers have _apiDetails, otherwise undefined.
4388
+ *
4389
+ * @param config - Map of specifier keys to handler functions.
4390
+ * @returns Aggregated specifier-level API details, or undefined if no handlers have _apiDetails.
4224
4391
  */ function aggregateSpecifierApiDetails(config) {
4225
4392
  var specifiers = {};
4226
4393
  var hasAny = false;
@@ -4258,6 +4425,9 @@ function _unsupported_iterable_to_array$6(o, minLen) {
4258
4425
  * Aggregates _apiDetails from a model type map (used by onCallCreateModel, etc.).
4259
4426
  *
4260
4427
  * Returns OnCallCrudModelApiDetails if any handlers have _apiDetails, otherwise undefined.
4428
+ *
4429
+ * @param map - Map of model type strings to handler functions.
4430
+ * @returns Aggregated CRUD-model-level API details, or undefined if no handlers have _apiDetails.
4261
4431
  */ function aggregateCrudModelApiDetails(map) {
4262
4432
  var modelTypes = {};
4263
4433
  var hasAny = false;
@@ -4304,6 +4474,9 @@ function _unsupported_iterable_to_array$6(o, minLen) {
4304
4474
  * Aggregates _apiDetails from the top-level call model map.
4305
4475
  *
4306
4476
  * Returns OnCallModelApiDetails if any CRUD handlers have _apiDetails, otherwise undefined.
4477
+ *
4478
+ * @param map - Map of call type strings to CRUD handler functions.
4479
+ * @returns Aggregated model-level API details, or undefined if no handlers have _apiDetails.
4307
4480
  */ function aggregateModelApiDetails(map) {
4308
4481
  var result = {};
4309
4482
  var hasAny = false;
@@ -4370,7 +4543,7 @@ function _unsupported_iterable_to_array$6(o, minLen) {
4370
4543
  if (modelDetails == null) {
4371
4544
  continue;
4372
4545
  }
4373
- if (!models[modelType]) {
4546
+ if (!(modelType in models)) {
4374
4547
  models[modelType] = {
4375
4548
  calls: {}
4376
4549
  };
@@ -4414,9 +4587,16 @@ function _unsupported_iterable_to_array$6(o, minLen) {
4414
4587
  /**
4415
4588
  * Resolves leaf-level analytics details from the aggregated _apiDetails tree.
4416
4589
  *
4417
- * Walks: call modelType specifier (if specifier-level), then reads the `analytics`
4590
+ * Walks: call -> modelType -> specifier (if specifier-level), then reads the `analytics`
4418
4591
  * field from the handler-level {@link OnCallModelFunctionApiDetails}.
4419
- */ function resolveAnalyticsFromApiDetails(apiDetails, call, modelType, specifier) {
4592
+ *
4593
+ * @param apiDetails - The top-level aggregated API details.
4594
+ * @param call - The CRUD operation type to look up.
4595
+ * @param modelType - The Firestore model type to look up.
4596
+ * @param specifier - Optional specifier key for variant handlers.
4597
+ * @returns The analytics details for the resolved handler, or undefined.
4598
+ */ // eslint-disable-next-line @typescript-eslint/max-params
4599
+ function resolveAnalyticsFromApiDetails(apiDetails, call, modelType, specifier) {
4420
4600
  var _apiDetails_call;
4421
4601
  var modelDetails = (_apiDetails_call = apiDetails[call]) === null || _apiDetails_call === void 0 ? void 0 : _apiDetails_call.modelTypes[modelType];
4422
4602
  if (modelDetails) {
@@ -4439,6 +4619,9 @@ function _unsupported_iterable_to_array$6(o, minLen) {
4439
4619
  * which the client can use to display a meaningful "not found" message. Intended to be
4440
4620
  * passed to Firebase permission/existence checking utilities as the
4441
4621
  * {@link FirebaseDoesNotExistErrorContextErrorFunction} callback.
4622
+ *
4623
+ * @param firebaseContextGrantedModelRoles - The granted model roles context containing the document reference.
4624
+ * @returns A model-not-available HTTP error.
4442
4625
  */ var nestFirebaseDoesNotExistError = function nestFirebaseDoesNotExistError(firebaseContextGrantedModelRoles) {
4443
4626
  var _firebaseContextGrantedModelRoles_data, _firebaseContextGrantedModelRoles_data1;
4444
4627
  return modelNotAvailableError({
@@ -4454,6 +4637,10 @@ function _unsupported_iterable_to_array$6(o, minLen) {
4454
4637
  * Returns a "forbidden" HTTP error including the document key, model type, and the roles
4455
4638
  * that were required but not granted. Intended to be passed to Firebase permission checking
4456
4639
  * utilities as the {@link FirebasePermissionErrorContextErrorFunction} callback.
4640
+ *
4641
+ * @param firebaseContextGrantedModelRoles - The granted model roles context containing the document reference.
4642
+ * @param roles - The roles that were required but not granted.
4643
+ * @returns A forbidden HTTP error.
4457
4644
  */ var nestFirebaseForbiddenPermissionError = function nestFirebaseForbiddenPermissionError(firebaseContextGrantedModelRoles, roles) {
4458
4645
  var _firebaseContextGrantedModelRoles_data, _firebaseContextGrantedModelRoles_data1;
4459
4646
  return forbiddenError({
@@ -4579,6 +4766,9 @@ function _unsupported_iterable_to_array$6(o, minLen) {
4579
4766
  /**
4580
4767
  * Creates a bad-request error indicating the provided specifier is not recognized
4581
4768
  * by the current model CRUD handler.
4769
+ *
4770
+ * @param specifier - The unrecognized specifier string.
4771
+ * @returns A bad-request error with UNKNOWN_SPECIFIER_ERROR code.
4582
4772
  */ function unknownModelCrudFunctionSpecifierError(specifier) {
4583
4773
  return badRequestError(serverError({
4584
4774
  status: 400,
@@ -4681,8 +4871,7 @@ function _object_spread_props$a(target, source) {
4681
4871
  }
4682
4872
  }
4683
4873
  var fn = function fn(request) {
4684
- var _request_data, _request_data1;
4685
- var call = (_request_data = request.data) === null || _request_data === void 0 ? void 0 : _request_data.call;
4874
+ var call = request.data.call;
4686
4875
  if (!call) {
4687
4876
  throw onCallModelMissingCallTypeError();
4688
4877
  }
@@ -4690,7 +4879,7 @@ function _object_spread_props$a(target, source) {
4690
4879
  if (!callFn) {
4691
4880
  throw onCallModelUnknownCallTypeError(call);
4692
4881
  }
4693
- var _request_data2 = request.data, specifier = _request_data2.specifier, modelType = _request_data2.modelType;
4882
+ var _request_data = request.data, specifier = _request_data.specifier, modelType = _request_data.modelType;
4694
4883
  var auth = request.auth;
4695
4884
  var context = {
4696
4885
  call: call,
@@ -4698,7 +4887,7 @@ function _object_spread_props$a(target, source) {
4698
4887
  specifier: specifier,
4699
4888
  uid: auth === null || auth === void 0 ? void 0 : auth.uid,
4700
4889
  auth: auth,
4701
- data: (_request_data1 = request.data) === null || _request_data1 === void 0 ? void 0 : _request_data1.data,
4890
+ data: request.data.data,
4702
4891
  request: request
4703
4892
  };
4704
4893
  preAssert(context);
@@ -4727,6 +4916,8 @@ function _object_spread_props$a(target, source) {
4727
4916
  }
4728
4917
  /**
4729
4918
  * Creates a bad-request error indicating the `call` field was missing from the request payload.
4919
+ *
4920
+ * @returns A bad-request error with CALL_TYPE_MISSING_ERROR code.
4730
4921
  */ function onCallModelMissingCallTypeError() {
4731
4922
  return badRequestError(serverError({
4732
4923
  status: 400,
@@ -4736,6 +4927,9 @@ function _object_spread_props$a(target, source) {
4736
4927
  }
4737
4928
  /**
4738
4929
  * Creates a bad-request error indicating the provided `call` type is not recognized.
4930
+ *
4931
+ * @param call - The unrecognized call type string.
4932
+ * @returns A bad-request error with UNKNOWN_CALL_TYPE_ERROR code.
4739
4933
  */ function onCallModelUnknownCallTypeError(call) {
4740
4934
  return badRequestError(serverError({
4741
4935
  status: 400,
@@ -4752,14 +4946,16 @@ function _object_spread_props$a(target, source) {
4752
4946
  * Dispatches to the correct model-type handler from the map, enforces auth requirements,
4753
4947
  * runs pre-assertions, and aggregates API details from all handlers for MCP introspection.
4754
4948
  *
4949
+ * @param map - Maps model type strings to their handler functions.
4950
+ * @param config - Configuration including call type, crud type, and error factory.
4951
+ * @returns A callable function that dispatches to the correct model-type handler.
4755
4952
  * @internal Not intended for direct use outside the model CRUD module.
4756
4953
  */ function _onCallWithCallTypeFunction(map, config) {
4757
- var callType = config.callType; config.crudType; var _config_preAssert = config.preAssert, preAssert = _config_preAssert === void 0 ? function() {
4954
+ var callType = config.callType, _config_preAssert = config.preAssert, preAssert = _config_preAssert === void 0 ? function() {
4758
4955
  return undefined;
4759
4956
  } : _config_preAssert, throwOnUnknownModelType = config.throwOnUnknownModelType;
4760
4957
  var fn = function fn(request) {
4761
- var _request_data;
4762
- var modelType = (_request_data = request.data) === null || _request_data === void 0 ? void 0 : _request_data.modelType;
4958
+ var modelType = request.data.modelType;
4763
4959
  var crudFn = map[modelType];
4764
4960
  if (crudFn) {
4765
4961
  var specifier = request.data.specifier;
@@ -4808,13 +5004,15 @@ function _object_spread_props$a(target, source) {
4808
5004
  var preAssert = config.preAssert;
4809
5005
  return _onCallWithCallTypeFunction(map, {
4810
5006
  callType: 'create',
4811
- crudType: 'create',
4812
5007
  preAssert: preAssert,
4813
5008
  throwOnUnknownModelType: createModelUnknownModelTypeError
4814
5009
  });
4815
5010
  }
4816
5011
  /**
4817
5012
  * Creates a bad-request error indicating the requested model type is not valid for creation.
5013
+ *
5014
+ * @param modelType - The unrecognized model type string.
5015
+ * @returns A bad-request error with UNKNOWN_TYPE_ERROR code.
4818
5016
  */ function createModelUnknownModelTypeError(modelType) {
4819
5017
  return badRequestError(serverError({
4820
5018
  status: 400,
@@ -4848,13 +5046,15 @@ function _object_spread_props$a(target, source) {
4848
5046
  var preAssert = config.preAssert;
4849
5047
  return _onCallWithCallTypeFunction(map, {
4850
5048
  callType: 'read',
4851
- crudType: 'read',
4852
5049
  preAssert: preAssert,
4853
5050
  throwOnUnknownModelType: readModelUnknownModelTypeError
4854
5051
  });
4855
5052
  }
4856
5053
  /**
4857
5054
  * Creates a bad-request error indicating the requested model type is not valid for reading.
5055
+ *
5056
+ * @param modelType - The unrecognized model type string.
5057
+ * @returns A bad-request error with UNKNOWN_TYPE_ERROR code.
4858
5058
  */ function readModelUnknownModelTypeError(modelType) {
4859
5059
  return badRequestError(serverError({
4860
5060
  status: 400,
@@ -4891,13 +5091,15 @@ function _object_spread_props$a(target, source) {
4891
5091
  var preAssert = config.preAssert;
4892
5092
  return _onCallWithCallTypeFunction(map, {
4893
5093
  callType: 'update',
4894
- crudType: 'update',
4895
5094
  preAssert: preAssert,
4896
5095
  throwOnUnknownModelType: updateModelUnknownModelTypeError
4897
5096
  });
4898
5097
  }
4899
5098
  /**
4900
5099
  * Creates a bad-request error indicating the requested model type is not valid for updating.
5100
+ *
5101
+ * @param modelType - The unrecognized model type string.
5102
+ * @returns A bad-request error with UNKNOWN_TYPE_ERROR code.
4901
5103
  */ function updateModelUnknownModelTypeError(modelType) {
4902
5104
  return badRequestError(serverError({
4903
5105
  status: 400,
@@ -4931,13 +5133,15 @@ function _object_spread_props$a(target, source) {
4931
5133
  var preAssert = config.preAssert;
4932
5134
  return _onCallWithCallTypeFunction(map, {
4933
5135
  callType: 'delete',
4934
- crudType: 'delete',
4935
5136
  preAssert: preAssert,
4936
5137
  throwOnUnknownModelType: deleteModelUnknownModelTypeError
4937
5138
  });
4938
5139
  }
4939
5140
  /**
4940
5141
  * Creates a bad-request error indicating the requested model type is not valid for deletion.
5142
+ *
5143
+ * @param modelType - The unrecognized model type string.
5144
+ * @returns A bad-request error with UNKNOWN_TYPE_ERROR code.
4941
5145
  */ function deleteModelUnknownModelTypeError(modelType) {
4942
5146
  return badRequestError(serverError({
4943
5147
  status: 400,
@@ -5251,6 +5455,7 @@ FirebaseServerAnalyticsSegmentModule = __decorate([
5251
5455
  * Creates a NestJS {@link FactoryProvider} that binds a Firebase Admin app getter to {@link FIREBASE_APP_TOKEN}.
5252
5456
  *
5253
5457
  * @param useFactory - Factory function returning the Firebase Admin app instance.
5458
+ * @returns A NestJS factory provider for the Firebase Admin app.
5254
5459
  *
5255
5460
  * @example
5256
5461
  * ```typescript
@@ -5348,6 +5553,9 @@ FirebaseServerAuthModule = __decorate([
5348
5553
  * Returns two providers: the concrete service and an alias that maps
5349
5554
  * `FirebaseServerAuthService` to the concrete token, enabling injection by the abstract type.
5350
5555
  *
5556
+ * @param provider - The factory provider configuration for the auth service.
5557
+ * @returns A tuple containing the configured provider and an alias provider.
5558
+ *
5351
5559
  * @example
5352
5560
  * ```typescript
5353
5561
  * const providers = provideFirebaseServerAuthService({
@@ -5373,6 +5581,9 @@ FirebaseServerAuthModule = __decorate([
5373
5581
  * Generates NestJS {@link ModuleMetadata} for an app's auth module, including the {@link FirebaseServerAuthModule}
5374
5582
  * import and the custom {@link FirebaseServerAuthService} provider.
5375
5583
  *
5584
+ * @param config - The module metadata configuration including the service provider.
5585
+ * @returns The merged NestJS module metadata.
5586
+ *
5376
5587
  * @example
5377
5588
  * ```typescript
5378
5589
  * @Module(firebaseServerAuthModuleMetadata({
@@ -5396,6 +5607,7 @@ FirebaseServerAuthModule = __decorate([
5396
5607
  /**
5397
5608
  * Asserts that the caller has admin privileges in the request.
5398
5609
  *
5610
+ * @param request - The callable request to check for admin privileges.
5399
5611
  * @throws {HttpsError} Throws forbidden (403) if the caller is not an admin.
5400
5612
  */ function assertIsAdminInRequest(request) {
5401
5613
  if (!isAdminInRequest(request)) {
@@ -5404,6 +5616,9 @@ FirebaseServerAuthModule = __decorate([
5404
5616
  }
5405
5617
  /**
5406
5618
  * Checks whether the caller has admin privileges in the request.
5619
+ *
5620
+ * @param request - The callable request to check for admin privileges.
5621
+ * @returns True if the caller has admin privileges.
5407
5622
  */ function isAdminInRequest(request) {
5408
5623
  return request.nest.authService.context(request).isAdmin;
5409
5624
  }
@@ -5412,6 +5627,8 @@ FirebaseServerAuthModule = __decorate([
5412
5627
  *
5413
5628
  * If the request data contains a `uid` that differs from the caller's auth UID, admin status is required.
5414
5629
  *
5630
+ * @param request - The callable request containing the target UID.
5631
+ * @param requireUid - If true, a UID must be present in the request data.
5415
5632
  * @returns The resolved target UID (from request data or auth).
5416
5633
  * @throws {HttpsError} Throws forbidden (403) if the caller is not authorized.
5417
5634
  */ function assertIsAdminOrTargetUserInRequestData(request, requireUid) {
@@ -5425,7 +5642,9 @@ FirebaseServerAuthModule = __decorate([
5425
5642
  /**
5426
5643
  * Checks whether the caller is an admin or is targeting their own user record in the request data.
5427
5644
  *
5645
+ * @param request - The callable request containing the target UID.
5428
5646
  * @param requireUid - If true, a UID must be present in the request data.
5647
+ * @returns True if the caller is an admin or is targeting their own user record.
5429
5648
  */ function isAdminOrTargetUserInRequestData(request) {
5430
5649
  var requireUid = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
5431
5650
  var _request_auth;
@@ -5440,6 +5659,7 @@ FirebaseServerAuthModule = __decorate([
5440
5659
  /**
5441
5660
  * Asserts that the caller has signed the Terms of Service.
5442
5661
  *
5662
+ * @param request - The callable request to check for ToS status.
5443
5663
  * @throws {HttpsError} Throws forbidden (403) if ToS has not been signed.
5444
5664
  */ function assertHasSignedTosInRequest(request) {
5445
5665
  if (!hasSignedTosInRequest(request)) {
@@ -5450,12 +5670,16 @@ FirebaseServerAuthModule = __decorate([
5450
5670
  }
5451
5671
  /**
5452
5672
  * Checks whether the caller has signed the Terms of Service.
5673
+ *
5674
+ * @param request - The callable request to check for ToS status.
5675
+ * @returns True if the caller has signed the Terms of Service.
5453
5676
  */ function hasSignedTosInRequest(request) {
5454
5677
  return request.nest.authService.context(request).hasSignedTos;
5455
5678
  }
5456
5679
  /**
5457
5680
  * Asserts that the caller has all of the specified auth roles.
5458
5681
  *
5682
+ * @param request - The callable request to check for auth roles.
5459
5683
  * @param authRoles - One or more roles that must all be present.
5460
5684
  * @throws {HttpsError} Throws forbidden (403) if any required role is missing.
5461
5685
  */ function assertHasRolesInRequest(request, authRoles) {
@@ -5470,6 +5694,10 @@ FirebaseServerAuthModule = __decorate([
5470
5694
  }
5471
5695
  /**
5472
5696
  * Checks whether the caller has all of the specified auth roles.
5697
+ *
5698
+ * @param request - The callable request to check for auth roles.
5699
+ * @param authRoles - One or more roles that must all be present.
5700
+ * @returns True if the caller has all of the specified auth roles.
5473
5701
  */ function hasAuthRolesInRequest(request, authRoles) {
5474
5702
  return containsAllValues(request.nest.authService.context(request).authRoles, authRoles);
5475
5703
  }
@@ -5478,7 +5706,8 @@ FirebaseServerAuthModule = __decorate([
5478
5706
  *
5479
5707
  * This may be used to filter out new users that were not invited from finishing their onboarding.
5480
5708
  *
5481
- * @param request
5709
+ * @param request - The callable request to check for setup password claims.
5710
+ * @returns True if the claims contain a setup password key.
5482
5711
  */ function hasNewUserSetupPasswordInRequest(request) {
5483
5712
  var claims = request.nest.authService.context(request).claims;
5484
5713
  return claims[FIREBASE_SERVER_AUTH_CLAIMS_SETUP_PASSWORD_KEY] != null;
@@ -5572,6 +5801,9 @@ function _object_spread_props$7(target, source) {
5572
5801
  }
5573
5802
  /**
5574
5803
  * Creates a bad-request error indicating the provided development function specifier is not recognized.
5804
+ *
5805
+ * @param specifier - the unrecognized specifier string from the client request.
5806
+ * @returns A bad-request error with the unknown specifier details.
5575
5807
  */ function developmentUnknownSpecifierError(specifier) {
5576
5808
  return badRequestError(serverError({
5577
5809
  status: 400,
@@ -5589,6 +5821,8 @@ function _object_spread_props$7(target, source) {
5589
5821
  /**
5590
5822
  * Creates a bad-request error for when the caller sends a 'run' command
5591
5823
  * without specifying which scheduled function to execute.
5824
+ *
5825
+ * @returns A bad-request error indicating the missing run name.
5592
5826
  */ function noRunNameSpecifiedForScheduledFunctionDevelopmentFunction() {
5593
5827
  return badRequestError({
5594
5828
  code: NO_RUN_NAME_SPECIFIED_FOR_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_CODE,
@@ -5601,6 +5835,9 @@ function _object_spread_props$7(target, source) {
5601
5835
  /**
5602
5836
  * Creates a bad-request error for when the requested scheduled function name
5603
5837
  * is not found in the registered function map.
5838
+ *
5839
+ * @param name - the unrecognized function name from the client request.
5840
+ * @returns A bad-request error with the unknown function name details.
5604
5841
  */ function unknownScheduledFunctionDevelopmentFunctionName(name) {
5605
5842
  return badRequestError({
5606
5843
  code: UNKNOWN_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_NAME_CODE,
@@ -5616,6 +5853,9 @@ function _object_spread_props$7(target, source) {
5616
5853
  /**
5617
5854
  * Creates a bad-request error for when the request `type` field does not match
5618
5855
  * any supported operation ('run' or 'list').
5856
+ *
5857
+ * @param type - the unrecognized type value from the client request.
5858
+ * @returns A bad-request error with the unknown type details.
5619
5859
  */ function unknownScheduledFunctionDevelopmentFunctionType(type) {
5620
5860
  return badRequestError({
5621
5861
  code: UNKNOWN_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_TYPE_CODE,
@@ -5830,7 +6070,7 @@ function _ts_generator$7(thisArg, body) {
5830
6070
  var result = [];
5831
6071
  forEachKeyValue(allScheduledFunctions, {
5832
6072
  forEach: function forEach(x) {
5833
- var _x = _sliced_to_array(x, 2), functionName = _x[0]; _x[1];
6073
+ var _x = _sliced_to_array(x, 1), functionName = _x[0];
5834
6074
  result.push({
5835
6075
  name: functionName.toString()
5836
6076
  });
@@ -5847,12 +6087,12 @@ function _ts_generator$7(thisArg, body) {
5847
6087
  data = request.data;
5848
6088
  type = data.type;
5849
6089
  switch(type){
5850
- case 'run':
6090
+ case ScheduledFunctionDevelopmentFunctionTypeEnum.RUN:
5851
6091
  return [
5852
6092
  3,
5853
6093
  1
5854
6094
  ];
5855
- case 'list':
6095
+ case ScheduledFunctionDevelopmentFunctionTypeEnum.LIST:
5856
6096
  return [
5857
6097
  3,
5858
6098
  6
@@ -5910,8 +6150,6 @@ function _ts_generator$7(thisArg, body) {
5910
6150
  }
5911
6151
  ];
5912
6152
  case 7:
5913
- throw unknownScheduledFunctionDevelopmentFunctionType(type);
5914
- case 8:
5915
6153
  return [
5916
6154
  2
5917
6155
  ];
@@ -6101,6 +6339,7 @@ function _ts_generator$6(thisArg, body) {
6101
6339
  * ```
6102
6340
  */ function firebaseServerDevFunctions(config) {
6103
6341
  var enabled = config.enabled, secure = config.secure, nest = config.nest, developerFunctionsMap = config.developerFunctionsMap, onCallFactory = config.onCallFactory, allScheduledFunctions = config.allScheduledFunctions, disableDevelopmentScheduleFunction = config.disableDevelopmentScheduleFunction;
6342
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- RunnableHttpFunction supports legacy gen 1 deployments
6104
6343
  var dev;
6105
6344
  if (enabled) {
6106
6345
  var fullFunctionsMap = _object_spread$8({}, developerFunctionsMap);
@@ -6115,7 +6354,7 @@ function _ts_generator$6(thisArg, body) {
6115
6354
  }
6116
6355
  dev = onCallFactory(onCallFunction)(nest);
6117
6356
  } else {
6118
- dev = onCallFactory(function(x) {
6357
+ dev = onCallFactory(function() {
6119
6358
  return _async_to_generator$6(function() {
6120
6359
  return _ts_generator$6(this, function(_state) {
6121
6360
  throw unavailableError({
@@ -6235,6 +6474,8 @@ function _is_native_reflect_construct$1() {
6235
6474
  key: "developmentSchedulerEnabled",
6236
6475
  get: /**
6237
6476
  * Enabled when not in production and not in a testing environment.
6477
+ *
6478
+ * @returns True if the development scheduler should be enabled.
6238
6479
  */ function get() {
6239
6480
  return !this.isProduction && !this.isTestingEnv;
6240
6481
  }
@@ -6257,6 +6498,9 @@ DefaultFirebaseServerEnvService = __decorate([
6257
6498
  *
6258
6499
  * Useful for conditionally enabling production-only Cloud Functions (e.g., scheduled tasks).
6259
6500
  *
6501
+ * @param nest - getter for the NestJS application context promise.
6502
+ * @returns An async decision function that resolves to `true` in production.
6503
+ *
6260
6504
  * @example
6261
6505
  * ```typescript
6262
6506
  * const isProduction = nestAppIsProductionEnvironment(nestAppGetter);
@@ -6273,6 +6517,9 @@ DefaultFirebaseServerEnvService = __decorate([
6273
6517
  * Creates an async decision function that resolves to `true` if the development scheduler is enabled.
6274
6518
  *
6275
6519
  * The development scheduler is enabled in non-production, non-testing environments.
6520
+ *
6521
+ * @param nest - getter for the NestJS application context promise.
6522
+ * @returns An async decision function that resolves to `true` when the development scheduler is enabled.
6276
6523
  */ function nestAppHasDevelopmentSchedulerEnabled(nest) {
6277
6524
  return function() {
6278
6525
  return nest().then(function(x) {
@@ -6369,6 +6616,11 @@ FirebaseServerFirestoreContextModule = __decorate([
6369
6616
  /**
6370
6617
  * Creates a NestJS provider that initializes a Firestore collections instance from the app's {@link FirestoreContext}.
6371
6618
  *
6619
+ * @param config - The provide token and factory function configuration.
6620
+ * @param config.provide - The class token to provide.
6621
+ * @param config.useFactory - Factory that creates the collections from a FirestoreContext.
6622
+ * @returns A tuple containing the configured NestJS provider.
6623
+ *
6372
6624
  * @example
6373
6625
  * ```typescript
6374
6626
  * const [provider] = provideAppFirestoreCollections({
@@ -6392,6 +6644,9 @@ FirebaseServerFirestoreContextModule = __decorate([
6392
6644
  * Generates NestJS {@link ModuleMetadata} for an app's Firestore module, including the
6393
6645
  * {@link FirebaseServerFirestoreContextModule} import and the app's collections provider.
6394
6646
  *
6647
+ * @param config - The Firestore collections config plus optional additional module metadata.
6648
+ * @returns NestJS module metadata ready to be passed to the `@Module()` decorator.
6649
+ *
6395
6650
  * @example
6396
6651
  * ```typescript
6397
6652
  * @Module(appFirestoreModuleMetadata({
@@ -7065,6 +7320,8 @@ function _ts_generator$5(thisArg, body) {
7065
7320
  /**
7066
7321
  * Default error logger that writes validation error details to the console.
7067
7322
  * Used when `logError` is `true` or omitted in the factory options.
7323
+ *
7324
+ * @param details - the validation error details to log.
7068
7325
  */ var defaultFirebaseServerActionsTransformFactoryLogErrorFunction = function defaultFirebaseServerActionsTransformFactoryLogErrorFunction(details) {
7069
7326
  console.log('firebaseServerActionsTransformFactory() encountered validation error: ', details);
7070
7327
  };
@@ -7690,7 +7947,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
7690
7947
  builder = (_builder1 = builder).exclude.apply(_builder1, _to_consumable_array$2(excludePatterns));
7691
7948
  }
7692
7949
  (_builder = builder).forRoutes.apply(_builder, _to_consumable_array$2(forRoutes));
7693
- this.logger.debug("Configured AppCheck middleware for routes: ".concat(forRoutes.join(', ')).concat(excludePatterns.length > 0 ? " (excluding: ".concat(excludePatterns.join(', '), ")") : ''));
7950
+ var excludeInfo = excludePatterns.length > 0 ? " (excluding: ".concat(excludePatterns.join(', '), ")") : '';
7951
+ this.logger.debug("Configured AppCheck middleware for routes: ".concat(forRoutes.join(', ')).concat(excludeInfo));
7694
7952
  }
7695
7953
  }
7696
7954
  ]);
@@ -8128,16 +8386,28 @@ function _ts_generator$2(thisArg, body) {
8128
8386
  }
8129
8387
  /**
8130
8388
  * Resolves a Google Cloud Storage {@link Bucket} from a {@link StoragePath}.
8389
+ *
8390
+ * @param storage - the Google Cloud Storage client instance.
8391
+ * @param path - the storage path containing the bucket ID.
8392
+ * @returns The resolved Google Cloud Storage bucket.
8131
8393
  */ function googleCloudStorageBucketForStorageFilePath(storage, path) {
8132
8394
  return storage.bucket(path.bucketId);
8133
8395
  }
8134
8396
  /**
8135
8397
  * Resolves a Google Cloud Storage {@link GoogleCloudFile} from a {@link StoragePath}.
8398
+ *
8399
+ * @param storage - the Google Cloud Storage client instance.
8400
+ * @param path - the storage path containing bucket ID and file path.
8401
+ * @returns The resolved Google Cloud Storage file reference.
8136
8402
  */ function googleCloudStorageFileForStorageFilePath(storage, path) {
8137
8403
  return googleCloudStorageBucketForStorageFilePath(storage, path).file(path.pathString);
8138
8404
  }
8139
8405
  /**
8140
8406
  * Converts Google Cloud Storage {@link FileMetadata} into the normalized {@link StorageMetadata} format.
8407
+ *
8408
+ * @param file - the Google Cloud Storage file reference.
8409
+ * @param metadata - the raw file metadata from the Google Cloud SDK.
8410
+ * @returns Normalized storage metadata.
8141
8411
  */ function googleCloudFileMetadataToStorageMetadata(file, metadata) {
8142
8412
  var _metadata_generation;
8143
8413
  var fullPath = file.name;
@@ -8168,6 +8438,10 @@ function _ts_generator$2(thisArg, body) {
8168
8438
  * and ACL operations for a single file in Google Cloud Storage.
8169
8439
  *
8170
8440
  * Handles emulator-specific edge cases (e.g., signing errors, atomic move fallback).
8441
+ *
8442
+ * @param storage - the Google Cloud Storage client instance.
8443
+ * @param storagePath - the storage path identifying the file's bucket and path.
8444
+ * @returns A file accessor with CRUD, streaming, and ACL operations.
8171
8445
  */ function googleCloudStorageAccessorFile(storage, storagePath) {
8172
8446
  var file = googleCloudStorageFileForStorageFilePath(storage, storagePath);
8173
8447
  function makeDownloadOptions(maxDownloadSizeBytes) {
@@ -8178,7 +8452,7 @@ function _ts_generator$2(thisArg, body) {
8178
8452
  }
8179
8453
  function _configureMetadata(options) {
8180
8454
  var _options_metadata, _options_metadata1, _options_metadata2, _options_metadata3, _options_metadata4, _options_metadata5;
8181
- var customMetadata = filterUndefinedValues(_object_spread$1({}, (_options_metadata = options.metadata) === null || _options_metadata === void 0 ? void 0 : _options_metadata.customMetadata, options === null || options === void 0 ? void 0 : options.customMetadata));
8455
+ var customMetadata = filterUndefinedValues(_object_spread$1({}, (_options_metadata = options.metadata) === null || _options_metadata === void 0 ? void 0 : _options_metadata.customMetadata, options.customMetadata));
8182
8456
  return filterUndefinedValues({
8183
8457
  cacheControl: (_options_metadata1 = options.metadata) === null || _options_metadata1 === void 0 ? void 0 : _options_metadata1.cacheControl,
8184
8458
  contentDisposition: (_options_metadata2 = options.metadata) === null || _options_metadata2 === void 0 ? void 0 : _options_metadata2.contentDisposition,
@@ -8295,7 +8569,7 @@ function _ts_generator$2(thisArg, body) {
8295
8569
  return x[0];
8296
8570
  }).catch(function(e) {
8297
8571
  var publicUrlBackup;
8298
- if (e && e.name === 'SigningError' && (isTestNodeEnv() || process.env.FIREBASE_STORAGE_EMULATOR_HOST)) {
8572
+ if (_instanceof(e, Error) && e.name === 'SigningError' && (isTestNodeEnv() || process.env.FIREBASE_STORAGE_EMULATOR_HOST)) {
8299
8573
  // NOTE: Signing does not behave properly in the emulator as it is not supported.
8300
8574
  // https://github.com/firebase/firebase-tools/issues/3400
8301
8575
  // we can return the public url instead.
@@ -8438,7 +8712,7 @@ function _ts_generator$2(thisArg, body) {
8438
8712
  },
8439
8713
  copy: copy,
8440
8714
  delete: function _delete(options) {
8441
- return file.delete(options).then(function(x) {
8715
+ return file.delete(options).then(function() {
8442
8716
  return undefined;
8443
8717
  });
8444
8718
  },
@@ -8472,7 +8746,8 @@ function _ts_generator$2(thisArg, body) {
8472
8746
  }
8473
8747
  var googleCloudStorageListFilesResultFactory = storageListFilesResultFactory({
8474
8748
  hasItems: function hasItems(result) {
8475
- return Boolean(result.apiResponse.items || result.apiResponse.prefixes);
8749
+ var _result_apiResponse_items;
8750
+ return Boolean((_result_apiResponse_items = result.apiResponse.items) !== null && _result_apiResponse_items !== void 0 ? _result_apiResponse_items : result.apiResponse.prefixes);
8476
8751
  },
8477
8752
  hasNext: function hasNext(result) {
8478
8753
  return result.nextQuery != null;
@@ -8481,7 +8756,8 @@ var googleCloudStorageListFilesResultFactory = storageListFilesResultFactory({
8481
8756
  var _result_nextQuery;
8482
8757
  return (_result_nextQuery = result.nextQuery) === null || _result_nextQuery === void 0 ? void 0 : _result_nextQuery.pageToken;
8483
8758
  },
8484
- next: function next(storage, options, folder, result) {
8759
+ next: function next(param, result) {
8760
+ var options = param.options, folder = param.folder;
8485
8761
  return folder.list(_object_spread$1({}, options, result.nextQuery));
8486
8762
  },
8487
8763
  file: function file(storage, fileResult) {
@@ -8491,9 +8767,8 @@ var googleCloudStorageListFilesResultFactory = storageListFilesResultFactory({
8491
8767
  return googleCloudStorageAccessorFolder(storage, folderResult.storagePath);
8492
8768
  },
8493
8769
  filesFromResult: function filesFromResult(result) {
8494
- var _ref;
8495
- var _result_apiResponse;
8496
- var items = (_ref = (_result_apiResponse = result.apiResponse) === null || _result_apiResponse === void 0 ? void 0 : _result_apiResponse.items) !== null && _ref !== void 0 ? _ref : [];
8770
+ var _result_apiResponse_items;
8771
+ var items = (_result_apiResponse_items = result.apiResponse.items) !== null && _result_apiResponse_items !== void 0 ? _result_apiResponse_items : [];
8497
8772
  return items.map(function(x) {
8498
8773
  return {
8499
8774
  raw: x,
@@ -8506,9 +8781,8 @@ var googleCloudStorageListFilesResultFactory = storageListFilesResultFactory({
8506
8781
  });
8507
8782
  },
8508
8783
  foldersFromResult: function foldersFromResult(result, folder) {
8509
- var _ref;
8510
- var _result_apiResponse;
8511
- var items = (_ref = (_result_apiResponse = result.apiResponse) === null || _result_apiResponse === void 0 ? void 0 : _result_apiResponse.prefixes) !== null && _ref !== void 0 ? _ref : [];
8784
+ var _result_apiResponse_prefixes;
8785
+ var items = (_result_apiResponse_prefixes = result.apiResponse.prefixes) !== null && _result_apiResponse_prefixes !== void 0 ? _result_apiResponse_prefixes : [];
8512
8786
  return items.map(function(prefix) {
8513
8787
  return {
8514
8788
  raw: prefix,
@@ -8524,6 +8798,10 @@ var googleCloudStorageListFilesResultFactory = storageListFilesResultFactory({
8524
8798
  /**
8525
8799
  * Creates a {@link GoogleCloudStorageAccessorFolder} that supports checking folder existence
8526
8800
  * and listing files/subfolders with pagination.
8801
+ *
8802
+ * @param storage - the Google Cloud Storage client instance.
8803
+ * @param storagePath - the storage path identifying the folder's bucket and prefix.
8804
+ * @returns A folder accessor with existence checking and listing operations.
8527
8805
  */ function googleCloudStorageAccessorFolder(storage, storagePath) {
8528
8806
  var bucket = googleCloudStorageBucketForStorageFilePath(storage, storagePath);
8529
8807
  var file = bucket.file(storagePath.pathString);
@@ -8567,7 +8845,11 @@ var googleCloudStorageListFilesResultFactory = storageListFilesResultFactory({
8567
8845
  nextQuery: nextQuery,
8568
8846
  apiResponse: apiResponse
8569
8847
  };
8570
- return googleCloudStorageListFilesResultFactory(storage, folder, options, result);
8848
+ return googleCloudStorageListFilesResultFactory({
8849
+ storage: storage,
8850
+ folder: folder,
8851
+ options: options
8852
+ }, result);
8571
8853
  });
8572
8854
  }
8573
8855
  };
@@ -8576,6 +8858,8 @@ var googleCloudStorageListFilesResultFactory = storageListFilesResultFactory({
8576
8858
  /**
8577
8859
  * Creates a {@link FirebaseStorageAccessorDriver} for Google Cloud Storage (Admin SDK).
8578
8860
  *
8861
+ * @returns A server-side storage accessor driver for Google Cloud Storage.
8862
+ *
8579
8863
  * @example
8580
8864
  * ```typescript
8581
8865
  * const driver = googleCloudStorageFirebaseStorageAccessorDriver();
@@ -8597,6 +8881,8 @@ var googleCloudStorageListFilesResultFactory = storageListFilesResultFactory({
8597
8881
  *
8598
8882
  * Bundles the server-side storage accessor driver, identified as `@google-cloud/storage`.
8599
8883
  *
8884
+ * @returns A complete set of storage drivers for server-side usage.
8885
+ *
8600
8886
  * @example
8601
8887
  * ```typescript
8602
8888
  * const drivers = googleCloudFirebaseStorageDrivers();
@@ -8698,6 +8984,7 @@ function _define_property$3(obj, key, value) {
8698
8984
  * Storage wrapper and the raw Google Cloud Storage SDK.
8699
8985
  *
8700
8986
  * @param storage - The Firebase Admin Storage instance.
8987
+ * @returns The underlying Google Cloud Storage client.
8701
8988
  *
8702
8989
  * @example
8703
8990
  * ```typescript
@@ -8848,6 +9135,7 @@ FirebaseServerStorageContextModule = __decorate([
8848
9135
  * Creates a NestJS provider that configures the default storage bucket ID.
8849
9136
  *
8850
9137
  * @param input - A bucket ID string or full factory config object.
9138
+ * @returns A NestJS provider for the storage context factory config token.
8851
9139
  * @throws Error if `defaultBucketId` is empty.
8852
9140
  *
8853
9141
  * @example
@@ -8868,6 +9156,8 @@ FirebaseServerStorageContextModule = __decorate([
8868
9156
  }
8869
9157
  /**
8870
9158
  * Returns the default provider config that creates a standard {@link FirebaseServerStorageService}.
9159
+ *
9160
+ * @returns The default provider configuration for FirebaseServerStorageService.
8871
9161
  */ function defaultProvideFirebaseServerStorageServiceSimple() {
8872
9162
  return {
8873
9163
  provide: FirebaseServerStorageService,
@@ -8881,6 +9171,9 @@ FirebaseServerStorageContextModule = __decorate([
8881
9171
  *
8882
9172
  * If the provider token differs from `FirebaseServerStorageService`, an alias provider is added
8883
9173
  * so the service can also be injected by the abstract type.
9174
+ *
9175
+ * @param provider - The storage service provider configuration.
9176
+ * @returns An array of NestJS providers for the storage service.
8884
9177
  */ function provideFirebaseServerStorageService(provider) {
8885
9178
  var _provider_inject;
8886
9179
  var providers = [
@@ -8902,13 +9195,17 @@ FirebaseServerStorageContextModule = __decorate([
8902
9195
  * Generates NestJS {@link ModuleMetadata} for an app's storage module, including the
8903
9196
  * {@link FirebaseServerStorageContextModule} import and the storage service provider.
8904
9197
  *
9198
+ * @param config - Optional configuration including a custom service provider and additional module metadata.
9199
+ * @returns NestJS module metadata ready to be passed to the `@Module()` decorator.
9200
+ *
8905
9201
  * @example
8906
9202
  * ```typescript
8907
9203
  * @Module(firebaseServerStorageModuleMetadata())
8908
9204
  * export class AppStorageModule {}
8909
9205
  * ```
8910
9206
  */ function firebaseServerStorageModuleMetadata(config) {
8911
- var serviceProvider = config && config.serviceProvider ? config.serviceProvider : defaultProvideFirebaseServerStorageServiceSimple();
9207
+ var _ref;
9208
+ var serviceProvider = (_ref = config === null || config === void 0 ? void 0 : config.serviceProvider) !== null && _ref !== void 0 ? _ref : defaultProvideFirebaseServerStorageServiceSimple();
8912
9209
  var providers = provideFirebaseServerStorageService(serviceProvider);
8913
9210
  var tokensToExport = injectionTokensFromProviders(providers);
8914
9211
  return mergeModuleMetadata({
@@ -9166,6 +9463,9 @@ function _ts_generator$1(thisArg, body) {
9166
9463
  * times with the same app reuses the existing server. The factory wires up Firebase Admin,
9167
9464
  * environment config, storage, AppCheck middleware, and webhook routes based on the config.
9168
9465
  *
9466
+ * @param config - Configuration for the NestJS server instance including the root module, providers, and middleware options.
9467
+ * @returns A NestServerInstance that manages server lifecycle for the given module class.
9468
+ *
9169
9469
  * @example
9170
9470
  * ```typescript
9171
9471
  * const instance = nestServerInstance({ moduleClass: AppModule, appCheckEnabled: true });
@@ -9181,7 +9481,7 @@ function _ts_generator$1(thisArg, body) {
9181
9481
  var server = express();
9182
9482
  var createNestServer = function createNestServer(expressInstance) {
9183
9483
  return _async_to_generator$1(function() {
9184
- var _config_defaultStorageBucket, _buildNestServerRootModule, rootModule, globalApiRoutePrefixConfig, options, nestApp;
9484
+ var _config_defaultStorageBucket, _buildNestServerRootModule, rootModule, globalApiRoutePrefixConfig, options, nestApp, configured;
9185
9485
  return _ts_generator$1(this, function(_state) {
9186
9486
  switch(_state.label){
9187
9487
  case 0:
@@ -9211,7 +9511,10 @@ function _ts_generator$1(thisArg, body) {
9211
9511
  nestApp = nestApp.setGlobalPrefix(globalApiRoutePrefixConfig.globalApiRoutePrefix, globalApiRoutePrefixConfig);
9212
9512
  }
9213
9513
  if (configureNestServerInstance) {
9214
- nestApp = configureNestServerInstance(nestApp) || nestApp;
9514
+ configured = configureNestServerInstance(nestApp);
9515
+ if (configured) {
9516
+ nestApp = configured;
9517
+ }
9215
9518
  }
9216
9519
  return [
9217
9520
  2,
@@ -9488,14 +9791,21 @@ function _ts_generator(thisArg, body) {
9488
9791
  {
9489
9792
  key: "nest",
9490
9793
  get: /**
9794
+ * Returns the NestJS application context.
9795
+ *
9491
9796
  * @deprecated use nestApplication instead.
9797
+ * @returns The NestJS application context.
9492
9798
  */ function get() {
9493
9799
  return this._nestApplication;
9494
9800
  }
9495
9801
  },
9496
9802
  {
9497
9803
  key: "nestApplication",
9498
- get: function get() {
9804
+ get: /**
9805
+ * Returns the NestJS application context.
9806
+ *
9807
+ * @returns The NestJS application context.
9808
+ */ function get() {
9499
9809
  return this._nestApplication;
9500
9810
  }
9501
9811
  }
@@ -9529,13 +9839,13 @@ function _ts_generator(thisArg, body) {
9529
9839
  {
9530
9840
  key: "envService",
9531
9841
  get: function get() {
9532
- return this.nest.get(FirebaseServerEnvService);
9842
+ return this.nestApplication.get(FirebaseServerEnvService);
9533
9843
  }
9534
9844
  },
9535
9845
  {
9536
9846
  key: "storageService",
9537
9847
  get: function get() {
9538
- return this.nest.get(FirebaseServerStorageService);
9848
+ return this.nestApplication.get(FirebaseServerStorageService);
9539
9849
  }
9540
9850
  },
9541
9851
  {
@@ -9546,6 +9856,7 @@ function _ts_generator(thisArg, body) {
9546
9856
  *
9547
9857
  * @param auth - The request's auth data reference.
9548
9858
  * @param buildFn - Optional builder to customize the context.
9859
+ * @returns A model context with auth, app, and error factories.
9549
9860
  */ key: "makeModelContext",
9550
9861
  value: function makeModelContext(auth, buildFn) {
9551
9862
  var base = {
@@ -9567,6 +9878,7 @@ function _ts_generator(thisArg, body) {
9567
9878
  *
9568
9879
  * @param context - The request's auth data reference.
9569
9880
  * @param buildFn - Optional builder to customize the model context.
9881
+ * @returns An in-context models service scoped to the given auth context.
9570
9882
  */ key: "model",
9571
9883
  value: function model(context, buildFn) {
9572
9884
  var firebaseModelContext = this.makeModelContext(context, buildFn);
@@ -9653,7 +9965,7 @@ function _define_property(obj, key, value) {
9653
9965
  {
9654
9966
  key: "nest",
9655
9967
  get: function get() {
9656
- return this.context.nest;
9968
+ return this.context.nestApplication;
9657
9969
  }
9658
9970
  }
9659
9971
  ]);