firebase-admin 9.3.0 → 9.5.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.
Files changed (82) hide show
  1. package/lib/auth/action-code-settings-builder.js +1 -1
  2. package/lib/auth/auth-api-request.js +98 -25
  3. package/lib/auth/auth-config.js +15 -15
  4. package/lib/auth/auth.js +82 -61
  5. package/lib/auth/identifier.js +3 -2
  6. package/lib/auth/index.d.ts +1868 -0
  7. package/lib/{credential/credential-interfaces.js → auth/index.js} +1 -1
  8. package/lib/auth/tenant-manager.js +1 -1
  9. package/lib/auth/tenant.js +7 -1
  10. package/lib/auth/token-generator.js +6 -4
  11. package/lib/auth/token-verifier.js +32 -36
  12. package/lib/auth/user-import-builder.js +18 -15
  13. package/lib/auth/user-record.js +4 -4
  14. package/lib/credential/credential-internal.js +1 -2
  15. package/lib/credential/credential.js +8 -122
  16. package/lib/credential/index.d.ts +169 -0
  17. package/lib/credential/index.js +5 -17
  18. package/lib/database/database-internal.js +19 -26
  19. package/lib/database/index.d.ts +89 -0
  20. package/lib/database/index.js +12 -28
  21. package/lib/default-namespace.js +2 -1
  22. package/lib/firebase-app.js +26 -48
  23. package/lib/firebase-namespace-api.d.ts +238 -0
  24. package/lib/{firebase-service.js → firebase-namespace-api.js} +2 -2
  25. package/lib/{database/database.js → firebase-namespace.d.ts} +14 -7
  26. package/lib/firebase-namespace.js +22 -92
  27. package/lib/firestore/firestore-internal.js +2 -19
  28. package/lib/firestore/index.d.ts +50 -0
  29. package/lib/firestore/index.js +28 -43
  30. package/lib/index.d.ts +3 -932
  31. package/lib/index.js +2 -1
  32. package/lib/instance-id/index.d.ts +81 -0
  33. package/lib/instance-id/index.js +1 -10
  34. package/lib/instance-id/instance-id-request-internal.js +2 -1
  35. package/lib/instance-id/instance-id.js +1 -19
  36. package/lib/machine-learning/index.d.ts +249 -0
  37. package/lib/{messaging/messaging-types.js → machine-learning/index.js} +2 -2
  38. package/lib/machine-learning/machine-learning-api-client.js +1 -1
  39. package/lib/machine-learning/machine-learning-utils.js +1 -1
  40. package/lib/machine-learning/machine-learning.js +3 -22
  41. package/lib/messaging/batch-request-internal.js +1 -1
  42. package/lib/messaging/index.d.ts +1174 -0
  43. package/lib/messaging/index.js +1 -24
  44. package/lib/messaging/messaging-api-request-internal.js +2 -1
  45. package/lib/messaging/messaging-errors-internal.js +1 -1
  46. package/lib/messaging/messaging-internal.js +1 -1
  47. package/lib/messaging/messaging.js +21 -25
  48. package/lib/project-management/android-app.js +7 -6
  49. package/lib/project-management/index.d.ts +363 -0
  50. package/lib/project-management/index.js +23 -25
  51. package/lib/project-management/ios-app.js +5 -4
  52. package/lib/project-management/project-management-api-request-internal.js +5 -5
  53. package/lib/project-management/project-management.js +9 -26
  54. package/lib/remote-config/index.d.ts +359 -0
  55. package/lib/remote-config/index.js +1 -26
  56. package/lib/remote-config/remote-config-api-client-internal.js +3 -3
  57. package/lib/remote-config/remote-config.js +15 -32
  58. package/lib/security-rules/index.d.ts +216 -0
  59. package/lib/security-rules/index.js +1 -24
  60. package/lib/security-rules/security-rules-api-client-internal.js +1 -1
  61. package/lib/security-rules/security-rules-internal.js +1 -1
  62. package/lib/security-rules/security-rules.js +6 -15
  63. package/lib/storage/index.d.ts +60 -0
  64. package/lib/storage/index.js +1 -10
  65. package/lib/storage/storage.js +2 -19
  66. package/lib/utils/api-request.js +10 -3
  67. package/lib/utils/deep-copy.js +2 -1
  68. package/lib/utils/error.js +2 -1
  69. package/lib/utils/index.js +6 -5
  70. package/lib/utils/validator.js +2 -1
  71. package/package.json +15 -12
  72. package/lib/auth.d.ts +0 -2016
  73. package/lib/credential.d.ts +0 -150
  74. package/lib/database.d.ts +0 -1663
  75. package/lib/instance-id.d.ts +0 -37
  76. package/lib/messaging.d.ts +0 -1341
  77. package/lib/project-management/app-metadata.js +0 -37
  78. package/lib/project-management.d.ts +0 -361
  79. package/lib/remote-config/remote-config-api-client.js +0 -36
  80. package/lib/remote-config.d.ts +0 -350
  81. package/lib/security-rules.d.ts +0 -192
  82. package/lib/storage.d.ts +0 -40
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v9.3.0 */
1
+ /*! firebase-admin v9.5.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2020 Google Inc.
@@ -16,26 +16,3 @@
16
16
  * limitations under the License.
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.admin = exports.messaging = void 0;
20
- var firebaseAdmin = require("../index");
21
- function messaging(app) {
22
- if (typeof (app) === 'undefined') {
23
- app = firebaseAdmin.app();
24
- }
25
- return app.messaging();
26
- }
27
- exports.messaging = messaging;
28
- /**
29
- * We must define a namespace to make the typings work correctly. Otherwise
30
- * `admin.messaging()` cannot be called like a function. Temporarily,
31
- * admin.messaging is used as the namespace name because we cannot barrel
32
- * re-export the contents from messsaging, and we want it to
33
- * match the namespacing in the re-export inside src/index.d.ts
34
- */
35
- /* eslint-disable @typescript-eslint/no-namespace */
36
- var admin;
37
- (function (admin) {
38
- var messaging;
39
- (function (messaging) {
40
- })(messaging = admin.messaging || (admin.messaging = {}));
41
- })(admin = exports.admin || (exports.admin = {}));
@@ -1,6 +1,7 @@
1
- /*! firebase-admin v9.3.0 */
1
+ /*! firebase-admin v9.5.0 */
2
2
  "use strict";
