firebase-admin 6.2.0 → 6.5.1
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/CHANGELOG.md +36 -1
- package/lib/auth/action-code-settings-builder.js +1 -1
- package/lib/auth/auth-api-request.js +2 -2
- package/lib/auth/auth.js +1 -1
- package/lib/auth/credential.js +45 -9
- package/lib/auth/token-generator.js +1 -1
- package/lib/auth/token-verifier.js +1 -1
- package/lib/auth/user-import-builder.js +1 -1
- package/lib/auth/user-record.js +2 -2
- package/lib/database/database.js +1 -1
- package/lib/default-namespace.js +1 -1
- package/lib/firebase-app.js +16 -4
- package/lib/firebase-namespace.js +24 -8
- package/lib/firebase-service.js +1 -1
- package/lib/firestore/firestore.js +1 -1
- package/lib/index.d.ts +79 -9
- package/lib/index.js +8 -1
- package/lib/instance-id/instance-id-request.js +1 -1
- package/lib/instance-id/instance-id.js +1 -1
- package/lib/messaging/messaging-api-request.js +2 -2
- package/lib/messaging/messaging.js +40 -1
- package/lib/project-management/android-app.js +116 -0
- package/lib/project-management/ios-app.js +67 -0
- package/lib/project-management/project-management-api-request.js +260 -0
- package/lib/project-management/project-management.js +149 -0
- package/lib/storage/storage.js +1 -1
- package/lib/utils/api-request.js +128 -13
- package/lib/utils/deep-copy.js +1 -1
- package/lib/utils/error.js +32 -4
- package/lib/utils/index.js +1 -1
- package/lib/utils/validator.js +14 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,9 +2,44 @@
|
|
|
2
2
|
|
|
3
3
|
-
|
|
4
4
|
|
|
5
|
+
# v6.5.1
|
|
6
|
+
|
|
7
|
+
- [fixed] Implemented a Node.js environment check that will be executed at
|
|
8
|
+
package import time.
|
|
9
|
+
- [fixed] Setting GOOGLE_APPLICATION_CREDENTIALS environment variable
|
|
10
|
+
to a refresh token instead of a certificate token now supported
|
|
11
|
+
|
|
12
|
+
# v6.5.0
|
|
13
|
+
|
|
14
|
+
- [fixed] Correctly parses error codes sent by Firebase Auth backend servers.
|
|
15
|
+
- [fixed] Correctly marked the optional fields in `UserRecord` types.
|
|
16
|
+
- [added] `admin.projectManagement().shaCertificate()` method to create an
|
|
17
|
+
instance of admin.projectManagement.ShaCertificate.
|
|
18
|
+
|
|
19
|
+
# v6.4.0
|
|
20
|
+
|
|
21
|
+
- [added] `messaging.Aps` type now supports configuring a critical sound.
|
|
22
|
+
A new `messaging.CriticalSound` type has been introduced for this purpose.
|
|
23
|
+
- [added] `messaging.AndroidNotification` type now supports `channel_id`.
|
|
24
|
+
- [added] `AppOptions` now accepts an optional `http.Agent` object. The
|
|
25
|
+
`http.Agent` specified via this API is used when the SDK makes backend
|
|
26
|
+
HTTP calls. This can be used when it is required to deploy the Admin SDK
|
|
27
|
+
behind a proxy.
|
|
28
|
+
- [added] `admin.credential.cert()`, `admin.credential.applicationDefault()`,
|
|
29
|
+
and `admin.credential.refreshToken()` methods now accept an `http.Agent`
|
|
30
|
+
as an optional argument. If specified, the `http.Agent` will be used
|
|
31
|
+
when calling Google backend servers to fetch OAuth2 access tokens.
|
|
32
|
+
|
|
33
|
+
# v6.3.0
|
|
34
|
+
|
|
35
|
+
- [added] A new `ProjectManagement` service, which includes the ability to
|
|
36
|
+
create, list, and get details about Android and iOS apps associated with your
|
|
37
|
+
Firebase Project.
|
|
38
|
+
- [added] `messaging.ApsAlert` type now supports subtitle in its payload.
|
|
39
|
+
|
|
5
40
|
# v6.2.0
|
|
6
41
|
|
|
7
|
-
- [
|
|
42
|
+
- [added] Added the email action link generation APIs for creating links for
|
|
8
43
|
password reset, email verification and email link sign-in via
|
|
9
44
|
`auth.generatePasswordResetLink()`, `auth.generateEmailVerificationLink()`
|
|
10
45
|
and `auth.generateSignInWithEmailLink()`.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin v6.
|
|
1
|
+
/*! firebase-admin v6.5.1 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2017 Google Inc.
|
|
@@ -31,7 +31,7 @@ var FIREBASE_AUTH_PORT = 443;
|
|
|
31
31
|
var FIREBASE_AUTH_PATH = '/identitytoolkit/v3/relyingparty/';
|
|
32
32
|
/** Firebase Auth request header. */
|
|
33
33
|
var FIREBASE_AUTH_HEADER = {
|
|
34
|
-
'X-Client-Version': 'Node/Admin/6.
|
|
34
|
+
'X-Client-Version': 'Node/Admin/6.5.1',
|
|
35
35
|
};
|
|
36
36
|
/** Firebase Auth request timeout duration in milliseconds. */
|
|
37
37
|
var FIREBASE_AUTH_TIMEOUT = 25000;
|
package/lib/auth/auth.js
CHANGED
package/lib/auth/credential.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin v6.
|
|
1
|
+
/*! firebase-admin v6.5.1 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2017 Google Inc.
|
|
@@ -168,10 +168,11 @@ function requestAccessToken(client, request) {
|
|
|
168
168
|
* Implementation of Credential that uses a service account certificate.
|
|
169
169
|
*/
|
|
170
170
|
var CertCredential = /** @class */ (function () {
|
|
171
|
-
function CertCredential(serviceAccountPathOrObject) {
|
|
171
|
+
function CertCredential(serviceAccountPathOrObject, httpAgent) {
|
|
172
172
|
this.certificate = (typeof serviceAccountPathOrObject === 'string') ?
|
|
173
173
|
Certificate.fromPath(serviceAccountPathOrObject) : new Certificate(serviceAccountPathOrObject);
|
|
174
174
|
this.httpClient = new api_request_1.HttpClient();
|
|
175
|
+
this.httpAgent = httpAgent;
|
|
175
176
|
}
|
|
176
177
|
CertCredential.prototype.getAccessToken = function () {
|
|
177
178
|
var token = this.createAuthJwt_();
|
|
@@ -184,6 +185,7 @@ var CertCredential = /** @class */ (function () {
|
|
|
184
185
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
185
186
|
},
|
|
186
187
|
data: postData,
|
|
188
|
+
httpAgent: this.httpAgent,
|
|
187
189
|
};
|
|
188
190
|
return requestAccessToken(this.httpClient, request);
|
|
189
191
|
};
|
|
@@ -216,10 +218,11 @@ exports.CertCredential = CertCredential;
|
|
|
216
218
|
* Implementation of Credential that gets access tokens from refresh tokens.
|
|
217
219
|
*/
|
|
218
220
|
var RefreshTokenCredential = /** @class */ (function () {
|
|
219
|
-
function RefreshTokenCredential(refreshTokenPathOrObject) {
|
|
221
|
+
function RefreshTokenCredential(refreshTokenPathOrObject, httpAgent) {
|
|
220
222
|
this.refreshToken = (typeof refreshTokenPathOrObject === 'string') ?
|
|
221
223
|
RefreshToken.fromPath(refreshTokenPathOrObject) : new RefreshToken(refreshTokenPathOrObject);
|
|
222
224
|
this.httpClient = new api_request_1.HttpClient();
|
|
225
|
+
this.httpAgent = httpAgent;
|
|
223
226
|
}
|
|
224
227
|
RefreshTokenCredential.prototype.getAccessToken = function () {
|
|
225
228
|
var postData = 'client_id=' + this.refreshToken.clientId + '&' +
|
|
@@ -233,6 +236,7 @@ var RefreshTokenCredential = /** @class */ (function () {
|
|
|
233
236
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
234
237
|
},
|
|
235
238
|
data: postData,
|
|
239
|
+
httpAgent: this.httpAgent,
|
|
236
240
|
};
|
|
237
241
|
return requestAccessToken(this.httpClient, request);
|
|
238
242
|
};
|
|
@@ -248,13 +252,15 @@ exports.RefreshTokenCredential = RefreshTokenCredential;
|
|
|
248
252
|
* of an App Engine instance or Google Compute Engine machine.
|
|
249
253
|
*/
|
|
250
254
|
var MetadataServiceCredential = /** @class */ (function () {
|
|
251
|
-
function MetadataServiceCredential() {
|
|
255
|
+
function MetadataServiceCredential(httpAgent) {
|
|
252
256
|
this.httpClient = new api_request_1.HttpClient();
|
|
257
|
+
this.httpAgent = httpAgent;
|
|
253
258
|
}
|
|
254
259
|
MetadataServiceCredential.prototype.getAccessToken = function () {
|
|
255
260
|
var request = {
|
|
256
261
|
method: 'GET',
|
|
257
262
|
url: "http://" + GOOGLE_METADATA_SERVICE_HOST + GOOGLE_METADATA_SERVICE_PATH,
|
|
263
|
+
httpAgent: this.httpAgent,
|
|
258
264
|
};
|
|
259
265
|
return requestAccessToken(this.httpClient, request);
|
|
260
266
|
};
|
|
@@ -269,19 +275,18 @@ exports.MetadataServiceCredential = MetadataServiceCredential;
|
|
|
269
275
|
* described in https://developers.google.com/identity/protocols/application-default-credentials
|
|
270
276
|
*/
|
|
271
277
|
var ApplicationDefaultCredential = /** @class */ (function () {
|
|
272
|
-
function ApplicationDefaultCredential() {
|
|
278
|
+
function ApplicationDefaultCredential(httpAgent) {
|
|
273
279
|
if (process.env.GOOGLE_APPLICATION_CREDENTIALS) {
|
|
274
|
-
|
|
275
|
-
this.credential_ = new CertCredential(serviceAccount);
|
|
280
|
+
this.credential_ = credentialFromFile(process.env.GOOGLE_APPLICATION_CREDENTIALS, httpAgent);
|
|
276
281
|
return;
|
|
277
282
|
}
|
|
278
283
|
// It is OK to not have this file. If it is present, it must be valid.
|
|
279
284
|
var refreshToken = RefreshToken.fromPath(GCLOUD_CREDENTIAL_PATH);
|
|
280
285
|
if (refreshToken) {
|
|
281
|
-
this.credential_ = new RefreshTokenCredential(refreshToken);
|
|
286
|
+
this.credential_ = new RefreshTokenCredential(refreshToken, httpAgent);
|
|
282
287
|
return;
|
|
283
288
|
}
|
|
284
|
-
this.credential_ = new MetadataServiceCredential();
|
|
289
|
+
this.credential_ = new MetadataServiceCredential(httpAgent);
|
|
285
290
|
}
|
|
286
291
|
ApplicationDefaultCredential.prototype.getAccessToken = function () {
|
|
287
292
|
return this.credential_.getAccessToken();
|
|
@@ -296,3 +301,34 @@ var ApplicationDefaultCredential = /** @class */ (function () {
|
|
|
296
301
|
return ApplicationDefaultCredential;
|
|
297
302
|
}());
|
|
298
303
|
exports.ApplicationDefaultCredential = ApplicationDefaultCredential;
|
|
304
|
+
function credentialFromFile(filePath, httpAgent) {
|
|
305
|
+
var credentialsFile = readCredentialFile(filePath);
|
|
306
|
+
if (typeof credentialsFile !== 'object') {
|
|
307
|
+
throw new error_1.FirebaseAppError(error_1.AppErrorCodes.INVALID_CREDENTIAL, 'Failed to parse contents of the credentials file as an object');
|
|
308
|
+
}
|
|
309
|
+
if (credentialsFile.type === 'service_account') {
|
|
310
|
+
return new CertCredential(credentialsFile, httpAgent);
|
|
311
|
+
}
|
|
312
|
+
if (credentialsFile.type === 'authorized_user') {
|
|
313
|
+
return new RefreshTokenCredential(credentialsFile, httpAgent);
|
|
314
|
+
}
|
|
315
|
+
throw new error_1.FirebaseAppError(error_1.AppErrorCodes.INVALID_CREDENTIAL, 'Invalid contents in the credentials file');
|
|
316
|
+
}
|
|
317
|
+
function readCredentialFile(filePath) {
|
|
318
|
+
if (typeof filePath !== 'string') {
|
|
319
|
+
throw new error_1.FirebaseAppError(error_1.AppErrorCodes.INVALID_CREDENTIAL, 'Failed to parse credentials file: TypeError: path must be a string');
|
|
320
|
+
}
|
|
321
|
+
var fileText;
|
|
322
|
+
try {
|
|
323
|
+
fileText = fs.readFileSync(filePath, 'utf8');
|
|
324
|
+
}
|
|
325
|
+
catch (error) {
|
|
326
|
+
throw new error_1.FirebaseAppError(error_1.AppErrorCodes.INVALID_CREDENTIAL, "Failed to read credentials from file " + filePath + ": " + error);
|
|
327
|
+
}
|
|
328
|
+
try {
|
|
329
|
+
return JSON.parse(fileText);
|
|
330
|
+
}
|
|
331
|
+
catch (error) {
|
|
332
|
+
throw new error_1.FirebaseAppError(error_1.AppErrorCodes.INVALID_CREDENTIAL, 'Failed to parse contents of the credentials file as an object: ' + error);
|
|
333
|
+
}
|
|
334
|
+
}
|
package/lib/auth/user-record.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin v6.
|
|
1
|
+
/*! firebase-admin v6.5.1 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2017 Google Inc.
|
|
@@ -142,7 +142,7 @@ var UserRecord = /** @class */ (function () {
|
|
|
142
142
|
if (typeof response.validSince !== 'undefined') {
|
|
143
143
|
validAfterTime = parseDate(response.validSince * 1000);
|
|
144
144
|
}
|
|
145
|
-
utils.addReadonlyGetter(this, 'tokensValidAfterTime', validAfterTime);
|
|
145
|
+
utils.addReadonlyGetter(this, 'tokensValidAfterTime', validAfterTime || undefined);
|
|
146
146
|
}
|
|
147
147
|
/** @return {object} The plain object representation of the user record. */
|
|
148
148
|
UserRecord.prototype.toJSON = function () {
|
package/lib/database/database.js
CHANGED
package/lib/default-namespace.js
CHANGED
package/lib/firebase-app.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin v6.
|
|
1
|
+
/*! firebase-admin v6.5.1 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2017 Google Inc.
|
|
@@ -274,11 +274,23 @@ var FirebaseApp = /** @class */ (function () {
|
|
|
274
274
|
return new iidService(_this);
|
|
275
275
|
});
|
|
276
276
|
};
|
|
277
|
+
/**
|
|
278
|
+
* Returns the ProjectManagement service instance associated with this app.
|
|
279
|
+
*
|
|
280
|
+
* @return {ProjectManagement} The ProjectManagement service instance of this app.
|
|
281
|
+
*/
|
|
282
|
+
FirebaseApp.prototype.projectManagement = function () {
|
|
283
|
+
var _this = this;
|
|
284
|
+
return this.ensureService_('project-management', function () {
|
|
285
|
+
var projectManagementService = require('./project-management/project-management').ProjectManagement;
|
|
286
|
+
return new projectManagementService(_this);
|
|
287
|
+
});
|
|
288
|
+
};
|
|
277
289
|
Object.defineProperty(FirebaseApp.prototype, "name", {
|
|
278
290
|
/**
|
|
279
291
|
* Returns the name of the FirebaseApp instance.
|
|
280
292
|
*
|
|
281
|
-
* @
|
|
293
|
+
* @return {string} The name of the FirebaseApp instance.
|
|
282
294
|
*/
|
|
283
295
|
get: function () {
|
|
284
296
|
this.checkDestroyed_();
|
|
@@ -291,7 +303,7 @@ var FirebaseApp = /** @class */ (function () {
|
|
|
291
303
|
/**
|
|
292
304
|
* Returns the options for the FirebaseApp instance.
|
|
293
305
|
*
|
|
294
|
-
* @
|
|
306
|
+
* @return {FirebaseAppOptions} The options for the FirebaseApp instance.
|
|
295
307
|
*/
|
|
296
308
|
get: function () {
|
|
297
309
|
this.checkDestroyed_();
|
|
@@ -303,7 +315,7 @@ var FirebaseApp = /** @class */ (function () {
|
|
|
303
315
|
/**
|
|
304
316
|
* Deletes the FirebaseApp instance.
|
|
305
317
|
*
|
|
306
|
-
* @
|
|
318
|
+
* @return {Promise<void>} An empty Promise fulfilled once the FirebaseApp instance is deleted.
|
|
307
319
|
*/
|
|
308
320
|
FirebaseApp.prototype.delete = function () {
|
|
309
321
|
var _this = this;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin v6.
|
|
1
|
+
/*! firebase-admin v6.5.1 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2017 Google Inc.
|
|
@@ -214,23 +214,23 @@ var FirebaseNamespaceInternals = /** @class */ (function () {
|
|
|
214
214
|
}());
|
|
215
215
|
exports.FirebaseNamespaceInternals = FirebaseNamespaceInternals;
|
|
216
216
|
var firebaseCredential = {
|
|
217
|
-
cert: function (serviceAccountPathOrObject) {
|
|
217
|
+
cert: function (serviceAccountPathOrObject, httpAgent) {
|
|
218
218
|
var stringifiedServiceAccount = JSON.stringify(serviceAccountPathOrObject);
|
|
219
219
|
if (!(stringifiedServiceAccount in globalCertCreds)) {
|
|
220
|
-
globalCertCreds[stringifiedServiceAccount] = new credential_1.CertCredential(serviceAccountPathOrObject);
|
|
220
|
+
globalCertCreds[stringifiedServiceAccount] = new credential_1.CertCredential(serviceAccountPathOrObject, httpAgent);
|
|
221
221
|
}
|
|
222
222
|
return globalCertCreds[stringifiedServiceAccount];
|
|
223
223
|
},
|
|
224
|
-
refreshToken: function (refreshTokenPathOrObject) {
|
|
224
|
+
refreshToken: function (refreshTokenPathOrObject, httpAgent) {
|
|
225
225
|
var stringifiedRefreshToken = JSON.stringify(refreshTokenPathOrObject);
|
|
226
226
|
if (!(stringifiedRefreshToken in globalRefreshTokenCreds)) {
|
|
227
|
-
globalRefreshTokenCreds[stringifiedRefreshToken] = new credential_1.RefreshTokenCredential(refreshTokenPathOrObject);
|
|
227
|
+
globalRefreshTokenCreds[stringifiedRefreshToken] = new credential_1.RefreshTokenCredential(refreshTokenPathOrObject, httpAgent);
|
|
228
228
|
}
|
|
229
229
|
return globalRefreshTokenCreds[stringifiedRefreshToken];
|
|
230
230
|
},
|
|
231
|
-
applicationDefault: function () {
|
|
231
|
+
applicationDefault: function (httpAgent) {
|
|
232
232
|
if (typeof globalAppDefaultCred === 'undefined') {
|
|
233
|
-
globalAppDefaultCred = new credential_1.ApplicationDefaultCredential();
|
|
233
|
+
globalAppDefaultCred = new credential_1.ApplicationDefaultCredential(httpAgent);
|
|
234
234
|
}
|
|
235
235
|
return globalAppDefaultCred;
|
|
236
236
|
},
|
|
@@ -246,7 +246,7 @@ var FirebaseNamespace = /** @class */ (function () {
|
|
|
246
246
|
this.__esModule = true;
|
|
247
247
|
/* tslint:enable:variable-name */
|
|
248
248
|
this.credential = firebaseCredential;
|
|
249
|
-
this.SDK_VERSION = '6.
|
|
249
|
+
this.SDK_VERSION = '6.5.1';
|
|
250
250
|
/* tslint:disable */
|
|
251
251
|
// TODO(jwenger): Database is the only consumer of firebase.Promise. We should update it to use
|
|
252
252
|
// use the native Promise and then remove this.
|
|
@@ -347,6 +347,22 @@ var FirebaseNamespace = /** @class */ (function () {
|
|
|
347
347
|
enumerable: true,
|
|
348
348
|
configurable: true
|
|
349
349
|
});
|
|
350
|
+
Object.defineProperty(FirebaseNamespace.prototype, "projectManagement", {
|
|
351
|
+
/**
|
|
352
|
+
* Gets the `ProjectManagement` service namespace. The returned namespace can be used to get the
|
|
353
|
+
* `ProjectManagement` service for the default app or an explicitly specified app.
|
|
354
|
+
*/
|
|
355
|
+
get: function () {
|
|
356
|
+
var _this = this;
|
|
357
|
+
var fn = function (app) {
|
|
358
|
+
return _this.ensureApp(app).projectManagement();
|
|
359
|
+
};
|
|
360
|
+
var projectManagement = require('./project-management/project-management').ProjectManagement;
|
|
361
|
+
return Object.assign(fn, { ProjectManagement: projectManagement });
|
|
362
|
+
},
|
|
363
|
+
enumerable: true,
|
|
364
|
+
configurable: true
|
|
365
|
+
});
|
|
350
366
|
/**
|
|
351
367
|
* Initializes the FirebaseApp instance.
|
|
352
368
|
*
|
package/lib/firebase-service.js
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin v6.
|
|
1
|
+
/*! firebase-admin v6.5.1 */
|
|
2
2
|
/*!
|
|
3
3
|
* Copyright 2017 Google Inc.
|
|
4
4
|
*
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
import {Bucket} from '@google-cloud/storage';
|
|
19
19
|
import * as _firestore from '@google-cloud/firestore';
|
|
20
|
+
import {Agent} from 'http';
|
|
20
21
|
|
|
21
22
|
declare namespace admin {
|
|
22
23
|
interface FirebaseError {
|
|
@@ -50,6 +51,7 @@ declare namespace admin {
|
|
|
50
51
|
serviceAccountId?: string;
|
|
51
52
|
storageBucket?: string;
|
|
52
53
|
projectId?: string;
|
|
54
|
+
httpAgent?: Agent;
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
var SDK_VERSION: string;
|
|
@@ -62,6 +64,7 @@ declare namespace admin {
|
|
|
62
64
|
function storage(app?: admin.app.App): admin.storage.Storage;
|
|
63
65
|
function firestore(app?: admin.app.App): admin.firestore.Firestore;
|
|
64
66
|
function instanceId(app?: admin.app.App): admin.instanceId.InstanceId;
|
|
67
|
+
function projectManagement(app?: admin.app.App): admin.projectManagement.ProjectManagement;
|
|
65
68
|
function initializeApp(options?: admin.AppOptions, name?: string): admin.app.App;
|
|
66
69
|
}
|
|
67
70
|
|
|
@@ -75,6 +78,7 @@ declare namespace admin.app {
|
|
|
75
78
|
firestore(): admin.firestore.Firestore;
|
|
76
79
|
instanceId(): admin.instanceId.InstanceId;
|
|
77
80
|
messaging(): admin.messaging.Messaging;
|
|
81
|
+
projectManagement(): admin.projectManagement.ProjectManagement;
|
|
78
82
|
storage(): admin.storage.Storage;
|
|
79
83
|
delete(): Promise<void>;
|
|
80
84
|
}
|
|
@@ -101,11 +105,11 @@ declare namespace admin.auth {
|
|
|
101
105
|
|
|
102
106
|
interface UserRecord {
|
|
103
107
|
uid: string;
|
|
104
|
-
email
|
|
108
|
+
email?: string;
|
|
105
109
|
emailVerified: boolean;
|
|
106
|
-
displayName
|
|
107
|
-
phoneNumber
|
|
108
|
-
photoURL
|
|
110
|
+
displayName?: string;
|
|
111
|
+
phoneNumber?: string;
|
|
112
|
+
photoURL?: string;
|
|
109
113
|
disabled: boolean;
|
|
110
114
|
metadata: admin.auth.UserMetadata;
|
|
111
115
|
providerData: admin.auth.UserInfo[];
|
|
@@ -268,9 +272,9 @@ declare namespace admin.credential {
|
|
|
268
272
|
getAccessToken(): Promise<admin.GoogleOAuthAccessToken>;
|
|
269
273
|
}
|
|
270
274
|
|
|
271
|
-
function applicationDefault(): admin.credential.Credential;
|
|
272
|
-
function cert(serviceAccountPathOrObject: string|admin.ServiceAccount): admin.credential.Credential;
|
|
273
|
-
function refreshToken(refreshTokenPathOrObject: string|Object): admin.credential.Credential;
|
|
275
|
+
function applicationDefault(httpAgent?: Agent): admin.credential.Credential;
|
|
276
|
+
function cert(serviceAccountPathOrObject: string|admin.ServiceAccount, httpAgent?: Agent): admin.credential.Credential;
|
|
277
|
+
function refreshToken(refreshTokenPathOrObject: string|Object, httpAgent?: Agent): admin.credential.Credential;
|
|
274
278
|
}
|
|
275
279
|
|
|
276
280
|
declare namespace admin.database {
|
|
@@ -430,6 +434,7 @@ declare namespace admin.messaging {
|
|
|
430
434
|
bodyLocArgs?: string[];
|
|
431
435
|
titleLocKey?: string;
|
|
432
436
|
titleLocArgs?: string[];
|
|
437
|
+
channelId?: string;
|
|
433
438
|
};
|
|
434
439
|
|
|
435
440
|
type ApnsConfig = {
|
|
@@ -445,7 +450,7 @@ declare namespace admin.messaging {
|
|
|
445
450
|
type Aps = {
|
|
446
451
|
alert?: string | ApsAlert;
|
|
447
452
|
badge?: number;
|
|
448
|
-
sound?: string;
|
|
453
|
+
sound?: string | CriticalSound;
|
|
449
454
|
contentAvailable?: boolean;
|
|
450
455
|
mutableContent?: boolean;
|
|
451
456
|
category?: string;
|
|
@@ -455,15 +460,24 @@ declare namespace admin.messaging {
|
|
|
455
460
|
|
|
456
461
|
type ApsAlert = {
|
|
457
462
|
title?: string;
|
|
463
|
+
subtitle?: string;
|
|
458
464
|
body?: string;
|
|
459
465
|
locKey?: string;
|
|
460
466
|
locArgs?: string[];
|
|
461
467
|
titleLocKey?: string;
|
|
462
468
|
titleLocArgs?: string[];
|
|
469
|
+
subtitleLocKey?: string;
|
|
470
|
+
subtitleLocArgs?: string[];
|
|
463
471
|
actionLocKey?: string;
|
|
464
472
|
launchImage?: string;
|
|
465
473
|
};
|
|
466
474
|
|
|
475
|
+
type CriticalSound = {
|
|
476
|
+
critical?: boolean;
|
|
477
|
+
name: string;
|
|
478
|
+
volume?: number;
|
|
479
|
+
}
|
|
480
|
+
|
|
467
481
|
type Notification = {
|
|
468
482
|
title?: string;
|
|
469
483
|
body?: string;
|
|
@@ -651,6 +665,62 @@ declare namespace admin.instanceId {
|
|
|
651
665
|
}
|
|
652
666
|
}
|
|
653
667
|
|
|
668
|
+
declare namespace admin.projectManagement {
|
|
669
|
+
interface ShaCertificate {
|
|
670
|
+
certType: ('sha1' | 'sha256');
|
|
671
|
+
shaHash: string;
|
|
672
|
+
resourceName?: string;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
interface AndroidAppMetadata {
|
|
676
|
+
resourceName: string;
|
|
677
|
+
appId: string;
|
|
678
|
+
displayName: string | null;
|
|
679
|
+
projectId: string;
|
|
680
|
+
packageName: string;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
interface AndroidApp {
|
|
684
|
+
appId: string;
|
|
685
|
+
|
|
686
|
+
getMetadata(): Promise<admin.projectManagement.AndroidAppMetadata>;
|
|
687
|
+
setDisplayName(newDisplayName: string): Promise<void>;
|
|
688
|
+
getShaCertificates(): Promise<admin.projectManagement.ShaCertificate[]>;
|
|
689
|
+
addShaCertificate(certificateToAdd: ShaCertificate): Promise<void>;
|
|
690
|
+
deleteShaCertificate(certificateToRemove: ShaCertificate): Promise<void>;
|
|
691
|
+
getConfig(): Promise<string>;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
interface IosAppMetadata {
|
|
695
|
+
resourceName: string;
|
|
696
|
+
appId: string;
|
|
697
|
+
displayName: string;
|
|
698
|
+
projectId: string;
|
|
699
|
+
bundleId: string;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
interface IosApp {
|
|
703
|
+
appId: string;
|
|
704
|
+
|
|
705
|
+
getMetadata(): Promise<admin.projectManagement.IosAppMetadata>;
|
|
706
|
+
setDisplayName(newDisplayName: string): Promise<void>;
|
|
707
|
+
getConfig(): Promise<string>;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
interface ProjectManagement {
|
|
711
|
+
app: admin.app.App;
|
|
712
|
+
|
|
713
|
+
listAndroidApps(): Promise<admin.projectManagement.AndroidApp[]>;
|
|
714
|
+
listIosApps(): Promise<admin.projectManagement.IosApp[]>;
|
|
715
|
+
androidApp(appId: string): admin.projectManagement.AndroidApp;
|
|
716
|
+
iosApp(appId: string): admin.projectManagement.IosApp;
|
|
717
|
+
shaCertificate(shaHash: string): admin.projectManagement.ShaCertificate;
|
|
718
|
+
createAndroidApp(
|
|
719
|
+
packageName: string, displayName?: string): Promise<admin.projectManagement.AndroidApp>;
|
|
720
|
+
createIosApp(bundleId: string, displayName?: string): Promise<admin.projectManagement.IosApp>;
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
|
|
654
724
|
declare module 'firebase-admin' {
|
|
655
725
|
}
|
|
656
726
|
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin v6.
|
|
1
|
+
/*! firebase-admin v6.5.1 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2017 Google Inc.
|
|
@@ -16,4 +16,11 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
var firebase = require("./default-namespace");
|
|
19
|
+
// Only Node.js has a process variable that is of [[Class]] process
|
|
20
|
+
var processGlobal = typeof process !== 'undefined' ? process : 0;
|
|
21
|
+
if (Object.prototype.toString.call(processGlobal) !== '[object process]') {
|
|
22
|
+
var message = "\n======== WARNING! ========\n\nfirebase-admin appears to have been installed in an unsupported environment.\nThis package should only be used in server-side or backend Node.js environments,\nand should not be used in web browsers or other client-side environments.\n\nUse the Firebase JS SDK for client-side Firebase integrations:\n\nhttps://firebase.google.com/docs/web/setup\n";
|
|
23
|
+
// tslint:disable-next-line:no-console
|
|
24
|
+
console.error(message);
|
|
25
|
+
}
|
|
19
26
|
module.exports = firebase;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin v6.
|
|
1
|
+
/*! firebase-admin v6.5.1 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2017 Google Inc.
|
|
@@ -23,7 +23,7 @@ var validator = require("../utils/validator");
|
|
|
23
23
|
var FIREBASE_MESSAGING_TIMEOUT = 10000;
|
|
24
24
|
var FIREBASE_MESSAGING_HTTP_METHOD = 'POST';
|
|
25
25
|
var FIREBASE_MESSAGING_HEADERS = {
|
|
26
|
-
'Sdk-Version': 'Node/Admin/6.
|
|
26
|
+
'Sdk-Version': 'Node/Admin/6.5.1',
|
|
27
27
|
'access_token_auth': 'true',
|
|
28
28
|
};
|
|
29
29
|
/**
|