[core] add functions module to core + types
This commit is contained in:
parent
ca068dbbab
commit
30f23316c4
@ -16,6 +16,7 @@ import Crash, { NAMESPACE as CrashNamespace } from '../crash';
|
|||||||
import Crashlytics, { NAMESPACE as CrashlyticsNamespace } from '../crashlytics';
|
import Crashlytics, { NAMESPACE as CrashlyticsNamespace } from '../crashlytics';
|
||||||
import Database, { NAMESPACE as DatabaseNamespace } from '../database';
|
import Database, { NAMESPACE as DatabaseNamespace } from '../database';
|
||||||
import Firestore, { NAMESPACE as FirestoreNamespace } from '../firestore';
|
import Firestore, { NAMESPACE as FirestoreNamespace } from '../firestore';
|
||||||
|
import Functions, { NAMESPACE as FunctionsNamespace } from '../functions';
|
||||||
import InstanceId, { NAMESPACE as InstanceIdNamespace } from '../iid';
|
import InstanceId, { NAMESPACE as InstanceIdNamespace } from '../iid';
|
||||||
import Invites, { NAMESPACE as InvitesNamespace } from '../invites';
|
import Invites, { NAMESPACE as InvitesNamespace } from '../invites';
|
||||||
import Links, { NAMESPACE as LinksNamespace } from '../links';
|
import Links, { NAMESPACE as LinksNamespace } from '../links';
|
||||||
@ -45,6 +46,7 @@ export default class App {
|
|||||||
crashlytics: () => Crashlytics;
|
crashlytics: () => Crashlytics;
|
||||||
database: () => Database;
|
database: () => Database;
|
||||||
firestore: () => Firestore;
|
firestore: () => Firestore;
|
||||||
|
functions: () => Functions;
|
||||||
iid: () => InstanceId;
|
iid: () => InstanceId;
|
||||||
invites: () => Invites;
|
invites: () => Invites;
|
||||||
links: () => Links;
|
links: () => Links;
|
||||||
@ -85,6 +87,7 @@ export default class App {
|
|||||||
this.crashlytics = APPS.appModule(this, CrashlyticsNamespace, Crashlytics);
|
this.crashlytics = APPS.appModule(this, CrashlyticsNamespace, Crashlytics);
|
||||||
this.database = APPS.appModule(this, DatabaseNamespace, Database);
|
this.database = APPS.appModule(this, DatabaseNamespace, Database);
|
||||||
this.firestore = APPS.appModule(this, FirestoreNamespace, Firestore);
|
this.firestore = APPS.appModule(this, FirestoreNamespace, Firestore);
|
||||||
|
this.functions = APPS.appModule(this, FunctionsNamespace, Functions);
|
||||||
this.iid = APPS.appModule(this, InstanceIdNamespace, InstanceId);
|
this.iid = APPS.appModule(this, InstanceIdNamespace, InstanceId);
|
||||||
this.invites = APPS.appModule(this, InvitesNamespace, Invites);
|
this.invites = APPS.appModule(this, InvitesNamespace, Invites);
|
||||||
this.links = APPS.appModule(this, LinksNamespace, Links);
|
this.links = APPS.appModule(this, LinksNamespace, Links);
|
||||||
|
@ -38,6 +38,10 @@ import {
|
|||||||
statics as FirestoreStatics,
|
statics as FirestoreStatics,
|
||||||
MODULE_NAME as FirestoreModuleName,
|
MODULE_NAME as FirestoreModuleName,
|
||||||
} from '../firestore';
|
} from '../firestore';
|
||||||
|
import {
|
||||||
|
statics as FunctionsStatics,
|
||||||
|
MODULE_NAME as FunctionsModuleName,
|
||||||
|
} from '../functions';
|
||||||
import {
|
import {
|
||||||
statics as InstanceIdStatics,
|
statics as InstanceIdStatics,
|
||||||
MODULE_NAME as InstanceIdModuleName,
|
MODULE_NAME as InstanceIdModuleName,
|
||||||
@ -81,6 +85,7 @@ import type {
|
|||||||
DatabaseModule,
|
DatabaseModule,
|
||||||
FirebaseOptions,
|
FirebaseOptions,
|
||||||
FirestoreModule,
|
FirestoreModule,
|
||||||
|
FunctionsModule,
|
||||||
InstanceIdModule,
|
InstanceIdModule,
|
||||||
InvitesModule,
|
InvitesModule,
|
||||||
LinksModule,
|
LinksModule,
|
||||||
@ -102,6 +107,7 @@ class Firebase {
|
|||||||
crashlytics: CrashlyticsModule;
|
crashlytics: CrashlyticsModule;
|
||||||
database: DatabaseModule;
|
database: DatabaseModule;
|
||||||
firestore: FirestoreModule;
|
firestore: FirestoreModule;
|
||||||
|
functions: FunctionsModule;
|
||||||
iid: InstanceIdModule;
|
iid: InstanceIdModule;
|
||||||
invites: InvitesModule;
|
invites: InvitesModule;
|
||||||
links: LinksModule;
|
links: LinksModule;
|
||||||
@ -146,6 +152,11 @@ class Firebase {
|
|||||||
FirestoreStatics,
|
FirestoreStatics,
|
||||||
FirestoreModuleName
|
FirestoreModuleName
|
||||||
);
|
);
|
||||||
|
this.functions = APPS.moduleAndStatics(
|
||||||
|
'functions',
|
||||||
|
FunctionsStatics,
|
||||||
|
FunctionsModuleName
|
||||||
|
);
|
||||||
this.iid = APPS.moduleAndStatics(
|
this.iid = APPS.moduleAndStatics(
|
||||||
'iid',
|
'iid',
|
||||||
InstanceIdStatics,
|
InstanceIdStatics,
|
||||||
|
@ -16,7 +16,7 @@ type HttpsCallableResult = {
|
|||||||
|
|
||||||
type HttpsCallable = (data?: any) => Promise<HttpsCallableResult>;
|
type HttpsCallable = (data?: any) => Promise<HttpsCallableResult>;
|
||||||
|
|
||||||
export default class Analytics extends ModuleBase {
|
export default class Functions extends ModuleBase {
|
||||||
constructor(app: App) {
|
constructor(app: App) {
|
||||||
super(app, {
|
super(app, {
|
||||||
moduleName: MODULE_NAME,
|
moduleName: MODULE_NAME,
|
||||||
|
@ -84,6 +84,7 @@ export type FirebaseNamespace =
|
|||||||
| 'crashlytics'
|
| 'crashlytics'
|
||||||
| 'database'
|
| 'database'
|
||||||
| 'firestore'
|
| 'firestore'
|
||||||
|
| 'functions'
|
||||||
| 'iid'
|
| 'iid'
|
||||||
| 'invites'
|
| 'invites'
|
||||||
| 'links'
|
| 'links'
|
||||||
|
@ -107,7 +107,7 @@ export default {
|
|||||||
const _name = (name || DEFAULT_APP_NAME).toUpperCase();
|
const _name = (name || DEFAULT_APP_NAME).toUpperCase();
|
||||||
|
|
||||||
// return an existing app if found
|
// return an existing app if found
|
||||||
// todo in v4 remove deprecation and throw an error
|
// TODO in v5 remove deprecation and throw an error
|
||||||
if (APPS[_name]) {
|
if (APPS[_name]) {
|
||||||
console.warn(INTERNALS.STRINGS.WARN_INITIALIZE_DEPRECATION);
|
console.warn(INTERNALS.STRINGS.WARN_INITIALIZE_DEPRECATION);
|
||||||
return APPS[_name];
|
return APPS[_name];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user