@dereekb/firebase-server 13.12.3 → 13.12.5

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.
package/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { timingSafeEqual } from 'node:crypto';
2
- import { DBX_FIREBASE_SERVER_NO_AUTH_ERROR_CODE, UNAUTHENTICATED_ERROR_CODE, FORBIDDEN_ERROR_CODE, PERMISSION_DENIED_ERROR_CODE, NOT_FOUND_ERROR_CODE, MODEL_NOT_AVAILABLE_ERROR_CODE, BAD_REQUEST_ERROR_CODE, CONFLICT_ERROR_CODE, ALREADY_EXISTS_ERROR_CODE, UNAVAILABLE_ERROR_CODE, UNAVAILABLE_OR_DEACTIVATED_FUNCTION_ERROR_CODE, INTERNAL_SERVER_ERROR_CODE, FIREBASE_AUTH_USER_NOT_FOUND_ERROR, FIREBASE_SERVER_AUTH_CLAIMS_RESET_PASSWORD_KEY, FIREBASE_SERVER_AUTH_CLAIMS_RESET_LAST_COM_DATE_KEY, FIREBASE_SERVER_AUTH_CLAIMS_RESET_EXPIRES_AT_KEY, FIREBASE_SERVER_AUTH_CLAIMS_SETUP_PASSWORD_KEY, FIREBASE_AUTH_PHONE_NUMBER_ALREADY_EXISTS_ERROR, FIREBASE_AUTH_EMAIL_ALREADY_EXISTS_ERROR, FIREBASE_AUTH_INVALID_PHONE_NUMBER_ERROR, FIREBASE_SERVER_AUTH_CLAIMS_SETUP_LAST_COM_DATE_KEY, setIdAndKeyFromKeyIdRefOnDocumentData, DBX_FIREBASE_SERVER_PASSWORD_RESET_INVALID_CODE_ERROR_CODE, DBX_FIREBASE_SERVER_PASSWORD_RESET_NO_CONFIG_ERROR_CODE, DBX_FIREBASE_SERVER_PASSWORD_RESET_SEND_ONCE_ERROR_CODE, DBX_FIREBASE_SERVER_PASSWORD_RESET_THROTTLE_ERROR_CODE, FirestoreDocumentContextType, streamFromOnSnapshot, FIRESTORE_LIMIT_QUERY_CONSTRAINT_TYPE, FIRESTORE_LIMIT_TO_LAST_QUERY_CONSTRAINT_TYPE, FIRESTORE_ORDER_BY_QUERY_CONSTRAINT_TYPE, FIRESTORE_ORDER_BY_DOCUMENT_ID_QUERY_CONSTRAINT_TYPE, FIRESTORE_WHERE_QUERY_CONSTRAINT_TYPE, FIRESTORE_WHERE_DOCUMENT_ID_QUERY_CONSTRAINT_TYPE, FIRESTORE_OFFSET_QUERY_CONSTRAINT_TYPE, FIRESTORE_START_AT_QUERY_CONSTRAINT_TYPE, FIRESTORE_START_AT_VALUE_QUERY_CONSTRAINT_TYPE, FIRESTORE_START_AFTER_QUERY_CONSTRAINT_TYPE, FIRESTORE_END_AT_QUERY_CONSTRAINT_TYPE, FIRESTORE_END_AT_VALUE_QUERY_CONSTRAINT_TYPE, FIRESTORE_END_BEFORE_QUERY_CONSTRAINT_TYPE, makeFirestoreQueryConstraintFunctionsDriver, firestoreContextFactory, firestoreField, optionalFirestoreField, DEFAULT_MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER, UNKNOWN_MODEL_TYPE_ERROR_CODE, BAD_DOCUMENT_QUERY_CURSOR_ERROR_CODE, limit, startAfter, DEFAULT_ON_CALL_QUERY_MODEL_LIMIT, MAX_ON_CALL_QUERY_MODEL_LIMIT, ScheduledFunctionDevelopmentFunctionTypeEnum, SCHEDULED_FUNCTION_DEV_FUNCTION_SPECIFIER, storageListFilesResultFactory, assertStorageUploadOptionsStringFormat, firebaseStorageContextFactory, inContextFirebaseModelsServiceFactory, useFirebaseModelsService } from '@dereekb/firebase';
2
+ import { DBX_FIREBASE_SERVER_NO_AUTH_ERROR_CODE, UNAUTHENTICATED_ERROR_CODE, FORBIDDEN_ERROR_CODE, PERMISSION_DENIED_ERROR_CODE, NOT_FOUND_ERROR_CODE, MODEL_NOT_AVAILABLE_ERROR_CODE, BAD_REQUEST_ERROR_CODE, CONFLICT_ERROR_CODE, ALREADY_EXISTS_ERROR_CODE, UNAVAILABLE_ERROR_CODE, UNAVAILABLE_OR_DEACTIVATED_FUNCTION_ERROR_CODE, INTERNAL_SERVER_ERROR_CODE, FIREBASE_AUTH_USER_NOT_FOUND_ERROR, FIREBASE_SERVER_AUTH_CLAIMS_RESET_PASSWORD_KEY, FIREBASE_SERVER_AUTH_CLAIMS_RESET_LAST_COM_DATE_KEY, FIREBASE_SERVER_AUTH_CLAIMS_RESET_EXPIRES_AT_KEY, FIREBASE_AUTH_PHONE_NUMBER_ALREADY_EXISTS_ERROR, FIREBASE_AUTH_EMAIL_ALREADY_EXISTS_ERROR, FIREBASE_AUTH_INVALID_PHONE_NUMBER_ERROR, FIREBASE_SERVER_AUTH_CLAIMS_SETUP_PASSWORD_KEY, FIREBASE_SERVER_AUTH_CLAIMS_SETUP_LAST_COM_DATE_KEY, setIdAndKeyFromKeyIdRefOnDocumentData, DBX_FIREBASE_SERVER_PASSWORD_RESET_INVALID_CODE_ERROR_CODE, DBX_FIREBASE_SERVER_PASSWORD_RESET_NO_CONFIG_ERROR_CODE, DBX_FIREBASE_SERVER_PASSWORD_RESET_SEND_ONCE_ERROR_CODE, DBX_FIREBASE_SERVER_PASSWORD_RESET_THROTTLE_ERROR_CODE, FirestoreDocumentContextType, streamFromOnSnapshot, FIRESTORE_LIMIT_QUERY_CONSTRAINT_TYPE, FIRESTORE_LIMIT_TO_LAST_QUERY_CONSTRAINT_TYPE, FIRESTORE_ORDER_BY_QUERY_CONSTRAINT_TYPE, FIRESTORE_ORDER_BY_DOCUMENT_ID_QUERY_CONSTRAINT_TYPE, FIRESTORE_WHERE_QUERY_CONSTRAINT_TYPE, FIRESTORE_WHERE_DOCUMENT_ID_QUERY_CONSTRAINT_TYPE, FIRESTORE_OFFSET_QUERY_CONSTRAINT_TYPE, FIRESTORE_START_AT_QUERY_CONSTRAINT_TYPE, FIRESTORE_START_AT_VALUE_QUERY_CONSTRAINT_TYPE, FIRESTORE_START_AFTER_QUERY_CONSTRAINT_TYPE, FIRESTORE_END_AT_QUERY_CONSTRAINT_TYPE, FIRESTORE_END_AT_VALUE_QUERY_CONSTRAINT_TYPE, FIRESTORE_END_BEFORE_QUERY_CONSTRAINT_TYPE, makeFirestoreQueryConstraintFunctionsDriver, firestoreContextFactory, firestoreField, optionalFirestoreField, DEFAULT_MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER, UNKNOWN_MODEL_TYPE_ERROR_CODE, BAD_DOCUMENT_QUERY_CURSOR_ERROR_CODE, limit, startAfter, DEFAULT_ON_CALL_QUERY_MODEL_LIMIT, MAX_ON_CALL_QUERY_MODEL_LIMIT, ScheduledFunctionDevelopmentFunctionTypeEnum, SCHEDULED_FUNCTION_DEV_FUNCTION_SPECIFIER, storageListFilesResultFactory, assertStorageUploadOptionsStringFormat, firebaseStorageContextFactory, inContextFirebaseModelsServiceFactory, useFirebaseModelsService } from '@dereekb/firebase';
3
3
  import { partialServerError, isServerError, randomNumberFactory, cachedGetter, filterNullAndUndefinedValues, asSet, AUTH_ADMIN_ROLE, AUTH_TOS_SIGNED_ROLE, forEachKeyValue, KeyValueTypleValueFilter, filterUndefinedValues, isThrottled, mapObjectMap, batch, objectToMap, serverError, asArray, containsAllValues, websiteUrlDetails, mergeObjects, cronExpressionRepeatingEveryNMinutes, mapIdentityFunction, slashPathName, toRelativeSlashPathStartType, fixMultiSlashesInSlashPath, SLASH_PATH_SEPARATOR, objectHasNoKeys, websiteUrlFromPaths, pushItemOrArrayItemsIntoArray, makeGetter, asGetter, build, performAsyncTasks } from '@dereekb/util';
