@dereekb/firebase-server 13.12.3 → 13.12.4

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.cjs.js CHANGED
@@ -1256,15 +1256,6 @@ function _ts_generator$g(thisArg, body) {
1256
1256
  this.updateClaims(passwordClaimsData)
1257
1257
  ];
1258
1258
  case 1:
1259
- _state.sent();
1260
- // update the user
1261
- return [
1262
- 4,
1263
- this.updateUser({
1264
- password: password
1265
- })
1266
- ];
1267
- case 2:
1268
1259
  _state.sent();
1269
1260
  return [
1270
1261
  2,
@@ -2123,6 +2114,50 @@ function _ts_generator$g(thisArg, body) {
2123
2114
  ]);
2124
2115
  return NoSetupContentFirebaseServerNewUserService;
2125
2116
  }(AbstractFirebaseServerNewUserService);
2117
+ /**
2118
+ * Builds the composite oob code from a raw reset code (the numeric value stored in
2119
+ * {@link FirebaseServerAuthResetUserPasswordClaims.resetPassword}) and the target user's uid.
2120
+ *
2121
+ * @param uid - The target user's UID.
2122
+ * @param code - The raw reset code from the user's claims.
2123
+ *
2124
+ * @example
2125
+ * ```typescript
2126
+ * const oobCode = encodeFirebaseServerUserPasswordResetOobCode(user.uid, claims.resetPassword);
2127
+ * // e.g. '482910-abcDEF123'
2128
+ * ```
2129
+ */ function encodeFirebaseServerUserPasswordResetOobCode(uid, code) {
2130
+ return "".concat(code, "-").concat(uid);
2131
+ }
2132
+ /**
2133
+ * Decodes a composite oob code back into its `{ uid, code }` parts. Returns `undefined`
2134
+ * when the token is malformed (missing separator, non-numeric code, empty uid).
2135
+ *
2136
+ * @param token - The composite oob token, typically received from the password-reset email.
2137
+ *
2138
+ * @example
2139
+ * ```typescript
2140
+ * const decoded = decodeFirebaseServerUserPasswordResetOobCode('482910-abcDEF123');
2141
+ * // decoded = { uid: 'abcDEF123', code: '482910' }
2142
+ * ```
2143
+ */ function decodeFirebaseServerUserPasswordResetOobCode(token) {
2144
+ var result;
2145
+ if (typeof token === 'string') {
2146
+ var dashIndex = token.indexOf('-');
2147
+ if (dashIndex > 0 && dashIndex < token.length - 1) {
2148
+ var code = token.slice(0, dashIndex);
2149
+ var uid = token.slice(dashIndex + 1);
2150
+ // Code must be purely digits (matches DEFAULT_FIREBASE_PASSWORD_NUMBER_GENERATOR output).
2151
+ if (/^\d+$/.test(code)) {
2152
+ result = {
2153
+ uid: uid,
2154
+ code: code
2155
+ };
2156
+ }
2157
+ }
2158
+ }
2159
+ return result;
2160
+ }
2126
2161
  /**
2127
2162
  * Default throttle duration (60 seconds) between reset content re-sends to prevent spam while
2128
2163
  * remaining responsive for legitimate users who didn't receive the first email.
@@ -2171,7 +2206,7 @@ function _ts_generator$g(thisArg, body) {
2171
2206
  key: "beginPasswordReset",
2172
2207
  value: function beginPasswordReset(input) {
2173
2208
  return _async_to_generator$g(function() {
2174
- var uid, email, sendResetContent, sendResetDetailsOnce, sendResetIgnoreThrottle, sendResetThrowErrors, data, sendDetailsInTestEnvironment, resolvedUid, userRecord, userContext, claims;
2209
+ var uid, email, sendResetContent, sendResetDetailsOnce, sendResetIgnoreThrottle, sendResetThrowErrors, data, sendDetailsInTestEnvironment, resolvedUid, userRecord, userContext, claims, oobCode;
2175
2210
  return _ts_generator$g(this, function(_state) {
2176
2211
  switch(_state.label){
2177
2212
  case 0:
@@ -2232,9 +2267,13 @@ function _ts_generator$g(thisArg, body) {
2232
2267
  _state.sent();
2233
2268
  _state.label = 7;
2234
2269
  case 7:
2270
+ oobCode = encodeFirebaseServerUserPasswordResetOobCode(resolvedUid, claims.resetPassword);
2235
2271
  return [
2236
2272
  2,
2237
- claims
2273
+ {
2274
+ claims: claims,
2275
+ oobCode: oobCode
2276
+ }
2238
2277
  ];
2239
2278
  }
2240
2279
  });
@@ -2380,6 +2419,7 @@ function _ts_generator$g(thisArg, body) {
2380
2419
  resetCommunicationAt: claims.resetCommunicationAt,
2381
2420
  resetExpiresAt: claims.resetExpiresAt
2382
2421
  },
2422
+ oobCode: encodeFirebaseServerUserPasswordResetOobCode(userContext.uid, claims.resetPassword),
2383
2423
  data: config === null || config === void 0 ? void 0 : config.data,
2384
2424
  sendDetailsInTestEnvironment: config === null || config === void 0 ? void 0 : config.sendDetailsInTestEnvironment
2385
2425
  };
@@ -2422,30 +2462,56 @@ function _ts_generator$g(thisArg, body) {
2422
2462
  },
2423
2463
  {
2424
2464
  key: "completePasswordReset",
2425
- value: function completePasswordReset(uid, input) {
2465
+ value: function completePasswordReset(input) {
2426
2466
  return _async_to_generator$g(function() {
2427
- var userContext, claims, storedCode, expiresAt, storedBuf, inputBuf;
2467
+ var decoded, userContext, claims, storedCode, expiresAt, storedBuf, inputBuf;
2428
2468
  return _ts_generator$g(this, function(_state) {
2429
2469
  switch(_state.label){
2430
2470
  case 0:
2431
- userContext = this.authService.userContext(uid);
2471
+ // Decode the composite token. A malformed token is treated identically to every other
2472
+ // failure mode below — the caller cannot distinguish between "bad encoding", "unknown uid",
2473
+ // "no active reset", "expired", or "wrong code".
2474
+ decoded = decodeFirebaseServerUserPasswordResetOobCode(input.oobCode);
2475
+ if (!decoded) {
2476
+ throw new FirebaseServerAuthPasswordResetInvalidCodeError();
2477
+ }
2478
+ userContext = this.authService.userContext(decoded.uid);
2479
+ _state.label = 1;
2480
+ case 1:
2481
+ _state.trys.push([
2482
+ 1,
2483
+ 3,
2484
+ ,
2485
+ 4
2486
+ ]);
2432
2487
  return [
2433
2488
  4,
2434
2489
  userContext.loadResetPasswordClaims()
2435
2490
  ];
2436
- case 1:
2491
+ case 2:
2437
2492
  claims = _state.sent();
2493
+ return [
2494
+ 3,
2495
+ 4
2496
+ ];
2497
+ case 3:
2498
+ _state.sent();
2499
+ claims = undefined;
2500
+ return [
2501
+ 3,
2502
+ 4
2503
+ ];
2504
+ case 4:
2438
2505
  storedCode = claims === null || claims === void 0 ? void 0 : claims.resetPassword;
2439
2506
  expiresAt = claims === null || claims === void 0 ? void 0 : claims.resetExpiresAt;
2440
2507
  // Reject if no active reset OR the stored code is missing/wrong length OR the code is expired.
2441
- // All failure cases throw the same opaque error so callers cannot distinguish them.
2442
- if (!storedCode || !expiresAt || storedCode.length !== input.resetPassword.length || new Date(expiresAt).getTime() <= Date.now()) {
2508
+ if (!storedCode || !expiresAt || storedCode.length !== decoded.code.length || new Date(expiresAt).getTime() <= Date.now()) {
2443
2509
  throw new FirebaseServerAuthPasswordResetInvalidCodeError();
2444
2510
  }
2445
2511
  // Constant-time comparison to avoid leaking timing information about how many leading
2446
2512
  // characters of the provided code matched. Lengths are equal per the guard above.
2447
2513
  storedBuf = Buffer.from(storedCode);
2448
- inputBuf = Buffer.from(input.resetPassword);
2514
+ inputBuf = Buffer.from(decoded.code);
2449
2515
  if (!node_crypto.timingSafeEqual(storedBuf, inputBuf)) {
2450
2516
  throw new FirebaseServerAuthPasswordResetInvalidCodeError();
2451
2517
  }
@@ -12998,12 +13064,14 @@ exports.catchAndThrowPasswordResetServerErrors = catchAndThrowPasswordResetServe
12998
13064
  exports.cloudEventHandlerWithNestContextFactory = cloudEventHandlerWithNestContextFactory;
12999
13065
  exports.collectionRefForPath = collectionRefForPath;
13000
13066
  exports.createModelUnknownModelTypeError = createModelUnknownModelTypeError;
13067
+ exports.decodeFirebaseServerUserPasswordResetOobCode = decodeFirebaseServerUserPasswordResetOobCode;
13001
13068
  exports.defaultFirebaseServerActionsTransformFactoryLogErrorFunction = defaultFirebaseServerActionsTransformFactoryLogErrorFunction;
13002
13069
  exports.defaultProvideFirebaseServerStorageServiceSimple = defaultProvideFirebaseServerStorageServiceSimple;
13003
13070
  exports.deleteModelUnknownModelTypeError = deleteModelUnknownModelTypeError;
13004
13071
  exports.developmentUnknownSpecifierError = developmentUnknownSpecifierError;
13005
13072
  exports.docRefForPath = docRefForPath;
13006
13073
  exports.documentModelNotAvailableError = documentModelNotAvailableError;
13074
+ exports.encodeFirebaseServerUserPasswordResetOobCode = encodeFirebaseServerUserPasswordResetOobCode;
13007
13075
  exports.executeOnCallQuery = executeOnCallQuery;
13008
13076
  exports.firebaseAuthTokenFromDecodedIdToken = firebaseAuthTokenFromDecodedIdToken;
13009
13077
  exports.firebaseServerActionsContext = firebaseServerActionsContext;
package/index.esm.js CHANGED
@@ -1254,15 +1254,6 @@ function _ts_generator$g(thisArg, body) {
1254
1254
  this.updateClaims(passwordClaimsData)
1255
1255
  ];
1256
1256
  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
1257
  _state.sent();
1267
1258
  return [
1268
1259
  2,
@@ -2121,6 +2112,50 @@ function _ts_generator$g(thisArg, body) {
2121
2112
  ]);
2122
2113
  return NoSetupContentFirebaseServerNewUserService;
2123
2114
  }(AbstractFirebaseServerNewUserService);
2115
+ /**
2116
+ * Builds the composite oob code from a raw reset code (the numeric value stored in
2117
+ * {@link FirebaseServerAuthResetUserPasswordClaims.resetPassword}) and the target user's uid.
2118
+ *
2119
+ * @param uid - The target user's UID.
2120
+ * @param code - The raw reset code from the user's claims.
2121
+ *
2122
+ * @example
2123
+ * ```typescript
2124
+ * const oobCode = encodeFirebaseServerUserPasswordResetOobCode(user.uid, claims.resetPassword);
2125
+ * // e.g. '482910-abcDEF123'
2126
+ * ```
2127
+ */ function encodeFirebaseServerUserPasswordResetOobCode(uid, code) {
2128
+ return "".concat(code, "-").concat(uid);
2129
+ }
2130
+ /**
2131
+ * Decodes a composite oob code back into its `{ uid, code }` parts. Returns `undefined`
2132
+ * when the token is malformed (missing separator, non-numeric code, empty uid).
2133
+ *
2134
+ * @param token - The composite oob token, typically received from the password-reset email.
2135
+ *
2136
+ * @example
2137
+ * ```typescript
2138
+ * const decoded = decodeFirebaseServerUserPasswordResetOobCode('482910-abcDEF123');
2139
+ * // decoded = { uid: 'abcDEF123', code: '482910' }
2140
+ * ```
2141
+ */ function decodeFirebaseServerUserPasswordResetOobCode(token) {
2142
+ var result;
2143
+ if (typeof token === 'string') {
2144
+ var dashIndex = token.indexOf('-');
2145
+ if (dashIndex > 0 && dashIndex < token.length - 1) {
2146
+ var code = token.slice(0, dashIndex);
2147
+ var uid = token.slice(dashIndex + 1);
2148
+ // Code must be purely digits (matches DEFAULT_FIREBASE_PASSWORD_NUMBER_GENERATOR output).
2149
+ if (/^\d+$/.test(code)) {
2150
+ result = {
2151
+ uid: uid,
2152
+ code: code
2153
+ };
2154
+ }
2155
+ }
2156
+ }
2157
+ return result;
2158
+ }
2124
2159
  /**
2125
2160
  * Default throttle duration (60 seconds) between reset content re-sends to prevent spam while
2126
2161
  * remaining responsive for legitimate users who didn't receive the first email.
@@ -2169,7 +2204,7 @@ function _ts_generator$g(thisArg, body) {
2169
2204
  key: "beginPasswordReset",
2170
2205
  value: function beginPasswordReset(input) {
2171
2206
  return _async_to_generator$g(function() {
2172
- var uid, email, sendResetContent, sendResetDetailsOnce, sendResetIgnoreThrottle, sendResetThrowErrors, data, sendDetailsInTestEnvironment, resolvedUid, userRecord, userContext, claims;
2207
+ var uid, email, sendResetContent, sendResetDetailsOnce, sendResetIgnoreThrottle, sendResetThrowErrors, data, sendDetailsInTestEnvironment, resolvedUid, userRecord, userContext, claims, oobCode;
2173
2208
  return _ts_generator$g(this, function(_state) {
2174
2209
  switch(_state.label){
2175
2210
  case 0:
@@ -2230,9 +2265,13 @@ function _ts_generator$g(thisArg, body) {
2230
2265
  _state.sent();
2231
2266
  _state.label = 7;
2232
2267
  case 7:
2268
+ oobCode = encodeFirebaseServerUserPasswordResetOobCode(resolvedUid, claims.resetPassword);
2233
2269
  return [
2234
2270
  2,
2235
- claims
2271
+ {
2272
+ claims: claims,
2273
+ oobCode: oobCode
2274
+ }
2236
2275
  ];
2237
2276
  }
2238
2277
  });
@@ -2378,6 +2417,7 @@ function _ts_generator$g(thisArg, body) {
2378
2417
  resetCommunicationAt: claims.resetCommunicationAt,
2379
2418
  resetExpiresAt: claims.resetExpiresAt
2380
2419
  },
2420
+ oobCode: encodeFirebaseServerUserPasswordResetOobCode(userContext.uid, claims.resetPassword),
2381
2421
  data: config === null || config === void 0 ? void 0 : config.data,
2382
2422
  sendDetailsInTestEnvironment: config === null || config === void 0 ? void 0 : config.sendDetailsInTestEnvironment
2383
2423
  };
@@ -2420,30 +2460,56 @@ function _ts_generator$g(thisArg, body) {
2420
2460
  },
2421
2461
  {
2422
2462
  key: "completePasswordReset",
2423
- value: function completePasswordReset(uid, input) {
2463
+ value: function completePasswordReset(input) {
2424
2464
  return _async_to_generator$g(function() {
2425
- var userContext, claims, storedCode, expiresAt, storedBuf, inputBuf;
2465
+ var decoded, userContext, claims, storedCode, expiresAt, storedBuf, inputBuf;
2426
2466
  return _ts_generator$g(this, function(_state) {
2427
2467
  switch(_state.label){
2428
2468
  case 0:
2429
- userContext = this.authService.userContext(uid);
2469
+ // Decode the composite token. A malformed token is treated identically to every other
2470
+ // failure mode below — the caller cannot distinguish between "bad encoding", "unknown uid",
2471
+ // "no active reset", "expired", or "wrong code".
2472
+ decoded = decodeFirebaseServerUserPasswordResetOobCode(input.oobCode);
2473
+ if (!decoded) {
2474
+ throw new FirebaseServerAuthPasswordResetInvalidCodeError();
2475
+ }
2476
+ userContext = this.authService.userContext(decoded.uid);
2477
+ _state.label = 1;
2478
+ case 1:
2479
+ _state.trys.push([
2480
+ 1,
2481
+ 3,
2482
+ ,
2483
+ 4
2484
+ ]);
2430
2485
  return [
2431
2486
  4,
2432
2487
  userContext.loadResetPasswordClaims()
2433
2488
  ];
2434
- case 1:
2489
+ case 2:
2435
2490
  claims = _state.sent();
2491
+ return [
2492
+ 3,
2493
+ 4
2494
+ ];
2495
+ case 3:
2496
+ _state.sent();
2497
+ claims = undefined;
2498
+ return [
2499
+ 3,
2500
+ 4
2501
+ ];
2502
+ case 4:
2436
2503
  storedCode = claims === null || claims === void 0 ? void 0 : claims.resetPassword;
2437
2504
  expiresAt = claims === null || claims === void 0 ? void 0 : claims.resetExpiresAt;
2438
2505
  // 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()) {
2506
+ if (!storedCode || !expiresAt || storedCode.length !== decoded.code.length || new Date(expiresAt).getTime() <= Date.now()) {
2441
2507
  throw new FirebaseServerAuthPasswordResetInvalidCodeError();
2442
2508
  }
2443
2509
  // Constant-time comparison to avoid leaking timing information about how many leading
2444
2510
  // characters of the provided code matched. Lengths are equal per the guard above.
2445
2511
  storedBuf = Buffer.from(storedCode);
2446
- inputBuf = Buffer.from(input.resetPassword);
2512
+ inputBuf = Buffer.from(decoded.code);
2447
2513
  if (!timingSafeEqual(storedBuf, inputBuf)) {
2448
2514
  throw new FirebaseServerAuthPasswordResetInvalidCodeError();
2449
2515
  }
@@ -12914,4 +12980,4 @@ function _define_property(obj, key, value) {
12914
12980
  }
12915
12981
  ();
12916
12982
 
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 };
12983
+ 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.4",
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.4",
6
+ "@dereekb/firebase": "13.12.4",
7
+ "@dereekb/firebase-server": "13.12.4",
8
+ "@dereekb/date": "13.12.4",
9
+ "@dereekb/nestjs": "13.12.4",
10
+ "@dereekb/model": "13.12.4",
11
+ "@dereekb/rxjs": "13.12.4",
12
+ "@dereekb/util": "13.12.4"
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.4",
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.4",
6
+ "@dereekb/date": "13.12.4",
7
+ "@dereekb/firebase": "13.12.4",
8
+ "@dereekb/firebase-server": "13.12.4",
9
+ "@dereekb/firebase-server/oidc": "13.12.4",
10
+ "@dereekb/model": "13.12.4",
11
+ "@dereekb/nestjs": "13.12.4",
12
+ "@dereekb/rxjs": "13.12.4",
13
+ "@dereekb/util": "13.12.4",
14
+ "@dereekb/zoho": "13.12.4",
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
  */