firebase-admin 10.2.0 → 11.0.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/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 +7 -1
- package/lib/app/credential-internal.js +120 -106
- 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 +346 -393
- 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 +1 -1
- package/lib/auth/base-auth.js +137 -144
- 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 +62 -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/eventarc/cloudevent.d.ts +1 -1
- package/lib/eventarc/cloudevent.js +1 -1
- package/lib/eventarc/eventarc-client-internal.d.ts +1 -1
- package/lib/eventarc/eventarc-client-internal.js +63 -129
- package/lib/eventarc/eventarc-utils.d.ts +1 -1
- package/lib/eventarc/eventarc-utils.js +16 -32
- package/lib/eventarc/eventarc.d.ts +1 -1
- package/lib/eventarc/eventarc.js +51 -65
- package/lib/eventarc/index.d.ts +1 -1
- package/lib/eventarc/index.js +7 -7
- 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 +19 -1
- package/lib/functions/functions-api-client-internal.js +83 -103
- package/lib/functions/functions-api.d.ts +1 -1
- package/lib/functions/functions-api.js +1 -1
- package/lib/functions/functions.d.ts +1 -1
- package/lib/functions/functions.js +13 -15
- package/lib/functions/index.d.ts +1 -1
- package/lib/functions/index.js +7 -7
- 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 +3 -1
- package/lib/security-rules/security-rules-api-client-internal.js +118 -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 +83 -92
- 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 +1 -1
- package/lib/utils/error.js +611 -681
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +38 -43
- 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 +25 -10
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v11.0.1 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2018 Google Inc.
|
|
@@ -17,41 +17,41 @@
|
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.ShaCertificate = exports.AndroidApp = void 0;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
const error_1 = require("../utils/error");
|
|
21
|
+
const validator = require("../utils/validator");
|
|
22
|
+
const project_management_api_request_internal_1 = require("./project-management-api-request-internal");
|
|
23
|
+
const app_metadata_1 = require("./app-metadata");
|
|
24
24
|
/**
|
|
25
25
|
* A reference to a Firebase Android app.
|
|
26
26
|
*
|
|
27
27
|
* Do not call this constructor directly. Instead, use {@link ProjectManagement.androidApp}.
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
class AndroidApp {
|
|
30
30
|
/**
|
|
31
31
|
* @internal
|
|
32
32
|
*/
|
|
33
|
-
|
|
33
|
+
constructor(appId, requestHandler) {
|
|
34
34
|
this.appId = appId;
|
|
35
35
|
this.requestHandler = requestHandler;
|
|
36
36
|
if (!validator.isNonEmptyString(appId)) {
|
|
37
37
|
throw new error_1.FirebaseProjectManagementError('invalid-argument', 'appId must be a non-empty string.');
|
|
38
38
|
}
|
|
39
|
-
this.resourceName =
|
|
39
|
+
this.resourceName = `projects/-/androidApps/${appId}`;
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* Retrieves metadata about this Android app.
|
|
43
43
|
*
|
|
44
44
|
* @returns A promise that resolves to the retrieved metadata about this Android app.
|
|
45
45
|
*/
|
|
46
|
-
|
|
46
|
+
getMetadata() {
|
|
47
47
|
return this.requestHandler.getResource(this.resourceName)
|
|
48
|
-
.then(
|
|
49
|
-
project_management_api_request_internal_1.assertServerResponse(validator.isNonNullObject(responseData), responseData, 'getMetadata()\'s responseData must be a non-null object.');
|
|
50
|
-
|
|
51
|
-
requiredFieldsList.forEach(
|
|
52
|
-
project_management_api_request_internal_1.assertServerResponse(validator.isNonEmptyString(responseData[requiredField]), responseData,
|
|
48
|
+
.then((responseData) => {
|
|
49
|
+
(0, project_management_api_request_internal_1.assertServerResponse)(validator.isNonNullObject(responseData), responseData, 'getMetadata()\'s responseData must be a non-null object.');
|
|
50
|
+
const requiredFieldsList = ['name', 'appId', 'projectId', 'packageName'];
|
|
51
|
+
requiredFieldsList.forEach((requiredField) => {
|
|
52
|
+
(0, project_management_api_request_internal_1.assertServerResponse)(validator.isNonEmptyString(responseData[requiredField]), responseData, `getMetadata()'s responseData.${requiredField} must be a non-empty string.`);
|
|
53
53
|
});
|
|
54
|
-
|
|
54
|
+
const metadata = {
|
|
55
55
|
platform: app_metadata_1.AppPlatform.ANDROID,
|
|
56
56
|
resourceName: responseData.name,
|
|
57
57
|
appId: responseData.appId,
|
|
@@ -61,7 +61,7 @@ var AndroidApp = /** @class */ (function () {
|
|
|
61
61
|
};
|
|
62
62
|
return metadata;
|
|
63
63
|
});
|
|
64
|
-
}
|
|
64
|
+
}
|
|
65
65
|
/**
|
|
66
66
|
* Sets the optional user-assigned display name of the app.
|
|
67
67
|
*
|
|
@@ -69,33 +69,33 @@ var AndroidApp = /** @class */ (function () {
|
|
|
69
69
|
*
|
|
70
70
|
* @returns A promise that resolves when the display name has been set.
|
|
71
71
|
*/
|
|
72
|
-
|
|
72
|
+
setDisplayName(newDisplayName) {
|
|
73
73
|
return this.requestHandler.setDisplayName(this.resourceName, newDisplayName);
|
|
74
|
-
}
|
|
74
|
+
}
|
|
75
75
|
/**
|
|
76
76
|
* Gets the list of SHA certificates associated with this Android app in Firebase.
|
|
77
77
|
*
|
|
78
78
|
* @returns The list of SHA-1 and SHA-256 certificates associated with this Android app in
|
|
79
79
|
* Firebase.
|
|
80
80
|
*/
|
|
81
|
-
|
|
81
|
+
getShaCertificates() {
|
|
82
82
|
return this.requestHandler.getAndroidShaCertificates(this.resourceName)
|
|
83
|
-
.then(
|
|
84
|
-
project_management_api_request_internal_1.assertServerResponse(validator.isNonNullObject(responseData), responseData, 'getShaCertificates()\'s responseData must be a non-null object.');
|
|
83
|
+
.then((responseData) => {
|
|
84
|
+
(0, project_management_api_request_internal_1.assertServerResponse)(validator.isNonNullObject(responseData), responseData, 'getShaCertificates()\'s responseData must be a non-null object.');
|
|
85
85
|
if (!responseData.certificates) {
|
|
86
86
|
return [];
|
|
87
87
|
}
|
|
88
|
-
project_management_api_request_internal_1.assertServerResponse(validator.isArray(responseData.certificates), responseData, '"certificates" field must be present in the getShaCertificates() response data.');
|
|
89
|
-
|
|
90
|
-
return responseData.certificates.map(
|
|
91
|
-
requiredFieldsList.forEach(
|
|
92
|
-
project_management_api_request_internal_1.assertServerResponse(validator.isNonEmptyString(certificateJson[requiredField]), responseData,
|
|
88
|
+
(0, project_management_api_request_internal_1.assertServerResponse)(validator.isArray(responseData.certificates), responseData, '"certificates" field must be present in the getShaCertificates() response data.');
|
|
89
|
+
const requiredFieldsList = ['name', 'shaHash'];
|
|
90
|
+
return responseData.certificates.map((certificateJson) => {
|
|
91
|
+
requiredFieldsList.forEach((requiredField) => {
|
|
92
|
+
(0, project_management_api_request_internal_1.assertServerResponse)(validator.isNonEmptyString(certificateJson[requiredField]), responseData, `getShaCertificates()'s responseData.certificates[].${requiredField} must be a `
|
|
93
93
|
+ 'non-empty string.');
|
|
94
94
|
});
|
|
95
95
|
return new ShaCertificate(certificateJson.shaHash, certificateJson.name);
|
|
96
96
|
});
|
|
97
97
|
});
|
|
98
|
-
}
|
|
98
|
+
}
|
|
99
99
|
/**
|
|
100
100
|
* Adds the given SHA certificate to this Android app.
|
|
101
101
|
*
|
|
@@ -104,9 +104,9 @@ var AndroidApp = /** @class */ (function () {
|
|
|
104
104
|
* @returns A promise that resolves when the given certificate
|
|
105
105
|
* has been added to the Android app.
|
|
106
106
|
*/
|
|
107
|
-
|
|
107
|
+
addShaCertificate(certificateToAdd) {
|
|
108
108
|
return this.requestHandler.addAndroidShaCertificate(this.resourceName, certificateToAdd);
|
|
109
|
-
}
|
|
109
|
+
}
|
|
110
110
|
/**
|
|
111
111
|
* Deletes the specified SHA certificate from this Android app.
|
|
112
112
|
*
|
|
@@ -115,13 +115,13 @@ var AndroidApp = /** @class */ (function () {
|
|
|
115
115
|
* @returns A promise that resolves when the specified
|
|
116
116
|
* certificate has been removed from the Android app.
|
|
117
117
|
*/
|
|
118
|
-
|
|
118
|
+
deleteShaCertificate(certificateToDelete) {
|
|
119
119
|
if (!certificateToDelete.resourceName) {
|
|
120
120
|
throw new error_1.FirebaseProjectManagementError('invalid-argument', 'Specified certificate does not include a resourceName. (Use AndroidApp.getShaCertificates() to retrieve ' +
|
|
121
121
|
'certificates with a resourceName.');
|
|
122
122
|
}
|
|
123
123
|
return this.requestHandler.deleteResource(certificateToDelete.resourceName);
|
|
124
|
-
}
|
|
124
|
+
}
|
|
125
125
|
/**
|
|
126
126
|
* Gets the configuration artifact associated with this app.
|
|
127
127
|
*
|
|
@@ -130,17 +130,16 @@ var AndroidApp = /** @class */ (function () {
|
|
|
130
130
|
* intended to be written to a JSON file that gets shipped with your Android
|
|
131
131
|
* app.
|
|
132
132
|
*/
|
|
133
|
-
|
|
133
|
+
getConfig() {
|
|
134
134
|
return this.requestHandler.getConfig(this.resourceName)
|
|
135
|
-
.then(
|
|
136
|
-
project_management_api_request_internal_1.assertServerResponse(validator.isNonNullObject(responseData), responseData, 'getConfig()\'s responseData must be a non-null object.');
|
|
137
|
-
|
|
138
|
-
project_management_api_request_internal_1.assertServerResponse(validator.isBase64String(base64ConfigFileContents), responseData, 'getConfig()\'s responseData.configFileContents must be a base64 string.');
|
|
135
|
+
.then((responseData) => {
|
|
136
|
+
(0, project_management_api_request_internal_1.assertServerResponse)(validator.isNonNullObject(responseData), responseData, 'getConfig()\'s responseData must be a non-null object.');
|
|
137
|
+
const base64ConfigFileContents = responseData.configFileContents;
|
|
138
|
+
(0, project_management_api_request_internal_1.assertServerResponse)(validator.isBase64String(base64ConfigFileContents), responseData, 'getConfig()\'s responseData.configFileContents must be a base64 string.');
|
|
139
139
|
return Buffer.from(base64ConfigFileContents, 'base64').toString('utf8');
|
|
140
140
|
});
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
}());
|
|
141
|
+
}
|
|
142
|
+
}
|
|
144
143
|
exports.AndroidApp = AndroidApp;
|
|
145
144
|
/**
|
|
146
145
|
* A SHA-1 or SHA-256 certificate.
|
|
@@ -148,7 +147,7 @@ exports.AndroidApp = AndroidApp;
|
|
|
148
147
|
* Do not call this constructor directly. Instead, use
|
|
149
148
|
* [`projectManagement.shaCertificate()`](projectManagement.ProjectManagement#shaCertificate).
|
|
150
149
|
*/
|
|
151
|
-
|
|
150
|
+
class ShaCertificate {
|
|
152
151
|
/**
|
|
153
152
|
* Creates a ShaCertificate using the given hash. The ShaCertificate's type (eg. 'sha256') is
|
|
154
153
|
* automatically determined from the hash itself.
|
|
@@ -167,7 +166,7 @@ var ShaCertificate = /** @class */ (function () {
|
|
|
167
166
|
*
|
|
168
167
|
* @internal
|
|
169
168
|
*/
|
|
170
|
-
|
|
169
|
+
constructor(shaHash, resourceName) {
|
|
171
170
|
this.shaHash = shaHash;
|
|
172
171
|
this.resourceName = resourceName;
|
|
173
172
|
if (/^[a-fA-F0-9]{40}$/.test(shaHash)) {
|
|
@@ -180,6 +179,5 @@ var ShaCertificate = /** @class */ (function () {
|
|
|
180
179
|
throw new error_1.FirebaseProjectManagementError('invalid-argument', 'shaHash must be either a sha256 hash or a sha1 hash.');
|
|
181
180
|
}
|
|
182
181
|
}
|
|
183
|
-
|
|
184
|
-
}());
|
|
182
|
+
}
|
|
185
183
|
exports.ShaCertificate = ShaCertificate;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v11.0.1 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2020 Google Inc.
|
|
@@ -16,14 +16,14 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.getProjectManagement = void 0;
|
|
19
|
+
exports.getProjectManagement = exports.IosApp = exports.ShaCertificate = exports.AndroidApp = exports.ProjectManagement = exports.AppPlatform = void 0;
|
|
20
20
|
/**
|
|
21
21
|
* Firebase project management.
|
|
22
22
|
*
|
|
23
23
|
* @packageDocumentation
|
|
24
24
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
const app_1 = require("../app");
|
|
26
|
+
const project_management_1 = require("./project-management");
|
|
27
27
|
var app_metadata_1 = require("./app-metadata");
|
|
28
28
|
Object.defineProperty(exports, "AppPlatform", { enumerable: true, get: function () { return app_metadata_1.AppPlatform; } });
|
|
29
29
|
var project_management_2 = require("./project-management");
|
|
@@ -60,9 +60,9 @@ Object.defineProperty(exports, "IosApp", { enumerable: true, get: function () {
|
|
|
60
60
|
*/
|
|
61
61
|
function getProjectManagement(app) {
|
|
62
62
|
if (typeof app === 'undefined') {
|
|
63
|
-
app = app_1.getApp();
|
|
63
|
+
app = (0, app_1.getApp)();
|
|
64
64
|
}
|
|
65
|
-
|
|
66
|
-
return firebaseApp.getOrInitService('projectManagement',
|
|
65
|
+
const firebaseApp = app;
|
|
66
|
+
return firebaseApp.getOrInitService('projectManagement', (app) => new project_management_1.ProjectManagement(app));
|
|
67
67
|
}
|
|
68
68
|
exports.getProjectManagement = getProjectManagement;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v11.0.1 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2018 Google Inc.
|
|
@@ -17,26 +17,26 @@
|
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.IosApp = void 0;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
const error_1 = require("../utils/error");
|
|
21
|
+
const validator = require("../utils/validator");
|
|
22
|
+
const project_management_api_request_internal_1 = require("./project-management-api-request-internal");
|
|
23
|
+
const app_metadata_1 = require("./app-metadata");
|
|
24
24
|
/**
|
|
25
25
|
* A reference to a Firebase iOS app.
|
|
26
26
|
*
|
|
27
27
|
* Do not call this constructor directly. Instead, use {@link ProjectManagement.iosApp}.
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
class IosApp {
|
|
30
30
|
/**
|
|
31
31
|
* @internal
|
|
32
32
|
*/
|
|
33
|
-
|
|
33
|
+
constructor(appId, requestHandler) {
|
|
34
34
|
this.appId = appId;
|
|
35
35
|
this.requestHandler = requestHandler;
|
|
36
36
|
if (!validator.isNonEmptyString(appId)) {
|
|
37
37
|
throw new error_1.FirebaseProjectManagementError('invalid-argument', 'appId must be a non-empty string.');
|
|
38
38
|
}
|
|
39
|
-
this.resourceName =
|
|
39
|
+
this.resourceName = `projects/-/iosApps/${appId}`;
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* Retrieves metadata about this iOS app.
|
|
@@ -44,15 +44,15 @@ var IosApp = /** @class */ (function () {
|
|
|
44
44
|
* @returns A promise that
|
|
45
45
|
* resolves to the retrieved metadata about this iOS app.
|
|
46
46
|
*/
|
|
47
|
-
|
|
47
|
+
getMetadata() {
|
|
48
48
|
return this.requestHandler.getResource(this.resourceName)
|
|
49
|
-
.then(
|
|
50
|
-
project_management_api_request_internal_1.assertServerResponse(validator.isNonNullObject(responseData), responseData, 'getMetadata()\'s responseData must be a non-null object.');
|
|
51
|
-
|
|
52
|
-
requiredFieldsList.forEach(
|
|
53
|
-
project_management_api_request_internal_1.assertServerResponse(validator.isNonEmptyString(responseData[requiredField]), responseData,
|
|
49
|
+
.then((responseData) => {
|
|
50
|
+
(0, project_management_api_request_internal_1.assertServerResponse)(validator.isNonNullObject(responseData), responseData, 'getMetadata()\'s responseData must be a non-null object.');
|
|
51
|
+
const requiredFieldsList = ['name', 'appId', 'projectId', 'bundleId'];
|
|
52
|
+
requiredFieldsList.forEach((requiredField) => {
|
|
53
|
+
(0, project_management_api_request_internal_1.assertServerResponse)(validator.isNonEmptyString(responseData[requiredField]), responseData, `getMetadata()'s responseData.${requiredField} must be a non-empty string.`);
|
|
54
54
|
});
|
|
55
|
-
|
|
55
|
+
const metadata = {
|
|
56
56
|
platform: app_metadata_1.AppPlatform.IOS,
|
|
57
57
|
resourceName: responseData.name,
|
|
58
58
|
appId: responseData.appId,
|
|
@@ -62,7 +62,7 @@ var IosApp = /** @class */ (function () {
|
|
|
62
62
|
};
|
|
63
63
|
return metadata;
|
|
64
64
|
});
|
|
65
|
-
}
|
|
65
|
+
}
|
|
66
66
|
/**
|
|
67
67
|
* Sets the optional user-assigned display name of the app.
|
|
68
68
|
*
|
|
@@ -71,9 +71,9 @@ var IosApp = /** @class */ (function () {
|
|
|
71
71
|
* @returns A promise that resolves when the display name has
|
|
72
72
|
* been set.
|
|
73
73
|
*/
|
|
74
|
-
|
|
74
|
+
setDisplayName(newDisplayName) {
|
|
75
75
|
return this.requestHandler.setDisplayName(this.resourceName, newDisplayName);
|
|
76
|
-
}
|
|
76
|
+
}
|
|
77
77
|
/**
|
|
78
78
|
* Gets the configuration artifact associated with this app.
|
|
79
79
|
*
|
|
@@ -81,15 +81,14 @@ var IosApp = /** @class */ (function () {
|
|
|
81
81
|
* config file, in UTF-8 string format. This string is typically intended to
|
|
82
82
|
* be written to a plist file that gets shipped with your iOS app.
|
|
83
83
|
*/
|
|
84
|
-
|
|
84
|
+
getConfig() {
|
|
85
85
|
return this.requestHandler.getConfig(this.resourceName)
|
|
86
|
-
.then(
|
|
87
|
-
project_management_api_request_internal_1.assertServerResponse(validator.isNonNullObject(responseData), responseData, 'getConfig()\'s responseData must be a non-null object.');
|
|
88
|
-
|
|
89
|
-
project_management_api_request_internal_1.assertServerResponse(validator.isBase64String(base64ConfigFileContents), responseData, 'getConfig()\'s responseData.configFileContents must be a base64 string.');
|
|
86
|
+
.then((responseData) => {
|
|
87
|
+
(0, project_management_api_request_internal_1.assertServerResponse)(validator.isNonNullObject(responseData), responseData, 'getConfig()\'s responseData must be a non-null object.');
|
|
88
|
+
const base64ConfigFileContents = responseData.configFileContents;
|
|
89
|
+
(0, project_management_api_request_internal_1.assertServerResponse)(validator.isBase64String(base64ConfigFileContents), responseData, 'getConfig()\'s responseData.configFileContents must be a base64 string.');
|
|
90
90
|
return Buffer.from(base64ConfigFileContents, 'base64').toString('utf8');
|
|
91
91
|
});
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
}());
|
|
92
|
+
}
|
|
93
|
+
}
|
|
95
94
|
exports.IosApp = IosApp;
|