diff --git a/etc/firebase-admin.api.md b/etc/firebase-admin.api.md index 00fe991142..5b4b580cdd 100644 --- a/etc/firebase-admin.api.md +++ b/etc/firebase-admin.api.md @@ -46,11 +46,9 @@ export namespace app { } } -// @public -export function applicationDefault(httpAgent?: Agent): Credential; - // @public export interface AppOptions { + // Warning: (ae-forgotten-export) The symbol "Credential" needs to be exported by the entry point default-namespace.d.ts credential?: Credential; databaseAuthVariableOverride?: object | null; databaseURL?: string; @@ -274,20 +272,15 @@ export namespace auth { export type UserRecord = UserRecord; } -// @public -export function cert(serviceAccountPathOrObject: string | ServiceAccount, httpAgent?: Agent): Credential; - -// @public -export interface Credential { - getAccessToken(): Promise; -} - // @public (undocumented) export namespace credential { export type Credential = Credential; - const applicationDefault: typeof applicationDefault; - const cert: typeof cert; - const refreshToken: typeof refreshToken; + const // Warning: (ae-forgotten-export) The symbol "applicationDefault" needs to be exported by the entry point default-namespace.d.ts + applicationDefault: typeof applicationDefault; + const // Warning: (ae-forgotten-export) The symbol "cert" needs to be exported by the entry point default-namespace.d.ts + cert: typeof cert; + const // Warning: (ae-forgotten-export) The symbol "refreshToken" needs to be exported by the entry point default-namespace.d.ts + refreshToken: typeof refreshToken; } // @public @@ -316,9 +309,6 @@ export namespace database { const ServerValue: rtdb.ServerValue; } -// @public -export function deleteApp(app: App): Promise; - // @public export interface FirebaseArrayIndexError { error: FirebaseError; @@ -369,12 +359,6 @@ export namespace firestore { import setLogFunction = _firestore.setLogFunction; } -// @public (undocumented) -export function getApp(name?: string): App; - -// @public (undocumented) -export function getApps(): App[]; - // @public export interface GoogleOAuthAccessToken { // (undocumented) @@ -618,9 +602,6 @@ export namespace projectManagement { export type ShaCertificate = ShaCertificate; } -// @public -export function refreshToken(refreshTokenPathOrObject: string | object, httpAgent?: Agent): Credential; - // @public export function remoteConfig(app?: App): remoteConfig.RemoteConfig; diff --git a/etc/firebase-admin.auth.api.md b/etc/firebase-admin.auth.api.md index 820a30cda7..768cd26b8a 100644 --- a/etc/firebase-admin.auth.api.md +++ b/etc/firebase-admin.auth.api.md @@ -28,115 +28,6 @@ export class Auth extends BaseAuth { tenantManager(): TenantManager; } -// @public -export function auth(app?: App): auth.Auth; - -// @public (undocumented) -export namespace auth { - // (undocumented) - export type ActionCodeSettings = ActionCodeSettings; - // (undocumented) - export type Auth = Auth; - // (undocumented) - export type AuthFactorType = AuthFactorType; - // (undocumented) - export type AuthProviderConfig = AuthProviderConfig; - // (undocumented) - export type AuthProviderConfigFilter = AuthProviderConfigFilter; - // (undocumented) - export type BaseAuth = BaseAuth; - // (undocumented) - export type CreateMultiFactorInfoRequest = CreateMultiFactorInfoRequest; - // (undocumented) - export type CreatePhoneMultiFactorInfoRequest = CreatePhoneMultiFactorInfoRequest; - // (undocumented) - export type CreateRequest = CreateRequest; - // (undocumented) - export type CreateTenantRequest = CreateTenantRequest; - // (undocumented) - export type DecodedIdToken = DecodedIdToken; - // (undocumented) - export type DeleteUsersResult = DeleteUsersResult; - // (undocumented) - export type EmailIdentifier = EmailIdentifier; - // (undocumented) - export type EmailSignInProviderConfig = EmailSignInProviderConfig; - // (undocumented) - export type GetUsersResult = GetUsersResult; - // (undocumented) - export type HashAlgorithmType = HashAlgorithmType; - // (undocumented) - export type ListProviderConfigResults = ListProviderConfigResults; - // (undocumented) - export type ListTenantsResult = ListTenantsResult; - // (undocumented) - export type ListUsersResult = ListUsersResult; - // (undocumented) - export type MultiFactorConfig = MultiFactorConfig; - // (undocumented) - export type MultiFactorConfigState = MultiFactorConfigState; - // (undocumented) - export type MultiFactorCreateSettings = MultiFactorCreateSettings; - // (undocumented) - export type MultiFactorInfo = MultiFactorInfo; - // (undocumented) - export type MultiFactorSettings = MultiFactorSettings; - // (undocumented) - export type MultiFactorUpdateSettings = MultiFactorUpdateSettings; - // (undocumented) - export type OIDCAuthProviderConfig = OIDCAuthProviderConfig; - // (undocumented) - export type OIDCUpdateAuthProviderRequest = OIDCUpdateAuthProviderRequest; - // (undocumented) - export type PhoneIdentifier = PhoneIdentifier; - // (undocumented) - export type PhoneMultiFactorInfo = PhoneMultiFactorInfo; - // (undocumented) - export type ProviderIdentifier = ProviderIdentifier; - // (undocumented) - export type SAMLAuthProviderConfig = SAMLAuthProviderConfig; - // (undocumented) - export type SAMLUpdateAuthProviderRequest = SAMLUpdateAuthProviderRequest; - // (undocumented) - export type SessionCookieOptions = SessionCookieOptions; - // (undocumented) - export type Tenant = Tenant; - // (undocumented) - export type TenantAwareAuth = TenantAwareAuth; - // (undocumented) - export type TenantManager = TenantManager; - // (undocumented) - export type UidIdentifier = UidIdentifier; - // (undocumented) - export type UpdateAuthProviderRequest = UpdateAuthProviderRequest; - // (undocumented) - export type UpdateMultiFactorInfoRequest = UpdateMultiFactorInfoRequest; - // (undocumented) - export type UpdatePhoneMultiFactorInfoRequest = UpdatePhoneMultiFactorInfoRequest; - // (undocumented) - export type UpdateRequest = UpdateRequest; - // (undocumented) - export type UpdateTenantRequest = UpdateTenantRequest; - // (undocumented) - export type UserIdentifier = UserIdentifier; - // (undocumented) - export type UserImportOptions = UserImportOptions; - // (undocumented) - export type UserImportRecord = UserImportRecord; - // (undocumented) - export type UserImportResult = UserImportResult; - // (undocumented) - export type UserInfo = UserInfo; - // (undocumented) - export type UserMetadata = UserMetadata; - // (undocumented) - export type UserMetadataRequest = UserMetadataRequest; - // (undocumented) - export type UserProviderRequest = UserProviderRequest; - // (undocumented) - export type UserRecord = UserRecord; -} - // @public export type AuthFactorType = 'phone'; diff --git a/etc/firebase-admin.database.api.md b/etc/firebase-admin.database.api.md index 3b9fe43324..f76fd77fe4 100644 --- a/etc/firebase-admin.database.api.md +++ b/etc/firebase-admin.database.api.md @@ -21,32 +21,6 @@ export interface Database extends FirebaseDatabase { setRules(source: string | Buffer | object): Promise; } -// Warning: (ae-forgotten-export) The symbol "App" needs to be exported by the entry point index.d.ts -// -// @public -export function database(app?: App): database.Database; - -// @public (undocumented) -export namespace database { - // (undocumented) - export type Database = Database; - // (undocumented) - export type DataSnapshot = rtdb.DataSnapshot; - // (undocumented) - export type EventType = rtdb.EventType; - // (undocumented) - export type OnDisconnect = rtdb.OnDisconnect; - // (undocumented) - export type Query = rtdb.Query; - // (undocumented) - export type Reference = rtdb.Reference; - // (undocumented) - export type ThenableReference = rtdb.ThenableReference; - const // (undocumented) - enableLogging: typeof rtdb.enableLogging; - const ServerValue: rtdb.ServerValue; -} - export { DataSnapshot } // @public @@ -54,6 +28,8 @@ export const enableLogging: typeof rtdb.enableLogging; export { EventType } +// Warning: (ae-forgotten-export) The symbol "App" needs to be exported by the entry point index.d.ts +// // @public export function getDatabase(app?: App): Database; diff --git a/etc/firebase-admin.firestore.api.md b/etc/firebase-admin.firestore.api.md index e060e6d4c2..e1c0fbe0fc 100644 --- a/etc/firebase-admin.firestore.api.md +++ b/etc/firebase-admin.firestore.api.md @@ -57,48 +57,12 @@ export { FieldValue } export { Firestore } -// Warning: (ae-forgotten-export) The symbol "App" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export function firestore(app?: App): _firestore.Firestore; - -// @public (undocumented) -export namespace firestore { - import v1beta1 = _firestore.v1beta1; - import v1 = _firestore.v1; - import BulkWriter = _firestore.BulkWriter; - import BulkWriterOptions = _firestore.BulkWriterOptions; - import CollectionGroup = _firestore.CollectionGroup; - import CollectionReference = _firestore.CollectionReference; - import DocumentChangeType = _firestore.DocumentChangeType; - import DocumentData = _firestore.DocumentData; - import DocumentReference = _firestore.DocumentReference; - import DocumentSnapshot = _firestore.DocumentSnapshot; - import FieldPath = _firestore.FieldPath; - import FieldValue = _firestore.FieldValue; - import Firestore = _firestore.Firestore; - import FirestoreDataConverter = _firestore.FirestoreDataConverter; - import GeoPoint = _firestore.GeoPoint; - import GrpcStatus = _firestore.GrpcStatus; - import Precondition = _firestore.Precondition; - import Query = _firestore.Query; - import QueryDocumentSnapshot = _firestore.QueryDocumentSnapshot; - import QueryPartition = _firestore.QueryPartition; - import QuerySnapshot = _firestore.QuerySnapshot; - import ReadOptions = _firestore.ReadOptions; - import Settings = _firestore.Settings; - import Timestamp = _firestore.Timestamp; - import Transaction = _firestore.Transaction; - import UpdateData = _firestore.UpdateData; - import WriteBatch = _firestore.WriteBatch; - import WriteResult = _firestore.WriteResult; - import setLogFunction = _firestore.setLogFunction; -} - export { FirestoreDataConverter } export { GeoPoint } +// Warning: (ae-forgotten-export) The symbol "App" needs to be exported by the entry point index.d.ts +// // @public (undocumented) export function getFirestore(app?: App): _firestore.Firestore; diff --git a/etc/firebase-admin.instance-id.api.md b/etc/firebase-admin.instance-id.api.md index a391fbacc7..81528b204c 100644 --- a/etc/firebase-admin.instance-id.api.md +++ b/etc/firebase-admin.instance-id.api.md @@ -17,15 +17,6 @@ export class InstanceId { deleteInstanceId(instanceId: string): Promise; } -// @public -export function instanceId(app?: App): instanceId.InstanceId; - -// @public (undocumented) -export namespace instanceId { - // (undocumented) - export type InstanceId = InstanceId; -} - // (No @packageDocumentation comment for this package) diff --git a/etc/firebase-admin.machine-learning.api.md b/etc/firebase-admin.machine-learning.api.md index 2560737b4a..70b0b778ab 100644 --- a/etc/firebase-admin.machine-learning.api.md +++ b/etc/firebase-admin.machine-learning.api.md @@ -52,31 +52,6 @@ export class MachineLearning { updateModel(modelId: string, model: ModelOptions): Promise; } -// @public -export function machineLearning(app?: App): machineLearning.MachineLearning; - -// @public (undocumented) -export namespace machineLearning { - // (undocumented) - export type AutoMLTfliteModelOptions = AutoMLTfliteModelOptions; - // (undocumented) - export type GcsTfliteModelOptions = GcsTfliteModelOptions; - // (undocumented) - export type ListModelsOptions = ListModelsOptions; - // (undocumented) - export type ListModelsResult = ListModelsResult; - // (undocumented) - export type MachineLearning = MachineLearning; - // (undocumented) - export type Model = Model; - // (undocumented) - export type ModelOptions = ModelOptions; - // (undocumented) - export type ModelOptionsBase = ModelOptionsBase; - // (undocumented) - export type TFLiteModel = TFLiteModel; -} - // @public export class Model { get createTime(): string; diff --git a/etc/firebase-admin.messaging.api.md b/etc/firebase-admin.messaging.api.md index eec7b21f45..361a44b70e 100644 --- a/etc/firebase-admin.messaging.api.md +++ b/etc/firebase-admin.messaging.api.md @@ -193,79 +193,6 @@ export class Messaging { unsubscribeFromTopic(registrationTokenOrTokens: string | string[], topic: string): Promise; } -// @public -export function messaging(app?: App): messaging.Messaging; - -// @public (undocumented) -export namespace messaging { - // (undocumented) - export type AndroidConfig = AndroidConfig; - // (undocumented) - export type AndroidFcmOptions = AndroidFcmOptions; - // (undocumented) - export type AndroidNotification = AndroidNotification; - // (undocumented) - export type ApnsConfig = ApnsConfig; - // (undocumented) - export type ApnsFcmOptions = ApnsFcmOptions; - // (undocumented) - export type ApnsPayload = ApnsPayload; - // (undocumented) - export type Aps = Aps; - // (undocumented) - export type ApsAlert = ApsAlert; - // (undocumented) - export type BatchResponse = BatchResponse; - // (undocumented) - export type ConditionMessage = ConditionMessage; - // (undocumented) - export type CriticalSound = CriticalSound; - // (undocumented) - export type DataMessagePayload = DataMessagePayload; - // (undocumented) - export type FcmOptions = FcmOptions; - // (undocumented) - export type LightSettings = LightSettings; - // (undocumented) - export type Message = Message; - // (undocumented) - export type Messaging = Messaging; - // (undocumented) - export type MessagingConditionResponse = MessagingConditionResponse; - // (undocumented) - export type MessagingDeviceGroupResponse = MessagingDeviceGroupResponse; - // (undocumented) - export type MessagingDeviceResult = MessagingDeviceResult; - // (undocumented) - export type MessagingDevicesResponse = MessagingDevicesResponse; - // (undocumented) - export type MessagingOptions = MessagingOptions; - // (undocumented) - export type MessagingPayload = MessagingPayload; - // (undocumented) - export type MessagingTopicManagementResponse = MessagingTopicManagementResponse; - // (undocumented) - export type MessagingTopicResponse = MessagingTopicResponse; - // (undocumented) - export type MulticastMessage = MulticastMessage; - // (undocumented) - export type Notification = Notification; - // (undocumented) - export type NotificationMessagePayload = NotificationMessagePayload; - // (undocumented) - export type SendResponse = SendResponse; - // (undocumented) - export type TokenMessage = TokenMessage; - // (undocumented) - export type TopicMessage = TopicMessage; - // (undocumented) - export type WebpushConfig = WebpushConfig; - // (undocumented) - export type WebpushFcmOptions = WebpushFcmOptions; - // (undocumented) - export type WebpushNotification = WebpushNotification; -} - // @public export interface MessagingConditionResponse { messageId: number; diff --git a/etc/firebase-admin.project-management.api.md b/etc/firebase-admin.project-management.api.md index eb166be66c..4b69129073 100644 --- a/etc/firebase-admin.project-management.api.md +++ b/etc/firebase-admin.project-management.api.md @@ -77,29 +77,6 @@ export class ProjectManagement { shaCertificate(shaHash: string): ShaCertificate; } -// @public -export function projectManagement(app?: App): projectManagement.ProjectManagement; - -// @public (undocumented) -export namespace projectManagement { - // (undocumented) - export type AndroidApp = AndroidApp; - // (undocumented) - export type AndroidAppMetadata = AndroidAppMetadata; - // (undocumented) - export type AppMetadata = AppMetadata; - // (undocumented) - export type AppPlatform = AppPlatform; - // (undocumented) - export type IosApp = IosApp; - // (undocumented) - export type IosAppMetadata = IosAppMetadata; - // (undocumented) - export type ProjectManagement = ProjectManagement; - // (undocumented) - export type ShaCertificate = ShaCertificate; -} - // @public export class ShaCertificate { readonly certType: ('sha1' | 'sha256'); diff --git a/etc/firebase-admin.remote-config.api.md b/etc/firebase-admin.remote-config.api.md index 063c2b4167..d85e53d66f 100644 --- a/etc/firebase-admin.remote-config.api.md +++ b/etc/firebase-admin.remote-config.api.md @@ -51,39 +51,6 @@ export class RemoteConfig { validateTemplate(template: RemoteConfigTemplate): Promise; } -// @public -export function remoteConfig(app?: App): remoteConfig.RemoteConfig; - -// @public (undocumented) -export namespace remoteConfig { - // (undocumented) - export type ExplicitParameterValue = ExplicitParameterValue; - // (undocumented) - export type InAppDefaultValue = InAppDefaultValue; - // (undocumented) - export type ListVersionsOptions = ListVersionsOptions; - // (undocumented) - export type ListVersionsResult = ListVersionsResult; - // (undocumented) - export type RemoteConfig = RemoteConfig; - // (undocumented) - export type RemoteConfigCondition = RemoteConfigCondition; - // (undocumented) - export type RemoteConfigParameter = RemoteConfigParameter; - // (undocumented) - export type RemoteConfigParameterGroup = RemoteConfigParameterGroup; - // (undocumented) - export type RemoteConfigParameterValue = RemoteConfigParameterValue; - // (undocumented) - export type RemoteConfigTemplate = RemoteConfigTemplate; - // (undocumented) - export type RemoteConfigUser = RemoteConfigUser; - // (undocumented) - export type TagColor = TagColor; - // (undocumented) - export type Version = Version; -} - // @public export interface RemoteConfigCondition { expression: string; diff --git a/etc/firebase-admin.security-rules.api.md b/etc/firebase-admin.security-rules.api.md index bef96e2edf..9fb95e3493 100644 --- a/etc/firebase-admin.security-rules.api.md +++ b/etc/firebase-admin.security-rules.api.md @@ -56,23 +56,6 @@ export class SecurityRules { releaseStorageRulesetFromSource(source: string | Buffer, bucket?: string): Promise; } -// @public -export function securityRules(app?: App): securityRules.SecurityRules; - -// @public (undocumented) -export namespace securityRules { - // (undocumented) - export type Ruleset = Ruleset; - // (undocumented) - export type RulesetMetadata = RulesetMetadata; - // (undocumented) - export type RulesetMetadataList = RulesetMetadataList; - // (undocumented) - export type RulesFile = RulesFile; - // (undocumented) - export type SecurityRules = SecurityRules; -} - // (No @packageDocumentation comment for this package) diff --git a/etc/firebase-admin.storage.api.md b/etc/firebase-admin.storage.api.md index f5049af101..b0b7199eb7 100644 --- a/etc/firebase-admin.storage.api.md +++ b/etc/firebase-admin.storage.api.md @@ -18,15 +18,6 @@ export class Storage { bucket(name?: string): Bucket; } -// @public -export function storage(app?: App): storage.Storage; - -// @public (undocumented) -export namespace storage { - // (undocumented) - export type Storage = Storage; -} - // (No @packageDocumentation comment for this package) diff --git a/src/app/firebase-namespace.ts b/src/app/firebase-namespace.ts index 502a864929..f7c0280d53 100644 --- a/src/app/firebase-namespace.ts +++ b/src/app/firebase-namespace.ts @@ -18,22 +18,14 @@ import fs = require('fs'); import { AppErrorCodes, FirebaseAppError } from '../utils/error'; -import { AppOptions, app } from '../firebase-namespace-api'; +import { + app, auth, messaging, machineLearning, storage, firestore, database, + instanceId, projectManagement, securityRules , remoteConfig, AppOptions, +} from '../firebase-namespace-api'; import { FirebaseApp } from './firebase-app'; import { cert, refreshToken, applicationDefault } from './credential-factory'; import { getApplicationDefault } from './credential-internal'; -import { auth } from '../auth/index'; -import { database } from '../database/index'; -import { firestore } from '../firestore/index'; -import { instanceId } from '../instance-id/index'; -import { machineLearning } from '../machine-learning/index'; -import { messaging } from '../messaging/index'; -import { projectManagement } from '../project-management/index'; -import { remoteConfig } from '../remote-config/index'; -import { securityRules } from '../security-rules/index'; -import { storage } from '../storage/index'; - import * as validator from '../utils/validator'; import { getSdkVersion } from '../utils/index'; diff --git a/src/auth/auth-namespace.ts b/src/auth/auth-namespace.ts index 7924bcf479..59c7e31211 100644 --- a/src/auth/auth-namespace.ts +++ b/src/auth/auth-namespace.ts @@ -14,9 +14,7 @@ * limitations under the License. */ -import { App, getApp } from '../app/index'; -import { Auth } from './auth'; -import { FirebaseApp } from '../app/firebase-app'; +import { App } from '../app/index'; // Import all public types with aliases, and re-export from the auth namespace. @@ -95,36 +93,6 @@ import { UserRecord as TUserRecord, } from './user-record'; -/** - * Gets the {@link auth.Auth `Auth`} service for the default app or a - * given app. - * - * `getAuth()` can be called with no arguments to access the default app's - * {@link auth.Auth `Auth`} service or as `getAuth(app)` to access the - * {@link auth.Auth `Auth`} service associated with a specific app. - * - * @example - * ```javascript - * // Get the Auth service for the default app - * const defaultAuth = getAuth(); - * ``` - * - * @example - * ```javascript - * // Get the Auth service for a given app - * const otherAuth = getAuth(otherApp); - * ``` - * - */ -export function getAuth(app?: App): Auth { - if (typeof app === 'undefined') { - app = getApp(); - } - - const firebaseApp: FirebaseApp = app as FirebaseApp; - return firebaseApp.getOrInitService('auth', (app) => new Auth(app)); -} - /** * Gets the {@link auth.Auth `Auth`} service for the default app or a * given app. diff --git a/src/auth/base-auth.ts b/src/auth/base-auth.ts index fd6dcd39c2..c3a4f406e5 100644 --- a/src/auth/base-auth.ts +++ b/src/auth/base-auth.ts @@ -14,8 +14,7 @@ * limitations under the License. */ -import { App } from '../app'; -import { FirebaseArrayIndexError } from '../firebase-namespace-api'; +import { App, FirebaseArrayIndexError } from '../app'; import { AuthClientErrorCode, ErrorInfo, FirebaseAuthError } from '../utils/error'; import * as validator from '../utils/validator'; diff --git a/src/auth/index.ts b/src/auth/index.ts index 619abf366c..403deafedf 100644 --- a/src/auth/index.ts +++ b/src/auth/index.ts @@ -14,6 +14,40 @@ * limitations under the License. */ +import { App, getApp } from '../app/index'; +import { FirebaseApp } from '../app/firebase-app'; +import { Auth } from './auth'; + +/** + * Gets the {@link auth.Auth `Auth`} service for the default app or a + * given app. + * + * `getAuth()` can be called with no arguments to access the default app's + * {@link auth.Auth `Auth`} service or as `getAuth(app)` to access the + * {@link auth.Auth `Auth`} service associated with a specific app. + * + * @example + * ```javascript + * // Get the Auth service for the default app + * const defaultAuth = getAuth(); + * ``` + * + * @example + * ```javascript + * // Get the Auth service for a given app + * const otherAuth = getAuth(otherApp); + * ``` + * + */ +export function getAuth(app?: App): Auth { + if (typeof app === 'undefined') { + app = getApp(); + } + + const firebaseApp: FirebaseApp = app as FirebaseApp; + return firebaseApp.getOrInitService('auth', (app) => new Auth(app)); +} + export { ActionCodeSettings } from './action-code-settings-builder'; export { @@ -90,5 +124,3 @@ export { UserMetadata, UserRecord, } from './user-record'; - -export { getAuth, auth } from './auth-namespace'; diff --git a/src/database/database-namespace.ts b/src/database/database-namespace.ts new file mode 100644 index 0000000000..b8882f8997 --- /dev/null +++ b/src/database/database-namespace.ts @@ -0,0 +1,71 @@ +/*! + * Copyright 2021 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as rtdb from '@firebase/database-types'; +import { App } from '../app'; +import { Database as TDatabase } from './database'; + +/** + * Gets the {@link database.Database `Database`} service for the default + * app or a given app. + * + * `admin.database()` can be called with no arguments to access the default + * app's {@link database.Database `Database`} service or as + * `admin.database(app)` to access the + * {@link database.Database `Database`} service associated with a specific + * app. + * + * `admin.database` is also a namespace that can be used to access global + * constants and methods associated with the `Database` service. + * + * @example + * ```javascript + * // Get the Database service for the default app + * var defaultDatabase = admin.database(); + * ``` + * + * @example + * ```javascript + * // Get the Database service for a specific app + * var otherDatabase = admin.database(app); + * ``` + * + * @param App whose `Database` service to + * return. If not provided, the default `Database` service will be returned. + * + * @return The default `Database` service if no app + * is provided or the `Database` service associated with the provided app. + */ +export declare function database(app?: App): database.Database; + +/* eslint-disable @typescript-eslint/no-namespace */ +export namespace database { + export type Database = TDatabase; + export type DataSnapshot = rtdb.DataSnapshot; + export type EventType = rtdb.EventType; + export type OnDisconnect = rtdb.OnDisconnect; + export type Query = rtdb.Query; + export type Reference = rtdb.Reference; + export type ThenableReference = rtdb.ThenableReference; + + export declare const enableLogging: typeof rtdb.enableLogging; + + /** + * [`ServerValue`](https://firebase.google.com/docs/reference/js/firebase.database.ServerValue) + * module from the `@firebase/database` package. + */ + export declare const ServerValue: rtdb.ServerValue; +} diff --git a/src/database/index.ts b/src/database/index.ts index 4cc274cf49..060a68c679 100644 --- a/src/database/index.ts +++ b/src/database/index.ts @@ -23,7 +23,6 @@ import { import { App, getApp } from '../app'; import { FirebaseApp } from '../app/firebase-app'; import { Database, DatabaseService } from './database'; -import { Database as TDatabase } from './database'; export { Database }; export { @@ -121,55 +120,3 @@ function getDatabaseInstance(options: { url?: string; app?: App }): Database { const dbService = firebaseApp.getOrInitService('database', (app) => new DatabaseService(app)); return dbService.getDatabase(options.url); } - -/** - * Gets the {@link database.Database `Database`} service for the default - * app or a given app. - * - * `admin.database()` can be called with no arguments to access the default - * app's {@link database.Database `Database`} service or as - * `admin.database(app)` to access the - * {@link database.Database `Database`} service associated with a specific - * app. - * - * `admin.database` is also a namespace that can be used to access global - * constants and methods associated with the `Database` service. - * - * @example - * ```javascript - * // Get the Database service for the default app - * var defaultDatabase = admin.database(); - * ``` - * - * @example - * ```javascript - * // Get the Database service for a specific app - * var otherDatabase = admin.database(app); - * ``` - * - * @param App whose `Database` service to - * return. If not provided, the default `Database` service will be returned. - * - * @return The default `Database` service if no app - * is provided or the `Database` service associated with the provided app. - */ -export declare function database(app?: App): database.Database; - -/* eslint-disable @typescript-eslint/no-namespace */ -export namespace database { - export type Database = TDatabase; - export type DataSnapshot = rtdb.DataSnapshot; - export type EventType = rtdb.EventType; - export type OnDisconnect = rtdb.OnDisconnect; - export type Query = rtdb.Query; - export type Reference = rtdb.Reference; - export type ThenableReference = rtdb.ThenableReference; - - export declare const enableLogging: typeof rtdb.enableLogging; - - /** - * [`ServerValue`](https://firebase.google.com/docs/reference/js/firebase.database.ServerValue) - * module from the `@firebase/database` package. - */ - export declare const ServerValue: rtdb.ServerValue; -} diff --git a/src/default-namespace.d.ts b/src/default-namespace.d.ts index 188f904275..22ea79d419 100644 --- a/src/default-namespace.d.ts +++ b/src/default-namespace.d.ts @@ -14,15 +14,4 @@ * limitations under the License. */ -export * from './credential/index'; export * from './firebase-namespace-api'; -export { auth } from './auth/index'; -export { database } from './database/index'; -export { firestore } from './firestore/index'; -export { instanceId } from './instance-id/index'; -export { machineLearning } from './machine-learning/index'; -export { messaging } from './messaging/index'; -export { projectManagement } from './project-management/index'; -export { remoteConfig } from './remote-config/index'; -export { securityRules } from './security-rules/index'; -export { storage } from './storage/index'; diff --git a/src/firebase-namespace-api.ts b/src/firebase-namespace-api.ts index 798d8c426c..4bfe9298a2 100644 --- a/src/firebase-namespace-api.ts +++ b/src/firebase-namespace-api.ts @@ -1,5 +1,5 @@ /*! - * Copyright 2020 Google Inc. + * Copyright 2021 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,20 +14,20 @@ * limitations under the License. */ -import { auth } from './auth/index'; -import { database } from './database/index'; -import { firestore } from './firestore/index'; -import { instanceId } from './instance-id/index'; -import { machineLearning } from './machine-learning/index'; -import { messaging } from './messaging/index'; -import { projectManagement } from './project-management/index'; -import { remoteConfig } from './remote-config/index'; -import { securityRules } from './security-rules/index'; -import { storage } from './storage/index'; +import { auth } from './auth/auth-namespace'; +import { database } from './database/database-namespace'; +import { firestore } from './firestore/firestore-namespace'; +import { instanceId } from './instance-id/instance-id-namespace'; +import { machineLearning } from './machine-learning/machine-learning-namespace'; +import { messaging } from './messaging/messaging-namespace'; +import { projectManagement } from './project-management/project-management-namespace'; +import { remoteConfig } from './remote-config/remote-config-namespace'; +import { securityRules } from './security-rules/security-rules-namespace'; +import { storage } from './storage/storage-namespace'; import { App as AppCore, AppOptions } from './app/index'; -export * from './app/index'; +export { App, AppOptions, FirebaseError, FirebaseArrayIndexError } from './app/index'; // eslint-disable-next-line @typescript-eslint/no-namespace export namespace app { @@ -74,6 +74,18 @@ export namespace app { } } +export * from './credential/index'; +export { auth } from './auth/auth-namespace'; +export { database } from './database/database-namespace'; +export { firestore } from './firestore/firestore-namespace'; +export { instanceId } from './instance-id/instance-id-namespace'; +export { machineLearning } from './machine-learning/machine-learning-namespace'; +export { messaging } from './messaging/messaging-namespace'; +export { projectManagement } from './project-management/project-management-namespace'; +export { remoteConfig } from './remote-config/remote-config-namespace'; +export { securityRules } from './security-rules/security-rules-namespace'; +export { storage } from './storage/storage-namespace'; + // Declare other top-level members of the admin namespace below. Unfortunately, there's no // compile-time mechanism to ensure that the FirebaseNamespace class actually provides these // signatures. But this part of the API is quite small and stable. It should be easy enough to diff --git a/src/firestore/firestore-namespace.ts b/src/firestore/firestore-namespace.ts new file mode 100644 index 0000000000..5f1cef8cfa --- /dev/null +++ b/src/firestore/firestore-namespace.ts @@ -0,0 +1,57 @@ +/*! + * Copyright 2021 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as _firestore from '@google-cloud/firestore'; +import { App } from '../app'; + +export declare function firestore(app?: App): _firestore.Firestore; + +/* eslint-disable @typescript-eslint/no-namespace */ +export namespace firestore { + /* eslint-disable @typescript-eslint/no-unused-vars */ + // See https://github.com/typescript-eslint/typescript-eslint/issues/363 + export import v1beta1 = _firestore.v1beta1; + export import v1 = _firestore.v1; + + export import BulkWriter = _firestore.BulkWriter; + export import BulkWriterOptions = _firestore.BulkWriterOptions; + export import CollectionGroup = _firestore.CollectionGroup; + export import CollectionReference = _firestore.CollectionReference; + export import DocumentChangeType = _firestore.DocumentChangeType; + export import DocumentData = _firestore.DocumentData; + export import DocumentReference = _firestore.DocumentReference; + export import DocumentSnapshot = _firestore.DocumentSnapshot; + export import FieldPath = _firestore.FieldPath; + export import FieldValue = _firestore.FieldValue; + export import Firestore = _firestore.Firestore; + export import FirestoreDataConverter = _firestore.FirestoreDataConverter; + export import GeoPoint = _firestore.GeoPoint; + export import GrpcStatus = _firestore.GrpcStatus; + export import Precondition = _firestore.Precondition; + export import Query = _firestore.Query; + export import QueryDocumentSnapshot = _firestore.QueryDocumentSnapshot; + export import QueryPartition = _firestore.QueryPartition; + export import QuerySnapshot = _firestore.QuerySnapshot; + export import ReadOptions = _firestore.ReadOptions; + export import Settings = _firestore.Settings; + export import Timestamp = _firestore.Timestamp; + export import Transaction = _firestore.Transaction; + export import UpdateData = _firestore.UpdateData; + export import WriteBatch = _firestore.WriteBatch; + export import WriteResult = _firestore.WriteResult; + + export import setLogFunction = _firestore.setLogFunction; +} diff --git a/src/firestore/index.ts b/src/firestore/index.ts index ebfb3243dc..50f2562c18 100644 --- a/src/firestore/index.ts +++ b/src/firestore/index.ts @@ -60,42 +60,3 @@ export function getFirestore(app?: App): _firestore.Firestore { 'firestore', (app) => new FirestoreService(app)); return firestoreService.client; } - -export declare function firestore(app?: App): _firestore.Firestore; - -/* eslint-disable @typescript-eslint/no-namespace */ -export namespace firestore { - /* eslint-disable @typescript-eslint/no-unused-vars */ - // See https://github.com/typescript-eslint/typescript-eslint/issues/363 - export import v1beta1 = _firestore.v1beta1; - export import v1 = _firestore.v1; - - export import BulkWriter = _firestore.BulkWriter; - export import BulkWriterOptions = _firestore.BulkWriterOptions; - export import CollectionGroup = _firestore.CollectionGroup; - export import CollectionReference = _firestore.CollectionReference; - export import DocumentChangeType = _firestore.DocumentChangeType; - export import DocumentData = _firestore.DocumentData; - export import DocumentReference = _firestore.DocumentReference; - export import DocumentSnapshot = _firestore.DocumentSnapshot; - export import FieldPath = _firestore.FieldPath; - export import FieldValue = _firestore.FieldValue; - export import Firestore = _firestore.Firestore; - export import FirestoreDataConverter = _firestore.FirestoreDataConverter; - export import GeoPoint = _firestore.GeoPoint; - export import GrpcStatus = _firestore.GrpcStatus; - export import Precondition = _firestore.Precondition; - export import Query = _firestore.Query; - export import QueryDocumentSnapshot = _firestore.QueryDocumentSnapshot; - export import QueryPartition = _firestore.QueryPartition; - export import QuerySnapshot = _firestore.QuerySnapshot; - export import ReadOptions = _firestore.ReadOptions; - export import Settings = _firestore.Settings; - export import Timestamp = _firestore.Timestamp; - export import Transaction = _firestore.Transaction; - export import UpdateData = _firestore.UpdateData; - export import WriteBatch = _firestore.WriteBatch; - export import WriteResult = _firestore.WriteResult; - - export import setLogFunction = _firestore.setLogFunction; -} diff --git a/src/instance-id/index.ts b/src/instance-id/index.ts index ef7a56b997..c6ce147f80 100644 --- a/src/instance-id/index.ts +++ b/src/instance-id/index.ts @@ -58,42 +58,3 @@ export function getInstanceId(app?: App): InstanceId { const firebaseApp: FirebaseApp = app as FirebaseApp; return firebaseApp.getOrInitService('instanceId', (app) => new InstanceId(app)); } - -/** - * Gets the {@link instanceId.InstanceId `InstanceId`} service for the - * default app or a given app. - * - * `admin.instanceId()` can be called with no arguments to access the default - * app's {@link instanceId.InstanceId `InstanceId`} service or as - * `admin.instanceId(app)` to access the - * {@link instanceId.InstanceId `InstanceId`} service associated with a - * specific app. - * - * @example - * ```javascript - * // Get the Instance ID service for the default app - * var defaultInstanceId = admin.instanceId(); - * ``` - * - * @example - * ```javascript - * // Get the Instance ID service for a given app - * var otherInstanceId = admin.instanceId(otherApp); - *``` - * - * @param app Optional app whose `InstanceId` service to - * return. If not provided, the default `InstanceId` service will be - * returned. - * - * @return The default `InstanceId` service if - * no app is provided or the `InstanceId` service associated with the - * provided app. - */ -export declare function instanceId(app?: App): instanceId.InstanceId; - -import { InstanceId as TInstanceId } from './instance-id'; - -/* eslint-disable @typescript-eslint/no-namespace */ -export namespace instanceId { - export type InstanceId = TInstanceId; -} diff --git a/src/instance-id/instance-id-namespace.ts b/src/instance-id/instance-id-namespace.ts new file mode 100644 index 0000000000..74b367a595 --- /dev/null +++ b/src/instance-id/instance-id-namespace.ts @@ -0,0 +1,39 @@ +import { App } from '../app/index'; +import { InstanceId as TInstanceId } from './instance-id'; + +/** + * Gets the {@link instanceId.InstanceId `InstanceId`} service for the + * default app or a given app. + * + * `admin.instanceId()` can be called with no arguments to access the default + * app's {@link instanceId.InstanceId `InstanceId`} service or as + * `admin.instanceId(app)` to access the + * {@link instanceId.InstanceId `InstanceId`} service associated with a + * specific app. + * + * @example + * ```javascript + * // Get the Instance ID service for the default app + * var defaultInstanceId = admin.instanceId(); + * ``` + * + * @example + * ```javascript + * // Get the Instance ID service for a given app + * var otherInstanceId = admin.instanceId(otherApp); + *``` + * + * @param app Optional app whose `InstanceId` service to + * return. If not provided, the default `InstanceId` service will be + * returned. + * + * @return The default `InstanceId` service if + * no app is provided or the `InstanceId` service associated with the + * provided app. + */ +export declare function instanceId(app?: App): instanceId.InstanceId; + +/* eslint-disable @typescript-eslint/no-namespace */ +export namespace instanceId { + export type InstanceId = TInstanceId; +} diff --git a/src/machine-learning/index.ts b/src/machine-learning/index.ts index e3cdf83d65..279273d301 100644 --- a/src/machine-learning/index.ts +++ b/src/machine-learning/index.ts @@ -69,62 +69,3 @@ export function getMachineLearning(app?: App): MachineLearning { const firebaseApp: FirebaseApp = app as FirebaseApp; return firebaseApp.getOrInitService('machineLearning', (app) => new MachineLearning(app)); } - -import { - ListModelsResult as TListModelsResult, - MachineLearning as TMachineLearning, - Model as TModel, - TFLiteModel as TTFLiteModel, -} from './machine-learning'; -import { - AutoMLTfliteModelOptions as TAutoMLTfliteModelOptions, - GcsTfliteModelOptions as TGcsTfliteModelOptions, - ListModelsOptions as TListModelsOptions, - ModelOptions as TModelOptions, - ModelOptionsBase as TModelOptionsBase, -} from './machine-learning-api-client'; - -/** - * Gets the {@link machineLearning.MachineLearning `MachineLearning`} service for the - * default app or a given app. - * - * `admin.machineLearning()` can be called with no arguments to access the - * default app's {@link machineLearning.MachineLearning - * `MachineLearning`} service or as `admin.machineLearning(app)` to access - * the {@link machineLearning.MachineLearning `MachineLearning`} - * service associated with a specific app. - * - * @example - * ```javascript - * // Get the MachineLearning service for the default app - * var defaultMachineLearning = admin.machineLearning(); - * ``` - * - * @example - * ```javascript - * // Get the MachineLearning service for a given app - * var otherMachineLearning = admin.machineLearning(otherApp); - * ``` - * - * @param app Optional app whose `MachineLearning` service to - * return. If not provided, the default `MachineLearning` service - * will be returned. - * - * @return The default `MachineLearning` service if no app is provided or the - * `MachineLearning` service associated with the provided app. - */ -export declare function machineLearning(app?: App): machineLearning.MachineLearning; - -/* eslint-disable @typescript-eslint/no-namespace */ -export namespace machineLearning { - export type ListModelsResult = TListModelsResult; - export type MachineLearning = TMachineLearning; - export type Model = TModel; - export type TFLiteModel = TTFLiteModel; - - export type AutoMLTfliteModelOptions = TAutoMLTfliteModelOptions; - export type GcsTfliteModelOptions = TGcsTfliteModelOptions; - export type ListModelsOptions = TListModelsOptions; - export type ModelOptions = TModelOptions; - export type ModelOptionsBase = TModelOptionsBase; -} diff --git a/src/machine-learning/machine-learning-namespace.ts b/src/machine-learning/machine-learning-namespace.ts new file mode 100644 index 0000000000..021b6ca6aa --- /dev/null +++ b/src/machine-learning/machine-learning-namespace.ts @@ -0,0 +1,75 @@ +/*! + * Copyright 2021 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { App } from '../app'; +import { + ListModelsResult as TListModelsResult, + MachineLearning as TMachineLearning, + Model as TModel, + TFLiteModel as TTFLiteModel, +} from './machine-learning'; +import { + AutoMLTfliteModelOptions as TAutoMLTfliteModelOptions, + GcsTfliteModelOptions as TGcsTfliteModelOptions, + ListModelsOptions as TListModelsOptions, + ModelOptions as TModelOptions, + ModelOptionsBase as TModelOptionsBase, +} from './machine-learning-api-client'; + +/** + * Gets the {@link machineLearning.MachineLearning `MachineLearning`} service for the + * default app or a given app. + * + * `admin.machineLearning()` can be called with no arguments to access the + * default app's {@link machineLearning.MachineLearning + * `MachineLearning`} service or as `admin.machineLearning(app)` to access + * the {@link machineLearning.MachineLearning `MachineLearning`} + * service associated with a specific app. + * + * @example + * ```javascript + * // Get the MachineLearning service for the default app + * var defaultMachineLearning = admin.machineLearning(); + * ``` + * + * @example + * ```javascript + * // Get the MachineLearning service for a given app + * var otherMachineLearning = admin.machineLearning(otherApp); + * ``` + * + * @param app Optional app whose `MachineLearning` service to + * return. If not provided, the default `MachineLearning` service + * will be returned. + * + * @return The default `MachineLearning` service if no app is provided or the + * `MachineLearning` service associated with the provided app. + */ +export declare function machineLearning(app?: App): machineLearning.MachineLearning; + +/* eslint-disable @typescript-eslint/no-namespace */ +export namespace machineLearning { + export type ListModelsResult = TListModelsResult; + export type MachineLearning = TMachineLearning; + export type Model = TModel; + export type TFLiteModel = TTFLiteModel; + + export type AutoMLTfliteModelOptions = TAutoMLTfliteModelOptions; + export type GcsTfliteModelOptions = TGcsTfliteModelOptions; + export type ListModelsOptions = TListModelsOptions; + export type ModelOptions = TModelOptions; + export type ModelOptionsBase = TModelOptionsBase; +} diff --git a/src/messaging/index.ts b/src/messaging/index.ts index 5d799cf6b0..b64559e9f7 100644 --- a/src/messaging/index.ts +++ b/src/messaging/index.ts @@ -97,112 +97,3 @@ export function getMessaging(app?: App): Messaging { const firebaseApp: FirebaseApp = app as FirebaseApp; return firebaseApp.getOrInitService('messaging', (app) => new Messaging(app)); } - -import { Messaging as TMessaging } from './messaging'; -import { - AndroidConfig as TAndroidConfig, - AndroidFcmOptions as TAndroidFcmOptions, - AndroidNotification as TAndroidNotification, - ApnsConfig as TApnsConfig, - ApnsFcmOptions as TApnsFcmOptions, - ApnsPayload as TApnsPayload, - Aps as TAps, - ApsAlert as TApsAlert, - BatchResponse as TBatchResponse, - CriticalSound as TCriticalSound, - ConditionMessage as TConditionMessage, - FcmOptions as TFcmOptions, - LightSettings as TLightSettings, - Message as TMessage, - MessagingTopicManagementResponse as TMessagingTopicManagementResponse, - MulticastMessage as TMulticastMessage, - Notification as TNotification, - SendResponse as TSendResponse, - TokenMessage as TTokenMessage, - TopicMessage as TTopicMessage, - WebpushConfig as TWebpushConfig, - WebpushFcmOptions as TWebpushFcmOptions, - WebpushNotification as TWebpushNotification, - - // Legacy APIs - DataMessagePayload as TDataMessagePayload, - MessagingConditionResponse as TMessagingConditionResponse, - MessagingDeviceGroupResponse as TMessagingDeviceGroupResponse, - MessagingDeviceResult as TMessagingDeviceResult, - MessagingDevicesResponse as TMessagingDevicesResponse, - MessagingOptions as TMessagingOptions, - MessagingPayload as TMessagingPayload, - MessagingTopicResponse as TMessagingTopicResponse, - NotificationMessagePayload as TNotificationMessagePayload, -} from './messaging-api'; - -/** - * Gets the {@link messaging.Messaging `Messaging`} service for the - * default app or a given app. - * - * `admin.messaging()` can be called with no arguments to access the default - * app's {@link messaging.Messaging `Messaging`} service or as - * `admin.messaging(app)` to access the - * {@link messaging.Messaging `Messaging`} service associated with a - * specific app. - * - * @example - * ```javascript - * // Get the Messaging service for the default app - * var defaultMessaging = admin.messaging(); - * ``` - * - * @example - * ```javascript - * // Get the Messaging service for a given app - * var otherMessaging = admin.messaging(otherApp); - * ``` - * - * @param app Optional app whose `Messaging` service to - * return. If not provided, the default `Messaging` service will be returned. - * - * @return The default `Messaging` service if no - * app is provided or the `Messaging` service associated with the provided - * app. - */ -export declare function messaging(app?: App): messaging.Messaging; - -/* eslint-disable @typescript-eslint/no-namespace */ -export namespace messaging { - export type Messaging = TMessaging; - - export type AndroidConfig = TAndroidConfig; - export type AndroidFcmOptions = TAndroidFcmOptions; - export type AndroidNotification = TAndroidNotification; - export type ApnsConfig = TApnsConfig; - export type ApnsFcmOptions = TApnsFcmOptions; - export type ApnsPayload = TApnsPayload; - export type Aps = TAps; - export type ApsAlert = TApsAlert; - export type BatchResponse = TBatchResponse; - export type CriticalSound = TCriticalSound; - export type ConditionMessage = TConditionMessage; - export type FcmOptions = TFcmOptions; - export type LightSettings = TLightSettings; - export type Message = TMessage; - export type MessagingTopicManagementResponse = TMessagingTopicManagementResponse; - export type MulticastMessage = TMulticastMessage; - export type Notification = TNotification; - export type SendResponse = TSendResponse; - export type TokenMessage = TTokenMessage; - export type TopicMessage = TTopicMessage; - export type WebpushConfig = TWebpushConfig; - export type WebpushFcmOptions = TWebpushFcmOptions; - export type WebpushNotification = TWebpushNotification; - - // Legacy APIs - export type DataMessagePayload = TDataMessagePayload; - export type MessagingConditionResponse = TMessagingConditionResponse; - export type MessagingDeviceGroupResponse = TMessagingDeviceGroupResponse; - export type MessagingDeviceResult = TMessagingDeviceResult; - export type MessagingDevicesResponse = TMessagingDevicesResponse; - export type MessagingOptions = TMessagingOptions; - export type MessagingPayload = TMessagingPayload; - export type MessagingTopicResponse = TMessagingTopicResponse; - export type NotificationMessagePayload = TNotificationMessagePayload; -} diff --git a/src/messaging/messaging-namespace.ts b/src/messaging/messaging-namespace.ts new file mode 100644 index 0000000000..b49fdb564a --- /dev/null +++ b/src/messaging/messaging-namespace.ts @@ -0,0 +1,125 @@ +/*! + * Copyright 2021 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { App } from '../app'; +import { Messaging as TMessaging } from './messaging'; +import { + AndroidConfig as TAndroidConfig, + AndroidFcmOptions as TAndroidFcmOptions, + AndroidNotification as TAndroidNotification, + ApnsConfig as TApnsConfig, + ApnsFcmOptions as TApnsFcmOptions, + ApnsPayload as TApnsPayload, + Aps as TAps, + ApsAlert as TApsAlert, + BatchResponse as TBatchResponse, + CriticalSound as TCriticalSound, + ConditionMessage as TConditionMessage, + FcmOptions as TFcmOptions, + LightSettings as TLightSettings, + Message as TMessage, + MessagingTopicManagementResponse as TMessagingTopicManagementResponse, + MulticastMessage as TMulticastMessage, + Notification as TNotification, + SendResponse as TSendResponse, + TokenMessage as TTokenMessage, + TopicMessage as TTopicMessage, + WebpushConfig as TWebpushConfig, + WebpushFcmOptions as TWebpushFcmOptions, + WebpushNotification as TWebpushNotification, + + // Legacy APIs + DataMessagePayload as TDataMessagePayload, + MessagingConditionResponse as TMessagingConditionResponse, + MessagingDeviceGroupResponse as TMessagingDeviceGroupResponse, + MessagingDeviceResult as TMessagingDeviceResult, + MessagingDevicesResponse as TMessagingDevicesResponse, + MessagingOptions as TMessagingOptions, + MessagingPayload as TMessagingPayload, + MessagingTopicResponse as TMessagingTopicResponse, + NotificationMessagePayload as TNotificationMessagePayload, +} from './messaging-api'; + +/** + * Gets the {@link messaging.Messaging `Messaging`} service for the + * default app or a given app. + * + * `admin.messaging()` can be called with no arguments to access the default + * app's {@link messaging.Messaging `Messaging`} service or as + * `admin.messaging(app)` to access the + * {@link messaging.Messaging `Messaging`} service associated with a + * specific app. + * + * @example + * ```javascript + * // Get the Messaging service for the default app + * var defaultMessaging = admin.messaging(); + * ``` + * + * @example + * ```javascript + * // Get the Messaging service for a given app + * var otherMessaging = admin.messaging(otherApp); + * ``` + * + * @param app Optional app whose `Messaging` service to + * return. If not provided, the default `Messaging` service will be returned. + * + * @return The default `Messaging` service if no + * app is provided or the `Messaging` service associated with the provided + * app. + */ +export declare function messaging(app?: App): messaging.Messaging; + +/* eslint-disable @typescript-eslint/no-namespace */ +export namespace messaging { + export type Messaging = TMessaging; + + export type AndroidConfig = TAndroidConfig; + export type AndroidFcmOptions = TAndroidFcmOptions; + export type AndroidNotification = TAndroidNotification; + export type ApnsConfig = TApnsConfig; + export type ApnsFcmOptions = TApnsFcmOptions; + export type ApnsPayload = TApnsPayload; + export type Aps = TAps; + export type ApsAlert = TApsAlert; + export type BatchResponse = TBatchResponse; + export type CriticalSound = TCriticalSound; + export type ConditionMessage = TConditionMessage; + export type FcmOptions = TFcmOptions; + export type LightSettings = TLightSettings; + export type Message = TMessage; + export type MessagingTopicManagementResponse = TMessagingTopicManagementResponse; + export type MulticastMessage = TMulticastMessage; + export type Notification = TNotification; + export type SendResponse = TSendResponse; + export type TokenMessage = TTokenMessage; + export type TopicMessage = TTopicMessage; + export type WebpushConfig = TWebpushConfig; + export type WebpushFcmOptions = TWebpushFcmOptions; + export type WebpushNotification = TWebpushNotification; + + // Legacy APIs + export type DataMessagePayload = TDataMessagePayload; + export type MessagingConditionResponse = TMessagingConditionResponse; + export type MessagingDeviceGroupResponse = TMessagingDeviceGroupResponse; + export type MessagingDeviceResult = TMessagingDeviceResult; + export type MessagingDevicesResponse = TMessagingDevicesResponse; + export type MessagingOptions = TMessagingOptions; + export type MessagingPayload = TMessagingPayload; + export type MessagingTopicResponse = TMessagingTopicResponse; + export type NotificationMessagePayload = TNotificationMessagePayload; +} diff --git a/src/project-management/index.ts b/src/project-management/index.ts index 35cbe3b4c1..97ff5c203c 100644 --- a/src/project-management/index.ts +++ b/src/project-management/index.ts @@ -59,60 +59,3 @@ export function getProjectManagement(app?: App): ProjectManagement { const firebaseApp: FirebaseApp = app as FirebaseApp; return firebaseApp.getOrInitService('projectManagement', (app) => new ProjectManagement(app)); } - -/** - * Gets the {@link projectManagement.ProjectManagement - * `ProjectManagement`} service for the default app or a given app. - * - * `admin.projectManagement()` can be called with no arguments to access the - * default app's {@link projectManagement.ProjectManagement - * `ProjectManagement`} service, or as `admin.projectManagement(app)` to access - * the {@link projectManagement.ProjectManagement `ProjectManagement`} - * service associated with a specific app. - * - * @example - * ```javascript - * // Get the ProjectManagement service for the default app - * var defaultProjectManagement = admin.projectManagement(); - * ``` - * - * @example - * ```javascript - * // Get the ProjectManagement service for a given app - * var otherProjectManagement = admin.projectManagement(otherApp); - * ``` - * - * @param app Optional app whose `ProjectManagement` service - * to return. If not provided, the default `ProjectManagement` service will - * be returned. * - * @return The default `ProjectManagement` service if no app is provided or the - * `ProjectManagement` service associated with the provided app. - */ -export declare function projectManagement(app?: App): projectManagement.ProjectManagement; - -import { - AppMetadata as TAppMetadata, - AppPlatform as TAppPlatform, -} from './app-metadata'; -import { ProjectManagement as TProjectManagement } from './project-management'; -import { - AndroidApp as TAndroidApp, - AndroidAppMetadata as TAndroidAppMetadata, - ShaCertificate as TShaCertificate, -} from './android-app'; -import { - IosApp as TIosApp, - IosAppMetadata as TIosAppMetadata, -} from './ios-app'; - -/* eslint-disable @typescript-eslint/no-namespace */ -export namespace projectManagement { - export type AppMetadata = TAppMetadata; - export type AppPlatform = TAppPlatform; - export type ProjectManagement = TProjectManagement; - export type IosApp = TIosApp; - export type IosAppMetadata = TIosAppMetadata; - export type AndroidApp = TAndroidApp; - export type AndroidAppMetadata = TAndroidAppMetadata; - export type ShaCertificate = TShaCertificate; -} diff --git a/src/project-management/project-management-namespace.ts b/src/project-management/project-management-namespace.ts new file mode 100644 index 0000000000..e37903cda8 --- /dev/null +++ b/src/project-management/project-management-namespace.ts @@ -0,0 +1,73 @@ +/*! + * Copyright 2021 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { App } from '../app'; +import { + AppMetadata as TAppMetadata, + AppPlatform as TAppPlatform, +} from './app-metadata'; +import { ProjectManagement as TProjectManagement } from './project-management'; +import { + AndroidApp as TAndroidApp, + AndroidAppMetadata as TAndroidAppMetadata, + ShaCertificate as TShaCertificate, +} from './android-app'; +import { + IosApp as TIosApp, + IosAppMetadata as TIosAppMetadata, +} from './ios-app'; + +/** + * Gets the {@link projectManagement.ProjectManagement + * `ProjectManagement`} service for the default app or a given app. + * + * `admin.projectManagement()` can be called with no arguments to access the + * default app's {@link projectManagement.ProjectManagement + * `ProjectManagement`} service, or as `admin.projectManagement(app)` to access + * the {@link projectManagement.ProjectManagement `ProjectManagement`} + * service associated with a specific app. + * + * @example + * ```javascript + * // Get the ProjectManagement service for the default app + * var defaultProjectManagement = admin.projectManagement(); + * ``` + * + * @example + * ```javascript + * // Get the ProjectManagement service for a given app + * var otherProjectManagement = admin.projectManagement(otherApp); + * ``` + * + * @param app Optional app whose `ProjectManagement` service + * to return. If not provided, the default `ProjectManagement` service will + * be returned. * + * @return The default `ProjectManagement` service if no app is provided or the + * `ProjectManagement` service associated with the provided app. + */ +export declare function projectManagement(app?: App): projectManagement.ProjectManagement; + +/* eslint-disable @typescript-eslint/no-namespace */ +export namespace projectManagement { + export type AppMetadata = TAppMetadata; + export type AppPlatform = TAppPlatform; + export type ProjectManagement = TProjectManagement; + export type IosApp = TIosApp; + export type IosAppMetadata = TIosAppMetadata; + export type AndroidApp = TAndroidApp; + export type AndroidAppMetadata = TAndroidAppMetadata; + export type ShaCertificate = TShaCertificate; +} diff --git a/src/remote-config/index.ts b/src/remote-config/index.ts index e97803c68f..0d0d6e6612 100644 --- a/src/remote-config/index.ts +++ b/src/remote-config/index.ts @@ -71,67 +71,3 @@ export function getRemoteConfig(app?: App): RemoteConfig { const firebaseApp: FirebaseApp = app as FirebaseApp; return firebaseApp.getOrInitService('remoteConfig', (app) => new RemoteConfig(app)); } - -import { - ExplicitParameterValue as TExplicitParameterValue, - InAppDefaultValue as TInAppDefaultValue, - ListVersionsOptions as TListVersionsOptions, - ListVersionsResult as TListVersionsResult, - RemoteConfigCondition as TRemoteConfigCondition, - RemoteConfigParameter as TRemoteConfigParameter, - RemoteConfigParameterGroup as TRemoteConfigParameterGroup, - RemoteConfigParameterValue as TRemoteConfigParameterValue, - RemoteConfigTemplate as TRemoteConfigTemplate, - RemoteConfigUser as TRemoteConfigUser, - TagColor as TTagColor, - Version as TVersion, -} from './remote-config-api'; -import { RemoteConfig as TRemoteConfig } from './remote-config'; - -/** - * Gets the {@link remoteConfig.RemoteConfig `RemoteConfig`} service for the - * default app or a given app. - * - * `admin.remoteConfig()` can be called with no arguments to access the default - * app's {@link remoteConfig.RemoteConfig `RemoteConfig`} service or as - * `admin.remoteConfig(app)` to access the - * {@link remoteConfig.RemoteConfig `RemoteConfig`} service associated with a - * specific app. - * - * @example - * ```javascript - * // Get the `RemoteConfig` service for the default app - * var defaultRemoteConfig = admin.remoteConfig(); - * ``` - * - * @example - * ```javascript - * // Get the `RemoteConfig` service for a given app - * var otherRemoteConfig = admin.remoteConfig(otherApp); - * ``` - * - * @param app Optional app for which to return the `RemoteConfig` service. - * If not provided, the default `RemoteConfig` service is returned. - * - * @return The default `RemoteConfig` service if no - * app is provided, or the `RemoteConfig` service associated with the provided - * app. - */ -export declare function remoteConfig(app?: App): remoteConfig.RemoteConfig; - -/* eslint-disable @typescript-eslint/no-namespace */ -export namespace remoteConfig { - export type ExplicitParameterValue = TExplicitParameterValue; - export type InAppDefaultValue = TInAppDefaultValue; - export type ListVersionsOptions = TListVersionsOptions; - export type ListVersionsResult = TListVersionsResult; - export type RemoteConfig = TRemoteConfig; - export type RemoteConfigCondition = TRemoteConfigCondition; - export type RemoteConfigParameter = TRemoteConfigParameter; - export type RemoteConfigParameterGroup = TRemoteConfigParameterGroup; - export type RemoteConfigParameterValue = TRemoteConfigParameterValue; - export type RemoteConfigTemplate = TRemoteConfigTemplate; - export type RemoteConfigUser = TRemoteConfigUser; - export type TagColor = TTagColor; - export type Version = TVersion; -} diff --git a/src/remote-config/remote-config-namespace.ts b/src/remote-config/remote-config-namespace.ts new file mode 100644 index 0000000000..d50fcb0aee --- /dev/null +++ b/src/remote-config/remote-config-namespace.ts @@ -0,0 +1,80 @@ +/*! + * Copyright 2021 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { App } from '../app'; +import { + ExplicitParameterValue as TExplicitParameterValue, + InAppDefaultValue as TInAppDefaultValue, + ListVersionsOptions as TListVersionsOptions, + ListVersionsResult as TListVersionsResult, + RemoteConfigCondition as TRemoteConfigCondition, + RemoteConfigParameter as TRemoteConfigParameter, + RemoteConfigParameterGroup as TRemoteConfigParameterGroup, + RemoteConfigParameterValue as TRemoteConfigParameterValue, + RemoteConfigTemplate as TRemoteConfigTemplate, + RemoteConfigUser as TRemoteConfigUser, + TagColor as TTagColor, + Version as TVersion, +} from './remote-config-api'; +import { RemoteConfig as TRemoteConfig } from './remote-config'; + +/** + * Gets the {@link remoteConfig.RemoteConfig `RemoteConfig`} service for the + * default app or a given app. + * + * `admin.remoteConfig()` can be called with no arguments to access the default + * app's {@link remoteConfig.RemoteConfig `RemoteConfig`} service or as + * `admin.remoteConfig(app)` to access the + * {@link remoteConfig.RemoteConfig `RemoteConfig`} service associated with a + * specific app. + * + * @example + * ```javascript + * // Get the `RemoteConfig` service for the default app + * var defaultRemoteConfig = admin.remoteConfig(); + * ``` + * + * @example + * ```javascript + * // Get the `RemoteConfig` service for a given app + * var otherRemoteConfig = admin.remoteConfig(otherApp); + * ``` + * + * @param app Optional app for which to return the `RemoteConfig` service. + * If not provided, the default `RemoteConfig` service is returned. + * + * @return The default `RemoteConfig` service if no + * app is provided, or the `RemoteConfig` service associated with the provided + * app. + */ +export declare function remoteConfig(app?: App): remoteConfig.RemoteConfig; + +/* eslint-disable @typescript-eslint/no-namespace */ +export namespace remoteConfig { + export type ExplicitParameterValue = TExplicitParameterValue; + export type InAppDefaultValue = TInAppDefaultValue; + export type ListVersionsOptions = TListVersionsOptions; + export type ListVersionsResult = TListVersionsResult; + export type RemoteConfig = TRemoteConfig; + export type RemoteConfigCondition = TRemoteConfigCondition; + export type RemoteConfigParameter = TRemoteConfigParameter; + export type RemoteConfigParameterGroup = TRemoteConfigParameterGroup; + export type RemoteConfigParameterValue = TRemoteConfigParameterValue; + export type RemoteConfigTemplate = TRemoteConfigTemplate; + export type RemoteConfigUser = TRemoteConfigUser; + export type TagColor = TTagColor; + export type Version = TVersion; +} diff --git a/src/security-rules/index.ts b/src/security-rules/index.ts index 72582520d9..3537f6bf6a 100644 --- a/src/security-rules/index.ts +++ b/src/security-rules/index.ts @@ -26,14 +26,6 @@ export { SecurityRules, } from './security-rules'; -import { - RulesFile as TRulesFile, - Ruleset as TRuleset, - RulesetMetadata as TRulesetMetadata, - RulesetMetadataList as TRulesetMetadataList, - SecurityRules as TSecurityRules, -} from './security-rules'; - /** * Gets the {@link securityRules.SecurityRules * `SecurityRules`} service for the default app or a given app. @@ -70,42 +62,3 @@ export function getSecurityRules(app?: App): SecurityRules { const firebaseApp: FirebaseApp = app as FirebaseApp; return firebaseApp.getOrInitService('securityRules', (app) => new SecurityRules(app)); } - -/** - * Gets the {@link securityRules.SecurityRules - * `SecurityRules`} service for the default app or a given app. - * - * `admin.securityRules()` can be called with no arguments to access the - * default app's {@link securityRules.SecurityRules - * `SecurityRules`} service, or as `admin.securityRules(app)` to access - * the {@link securityRules.SecurityRules `SecurityRules`} - * service associated with a specific app. - * - * @example - * ```javascript - * // Get the SecurityRules service for the default app - * var defaultSecurityRules = admin.securityRules(); - * ``` - * - * @example - * ```javascript - * // Get the SecurityRules service for a given app - * var otherSecurityRules = admin.securityRules(otherApp); - * ``` - * - * @param app Optional app to return the `SecurityRules` service - * for. If not provided, the default `SecurityRules` service - * is returned. - * @return The default `SecurityRules` service if no app is provided, or the - * `SecurityRules` service associated with the provided app. - */ -export declare function securityRules(app?: App): securityRules.SecurityRules; - -/* eslint-disable @typescript-eslint/no-namespace */ -export namespace securityRules { - export type RulesFile = TRulesFile; - export type Ruleset = TRuleset; - export type RulesetMetadata = TRulesetMetadata; - export type RulesetMetadataList = TRulesetMetadataList; - export type SecurityRules = TSecurityRules; -} diff --git a/src/security-rules/security-rules-namespace.ts b/src/security-rules/security-rules-namespace.ts new file mode 100644 index 0000000000..6556440f54 --- /dev/null +++ b/src/security-rules/security-rules-namespace.ts @@ -0,0 +1,63 @@ +/*! + * Copyright 2021 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { App } from '../app'; +import { + RulesFile as TRulesFile, + Ruleset as TRuleset, + RulesetMetadata as TRulesetMetadata, + RulesetMetadataList as TRulesetMetadataList, + SecurityRules as TSecurityRules, +} from './security-rules'; + +/** + * Gets the {@link securityRules.SecurityRules + * `SecurityRules`} service for the default app or a given app. + * + * `admin.securityRules()` can be called with no arguments to access the + * default app's {@link securityRules.SecurityRules + * `SecurityRules`} service, or as `admin.securityRules(app)` to access + * the {@link securityRules.SecurityRules `SecurityRules`} + * service associated with a specific app. + * + * @example + * ```javascript + * // Get the SecurityRules service for the default app + * var defaultSecurityRules = admin.securityRules(); + * ``` + * + * @example + * ```javascript + * // Get the SecurityRules service for a given app + * var otherSecurityRules = admin.securityRules(otherApp); + * ``` + * + * @param app Optional app to return the `SecurityRules` service + * for. If not provided, the default `SecurityRules` service + * is returned. + * @return The default `SecurityRules` service if no app is provided, or the + * `SecurityRules` service associated with the provided app. + */ +export declare function securityRules(app?: App): securityRules.SecurityRules; + +/* eslint-disable @typescript-eslint/no-namespace */ +export namespace securityRules { + export type RulesFile = TRulesFile; + export type Ruleset = TRuleset; + export type RulesetMetadata = TRulesetMetadata; + export type RulesetMetadataList = TRulesetMetadataList; + export type SecurityRules = TSecurityRules; +} diff --git a/src/storage/index.ts b/src/storage/index.ts index 7310c1cf00..6eeca2a107 100644 --- a/src/storage/index.ts +++ b/src/storage/index.ts @@ -50,34 +50,3 @@ export function getStorage(app?: App): Storage { const firebaseApp: FirebaseApp = app as FirebaseApp; return firebaseApp.getOrInitService('storage', (app) => new Storage(app)); } - -import { Storage as TStorage } from './storage'; - -/** - * Gets the {@link storage.Storage `Storage`} service for the - * default app or a given app. - * - * `admin.storage()` can be called with no arguments to access the default - * app's {@link storage.Storage `Storage`} service or as - * `admin.storage(app)` to access the - * {@link storage.Storage `Storage`} service associated with a - * specific app. - * - * @example - * ```javascript - * // Get the Storage service for the default app - * var defaultStorage = admin.storage(); - * ``` - * - * @example - * ```javascript - * // Get the Storage service for a given app - * var otherStorage = admin.storage(otherApp); - * ``` - */ -export declare function storage(app?: App): storage.Storage; - -/* eslint-disable @typescript-eslint/no-namespace */ -export namespace storage { - export type Storage = TStorage; -} diff --git a/src/storage/storage-namespace.ts b/src/storage/storage-namespace.ts new file mode 100644 index 0000000000..1e78d076d6 --- /dev/null +++ b/src/storage/storage-namespace.ts @@ -0,0 +1,47 @@ +/*! + * Copyright 2021 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { App } from '../app'; +import { Storage as TStorage } from './storage'; + +/** + * Gets the {@link storage.Storage `Storage`} service for the + * default app or a given app. + * + * `admin.storage()` can be called with no arguments to access the default + * app's {@link storage.Storage `Storage`} service or as + * `admin.storage(app)` to access the + * {@link storage.Storage `Storage`} service associated with a + * specific app. + * + * @example + * ```javascript + * // Get the Storage service for the default app + * var defaultStorage = admin.storage(); + * ``` + * + * @example + * ```javascript + * // Get the Storage service for a given app + * var otherStorage = admin.storage(otherApp); + * ``` + */ +export declare function storage(app?: App): storage.Storage; + +/* eslint-disable @typescript-eslint/no-namespace */ +export namespace storage { + export type Storage = TStorage; +} diff --git a/src/utils/error.ts b/src/utils/error.ts index 232bed0981..3f8fa28495 100644 --- a/src/utils/error.ts +++ b/src/utils/error.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { FirebaseError as FireabseErrorInterface } from '../firebase-namespace-api'; +import { FirebaseError as FireabseErrorInterface } from '../app'; import { deepCopy } from '../utils/deep-copy'; /** diff --git a/test/unit/app/firebase-app.spec.ts b/test/unit/app/firebase-app.spec.ts index e3aaba5687..fe111993fd 100644 --- a/test/unit/app/firebase-app.spec.ts +++ b/test/unit/app/firebase-app.spec.ts @@ -32,17 +32,10 @@ import { FirebaseApp, FirebaseAccessToken } from '../../../src/app/firebase-app' import { FirebaseNamespace, FirebaseNamespaceInternals, FIREBASE_CONFIG_VAR } from '../../../src/app/firebase-namespace'; - -import { auth } from '../../../src/auth/index'; -import { messaging } from '../../../src/messaging/index'; -import { machineLearning } from '../../../src/machine-learning/index'; -import { storage } from '../../../src/storage/index'; -import { firestore } from '../../../src/firestore/index'; -import { database } from '../../../src/database/index'; -import { instanceId } from '../../../src/instance-id/index'; -import { projectManagement } from '../../../src/project-management/index'; -import { securityRules } from '../../../src/security-rules/index'; -import { remoteConfig } from '../../../src/remote-config/index'; +import { + auth, messaging, machineLearning, storage, firestore, database, + instanceId, projectManagement, securityRules , remoteConfig, +} from '../../../src/firebase-namespace-api'; import { FirebaseAppError, AppErrorCodes } from '../../../src/utils/error'; import Auth = auth.Auth; diff --git a/test/unit/app/firebase-namespace.spec.ts b/test/unit/app/firebase-namespace.spec.ts index a3aeb7b99c..e2daa62729 100644 --- a/test/unit/app/firebase-namespace.spec.ts +++ b/test/unit/app/firebase-namespace.spec.ts @@ -47,18 +47,10 @@ import { } from '@google-cloud/firestore'; import { getSdkVersion } from '../../../src/utils/index'; -import { app } from '../../../src/firebase-namespace-api'; -import { auth } from '../../../src/auth/index'; -import { messaging } from '../../../src/messaging/index'; -import { machineLearning } from '../../../src/machine-learning/index'; -import { storage } from '../../../src/storage/index'; -import { firestore } from '../../../src/firestore/index'; -import { database } from '../../../src/database/index'; -import { instanceId } from '../../../src/instance-id/index'; -import { projectManagement } from '../../../src/project-management/index'; -import { securityRules } from '../../../src/security-rules/index'; -import { remoteConfig } from '../../../src/remote-config/index'; - +import { + app, auth, messaging, machineLearning, storage, firestore, database, + instanceId, projectManagement, securityRules , remoteConfig, +} from '../../../src/firebase-namespace-api'; import { Auth as AuthImpl } from '../../../src/auth/auth'; import { InstanceId as InstanceIdImpl } from '../../../src/instance-id/instance-id'; import { MachineLearning as MachineLearningImpl } from '../../../src/machine-learning/machine-learning';