3
3
  /*!
4
+ * @license
4
5
  * Copyright 2017 Google Inc.
5
6
  *
6
7
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v9.3.0 */
1
+ /*! firebase-admin v9.5.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2019 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v9.3.0 */
1
+ /*! firebase-admin v9.5.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2020 Google Inc.
@@ -1,6 +1,7 @@
1
- /*! firebase-admin v9.3.0 */
1
+ /*! firebase-admin v9.5.0 */
2
2
  "use strict";
3
3
  /*!
4
+ * @license
4
5
  * Copyright 2017 Google Inc.
5
6
  *
6
7
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,6 +16,17 @@
15
16
  * See the License for the specific language governing permissions and
16
17
  * limitations under the License.
17
18
  */
19
+ var __assign = (this && this.__assign) || function () {
20
+ __assign = Object.assign || function(t) {
21
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
22
+ s = arguments[i];
23
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
24
+ t[p] = s[p];
25
+ }
26
+ return t;
27
+ };
28
+ return __assign.apply(this, arguments);
29
+ };
18
30
  Object.defineProperty(exports, "__esModule", { value: true });
19
31
  exports.Messaging = void 0;
20
32
  var deep_copy_1 = require("../utils/deep-copy");
@@ -144,29 +156,12 @@ function mapRawResponseToTopicManagementResponse(response) {
144
156
  }
145
157
  return result;
146
158
  }
147
- /**
148
- * Internals of a Messaging instance.
149
- */
150
- var MessagingInternals = /** @class */ (function () {
151
- function MessagingInternals() {
152
- }
153
- /**
154
- * Deletes the service and its associated resources.
155
- *
156
- * @return {Promise<()>} An empty Promise that will be fulfilled when the service is deleted.
157
- */
158
- MessagingInternals.prototype.delete = function () {
159
- // There are no resources to clean up.
160
- return Promise.resolve(undefined);
161
- };
162
- return MessagingInternals;
163
- }());
164
159
  /**
165
160
  * Messaging service bound to the provided app.
166
161
  */
