Skip to content

Commit e19d00a

Browse files
committed
rename FPNV to PhoneNumberVerification and replace getPhoneNumber() with property
1 parent abc10bf commit e19d00a

18 files changed

Lines changed: 2187 additions & 1639 deletions

entrypoints.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
"typings": "./lib/auth/index.d.ts",
1717
"dist": "./lib/auth/index.js"
1818
},
19-
"firebase-admin/fpnv": {
20-
"typings": "./lib/fpnv/index.d.ts",
21-
"dist": "./lib/fpnv/index.js"
19+
"firebase-admin/phone-number-verification": {
20+
"typings": "./lib/phone-number-verification/index.d.ts",
21+
"dist": "./lib/phone-number-verification/index.js"
2222
},
2323
"firebase-admin/database": {
2424
"typings": "./lib/database/index.d.ts",

package-lock.json

Lines changed: 1912 additions & 1384 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@
7373
"auth": [
7474
"lib/auth"
7575
],
76-
"fpnv": [
77-
"lib/fpnv"
76+
"phone-number-verification": [
77+
"lib/phone-number-verification"
7878
],
7979
"eventarc": [
8080
"lib/eventarc"
@@ -137,10 +137,10 @@
137137
"require": "./lib/auth/index.js",
138138
"import": "./lib/esm/auth/index.js"
139139
},
140-
"./fpnv": {
141-
"types": "./lib/fpnv/index.d.ts",
142-
"require": "./lib/fpnv/index.js",
143-
"import": "./lib/esm/fpnv/index.js"
140+
"./phone-number-verification": {
141+
"types": "./lib/phone-number-verification/index.d.ts",
142+
"require": "./lib/phone-number-verification/index.js",
143+
"import": "./lib/esm/phone-number-verification/index.js"
144144
},
145145
"./database": {
146146
"types": "./lib/database/index.d.ts",

src/app/firebase-namespace.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { App as AppCore } from './core';
1919
import { AppStore, defaultAppStore } from './lifecycle';
2020
import {
2121
app, appCheck, auth, messaging, machineLearning, storage, firestore, database,
22-
instanceId, installations, projectManagement, securityRules , remoteConfig, fpnv, AppOptions,
22+
instanceId, installations, projectManagement, securityRules , remoteConfig, phoneNumberVerification, AppOptions,
2323
} from '../firebase-namespace-api';
2424
import { cert, refreshToken, applicationDefault } from './credential-factory';
2525
import { getSdkVersion } from '../utils/index';
@@ -37,7 +37,7 @@ import ProjectManagement = projectManagement.ProjectManagement;
3737
import RemoteConfig = remoteConfig.RemoteConfig;
3838
import SecurityRules = securityRules.SecurityRules;
3939
import Storage = storage.Storage;
40-
import Fpnv = fpnv.Fpnv;
40+
import PhoneNumberVerification = phoneNumberVerification.PhoneNumberVerification;
4141

4242
export interface FirebaseServiceNamespace <T> {
4343
(app?: App): T;
@@ -281,17 +281,19 @@ export class FirebaseNamespace {
281281
}
282282

283283
/**
284-
* Gets the `Fpnv` service namespace. The returned namespace can be used to get the
285-
* `Fpnv` service for the default app or an explicitly specified app.
284+
* Gets the `PhoneNumberVerification` service namespace. The returned namespace can be used to get the
285+
* `PhoneNumberVerification` service for the default app or an explicitly specified app.
286286
*/
287-
get fpnv(): FirebaseServiceNamespace<Fpnv> {
288-
const fn: FirebaseServiceNamespace<Fpnv> = (app?: App) => {
289-
return this.ensureApp(app).fpnv();
287+
get phoneNumberVerification(): FirebaseServiceNamespace<PhoneNumberVerification> {
288+
const fn: FirebaseServiceNamespace<PhoneNumberVerification> = (app?: App) => {
289+
return this.ensureApp(app).phoneNumberVerification();
290290
};
291-
const fpnv = require('../fpnv/fpnv').Fpnv;
292-
return Object.assign(fn, { Fpnv: fpnv });
291+
const phoneNumberVerification = require(
292+
'../phone-number-verification/phone-number-verification').PhoneNumberVerification;
293+
return Object.assign(fn, { PhoneNumberVerification: phoneNumberVerification });
293294
}
294295

296+
295297
// TODO: Change the return types to app.App in the following methods.
296298

297299
/**
@@ -410,11 +412,12 @@ function extendApp(app: AppCore): App {
410412
return fn(app);
411413
};
412414

413-
result.fpnv = () => {
414-
const fn = require('../fpnv/index').getFirebasePnv;
415+
result.phoneNumberVerification = () => {
416+
const fn = require('../phone-number-verification/index').getPhoneNumberVerification;
415417
return fn(app);
416418
};
417419

420+
418421
(result as any).__extended = true;
419422
return result;
420423
}

src/firebase-namespace-api.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { projectManagement } from './project-management/project-management-names
2626
import { remoteConfig } from './remote-config/remote-config-namespace';
2727
import { securityRules } from './security-rules/security-rules-namespace';
2828
import { storage } from './storage/storage-namespace';
29-
import { fpnv } from './fpnv/fpnv-namespace';
29+
import { phoneNumberVerification } from './phone-number-verification/phone-number-verification-namespace';
3030

3131
import { App as AppCore, AppOptions } from './app/index';
3232

@@ -57,7 +57,7 @@ export namespace app {
5757
remoteConfig(): remoteConfig.RemoteConfig;
5858
securityRules(): securityRules.SecurityRules;
5959
storage(): storage.Storage;
60-
fpnv(): fpnv.Fpnv;
60+
phoneNumberVerification(): phoneNumberVerification.PhoneNumberVerification;
6161

6262
/**
6363
* Renders this local `FirebaseApp` unusable and frees the resources of
@@ -93,7 +93,7 @@ export { projectManagement } from './project-management/project-management-names
9393
export { remoteConfig } from './remote-config/remote-config-namespace';
9494
export { securityRules } from './security-rules/security-rules-namespace';
9595
export { storage } from './storage/storage-namespace';
96-
export { fpnv } from './fpnv/fpnv-namespace';
96+
export { phoneNumberVerification } from './phone-number-verification/phone-number-verification-namespace';
9797

9898
// Declare other top-level members of the admin namespace below. Unfortunately, there's no
9999
// compile-time mechanism to ensure that the FirebaseNamespace class actually provides these

src/fpnv/fpnv-namespace.ts

Lines changed: 0 additions & 63 deletions
This file was deleted.

src/fpnv/index.ts

Lines changed: 0 additions & 64 deletions
This file was deleted.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/**
2+
* Firebase Phone Number Verification.
3+
*
4+
* @packageDocumentation
5+
*/
6+
7+
/*!
8+
* @license
9+
* Copyright 2025 Google LLC
10+
*
11+
* Licensed under the Apache License, Version 2.0 (the "License");
12+
* you may not use this file except in compliance with the License.
13+
* You may obtain a copy of the License at
14+
*
15+
* http://www.apache.org/licenses/LICENSE-2.0
16+
*
17+
* Unless required by applicable law or agreed to in writing, software
18+
* distributed under the License is distributed on an "AS IS" BASIS,
19+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20+
* See the License for the specific language governing permissions and
21+
* limitations under the License.
22+
*/
23+
24+
import { App, getApp } from '../app';
25+
import { FirebaseApp } from '../app/firebase-app';
26+
import { PhoneNumberVerification } from './phone-number-verification';
27+
28+
export {
29+
PhoneNumberVerification
30+
} from './phone-number-verification';
31+
32+
export {
33+
PhoneNumberVerificationToken,
34+
} from './phone-number-verification-api'
35+
36+
/**
37+
* Gets the {@link PhoneNumberVerification} service for the default app or a
38+
* given app.
39+
*
40+
* `getPhoneNumberVerification()` can be called with no arguments to access the default app's
41+
* {@link PhoneNumberVerification} service or as `getPhoneNumberVerification(app)` to access the
42+
* {@link PhoneNumberVerification} service associated with a specific app.
43+
*
44+
* @example
45+
* ```javascript
46+
* // Get the PhoneNumberVerification service for the default app
47+
* const defaultPnv = getPhoneNumberVerification();
48+
* ```
49+
*
50+
* @example
51+
* ```javascript
52+
* // Get the PhoneNumberVerification service for a given app
53+
* const otherPnv = getPhoneNumberVerification(otherApp);
54+
* ```
55+
*
56+
* @returns The {@link PhoneNumberVerification} service associated with the provided app.
57+
*
58+
*/
59+
export function getPhoneNumberVerification(app?: App): PhoneNumberVerification {
60+
if (typeof app === 'undefined') {
61+
app = getApp();
62+
}
63+
64+
const firebaseApp: FirebaseApp = app as FirebaseApp;
65+
return firebaseApp.getOrInitService('phone-number-verification', (app) => new PhoneNumberVerification(app));
66+
}

src/fpnv/fpnv-api-client-internal.ts renamed to src/phone-number-verification/phone-number-verification-api-client-internal.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ export const FPNV_ERROR_CODE_MAPPING = {
4444
INVALID_ARGUMENT: 'invalid-argument',
4545
INVALID_TOKEN: 'invalid-token',
4646
EXPIRED_TOKEN: 'expired-token',
47-
} satisfies Record<string, FpnvErrorCode>;
47+
} satisfies Record<string, PhoneNumberVerificationErrorCode>;
4848

49-
export type FpnvErrorCode =
49+
export type PhoneNumberVerificationErrorCode =
5050
| 'invalid-argument'
5151
| 'invalid-token'
5252
| 'expired-token'
@@ -58,14 +58,15 @@ export type FpnvErrorCode =
5858
* @param message - The error message.
5959
* @constructor
6060
*/
61-
export class FirebaseFpnvError extends PrefixedFirebaseError {
62-
constructor(code: FpnvErrorCode, message: string) {
63-
super('fpnv', code, message);
61+
export class FirebasePhoneNumberVerificationError extends PrefixedFirebaseError {
62+
constructor(code: PhoneNumberVerificationErrorCode, message: string) {
63+
super('phone-number-verification', code, message);
6464

6565
/* tslint:disable:max-line-length */
6666
// Set the prototype explicitly. See the following link for more details:
6767
// https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
6868
/* tslint:enable:max-line-length */
69-
(this as any).__proto__ = FirebaseFpnvError.prototype;
69+
(this as any).__proto__ = FirebasePhoneNumberVerificationError.prototype;
7070
}
7171
}
72+

0 commit comments

Comments
 (0)