firebase-admin 10.1.0 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/app/core.d.ts +1 -1
- package/lib/app/core.js +1 -1
- package/lib/app/credential-factory.d.ts +1 -1
- package/lib/app/credential-factory.js +8 -8
- package/lib/app/credential-internal.d.ts +3 -1
- package/lib/app/credential-internal.js +103 -95
- package/lib/app/credential.d.ts +1 -1
- package/lib/app/credential.js +1 -1
- package/lib/app/firebase-app.d.ts +1 -1
- package/lib/app/firebase-app.js +76 -91
- package/lib/app/firebase-namespace.d.ts +1 -1
- package/lib/app/firebase-namespace.js +209 -279
- package/lib/app/index.d.ts +1 -1
- package/lib/app/index.js +4 -4
- package/lib/app/lifecycle.d.ts +1 -1
- package/lib/app/lifecycle.js +37 -43
- package/lib/app-check/app-check-api-client-internal.d.ts +1 -1
- package/lib/app-check/app-check-api-client-internal.js +54 -73
- package/lib/app-check/app-check-api.d.ts +1 -1
- package/lib/app-check/app-check-api.js +1 -1
- package/lib/app-check/app-check-namespace.d.ts +1 -1
- package/lib/app-check/app-check-namespace.js +1 -1
- package/lib/app-check/app-check.d.ts +1 -1
- package/lib/app-check/app-check.js +17 -19
- package/lib/app-check/index.d.ts +1 -1
- package/lib/app-check/index.js +7 -7
- package/lib/app-check/token-generator.d.ts +1 -1
- package/lib/app-check/token-generator.js +47 -52
- package/lib/app-check/token-verifier.d.ts +1 -1
- package/lib/app-check/token-verifier.js +46 -50
- package/lib/auth/action-code-settings-builder.d.ts +1 -1
- package/lib/auth/action-code-settings-builder.js +10 -11
- package/lib/auth/auth-api-request.d.ts +1 -1
- package/lib/auth/auth-api-request.js +355 -382
- package/lib/auth/auth-config.d.ts +1 -1
- package/lib/auth/auth-config.js +95 -106
- package/lib/auth/auth-namespace.d.ts +1 -1
- package/lib/auth/auth-namespace.js +1 -1
- package/lib/auth/auth.d.ts +1 -1
- package/lib/auth/auth.js +20 -40
- package/lib/auth/base-auth.d.ts +26 -1
- package/lib/auth/base-auth.js +162 -142
- package/lib/auth/identifier.d.ts +1 -1
- package/lib/auth/identifier.js +2 -2
- package/lib/auth/index.d.ts +1 -1
- package/lib/auth/index.js +7 -7
- package/lib/auth/tenant-manager.d.ts +1 -1
- package/lib/auth/tenant-manager.js +49 -71
- package/lib/auth/tenant.d.ts +1 -1
- package/lib/auth/tenant.js +44 -55
- package/lib/auth/token-generator.d.ts +1 -1
- package/lib/auth/token-generator.js +49 -53
- package/lib/auth/token-verifier.d.ts +1 -1
- package/lib/auth/token-verifier.js +83 -91
- package/lib/auth/user-import-builder.d.ts +1 -1
- package/lib/auth/user-import-builder.js +70 -73
- package/lib/auth/user-record.d.ts +1 -1
- package/lib/auth/user-record.js +61 -84
- package/lib/credential/index.d.ts +1 -1
- package/lib/credential/index.js +2 -2
- package/lib/database/database-namespace.d.ts +1 -1
- package/lib/database/database-namespace.js +1 -1
- package/lib/database/database.d.ts +1 -1
- package/lib/database/database.js +92 -108
- package/lib/database/index.d.ts +1 -1
- package/lib/database/index.js +10 -10
- package/lib/default-namespace.d.ts +1 -1
- package/lib/default-namespace.js +2 -2
- package/lib/esm/eventarc/index.js +5 -0
- package/lib/esm/functions/index.js +5 -0
- package/lib/eventarc/cloudevent.d.ts +84 -0
- package/lib/eventarc/cloudevent.js +19 -0
- package/lib/eventarc/eventarc-client-internal.d.ts +18 -0
- package/lib/eventarc/eventarc-client-internal.js +139 -0
- package/lib/eventarc/eventarc-utils.d.ts +31 -0
- package/lib/eventarc/eventarc-utils.js +125 -0
- package/lib/eventarc/eventarc.d.ts +107 -0
- package/lib/eventarc/eventarc.js +125 -0
- package/lib/eventarc/index.d.ts +53 -0
- package/lib/eventarc/index.js +64 -0
- package/lib/firebase-namespace-api.d.ts +1 -1
- package/lib/firebase-namespace-api.js +8 -3
- package/lib/firestore/firestore-internal.d.ts +1 -1
- package/lib/firestore/firestore-internal.js +28 -37
- package/lib/firestore/firestore-namespace.d.ts +9 -1
- package/lib/firestore/firestore-namespace.js +2 -2
- package/lib/firestore/index.d.ts +2 -2
- package/lib/firestore/index.js +7 -7
- package/lib/functions/functions-api-client-internal.d.ts +32 -0
- package/lib/functions/functions-api-client-internal.js +257 -0
- package/lib/functions/functions-api.d.ts +67 -0
- package/lib/functions/functions-api.js +19 -0
- package/lib/functions/functions.d.ts +63 -0
- package/lib/functions/functions.js +97 -0
- package/lib/functions/index.d.ts +53 -0
- package/lib/functions/index.js +64 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +14 -4
- package/lib/installations/index.d.ts +1 -1
- package/lib/installations/index.js +6 -6
- package/lib/installations/installations-namespace.d.ts +1 -1
- package/lib/installations/installations-namespace.js +1 -1
- package/lib/installations/installations-request-handler.d.ts +1 -1
- package/lib/installations/installations-request-handler.js +33 -36
- package/lib/installations/installations.d.ts +1 -1
- package/lib/installations/installations.js +17 -22
- package/lib/instance-id/index.d.ts +1 -1
- package/lib/instance-id/index.js +6 -6
- package/lib/instance-id/instance-id-namespace.d.ts +1 -1
- package/lib/instance-id/instance-id-namespace.js +1 -1
- package/lib/instance-id/instance-id.d.ts +1 -1
- package/lib/instance-id/instance-id.js +21 -26
- package/lib/machine-learning/index.d.ts +1 -1
- package/lib/machine-learning/index.js +7 -7
- package/lib/machine-learning/machine-learning-api-client.d.ts +1 -1
- package/lib/machine-learning/machine-learning-api-client.js +110 -124
- package/lib/machine-learning/machine-learning-namespace.d.ts +1 -1
- package/lib/machine-learning/machine-learning-namespace.js +1 -1
- package/lib/machine-learning/machine-learning-utils.d.ts +1 -1
- package/lib/machine-learning/machine-learning-utils.js +9 -24
- package/lib/machine-learning/machine-learning.d.ts +1 -1
- package/lib/machine-learning/machine-learning.js +146 -207
- package/lib/messaging/batch-request-internal.d.ts +1 -1
- package/lib/messaging/batch-request-internal.js +33 -35
- package/lib/messaging/index.d.ts +1 -1
- package/lib/messaging/index.js +7 -7
- package/lib/messaging/messaging-api-request-internal.d.ts +1 -1
- package/lib/messaging/messaging-api-request-internal.js +38 -40
- package/lib/messaging/messaging-api.d.ts +1 -1
- package/lib/messaging/messaging-api.js +1 -1
- package/lib/messaging/messaging-errors-internal.d.ts +1 -1
- package/lib/messaging/messaging-errors-internal.js +12 -13
- package/lib/messaging/messaging-internal.d.ts +1 -1
- package/lib/messaging/messaging-internal.js +51 -51
- package/lib/messaging/messaging-namespace.d.ts +1 -1
- package/lib/messaging/messaging-namespace.js +1 -1
- package/lib/messaging/messaging.d.ts +1 -1
- package/lib/messaging/messaging.js +184 -208
- package/lib/project-management/android-app.d.ts +1 -1
- package/lib/project-management/android-app.js +41 -43
- package/lib/project-management/app-metadata.d.ts +1 -1
- package/lib/project-management/app-metadata.js +1 -1
- package/lib/project-management/index.d.ts +1 -1
- package/lib/project-management/index.js +7 -7
- package/lib/project-management/ios-app.d.ts +1 -1
- package/lib/project-management/ios-app.js +25 -26
- package/lib/project-management/project-management-api-request-internal.d.ts +1 -1
- package/lib/project-management/project-management-api-request-internal.js +84 -89
- package/lib/project-management/project-management-namespace.d.ts +1 -1
- package/lib/project-management/project-management-namespace.js +1 -1
- package/lib/project-management/project-management.d.ts +1 -1
- package/lib/project-management/project-management.js +80 -87
- package/lib/remote-config/index.d.ts +1 -1
- package/lib/remote-config/index.js +7 -7
- package/lib/remote-config/remote-config-api-client-internal.d.ts +1 -1
- package/lib/remote-config/remote-config-api-client-internal.js +116 -154
- package/lib/remote-config/remote-config-api.d.ts +1 -1
- package/lib/remote-config/remote-config-api.js +1 -1
- package/lib/remote-config/remote-config-namespace.d.ts +1 -1
- package/lib/remote-config/remote-config-namespace.js +1 -1
- package/lib/remote-config/remote-config.d.ts +1 -1
- package/lib/remote-config/remote-config.js +51 -59
- package/lib/security-rules/index.d.ts +1 -1
- package/lib/security-rules/index.js +7 -7
- package/lib/security-rules/security-rules-api-client-internal.d.ts +1 -1
- package/lib/security-rules/security-rules-api-client-internal.js +95 -107
- package/lib/security-rules/security-rules-internal.d.ts +1 -1
- package/lib/security-rules/security-rules-internal.js +6 -21
- package/lib/security-rules/security-rules-namespace.d.ts +1 -1
- package/lib/security-rules/security-rules-namespace.js +1 -1
- package/lib/security-rules/security-rules.d.ts +1 -1
- package/lib/security-rules/security-rules.js +82 -91
- package/lib/storage/index.d.ts +1 -1
- package/lib/storage/index.js +7 -7
- package/lib/storage/storage-namespace.d.ts +1 -1
- package/lib/storage/storage-namespace.js +1 -1
- package/lib/storage/storage.d.ts +1 -1
- package/lib/storage/storage.js +25 -30
- package/lib/utils/api-request.d.ts +3 -1
- package/lib/utils/api-request.js +278 -356
- package/lib/utils/crypto-signer.d.ts +1 -1
- package/lib/utils/crypto-signer.js +58 -93
- package/lib/utils/deep-copy.d.ts +1 -1
- package/lib/utils/deep-copy.js +3 -3
- package/lib/utils/error.d.ts +5 -1
- package/lib/utils/error.js +613 -677
- package/lib/utils/index.d.ts +43 -1
- package/lib/utils/index.js +99 -34
- package/lib/utils/jwt.d.ts +1 -1
- package/lib/utils/jwt.js +97 -123
- package/lib/utils/validator.d.ts +1 -1
- package/lib/utils/validator.js +13 -13
- package/package.json +43 -11
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v11.0.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* @license
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
*/
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
20
|
exports.defaultNamespace = exports.FirebaseNamespace = exports.FirebaseNamespaceInternals = void 0;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
const lifecycle_1 = require("./lifecycle");
|
|
22
|
+
const credential_factory_1 = require("./credential-factory");
|
|
23
|
+
const index_1 = require("../utils/index");
|
|
24
24
|
/**
|
|
25
25
|
* Internals of a FirebaseNamespace instance.
|
|
26
26
|
*/
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
class FirebaseNamespaceInternals {
|
|
28
|
+
constructor(appStore) {
|
|
29
29
|
this.appStore = appStore;
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
@@ -39,10 +39,10 @@ var FirebaseNamespaceInternals = /** @class */ (function () {
|
|
|
39
39
|
*
|
|
40
40
|
* @returns A new App instance.
|
|
41
41
|
*/
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
initializeApp(options, appName) {
|
|
43
|
+
const app = this.appStore.initializeApp(options, appName);
|
|
44
44
|
return extendApp(app);
|
|
45
|
-
}
|
|
45
|
+
}
|
|
46
46
|
/**
|
|
47
47
|
* Returns the App instance with the provided name (or the default App instance
|
|
48
48
|
* if no name is provided).
|
|
@@ -50,251 +50,186 @@ var FirebaseNamespaceInternals = /** @class */ (function () {
|
|
|
50
50
|
* @param appName - Optional name of the FirebaseApp instance to return.
|
|
51
51
|
* @returns The App instance which has the provided name.
|
|
52
52
|
*/
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
app(appName) {
|
|
54
|
+
const app = this.appStore.getApp(appName);
|
|
55
55
|
return extendApp(app);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
enumerable: false,
|
|
65
|
-
configurable: true
|
|
66
|
-
});
|
|
67
|
-
return FirebaseNamespaceInternals;
|
|
68
|
-
}());
|
|
56
|
+
}
|
|
57
|
+
/*
|
|
58
|
+
* Returns an array of all the non-deleted App instances.
|
|
59
|
+
*/
|
|
60
|
+
get apps() {
|
|
61
|
+
return this.appStore.getApps().map((app) => extendApp(app));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
69
64
|
exports.FirebaseNamespaceInternals = FirebaseNamespaceInternals;
|
|
70
|
-
|
|
65
|
+
const firebaseCredential = {
|
|
71
66
|
cert: credential_factory_1.cert, refreshToken: credential_factory_1.refreshToken, applicationDefault: credential_factory_1.applicationDefault
|
|
72
67
|
};
|
|
73
68
|
/**
|
|
74
69
|
* Global Firebase context object.
|
|
75
70
|
*/
|
|
76
|
-
|
|
71
|
+
class FirebaseNamespace {
|
|
77
72
|
/* tslint:enable */
|
|
78
|
-
|
|
73
|
+
constructor(appStore) {
|
|
79
74
|
// Hack to prevent Babel from modifying the object returned as the default admin namespace.
|
|
80
75
|
/* tslint:disable:variable-name */
|
|
81
76
|
this.__esModule = true;
|
|
82
77
|
/* tslint:enable:variable-name */
|
|
83
78
|
this.credential = firebaseCredential;
|
|
84
|
-
this.SDK_VERSION = index_1.getSdkVersion();
|
|
79
|
+
this.SDK_VERSION = (0, index_1.getSdkVersion)();
|
|
85
80
|
/* tslint:disable */
|
|
86
81
|
// TODO(jwenger): Database is the only consumer of firebase.Promise. We should update it to use
|
|
87
82
|
// use the native Promise and then remove this.
|
|
88
83
|
this.Promise = Promise;
|
|
89
|
-
this.INTERNAL = new FirebaseNamespaceInternals(appStore
|
|
84
|
+
this.INTERNAL = new FirebaseNamespaceInternals(appStore ?? new lifecycle_1.AppStore());
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Gets the `Auth` service namespace. The returned namespace can be used to get the
|
|
88
|
+
* `Auth` service for the default app or an explicitly specified app.
|
|
89
|
+
*/
|
|
90
|
+
get auth() {
|
|
91
|
+
const fn = (app) => {
|
|
92
|
+
return this.ensureApp(app).auth();
|
|
93
|
+
};
|
|
94
|
+
const auth = require('../auth/auth').Auth;
|
|
95
|
+
return Object.assign(fn, { Auth: auth });
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Gets the `Database` service namespace. The returned namespace can be used to get the
|
|
99
|
+
* `Database` service for the default app or an explicitly specified app.
|
|
100
|
+
*/
|
|
101
|
+
get database() {
|
|
102
|
+
const fn = (app) => {
|
|
103
|
+
return this.ensureApp(app).database();
|
|
104
|
+
};
|
|
105
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
106
|
+
return Object.assign(fn, require('@firebase/database-compat/standalone'));
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Gets the `Messaging` service namespace. The returned namespace can be used to get the
|
|
110
|
+
* `Messaging` service for the default app or an explicitly specified app.
|
|
111
|
+
*/
|
|
112
|
+
get messaging() {
|
|
113
|
+
const fn = (app) => {
|
|
114
|
+
return this.ensureApp(app).messaging();
|
|
115
|
+
};
|
|
116
|
+
const messaging = require('../messaging/messaging').Messaging;
|
|
117
|
+
return Object.assign(fn, { Messaging: messaging });
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Gets the `Storage` service namespace. The returned namespace can be used to get the
|
|
121
|
+
* `Storage` service for the default app or an explicitly specified app.
|
|
122
|
+
*/
|
|
123
|
+
get storage() {
|
|
124
|
+
const fn = (app) => {
|
|
125
|
+
return this.ensureApp(app).storage();
|
|
126
|
+
};
|
|
127
|
+
const storage = require('../storage/storage').Storage;
|
|
128
|
+
return Object.assign(fn, { Storage: storage });
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Gets the `Firestore` service namespace. The returned namespace can be used to get the
|
|
132
|
+
* `Firestore` service for the default app or an explicitly specified app.
|
|
133
|
+
*/
|
|
134
|
+
get firestore() {
|
|
135
|
+
let fn = (app) => {
|
|
136
|
+
return this.ensureApp(app).firestore();
|
|
137
|
+
};
|
|
138
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
139
|
+
const firestore = require('@google-cloud/firestore');
|
|
140
|
+
fn = Object.assign(fn, firestore.Firestore);
|
|
141
|
+
// `v1beta1` and `v1` are lazy-loaded in the Firestore SDK. We use the same trick here
|
|
142
|
+
// to avoid triggering this lazy-loading upon initialization.
|
|
143
|
+
Object.defineProperty(fn, 'v1beta1', {
|
|
144
|
+
get: () => {
|
|
145
|
+
return firestore.v1beta1;
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
Object.defineProperty(fn, 'v1', {
|
|
149
|
+
get: () => {
|
|
150
|
+
return firestore.v1;
|
|
151
|
+
},
|
|
152
|
+
});
|
|
153
|
+
return fn;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Gets the `MachineLearning` service namespace. The returned namespace can be
|
|
157
|
+
* used to get the `MachineLearning` service for the default app or an
|
|
158
|
+
* explicityly specified app.
|
|
159
|
+
*/
|
|
160
|
+
get machineLearning() {
|
|
161
|
+
const fn = (app) => {
|
|
162
|
+
return this.ensureApp(app).machineLearning();
|
|
163
|
+
};
|
|
164
|
+
const machineLearning = require('../machine-learning/machine-learning').MachineLearning;
|
|
165
|
+
return Object.assign(fn, { MachineLearning: machineLearning });
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Gets the `Installations` service namespace. The returned namespace can be used to get the
|
|
169
|
+
* `Installations` service for the default app or an explicitly specified app.
|
|
170
|
+
*/
|
|
171
|
+
get installations() {
|
|
172
|
+
const fn = (app) => {
|
|
173
|
+
return this.ensureApp(app).installations();
|
|
174
|
+
};
|
|
175
|
+
const installations = require('../installations/installations').Installations;
|
|
176
|
+
return Object.assign(fn, { Installations: installations });
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Gets the `InstanceId` service namespace. The returned namespace can be used to get the
|
|
180
|
+
* `Instance` service for the default app or an explicitly specified app.
|
|
181
|
+
*/
|
|
182
|
+
get instanceId() {
|
|
183
|
+
const fn = (app) => {
|
|
184
|
+
return this.ensureApp(app).instanceId();
|
|
185
|
+
};
|
|
186
|
+
const instanceId = require('../instance-id/instance-id').InstanceId;
|
|
187
|
+
return Object.assign(fn, { InstanceId: instanceId });
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Gets the `ProjectManagement` service namespace. The returned namespace can be used to get the
|
|
191
|
+
* `ProjectManagement` service for the default app or an explicitly specified app.
|
|
192
|
+
*/
|
|
193
|
+
get projectManagement() {
|
|
194
|
+
const fn = (app) => {
|
|
195
|
+
return this.ensureApp(app).projectManagement();
|
|
196
|
+
};
|
|
197
|
+
const projectManagement = require('../project-management/project-management').ProjectManagement;
|
|
198
|
+
return Object.assign(fn, { ProjectManagement: projectManagement });
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Gets the `SecurityRules` service namespace. The returned namespace can be used to get the
|
|
202
|
+
* `SecurityRules` service for the default app or an explicitly specified app.
|
|
203
|
+
*/
|
|
204
|
+
get securityRules() {
|
|
205
|
+
const fn = (app) => {
|
|
206
|
+
return this.ensureApp(app).securityRules();
|
|
207
|
+
};
|
|
208
|
+
const securityRules = require('../security-rules/security-rules').SecurityRules;
|
|
209
|
+
return Object.assign(fn, { SecurityRules: securityRules });
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Gets the `RemoteConfig` service namespace. The returned namespace can be used to get the
|
|
213
|
+
* `RemoteConfig` service for the default app or an explicitly specified app.
|
|
214
|
+
*/
|
|
215
|
+
get remoteConfig() {
|
|
216
|
+
const fn = (app) => {
|
|
217
|
+
return this.ensureApp(app).remoteConfig();
|
|
218
|
+
};
|
|
219
|
+
const remoteConfig = require('../remote-config/remote-config').RemoteConfig;
|
|
220
|
+
return Object.assign(fn, { RemoteConfig: remoteConfig });
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Gets the `AppCheck` service namespace. The returned namespace can be used to get the
|
|
224
|
+
* `AppCheck` service for the default app or an explicitly specified app.
|
|
225
|
+
*/
|
|
226
|
+
get appCheck() {
|
|
227
|
+
const fn = (app) => {
|
|
228
|
+
return this.ensureApp(app).appCheck();
|
|
229
|
+
};
|
|
230
|
+
const appCheck = require('../app-check/app-check').AppCheck;
|
|
231
|
+
return Object.assign(fn, { AppCheck: appCheck });
|
|
90
232
|
}
|
|
91
|
-
Object.defineProperty(FirebaseNamespace.prototype, "auth", {
|
|
92
|
-
/**
|
|
93
|
-
* Gets the `Auth` service namespace. The returned namespace can be used to get the
|
|
94
|
-
* `Auth` service for the default app or an explicitly specified app.
|
|
95
|
-
*/
|
|
96
|
-
get: function () {
|
|
97
|
-
var _this = this;
|
|
98
|
-
var fn = function (app) {
|
|
99
|
-
return _this.ensureApp(app).auth();
|
|
100
|
-
};
|
|
101
|
-
var auth = require('../auth/auth').Auth;
|
|
102
|
-
return Object.assign(fn, { Auth: auth });
|
|
103
|
-
},
|
|
104
|
-
enumerable: false,
|
|
105
|
-
configurable: true
|
|
106
|
-
});
|
|
107
|
-
Object.defineProperty(FirebaseNamespace.prototype, "database", {
|
|
108
|
-
/**
|
|
109
|
-
* Gets the `Database` service namespace. The returned namespace can be used to get the
|
|
110
|
-
* `Database` service for the default app or an explicitly specified app.
|
|
111
|
-
*/
|
|
112
|
-
get: function () {
|
|
113
|
-
var _this = this;
|
|
114
|
-
var fn = function (app) {
|
|
115
|
-
return _this.ensureApp(app).database();
|
|
116
|
-
};
|
|
117
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
118
|
-
return Object.assign(fn, require('@firebase/database-compat/standalone'));
|
|
119
|
-
},
|
|
120
|
-
enumerable: false,
|
|
121
|
-
configurable: true
|
|
122
|
-
});
|
|
123
|
-
Object.defineProperty(FirebaseNamespace.prototype, "messaging", {
|
|
124
|
-
/**
|
|
125
|
-
* Gets the `Messaging` service namespace. The returned namespace can be used to get the
|
|
126
|
-
* `Messaging` service for the default app or an explicitly specified app.
|
|
127
|
-
*/
|
|
128
|
-
get: function () {
|
|
129
|
-
var _this = this;
|
|
130
|
-
var fn = function (app) {
|
|
131
|
-
return _this.ensureApp(app).messaging();
|
|
132
|
-
};
|
|
133
|
-
var messaging = require('../messaging/messaging').Messaging;
|
|
134
|
-
return Object.assign(fn, { Messaging: messaging });
|
|
135
|
-
},
|
|
136
|
-
enumerable: false,
|
|
137
|
-
configurable: true
|
|
138
|
-
});
|
|
139
|
-
Object.defineProperty(FirebaseNamespace.prototype, "storage", {
|
|
140
|
-
/**
|
|
141
|
-
* Gets the `Storage` service namespace. The returned namespace can be used to get the
|
|
142
|
-
* `Storage` service for the default app or an explicitly specified app.
|
|
143
|
-
*/
|
|
144
|
-
get: function () {
|
|
145
|
-
var _this = this;
|
|
146
|
-
var fn = function (app) {
|
|
147
|
-
return _this.ensureApp(app).storage();
|
|
148
|
-
};
|
|
149
|
-
var storage = require('../storage/storage').Storage;
|
|
150
|
-
return Object.assign(fn, { Storage: storage });
|
|
151
|
-
},
|
|
152
|
-
enumerable: false,
|
|
153
|
-
configurable: true
|
|
154
|
-
});
|
|
155
|
-
Object.defineProperty(FirebaseNamespace.prototype, "firestore", {
|
|
156
|
-
/**
|
|
157
|
-
* Gets the `Firestore` service namespace. The returned namespace can be used to get the
|
|
158
|
-
* `Firestore` service for the default app or an explicitly specified app.
|
|
159
|
-
*/
|
|
160
|
-
get: function () {
|
|
161
|
-
var _this = this;
|
|
162
|
-
var fn = function (app) {
|
|
163
|
-
return _this.ensureApp(app).firestore();
|
|
164
|
-
};
|
|
165
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
166
|
-
var firestore = require('@google-cloud/firestore');
|
|
167
|
-
fn = Object.assign(fn, firestore.Firestore);
|
|
168
|
-
// `v1beta1` and `v1` are lazy-loaded in the Firestore SDK. We use the same trick here
|
|
169
|
-
// to avoid triggering this lazy-loading upon initialization.
|
|
170
|
-
Object.defineProperty(fn, 'v1beta1', {
|
|
171
|
-
get: function () {
|
|
172
|
-
return firestore.v1beta1;
|
|
173
|
-
},
|
|
174
|
-
});
|
|
175
|
-
Object.defineProperty(fn, 'v1', {
|
|
176
|
-
get: function () {
|
|
177
|
-
return firestore.v1;
|
|
178
|
-
},
|
|
179
|
-
});
|
|
180
|
-
return fn;
|
|
181
|
-
},
|
|
182
|
-
enumerable: false,
|
|
183
|
-
configurable: true
|
|
184
|
-
});
|
|
185
|
-
Object.defineProperty(FirebaseNamespace.prototype, "machineLearning", {
|
|
186
|
-
/**
|
|
187
|
-
* Gets the `MachineLearning` service namespace. The returned namespace can be
|
|
188
|
-
* used to get the `MachineLearning` service for the default app or an
|
|
189
|
-
* explicityly specified app.
|
|
190
|
-
*/
|
|
191
|
-
get: function () {
|
|
192
|
-
var _this = this;
|
|
193
|
-
var fn = function (app) {
|
|
194
|
-
return _this.ensureApp(app).machineLearning();
|
|
195
|
-
};
|
|
196
|
-
var machineLearning = require('../machine-learning/machine-learning').MachineLearning;
|
|
197
|
-
return Object.assign(fn, { MachineLearning: machineLearning });
|
|
198
|
-
},
|
|
199
|
-
enumerable: false,
|
|
200
|
-
configurable: true
|
|
201
|
-
});
|
|
202
|
-
Object.defineProperty(FirebaseNamespace.prototype, "installations", {
|
|
203
|
-
/**
|
|
204
|
-
* Gets the `Installations` service namespace. The returned namespace can be used to get the
|
|
205
|
-
* `Installations` service for the default app or an explicitly specified app.
|
|
206
|
-
*/
|
|
207
|
-
get: function () {
|
|
208
|
-
var _this = this;
|
|
209
|
-
var fn = function (app) {
|
|
210
|
-
return _this.ensureApp(app).installations();
|
|
211
|
-
};
|
|
212
|
-
var installations = require('../installations/installations').Installations;
|
|
213
|
-
return Object.assign(fn, { Installations: installations });
|
|
214
|
-
},
|
|
215
|
-
enumerable: false,
|
|
216
|
-
configurable: true
|
|
217
|
-
});
|
|
218
|
-
Object.defineProperty(FirebaseNamespace.prototype, "instanceId", {
|
|
219
|
-
/**
|
|
220
|
-
* Gets the `InstanceId` service namespace. The returned namespace can be used to get the
|
|
221
|
-
* `Instance` service for the default app or an explicitly specified app.
|
|
222
|
-
*/
|
|
223
|
-
get: function () {
|
|
224
|
-
var _this = this;
|
|
225
|
-
var fn = function (app) {
|
|
226
|
-
return _this.ensureApp(app).instanceId();
|
|
227
|
-
};
|
|
228
|
-
var instanceId = require('../instance-id/instance-id').InstanceId;
|
|
229
|
-
return Object.assign(fn, { InstanceId: instanceId });
|
|
230
|
-
},
|
|
231
|
-
enumerable: false,
|
|
232
|
-
configurable: true
|
|
233
|
-
});
|
|
234
|
-
Object.defineProperty(FirebaseNamespace.prototype, "projectManagement", {
|
|
235
|
-
/**
|
|
236
|
-
* Gets the `ProjectManagement` service namespace. The returned namespace can be used to get the
|
|
237
|
-
* `ProjectManagement` service for the default app or an explicitly specified app.
|
|
238
|
-
*/
|
|
239
|
-
get: function () {
|
|
240
|
-
var _this = this;
|
|
241
|
-
var fn = function (app) {
|
|
242
|
-
return _this.ensureApp(app).projectManagement();
|
|
243
|
-
};
|
|
244
|
-
var projectManagement = require('../project-management/project-management').ProjectManagement;
|
|
245
|
-
return Object.assign(fn, { ProjectManagement: projectManagement });
|
|
246
|
-
},
|
|
247
|
-
enumerable: false,
|
|
248
|
-
configurable: true
|
|
249
|
-
});
|
|
250
|
-
Object.defineProperty(FirebaseNamespace.prototype, "securityRules", {
|
|
251
|
-
/**
|
|
252
|
-
* Gets the `SecurityRules` service namespace. The returned namespace can be used to get the
|
|
253
|
-
* `SecurityRules` service for the default app or an explicitly specified app.
|
|
254
|
-
*/
|
|
255
|
-
get: function () {
|
|
256
|
-
var _this = this;
|
|
257
|
-
var fn = function (app) {
|
|
258
|
-
return _this.ensureApp(app).securityRules();
|
|
259
|
-
};
|
|
260
|
-
var securityRules = require('../security-rules/security-rules').SecurityRules;
|
|
261
|
-
return Object.assign(fn, { SecurityRules: securityRules });
|
|
262
|
-
},
|
|
263
|
-
enumerable: false,
|
|
264
|
-
configurable: true
|
|
265
|
-
});
|
|
266
|
-
Object.defineProperty(FirebaseNamespace.prototype, "remoteConfig", {
|
|
267
|
-
/**
|
|
268
|
-
* Gets the `RemoteConfig` service namespace. The returned namespace can be used to get the
|
|
269
|
-
* `RemoteConfig` service for the default app or an explicitly specified app.
|
|
270
|
-
*/
|
|
271
|
-
get: function () {
|
|
272
|
-
var _this = this;
|
|
273
|
-
var fn = function (app) {
|
|
274
|
-
return _this.ensureApp(app).remoteConfig();
|
|
275
|
-
};
|
|
276
|
-
var remoteConfig = require('../remote-config/remote-config').RemoteConfig;
|
|
277
|
-
return Object.assign(fn, { RemoteConfig: remoteConfig });
|
|
278
|
-
},
|
|
279
|
-
enumerable: false,
|
|
280
|
-
configurable: true
|
|
281
|
-
});
|
|
282
|
-
Object.defineProperty(FirebaseNamespace.prototype, "appCheck", {
|
|
283
|
-
/**
|
|
284
|
-
* Gets the `AppCheck` service namespace. The returned namespace can be used to get the
|
|
285
|
-
* `AppCheck` service for the default app or an explicitly specified app.
|
|
286
|
-
*/
|
|
287
|
-
get: function () {
|
|
288
|
-
var _this = this;
|
|
289
|
-
var fn = function (app) {
|
|
290
|
-
return _this.ensureApp(app).appCheck();
|
|
291
|
-
};
|
|
292
|
-
var appCheck = require('../app-check/app-check').AppCheck;
|
|
293
|
-
return Object.assign(fn, { AppCheck: appCheck });
|
|
294
|
-
},
|
|
295
|
-
enumerable: false,
|
|
296
|
-
configurable: true
|
|
297
|
-
});
|
|
298
233
|
// TODO: Change the return types to app.App in the following methods.
|
|
299
234
|
/**
|
|
300
235
|
* Initializes the FirebaseApp instance.
|
|
@@ -307,9 +242,9 @@ var FirebaseNamespace = /** @class */ (function () {
|
|
|
307
242
|
*
|
|
308
243
|
* @returns A new FirebaseApp instance.
|
|
309
244
|
*/
|
|
310
|
-
|
|
245
|
+
initializeApp(options, appName) {
|
|
311
246
|
return this.INTERNAL.initializeApp(options, appName);
|
|
312
|
-
}
|
|
247
|
+
}
|
|
313
248
|
/**
|
|
314
249
|
* Returns the FirebaseApp instance with the provided name (or the default FirebaseApp instance
|
|
315
250
|
* if no name is provided).
|
|
@@ -317,27 +252,22 @@ var FirebaseNamespace = /** @class */ (function () {
|
|
|
317
252
|
* @param appName - Optional name of the FirebaseApp instance to return.
|
|
318
253
|
* @returns The FirebaseApp instance which has the provided name.
|
|
319
254
|
*/
|
|
320
|
-
|
|
255
|
+
app(appName) {
|
|
321
256
|
return this.INTERNAL.app(appName);
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
enumerable: false,
|
|
331
|
-
configurable: true
|
|
332
|
-
});
|
|
333
|
-
FirebaseNamespace.prototype.ensureApp = function (app) {
|
|
257
|
+
}
|
|
258
|
+
/*
|
|
259
|
+
* Returns an array of all the non-deleted FirebaseApp instances.
|
|
260
|
+
*/
|
|
261
|
+
get apps() {
|
|
262
|
+
return this.INTERNAL.apps;
|
|
263
|
+
}
|
|
264
|
+
ensureApp(app) {
|
|
334
265
|
if (typeof app === 'undefined') {
|
|
335
266
|
app = this.app();
|
|
336
267
|
}
|
|
337
268
|
return app;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
}());
|
|
269
|
+
}
|
|
270
|
+
}
|
|
341
271
|
exports.FirebaseNamespace = FirebaseNamespace;
|
|
342
272
|
/**
|
|
343
273
|
* In order to maintain backward compatibility, we instantiate a default namespace instance in
|
|
@@ -348,56 +278,56 @@ exports.FirebaseNamespace = FirebaseNamespace;
|
|
|
348
278
|
*/
|
|
349
279
|
exports.defaultNamespace = new FirebaseNamespace(lifecycle_1.defaultAppStore);
|
|
350
280
|
function extendApp(app) {
|
|
351
|
-
|
|
281
|
+
const result = app;
|
|
352
282
|
if (result.__extended) {
|
|
353
283
|
return result;
|
|
354
284
|
}
|
|
355
|
-
result.auth =
|
|
356
|
-
|
|
285
|
+
result.auth = () => {
|
|
286
|
+
const fn = require('../auth/index').getAuth;
|
|
357
287
|
return fn(app);
|
|
358
288
|
};
|
|
359
|
-
result.appCheck =
|
|
360
|
-
|
|
289
|
+
result.appCheck = () => {
|
|
290
|
+
const fn = require('../app-check/index').getAppCheck;
|
|
361
291
|
return fn(app);
|
|
362
292
|
};
|
|
363
|
-
result.database =
|
|
364
|
-
|
|
293
|
+
result.database = (url) => {
|
|
294
|
+
const fn = require('../database/index').getDatabaseWithUrl;
|
|
365
295
|
return fn(url, app);
|
|
366
296
|
};
|
|
367
|
-
result.messaging =
|
|
368
|
-
|
|
297
|
+
result.messaging = () => {
|
|
298
|
+
const fn = require('../messaging/index').getMessaging;
|
|
369
299
|
return fn(app);
|
|
370
300
|
};
|
|
371
|
-
result.storage =
|
|
372
|
-
|
|
301
|
+
result.storage = () => {
|
|
302
|
+
const fn = require('../storage/index').getStorage;
|
|
373
303
|
return fn(app);
|
|
374
304
|
};
|
|
375
|
-
result.firestore =
|
|
376
|
-
|
|
305
|
+
result.firestore = () => {
|
|
306
|
+
const fn = require('../firestore/index').getFirestore;
|
|
377
307
|
return fn(app);
|
|
378
308
|
};
|
|
379
|
-
result.instanceId =
|
|
380
|
-
|
|
309
|
+
result.instanceId = () => {
|
|
310
|
+
const fn = require('../instance-id/index').getInstanceId;
|
|
381
311
|
return fn(app);
|
|
382
312
|
};
|
|
383
|
-
result.installations =
|
|
384
|
-
|
|
313
|
+
result.installations = () => {
|
|
314
|
+
const fn = require('../installations/index').getInstallations;
|
|
385
315
|
return fn(app);
|
|
386
316
|
};
|
|
387
|
-
result.machineLearning =
|
|
388
|
-
|
|
317
|
+
result.machineLearning = () => {
|
|
318
|
+
const fn = require('../machine-learning/index').getMachineLearning;
|
|
389
319
|
return fn(app);
|
|
390
320
|
};
|
|
391
|
-
result.projectManagement =
|
|
392
|
-
|
|
321
|
+
result.projectManagement = () => {
|
|
322
|
+
const fn = require('../project-management/index').getProjectManagement;
|
|
393
323
|
return fn(app);
|
|
394
324
|
};
|
|
395
|
-
result.securityRules =
|
|
396
|
-
|
|
325
|
+
result.securityRules = () => {
|
|
326
|
+
const fn = require('../security-rules/index').getSecurityRules;
|
|
397
327
|
return fn(app);
|
|
398
328
|
};
|
|
399
|
-
result.remoteConfig =
|
|
400
|
-
|
|
329
|
+
result.remoteConfig = () => {
|
|
330
|
+
const fn = require('../remote-config/index').getRemoteConfig;
|
|
401
331
|
return fn(app);
|
|
402
332
|
};
|
|
403
333
|
result.__extended = true;
|
package/lib/app/index.d.ts
CHANGED
package/lib/app/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v11.0.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* @license
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.SDK_VERSION = void 0;
|
|
21
|
-
|
|
20
|
+
exports.SDK_VERSION = exports.refreshToken = exports.cert = exports.applicationDefault = exports.deleteApp = exports.getApps = exports.getApp = exports.initializeApp = void 0;
|
|
21
|
+
const utils_1 = require("../utils");
|
|
22
22
|
var lifecycle_1 = require("./lifecycle");
|
|
23
23
|
Object.defineProperty(exports, "initializeApp", { enumerable: true, get: function () { return lifecycle_1.initializeApp; } });
|
|
24
24
|
Object.defineProperty(exports, "getApp", { enumerable: true, get: function () { return lifecycle_1.getApp; } });
|
|
@@ -28,4 +28,4 @@ var credential_factory_1 = require("./credential-factory");
|
|
|
28
28
|
Object.defineProperty(exports, "applicationDefault", { enumerable: true, get: function () { return credential_factory_1.applicationDefault; } });
|
|
29
29
|
Object.defineProperty(exports, "cert", { enumerable: true, get: function () { return credential_factory_1.cert; } });
|
|
30
30
|
Object.defineProperty(exports, "refreshToken", { enumerable: true, get: function () { return credential_factory_1.refreshToken; } });
|
|
31
|
-
exports.SDK_VERSION = utils_1.getSdkVersion();
|
|
31
|
+
exports.SDK_VERSION = (0, utils_1.getSdkVersion)();
|
package/lib/app/lifecycle.d.ts
CHANGED