167
162
  var Messaging = /** @class */ (function () {
168
163
  /**
169
- * Gets the {@link admin.messaging.Messaging `Messaging`} service for the
164
+ * Gets the {@link messaging.Messaging `Messaging`} service for the
170
165
  * current app.
171
166
  *
172
167
  * @example
@@ -179,7 +174,6 @@ var Messaging = /** @class */ (function () {
179
174
  * @return The `Messaging` service for the current app.
180
175
  */
181
176
  function Messaging(app) {
182
- this.INTERNAL = new MessagingInternals();
183
177
  if (!validator.isNonNullObject(app) || !('options' in app)) {
184
178
  throw new error_1.FirebaseMessagingError(error_1.MessagingClientErrorCode.INVALID_ARGUMENT, 'First argument passed to admin.messaging() must be a valid Firebase app instance.');
185
179
  }
@@ -376,7 +370,8 @@ var Messaging = /** @class */ (function () {
376
370
  return mapRawResponseToDevicesResponse(response);
377
371
  }
378
372
  else {
379
- return mapRawResponseToDeviceGroupResponse(response);
373
+ var groupResponse = mapRawResponseToDeviceGroupResponse(response);
374
+ return __assign(__assign({}, groupResponse), { canonicalRegistrationTokenCount: -1, multicastId: -1, results: [] });
380
375
  }
381
376
  });
382
377
  };
@@ -440,7 +435,8 @@ var Messaging = /** @class */ (function () {
440
435
  throw new error_1.FirebaseMessagingError(error_1.MessagingClientErrorCode.INVALID_RECIPIENT, 'Notification key provided to sendToDeviceGroup() is invalid.');
441
436
  }
442
437
  else {
443
- return mapRawResponseToDevicesResponse(response);
438
+ var devicesResponse = mapRawResponseToDevicesResponse(response);
439
+ return __assign(__assign({}, devicesResponse), { failedRegistrationTokens: [] });
444
440
  }
445
441
  }
446
442
  return mapRawResponseToDeviceGroupResponse(response);
@@ -660,7 +656,7 @@ var Messaging = /** @class */ (function () {
660
656
  // Validate the payload does not contain any invalid keys
661
657
  if (validPayloadKeys.indexOf(payloadKey) === -1) {
662
658
  throw new error_1.FirebaseMessagingError(error_1.MessagingClientErrorCode.INVALID_PAYLOAD, "Messaging payload contains an invalid \"" + payloadKey + "\" property. Valid properties are " +
663
- "\"data\" and \"notification\".");
659
+ '"data" and "notification".');
664
660
  }
665
661
  else {
666
662
  containsDataOrNotificationKey = true;
@@ -674,13 +670,13 @@ var Messaging = /** @class */ (function () {
674
670
  // Validate each top-level key in the payload is an object
675
671
  if (!validator.isNonNullObject(value)) {
676
672
  throw new error_1.FirebaseMessagingError(error_1.MessagingClientErrorCode.INVALID_PAYLOAD, "Messaging payload contains an invalid value for the \"" + payloadKey + "\" property. " +
677
- "Value must be an object.");
673
+ 'Value must be an object.');
678
674
  }
679
675
  Object.keys(value).forEach(function (subKey) {
680
676
  if (!validator.isString(value[subKey])) {
681
677
  // Validate all sub-keys have a string value
682
678
  throw new error_1.FirebaseMessagingError(error_1.MessagingClientErrorCode.INVALID_PAYLOAD, "Messaging payload contains an invalid value for the \"" + payloadKey + "." + subKey + "\" " +
683
- "property. Values must be strings.");
679
+ 'property. Values must be strings.');
684
680
  }
685
681
  else if (payloadKey === 'data' && /^google\./.test(subKey)) {
686
682
  // Validate the data payload does not contain keys which start with 'google.'.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v9.3.0 */
1
+ /*! firebase-admin v9.5.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2018 Google Inc.
@@ -20,7 +20,8 @@ exports.ShaCertificate = exports.AndroidApp = void 0;
20
20
  var error_1 = require("../utils/error");
21
21
  var validator = require("../utils/validator");
22
22
  var project_management_api_request_internal_1 = require("./project-management-api-request-internal");
23
- var app_metadata_1 = require("./app-metadata");
23
+ var index_1 = require("./index");
24
+ var AppPlatform = index_1.projectManagement.AppPlatform;
24
25
  var AndroidApp = /** @class */ (function () {
25
26
  function AndroidApp(appId, requestHandler) {
26
27
  this.appId = appId;
@@ -44,7 +45,7 @@ var AndroidApp = /** @class */ (function () {
44
45
  project_management_api_request_internal_1.assertServerResponse(validator.isNonEmptyString(responseData[requiredField]), responseData, "getMetadata()'s responseData." + requiredField + " must be a non-empty string.");
45
46
  });
46
47
  var metadata = {
47
- platform: app_metadata_1.AppPlatform.ANDROID,
48
+ platform: AppPlatform.ANDROID,
48
49
  resourceName: responseData.name,
49
50
  appId: responseData.appId,
50
51
  displayName: responseData.displayName || null,
@@ -82,7 +83,7 @@ var AndroidApp = /** @class */ (function () {
82
83
  return responseData.certificates.map(function (certificateJson) {
83
84
  requiredFieldsList.forEach(function (requiredField) {
84
85
  project_management_api_request_internal_1.assertServerResponse(validator.isNonEmptyString(certificateJson[requiredField]), responseData, "getShaCertificates()'s responseData.certificates[]." + requiredField + " must be a "
85
- + "non-empty string.");
86
+ + 'non-empty string.');
86
87
  });
87
88
  return new ShaCertificate(certificateJson.shaHash, certificateJson.name);
88
89
  });
@@ -127,7 +128,7 @@ var AndroidApp = /** @class */ (function () {
127
128
  .then(function (responseData) {
128
129
  project_management_api_request_internal_1.assertServerResponse(validator.isNonNullObject(responseData), responseData, 'getConfig()\'s responseData must be a non-null object.');
129
130
  var base64ConfigFileContents = responseData.configFileContents;
130
- project_management_api_request_internal_1.assertServerResponse(validator.isBase64String(base64ConfigFileContents), responseData, "getConfig()'s responseData.configFileContents must be a base64 string.");
131
+ project_management_api_request_internal_1.assertServerResponse(validator.isBase64String(base64ConfigFileContents), responseData, 'getConfig()\'s responseData.configFileContents must be a base64 string.');
131
132
  return Buffer.from(base64ConfigFileContents, 'base64').toString('utf8');
132
133
  });
133
134
  };
@@ -138,7 +139,7 @@ exports.AndroidApp = AndroidApp;
138
139
  * A SHA-1 or SHA-256 certificate.
139
140
  *
140
141
  * Do not call this constructor directly. Instead, use
141
- * [`projectManagement.shaCertificate()`](admin.projectManagement.ProjectManagement#shaCertificate).
142
+ * [`projectManagement.shaCertificate()`](projectManagement.ProjectManagement#shaCertificate).
142
143
  */
143
144
  var ShaCertificate = /** @class */ (function () {
144
145
  /**
@@ -0,0 +1,363 @@
1
+ /*! firebase-admin v9.5.0 */
2
+ /*!
3
+ * Copyright 2020 Google Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { app } from '../firebase-namespace-api';
18
+ /**
19
+ * Gets the {@link projectManagement.ProjectManagement
20
+ * `ProjectManagement`} service for the default app or a given app.
21
+ *
22
+ * `admin.projectManagement()` can be called with no arguments to access the
23
+ * default app's {@link projectManagement.ProjectManagement
24
+ * `ProjectManagement`} service, or as `admin.projectManagement(app)` to access
25
+ * the {@link projectManagement.ProjectManagement `ProjectManagement`}
26
+ * service associated with a specific app.
27
+ *
28
+ * @example
29
+ * ```javascript
30
+ * // Get the ProjectManagement service for the default app
31
+ * var defaultProjectManagement = admin.projectManagement();
32
+ * ```
33
+ *
34
+ * @example
35
+ * ```javascript
36
+ * // Get the ProjectManagement service for a given app
37
+ * var otherProjectManagement = admin.projectManagement(otherApp);
38
+ * ```
39
+ *
40
+ * @param app Optional app whose `ProjectManagement` service
41
+ * to return. If not provided, the default `ProjectManagement` service will
42
+ * be returned. *
43
+ * @return The default `ProjectManagement` service if no app is provided or the
44
+ * `ProjectManagement` service associated with the provided app.
45
+ */
46
+ export declare function projectManagement(app?: app.App): projectManagement.ProjectManagement;
47
+ export declare namespace projectManagement {
48
+ /**
49
+ * Metadata about a Firebase Android App.
50
+ */
51
+ interface AndroidAppMetadata extends AppMetadata {
52
+ platform: AppPlatform.ANDROID;
53
+ /**
54
+ * The canonical package name of the Android App, as would appear in the Google Play Developer
55
+ * Console.
56
+ *
57
+ * @example
58
+ * ```javascript
59
+ * var packageName = androidAppMetadata.packageName;
60
+ * ```
61
+ */
62
+ packageName: string;
63
+ }
64
+ /**
65
+ * Metadata about a Firebase app.
66
+ */
67
+ interface AppMetadata {
68
+ /**
69
+ * The globally unique, Firebase-assigned identifier of the app.
70
+ *
71
+ * @example
72
+ * ```javascript
73
+ * var appId = appMetadata.appId;
74
+ * ```
75
+ */
76
+ appId: string;
77
+ /**
78
+ * The optional user-assigned display name of the app.
79
+ *
80
+ * @example
81
+ * ```javascript
82
+ * var displayName = appMetadata.displayName;
83
+ * ```
84
+ */
85
+ displayName?: string;
86
+ /**
87
+ * The development platform of the app. Supporting Android and iOS app platforms.
88
+ *
89
+ * @example
90
+ * ```javascript
91
+ * var platform = AppPlatform.ANDROID;
92
+ * ```
93
+ */
94
+ platform: AppPlatform;
95
+ /**
96
+ * The globally unique, user-assigned ID of the parent project for the app.
97
+ *
98
+ * @example
99
+ * ```javascript
100
+ * var projectId = appMetadata.projectId;
101
+ * ```
102
+ */
103
+ projectId: string;
104
+ /**
105
+ * The fully-qualified resource name that identifies this app.
106
+ *
107
+ * This is useful when manually constructing requests for Firebase's public API.
108
+ *
109
+ * @example
110
+ * ```javascript
111
+ * var resourceName = androidAppMetadata.resourceName;
112
+ * ```
113
+ */
114
+ resourceName: string;
115
+ }
116
+ /**
117
+ * Platforms with which a Firebase App can be associated.
118
+ */
119
+ enum AppPlatform {
120
+ /**
121
+ * Unknown state. This is only used for distinguishing unset values.
122
+ */
123
+ PLATFORM_UNKNOWN = "PLATFORM_UNKNOWN",
124
+ /**
125
+ * The Firebase App is associated with iOS.
126
+ */
127
+ IOS = "IOS",
128
+ /**
129
+ * The Firebase App is associated with Android.
130
+ */
131
+ ANDROID = "ANDROID"
132
+ }
133
+ /**
134
+ * Metadata about a Firebase iOS App.
135
+ */
136
+ interface IosAppMetadata extends AppMetadata {
137
+ platform: AppPlatform.IOS;
138
+ /**
139
+ * The canonical bundle ID of the iOS App as it would appear in the iOS App Store.
140
+ *
141
+ * @example
142
+ * ```javascript
143
+ * var bundleId = iosAppMetadata.bundleId;
144
+ *```
145
+ */
146
+ bundleId: string;
147
+ }
148
+ /**
149
+ * A reference to a Firebase Android app.
150
+ *
151
+ * Do not call this constructor directly. Instead, use
152
+ * [`projectManagement.androidApp()`](projectManagement.ProjectManagement#androidApp).
153
+ */
154
+ interface AndroidApp {
155
+ appId: string;
156
+ /**
157
+ * Retrieves metadata about this Android app.
158
+ *
159
+ * @return A promise that resolves to the retrieved metadata about this Android app.
160
+ */
161
+ getMetadata(): Promise<AndroidAppMetadata>;
162
+ /**
163
+ * Sets the optional user-assigned display name of the app.
164
+ *
165
+ * @param newDisplayName The new display name to set.
166
+ *
167
+ * @return A promise that resolves when the display name has been set.
168
+ */
169
+ setDisplayName(newDisplayName: string): Promise<void>;
170
+ /**
171
+ * Gets the list of SHA certificates associated with this Android app in Firebase.
172
+ *
173
+ * @return The list of SHA-1 and SHA-256 certificates associated with this Android app in
174
+ * Firebase.
175
+ */
176
+ getShaCertificates(): Promise<ShaCertificate[]>;
177
+ /**
178
+ * Adds the given SHA certificate to this Android app.
179
+ *
180
+ * @param certificateToAdd The SHA certificate to add.
181
+ *
182
+ * @return A promise that resolves when the given certificate
183
+ * has been added to the Android app.
184
+ */
185
+ addShaCertificate(certificateToAdd: ShaCertificate): Promise<void>;
186
+ /**
187
+ * Deletes the specified SHA certificate from this Android app.
188
+ *
189
+ * @param certificateToDelete The SHA certificate to delete.
190
+ *
191
+ * @return A promise that resolves when the specified
192
+ * certificate has been removed from the Android app.
193
+ */
194
+ deleteShaCertificate(certificateToRemove: ShaCertificate): Promise<void>;
195
+ /**
196
+ * Gets the configuration artifact associated with this app.
197
+ *
198
+ * @return A promise that resolves to the Android app's
199
+ * Firebase config file, in UTF-8 string format. This string is typically
200
+ * intended to be written to a JSON file that gets shipped with your Android
201
+ * app.
202
+ */
203
+ getConfig(): Promise<string>;
204
+ }
205
+ /**
206
+ * A reference to a Firebase iOS app.
207
+ *
208
+ * Do not call this constructor directly. Instead, use
209
+ * [`projectManagement.iosApp()`](projectManagement.ProjectManagement#iosApp).
210
+ */
211
+ interface IosApp {
212
+ appId: string;
213
+ /**
214
+ * Retrieves metadata about this iOS app.
215
+ *
216
+ * @return {!Promise<admin.projectManagement.IosAppMetadata>} A promise that
217
+ * resolves to the retrieved metadata about this iOS app.
218
+ */
219
+ getMetadata(): Promise<IosAppMetadata>;
220
+ /**
221
+ * Sets the optional user-assigned display name of the app.
222
+ *
223
+ * @param newDisplayName The new display name to set.
224
+ *
225
+ * @return A promise that resolves when the display name has
226
+ * been set.
227
+ */
228
+ setDisplayName(newDisplayName: string): Promise<void>;
229
+ /**
230
+ * Gets the configuration artifact associated with this app.
231
+ *
232
+ * @return A promise that resolves to the iOS app's Firebase
233
+ * config file, in UTF-8 string format. This string is typically intended to
234
+ * be written to a plist file that gets shipped with your iOS app.
235
+ */
236
+ getConfig(): Promise<string>;
237
+ }
238
+ /**
239
+ * A SHA-1 or SHA-256 certificate.
240
+ *
241
+ * Do not call this constructor directly. Instead, use
242
+ * [`projectManagement.shaCertificate()`](projectManagement.ProjectManagement#shaCertificate).
243
+ */
244
+ interface ShaCertificate {
245
+ /**
246
+ * The SHA certificate type.
247
+ *
248
+ * @example
249
+ * ```javascript
250
+ * var certType = shaCertificate.certType;
251
+ * ```
252
+ */
253
+ certType: ('sha1' | 'sha256');
254
+ /**
255
+ * The SHA-1 or SHA-256 hash for this certificate.
256
+ *
257
+ * @example
258
+ * ```javascript
259
+ * var shaHash = shaCertificate.shaHash;
260
+ * ```
261
+ */
262
+ shaHash: string;
263
+ /**
264
+ * The fully-qualified resource name that identifies this sha-key.
265
+ *
266
+ * This is useful when manually constructing requests for Firebase's public API.
267
+ *
268
+ * @example
269
+ * ```javascript
270
+ * var resourceName = shaCertificate.resourceName;
271
+ * ```
272
+ */
273
+ resourceName?: string;
274
+ }
275
+ /**
276
+ * The Firebase ProjectManagement service interface.
277
+ *
278
+ * Do not call this constructor directly. Instead, use
279
+ * [`admin.projectManagement()`](projectManagement#projectManagement).
280
+ */
281
+ interface ProjectManagement {
282
+ app: app.App;
283
+ /**
284
+ * Lists up to 100 Firebase apps associated with this Firebase project.
285
+ *
286
+ * @return A promise that resolves to the metadata list of the apps.
287
+ */
288
+ listAppMetadata(): Promise<AppMetadata[]>;
289
+ /**
290
+ * Lists up to 100 Firebase Android apps associated with this Firebase project.
291
+ *
292
+ * @return The list of Android apps.
293
+ */
294
+ listAndroidApps(): Promise<AndroidApp[]>;
295
+ /**
296
+ * Lists up to 100 Firebase iOS apps associated with this Firebase project.
297
+ *
298
+ * @return The list of iOS apps.
299
+ */
300
+ listIosApps(): Promise<IosApp[]>;
301
+ /**
302
+ * Creates an `AndroidApp` object, referencing the specified Android app within
303
+ * this Firebase project.
304
+ *
305
+ * This method does not perform an RPC.
306
+ *
307
+ * @param appId The `appId` of the Android app to reference.
308
+ *
309
+ * @return An `AndroidApp` object that references the specified Firebase Android app.
310
+ */
311
+ androidApp(appId: string): AndroidApp;
312
+ /**
313
+ * Update the display name of this Firebase project.
314
+ *
315
+ * @param newDisplayName The new display name to be updated.
316
+ *
317
+ * @return A promise that resolves when the project display name has been updated.
318
+ */
319
+ setDisplayName(newDisplayName: string): Promise<void>;
320
+ /**
321
+ * Creates an `iOSApp` object, referencing the specified iOS app within
322
+ * this Firebase project.
323
+ *
324
+ * This method does not perform an RPC.
325
+ *
326
+ * @param appId The `appId` of the iOS app to reference.
327
+ *
328
+ * @return An `iOSApp` object that references the specified Firebase iOS app.
329
+ */
330
+ iosApp(appId: string): IosApp;
331
+ /**
332
+ * Creates a `ShaCertificate` object.
333
+ *
334
+ * This method does not perform an RPC.
335
+ *
336
+ * @param shaHash The SHA-1 or SHA-256 hash for this certificate.
337
+ *
338
+ * @return A `ShaCertificate` object contains the specified SHA hash.
339
+ */
340
+ shaCertificate(shaHash: string): ShaCertificate;
341
+ /**
342
+ * Creates a new Firebase Android app associated with this Firebase project.
343
+ *
344
+ * @param packageName The canonical package name of the Android App,
345
+ * as would appear in the Google Play Developer Console.
346
+ * @param displayName An optional user-assigned display name for this
347
+ * new app.
348
+ *
349
+ * @return A promise that resolves to the newly created Android app.
350
+ */
351
+ createAndroidApp(packageName: string, displayName?: string): Promise<AndroidApp>;
352
+ /**
353
+ * Creates a new Firebase iOS app associated with this Firebase project.
354
+ *
355
+ * @param bundleId The iOS app bundle ID to use for this new app.
356
+ * @param displayName An optional user-assigned display name for this
357
+ * new app.
358
+ *
359
+ * @return A promise that resolves to the newly created iOS app.
360
+ */
361
+ createIosApp(bundleId: string, displayName?: string): Promise<IosApp>;
362
+ }
363
+ }
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v9.3.0 */
1
+ /*! firebase-admin v9.5.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2020 Google Inc.
@@ -16,28 +16,26 @@
16
16
  * limitations under the License.
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.admin = exports.projectManagement = void 0;
20
- var appMetadataApi = require("./app-metadata");
21
- var firebaseAdmin = require("../index");
22
- function projectManagement(app) {
23
- if (typeof (app) === 'undefined') {
24
- app = firebaseAdmin.app();
25
- }
26
- return app.projectManagement();
27
- }
28
- exports.projectManagement = projectManagement;
29
- /**
30
- * We must define a namespace to make the typings work correctly. Otherwise
31
- * `admin.projectManagement()` cannot be called like a function. Temporarily,
32
- * admin.projectManagement is used as the namespace name because we cannot barrel
33
- * re-export the contents from instance-id, and we want it to
34
- * match the namespacing in the re-export inside src/index.d.ts
35
- */
19
+ exports.projectManagement = void 0;
36
20
  /* eslint-disable @typescript-eslint/no-namespace */
37
- var admin;
38
- (function (admin) {
39
- var projectManagement;
40
- (function (projectManagement) {
41
- projectManagement.AppPlatform = appMetadataApi.AppPlatform;
42
- })(projectManagement = admin.projectManagement || (admin.projectManagement = {}));
43
- })(admin = exports.admin || (exports.admin = {}));
21
+ var projectManagement;
22
+ (function (projectManagement) {
23
+ /**
24
+ * Platforms with which a Firebase App can be associated.
25
+ */
26
+ var AppPlatform;
27
+ (function (AppPlatform) {
28
+ /**
29
+ * Unknown state. This is only used for distinguishing unset values.
30
+ */
31
+ AppPlatform["PLATFORM_UNKNOWN"] = "PLATFORM_UNKNOWN";
32
+ /**
33
+ * The Firebase App is associated with iOS.
34
+ */
35
+ AppPlatform["IOS"] = "IOS";
36
+ /**
37
+ * The Firebase App is associated with Android.
38
+ */
39
+ AppPlatform["ANDROID"] = "ANDROID";
40
+ })(AppPlatform = projectManagement.AppPlatform || (projectManagement.AppPlatform = {}));
41
+ })(projectManagement = exports.projectManagement || (exports.projectManagement = {}));
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v9.3.0 */
1
+ /*! firebase-admin v9.5.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2018 Google Inc.
@@ -20,7 +20,8 @@ exports.IosApp = void 0;
20
20
  var error_1 = require("../utils/error");
21
21
  var validator = require("../utils/validator");
22
22
  var project_management_api_request_internal_1 = require("./project-management-api-request-internal");
23
- var app_metadata_1 = require("./app-metadata");
23
+ var index_1 = require("./index");
24
+ var AppPlatform = index_1.projectManagement.AppPlatform;
24
25
  var IosApp = /** @class */ (function () {
25
26
  function IosApp(appId, requestHandler) {
26
27
  this.appId = appId;
@@ -45,7 +46,7 @@ var IosApp = /** @class */ (function () {
45
46
  project_management_api_request_internal_1.assertServerResponse(validator.isNonEmptyString(responseData[requiredField]), responseData, "getMetadata()'s responseData." + requiredField + " must be a non-empty string.");
46
47
  });
47
48
  var metadata = {
48
- platform: app_metadata_1.AppPlatform.IOS,
49
+ platform: AppPlatform.IOS,
49
50
  resourceName: responseData.name,
50
51
  appId: responseData.appId,
51
52
  displayName: responseData.displayName || null,
@@ -78,7 +79,7 @@ var IosApp = /** @class */ (function () {
78
79
  .then(function (responseData) {
79
80
  project_management_api_request_internal_1.assertServerResponse(validator.isNonNullObject(responseData), responseData, 'getConfig()\'s responseData must be a non-null object.');
80
81
  var base64ConfigFileContents = responseData.configFileContents;
81
- project_management_api_request_internal_1.assertServerResponse(validator.isBase64String(base64ConfigFileContents), responseData, "getConfig()'s responseData.configFileContents must be a base64 string.");
82
+ project_management_api_request_internal_1.assertServerResponse(validator.isBase64String(base64ConfigFileContents), responseData, 'getConfig()\'s responseData.configFileContents must be a base64 string.');
82
83
  return Buffer.from(base64ConfigFileContents, 'base64').toString('utf8');
83
84
  });
84
85
  };