4
4
  import { HttpsError } from 'firebase-functions/https';
5
5
  import { hoursToMs, minutesToMs, toISODateString } from '@dereekb/date';
@@ -263,6 +263,12 @@ function _type_of$7(obj) {
263
263
  *
264
264
  * @param input - The value to check.
265
265
  * @returns `true` if the input is a Firebase {@link HttpsError}.
266
+ *
267
+ * @dbxUtil
268
+ * @dbxUtilCategory firebase-error
269
+ * @dbxUtilKind function
270
+ * @dbxUtilTags firebase, https, error, type-guard, server, callable
271
+ * @dbxUtilRelated is-firebase-error, firebase-server-error-info
266
272
  */ function isFirebaseHttpsError(input) {
267
273
  return (typeof input === "undefined" ? "undefined" : _type_of$7(input)) === 'object' && input != null && 'code' in input && 'httpErrorCode' in input && 'toJSON' in input;
268
274
  }
@@ -271,6 +277,12 @@ function _type_of$7(obj) {
271
277
  *
272
278
  * @param input - The value to check.
273
279
  * @returns `true` if the input is a Firebase Admin {@link admin.FirebaseError}.
280
+ *
281
+ * @dbxUtil
282
+ * @dbxUtilCategory firebase-error
283
+ * @dbxUtilKind function
284
+ * @dbxUtilTags firebase, admin, error, type-guard, server
285
+ * @dbxUtilRelated is-firebase-https-error, firebase-server-error-info
274
286
  */ function isFirebaseError(input) {
275
287
  return (typeof input === "undefined" ? "undefined" : _type_of$7(input)) === 'object' && input != null && 'code' in input && 'message' in input && 'toJSON' in input;
276
288
  }
@@ -283,6 +295,12 @@ function _type_of$7(obj) {
283
295
  * @param e - The caught error to analyze.
284
296
  * @returns Structured {@link FirebaseServerErrorInfo} with classified error details.
285
297
  *
298
+ * @dbxUtil
299
+ * @dbxUtilCategory firebase-error
300
+ * @dbxUtilKind function
301
+ * @dbxUtilTags firebase, error, decode, analyze, https, admin, server, classify, server-error
302
+ * @dbxUtilRelated firebase-server-error-info-code-pair, firebase-server-error-info-server-error-pair, firebase-server-error-info-server-error-code-pair, is-firebase-https-error, is-firebase-error
303
+ *
286
304
  * @example
287
305
  * ```typescript
288
306
  * try {
@@ -329,6 +347,12 @@ function _type_of$7(obj) {
329
347
  *
330
348
  * @param e - The caught error to analyze.
331
349
  * @returns A tuple of the Firebase error code (if present) and the full error info.
350
+ *
351
+ * @dbxUtil
352
+ * @dbxUtilCategory firebase-error
353
+ * @dbxUtilKind function
354
+ * @dbxUtilTags firebase, error, code, pair, tuple, pattern-match, decode
355
+ * @dbxUtilRelated firebase-server-error-info, firebase-server-error-info-server-error-pair, firebase-server-error-info-server-error-code-pair
332
356
  */ function firebaseServerErrorInfoCodePair(e) {
333
357
  var info = firebaseServerErrorInfo(e);
334
358
  return [
@@ -341,6 +365,12 @@ function _type_of$7(obj) {
341
365
  *
342
366
  * @param e - The caught error to analyze.
343
367
  * @returns A tuple of the server error (if present) and the full error info.
368
+ *
369
+ * @dbxUtil
370
+ * @dbxUtilCategory firebase-error
371
+ * @dbxUtilKind function
372
+ * @dbxUtilTags firebase, error, server-error, pair, tuple, pattern-match, decode, details
373
+ * @dbxUtilRelated firebase-server-error-info, firebase-server-error-info-code-pair, firebase-server-error-info-server-error-code-pair
344
374
  */ function firebaseServerErrorInfoServerErrorPair(e) {
345
375
  var info = firebaseServerErrorInfo(e);
346
376
  return [
@@ -353,6 +383,12 @@ function _type_of$7(obj) {
353
383
  *
354
384
  * @param e - The caught error to analyze.
355
385
  * @returns A tuple of the server error code (if present) and the full error info.
386
+ *
387
+ * @dbxUtil
388
+ * @dbxUtilCategory firebase-error
389
+ * @dbxUtilKind function
390
+ * @dbxUtilTags firebase, error, server-error, code, string-code, pair, tuple, pattern-match, decode
391
+ * @dbxUtilRelated firebase-server-error-info, firebase-server-error-info-code-pair, firebase-server-error-info-server-error-pair
356
392
  */ function firebaseServerErrorInfoServerErrorCodePair(e) {
357
393
  var info = firebaseServerErrorInfo(e);
358
394
  return [
@@ -367,6 +403,12 @@ function _type_of$7(obj) {
367
403
  *
368
404
  * @param e - The caught error.
369
405
  * @param handleFirebaseErrorFn - Handler that receives the typed {@link admin.FirebaseError}.
406
+ *
407
+ * @dbxUtil
408
+ * @dbxUtilCategory firebase-error
409
+ * @dbxUtilKind function
410
+ * @dbxUtilTags firebase, admin, error, handler, catch, conditional, rethrow
411
+ * @dbxUtilRelated is-firebase-error, firebase-server-error-info
370
412
  */ function handleFirebaseError(e, handleFirebaseErrorFn) {
371
413
  var firebaseError = e.code ? e : undefined;
372
414
  if (firebaseError) {
@@ -1254,15 +1296,6 @@ function _ts_generator$g(thisArg, body) {
1254
1296
  this.updateClaims(passwordClaimsData)
1255
1297
  ];
1256
1298
  case 1:
1257
- _state.sent();
1258
- // update the user
1259
- return [
1260
- 4,
1261
- this.updateUser({
1262
- password: password
1263
- })
1264
- ];
1265
- case 2:
1266
1299
  _state.sent();
1267
1300
  return [
1268
1301
  2,
@@ -1344,11 +1377,43 @@ function _ts_generator$g(thisArg, body) {
1344
1377
  key: "updateUser",
1345
1378
  value: function updateUser(template) {
1346
1379
  return _async_to_generator$g(function() {
1380
+ var e, firebaseError, errorCode, email, phoneNumber;
1347
1381
  return _ts_generator$g(this, function(_state) {
1348
- return [
1349
- 2,
1350
- this.service.auth.updateUser(this.uid, template)
1351
- ];
1382
+ switch(_state.label){
1383
+ case 0:
1384
+ _state.trys.push([
1385
+ 0,
1386
+ 2,
1387
+ ,
1388
+ 3
1389
+ ]);
1390
+ return [
1391
+ 4,
1392
+ this.service.auth.updateUser(this.uid, template)
1393
+ ];
1394
+ case 1:
1395
+ return [
1396
+ 2,
1397
+ _state.sent()
1398
+ ];
1399
+ case 2:
1400
+ e = _state.sent();
1401
+ firebaseError = e;
1402
+ errorCode = firebaseError.code;
1403
+ email = template.email, phoneNumber = template.phoneNumber;
1404
+ if (errorCode === FIREBASE_AUTH_PHONE_NUMBER_ALREADY_EXISTS_ERROR && phoneNumber) {
1405
+ throw new FirebaseServerAuthUserExistsError(errorCode, 'phone', phoneNumber);
1406
+ } else if (errorCode === FIREBASE_AUTH_EMAIL_ALREADY_EXISTS_ERROR && email) {
1407
+ throw new FirebaseServerAuthUserExistsError(errorCode, 'email', email);
1408
+ } else if (errorCode === FIREBASE_AUTH_INVALID_PHONE_NUMBER_ERROR && phoneNumber) {
1409
+ throw new FirebaseServerAuthUserBadInputError(errorCode, phoneNumber);
1410
+ }
1411
+ throw e;
1412
+ case 3:
1413
+ return [
1414
+ 2
1415
+ ];
1416
+ }
1352
1417
  });
1353
1418
  }).call(this);
1354
1419
  }
@@ -2121,6 +2186,50 @@ function _ts_generator$g(thisArg, body) {
2121
2186
  ]);
2122
2187
  return NoSetupContentFirebaseServerNewUserService;
2123
2188
  }(AbstractFirebaseServerNewUserService);
2189
+ /**
2190
+ * Builds the composite oob code from a raw reset code (the numeric value stored in
2191
+ * {@link FirebaseServerAuthResetUserPasswordClaims.resetPassword}) and the target user's uid.
2192
+ *
2193
+ * @param uid - The target user's UID.
2194
+ * @param code - The raw reset code from the user's claims.
2195
+ *
2196
+ * @example
2197
+ * ```typescript
2198
+ * const oobCode = encodeFirebaseServerUserPasswordResetOobCode(user.uid, claims.resetPassword);
2199
+ * // e.g. '482910-abcDEF123'
2200
+ * ```
2201
+ */ function encodeFirebaseServerUserPasswordResetOobCode(uid, code) {
2202
+ return "".concat(code, "-").concat(uid);
2203
+ }
2204
+ /**
2205
+ * Decodes a composite oob code back into its `{ uid, code }` parts. Returns `undefined`
2206
+ * when the token is malformed (missing separator, non-numeric code, empty uid).
2207
+ *
2208
+ * @param token - The composite oob token, typically received from the password-reset email.
2209
+ *
2210
+ * @example
2211
+ * ```typescript
2212
+ * const decoded = decodeFirebaseServerUserPasswordResetOobCode('482910-abcDEF123');
2213
+ * // decoded = { uid: 'abcDEF123', code: '482910' }
2214
+ * ```
2215
+ */ function decodeFirebaseServerUserPasswordResetOobCode(token) {
2216
+ var result;
2217
+ if (typeof token === 'string') {
2218
+ var dashIndex = token.indexOf('-');
2219
+ if (dashIndex > 0 && dashIndex < token.length - 1) {
2220
+ var code = token.slice(0, dashIndex);
2221
+ var uid = token.slice(dashIndex + 1);
2222
+ // Code must be purely digits (matches DEFAULT_FIREBASE_PASSWORD_NUMBER_GENERATOR output).
2223
+ if (/^\d+$/.test(code)) {
2224
+ result = {
2225
+ uid: uid,
2226
+ code: code
2227
+ };
2228
+ }
2229
+ }
2230
+ }
2231
+ return result;
2232
+ }
2124
2233
  /**
2125
2234
  * Default throttle duration (60 seconds) between reset content re-sends to prevent spam while
2126
2235
  * remaining responsive for legitimate users who didn't receive the first email.
@@ -2169,7 +2278,7 @@ function _ts_generator$g(thisArg, body) {
2169
2278
  key: "beginPasswordReset",
2170
2279
  value: function beginPasswordReset(input) {
2171
2280
  return _async_to_generator$g(function() {
2172
- var uid, email, sendResetContent, sendResetDetailsOnce, sendResetIgnoreThrottle, sendResetThrowErrors, data, sendDetailsInTestEnvironment, resolvedUid, userRecord, userContext, claims;
2281
+ var uid, email, sendResetContent, sendResetDetailsOnce, sendResetIgnoreThrottle, sendResetThrowErrors, data, sendDetailsInTestEnvironment, resolvedUid, userRecord, userContext, claims, oobCode;
2173
2282
  return _ts_generator$g(this, function(_state) {
2174
2283
  switch(_state.label){
2175
2284
  case 0:
@@ -2230,9 +2339,13 @@ function _ts_generator$g(thisArg, body) {
2230
2339
  _state.sent();
2231
2340
  _state.label = 7;
2232
2341
  case 7:
2342
+ oobCode = encodeFirebaseServerUserPasswordResetOobCode(resolvedUid, claims.resetPassword);
2233
2343
  return [
2234
2344
  2,
2235
- claims
2345
+ {
2346
+ claims: claims,
2347
+ oobCode: oobCode
2348
+ }
2236
2349
  ];
2237
2350
  }
2238
2351
  });
@@ -2378,6 +2491,7 @@ function _ts_generator$g(thisArg, body) {
2378
2491
  resetCommunicationAt: claims.resetCommunicationAt,
2379
2492
  resetExpiresAt: claims.resetExpiresAt
2380
2493
  },
2494
+ oobCode: encodeFirebaseServerUserPasswordResetOobCode(userContext.uid, claims.resetPassword),
2381
2495
  data: config === null || config === void 0 ? void 0 : config.data,
2382
2496
  sendDetailsInTestEnvironment: config === null || config === void 0 ? void 0 : config.sendDetailsInTestEnvironment
2383
2497
  };
@@ -2420,30 +2534,56 @@ function _ts_generator$g(thisArg, body) {
2420
2534
  },
2421
2535
  {
2422
2536
  key: "completePasswordReset",
2423
- value: function completePasswordReset(uid, input) {
2537
+ value: function completePasswordReset(input) {
2424
2538
  return _async_to_generator$g(function() {
2425
- var userContext, claims, storedCode, expiresAt, storedBuf, inputBuf;
2539
+ var decoded, userContext, claims, storedCode, expiresAt, storedBuf, inputBuf;
2426
2540
  return _ts_generator$g(this, function(_state) {
2427
2541
  switch(_state.label){
2428
2542
  case 0:
2429
- userContext = this.authService.userContext(uid);
2543
+ // Decode the composite token. A malformed token is treated identically to every other
2544
+ // failure mode below — the caller cannot distinguish between "bad encoding", "unknown uid",
2545
+ // "no active reset", "expired", or "wrong code".
2546
+ decoded = decodeFirebaseServerUserPasswordResetOobCode(input.oobCode);
2547
+ if (!decoded) {
2548
+ throw new FirebaseServerAuthPasswordResetInvalidCodeError();
2549
+ }
2550
+ userContext = this.authService.userContext(decoded.uid);
2551
+ _state.label = 1;
2552
+ case 1:
2553
+ _state.trys.push([
2554
+ 1,
2555
+ 3,
2556
+ ,
2557
+ 4
2558
+ ]);
2430
2559
  return [
2431
2560
  4,
2432
2561
  userContext.loadResetPasswordClaims()
2433
2562
  ];
2434
- case 1:
2563
+ case 2:
2435
2564
  claims = _state.sent();
2565
+ return [
2566
+ 3,
2567
+ 4
2568
+ ];
2569
+ case 3:
2570
+ _state.sent();
2571
+ claims = undefined;
2572
+ return [
2573
+ 3,
2574
+ 4
2575
+ ];
2576
+ case 4:
2436
2577
  storedCode = claims === null || claims === void 0 ? void 0 : claims.resetPassword;
2437
2578
  expiresAt = claims === null || claims === void 0 ? void 0 : claims.resetExpiresAt;
2438
2579
  // Reject if no active reset OR the stored code is missing/wrong length OR the code is expired.
2439
- // All failure cases throw the same opaque error so callers cannot distinguish them.
2440
- if (!storedCode || !expiresAt || storedCode.length !== input.resetPassword.length || new Date(expiresAt).getTime() <= Date.now()) {
2580
+ if (!storedCode || !expiresAt || storedCode.length !== decoded.code.length || new Date(expiresAt).getTime() <= Date.now()) {
2441
2581
  throw new FirebaseServerAuthPasswordResetInvalidCodeError();
2442
2582
  }
2443
2583
  // Constant-time comparison to avoid leaking timing information about how many leading
2444
2584
  // characters of the provided code matched. Lengths are equal per the guard above.
2445
2585
  storedBuf = Buffer.from(storedCode);
2446
- inputBuf = Buffer.from(input.resetPassword);
2586
+ inputBuf = Buffer.from(decoded.code);
2447
2587
  if (!timingSafeEqual(storedBuf, inputBuf)) {
2448
2588
  throw new FirebaseServerAuthPasswordResetInvalidCodeError();
2449
2589
  }
@@ -12914,4 +13054,4 @@ function _define_property(obj, key, value) {
12914
13054
  }
12915
13055
  ();
12916
13056
 
12917
- export { AbstractFirebaseNestContext, AbstractFirebaseServerActionsContext, AbstractFirebaseServerAuthContext, AbstractFirebaseServerAuthService, AbstractFirebaseServerAuthUserContext, AbstractFirebaseServerNewUserService, AbstractFirebaseServerUserPasswordResetService, AbstractNestContext, AbstractServerFirebaseNestContext, ConfigureFirebaseAppCheckMiddlewareModule, ConfigureFirebaseWebhookMiddlewareModule, DEFAULT_FIREBASE_PASSWORD_NUMBER_GENERATOR, DEFAULT_RESET_CODE_EXPIRES_IN, DEFAULT_RESET_COM_THROTTLE_TIME, DEFAULT_SERVER_ASSETS_BASE_PATH, DEFAULT_SETUP_COM_THROTTLE_TIME, DefaultFirebaseServerEnvService, FIREBASE_APP_TOKEN, FIREBASE_AUTH_TOKEN, FIREBASE_FIRESTORE_CONTEXT_TOKEN, FIREBASE_FIRESTORE_TOKEN, FIREBASE_SERVER_ENV_TOKEN, FIREBASE_SERVER_VALIDATION_ERROR_CODE, FIREBASE_STORAGE_CONTEXT_FACTORY_CONFIG_TOKEN, FIREBASE_STORAGE_CONTEXT_TOKEN, FIREBASE_STORAGE_TOKEN, FIRESTORE_CLIENT_QUERY_CONSTRAINT_HANDLER_MAPPING, FirebaseAppCheckMiddleware, FirebaseAppCheckMiddlewareConfig, FirebaseNestServerRootModule, FirebaseRawBodyMiddleware, FirebaseServerAnalyticsSegmentListenerService, FirebaseServerAnalyticsSegmentModule, FirebaseServerAnalyticsService, FirebaseServerAnalyticsServiceListener, FirebaseServerAuthModule, FirebaseServerAuthNewUserSendSetupDetailsNoSetupConfigError, FirebaseServerAuthNewUserSendSetupDetailsSendOnceError, FirebaseServerAuthNewUserSendSetupDetailsThrottleError, FirebaseServerAuthPasswordResetInvalidCodeError, FirebaseServerAuthPasswordResetNoResetConfigError, FirebaseServerAuthPasswordResetSendOnceError, FirebaseServerAuthPasswordResetThrottleError, FirebaseServerAuthService, FirebaseServerAuthUserBadInputError, FirebaseServerAuthUserExistsError, FirebaseServerEnvService, FirebaseServerFirestoreContextModule, FirebaseServerFirestoreModule, FirebaseServerStorageContextModule, FirebaseServerStorageModule, FirebaseServerStorageService, GlobalRoutePrefixConfig, MAX_MODEL_ACCESS_MULTI_READ_KEYS, MODEL_API_NEST_APPLICATION_CONTEXT, ModelApiCallModelDispatchService, ModelApiController, ModelApiDispatchConfig, ModelApiGetService, NO_RUN_NAME_SPECIFIED_FOR_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_CODE, NoContentFirebaseServerUserPasswordResetService, NoSetupContentFirebaseServerNewUserService, ON_CALL_MODEL_ANALYTICS_HANDLER, ON_CALL_MODEL_ANALYTICS_SERVICE, OnCallModelAnalyticsService, PHONE_NUMBER_ALREADY_EXISTS_ERROR_CODE, SkipAppCheck, UNKNOWN_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_NAME_CODE, UNKNOWN_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_TYPE_CODE, _onCallWithCallTypeFunction, aggregateCrudModelApiDetails, aggregateModelApiDetails, aggregateSpecifierApiDetails, alreadyExistsError, appAnalyticsModuleMetadata, appFirestoreModuleMetadata, assertContextHasAuth, assertDocumentExists, assertHasRolesInRequest, assertHasSignedTosInRequest, assertIsAdminInRequest, assertIsAdminOrTargetUserInRequestData, assertIsContextWithAuthData, assertRequestRequiresAuthForFunction, assertSnapshotData, assertSnapshotDataWithKey, authServicePasswordResetInvalidCodeError, authServicePasswordResetNoConfigError, authServicePasswordResetSendOnceError, authServicePasswordResetThrottleError, badRequestError, blockingFunctionHandlerWithNestContextFactory, buildNestServerRootModule, callWithAnalytics, catchAndThrowPasswordResetServerErrors, cloudEventHandlerWithNestContextFactory, collectionRefForPath, createModelUnknownModelTypeError, defaultFirebaseServerActionsTransformFactoryLogErrorFunction, defaultProvideFirebaseServerStorageServiceSimple, deleteModelUnknownModelTypeError, developmentUnknownSpecifierError, docRefForPath, documentModelNotAvailableError, executeOnCallQuery, firebaseAuthTokenFromDecodedIdToken, firebaseServerActionsContext, firebaseServerActionsTransformContext, firebaseServerActionsTransformFactory, firebaseServerAppTokenProvider, firebaseServerAuthModuleMetadata, firebaseServerDevFunctions, firebaseServerEnvTokenProvider, firebaseServerEnvTokenProviders, firebaseServerErrorInfo, firebaseServerErrorInfoCodePair, firebaseServerErrorInfoServerErrorCodePair, firebaseServerErrorInfoServerErrorPair, firebaseServerFirestoreContextModuleMetadata, firebaseServerStorageDefaultBucketIdTokenProvider, firebaseServerStorageModuleMetadata, firebaseServerValidationError, firebaseServerValidationServerError, firestoreClientQueryConstraintFunctionsDriver, firestoreEncryptedField, firestoreServerIncrementUpdateToUpdateData, forbiddenError, getAuthUserOrUndefined, getModelApiDetails, googleCloudFileMetadataToStorageMetadata, googleCloudFirebaseStorageContextFactory, googleCloudFirebaseStorageDrivers, googleCloudFirestoreAccessorDriver, googleCloudFirestoreContextFactory, googleCloudFirestoreDrivers, googleCloudFirestoreQueryDriver, googleCloudStorageAccessorFile, googleCloudStorageAccessorFolder, googleCloudStorageBucketForStorageFilePath, googleCloudStorageFileForStorageFilePath, googleCloudStorageFirebaseStorageAccessorDriver, googleCloudStorageFromFirebaseAdminStorage, googleCloudStorageListFilesResultFactory, handleFirebaseAuthError, handleFirebaseError, hasAuthRolesInRequest, hasNewUserSetupPasswordInRequest, hasSignedTosInRequest, inAuthContext, injectNestApplicationContextIntoRequest, injectNestIntoRequest, internalServerError, invokeModelUnknownModelTypeError, isActualSpecifier, isAdminInRequest, isAdminOrTargetUserInRequestData, isContextWithAuthData, isFirebaseError, isFirebaseHttpsError, isOnCallCrudModelApiDetails, isOnCallHandlerApiDetails, isOnCallModelTypeApiDetails, isOnCallSpecifierApiDetails, makeBlockingFunctionWithHandler, makeOnScheduleHandlerWithNestApplicationRequest, makeScheduledFunctionDevelopmentFunction, modelAccessReadErrorFromUseMultipleModelsFailure, modelApiModuleMetadata, modelNotAvailableError, nestAppHasDevelopmentSchedulerEnabled, nestAppIsProductionEnvironment, nestFirebaseDoesNotExistError, nestFirebaseForbiddenPermissionError, nestServerInstance, noRunNameSpecifiedForScheduledFunctionDevelopmentFunction, noopFirebaseServerAnalyticsServiceListener, noopOnCallModelAnalyticsService, notFoundError, onCallAnalyticsEmitterInstance, onCallCreateModel, onCallDeleteModel, onCallDevelopmentFunction, onCallHandlerWithNestApplicationFactory, onCallHandlerWithNestContextFactory, onCallInvokeModel, onCallModel, onCallModelMissingCallTypeError, onCallModelUnknownCallTypeError, onCallQueryModel, onCallReadModel, onCallSpecifierHandler, onCallUpdateModel, onScheduleHandlerWithNestApplicationFactory, onScheduleHandlerWithNestContextFactory, optionalAuthContext, optionalFirestoreEncryptedField, permissionDeniedError, phoneNumberAlreadyExistsError, preconditionConflictError, provideAppFirestoreCollections, provideFirebaseServerAuthService, provideFirebaseServerStorageService, queryModelBadCursorError, queryModelUnknownModelTypeError, readApiDetails, readModelUnknownModelTypeError, resolveAdminOnlyValue, resolveAnalyticsFromApiDetails, setNestContextOnRequest, setNestContextOnScheduleRequest, taskQueueFunctionHandlerWithNestContextFactory, unauthenticatedContextHasNoAuthData, unauthenticatedContextHasNoUidError, unauthenticatedError, unavailableError, unavailableOrDeactivatedFunctionError, unknownModelCrudFunctionSpecifierError, unknownScheduledFunctionDevelopmentFunctionName, unknownScheduledFunctionDevelopmentFunctionType, updateModelUnknownModelTypeError, userContextFromUid, verifyAppCheckInRequest, withApiDetails };
13057
+ export { AbstractFirebaseNestContext, AbstractFirebaseServerActionsContext, AbstractFirebaseServerAuthContext, AbstractFirebaseServerAuthService, AbstractFirebaseServerAuthUserContext, AbstractFirebaseServerNewUserService, AbstractFirebaseServerUserPasswordResetService, AbstractNestContext, AbstractServerFirebaseNestContext, ConfigureFirebaseAppCheckMiddlewareModule, ConfigureFirebaseWebhookMiddlewareModule, DEFAULT_FIREBASE_PASSWORD_NUMBER_GENERATOR, DEFAULT_RESET_CODE_EXPIRES_IN, DEFAULT_RESET_COM_THROTTLE_TIME, DEFAULT_SERVER_ASSETS_BASE_PATH, DEFAULT_SETUP_COM_THROTTLE_TIME, DefaultFirebaseServerEnvService, FIREBASE_APP_TOKEN, FIREBASE_AUTH_TOKEN, FIREBASE_FIRESTORE_CONTEXT_TOKEN, FIREBASE_FIRESTORE_TOKEN, FIREBASE_SERVER_ENV_TOKEN, FIREBASE_SERVER_VALIDATION_ERROR_CODE, FIREBASE_STORAGE_CONTEXT_FACTORY_CONFIG_TOKEN, FIREBASE_STORAGE_CONTEXT_TOKEN, FIREBASE_STORAGE_TOKEN, FIRESTORE_CLIENT_QUERY_CONSTRAINT_HANDLER_MAPPING, FirebaseAppCheckMiddleware, FirebaseAppCheckMiddlewareConfig, FirebaseNestServerRootModule, FirebaseRawBodyMiddleware, FirebaseServerAnalyticsSegmentListenerService, FirebaseServerAnalyticsSegmentModule, FirebaseServerAnalyticsService, FirebaseServerAnalyticsServiceListener, FirebaseServerAuthModule, FirebaseServerAuthNewUserSendSetupDetailsNoSetupConfigError, FirebaseServerAuthNewUserSendSetupDetailsSendOnceError, FirebaseServerAuthNewUserSendSetupDetailsThrottleError, FirebaseServerAuthPasswordResetInvalidCodeError, FirebaseServerAuthPasswordResetNoResetConfigError, FirebaseServerAuthPasswordResetSendOnceError, FirebaseServerAuthPasswordResetThrottleError, FirebaseServerAuthService, FirebaseServerAuthUserBadInputError, FirebaseServerAuthUserExistsError, FirebaseServerEnvService, FirebaseServerFirestoreContextModule, FirebaseServerFirestoreModule, FirebaseServerStorageContextModule, FirebaseServerStorageModule, FirebaseServerStorageService, GlobalRoutePrefixConfig, MAX_MODEL_ACCESS_MULTI_READ_KEYS, MODEL_API_NEST_APPLICATION_CONTEXT, ModelApiCallModelDispatchService, ModelApiController, ModelApiDispatchConfig, ModelApiGetService, NO_RUN_NAME_SPECIFIED_FOR_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_CODE, NoContentFirebaseServerUserPasswordResetService, NoSetupContentFirebaseServerNewUserService, ON_CALL_MODEL_ANALYTICS_HANDLER, ON_CALL_MODEL_ANALYTICS_SERVICE, OnCallModelAnalyticsService, PHONE_NUMBER_ALREADY_EXISTS_ERROR_CODE, SkipAppCheck, UNKNOWN_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_NAME_CODE, UNKNOWN_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_TYPE_CODE, _onCallWithCallTypeFunction, aggregateCrudModelApiDetails, aggregateModelApiDetails, aggregateSpecifierApiDetails, alreadyExistsError, appAnalyticsModuleMetadata, appFirestoreModuleMetadata, assertContextHasAuth, assertDocumentExists, assertHasRolesInRequest, assertHasSignedTosInRequest, assertIsAdminInRequest, assertIsAdminOrTargetUserInRequestData, assertIsContextWithAuthData, assertRequestRequiresAuthForFunction, assertSnapshotData, assertSnapshotDataWithKey, authServicePasswordResetInvalidCodeError, authServicePasswordResetNoConfigError, authServicePasswordResetSendOnceError, authServicePasswordResetThrottleError, badRequestError, blockingFunctionHandlerWithNestContextFactory, buildNestServerRootModule, callWithAnalytics, catchAndThrowPasswordResetServerErrors, cloudEventHandlerWithNestContextFactory, collectionRefForPath, createModelUnknownModelTypeError, decodeFirebaseServerUserPasswordResetOobCode, defaultFirebaseServerActionsTransformFactoryLogErrorFunction, defaultProvideFirebaseServerStorageServiceSimple, deleteModelUnknownModelTypeError, developmentUnknownSpecifierError, docRefForPath, documentModelNotAvailableError, encodeFirebaseServerUserPasswordResetOobCode, executeOnCallQuery, firebaseAuthTokenFromDecodedIdToken, firebaseServerActionsContext, firebaseServerActionsTransformContext, firebaseServerActionsTransformFactory, firebaseServerAppTokenProvider, firebaseServerAuthModuleMetadata, firebaseServerDevFunctions, firebaseServerEnvTokenProvider, firebaseServerEnvTokenProviders, firebaseServerErrorInfo, firebaseServerErrorInfoCodePair, firebaseServerErrorInfoServerErrorCodePair, firebaseServerErrorInfoServerErrorPair, firebaseServerFirestoreContextModuleMetadata, firebaseServerStorageDefaultBucketIdTokenProvider, firebaseServerStorageModuleMetadata, firebaseServerValidationError, firebaseServerValidationServerError, firestoreClientQueryConstraintFunctionsDriver, firestoreEncryptedField, firestoreServerIncrementUpdateToUpdateData, forbiddenError, getAuthUserOrUndefined, getModelApiDetails, googleCloudFileMetadataToStorageMetadata, googleCloudFirebaseStorageContextFactory, googleCloudFirebaseStorageDrivers, googleCloudFirestoreAccessorDriver, googleCloudFirestoreContextFactory, googleCloudFirestoreDrivers, googleCloudFirestoreQueryDriver, googleCloudStorageAccessorFile, googleCloudStorageAccessorFolder, googleCloudStorageBucketForStorageFilePath, googleCloudStorageFileForStorageFilePath, googleCloudStorageFirebaseStorageAccessorDriver, googleCloudStorageFromFirebaseAdminStorage, googleCloudStorageListFilesResultFactory, handleFirebaseAuthError, handleFirebaseError, hasAuthRolesInRequest, hasNewUserSetupPasswordInRequest, hasSignedTosInRequest, inAuthContext, injectNestApplicationContextIntoRequest, injectNestIntoRequest, internalServerError, invokeModelUnknownModelTypeError, isActualSpecifier, isAdminInRequest, isAdminOrTargetUserInRequestData, isContextWithAuthData, isFirebaseError, isFirebaseHttpsError, isOnCallCrudModelApiDetails, isOnCallHandlerApiDetails, isOnCallModelTypeApiDetails, isOnCallSpecifierApiDetails, makeBlockingFunctionWithHandler, makeOnScheduleHandlerWithNestApplicationRequest, makeScheduledFunctionDevelopmentFunction, modelAccessReadErrorFromUseMultipleModelsFailure, modelApiModuleMetadata, modelNotAvailableError, nestAppHasDevelopmentSchedulerEnabled, nestAppIsProductionEnvironment, nestFirebaseDoesNotExistError, nestFirebaseForbiddenPermissionError, nestServerInstance, noRunNameSpecifiedForScheduledFunctionDevelopmentFunction, noopFirebaseServerAnalyticsServiceListener, noopOnCallModelAnalyticsService, notFoundError, onCallAnalyticsEmitterInstance, onCallCreateModel, onCallDeleteModel, onCallDevelopmentFunction, onCallHandlerWithNestApplicationFactory, onCallHandlerWithNestContextFactory, onCallInvokeModel, onCallModel, onCallModelMissingCallTypeError, onCallModelUnknownCallTypeError, onCallQueryModel, onCallReadModel, onCallSpecifierHandler, onCallUpdateModel, onScheduleHandlerWithNestApplicationFactory, onScheduleHandlerWithNestContextFactory, optionalAuthContext, optionalFirestoreEncryptedField, permissionDeniedError, phoneNumberAlreadyExistsError, preconditionConflictError, provideAppFirestoreCollections, provideFirebaseServerAuthService, provideFirebaseServerStorageService, queryModelBadCursorError, queryModelUnknownModelTypeError, readApiDetails, readModelUnknownModelTypeError, resolveAdminOnlyValue, resolveAnalyticsFromApiDetails, setNestContextOnRequest, setNestContextOnScheduleRequest, taskQueueFunctionHandlerWithNestContextFactory, unauthenticatedContextHasNoAuthData, unauthenticatedContextHasNoUidError, unauthenticatedError, unavailableError, unavailableOrDeactivatedFunctionError, unknownModelCrudFunctionSpecifierError, unknownScheduledFunctionDevelopmentFunctionName, unknownScheduledFunctionDevelopmentFunctionType, updateModelUnknownModelTypeError, userContextFromUid, verifyAppCheckInRequest, withApiDetails };
@@ -374,7 +374,7 @@ function _ts_generator(thisArg, body) {
374
374
  key: "sendPasswordResetContentToUser",
375
375
  value: function sendPasswordResetContentToUser(details) {
376
376
  return _async_to_generator(function() {
377
- var userRecord, resetPassword, uid, displayName, email, baseRequest, baseRequestTo;
377
+ var userRecord, oobCode, uid, displayName, email, baseRequest, baseRequestTo;
378
378
  return _ts_generator(this, function(_state) {
379
379
  switch(_state.label){
380
380
  case 0:
@@ -384,7 +384,10 @@ function _ts_generator(thisArg, body) {
384
384
  ];
385
385
  case 1:
386
386
  userRecord = _state.sent();
387
- resetPassword = details.claims.resetPassword;
387
+ // Inject the encoded oob code (carries both the raw code and the target uid) so the link
388
+ // embedded in the email is self-sufficient — the recipient does not need to be signed in
389
+ // to complete the reset.
390
+ oobCode = details.oobCode;
388
391
  uid = userRecord.uid, displayName = userRecord.displayName, email = userRecord.email;
389
392
  if (!email) {
390
393
  throw new Error('Email is not present/available for the user record "'.concat(userRecord.uid, '"'));
@@ -405,7 +408,7 @@ function _ts_generator(thisArg, body) {
405
408
  name: baseRequestTo === null || baseRequestTo === void 0 ? void 0 : baseRequestTo.name,
406
409
  email: email,
407
410
  userVariables: _object_spread_props(_object_spread({
408
- resetPassword: resetPassword
411
+ resetPassword: oobCode
409
412
  }, baseRequestTo === null || baseRequestTo === void 0 ? void 0 : baseRequestTo.userVariables), {
410
413
  displayName: displayName,
411
414
  uid: uid
@@ -372,7 +372,7 @@ function _ts_generator(thisArg, body) {
372
372
  key: "sendPasswordResetContentToUser",
373
373
  value: function sendPasswordResetContentToUser(details) {
374
374
  return _async_to_generator(function() {
375
- var userRecord, resetPassword, uid, displayName, email, baseRequest, baseRequestTo;
375
+ var userRecord, oobCode, uid, displayName, email, baseRequest, baseRequestTo;
376
376
  return _ts_generator(this, function(_state) {
377
377
  switch(_state.label){
378
378
  case 0:
@@ -382,7 +382,10 @@ function _ts_generator(thisArg, body) {
382
382
  ];
383
383
  case 1:
384
384
  userRecord = _state.sent();
385
- resetPassword = details.claims.resetPassword;
385
+ // Inject the encoded oob code (carries both the raw code and the target uid) so the link
386
+ // embedded in the email is self-sufficient — the recipient does not need to be signed in
387
+ // to complete the reset.
388
+ oobCode = details.oobCode;
386
389
  uid = userRecord.uid, displayName = userRecord.displayName, email = userRecord.email;
387
390
  if (!email) {
388
391
  throw new Error('Email is not present/available for the user record "'.concat(userRecord.uid, '"'));
@@ -403,7 +406,7 @@ function _ts_generator(thisArg, body) {
403
406
  name: baseRequestTo === null || baseRequestTo === void 0 ? void 0 : baseRequestTo.name,
404
407
  email: email,
405
408
  userVariables: _object_spread_props(_object_spread({
406
- resetPassword: resetPassword
409
+ resetPassword: oobCode
407
410
  }, baseRequestTo === null || baseRequestTo === void 0 ? void 0 : baseRequestTo.userVariables), {
408
411
  displayName: displayName,
409
412
  uid: uid
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@dereekb/firebase-server/mailgun",
3
- "version": "13.12.3",
3
+ "version": "13.12.5",
4
4
  "peerDependencies": {
5
- "@dereekb/analytics": "13.12.3",
6
- "@dereekb/firebase": "13.12.3",
7
- "@dereekb/firebase-server": "13.12.3",
8
- "@dereekb/date": "13.12.3",
9
- "@dereekb/nestjs": "13.12.3",
10
- "@dereekb/model": "13.12.3",
11
- "@dereekb/rxjs": "13.12.3",
12
- "@dereekb/util": "13.12.3"
5
+ "@dereekb/analytics": "13.12.5",
6
+ "@dereekb/firebase": "13.12.5",
7
+ "@dereekb/firebase-server": "13.12.5",
8
+ "@dereekb/date": "13.12.5",
9
+ "@dereekb/nestjs": "13.12.5",
10
+ "@dereekb/model": "13.12.5",
11
+ "@dereekb/rxjs": "13.12.5",
12
+ "@dereekb/util": "13.12.5"
13
13
  },
14
14
  "exports": {
15
15
  "./package.json": "./package.json",
package/mcp/index.cjs.js CHANGED
@@ -4056,13 +4056,13 @@ function _unsupported_iterable_to_array$1(o, minLen) {
4056
4056
  /**
4057
4057
  * Default analytics event name used by {@link FirebaseServerMcpAnalyticsService} when
4058
4058
  * forwarding a completed MCP tool call to the downstream analytics pipeline.
4059
- */ var DEFAULT_MCP_ANALYTICS_EVENT_NAME = 'mcp-tool';
4059
+ */ var DEFAULT_MCP_ANALYTICS_EVENT_NAME = 'Mcp Tool Call';
4060
4060
  /**
4061
4061
  * NestJS injection token for the optional {@link FirebaseServerMcpAnalyticsConfig} provider.
4062
4062
  *
4063
4063
  * @example
4064
4064
  * ```typescript
4065
- * @Module(appMcpAnalyticsModuleMetadata({ mcpAnalyticsConfig: { eventName: 'mcp-tool', logEvents: true } }))
4065
+ * @Module(appMcpAnalyticsModuleMetadata({ mcpAnalyticsConfig: { eventName: 'Mcp Tool Call', logEvents: true } }))
4066
4066
  * export class AppMcpAnalyticsModule {}
4067
4067
  * ```
4068
4068
  */ var FIREBASE_SERVER_MCP_ANALYTICS_CONFIG = 'FIREBASE_SERVER_MCP_ANALYTICS_CONFIG';
@@ -4163,14 +4163,15 @@ var FirebaseServerMcpAnalyticsService_1;
4163
4163
  * no-op aside from the optional log line.
4164
4164
  */ exports.FirebaseServerMcpAnalyticsService = FirebaseServerMcpAnalyticsService_1 = /*#__PURE__*/ function(McpAnalyticsService) {
4165
4165
  _inherits(FirebaseServerMcpAnalyticsService, McpAnalyticsService);
4166
- function FirebaseServerMcpAnalyticsService(analyticsService, config) {
4166
+ function FirebaseServerMcpAnalyticsService(firebaseServerEnvService, analyticsService, config) {
4167
4167
  _class_call_check(this, FirebaseServerMcpAnalyticsService);
4168
4168
  var _this;
4169
4169
  var _ref, _ref1;
4170
- _this = _call_super(this, FirebaseServerMcpAnalyticsService), _define_property(_this, "analyticsService", void 0), _define_property(_this, "_logger", new common.Logger(FirebaseServerMcpAnalyticsService_1.name)), _define_property(_this, "_eventName", void 0), _define_property(_this, "_logEvents", void 0);
4170
+ _this = _call_super(this, FirebaseServerMcpAnalyticsService), _define_property(_this, "firebaseServerEnvService", void 0), _define_property(_this, "analyticsService", void 0), _define_property(_this, "_logger", new common.Logger(FirebaseServerMcpAnalyticsService_1.name)), _define_property(_this, "_eventName", void 0), _define_property(_this, "_logEvents", void 0);
4171
+ _this.firebaseServerEnvService = firebaseServerEnvService;
4171
4172
  _this.analyticsService = analyticsService;
4172
4173
  _this._eventName = (_ref = config === null || config === void 0 ? void 0 : config.eventName) !== null && _ref !== void 0 ? _ref : DEFAULT_MCP_ANALYTICS_EVENT_NAME;
4173
- _this._logEvents = (_ref1 = config === null || config === void 0 ? void 0 : config.logEvents) !== null && _ref1 !== void 0 ? _ref1 : true;
4174
+ _this._logEvents = (_ref1 = config === null || config === void 0 ? void 0 : config.logEvents) !== null && _ref1 !== void 0 ? _ref1 : !_this.firebaseServerEnvService.isProduction;
4174
4175
  return _this;
4175
4176
  }
4176
4177
  _create_class(FirebaseServerMcpAnalyticsService, [
@@ -4201,10 +4202,11 @@ var FirebaseServerMcpAnalyticsService_1;
4201
4202
  }(McpAnalyticsService);
4202
4203
  exports.FirebaseServerMcpAnalyticsService = FirebaseServerMcpAnalyticsService_1 = __decorate([
4203
4204
  common.Injectable(),
4204
- __param(0, common.Optional()),
4205
- __param(0, common.Inject(firebaseServer.FirebaseServerAnalyticsService)),
4205
+ __param(0, common.Inject(firebaseServer.FirebaseServerEnvService)),
4206
4206
  __param(1, common.Optional()),
4207
- __param(1, common.Inject(FIREBASE_SERVER_MCP_ANALYTICS_CONFIG))
4207
+ __param(1, common.Inject(firebaseServer.FirebaseServerAnalyticsService)),
4208
+ __param(2, common.Optional()),
4209
+ __param(2, common.Inject(FIREBASE_SERVER_MCP_ANALYTICS_CONFIG))
4208
4210
  ], exports.FirebaseServerMcpAnalyticsService);
4209
4211
 
4210
4212
  function _array_like_to_array(arr, len) {
package/mcp/index.esm.js CHANGED
@@ -4,7 +4,7 @@ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
  import { ListToolsRequestSchema, CallToolRequestSchema } from '@modelcontextprotocol/sdk/types.js';
5
5
  import { getOidcScopesFromRequest } from '@dereekb/firebase-server/oidc';
6
6
  import { makeValuesGroupMap, authRolesSetHasRoles } from '@dereekb/util';
7
- import { ModelApiCallModelDispatchService, ModelApiGetService, FirebaseServerAnalyticsService } from '@dereekb/firebase-server';
7
+ import { ModelApiCallModelDispatchService, ModelApiGetService, FirebaseServerEnvService, FirebaseServerAnalyticsService } from '@dereekb/firebase-server';
8
8
  import { inspect } from 'node:util';
9
9
  import { arktypeToJsonSchemaForExport } from '@dereekb/model';
10
10
  import { callModelOidcScopeForCallType } from '@dereekb/firebase';
@@ -4054,13 +4054,13 @@ function _unsupported_iterable_to_array$1(o, minLen) {
4054
4054
  /**
4055
4055
  * Default analytics event name used by {@link FirebaseServerMcpAnalyticsService} when
4056
4056
  * forwarding a completed MCP tool call to the downstream analytics pipeline.
4057
- */ var DEFAULT_MCP_ANALYTICS_EVENT_NAME = 'mcp-tool';
4057
+ */ var DEFAULT_MCP_ANALYTICS_EVENT_NAME = 'Mcp Tool Call';
4058
4058
  /**
4059
4059
  * NestJS injection token for the optional {@link FirebaseServerMcpAnalyticsConfig} provider.
4060
4060
  *
4061
4061
  * @example
4062
4062
  * ```typescript
4063
- * @Module(appMcpAnalyticsModuleMetadata({ mcpAnalyticsConfig: { eventName: 'mcp-tool', logEvents: true } }))
4063
+ * @Module(appMcpAnalyticsModuleMetadata({ mcpAnalyticsConfig: { eventName: 'Mcp Tool Call', logEvents: true } }))
4064
4064
  * export class AppMcpAnalyticsModule {}
4065
4065
  * ```
4066
4066
  */ var FIREBASE_SERVER_MCP_ANALYTICS_CONFIG = 'FIREBASE_SERVER_MCP_ANALYTICS_CONFIG';
@@ -4161,14 +4161,15 @@ var FirebaseServerMcpAnalyticsService_1;
4161
4161
  * no-op aside from the optional log line.
4162
4162
  */ var FirebaseServerMcpAnalyticsService = FirebaseServerMcpAnalyticsService_1 = /*#__PURE__*/ function(McpAnalyticsService) {
4163
4163
  _inherits(FirebaseServerMcpAnalyticsService, McpAnalyticsService);
4164
- function FirebaseServerMcpAnalyticsService(analyticsService, config) {
4164
+ function FirebaseServerMcpAnalyticsService(firebaseServerEnvService, analyticsService, config) {
4165
4165
  _class_call_check(this, FirebaseServerMcpAnalyticsService);
4166
4166
  var _this;
4167
4167
  var _ref, _ref1;
4168
- _this = _call_super(this, FirebaseServerMcpAnalyticsService), _define_property(_this, "analyticsService", void 0), _define_property(_this, "_logger", new Logger(FirebaseServerMcpAnalyticsService_1.name)), _define_property(_this, "_eventName", void 0), _define_property(_this, "_logEvents", void 0);
4168
+ _this = _call_super(this, FirebaseServerMcpAnalyticsService), _define_property(_this, "firebaseServerEnvService", void 0), _define_property(_this, "analyticsService", void 0), _define_property(_this, "_logger", new Logger(FirebaseServerMcpAnalyticsService_1.name)), _define_property(_this, "_eventName", void 0), _define_property(_this, "_logEvents", void 0);
4169
+ _this.firebaseServerEnvService = firebaseServerEnvService;
4169
4170
  _this.analyticsService = analyticsService;
4170
4171
  _this._eventName = (_ref = config === null || config === void 0 ? void 0 : config.eventName) !== null && _ref !== void 0 ? _ref : DEFAULT_MCP_ANALYTICS_EVENT_NAME;
4171
- _this._logEvents = (_ref1 = config === null || config === void 0 ? void 0 : config.logEvents) !== null && _ref1 !== void 0 ? _ref1 : true;
4172
+ _this._logEvents = (_ref1 = config === null || config === void 0 ? void 0 : config.logEvents) !== null && _ref1 !== void 0 ? _ref1 : !_this.firebaseServerEnvService.isProduction;
4172
4173
  return _this;
4173
4174
  }
4174
4175
  _create_class(FirebaseServerMcpAnalyticsService, [
@@ -4199,10 +4200,11 @@ var FirebaseServerMcpAnalyticsService_1;
4199
4200
  }(McpAnalyticsService);
4200
4201
  FirebaseServerMcpAnalyticsService = FirebaseServerMcpAnalyticsService_1 = __decorate([
4201
4202
  Injectable(),
4202
- __param(0, Optional()),
4203
- __param(0, Inject(FirebaseServerAnalyticsService)),
4203
+ __param(0, Inject(FirebaseServerEnvService)),
4204
4204
  __param(1, Optional()),
4205
- __param(1, Inject(FIREBASE_SERVER_MCP_ANALYTICS_CONFIG))
4205
+ __param(1, Inject(FirebaseServerAnalyticsService)),
4206
+ __param(2, Optional()),
4207
+ __param(2, Inject(FIREBASE_SERVER_MCP_ANALYTICS_CONFIG))
4206
4208
  ], FirebaseServerMcpAnalyticsService);
4207
4209
 
4208
4210
  function _array_like_to_array(arr, len) {
package/mcp/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@dereekb/firebase-server/mcp",
3
- "version": "13.12.3",
3
+ "version": "13.12.5",
4
4
  "peerDependencies": {
5
- "@dereekb/analytics": "13.12.3",
6
- "@dereekb/date": "13.12.3",
7
- "@dereekb/firebase": "13.12.3",
8
- "@dereekb/firebase-server": "13.12.3",
9
- "@dereekb/firebase-server/oidc": "13.12.3",
10
- "@dereekb/model": "13.12.3",
11
- "@dereekb/nestjs": "13.12.3",
12
- "@dereekb/rxjs": "13.12.3",
13
- "@dereekb/util": "13.12.3",
14
- "@dereekb/zoho": "13.12.3",
5
+ "@dereekb/analytics": "13.12.5",
6
+ "@dereekb/date": "13.12.5",
7
+ "@dereekb/firebase": "13.12.5",
8
+ "@dereekb/firebase-server": "13.12.5",
9
+ "@dereekb/firebase-server/oidc": "13.12.5",
10
+ "@dereekb/model": "13.12.5",
11
+ "@dereekb/nestjs": "13.12.5",
12
+ "@dereekb/rxjs": "13.12.5",
13
+ "@dereekb/util": "13.12.5",
14
+ "@dereekb/zoho": "13.12.5",
15
15
  "@modelcontextprotocol/sdk": "1.29.0",
16
16
  "@nestjs/common": "^11.1.19",
17
17
  "@nestjs/core": "^11.1.19",
@@ -3,7 +3,7 @@ import { type InjectionToken } from '@nestjs/common';
3
3
  * Default analytics event name used by {@link FirebaseServerMcpAnalyticsService} when
4
4
  * forwarding a completed MCP tool call to the downstream analytics pipeline.
5
5
  */
6
- export declare const DEFAULT_MCP_ANALYTICS_EVENT_NAME = "mcp-tool";
6
+ export declare const DEFAULT_MCP_ANALYTICS_EVENT_NAME = "Mcp Tool Call";
7
7
  /**
8
8
  * Configuration for {@link FirebaseServerMcpAnalyticsService}.
9
9
  *
@@ -18,7 +18,9 @@ export interface FirebaseServerMcpAnalyticsConfig {
18
18
  */
19
19
  readonly eventName?: string;
20
20
  /**
21
- * Whether to emit a per-call `Logger` line for each completed tool call. Defaults to `true`.
21
+ * Whether to emit a per-call `Logger` line for each completed tool call.
22
+ *
23
+ * Defaults to `true` on non-production environments.
22
24
  */
23
25
  readonly logEvents?: boolean;
24
26
  }
@@ -27,7 +29,7 @@ export interface FirebaseServerMcpAnalyticsConfig {
27
29
  *
28
30
  * @example
29
31
  * ```typescript
30
- * @Module(appMcpAnalyticsModuleMetadata({ mcpAnalyticsConfig: { eventName: 'mcp-tool', logEvents: true } }))
32
+ * @Module(appMcpAnalyticsModuleMetadata({ mcpAnalyticsConfig: { eventName: 'Mcp Tool Call', logEvents: true } }))
31
33
  * export class AppMcpAnalyticsModule {}
32
34
  * ```
33
35
  */
@@ -1,4 +1,4 @@
1
- import { FirebaseServerAnalyticsService } from '@dereekb/firebase-server';
1
+ import { FirebaseServerAnalyticsService, FirebaseServerEnvService } from '@dereekb/firebase-server';
2
2
  import { McpAnalyticsService, type McpAnalyticsEvent } from './mcp.analytics.handler';
3
3
  import { type FirebaseServerMcpAnalyticsConfig } from './mcp.analytics.config';
4
4
  /**
@@ -11,10 +11,11 @@ import { type FirebaseServerMcpAnalyticsConfig } from './mcp.analytics.config';
11
11
  * no-op aside from the optional log line.
12
12
  */
13
13
  export declare class FirebaseServerMcpAnalyticsService extends McpAnalyticsService {
14
+ private readonly firebaseServerEnvService;
14
15
  private readonly analyticsService?;
15
16
  private readonly _logger;
16
17
  private readonly _eventName;
17
18
  private readonly _logEvents;
18
- constructor(analyticsService?: FirebaseServerAnalyticsService | undefined, config?: FirebaseServerMcpAnalyticsConfig);
19
+ constructor(firebaseServerEnvService: FirebaseServerEnvService, analyticsService?: FirebaseServerAnalyticsService | undefined, config?: FirebaseServerMcpAnalyticsConfig);
19
20
  handleMcpAnalyticsEvent(event: McpAnalyticsEvent): void;
20
21
  }