@dereekb/firebase-server 13.4.1 → 13.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/index.cjs.js +455 -113
  2. package/index.esm.js +456 -114
  3. package/mailgun/package.json +9 -9
  4. package/model/index.cjs.js +645 -350
  5. package/model/index.esm.js +646 -351
  6. package/model/package.json +9 -9
  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 +150 -32
  30. package/oidc/index.esm.js +150 -32
  31. package/oidc/package.json +10 -10
  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 +10 -10
  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 +10 -10
  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.cjs.js CHANGED
@@ -74,6 +74,8 @@ function _type_of$7(obj) {
74
74
  }
75
75
  /**
76
76
  * Creates an unauthenticated {@link HttpsError} indicating the request context has no auth data.
77
+ *
78
+ * @returns A new unauthenticated {@link HttpsError} with the no-auth error code.
77
79
  */ function unauthenticatedContextHasNoAuthData() {
78
80
  return unauthenticatedError({
79
81
  message: 'expected auth',
@@ -82,6 +84,8 @@ function _type_of$7(obj) {
82
84
  }
83
85
  /**
84
86
  * Creates an unauthenticated {@link HttpsError} indicating the request context has no user UID.
87
+ *
88
+ * @returns A new unauthenticated {@link HttpsError} with the no-auth error code.
85
89
  */ function unauthenticatedContextHasNoUidError() {
86
90
  return unauthenticatedError({
87
91
  message: 'no user uid',
@@ -95,9 +99,15 @@ function _type_of$7(obj) {
95
99
  * Each factory wraps the Firebase `HttpsError` with a consistent shape: an HTTP status code,
96
100
  * a string error code, and an optional {@link ServerError} detail object.
97
101
  */ var UNAUTHENTICATED_ERROR_CODE = 'UNAUTHENTICATED';
98
- /** Creates an unauthenticated (401) {@link HttpsError}. */ function unauthenticatedError(messageOrError) {
102
+ /**
103
+ * Creates an unauthenticated (401) {@link HttpsError}.
104
+ *
105
+ * @param messageOrError - Optional error message string or partial server error object.
106
+ * @returns A new unauthenticated (401) {@link HttpsError}.
107
+ */ function unauthenticatedError(messageOrError) {
108
+ var _serverError_message;
99
109
  var serverError = util.partialServerError(messageOrError);
100
- return new https.HttpsError('unauthenticated', (serverError === null || serverError === void 0 ? void 0 : serverError.message) || 'unauthenticated', _object_spread_props$c(_object_spread$g({
110
+ return new https.HttpsError('unauthenticated', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'unauthenticated', _object_spread_props$c(_object_spread$g({
101
111
  status: 401,
102
112
  code: UNAUTHENTICATED_ERROR_CODE
103
113
  }, serverError), {
@@ -105,9 +115,15 @@ function _type_of$7(obj) {
105
115
  }));
106
116
  }
107
117
  var FORBIDDEN_ERROR_CODE = 'FORBIDDEN';
108
- /** Creates a forbidden (403) {@link HttpsError}. */ function forbiddenError(messageOrError) {
118
+ /**
119
+ * Creates a forbidden (403) {@link HttpsError}.
120
+ *
121
+ * @param messageOrError - Optional error message string or partial server error object.
122
+ * @returns A new forbidden (403) {@link HttpsError}.
123
+ */ function forbiddenError(messageOrError) {
124
+ var _serverError_message;
109
125
  var serverError = util.partialServerError(messageOrError);
110
- return new https.HttpsError('permission-denied', (serverError === null || serverError === void 0 ? void 0 : serverError.message) || 'forbidden', _object_spread_props$c(_object_spread$g({
126
+ return new https.HttpsError('permission-denied', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'forbidden', _object_spread_props$c(_object_spread$g({
111
127
  status: 403,
112
128
  code: FORBIDDEN_ERROR_CODE
113
129
  }, serverError), {
@@ -115,9 +131,15 @@ var FORBIDDEN_ERROR_CODE = 'FORBIDDEN';
115
131
  }));
116
132
  }
117
133
  var PERMISSION_DENIED_ERROR_CODE = 'PERMISSION_DENIED';
118
- /** Creates a permission-denied (403) {@link HttpsError}. */ function permissionDeniedError(messageOrError) {
134
+ /**
135
+ * Creates a permission-denied (403) {@link HttpsError}.
136
+ *
137
+ * @param messageOrError - Optional error message string or partial server error object.
138
+ * @returns A new permission-denied (403) {@link HttpsError}.
139
+ */ function permissionDeniedError(messageOrError) {
140
+ var _serverError_message;
119
141
  var serverError = util.partialServerError(messageOrError);
120
- return new https.HttpsError('permission-denied', (serverError === null || serverError === void 0 ? void 0 : serverError.message) || 'permission denied', _object_spread_props$c(_object_spread$g({
142
+ return new https.HttpsError('permission-denied', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'permission denied', _object_spread_props$c(_object_spread$g({
121
143
  status: 403,
122
144
  code: PERMISSION_DENIED_ERROR_CODE
123
145
  }, serverError), {
@@ -125,9 +147,15 @@ var PERMISSION_DENIED_ERROR_CODE = 'PERMISSION_DENIED';
125
147
  }));
126
148
  }
127
149
  var NOT_FOUND_ERROR_CODE = 'NOT_FOUND';
128
- /** Creates a not-found (404) {@link HttpsError}. */ function notFoundError(messageOrError) {
150
+ /**
151
+ * Creates a not-found (404) {@link HttpsError}.
152
+ *
153
+ * @param messageOrError - Optional error message string or partial server error object.
154
+ * @returns A new not-found (404) {@link HttpsError}.
155
+ */ function notFoundError(messageOrError) {
156
+ var _serverError_message;
129
157
  var serverError = util.partialServerError(messageOrError);
130
- return new https.HttpsError('not-found', (serverError === null || serverError === void 0 ? void 0 : serverError.message) || 'not found', _object_spread_props$c(_object_spread$g({
158
+ return new https.HttpsError('not-found', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'not found', _object_spread_props$c(_object_spread$g({
131
159
  status: 404,
132
160
  code: NOT_FOUND_ERROR_CODE
133
161
  }, serverError), {
@@ -135,9 +163,15 @@ var NOT_FOUND_ERROR_CODE = 'NOT_FOUND';
135
163
  }));
136
164
  }
137
165
  var MODEL_NOT_AVAILABLE_ERROR_CODE = 'MODEL_NOT_AVAILABLE';
138
- /** Creates a model-not-available (404) {@link HttpsError}, used when a Firestore document does not exist. */ function modelNotAvailableError(messageOrError) {
166
+ /**
167
+ * Creates a model-not-available (404) {@link HttpsError}, used when a Firestore document does not exist.
168
+ *
169
+ * @param messageOrError - Optional error message string or partial server error object.
170
+ * @returns A new model-not-available (404) {@link HttpsError}.
171
+ */ function modelNotAvailableError(messageOrError) {
172
+ var _serverError_message;
139
173
  var serverError = util.partialServerError(messageOrError);
140
- return new https.HttpsError('not-found', (serverError === null || serverError === void 0 ? void 0 : serverError.message) || 'model was not available', _object_spread_props$c(_object_spread$g({
174
+ return new https.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({
141
175
  status: 404,
142
176
  code: MODEL_NOT_AVAILABLE_ERROR_CODE
143
177
  }, serverError), {
@@ -145,9 +179,15 @@ var MODEL_NOT_AVAILABLE_ERROR_CODE = 'MODEL_NOT_AVAILABLE';
145
179
  }));
146
180
  }
147
181
  var BAD_REQUEST_ERROR_CODE = 'BAD_REQUEST';
148
- /** Creates a bad-request (400) {@link HttpsError}. */ function badRequestError(messageOrError) {
182
+ /**
183
+ * Creates a bad-request (400) {@link HttpsError}.
184
+ *
185
+ * @param messageOrError - Optional error message string or partial server error object.
186
+ * @returns A new bad-request (400) {@link HttpsError}.
187
+ */ function badRequestError(messageOrError) {
188
+ var _serverError_message;
149
189
  var serverError = util.partialServerError(messageOrError);
150
- return new https.HttpsError('invalid-argument', (serverError === null || serverError === void 0 ? void 0 : serverError.message) || 'bad request', _object_spread_props$c(_object_spread$g({
190
+ return new https.HttpsError('invalid-argument', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'bad request', _object_spread_props$c(_object_spread$g({
151
191
  status: 400,
152
192
  code: BAD_REQUEST_ERROR_CODE
153
193
  }, serverError), {
@@ -155,9 +195,15 @@ var BAD_REQUEST_ERROR_CODE = 'BAD_REQUEST';
155
195
  }));
156
196
  }
157
197
  var CONFLICT_ERROR_CODE = 'CONFLICT';
158
- /** Creates a precondition-conflict (409) {@link HttpsError}. */ function preconditionConflictError(messageOrError) {
198
+ /**
199
+ * Creates a precondition-conflict (409) {@link HttpsError}.
200
+ *
201
+ * @param messageOrError - Optional error message string or partial server error object.
202
+ * @returns A new precondition-conflict (409) {@link HttpsError}.
203
+ */ function preconditionConflictError(messageOrError) {
204
+ var _serverError_message;
159
205
  var serverError = util.partialServerError(messageOrError);
160
- return new https.HttpsError('failed-precondition', (serverError === null || serverError === void 0 ? void 0 : serverError.message) || 'conflict', _object_spread_props$c(_object_spread$g({
206
+ return new https.HttpsError('failed-precondition', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'conflict', _object_spread_props$c(_object_spread$g({
161
207
  status: 409,
162
208
  code: CONFLICT_ERROR_CODE
163
209
  }, serverError), {
@@ -165,9 +211,15 @@ var CONFLICT_ERROR_CODE = 'CONFLICT';
165
211
  }));
166
212
  }
167
213
  var ALREADY_EXISTS_ERROR_CODE = 'ALREADY_EXISTS';
168
- /** Creates an already-exists (409) {@link HttpsError}. */ function alreadyExistsError(messageOrError) {
214
+ /**
215
+ * Creates an already-exists (409) {@link HttpsError}.
216
+ *
217
+ * @param messageOrError - Optional error message string or partial server error object.
218
+ * @returns A new already-exists (409) {@link HttpsError}.
219
+ */ function alreadyExistsError(messageOrError) {
220
+ var _serverError_message;
169
221
  var serverError = util.partialServerError(messageOrError);
170
- return new https.HttpsError('already-exists', (serverError === null || serverError === void 0 ? void 0 : serverError.message) || 'already exists', _object_spread_props$c(_object_spread$g({
222
+ return new https.HttpsError('already-exists', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'already exists', _object_spread_props$c(_object_spread$g({
171
223
  status: 409,
172
224
  code: ALREADY_EXISTS_ERROR_CODE
173
225
  }, serverError), {
@@ -175,9 +227,15 @@ var ALREADY_EXISTS_ERROR_CODE = 'ALREADY_EXISTS';
175
227
  }));
176
228
  }
177
229
  var UNAVAILABLE_ERROR_CODE = 'UNAVAILABLE';
178
- /** Creates an unavailable (503) {@link HttpsError}. */ function unavailableError(messageOrError) {
230
+ /**
231
+ * Creates an unavailable (503) {@link HttpsError}.
232
+ *
233
+ * @param messageOrError - Optional error message string or partial server error object.
234
+ * @returns A new unavailable (503) {@link HttpsError}.
235
+ */ function unavailableError(messageOrError) {
236
+ var _serverError_message;
179
237
  var serverError = util.partialServerError(messageOrError);
180
- return new https.HttpsError('unavailable', (serverError === null || serverError === void 0 ? void 0 : serverError.message) || 'service unavailable', _object_spread_props$c(_object_spread$g({
238
+ return new https.HttpsError('unavailable', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'service unavailable', _object_spread_props$c(_object_spread$g({
181
239
  status: 503,
182
240
  code: UNAVAILABLE_ERROR_CODE
183
241
  }, serverError), {
@@ -185,9 +243,15 @@ var UNAVAILABLE_ERROR_CODE = 'UNAVAILABLE';
185
243
  }));
186
244
  }
187
245
  var UNAVAILABLE_OR_DEACTIVATED_FUNCTION_ERROR_CODE = 'UNAVAILABLE_OR_DEACTIVATED_FUNCTION';
188
- /** Creates an unimplemented (501) {@link HttpsError} for deactivated or unavailable functions. */ function unavailableOrDeactivatedFunctionError(messageOrError) {
246
+ /**
247
+ * Creates an unimplemented (501) {@link HttpsError} for deactivated or unavailable functions.
248
+ *
249
+ * @param messageOrError - Optional error message string or partial server error object.
250
+ * @returns A new unimplemented (501) {@link HttpsError}.
251
+ */ function unavailableOrDeactivatedFunctionError(messageOrError) {
252
+ var _serverError_message;
189
253
  var serverError = util.partialServerError(messageOrError);
190
- return new https.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({
254
+ return new https.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({
191
255
  status: 501,
192
256
  code: UNAVAILABLE_OR_DEACTIVATED_FUNCTION_ERROR_CODE
193
257
  }, serverError), {
@@ -195,9 +259,15 @@ var UNAVAILABLE_OR_DEACTIVATED_FUNCTION_ERROR_CODE = 'UNAVAILABLE_OR_DEACTIVATED
195
259
  }));
196
260
  }
197
261
  var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
198
- /** Creates an internal-error (500) {@link HttpsError}. */ function internalServerError(messageOrError) {
262
+ /**
263
+ * Creates an internal-error (500) {@link HttpsError}.
264
+ *
265
+ * @param messageOrError - Optional error message string or partial server error object.
266
+ * @returns A new internal-error (500) {@link HttpsError}.
267
+ */ function internalServerError(messageOrError) {
268
+ var _serverError_message;
199
269
  var serverError = util.partialServerError(messageOrError);
200
- return new https.HttpsError('internal', (serverError === null || serverError === void 0 ? void 0 : serverError.message) || 'internal error', _object_spread_props$c(_object_spread$g({
270
+ return new https.HttpsError('internal', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'internal error', _object_spread_props$c(_object_spread$g({
201
271
  status: 500,
202
272
  code: INTERNAL_SERVER_ERROR_CODE
203
273
  }, serverError), {
@@ -206,13 +276,19 @@ var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
206
276
  }
207
277
  /**
208
278
  * Type guard for Firebase {@link HttpsError} instances.
279
+ *
280
+ * @param input - The value to check.
281
+ * @returns `true` if the input is a Firebase {@link HttpsError}.
209
282
  */ function isFirebaseHttpsError(input) {
210
- return (typeof input === "undefined" ? "undefined" : _type_of$7(input)) === 'object' && input.code != null && input.httpErrorCode != null && input.toJSON != null;
283
+ return (typeof input === "undefined" ? "undefined" : _type_of$7(input)) === 'object' && input != null && 'code' in input && 'httpErrorCode' in input && 'toJSON' in input;
211
284
  }
212
285
  /**
213
286
  * Type guard for Firebase Admin {@link admin.FirebaseError} instances.
287
+ *
288
+ * @param input - The value to check.
289
+ * @returns `true` if the input is a Firebase Admin {@link admin.FirebaseError}.
214
290
  */ function isFirebaseError(input) {
215
- return (typeof input === "undefined" ? "undefined" : _type_of$7(input)) === 'object' && input.code != null && input.message != null && input.toJSON != null;
291
+ return (typeof input === "undefined" ? "undefined" : _type_of$7(input)) === 'object' && input != null && 'code' in input && 'message' in input && 'toJSON' in input;
216
292
  }
217
293
  /**
218
294
  * Analyzes a caught error and extracts structured Firebase error information.
@@ -221,6 +297,7 @@ var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
221
297
  * and extracts any embedded error codes and {@link ServerError} details.
222
298
  *
223
299
  * @param e - The caught error to analyze.
300
+ * @returns Structured {@link FirebaseServerErrorInfo} with classified error details.
224
301
  *
225
302
  * @example
226
303
  * ```typescript
@@ -265,6 +342,9 @@ var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
265
342
  }
266
343
  /**
267
344
  * Returns a tuple of [firebaseErrorCode, errorInfo] for pattern-matching on Firebase error codes.
345
+ *
346
+ * @param e - The caught error to analyze.
347
+ * @returns A tuple of the Firebase error code (if present) and the full error info.
268
348
  */ function firebaseServerErrorInfoCodePair(e) {
269
349
  var info = firebaseServerErrorInfo(e);
270
350
  return [
@@ -274,6 +354,9 @@ var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
274
354
  }
275
355
  /**
276
356
  * Returns a tuple of [serverError, errorInfo] for pattern-matching on embedded server error details.
357
+ *
358
+ * @param e - The caught error to analyze.
359
+ * @returns A tuple of the server error (if present) and the full error info.
277
360
  */ function firebaseServerErrorInfoServerErrorPair(e) {
278
361
  var info = firebaseServerErrorInfo(e);
279
362
  return [
@@ -283,6 +366,9 @@ var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
283
366
  }
284
367
  /**
285
368
  * Returns a tuple of [serverErrorCode, errorInfo] for pattern-matching on server error string codes.
369
+ *
370
+ * @param e - The caught error to analyze.
371
+ * @returns A tuple of the server error code (if present) and the full error info.
286
372
  */ function firebaseServerErrorInfoServerErrorCodePair(e) {
287
373
  var info = firebaseServerErrorInfo(e);
288
374
  return [
@@ -307,6 +393,9 @@ var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
307
393
  /**
308
394
  * Type guard that checks whether the given callable context contains authenticated user data (non-null auth with a uid).
309
395
  *
396
+ * @param context - The callable context to check.
397
+ * @returns `true` if the context has authenticated user data with a valid UID.
398
+ *
310
399
  * @example
311
400
  * ```typescript
312
401
  * if (isContextWithAuthData(context)) {
@@ -315,11 +404,12 @@ var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
315
404
  * ```
316
405
  */ function isContextWithAuthData(context) {
317
406
  var _context_auth;
318
- return Boolean(context.auth !== null && ((_context_auth = context.auth) === null || _context_auth === void 0 ? void 0 : _context_auth.uid));
407
+ return Boolean((_context_auth = context.auth) === null || _context_auth === void 0 ? void 0 : _context_auth.uid);
319
408
  }
320
409
  /**
321
410
  * Asserts that the callable context contains authenticated user data.
322
411
  *
412
+ * @param context - The callable context to assert on.
323
413
  * @throws {HttpsError} Throws an unauthenticated error if auth data is missing.
324
414
  *
325
415
  * @example
@@ -340,6 +430,7 @@ var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
340
430
  * including email, phone, and sign-in timestamps.
341
431
  *
342
432
  * @param token - The decoded ID token from Firebase Admin Auth.
433
+ * @returns A normalized {@link FirebaseAuthToken} with camelCase fields.
343
434
  *
344
435
  * @example
345
436
  * ```typescript
@@ -523,7 +614,7 @@ function _ts_generator$c(thisArg, body) {
523
614
  ];
524
615
  case 2:
525
616
  error = _state.sent();
526
- if ((error === null || error === void 0 ? void 0 : error.code) === firebase.FIREBASE_AUTH_USER_NOT_FOUND_ERROR) {
617
+ if (error.code === firebase.FIREBASE_AUTH_USER_NOT_FOUND_ERROR) {
527
618
  return [
528
619
  2,
529
620
  undefined
@@ -719,6 +810,9 @@ function _array_like_to_array$a(arr, len) {
719
810
  function _array_with_holes$3(arr) {
720
811
  if (Array.isArray(arr)) return arr;
721
812
  }
813
+ function _array_without_holes$7(arr) {
814
+ if (Array.isArray(arr)) return _array_like_to_array$a(arr);
815
+ }
722
816
  function _assert_this_initialized$4(self) {
723
817
  if (self === void 0) {
724
818
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
@@ -808,6 +902,9 @@ function _inherits$4(subClass, superClass) {
808
902
  });
809
903
  if (superClass) _set_prototype_of$4(subClass, superClass);
810
904
  }
905
+ function _iterable_to_array$7(iter) {
906
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
907
+ }
811
908
  function _iterable_to_array_limit$3(arr, i) {
812
909
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
813
910
  if (_i == null) return;
@@ -835,6 +932,9 @@ function _iterable_to_array_limit$3(arr, i) {
835
932
  function _non_iterable_rest$3() {
836
933
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
837
934
  }
935
+ function _non_iterable_spread$7() {
936
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
937
+ }
838
938
  function _object_spread$f(target) {
839
939
  for(var i = 1; i < arguments.length; i++){
840
940
  var source = arguments[i] != null ? arguments[i] : {};
@@ -866,6 +966,9 @@ function _set_prototype_of$4(o, p) {
866
966
  function _sliced_to_array$3(arr, i) {
867
967
  return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$a(arr, i) || _non_iterable_rest$3();
868
968
  }
969
+ function _to_consumable_array$7(arr) {
970
+ return _array_without_holes$7(arr) || _iterable_to_array$7(arr) || _unsupported_iterable_to_array$a(arr) || _non_iterable_spread$7();
971
+ }
869
972
  function _type_of$5(obj) {
870
973
  "@swc/helpers - typeof";
871
974
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
@@ -1073,6 +1176,8 @@ function _ts_generator$b(thisArg, body) {
1073
1176
  {
1074
1177
  /**
1075
1178
  * Generates a random numeric string for use as a temporary reset password.
1179
+ *
1180
+ * @returns A random numeric string suitable as a temporary password.
1076
1181
  */ key: "_generateResetPasswordKey",
1077
1182
  value: function _generateResetPasswordKey() {
1078
1183
  return String(DEFAULT_FIREBASE_PASSWORD_NUMBER_GENERATOR());
@@ -1253,6 +1358,7 @@ function _ts_generator$b(thisArg, body) {
1253
1358
  *
1254
1359
  * @param roles - The complete set of roles to assign.
1255
1360
  * @param claimsToRetain - Additional claims to merge in alongside the role-derived claims.
1361
+ * @returns Resolves when the claims have been replaced.
1256
1362
  *
1257
1363
  * @example
1258
1364
  * ```typescript
@@ -1263,7 +1369,7 @@ function _ts_generator$b(thisArg, body) {
1263
1369
  return _async_to_generator$b(function() {
1264
1370
  var claims;
1265
1371
  return _ts_generator$b(this, function(_state) {
1266
- claims = _object_spread$f({}, claimsToRetain, this._claimsForRolesChange(Array.from(roles)));
1372
+ claims = _object_spread$f({}, claimsToRetain, this._claimsForRolesChange(_to_consumable_array$7(roles)));
1267
1373
  return [
1268
1374
  2,
1269
1375
  this.setClaims(claims)
@@ -1276,6 +1382,9 @@ function _ts_generator$b(thisArg, body) {
1276
1382
  /**
1277
1383
  * Converts roles to their corresponding claim keys, filtering out null/undefined entries
1278
1384
  * that represent unrelated claims in the service's {@link FirebaseServerAuthService.claimsForRoles} output.
1385
+ *
1386
+ * @param roles - The roles to convert to claims.
1387
+ * @returns Filtered claims object with only the relevant role-based entries.
1279
1388
  */ key: "_claimsForRolesChange",
1280
1389
  value: function _claimsForRolesChange(roles) {
1281
1390
  return util.filterNullAndUndefinedValues(this.service.claimsForRoles(util.asSet(roles)));
@@ -1304,12 +1413,8 @@ function _ts_generator$b(thisArg, body) {
1304
1413
  ];
1305
1414
  case 1:
1306
1415
  currentClaims = _state.sent();
1307
- if (currentClaims) {
1308
- newClaims = _object_spread$f({}, currentClaims, util.filterUndefinedValues(claims, false));
1309
- newClaims = util.filterNullAndUndefinedValues(newClaims);
1310
- } else {
1311
- newClaims = claims;
1312
- }
1416
+ newClaims = _object_spread$f({}, currentClaims, util.filterUndefinedValues(claims, false));
1417
+ newClaims = util.filterNullAndUndefinedValues(newClaims);
1313
1418
  return [
1314
1419
  2,
1315
1420
  this.setClaims(newClaims)
@@ -1438,6 +1543,7 @@ function _ts_generator$b(thisArg, body) {
1438
1543
  *
1439
1544
  * @param authService - The auth service to create a context from if needed.
1440
1545
  * @param userContextOrUid - A user context or UID string.
1546
+ * @returns The resolved user context instance.
1441
1547
  *
1442
1548
  * @example
1443
1549
  * ```typescript
@@ -1621,6 +1727,7 @@ function _ts_generator$b(thisArg, body) {
1621
1727
  3,
1622
1728
  7
1623
1729
  ];
1730
+ // Cast to string | undefined because claims are cast from raw custom claims which may not have this field at runtime
1624
1731
  setupCommunicationAt = setupDetails.claims.setupCommunicationAt;
1625
1732
  hasSentCommunication = Boolean(setupCommunicationAt);
1626
1733
  if (!((config === null || config === void 0 ? void 0 : config.sendSetupDetailsOnce) && hasSentCommunication)) return [
@@ -1628,7 +1735,7 @@ function _ts_generator$b(thisArg, body) {
1628
1735
  2
1629
1736
  ];
1630
1737
  // do not send.
1631
- if (config === null || config === void 0 ? void 0 : config.throwErrors) {
1738
+ if (config.throwErrors) {
1632
1739
  throw new FirebaseServerAuthNewUserSendSetupDetailsSendOnceError();
1633
1740
  }
1634
1741
  return [
@@ -1758,6 +1865,8 @@ function _ts_generator$b(thisArg, body) {
1758
1865
  key: "updateSetupContentSentTime",
1759
1866
  value: /**
1760
1867
  * Records the current timestamp as the last setup content communication date in the user's claims.
1868
+ *
1869
+ * @param details - The user's setup details containing the user context.
1761
1870
  */ function updateSetupContentSentTime(details) {
1762
1871
  return _async_to_generator$b(function() {
1763
1872
  var setupCommunicationAt;
@@ -1824,6 +1933,8 @@ function _ts_generator$b(thisArg, body) {
1824
1933
  *
1825
1934
  * Generates a random setup password if none is provided. Override to customize user creation behavior.
1826
1935
  *
1936
+ * @param input - The initialization configuration for the new user.
1937
+ * @returns The created user record and the setup password used.
1827
1938
  * @throws Throws if the Firebase Admin SDK rejects the user creation.
1828
1939
  */ function createNewUser(input) {
1829
1940
  return _async_to_generator$b(function() {
@@ -1860,7 +1971,7 @@ function _ts_generator$b(thisArg, body) {
1860
1971
  case 3:
1861
1972
  e = _state.sent();
1862
1973
  firebaseError = e;
1863
- errorCode = firebaseError === null || firebaseError === void 0 ? void 0 : firebaseError.code;
1974
+ errorCode = firebaseError.code;
1864
1975
  if (errorCode === firebase.FIREBASE_AUTH_PHONE_NUMBER_ALREADY_EXISTS_ERROR && phoneNumber) {
1865
1976
  throw new FirebaseServerAuthUserExistsError(errorCode, 'phone', phoneNumber);
1866
1977
  } else if (errorCode === firebase.FIREBASE_AUTH_EMAIL_ALREADY_EXISTS_ERROR && email) {
@@ -1892,6 +2003,8 @@ function _ts_generator$b(thisArg, body) {
1892
2003
  key: "updateClaimsToClearUser",
1893
2004
  value: /**
1894
2005
  * Clears setup-related claims (setup password and last communication date) from the user.
2006
+ *
2007
+ * @param userContext - The user context to clear setup claims from.
1895
2008
  */ function updateClaimsToClearUser(userContext) {
1896
2009
  return _async_to_generator$b(function() {
1897
2010
  var _obj;
@@ -2097,6 +2210,7 @@ function _ts_generator$b(thisArg, body) {
2097
2210
  * Creates a NestJS provider that binds the given config to the {@link FIREBASE_SERVER_ENV_TOKEN} injection token.
2098
2211
  *
2099
2212
  * @param env - The Firebase server environment configuration.
2213
+ * @returns A NestJS provider binding the config to the {@link FIREBASE_SERVER_ENV_TOKEN} token.
2100
2214
  *
2101
2215
  * @example
2102
2216
  * ```typescript
@@ -2115,6 +2229,7 @@ function _ts_generator$b(thisArg, body) {
2115
2229
  * Use this when the NestJS app needs the config accessible via either token.
2116
2230
  *
2117
2231
  * @param env - The Firebase server environment configuration.
2232
+ * @returns An array of providers binding the config to both Firebase and base server env tokens.
2118
2233
  *
2119
2234
  * @example
2120
2235
  * ```typescript
@@ -2156,6 +2271,7 @@ function _class_call_check$m(instance, Constructor) {
2156
2271
  * Each field in the input maps to an atomic increment operation. Null/undefined values default to 0.
2157
2272
  *
2158
2273
  * @param input - The increment specification mapping field names to numeric deltas.
2274
+ * @returns Firestore {@link UpdateData} with atomic increment operations.
2159
2275
  *
2160
2276
  * @example
2161
2277
  * ```typescript
@@ -2228,6 +2344,7 @@ function _unsupported_iterable_to_array$9(o, minLen) {
2228
2344
  * Google Cloud Firestore's {@link FieldValue.arrayUnion} and {@link FieldValue.arrayRemove}.
2229
2345
  *
2230
2346
  * @param input - The array update specification with `union` and/or `remove` field maps.
2347
+ * @returns Firestore {@link UpdateData} with array union/remove operations.
2231
2348
  *
2232
2349
  * @example
2233
2350
  * ```typescript
@@ -2237,8 +2354,8 @@ function _unsupported_iterable_to_array$9(o, minLen) {
2237
2354
  * });
2238
2355
  * ```
2239
2356
  */ function firestoreServerArrayUpdateToUpdateData(input) {
2240
- var union = input === null || input === void 0 ? void 0 : input.union;
2241
- var remove = input === null || input === void 0 ? void 0 : input.remove;
2357
+ var union = input.union;
2358
+ var remove = input.remove;
2242
2359
  function createUpdatesWithArrayFunction(fieldUpdate, arrayUpdateFunction) {
2243
2360
  var result;
2244
2361
  if (fieldUpdate) {
@@ -2372,7 +2489,7 @@ function _define_property$p(obj, key, value) {
2372
2489
  key: "update",
2373
2490
  value: function update(data, params) {
2374
2491
  if ((params === null || params === void 0 ? void 0 : params.precondition) != null) {
2375
- this.batch.update(this.documentRef, data, params === null || params === void 0 ? void 0 : params.precondition);
2492
+ this.batch.update(this.documentRef, data, params.precondition);
2376
2493
  } else {
2377
2494
  this.batch.update(this.documentRef, data);
2378
2495
  }
@@ -2389,6 +2506,7 @@ function _define_property$p(obj, key, value) {
2389
2506
  * the batch applies all queued writes atomically.
2390
2507
  *
2391
2508
  * @param writeBatch - The Google Cloud WriteBatch to queue operations into.
2509
+ * @returns A factory that creates batch-backed accessors sharing the given WriteBatch.
2392
2510
  *
2393
2511
  * @example
2394
2512
  * ```typescript
@@ -2431,6 +2549,9 @@ function _define_property$p(obj, key, value) {
2431
2549
  }();
2432
2550
  /**
2433
2551
  * Creates a {@link WriteBatchFirestoreDocumentContext} wrapping the given batch.
2552
+ *
2553
+ * @param batch - The Google Cloud WriteBatch to use.
2554
+ * @returns A new {@link WriteBatchFirestoreDocumentContext} for the given batch.
2434
2555
  */ function writeBatchDocumentContext(batch) {
2435
2556
  return new WriteBatchFirestoreDocumentContext(batch);
2436
2557
  }
@@ -2557,6 +2678,8 @@ function _define_property$o(obj, key, value) {
2557
2678
  /**
2558
2679
  * Creates a {@link FirestoreDocumentDataAccessorFactory} that produces default (non-batched, non-transactional) accessors.
2559
2680
  *
2681
+ * @returns A factory that creates default (non-batched, non-transactional) accessors.
2682
+ *
2560
2683
  * @example
2561
2684
  * ```typescript
2562
2685
  * const factory = defaultFirestoreAccessorFactory<User>();
@@ -2574,6 +2697,8 @@ function _define_property$o(obj, key, value) {
2574
2697
  * Creates a {@link FirestoreDocumentContext} with no special execution context (no batch, no transaction).
2575
2698
  *
2576
2699
  * Operations performed through this context execute immediately against Firestore.
2700
+ *
2701
+ * @returns A {@link FirestoreDocumentContext} for direct Firestore operations.
2577
2702
  */ function defaultFirestoreDocumentContext() {
2578
2703
  return {
2579
2704
  contextType: firebase.FirestoreDocumentContextType.NONE,
@@ -2703,7 +2828,7 @@ function _define_property$n(obj, key, value) {
2703
2828
  key: "update",
2704
2829
  value: function update(data, params) {
2705
2830
  if (params === null || params === void 0 ? void 0 : params.precondition) {
2706
- this.transaction.update(this.documentRef, data, params === null || params === void 0 ? void 0 : params.precondition);
2831
+ this.transaction.update(this.documentRef, data, params.precondition);
2707
2832
  } else {
2708
2833
  this.transaction.update(this.documentRef, data);
2709
2834
  }
@@ -2720,6 +2845,7 @@ function _define_property$n(obj, key, value) {
2720
2845
  * atomic operation.
2721
2846
  *
2722
2847
  * @param transaction - The Google Cloud Transaction to execute operations within.
2848
+ * @returns A factory that creates transaction-backed accessors sharing the given transaction.
2723
2849
  *
2724
2850
  * @example
2725
2851
  * ```typescript
@@ -2763,6 +2889,9 @@ function _define_property$n(obj, key, value) {
2763
2889
  }();
2764
2890
  /**
2765
2891
  * Creates a {@link TransactionFirestoreDocumentContext} wrapping the given transaction.
2892
+ *
2893
+ * @param transaction - The Google Cloud Transaction to use.
2894
+ * @returns A new {@link TransactionFirestoreDocumentContext} for the given transaction.
2766
2895
  */ function transactionDocumentContext(transaction) {
2767
2896
  return new TransactionFirestoreDocumentContext(transaction);
2768
2897
  }
@@ -2949,6 +3078,7 @@ function _ts_generator$a(thisArg, body) {
2949
3078
  * @param start - A Firestore object that can resolve collection paths (e.g., Firestore instance, DocumentReference).
2950
3079
  * @param path - The initial collection path.
2951
3080
  * @param pathSegments - Optional pairs of [docId, collectionName] for subcollection traversal.
3081
+ * @returns The resolved {@link CollectionReference} at the given path.
2952
3082
  * @throws Error if pathSegments length is odd (segments must come in pairs).
2953
3083
  *
2954
3084
  * @example
@@ -2959,7 +3089,7 @@ function _ts_generator$a(thisArg, body) {
2959
3089
  */ function collectionRefForPath(start, path, pathSegments) {
2960
3090
  var ref = start.collection(path);
2961
3091
  if (pathSegments === null || pathSegments === void 0 ? void 0 : pathSegments.length) {
2962
- if ((pathSegments === null || pathSegments === void 0 ? void 0 : pathSegments.length) % 2 !== 0) {
3092
+ if (pathSegments.length % 2 !== 0) {
2963
3093
  throw new Error('Invalid number of path segments provided for collection. Path: "'.concat(path, '" + "').concat(pathSegments, '"'));
2964
3094
  }
2965
3095
  var batches = util.batch(pathSegments, 2); // batch to tuple [string, string]
@@ -2979,6 +3109,7 @@ function _ts_generator$a(thisArg, body) {
2979
3109
  * @param start - A Firestore object that can resolve document paths (e.g., CollectionReference).
2980
3110
  * @param path - Optional document ID or path within the collection.
2981
3111
  * @param pathSegments - Optional pairs of [collectionName, docId] for subcollection traversal.
3112
+ * @returns The resolved {@link DocumentReference} at the given path.
2982
3113
  *
2983
3114
  * @example
2984
3115
  * ```typescript
@@ -3003,6 +3134,8 @@ function _ts_generator$a(thisArg, body) {
3003
3134
  * Implements document/collection resolution, transaction/batch factories, and context factories
3004
3135
  * using the `@google-cloud/firestore` library.
3005
3136
  *
3137
+ * @returns A {@link FirestoreAccessorDriver} for the Google Cloud Admin SDK.
3138
+ *
3006
3139
  * @example
3007
3140
  * ```typescript
3008
3141
  * const accessorDriver = googleCloudFirestoreAccessorDriver();
@@ -3037,18 +3170,10 @@ function _ts_generator$a(thisArg, body) {
3037
3170
  return function(fn) {
3038
3171
  return _async_to_generator$a(function() {
3039
3172
  return _ts_generator$a(this, function(_state) {
3040
- switch(_state.label){
3041
- case 0:
3042
- return [
3043
- 4,
3044
- firestore.runTransaction(fn)
3045
- ];
3046
- case 1:
3047
- return [
3048
- 2,
3049
- _state.sent()
3050
- ];
3051
- }
3173
+ return [
3174
+ 2,
3175
+ firestore.runTransaction(fn)
3176
+ ];
3052
3177
  });
3053
3178
  })();
3054
3179
  };
@@ -3173,6 +3298,8 @@ var _obj;
3173
3298
  * Creates a {@link FirestoreQueryConstraintFunctionsDriver} for the Google Cloud Firestore server SDK.
3174
3299
  *
3175
3300
  * Translates abstract query constraints into Google Cloud Firestore query builder calls.
3301
+ *
3302
+ * @returns A {@link FirestoreQueryConstraintFunctionsDriver} for the server SDK.
3176
3303
  */ function firestoreClientQueryConstraintFunctionsDriver() {
3177
3304
  return firebase.makeFirestoreQueryConstraintFunctionsDriver({
3178
3305
  mapping: FIRESTORE_CLIENT_QUERY_CONSTRAINT_HANDLER_MAPPING,
@@ -3194,6 +3321,8 @@ var _obj;
3194
3321
  * streaming (streamDocs) via `onSnapshot`. Transaction-aware reads are supported
3195
3322
  * through the optional transaction parameter in `getDocs`.
3196
3323
  *
3324
+ * @returns A complete {@link FirestoreQueryDriver} for the Google Cloud Admin SDK.
3325
+ *
3197
3326
  * @example
3198
3327
  * ```typescript
3199
3328
  * const queryDriver = googleCloudFirestoreQueryDriver();
@@ -3228,6 +3357,8 @@ var _obj;
3228
3357
  *
3229
3358
  * Bundles the server-side accessor driver and query driver, identified as `@google-cloud/firestore`.
3230
3359
  *
3360
+ * @returns A complete set of {@link FirestoreDrivers} for the Google Cloud Admin SDK.
3361
+ *
3231
3362
  * @example
3232
3363
  * ```typescript
3233
3364
  * const drivers = googleCloudFirestoreDrivers();
@@ -3438,6 +3569,7 @@ function _ts_generator$9(thisArg, body) {
3438
3569
  /**
3439
3570
  * Asserts that the callable context contains auth data with a valid UID.
3440
3571
  *
3572
+ * @param context - The callable context to check for auth data.
3441
3573
  * @throws {HttpsError} Throws unauthenticated error if no auth data is present.
3442
3574
  *
3443
3575
  * @example
@@ -3455,13 +3587,15 @@ function _ts_generator$9(thisArg, body) {
3455
3587
  *
3456
3588
  * @param document - The Firestore document to load data from.
3457
3589
  * @param message - Optional custom error message.
3590
+ * @returns The document's snapshot data.
3458
3591
  * @throws {HttpsError} Throws a {@link modelNotAvailableError} (404) if the document has no data.
3459
3592
  *
3460
3593
  * @example
3461
3594
  * ```typescript
3462
3595
  * const userData = await assertSnapshotData(userDocument);
3463
3596
  * ```
3464
- */ function assertSnapshotData(document, message) {
3597
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- FirestoreDocument generic requires any for proper type inference
3598
+ function assertSnapshotData(document, message) {
3465
3599
  return _async_to_generator$9(function() {
3466
3600
  var data;
3467
3601
  return _ts_generator$9(this, function(_state) {
@@ -3493,8 +3627,10 @@ function _ts_generator$9(thisArg, body) {
3493
3627
  *
3494
3628
  * @param document - The Firestore document to load data from.
3495
3629
  * @param message - Optional custom error message.
3630
+ * @returns The document's snapshot data with `id` and `key` attached.
3496
3631
  * @throws {HttpsError} Throws a {@link modelNotAvailableError} (404) if the document has no data.
3497
- */ function assertSnapshotDataWithKey(document, message) {
3632
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- FirestoreDocument generic requires any for proper type inference
3633
+ function assertSnapshotDataWithKey(document, message) {
3498
3634
  return _async_to_generator$9(function() {
3499
3635
  var data;
3500
3636
  return _ts_generator$9(this, function(_state) {
@@ -3520,7 +3656,8 @@ function _ts_generator$9(thisArg, body) {
3520
3656
  * @param document - The Firestore document to check.
3521
3657
  * @param message - Optional custom error message.
3522
3658
  * @throws {HttpsError} Throws a {@link modelNotAvailableError} (404) if the document does not exist.
3523
- */ function assertDocumentExists(document, message) {
3659
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- FirestoreDocument generic requires any for proper type inference
3660
+ function assertDocumentExists(document, message) {
3524
3661
  return _async_to_generator$9(function() {
3525
3662
  var exists;
3526
3663
  return _ts_generator$9(this, function(_state) {
@@ -3546,7 +3683,12 @@ function _ts_generator$9(thisArg, body) {
3546
3683
  * Creates a {@link modelNotAvailableError} for the given document's model type.
3547
3684
  *
3548
3685
  * Used by {@link assertDocumentExists} and other assertion functions.
3549
- */ function documentModelNotAvailableError(document, message) {
3686
+ *
3687
+ * @param document - The document (or object with `modelType`) to generate the error for.
3688
+ * @param message - Optional custom error message.
3689
+ * @returns A {@link modelNotAvailableError} with the document's model type in the message.
3690
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- FirestoreDocument generic requires any for proper type inference
3691
+ function documentModelNotAvailableError(document, message) {
3550
3692
  return modelNotAvailableError({
3551
3693
  message: message !== null && message !== void 0 ? message : "The ".concat(document.modelType, " was unavailable.")
3552
3694
  });
@@ -3557,6 +3699,8 @@ function _ts_generator$9(thisArg, body) {
3557
3699
  */ var PHONE_NUMBER_ALREADY_EXISTS_ERROR_CODE = 'PHONE_NUMBER_ALREADY_EXISTS';
3558
3700
  /**
3559
3701
  * Creates a precondition conflict (409) error indicating the phone number already exists.
3702
+ *
3703
+ * @returns A new precondition-conflict (409) {@link HttpsError} with the phone-number-exists code.
3560
3704
  */ function phoneNumberAlreadyExistsError() {
3561
3705
  return preconditionConflictError({
3562
3706
  code: PHONE_NUMBER_ALREADY_EXISTS_ERROR_CODE,
@@ -3640,7 +3784,10 @@ function _class_call_check$h(instance, Constructor) {
3640
3784
  * Creates a default no-op {@link FirebaseServerAnalyticsServiceListener}.
3641
3785
  *
3642
3786
  * Used when no analytics provider is configured. All methods are no-ops.
3787
+ *
3788
+ * @returns A no-op listener that silently discards all analytics events.
3643
3789
  */ function noopFirebaseServerAnalyticsServiceListener() {
3790
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
3644
3791
  var noop = function noop() {};
3645
3792
  return {
3646
3793
  handleOnCallAnalyticsEvent: noop,
@@ -3948,6 +4095,9 @@ function _ts_generator$8(thisArg, body) {
3948
4095
  * emitter('triggered').sendEventType('Handler Starting');
3949
4096
  * emitter('success').sendEvent('Widget Created', { id: result.id });
3950
4097
  * ```
4098
+ *
4099
+ * @param config - The service and context to bind to the emitter factory.
4100
+ * @returns A factory function that creates lifecycle-stage-specific emitters.
3951
4101
  */ function onCallAnalyticsEmitterInstance(config) {
3952
4102
  var service = config.service, context = config.context;
3953
4103
  return function(lifecycle) {
@@ -3955,6 +4105,7 @@ function _ts_generator$8(thisArg, body) {
3955
4105
  service: service,
3956
4106
  context: context,
3957
4107
  lifecycle: lifecycle,
4108
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3958
4109
  sendEvent: function sendEvent(event, properties) {
3959
4110
  service.handleOnCallAnalyticsEvent({
3960
4111
  event: event,
@@ -4154,22 +4305,34 @@ function _unsupported_iterable_to_array$6(o, minLen) {
4154
4305
  // MARK: Type Guards
4155
4306
  /**
4156
4307
  * Whether the details are specifier-level (has specifiers map).
4308
+ *
4309
+ * @param details - The API details to check.
4310
+ * @returns True if the details contain a specifiers map.
4157
4311
  */ function isOnCallModelTypeApiDetails(details) {
4158
4312
  return details != null && 'specifiers' in details;
4159
4313
  }
4160
4314
  /**
4161
4315
  * Whether the details are CRUD-model-level (has modelTypes map).
4316
+ *
4317
+ * @param details - The API details to check.
4318
+ * @returns True if the details contain a modelTypes map.
4162
4319
  */ function isOnCallCrudModelApiDetails(details) {
4163
4320
  return details != null && 'modelTypes' in details;
4164
4321
  }
4165
4322
  /**
4166
4323
  * Whether the details are handler-level (leaf node — no specifiers or modelTypes).
4324
+ *
4325
+ * @param details - The API details to check.
4326
+ * @returns True if the details are handler-level (no specifiers or modelTypes).
4167
4327
  */ function isOnCallHandlerApiDetails(details) {
4168
4328
  return details != null && !('specifiers' in details) && !('modelTypes' in details);
4169
4329
  }
4170
4330
  /**
4171
4331
  * Whether the specifier-level details represent a true specifier (multiple sub-operations)
4172
4332
  * vs a wrapped direct handler (`isSpecifier: false`, details under `_`).
4333
+ *
4334
+ * @param details - The specifier-level API details to check.
4335
+ * @returns True if the details represent a true specifier with multiple sub-operations.
4173
4336
  */ function isActualSpecifier(details) {
4174
4337
  return details.isSpecifier;
4175
4338
  }
@@ -4202,7 +4365,11 @@ function _unsupported_iterable_to_array$6(o, minLen) {
4202
4365
  * fn: async (request) => { ... }
4203
4366
  * });
4204
4367
  * ```
4205
- */ function withApiDetails(config) {
4368
+ *
4369
+ * @param config - The API details configuration including the handler function.
4370
+ * @returns The handler function with _apiDetails attached.
4371
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4372
+ function withApiDetails(config) {
4206
4373
  var optionalAuth = config.optionalAuth, fn = config.fn, apiDetails = _object_without_properties(config, [
4207
4374
  "optionalAuth",
4208
4375
  "fn"
@@ -4216,6 +4383,9 @@ function _unsupported_iterable_to_array$6(o, minLen) {
4216
4383
  // MARK: Aggregation Utilities
4217
4384
  /**
4218
4385
  * Reads _apiDetails from a function if present.
4386
+ *
4387
+ * @param fn - The function or object that may carry _apiDetails.
4388
+ * @returns The API details if present, otherwise undefined.
4219
4389
  */ function readApiDetails(fn) {
4220
4390
  return fn === null || fn === void 0 ? void 0 : fn._apiDetails;
4221
4391
  }
@@ -4223,6 +4393,9 @@ function _unsupported_iterable_to_array$6(o, minLen) {
4223
4393
  * Aggregates _apiDetails from a specifier handler config object.
4224
4394
  *
4225
4395
  * Returns OnCallModelTypeApiDetails if any handlers have _apiDetails, otherwise undefined.
4396
+ *
4397
+ * @param config - Map of specifier keys to handler functions.
4398
+ * @returns Aggregated specifier-level API details, or undefined if no handlers have _apiDetails.
4226
4399
  */ function aggregateSpecifierApiDetails(config) {
4227
4400
  var specifiers = {};
4228
4401
  var hasAny = false;
@@ -4260,6 +4433,9 @@ function _unsupported_iterable_to_array$6(o, minLen) {
4260
4433
  * Aggregates _apiDetails from a model type map (used by onCallCreateModel, etc.).
4261
4434
  *
4262
4435
  * Returns OnCallCrudModelApiDetails if any handlers have _apiDetails, otherwise undefined.
4436
+ *
4437
+ * @param map - Map of model type strings to handler functions.
4438
+ * @returns Aggregated CRUD-model-level API details, or undefined if no handlers have _apiDetails.
4263
4439
  */ function aggregateCrudModelApiDetails(map) {
4264
4440
  var modelTypes = {};
4265
4441
  var hasAny = false;
@@ -4306,6 +4482,9 @@ function _unsupported_iterable_to_array$6(o, minLen) {
4306
4482
  * Aggregates _apiDetails from the top-level call model map.
4307
4483
  *
4308
4484
  * Returns OnCallModelApiDetails if any CRUD handlers have _apiDetails, otherwise undefined.
4485
+ *
4486
+ * @param map - Map of call type strings to CRUD handler functions.
4487
+ * @returns Aggregated model-level API details, or undefined if no handlers have _apiDetails.
4309
4488
  */ function aggregateModelApiDetails(map) {
4310
4489
  var result = {};
4311
4490
  var hasAny = false;
@@ -4372,7 +4551,7 @@ function _unsupported_iterable_to_array$6(o, minLen) {
4372
4551
  if (modelDetails == null) {
4373
4552
  continue;
4374
4553
  }
4375
- if (!models[modelType]) {
4554
+ if (!(modelType in models)) {
4376
4555
  models[modelType] = {
4377
4556
  calls: {}
4378
4557
  };
@@ -4416,9 +4595,16 @@ function _unsupported_iterable_to_array$6(o, minLen) {
4416
4595
  /**
4417
4596
  * Resolves leaf-level analytics details from the aggregated _apiDetails tree.
4418
4597
  *
4419
- * Walks: call modelType specifier (if specifier-level), then reads the `analytics`
4598
+ * Walks: call -> modelType -> specifier (if specifier-level), then reads the `analytics`
4420
4599
  * field from the handler-level {@link OnCallModelFunctionApiDetails}.
4421
- */ function resolveAnalyticsFromApiDetails(apiDetails, call, modelType, specifier) {
4600
+ *
4601
+ * @param apiDetails - The top-level aggregated API details.
4602
+ * @param call - The CRUD operation type to look up.
4603
+ * @param modelType - The Firestore model type to look up.
4604
+ * @param specifier - Optional specifier key for variant handlers.
4605
+ * @returns The analytics details for the resolved handler, or undefined.
4606
+ */ // eslint-disable-next-line @typescript-eslint/max-params
4607
+ function resolveAnalyticsFromApiDetails(apiDetails, call, modelType, specifier) {
4422
4608
  var _apiDetails_call;
4423
4609
  var modelDetails = (_apiDetails_call = apiDetails[call]) === null || _apiDetails_call === void 0 ? void 0 : _apiDetails_call.modelTypes[modelType];
4424
4610
  if (modelDetails) {
@@ -4441,6 +4627,9 @@ function _unsupported_iterable_to_array$6(o, minLen) {
4441
4627
  * which the client can use to display a meaningful "not found" message. Intended to be
4442
4628
  * passed to Firebase permission/existence checking utilities as the
4443
4629
  * {@link FirebaseDoesNotExistErrorContextErrorFunction} callback.
4630
+ *
4631
+ * @param firebaseContextGrantedModelRoles - The granted model roles context containing the document reference.
4632
+ * @returns A model-not-available HTTP error.
4444
4633
  */ var nestFirebaseDoesNotExistError = function nestFirebaseDoesNotExistError(firebaseContextGrantedModelRoles) {
4445
4634
  var _firebaseContextGrantedModelRoles_data, _firebaseContextGrantedModelRoles_data1;
4446
4635
  return modelNotAvailableError({
@@ -4456,6 +4645,10 @@ function _unsupported_iterable_to_array$6(o, minLen) {
4456
4645
  * Returns a "forbidden" HTTP error including the document key, model type, and the roles
4457
4646
  * that were required but not granted. Intended to be passed to Firebase permission checking
4458
4647
  * utilities as the {@link FirebasePermissionErrorContextErrorFunction} callback.
4648
+ *
4649
+ * @param firebaseContextGrantedModelRoles - The granted model roles context containing the document reference.
4650
+ * @param roles - The roles that were required but not granted.
4651
+ * @returns A forbidden HTTP error.
4459
4652
  */ var nestFirebaseForbiddenPermissionError = function nestFirebaseForbiddenPermissionError(firebaseContextGrantedModelRoles, roles) {
4460
4653
  var _firebaseContextGrantedModelRoles_data, _firebaseContextGrantedModelRoles_data1;
4461
4654
  return forbiddenError({
@@ -4508,7 +4701,8 @@ function _unsupported_iterable_to_array$6(o, minLen) {
4508
4701
  *
4509
4702
  * @param fn
4510
4703
  * @param request
4511
- */ function assertRequestRequiresAuthForFunction(fn, request) {
4704
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- accepts any nest context and input type for generic auth assertion
4705
+ function assertRequestRequiresAuthForFunction(fn, request) {
4512
4706
  if (fn._requireAuth !== false) {
4513
4707
  assertIsContextWithAuthData(request);
4514
4708
  }
@@ -4558,13 +4752,15 @@ function _unsupported_iterable_to_array$6(o, minLen) {
4558
4752
  * fromUpload: updateProfileFromUpload
4559
4753
  * });
4560
4754
  * ```
4561
- */ function onCallSpecifierHandler(config) {
4755
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4756
+ function onCallSpecifierHandler(config) {
4562
4757
  var map = util.objectToMap(config);
4563
4758
  var fn = function fn(request) {
4564
4759
  var _request_specifier = request.specifier, specifier = _request_specifier === void 0 ? firebase.MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_DEFAULT : _request_specifier;
4565
4760
  var handler = map.get(specifier);
4566
4761
  if (handler != null) {
4567
4762
  assertRequestRequiresAuthForFunction(handler, request);
4763
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4568
4764
  return handler(request);
4569
4765
  } else {
4570
4766
  throw unknownModelCrudFunctionSpecifierError(specifier);
@@ -4581,6 +4777,9 @@ function _unsupported_iterable_to_array$6(o, minLen) {
4581
4777
  /**
4582
4778
  * Creates a bad-request error indicating the provided specifier is not recognized
4583
4779
  * by the current model CRUD handler.
4780
+ *
4781
+ * @param specifier - The unrecognized specifier string.
4782
+ * @returns A bad-request error with UNKNOWN_SPECIFIER_ERROR code.
4584
4783
  */ function unknownModelCrudFunctionSpecifierError(specifier) {
4585
4784
  return badRequestError(util.serverError({
4586
4785
  status: 400,
@@ -4683,8 +4882,7 @@ function _object_spread_props$a(target, source) {
4683
4882
  }
4684
4883
  }
4685
4884
  var fn = function fn(request) {
4686
- var _request_data, _request_data1;
4687
- var call = (_request_data = request.data) === null || _request_data === void 0 ? void 0 : _request_data.call;
4885
+ var call = request.data.call;
4688
4886
  if (!call) {
4689
4887
  throw onCallModelMissingCallTypeError();
4690
4888
  }
@@ -4692,18 +4890,21 @@ function _object_spread_props$a(target, source) {
4692
4890
  if (!callFn) {
4693
4891
  throw onCallModelUnknownCallTypeError(call);
4694
4892
  }
4695
- var _request_data2 = request.data, specifier = _request_data2.specifier, modelType = _request_data2.modelType;
4893
+ var _request_data = request.data, specifier = _request_data.specifier, modelType = _request_data.modelType;
4894
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4696
4895
  var auth = request.auth;
4896
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4697
4897
  var context = {
4698
4898
  call: call,
4699
4899
  modelType: modelType,
4700
4900
  specifier: specifier,
4701
4901
  uid: auth === null || auth === void 0 ? void 0 : auth.uid,
4702
4902
  auth: auth,
4703
- data: (_request_data1 = request.data) === null || _request_data1 === void 0 ? void 0 : _request_data1.data,
4903
+ data: request.data.data,
4704
4904
  request: request
4705
4905
  };
4706
4906
  preAssert(context);
4907
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4707
4908
  var result;
4708
4909
  // Resolve analytics from _apiDetails tree — callWithAnalytics handles undefined details
4709
4910
  var analyticsService = getAnalyticsService(request);
@@ -4729,6 +4930,8 @@ function _object_spread_props$a(target, source) {
4729
4930
  }
4730
4931
  /**
4731
4932
  * Creates a bad-request error indicating the `call` field was missing from the request payload.
4933
+ *
4934
+ * @returns A bad-request error with CALL_TYPE_MISSING_ERROR code.
4732
4935
  */ function onCallModelMissingCallTypeError() {
4733
4936
  return badRequestError(util.serverError({
4734
4937
  status: 400,
@@ -4738,6 +4941,9 @@ function _object_spread_props$a(target, source) {
4738
4941
  }
4739
4942
  /**
4740
4943
  * Creates a bad-request error indicating the provided `call` type is not recognized.
4944
+ *
4945
+ * @param call - The unrecognized call type string.
4946
+ * @returns A bad-request error with UNKNOWN_CALL_TYPE_ERROR code.
4741
4947
  */ function onCallModelUnknownCallTypeError(call) {
4742
4948
  return badRequestError(util.serverError({
4743
4949
  status: 400,
@@ -4754,14 +4960,16 @@ function _object_spread_props$a(target, source) {
4754
4960
  * Dispatches to the correct model-type handler from the map, enforces auth requirements,
4755
4961
  * runs pre-assertions, and aggregates API details from all handlers for MCP introspection.
4756
4962
  *
4963
+ * @param map - Maps model type strings to their handler functions.
4964
+ * @param config - Configuration including call type, crud type, and error factory.
4965
+ * @returns A callable function that dispatches to the correct model-type handler.
4757
4966
  * @internal Not intended for direct use outside the model CRUD module.
4758
4967
  */ function _onCallWithCallTypeFunction(map, config) {
4759
- var callType = config.callType; config.crudType; var _config_preAssert = config.preAssert, preAssert = _config_preAssert === void 0 ? function() {
4968
+ var callType = config.callType, _config_preAssert = config.preAssert, preAssert = _config_preAssert === void 0 ? function() {
4760
4969
  return undefined;
4761
4970
  } : _config_preAssert, throwOnUnknownModelType = config.throwOnUnknownModelType;
4762
4971
  var fn = function fn(request) {
4763
- var _request_data;
4764
- var modelType = (_request_data = request.data) === null || _request_data === void 0 ? void 0 : _request_data.modelType;
4972
+ var modelType = request.data.modelType;
4765
4973
  var crudFn = map[modelType];
4766
4974
  if (crudFn) {
4767
4975
  var specifier = request.data.specifier;
@@ -4808,15 +5016,18 @@ function _object_spread_props$a(target, source) {
4808
5016
  */ function onCallCreateModel(map) {
4809
5017
  var config = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
4810
5018
  var preAssert = config.preAssert;
5019
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4811
5020
  return _onCallWithCallTypeFunction(map, {
4812
5021
  callType: 'create',
4813
- crudType: 'create',
4814
5022
  preAssert: preAssert,
4815
5023
  throwOnUnknownModelType: createModelUnknownModelTypeError
4816
5024
  });
4817
5025
  }
4818
5026
  /**
4819
5027
  * Creates a bad-request error indicating the requested model type is not valid for creation.
5028
+ *
5029
+ * @param modelType - The unrecognized model type string.
5030
+ * @returns A bad-request error with UNKNOWN_TYPE_ERROR code.
4820
5031
  */ function createModelUnknownModelTypeError(modelType) {
4821
5032
  return badRequestError(util.serverError({
4822
5033
  status: 400,
@@ -4848,15 +5059,18 @@ function _object_spread_props$a(target, source) {
4848
5059
  */ function onCallReadModel(map) {
4849
5060
  var config = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
4850
5061
  var preAssert = config.preAssert;
5062
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4851
5063
  return _onCallWithCallTypeFunction(map, {
4852
5064
  callType: 'read',
4853
- crudType: 'read',
4854
5065
  preAssert: preAssert,
4855
5066
  throwOnUnknownModelType: readModelUnknownModelTypeError
4856
5067
  });
4857
5068
  }
4858
5069
  /**
4859
5070
  * Creates a bad-request error indicating the requested model type is not valid for reading.
5071
+ *
5072
+ * @param modelType - The unrecognized model type string.
5073
+ * @returns A bad-request error with UNKNOWN_TYPE_ERROR code.
4860
5074
  */ function readModelUnknownModelTypeError(modelType) {
4861
5075
  return badRequestError(util.serverError({
4862
5076
  status: 400,
@@ -4891,15 +5105,18 @@ function _object_spread_props$a(target, source) {
4891
5105
  */ function onCallUpdateModel(map) {
4892
5106
  var config = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
4893
5107
  var preAssert = config.preAssert;
5108
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4894
5109
  return _onCallWithCallTypeFunction(map, {
4895
5110
  callType: 'update',
4896
- crudType: 'update',
4897
5111
  preAssert: preAssert,
4898
5112
  throwOnUnknownModelType: updateModelUnknownModelTypeError
4899
5113
  });
4900
5114
  }
4901
5115
  /**
4902
5116
  * Creates a bad-request error indicating the requested model type is not valid for updating.
5117
+ *
5118
+ * @param modelType - The unrecognized model type string.
5119
+ * @returns A bad-request error with UNKNOWN_TYPE_ERROR code.
4903
5120
  */ function updateModelUnknownModelTypeError(modelType) {
4904
5121
  return badRequestError(util.serverError({
4905
5122
  status: 400,
@@ -4931,15 +5148,18 @@ function _object_spread_props$a(target, source) {
4931
5148
  */ function onCallDeleteModel(map) {
4932
5149
  var config = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
4933
5150
  var preAssert = config.preAssert;
5151
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4934
5152
  return _onCallWithCallTypeFunction(map, {
4935
5153
  callType: 'delete',
4936
- crudType: 'delete',
4937
5154
  preAssert: preAssert,
4938
5155
  throwOnUnknownModelType: deleteModelUnknownModelTypeError
4939
5156
  });
4940
5157
  }
4941
5158
  /**
4942
5159
  * Creates a bad-request error indicating the requested model type is not valid for deletion.
5160
+ *
5161
+ * @param modelType - The unrecognized model type string.
5162
+ * @returns A bad-request error with UNKNOWN_TYPE_ERROR code.
4943
5163
  */ function deleteModelUnknownModelTypeError(modelType) {
4944
5164
  return badRequestError(util.serverError({
4945
5165
  status: 400,
@@ -5253,6 +5473,7 @@ exports.FirebaseServerAnalyticsSegmentModule = __decorate([
5253
5473
  * Creates a NestJS {@link FactoryProvider} that binds a Firebase Admin app getter to {@link FIREBASE_APP_TOKEN}.
5254
5474
  *
5255
5475
  * @param useFactory - Factory function returning the Firebase Admin app instance.
5476
+ * @returns A NestJS factory provider for the Firebase Admin app.
5256
5477
  *
5257
5478
  * @example
5258
5479
  * ```typescript
@@ -5350,6 +5571,9 @@ exports.FirebaseServerAuthModule = __decorate([
5350
5571
  * Returns two providers: the concrete service and an alias that maps
5351
5572
  * `FirebaseServerAuthService` to the concrete token, enabling injection by the abstract type.
5352
5573
  *
5574
+ * @param provider - The factory provider configuration for the auth service.
5575
+ * @returns A tuple containing the configured provider and an alias provider.
5576
+ *
5353
5577
  * @example
5354
5578
  * ```typescript
5355
5579
  * const providers = provideFirebaseServerAuthService({
@@ -5375,6 +5599,9 @@ exports.FirebaseServerAuthModule = __decorate([
5375
5599
  * Generates NestJS {@link ModuleMetadata} for an app's auth module, including the {@link FirebaseServerAuthModule}
5376
5600
  * import and the custom {@link FirebaseServerAuthService} provider.
5377
5601
  *
5602
+ * @param config - The module metadata configuration including the service provider.
5603
+ * @returns The merged NestJS module metadata.
5604
+ *
5378
5605
  * @example
5379
5606
  * ```typescript
5380
5607
  * @Module(firebaseServerAuthModuleMetadata({
@@ -5398,15 +5625,21 @@ exports.FirebaseServerAuthModule = __decorate([
5398
5625
  /**
5399
5626
  * Asserts that the caller has admin privileges in the request.
5400
5627
  *
5628
+ * @param request - The callable request to check for admin privileges.
5401
5629
  * @throws {HttpsError} Throws forbidden (403) if the caller is not an admin.
5402
- */ function assertIsAdminInRequest(request) {
5630
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5631
+ function assertIsAdminInRequest(request) {
5403
5632
  if (!isAdminInRequest(request)) {
5404
5633
  throw forbiddenError();
5405
5634
  }
5406
5635
  }
5407
5636
  /**
5408
5637
  * Checks whether the caller has admin privileges in the request.
5409
- */ function isAdminInRequest(request) {
5638
+ *
5639
+ * @param request - The callable request to check for admin privileges.
5640
+ * @returns True if the caller has admin privileges.
5641
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5642
+ function isAdminInRequest(request) {
5410
5643
  return request.nest.authService.context(request).isAdmin;
5411
5644
  }
5412
5645
  /**
@@ -5414,9 +5647,12 @@ exports.FirebaseServerAuthModule = __decorate([
5414
5647
  *
5415
5648
  * If the request data contains a `uid` that differs from the caller's auth UID, admin status is required.
5416
5649
  *
5650
+ * @param request - The callable request containing the target UID.
5651
+ * @param requireUid - If true, a UID must be present in the request data.
5417
5652
  * @returns The resolved target UID (from request data or auth).
5418
5653
  * @throws {HttpsError} Throws forbidden (403) if the caller is not authorized.
5419
- */ function assertIsAdminOrTargetUserInRequestData(request, requireUid) {
5654
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5655
+ function assertIsAdminOrTargetUserInRequestData(request, requireUid) {
5420
5656
  var _request_data_uid;
5421
5657
  var _request_auth;
5422
5658
  if (!isAdminOrTargetUserInRequestData(request, requireUid)) {
@@ -5427,8 +5663,11 @@ exports.FirebaseServerAuthModule = __decorate([
5427
5663
  /**
5428
5664
  * Checks whether the caller is an admin or is targeting their own user record in the request data.
5429
5665
  *
5666
+ * @param request - The callable request containing the target UID.
5430
5667
  * @param requireUid - If true, a UID must be present in the request data.
5431
- */ function isAdminOrTargetUserInRequestData(request) {
5668
+ * @returns True if the caller is an admin or is targeting their own user record.
5669
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5670
+ function isAdminOrTargetUserInRequestData(request) {
5432
5671
  var requireUid = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
5433
5672
  var _request_auth;
5434
5673
  var uid = request.data.uid;
@@ -5442,8 +5681,10 @@ exports.FirebaseServerAuthModule = __decorate([
5442
5681
  /**
5443
5682
  * Asserts that the caller has signed the Terms of Service.
5444
5683
  *
5684
+ * @param request - The callable request to check for ToS status.
5445
5685
  * @throws {HttpsError} Throws forbidden (403) if ToS has not been signed.
5446
- */ function assertHasSignedTosInRequest(request) {
5686
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5687
+ function assertHasSignedTosInRequest(request) {
5447
5688
  if (!hasSignedTosInRequest(request)) {
5448
5689
  throw forbiddenError({
5449
5690
  message: 'ToS has not been signed.'
@@ -5452,15 +5693,21 @@ exports.FirebaseServerAuthModule = __decorate([
5452
5693
  }
5453
5694
  /**
5454
5695
  * Checks whether the caller has signed the Terms of Service.
5455
- */ function hasSignedTosInRequest(request) {
5696
+ *
5697
+ * @param request - The callable request to check for ToS status.
5698
+ * @returns True if the caller has signed the Terms of Service.
5699
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5700
+ function hasSignedTosInRequest(request) {
5456
5701
  return request.nest.authService.context(request).hasSignedTos;
5457
5702
  }
5458
5703
  /**
5459
5704
  * Asserts that the caller has all of the specified auth roles.
5460
5705
  *
5706
+ * @param request - The callable request to check for auth roles.
5461
5707
  * @param authRoles - One or more roles that must all be present.
5462
5708
  * @throws {HttpsError} Throws forbidden (403) if any required role is missing.
5463
- */ function assertHasRolesInRequest(request, authRoles) {
5709
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5710
+ function assertHasRolesInRequest(request, authRoles) {
5464
5711
  if (!hasAuthRolesInRequest(request, authRoles)) {
5465
5712
  throw forbiddenError({
5466
5713
  message: 'Missing required auth roles.',
@@ -5472,7 +5719,12 @@ exports.FirebaseServerAuthModule = __decorate([
5472
5719
  }
5473
5720
  /**
5474
5721
  * Checks whether the caller has all of the specified auth roles.
5475
- */ function hasAuthRolesInRequest(request, authRoles) {
5722
+ *
5723
+ * @param request - The callable request to check for auth roles.
5724
+ * @param authRoles - One or more roles that must all be present.
5725
+ * @returns True if the caller has all of the specified auth roles.
5726
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5727
+ function hasAuthRolesInRequest(request, authRoles) {
5476
5728
  return util.containsAllValues(request.nest.authService.context(request).authRoles, authRoles);
5477
5729
  }
5478
5730
  /**
@@ -5480,8 +5732,10 @@ exports.FirebaseServerAuthModule = __decorate([
5480
5732
  *
5481
5733
  * This may be used to filter out new users that were not invited from finishing their onboarding.
5482
5734
  *
5483
- * @param request
5484
- */ function hasNewUserSetupPasswordInRequest(request) {
5735
+ * @param request - The callable request to check for setup password claims.
5736
+ * @returns True if the claims contain a setup password key.
5737
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5738
+ function hasNewUserSetupPasswordInRequest(request) {
5485
5739
  var claims = request.nest.authService.context(request).claims;
5486
5740
  return claims[firebase.FIREBASE_SERVER_AUTH_CLAIMS_SETUP_PASSWORD_KEY] != null;
5487
5741
  }
@@ -5574,6 +5828,9 @@ function _object_spread_props$7(target, source) {
5574
5828
  }
5575
5829
  /**
5576
5830
  * Creates a bad-request error indicating the provided development function specifier is not recognized.
5831
+ *
5832
+ * @param specifier - the unrecognized specifier string from the client request.
5833
+ * @returns A bad-request error with the unknown specifier details.
5577
5834
  */ function developmentUnknownSpecifierError(specifier) {
5578
5835
  return badRequestError(util.serverError({
5579
5836
  status: 400,
@@ -5591,6 +5848,8 @@ function _object_spread_props$7(target, source) {
5591
5848
  /**
5592
5849
  * Creates a bad-request error for when the caller sends a 'run' command
5593
5850
  * without specifying which scheduled function to execute.
5851
+ *
5852
+ * @returns A bad-request error indicating the missing run name.
5594
5853
  */ function noRunNameSpecifiedForScheduledFunctionDevelopmentFunction() {
5595
5854
  return badRequestError({
5596
5855
  code: NO_RUN_NAME_SPECIFIED_FOR_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_CODE,
@@ -5603,6 +5862,9 @@ function _object_spread_props$7(target, source) {
5603
5862
  /**
5604
5863
  * Creates a bad-request error for when the requested scheduled function name
5605
5864
  * is not found in the registered function map.
5865
+ *
5866
+ * @param name - the unrecognized function name from the client request.
5867
+ * @returns A bad-request error with the unknown function name details.
5606
5868
  */ function unknownScheduledFunctionDevelopmentFunctionName(name) {
5607
5869
  return badRequestError({
5608
5870
  code: UNKNOWN_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_NAME_CODE,
@@ -5618,6 +5880,9 @@ function _object_spread_props$7(target, source) {
5618
5880
  /**
5619
5881
  * Creates a bad-request error for when the request `type` field does not match
5620
5882
  * any supported operation ('run' or 'list').
5883
+ *
5884
+ * @param type - the unrecognized type value from the client request.
5885
+ * @returns A bad-request error with the unknown type details.
5621
5886
  */ function unknownScheduledFunctionDevelopmentFunctionType(type) {
5622
5887
  return badRequestError({
5623
5888
  code: UNKNOWN_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_TYPE_CODE,
@@ -5832,7 +6097,7 @@ function _ts_generator$7(thisArg, body) {
5832
6097
  var result = [];
5833
6098
  util.forEachKeyValue(allScheduledFunctions, {
5834
6099
  forEach: function forEach(x) {
5835
- var _x = _sliced_to_array(x, 2), functionName = _x[0]; _x[1];
6100
+ var _x = _sliced_to_array(x, 1), functionName = _x[0];
5836
6101
  result.push({
5837
6102
  name: functionName.toString()
5838
6103
  });
@@ -5849,12 +6114,12 @@ function _ts_generator$7(thisArg, body) {
5849
6114
  data = request.data;
5850
6115
  type = data.type;
5851
6116
  switch(type){
5852
- case 'run':
6117
+ case firebase.ScheduledFunctionDevelopmentFunctionTypeEnum.RUN:
5853
6118
  return [
5854
6119
  3,
5855
6120
  1
5856
6121
  ];
5857
- case 'list':
6122
+ case firebase.ScheduledFunctionDevelopmentFunctionTypeEnum.LIST:
5858
6123
  return [
5859
6124
  3,
5860
6125
  6
@@ -5912,8 +6177,6 @@ function _ts_generator$7(thisArg, body) {
5912
6177
  }
5913
6178
  ];
5914
6179
  case 7:
5915
- throw unknownScheduledFunctionDevelopmentFunctionType(type);
5916
- case 8:
5917
6180
  return [
5918
6181
  2
5919
6182
  ];
@@ -6101,8 +6364,10 @@ function _ts_generator$6(thisArg, body) {
6101
6364
  *
6102
6365
  * export const { dev } = devFunctions;
6103
6366
  * ```
6104
- */ function firebaseServerDevFunctions(config) {
6367
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- generic type parameters require `any` for Firebase SDK compatibility
6368
+ function firebaseServerDevFunctions(config) {
6105
6369
  var enabled = config.enabled, secure = config.secure, nest = config.nest, developerFunctionsMap = config.developerFunctionsMap, onCallFactory = config.onCallFactory, allScheduledFunctions = config.allScheduledFunctions, disableDevelopmentScheduleFunction = config.disableDevelopmentScheduleFunction;
6370
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- RunnableHttpFunction supports legacy gen 1 deployments
6106
6371
  var dev;
6107
6372
  if (enabled) {
6108
6373
  var fullFunctionsMap = _object_spread$8({}, developerFunctionsMap);
@@ -6117,7 +6382,7 @@ function _ts_generator$6(thisArg, body) {
6117
6382
  }
6118
6383
  dev = onCallFactory(onCallFunction)(nest);
6119
6384
  } else {
6120
- dev = onCallFactory(function(x) {
6385
+ dev = onCallFactory(function() {
6121
6386
  return _async_to_generator$6(function() {
6122
6387
  return _ts_generator$6(this, function(_state) {
6123
6388
  throw unavailableError({
@@ -6237,6 +6502,8 @@ function _is_native_reflect_construct$1() {
6237
6502
  key: "developmentSchedulerEnabled",
6238
6503
  get: /**
6239
6504
  * Enabled when not in production and not in a testing environment.
6505
+ *
6506
+ * @returns True if the development scheduler should be enabled.
6240
6507
  */ function get() {
6241
6508
  return !this.isProduction && !this.isTestingEnv;
6242
6509
  }
@@ -6259,6 +6526,9 @@ exports.DefaultFirebaseServerEnvService = __decorate([
6259
6526
  *
6260
6527
  * Useful for conditionally enabling production-only Cloud Functions (e.g., scheduled tasks).
6261
6528
  *
6529
+ * @param nest - getter for the NestJS application context promise.
6530
+ * @returns An async decision function that resolves to `true` in production.
6531
+ *
6262
6532
  * @example
6263
6533
  * ```typescript
6264
6534
  * const isProduction = nestAppIsProductionEnvironment(nestAppGetter);
@@ -6275,6 +6545,9 @@ exports.DefaultFirebaseServerEnvService = __decorate([
6275
6545
  * Creates an async decision function that resolves to `true` if the development scheduler is enabled.
6276
6546
  *
6277
6547
  * The development scheduler is enabled in non-production, non-testing environments.
6548
+ *
6549
+ * @param nest - getter for the NestJS application context promise.
6550
+ * @returns An async decision function that resolves to `true` when the development scheduler is enabled.
6278
6551
  */ function nestAppHasDevelopmentSchedulerEnabled(nest) {
6279
6552
  return function() {
6280
6553
  return nest().then(function(x) {
@@ -6371,6 +6644,11 @@ exports.FirebaseServerFirestoreContextModule = __decorate([
6371
6644
  /**
6372
6645
  * Creates a NestJS provider that initializes a Firestore collections instance from the app's {@link FirestoreContext}.
6373
6646
  *
6647
+ * @param config - The provide token and factory function configuration.
6648
+ * @param config.provide - The class token to provide.
6649
+ * @param config.useFactory - Factory that creates the collections from a FirestoreContext.
6650
+ * @returns A tuple containing the configured NestJS provider.
6651
+ *
6374
6652
  * @example
6375
6653
  * ```typescript
6376
6654
  * const [provider] = provideAppFirestoreCollections({
@@ -6394,6 +6672,9 @@ exports.FirebaseServerFirestoreContextModule = __decorate([
6394
6672
  * Generates NestJS {@link ModuleMetadata} for an app's Firestore module, including the
6395
6673
  * {@link FirebaseServerFirestoreContextModule} import and the app's collections provider.
6396
6674
  *
6675
+ * @param config - The Firestore collections config plus optional additional module metadata.
6676
+ * @returns NestJS module metadata ready to be passed to the `@Module()` decorator.
6677
+ *
6397
6678
  * @example
6398
6679
  * ```typescript
6399
6680
  * @Module(appFirestoreModuleMetadata({
@@ -6703,6 +6984,7 @@ function _object_spread_props$4(target, source) {
6703
6984
  * @param makeNestContext - Factory that creates the typed context from the NestJS application context.
6704
6985
  * @returns A factory for creating nest-context-aware event function handlers.
6705
6986
  */ function cloudEventHandlerWithNestContextFactory(makeNestContext) {
6987
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- CloudEvent generic requires `any` for SDK compatibility
6706
6988
  return function(fn) {
6707
6989
  return function(nestAppPromiseGetter) {
6708
6990
  var handlerBuilder = function handlerBuilder(handler) {
@@ -7067,6 +7349,8 @@ function _ts_generator$5(thisArg, body) {
7067
7349
  /**
7068
7350
  * Default error logger that writes validation error details to the console.
7069
7351
  * Used when `logError` is `true` or omitted in the factory options.
7352
+ *
7353
+ * @param details - the validation error details to log.
7070
7354
  */ var defaultFirebaseServerActionsTransformFactoryLogErrorFunction = function defaultFirebaseServerActionsTransformFactoryLogErrorFunction(details) {
7071
7355
  console.log('firebaseServerActionsTransformFactory() encountered validation error: ', details);
7072
7356
  };
@@ -7692,7 +7976,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
7692
7976
  builder = (_builder1 = builder).exclude.apply(_builder1, _to_consumable_array$2(excludePatterns));
7693
7977
  }
7694
7978
  (_builder = builder).forRoutes.apply(_builder, _to_consumable_array$2(forRoutes));
7695
- this.logger.debug("Configured AppCheck middleware for routes: ".concat(forRoutes.join(', ')).concat(excludePatterns.length > 0 ? " (excluding: ".concat(excludePatterns.join(', '), ")") : ''));
7979
+ var excludeInfo = excludePatterns.length > 0 ? " (excluding: ".concat(excludePatterns.join(', '), ")") : '';
7980
+ this.logger.debug("Configured AppCheck middleware for routes: ".concat(forRoutes.join(', ')).concat(excludeInfo));
7696
7981
  }
7697
7982
  }
7698
7983
  ]);
@@ -8130,16 +8415,28 @@ function _ts_generator$2(thisArg, body) {
8130
8415
  }
8131
8416
  /**
8132
8417
  * Resolves a Google Cloud Storage {@link Bucket} from a {@link StoragePath}.
8418
+ *
8419
+ * @param storage - the Google Cloud Storage client instance.
8420
+ * @param path - the storage path containing the bucket ID.
8421
+ * @returns The resolved Google Cloud Storage bucket.
8133
8422
  */ function googleCloudStorageBucketForStorageFilePath(storage, path) {
8134
8423
  return storage.bucket(path.bucketId);
8135
8424
  }
8136
8425
  /**
8137
8426
  * Resolves a Google Cloud Storage {@link GoogleCloudFile} from a {@link StoragePath}.
8427
+ *
8428
+ * @param storage - the Google Cloud Storage client instance.
8429
+ * @param path - the storage path containing bucket ID and file path.
8430
+ * @returns The resolved Google Cloud Storage file reference.
8138
8431
  */ function googleCloudStorageFileForStorageFilePath(storage, path) {
8139
8432
  return googleCloudStorageBucketForStorageFilePath(storage, path).file(path.pathString);
8140
8433
  }
8141
8434
  /**
8142
8435
  * Converts Google Cloud Storage {@link FileMetadata} into the normalized {@link StorageMetadata} format.
8436
+ *
8437
+ * @param file - the Google Cloud Storage file reference.
8438
+ * @param metadata - the raw file metadata from the Google Cloud SDK.
8439
+ * @returns Normalized storage metadata.
8143
8440
  */ function googleCloudFileMetadataToStorageMetadata(file, metadata) {
8144
8441
  var _metadata_generation;
8145
8442
  var fullPath = file.name;
@@ -8170,6 +8467,10 @@ function _ts_generator$2(thisArg, body) {
8170
8467
  * and ACL operations for a single file in Google Cloud Storage.
8171
8468
  *
8172
8469
  * Handles emulator-specific edge cases (e.g., signing errors, atomic move fallback).
8470
+ *
8471
+ * @param storage - the Google Cloud Storage client instance.
8472
+ * @param storagePath - the storage path identifying the file's bucket and path.
8473
+ * @returns A file accessor with CRUD, streaming, and ACL operations.
8173
8474
  */ function googleCloudStorageAccessorFile(storage$1, storagePath) {
8174
8475
  var file = googleCloudStorageFileForStorageFilePath(storage$1, storagePath);
8175
8476
  function makeDownloadOptions(maxDownloadSizeBytes) {
@@ -8180,7 +8481,7 @@ function _ts_generator$2(thisArg, body) {
8180
8481
  }
8181
8482
  function _configureMetadata(options) {
8182
8483
  var _options_metadata, _options_metadata1, _options_metadata2, _options_metadata3, _options_metadata4, _options_metadata5;
8183
- var customMetadata = util.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));
8484
+ var customMetadata = util.filterUndefinedValues(_object_spread$1({}, (_options_metadata = options.metadata) === null || _options_metadata === void 0 ? void 0 : _options_metadata.customMetadata, options.customMetadata));
8184
8485
  return util.filterUndefinedValues({
8185
8486
  cacheControl: (_options_metadata1 = options.metadata) === null || _options_metadata1 === void 0 ? void 0 : _options_metadata1.cacheControl,
8186
8487
  contentDisposition: (_options_metadata2 = options.metadata) === null || _options_metadata2 === void 0 ? void 0 : _options_metadata2.contentDisposition,
@@ -8297,7 +8598,7 @@ function _ts_generator$2(thisArg, body) {
8297
8598
  return x[0];
8298
8599
  }).catch(function(e) {
8299
8600
  var publicUrlBackup;
8300
- if (e && e.name === 'SigningError' && (nestjs.isTestNodeEnv() || process.env.FIREBASE_STORAGE_EMULATOR_HOST)) {
8601
+ if (_instanceof(e, Error) && e.name === 'SigningError' && (nestjs.isTestNodeEnv() || process.env.FIREBASE_STORAGE_EMULATOR_HOST)) {
8301
8602
  // NOTE: Signing does not behave properly in the emulator as it is not supported.
8302
8603
  // https://github.com/firebase/firebase-tools/issues/3400
8303
8604
  // we can return the public url instead.
@@ -8440,7 +8741,7 @@ function _ts_generator$2(thisArg, body) {
8440
8741
  },
8441
8742
  copy: copy,
8442
8743
  delete: function _delete(options) {
8443
- return file.delete(options).then(function(x) {
8744
+ return file.delete(options).then(function() {
8444
8745
  return undefined;
8445
8746
  });
8446
8747
  },
@@ -8474,7 +8775,8 @@ function _ts_generator$2(thisArg, body) {
8474
8775
  }
8475
8776
  var googleCloudStorageListFilesResultFactory = firebase.storageListFilesResultFactory({
8476
8777
  hasItems: function hasItems(result) {
8477
- return Boolean(result.apiResponse.items || result.apiResponse.prefixes);
8778
+ var _result_apiResponse_items;
8779
+ return Boolean((_result_apiResponse_items = result.apiResponse.items) !== null && _result_apiResponse_items !== void 0 ? _result_apiResponse_items : result.apiResponse.prefixes);
8478
8780
  },
8479
8781
  hasNext: function hasNext(result) {
8480
8782
  return result.nextQuery != null;
@@ -8483,7 +8785,8 @@ var googleCloudStorageListFilesResultFactory = firebase.storageListFilesResultFa
8483
8785
  var _result_nextQuery;
8484
8786
  return (_result_nextQuery = result.nextQuery) === null || _result_nextQuery === void 0 ? void 0 : _result_nextQuery.pageToken;
8485
8787
  },
8486
- next: function next(storage, options, folder, result) {
8788
+ next: function next(param, result) {
8789
+ var options = param.options, folder = param.folder;
8487
8790
  return folder.list(_object_spread$1({}, options, result.nextQuery));
8488
8791
  },
8489
8792
  file: function file(storage, fileResult) {
@@ -8493,9 +8796,8 @@ var googleCloudStorageListFilesResultFactory = firebase.storageListFilesResultFa
8493
8796
  return googleCloudStorageAccessorFolder(storage, folderResult.storagePath);
8494
8797
  },
8495
8798
  filesFromResult: function filesFromResult(result) {
8496
- var _ref;
8497
- var _result_apiResponse;
8498
- var items = (_ref = (_result_apiResponse = result.apiResponse) === null || _result_apiResponse === void 0 ? void 0 : _result_apiResponse.items) !== null && _ref !== void 0 ? _ref : [];
8799
+ var _result_apiResponse_items;
8800
+ var items = (_result_apiResponse_items = result.apiResponse.items) !== null && _result_apiResponse_items !== void 0 ? _result_apiResponse_items : [];
8499
8801
  return items.map(function(x) {
8500
8802
  return {
8501
8803
  raw: x,
@@ -8508,9 +8810,8 @@ var googleCloudStorageListFilesResultFactory = firebase.storageListFilesResultFa
8508
8810
  });
8509
8811
  },
8510
8812
  foldersFromResult: function foldersFromResult(result, folder) {
8511
- var _ref;
8512
- var _result_apiResponse;
8513
- var items = (_ref = (_result_apiResponse = result.apiResponse) === null || _result_apiResponse === void 0 ? void 0 : _result_apiResponse.prefixes) !== null && _ref !== void 0 ? _ref : [];
8813
+ var _result_apiResponse_prefixes;
8814
+ var items = (_result_apiResponse_prefixes = result.apiResponse.prefixes) !== null && _result_apiResponse_prefixes !== void 0 ? _result_apiResponse_prefixes : [];
8514
8815
  return items.map(function(prefix) {
8515
8816
  return {
8516
8817
  raw: prefix,
@@ -8526,6 +8827,10 @@ var googleCloudStorageListFilesResultFactory = firebase.storageListFilesResultFa
8526
8827
  /**
8527
8828
  * Creates a {@link GoogleCloudStorageAccessorFolder} that supports checking folder existence
8528
8829
  * and listing files/subfolders with pagination.
8830
+ *
8831
+ * @param storage - the Google Cloud Storage client instance.
8832
+ * @param storagePath - the storage path identifying the folder's bucket and prefix.
8833
+ * @returns A folder accessor with existence checking and listing operations.
8529
8834
  */ function googleCloudStorageAccessorFolder(storage, storagePath) {
8530
8835
  var bucket = googleCloudStorageBucketForStorageFilePath(storage, storagePath);
8531
8836
  var file = bucket.file(storagePath.pathString);
@@ -8569,7 +8874,11 @@ var googleCloudStorageListFilesResultFactory = firebase.storageListFilesResultFa
8569
8874
  nextQuery: nextQuery,
8570
8875
  apiResponse: apiResponse
8571
8876
  };
8572
- return googleCloudStorageListFilesResultFactory(storage, folder, options, result);
8877
+ return googleCloudStorageListFilesResultFactory({
8878
+ storage: storage,
8879
+ folder: folder,
8880
+ options: options
8881
+ }, result);
8573
8882
  });
8574
8883
  }
8575
8884
  };
@@ -8578,6 +8887,8 @@ var googleCloudStorageListFilesResultFactory = firebase.storageListFilesResultFa
8578
8887
  /**
8579
8888
  * Creates a {@link FirebaseStorageAccessorDriver} for Google Cloud Storage (Admin SDK).
8580
8889
  *
8890
+ * @returns A server-side storage accessor driver for Google Cloud Storage.
8891
+ *
8581
8892
  * @example
8582
8893
  * ```typescript
8583
8894
  * const driver = googleCloudStorageFirebaseStorageAccessorDriver();
@@ -8599,6 +8910,8 @@ var googleCloudStorageListFilesResultFactory = firebase.storageListFilesResultFa
8599
8910
  *
8600
8911
  * Bundles the server-side storage accessor driver, identified as `@google-cloud/storage`.
8601
8912
  *
8913
+ * @returns A complete set of storage drivers for server-side usage.
8914
+ *
8602
8915
  * @example
8603
8916
  * ```typescript
8604
8917
  * const drivers = googleCloudFirebaseStorageDrivers();
@@ -8700,6 +9013,7 @@ function _define_property$3(obj, key, value) {
8700
9013
  * Storage wrapper and the raw Google Cloud Storage SDK.
8701
9014
  *
8702
9015
  * @param storage - The Firebase Admin Storage instance.
9016
+ * @returns The underlying Google Cloud Storage client.
8703
9017
  *
8704
9018
  * @example
8705
9019
  * ```typescript
@@ -8850,6 +9164,7 @@ exports.FirebaseServerStorageContextModule = __decorate([
8850
9164
  * Creates a NestJS provider that configures the default storage bucket ID.
8851
9165
  *
8852
9166
  * @param input - A bucket ID string or full factory config object.
9167
+ * @returns A NestJS provider for the storage context factory config token.
8853
9168
  * @throws Error if `defaultBucketId` is empty.
8854
9169
  *
8855
9170
  * @example
@@ -8870,6 +9185,8 @@ exports.FirebaseServerStorageContextModule = __decorate([
8870
9185
  }
8871
9186
  /**
8872
9187
  * Returns the default provider config that creates a standard {@link FirebaseServerStorageService}.
9188
+ *
9189
+ * @returns The default provider configuration for FirebaseServerStorageService.
8873
9190
  */ function defaultProvideFirebaseServerStorageServiceSimple() {
8874
9191
  return {
8875
9192
  provide: FirebaseServerStorageService,
@@ -8883,6 +9200,9 @@ exports.FirebaseServerStorageContextModule = __decorate([
8883
9200
  *
8884
9201
  * If the provider token differs from `FirebaseServerStorageService`, an alias provider is added
8885
9202
  * so the service can also be injected by the abstract type.
9203
+ *
9204
+ * @param provider - The storage service provider configuration.
9205
+ * @returns An array of NestJS providers for the storage service.
8886
9206
  */ function provideFirebaseServerStorageService(provider) {
8887
9207
  var _provider_inject;
8888
9208
  var providers = [
@@ -8904,13 +9224,17 @@ exports.FirebaseServerStorageContextModule = __decorate([
8904
9224
  * Generates NestJS {@link ModuleMetadata} for an app's storage module, including the
8905
9225
  * {@link FirebaseServerStorageContextModule} import and the storage service provider.
8906
9226
  *
9227
+ * @param config - Optional configuration including a custom service provider and additional module metadata.
9228
+ * @returns NestJS module metadata ready to be passed to the `@Module()` decorator.
9229
+ *
8907
9230
  * @example
8908
9231
  * ```typescript
8909
9232
  * @Module(firebaseServerStorageModuleMetadata())
8910
9233
  * export class AppStorageModule {}
8911
9234
  * ```
8912
9235
  */ function firebaseServerStorageModuleMetadata(config) {
8913
- var serviceProvider = config && config.serviceProvider ? config.serviceProvider : defaultProvideFirebaseServerStorageServiceSimple();
9236
+ var _ref;
9237
+ var serviceProvider = (_ref = config === null || config === void 0 ? void 0 : config.serviceProvider) !== null && _ref !== void 0 ? _ref : defaultProvideFirebaseServerStorageServiceSimple();
8914
9238
  var providers = provideFirebaseServerStorageService(serviceProvider);
8915
9239
  var tokensToExport = nestjs.injectionTokensFromProviders(providers);
8916
9240
  return nestjs.mergeModuleMetadata({
@@ -9168,6 +9492,9 @@ function _ts_generator$1(thisArg, body) {
9168
9492
  * times with the same app reuses the existing server. The factory wires up Firebase Admin,
9169
9493
  * environment config, storage, AppCheck middleware, and webhook routes based on the config.
9170
9494
  *
9495
+ * @param config - Configuration for the NestJS server instance including the root module, providers, and middleware options.
9496
+ * @returns A NestServerInstance that manages server lifecycle for the given module class.
9497
+ *
9171
9498
  * @example
9172
9499
  * ```typescript
9173
9500
  * const instance = nestServerInstance({ moduleClass: AppModule, appCheckEnabled: true });
@@ -9183,7 +9510,7 @@ function _ts_generator$1(thisArg, body) {
9183
9510
  var server = express();
9184
9511
  var createNestServer = function createNestServer(expressInstance) {
9185
9512
  return _async_to_generator$1(function() {
9186
- var _config_defaultStorageBucket, _buildNestServerRootModule, rootModule, globalApiRoutePrefixConfig, options, nestApp;
9513
+ var _config_defaultStorageBucket, _buildNestServerRootModule, rootModule, globalApiRoutePrefixConfig, options, nestApp, configured;
9187
9514
  return _ts_generator$1(this, function(_state) {
9188
9515
  switch(_state.label){
9189
9516
  case 0:
@@ -9213,7 +9540,10 @@ function _ts_generator$1(thisArg, body) {
9213
9540
  nestApp = nestApp.setGlobalPrefix(globalApiRoutePrefixConfig.globalApiRoutePrefix, globalApiRoutePrefixConfig);
9214
9541
  }
9215
9542
  if (configureNestServerInstance) {
9216
- nestApp = configureNestServerInstance(nestApp) || nestApp;
9543
+ configured = configureNestServerInstance(nestApp);
9544
+ if (configured) {
9545
+ nestApp = configured;
9546
+ }
9217
9547
  }
9218
9548
  return [
9219
9549
  2,
@@ -9490,14 +9820,21 @@ function _ts_generator(thisArg, body) {
9490
9820
  {
9491
9821
  key: "nest",
9492
9822
  get: /**
9823
+ * Returns the NestJS application context.
9824
+ *
9493
9825
  * @deprecated use nestApplication instead.
9826
+ * @returns The NestJS application context.
9494
9827
  */ function get() {
9495
9828
  return this._nestApplication;
9496
9829
  }
9497
9830
  },
9498
9831
  {
9499
9832
  key: "nestApplication",
9500
- get: function get() {
9833
+ get: /**
9834
+ * Returns the NestJS application context.
9835
+ *
9836
+ * @returns The NestJS application context.
9837
+ */ function get() {
9501
9838
  return this._nestApplication;
9502
9839
  }
9503
9840
  }
@@ -9508,7 +9845,8 @@ function _ts_generator(thisArg, body) {
9508
9845
  * Abstract class used for the top-level NestJS context for Firebase services.
9509
9846
  *
9510
9847
  * Your API implementation of this class is usually <AppPrefix>ApiNestContext (e.g. `DemoApiNestContext`).
9511
- */ var AbstractFirebaseNestContext = /*#__PURE__*/ function(AbstractNestContext) {
9848
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- FirebaseModelsService generic requires `any` for SDK compatibility
9849
+ var AbstractFirebaseNestContext = /*#__PURE__*/ function(AbstractNestContext) {
9512
9850
  _inherits(AbstractFirebaseNestContext, AbstractNestContext);
9513
9851
  function AbstractFirebaseNestContext() {
9514
9852
  _class_call_check$1(this, AbstractFirebaseNestContext);
@@ -9531,13 +9869,13 @@ function _ts_generator(thisArg, body) {
9531
9869
  {
9532
9870
  key: "envService",
9533
9871
  get: function get() {
9534
- return this.nest.get(FirebaseServerEnvService);
9872
+ return this.nestApplication.get(FirebaseServerEnvService);
9535
9873
  }
9536
9874
  },
9537
9875
  {
9538
9876
  key: "storageService",
9539
9877
  get: function get() {
9540
- return this.nest.get(FirebaseServerStorageService);
9878
+ return this.nestApplication.get(FirebaseServerStorageService);
9541
9879
  }
9542
9880
  },
9543
9881
  {
@@ -9548,6 +9886,7 @@ function _ts_generator(thisArg, body) {
9548
9886
  *
9549
9887
  * @param auth - The request's auth data reference.
9550
9888
  * @param buildFn - Optional builder to customize the context.
9889
+ * @returns A model context with auth, app, and error factories.
9551
9890
  */ key: "makeModelContext",
9552
9891
  value: function makeModelContext(auth, buildFn) {
9553
9892
  var base = {
@@ -9569,6 +9908,7 @@ function _ts_generator(thisArg, body) {
9569
9908
  *
9570
9909
  * @param context - The request's auth data reference.
9571
9910
  * @param buildFn - Optional builder to customize the model context.
9911
+ * @returns An in-context models service scoped to the given auth context.
9572
9912
  */ key: "model",
9573
9913
  value: function model(context, buildFn) {
9574
9914
  var firebaseModelContext = this.makeModelContext(context, buildFn);
@@ -9577,7 +9917,8 @@ function _ts_generator(thisArg, body) {
9577
9917
  },
9578
9918
  {
9579
9919
  key: "useModel",
9580
- value: function useModel(type, select) {
9920
+ value: // eslint-disable-next-line @typescript-eslint/no-explicit-any -- implementation signature uses `any` to unify overload return types
9921
+ function useModel(type, select) {
9581
9922
  return _async_to_generator(function() {
9582
9923
  var _select_use, context, usePromise, use;
9583
9924
  return _ts_generator(this, function(_state) {
@@ -9639,7 +9980,8 @@ function _define_property(obj, key, value) {
9639
9980
  * Abstract class used for the top-level server NestJS context for server-only services.
9640
9981
  *
9641
9982
  * Your API implementation of this class is usually <AppPrefix>ApiServerNestContext (e.g. `DemoApiServerNestContext`).
9642
- */ var AbstractServerFirebaseNestContext = /*#__PURE__*/ function() {
9983
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- generic type parameters require `any` for Firebase SDK compatibility
9984
+ var AbstractServerFirebaseNestContext = /*#__PURE__*/ function() {
9643
9985
  function AbstractServerFirebaseNestContext(c) {
9644
9986
  _class_call_check(this, AbstractServerFirebaseNestContext);
9645
9987
  _define_property(this, "_context", void 0);
@@ -9655,7 +9997,7 @@ function _define_property(obj, key, value) {
9655
9997
  {
9656
9998
  key: "nest",
9657
9999
  get: function get() {
9658
- return this.context.nest;
10000
+ return this.context.nestApplication;
9659
10001
  }
9660
10002
  }
9661
10003
  ]);