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.
Files changed (192) hide show
  1. package/README.md +1 -1
  2. package/lib/app/core.d.ts +1 -1
  3. package/lib/app/core.js +1 -1
  4. package/lib/app/credential-factory.d.ts +1 -1
  5. package/lib/app/credential-factory.js +8 -8
  6. package/lib/app/credential-internal.d.ts +7 -1
  7. package/lib/app/credential-internal.js +120 -106
  8. package/lib/app/credential.d.ts +1 -1
  9. package/lib/app/credential.js +1 -1
  10. package/lib/app/firebase-app.d.ts +1 -1
  11. package/lib/app/firebase-app.js +76 -91
  12. package/lib/app/firebase-namespace.d.ts +1 -1
  13. package/lib/app/firebase-namespace.js +209 -279
  14. package/lib/app/index.d.ts +1 -1
  15. package/lib/app/index.js +4 -4
  16. package/lib/app/lifecycle.d.ts +1 -1
  17. package/lib/app/lifecycle.js +37 -43
  18. package/lib/app-check/app-check-api-client-internal.d.ts +1 -1
  19. package/lib/app-check/app-check-api-client-internal.js +54 -73
  20. package/lib/app-check/app-check-api.d.ts +1 -1
  21. package/lib/app-check/app-check-api.js +1 -1
  22. package/lib/app-check/app-check-namespace.d.ts +1 -1
  23. package/lib/app-check/app-check-namespace.js +1 -1
  24. package/lib/app-check/app-check.d.ts +1 -1
  25. package/lib/app-check/app-check.js +17 -19
  26. package/lib/app-check/index.d.ts +1 -1
  27. package/lib/app-check/index.js +7 -7
  28. package/lib/app-check/token-generator.d.ts +1 -1
  29. package/lib/app-check/token-generator.js +47 -52
  30. package/lib/app-check/token-verifier.d.ts +1 -1
  31. package/lib/app-check/token-verifier.js +46 -50
  32. package/lib/auth/action-code-settings-builder.d.ts +1 -1
  33. package/lib/auth/action-code-settings-builder.js +10 -11
  34. package/lib/auth/auth-api-request.d.ts +1 -1
  35. package/lib/auth/auth-api-request.js +346 -393
  36. package/lib/auth/auth-config.d.ts +1 -1
  37. package/lib/auth/auth-config.js +95 -106
  38. package/lib/auth/auth-namespace.d.ts +1 -1
  39. package/lib/auth/auth-namespace.js +1 -1
  40. package/lib/auth/auth.d.ts +1 -1
  41. package/lib/auth/auth.js +20 -40
  42. package/lib/auth/base-auth.d.ts +1 -1
  43. package/lib/auth/base-auth.js +137 -144
  44. package/lib/auth/identifier.d.ts +1 -1
  45. package/lib/auth/identifier.js +2 -2
  46. package/lib/auth/index.d.ts +1 -1
  47. package/lib/auth/index.js +7 -7
  48. package/lib/auth/tenant-manager.d.ts +1 -1
  49. package/lib/auth/tenant-manager.js +49 -71
  50. package/lib/auth/tenant.d.ts +1 -1
  51. package/lib/auth/tenant.js +44 -55
  52. package/lib/auth/token-generator.d.ts +1 -1
  53. package/lib/auth/token-generator.js +49 -53
  54. package/lib/auth/token-verifier.d.ts +1 -1
  55. package/lib/auth/token-verifier.js +83 -91
  56. package/lib/auth/user-import-builder.d.ts +1 -1
  57. package/lib/auth/user-import-builder.js +70 -73
  58. package/lib/auth/user-record.d.ts +1 -1
  59. package/lib/auth/user-record.js +62 -84
  60. package/lib/credential/index.d.ts +1 -1
  61. package/lib/credential/index.js +2 -2
  62. package/lib/database/database-namespace.d.ts +1 -1
  63. package/lib/database/database-namespace.js +1 -1
  64. package/lib/database/database.d.ts +1 -1
  65. package/lib/database/database.js +92 -108
  66. package/lib/database/index.d.ts +1 -1
  67. package/lib/database/index.js +10 -10
  68. package/lib/default-namespace.d.ts +1 -1
  69. package/lib/default-namespace.js +2 -2
  70. package/lib/eventarc/cloudevent.d.ts +1 -1
  71. package/lib/eventarc/cloudevent.js +1 -1
  72. package/lib/eventarc/eventarc-client-internal.d.ts +1 -1
  73. package/lib/eventarc/eventarc-client-internal.js +63 -129
  74. package/lib/eventarc/eventarc-utils.d.ts +1 -1
  75. package/lib/eventarc/eventarc-utils.js +16 -32
  76. package/lib/eventarc/eventarc.d.ts +1 -1
  77. package/lib/eventarc/eventarc.js +51 -65
  78. package/lib/eventarc/index.d.ts +1 -1
  79. package/lib/eventarc/index.js +7 -7
  80. package/lib/firebase-namespace-api.d.ts +1 -1
  81. package/lib/firebase-namespace-api.js +8 -3
  82. package/lib/firestore/firestore-internal.d.ts +1 -1
  83. package/lib/firestore/firestore-internal.js +28 -37
  84. package/lib/firestore/firestore-namespace.d.ts +9 -1
  85. package/lib/firestore/firestore-namespace.js +2 -2
  86. package/lib/firestore/index.d.ts +2 -2
  87. package/lib/firestore/index.js +7 -7
  88. package/lib/functions/functions-api-client-internal.d.ts +19 -1
  89. package/lib/functions/functions-api-client-internal.js +83 -103
  90. package/lib/functions/functions-api.d.ts +1 -1
  91. package/lib/functions/functions-api.js +1 -1
  92. package/lib/functions/functions.d.ts +1 -1
  93. package/lib/functions/functions.js +13 -15
  94. package/lib/functions/index.d.ts +1 -1
  95. package/lib/functions/index.js +7 -7
  96. package/lib/index.d.ts +1 -1
  97. package/lib/index.js +14 -4
  98. package/lib/installations/index.d.ts +1 -1
  99. package/lib/installations/index.js +6 -6
  100. package/lib/installations/installations-namespace.d.ts +1 -1
  101. package/lib/installations/installations-namespace.js +1 -1
  102. package/lib/installations/installations-request-handler.d.ts +1 -1
  103. package/lib/installations/installations-request-handler.js +33 -36
  104. package/lib/installations/installations.d.ts +1 -1
  105. package/lib/installations/installations.js +17 -22
  106. package/lib/instance-id/index.d.ts +1 -1
  107. package/lib/instance-id/index.js +6 -6
  108. package/lib/instance-id/instance-id-namespace.d.ts +1 -1
  109. package/lib/instance-id/instance-id-namespace.js +1 -1
  110. package/lib/instance-id/instance-id.d.ts +1 -1
  111. package/lib/instance-id/instance-id.js +21 -26
  112. package/lib/machine-learning/index.d.ts +1 -1
  113. package/lib/machine-learning/index.js +7 -7
  114. package/lib/machine-learning/machine-learning-api-client.d.ts +1 -1
  115. package/lib/machine-learning/machine-learning-api-client.js +110 -124
  116. package/lib/machine-learning/machine-learning-namespace.d.ts +1 -1
  117. package/lib/machine-learning/machine-learning-namespace.js +1 -1
  118. package/lib/machine-learning/machine-learning-utils.d.ts +1 -1
  119. package/lib/machine-learning/machine-learning-utils.js +9 -24
  120. package/lib/machine-learning/machine-learning.d.ts +1 -1
  121. package/lib/machine-learning/machine-learning.js +146 -207
  122. package/lib/messaging/batch-request-internal.d.ts +1 -1
  123. package/lib/messaging/batch-request-internal.js +33 -35
  124. package/lib/messaging/index.d.ts +1 -1
  125. package/lib/messaging/index.js +7 -7
  126. package/lib/messaging/messaging-api-request-internal.d.ts +1 -1
  127. package/lib/messaging/messaging-api-request-internal.js +38 -40
  128. package/lib/messaging/messaging-api.d.ts +1 -1
  129. package/lib/messaging/messaging-api.js +1 -1
  130. package/lib/messaging/messaging-errors-internal.d.ts +1 -1
  131. package/lib/messaging/messaging-errors-internal.js +12 -13
  132. package/lib/messaging/messaging-internal.d.ts +1 -1
  133. package/lib/messaging/messaging-internal.js +51 -51
  134. package/lib/messaging/messaging-namespace.d.ts +1 -1
  135. package/lib/messaging/messaging-namespace.js +1 -1
  136. package/lib/messaging/messaging.d.ts +1 -1
  137. package/lib/messaging/messaging.js +184 -208
  138. package/lib/project-management/android-app.d.ts +1 -1
  139. package/lib/project-management/android-app.js +41 -43
  140. package/lib/project-management/app-metadata.d.ts +1 -1
  141. package/lib/project-management/app-metadata.js +1 -1
  142. package/lib/project-management/index.d.ts +1 -1
  143. package/lib/project-management/index.js +7 -7
  144. package/lib/project-management/ios-app.d.ts +1 -1
  145. package/lib/project-management/ios-app.js +25 -26
  146. package/lib/project-management/project-management-api-request-internal.d.ts +1 -1
  147. package/lib/project-management/project-management-api-request-internal.js +84 -89
  148. package/lib/project-management/project-management-namespace.d.ts +1 -1
  149. package/lib/project-management/project-management-namespace.js +1 -1
  150. package/lib/project-management/project-management.d.ts +1 -1
  151. package/lib/project-management/project-management.js +80 -87
  152. package/lib/remote-config/index.d.ts +1 -1
  153. package/lib/remote-config/index.js +7 -7
  154. package/lib/remote-config/remote-config-api-client-internal.d.ts +1 -1
  155. package/lib/remote-config/remote-config-api-client-internal.js +116 -154
  156. package/lib/remote-config/remote-config-api.d.ts +1 -1
  157. package/lib/remote-config/remote-config-api.js +1 -1
  158. package/lib/remote-config/remote-config-namespace.d.ts +1 -1
  159. package/lib/remote-config/remote-config-namespace.js +1 -1
  160. package/lib/remote-config/remote-config.d.ts +1 -1
  161. package/lib/remote-config/remote-config.js +51 -59
  162. package/lib/security-rules/index.d.ts +1 -1
  163. package/lib/security-rules/index.js +7 -7
  164. package/lib/security-rules/security-rules-api-client-internal.d.ts +3 -1
  165. package/lib/security-rules/security-rules-api-client-internal.js +118 -107
  166. package/lib/security-rules/security-rules-internal.d.ts +1 -1
  167. package/lib/security-rules/security-rules-internal.js +6 -21
  168. package/lib/security-rules/security-rules-namespace.d.ts +1 -1
  169. package/lib/security-rules/security-rules-namespace.js +1 -1
  170. package/lib/security-rules/security-rules.d.ts +1 -1
  171. package/lib/security-rules/security-rules.js +83 -92
  172. package/lib/storage/index.d.ts +1 -1
  173. package/lib/storage/index.js +7 -7
  174. package/lib/storage/storage-namespace.d.ts +1 -1
  175. package/lib/storage/storage-namespace.js +1 -1
  176. package/lib/storage/storage.d.ts +1 -1
  177. package/lib/storage/storage.js +25 -30
  178. package/lib/utils/api-request.d.ts +3 -1
  179. package/lib/utils/api-request.js +278 -356
  180. package/lib/utils/crypto-signer.d.ts +1 -1
  181. package/lib/utils/crypto-signer.js +58 -93
  182. package/lib/utils/deep-copy.d.ts +1 -1
  183. package/lib/utils/deep-copy.js +3 -3
  184. package/lib/utils/error.d.ts +1 -1
  185. package/lib/utils/error.js +611 -681
  186. package/lib/utils/index.d.ts +1 -1
  187. package/lib/utils/index.js +38 -43
  188. package/lib/utils/jwt.d.ts +1 -1
  189. package/lib/utils/jwt.js +97 -123
  190. package/lib/utils/validator.d.ts +1 -1
  191. package/lib/utils/validator.js +13 -13
  192. package/package.json +25 -10
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.2.0 */
1
+ /*! firebase-admin v11.0.1 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2019 Google Inc.
@@ -15,27 +15,12 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */
18
- var __extends = (this && this.__extends) || (function () {
19
- var extendStatics = function (d, b) {
20
- extendStatics = Object.setPrototypeOf ||
21
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
22
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
23
- return extendStatics(d, b);
24
- };
25
- return function (d, b) {
26
- extendStatics(d, b);
27
- function __() { this.constructor = d; }
28
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
29
- };
30
- })();
31
18
  Object.defineProperty(exports, "__esModule", { value: true });
32
19
  exports.FirebaseSecurityRulesError = void 0;
33
- var error_1 = require("../utils/error");
34
- var FirebaseSecurityRulesError = /** @class */ (function (_super) {
35
- __extends(FirebaseSecurityRulesError, _super);
36
- function FirebaseSecurityRulesError(code, message) {
37
- return _super.call(this, 'security-rules', code, message) || this;
20
+ const error_1 = require("../utils/error");
21
+ class FirebaseSecurityRulesError extends error_1.PrefixedFirebaseError {
22
+ constructor(code, message) {
23
+ super('security-rules', code, message);
38
24
  }
39
- return FirebaseSecurityRulesError;
40
- }(error_1.PrefixedFirebaseError));
25
+ }
41
26
  exports.FirebaseSecurityRulesError = FirebaseSecurityRulesError;
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.2.0 */
1
+ /*! firebase-admin v11.0.1 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.2.0 */
1
+ /*! firebase-admin v11.0.1 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.2.0 */
1
+ /*! firebase-admin v11.0.1 */
2
2
  /*!
3
3
  * Copyright 2019 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.2.0 */
1
+ /*! firebase-admin v11.0.1 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2019 Google Inc.
@@ -17,21 +17,21 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.SecurityRules = exports.Ruleset = exports.RulesetMetadataList = void 0;
20
- var validator = require("../utils/validator");
21
- var security_rules_api_client_internal_1 = require("./security-rules-api-client-internal");
22
- var security_rules_internal_1 = require("./security-rules-internal");
20
+ const validator = require("../utils/validator");
21
+ const security_rules_api_client_internal_1 = require("./security-rules-api-client-internal");
22
+ const security_rules_internal_1 = require("./security-rules-internal");
23
23
  /**
24
24
  * A page of ruleset metadata.
25
25
  */
26
- var RulesetMetadataList = /** @class */ (function () {
26
+ class RulesetMetadataList {
27
27
  /**
28
28
  * @internal
29
29
  */
30
- function RulesetMetadataList(response) {
30
+ constructor(response) {
31
31
  if (!validator.isNonNullObject(response) || !validator.isArray(response.rulesets)) {
32
- throw new security_rules_internal_1.FirebaseSecurityRulesError('invalid-argument', "Invalid ListRulesets response: " + JSON.stringify(response));
32
+ throw new security_rules_internal_1.FirebaseSecurityRulesError('invalid-argument', `Invalid ListRulesets response: ${JSON.stringify(response)}`);
33
33
  }
34
- this.rulesets = response.rulesets.map(function (rs) {
34
+ this.rulesets = response.rulesets.map((rs) => {
35
35
  return {
36
36
  name: stripProjectIdPrefix(rs.name),
37
37
  createTime: new Date(rs.createTime).toUTCString(),
@@ -41,40 +41,38 @@ var RulesetMetadataList = /** @class */ (function () {
41
41
  this.nextPageToken = response.nextPageToken;
42
42
  }
43
43
  }
44
- return RulesetMetadataList;
45
- }());
44
+ }
46
45
  exports.RulesetMetadataList = RulesetMetadataList;
47
46
  /**
48
47
  * A set of Firebase security rules.
49
48
  */
50
- var Ruleset = /** @class */ (function () {
49
+ class Ruleset {
51
50
  /**
52
51
  * @internal
53
52
  */
54
- function Ruleset(ruleset) {
53
+ constructor(ruleset) {
55
54
  if (!validator.isNonNullObject(ruleset) ||
56
55
  !validator.isNonEmptyString(ruleset.name) ||
57
56
  !validator.isNonEmptyString(ruleset.createTime) ||
58
57
  !validator.isNonNullObject(ruleset.source)) {
59
- throw new security_rules_internal_1.FirebaseSecurityRulesError('invalid-argument', "Invalid Ruleset response: " + JSON.stringify(ruleset));
58
+ throw new security_rules_internal_1.FirebaseSecurityRulesError('invalid-argument', `Invalid Ruleset response: ${JSON.stringify(ruleset)}`);
60
59
  }
61
60
  this.name = stripProjectIdPrefix(ruleset.name);
62
61
  this.createTime = new Date(ruleset.createTime).toUTCString();
63
62
  this.source = ruleset.source.files || [];
64
63
  }
65
- return Ruleset;
66
- }());
64
+ }
67
65
  exports.Ruleset = Ruleset;
68
66
  /**
69
67
  * The Firebase `SecurityRules` service interface.
70
68
  */
71
- var SecurityRules = /** @class */ (function () {
69
+ class SecurityRules {
72
70
  /**
73
71
  * @param app - The app for this SecurityRules service.
74
72
  * @constructor
75
73
  * @internal
76
74
  */
77
- function SecurityRules(app) {
75
+ constructor(app) {
78
76
  this.app = app;
79
77
  this.client = new security_rules_api_client_internal_1.SecurityRulesApiClient(app);
80
78
  }
@@ -88,12 +86,12 @@ var SecurityRules = /** @class */ (function () {
88
86
  * @param name - Name of the `Ruleset` to retrieve.
89
87
  * @returns A promise that fulfills with the specified `Ruleset`.
90
88
  */
91
- SecurityRules.prototype.getRuleset = function (name) {
89
+ getRuleset(name) {
92
90
  return this.client.getRuleset(name)
93
- .then(function (rulesetResponse) {
91
+ .then((rulesetResponse) => {
94
92
  return new Ruleset(rulesetResponse);
95
93
  });
96
- };
94
+ }
97
95
  /**
98
96
  * Gets the {@link Ruleset} currently applied to
99
97
  * Cloud Firestore. Rejects with a `not-found` error if no ruleset is applied
@@ -101,9 +99,9 @@ var SecurityRules = /** @class */ (function () {
101
99
  *
102
100
  * @returns A promise that fulfills with the Firestore ruleset.
103
101
  */
104
- SecurityRules.prototype.getFirestoreRuleset = function () {
102
+ getFirestoreRuleset() {
105
103
  return this.getRulesetForRelease(SecurityRules.CLOUD_FIRESTORE);
106
- };
104
+ }
107
105
  /**
108
106
  * Creates a new {@link Ruleset} from the given
109
107
  * source, and applies it to Cloud Firestore.
@@ -111,20 +109,19 @@ var SecurityRules = /** @class */ (function () {
111
109
  * @param source - Rules source to apply.
112
110
  * @returns A promise that fulfills when the ruleset is created and released.
113
111
  */
114
- SecurityRules.prototype.releaseFirestoreRulesetFromSource = function (source) {
115
- var _this = this;
112
+ releaseFirestoreRulesetFromSource(source) {
116
113
  return Promise.resolve()
117
- .then(function () {
118
- var rulesFile = _this.createRulesFileFromSource('firestore.rules', source);
119
- return _this.createRuleset(rulesFile);
114
+ .then(() => {
115
+ const rulesFile = this.createRulesFileFromSource('firestore.rules', source);
116
+ return this.createRuleset(rulesFile);
120
117
  })
121
- .then(function (ruleset) {
122
- return _this.releaseFirestoreRuleset(ruleset)
123
- .then(function () {
118
+ .then((ruleset) => {
119
+ return this.releaseFirestoreRuleset(ruleset)
120
+ .then(() => {
124
121
  return ruleset;
125
122
  });
126
123
  });
127
- };
124
+ }
128
125
  /**
129
126
  * Applies the specified {@link Ruleset} ruleset
130
127
  * to Cloud Firestore.
@@ -133,9 +130,9 @@ var SecurityRules = /** @class */ (function () {
133
130
  * containing the name.
134
131
  * @returns A promise that fulfills when the ruleset is released.
135
132
  */
136
- SecurityRules.prototype.releaseFirestoreRuleset = function (ruleset) {
133
+ releaseFirestoreRuleset(ruleset) {
137
134
  return this.releaseRuleset(ruleset, SecurityRules.CLOUD_FIRESTORE);
138
- };
135
+ }
139
136
  /**
140
137
  * Gets the {@link Ruleset} currently applied to a
141
138
  * Cloud Storage bucket. Rejects with a `not-found` error if no ruleset is applied
@@ -146,16 +143,15 @@ var SecurityRules = /** @class */ (function () {
146
143
  * `AppOptions`.
147
144
  * @returns A promise that fulfills with the Cloud Storage ruleset.
148
145
  */
149
- SecurityRules.prototype.getStorageRuleset = function (bucket) {
150
- var _this = this;
146
+ getStorageRuleset(bucket) {
151
147
  return Promise.resolve()
152
- .then(function () {
153
- return _this.getBucketName(bucket);
148
+ .then(() => {
149
+ return this.getBucketName(bucket);
154
150
  })
155
- .then(function (bucketName) {
156
- return _this.getRulesetForRelease(SecurityRules.FIREBASE_STORAGE + "/" + bucketName);
151
+ .then((bucketName) => {
152
+ return this.getRulesetForRelease(`${SecurityRules.FIREBASE_STORAGE}/${bucketName}`);
157
153
  });
158
- };
154
+ }
159
155
  /**
160
156
  * Creates a new {@link Ruleset} from the given
161
157
  * source, and applies it to a Cloud Storage bucket.
@@ -166,23 +162,22 @@ var SecurityRules = /** @class */ (function () {
166
162
  * {@link firebase-admin.app#AppOptions}.
167
163
  * @returns A promise that fulfills when the ruleset is created and released.
168
164
  */
169
- SecurityRules.prototype.releaseStorageRulesetFromSource = function (source, bucket) {
170
- var _this = this;
165
+ releaseStorageRulesetFromSource(source, bucket) {
171
166
  return Promise.resolve()
172
- .then(function () {
167
+ .then(() => {
173
168
  // Bucket name is not required until the last step. But since there's a createRuleset step
174
169
  // before then, make sure to run this check and fail early if the bucket name is invalid.
175
- _this.getBucketName(bucket);
176
- var rulesFile = _this.createRulesFileFromSource('storage.rules', source);
177
- return _this.createRuleset(rulesFile);
170
+ this.getBucketName(bucket);
171
+ const rulesFile = this.createRulesFileFromSource('storage.rules', source);
172
+ return this.createRuleset(rulesFile);
178
173
  })
179
- .then(function (ruleset) {
180
- return _this.releaseStorageRuleset(ruleset, bucket)
181
- .then(function () {
174
+ .then((ruleset) => {
175
+ return this.releaseStorageRuleset(ruleset, bucket)
176
+ .then(() => {
182
177
  return ruleset;
183
178
  });
184
179
  });
185
- };
180
+ }
186
181
  /**
187
182
  * Applies the specified {@link Ruleset} ruleset
188
183
  * to a Cloud Storage bucket.
@@ -194,16 +189,15 @@ var SecurityRules = /** @class */ (function () {
194
189
  * {@link firebase-admin.app#AppOptions}.
195
190
  * @returns A promise that fulfills when the ruleset is released.
196
191
  */
197
- SecurityRules.prototype.releaseStorageRuleset = function (ruleset, bucket) {
198
- var _this = this;
192
+ releaseStorageRuleset(ruleset, bucket) {
199
193
  return Promise.resolve()
200
- .then(function () {
201
- return _this.getBucketName(bucket);
194
+ .then(() => {
195
+ return this.getBucketName(bucket);
202
196
  })
203
- .then(function (bucketName) {
204
- return _this.releaseRuleset(ruleset, SecurityRules.FIREBASE_STORAGE + "/" + bucketName);
197
+ .then((bucketName) => {
198
+ return this.releaseRuleset(ruleset, `${SecurityRules.FIREBASE_STORAGE}/${bucketName}`);
205
199
  });
206
- };
200
+ }
207
201
  /**
208
202
  * Creates a {@link RulesFile} with the given name
209
203
  * and source. Throws an error if any of the arguments are invalid. This is a local
@@ -221,11 +215,11 @@ var SecurityRules = /** @class */ (function () {
221
215
  * @param source - Contents of the rules file.
222
216
  * @returns A new rules file instance.
223
217
  */
224
- SecurityRules.prototype.createRulesFileFromSource = function (name, source) {
218
+ createRulesFileFromSource(name, source) {
225
219
  if (!validator.isNonEmptyString(name)) {
226
220
  throw new security_rules_internal_1.FirebaseSecurityRulesError('invalid-argument', 'Name must be a non-empty string.');
227
221
  }
228
- var content;
222
+ let content;
229
223
  if (validator.isNonEmptyString(source)) {
230
224
  content = source;
231
225
  }
@@ -236,27 +230,27 @@ var SecurityRules = /** @class */ (function () {
236
230
  throw new security_rules_internal_1.FirebaseSecurityRulesError('invalid-argument', 'Source must be a non-empty string or a Buffer.');
237
231
  }
238
232
  return {
239
- name: name,
240
- content: content,
233
+ name,
234
+ content,
241
235
  };
242
- };
236
+ }
243
237
  /**
244
238
  * Creates a new {@link Ruleset} from the given {@link RulesFile}.
245
239
  *
246
240
  * @param file - Rules file to include in the new `Ruleset`.
247
241
  * @returns A promise that fulfills with the newly created `Ruleset`.
248
242
  */
249
- SecurityRules.prototype.createRuleset = function (file) {
250
- var ruleset = {
243
+ createRuleset(file) {
244
+ const ruleset = {
251
245
  source: {
252
246
  files: [file],
253
247
  },
254
248
  };
255
249
  return this.client.createRuleset(ruleset)
256
- .then(function (rulesetResponse) {
250
+ .then((rulesetResponse) => {
257
251
  return new Ruleset(rulesetResponse);
258
252
  });
259
- };
253
+ }
260
254
  /**
261
255
  * Deletes the {@link Ruleset} identified by the given
262
256
  * name. The input name should be the short name string without the project ID
@@ -267,9 +261,9 @@ var SecurityRules = /** @class */ (function () {
267
261
  * @param name - Name of the `Ruleset` to delete.
268
262
  * @returns A promise that fulfills when the `Ruleset` is deleted.
269
263
  */
270
- SecurityRules.prototype.deleteRuleset = function (name) {
264
+ deleteRuleset(name) {
271
265
  return this.client.deleteRuleset(name);
272
- };
266
+ }
273
267
  /**
274
268
  * Retrieves a page of ruleset metadata.
275
269
  *
@@ -279,50 +273,47 @@ var SecurityRules = /** @class */ (function () {
279
273
  * starting without any offset.
280
274
  * @returns A promise that fulfills with a page of rulesets.
281
275
  */
282
- SecurityRules.prototype.listRulesetMetadata = function (pageSize, nextPageToken) {
283
- if (pageSize === void 0) { pageSize = 100; }
276
+ listRulesetMetadata(pageSize = 100, nextPageToken) {
284
277
  return this.client.listRulesets(pageSize, nextPageToken)
285
- .then(function (response) {
278
+ .then((response) => {
286
279
  return new RulesetMetadataList(response);
287
280
  });
288
- };
289
- SecurityRules.prototype.getRulesetForRelease = function (releaseName) {
290
- var _this = this;
281
+ }
282
+ getRulesetForRelease(releaseName) {
291
283
  return this.client.getRelease(releaseName)
292
- .then(function (release) {
293
- var rulesetName = release.rulesetName;
284
+ .then((release) => {
285
+ const rulesetName = release.rulesetName;
294
286
  if (!validator.isNonEmptyString(rulesetName)) {
295
- throw new security_rules_internal_1.FirebaseSecurityRulesError('not-found', "Ruleset name not found for " + releaseName + ".");
287
+ throw new security_rules_internal_1.FirebaseSecurityRulesError('not-found', `Ruleset name not found for ${releaseName}.`);
296
288
  }
297
- return _this.getRuleset(stripProjectIdPrefix(rulesetName));
289
+ return this.getRuleset(stripProjectIdPrefix(rulesetName));
298
290
  });
299
- };
300
- SecurityRules.prototype.releaseRuleset = function (ruleset, releaseName) {
291
+ }
292
+ releaseRuleset(ruleset, releaseName) {
301
293
  if (!validator.isNonEmptyString(ruleset) &&
302
294
  (!validator.isNonNullObject(ruleset) || !validator.isNonEmptyString(ruleset.name))) {
303
- var err = new security_rules_internal_1.FirebaseSecurityRulesError('invalid-argument', 'ruleset must be a non-empty name or a RulesetMetadata object.');
295
+ const err = new security_rules_internal_1.FirebaseSecurityRulesError('invalid-argument', 'ruleset must be a non-empty name or a RulesetMetadata object.');
304
296
  return Promise.reject(err);
305
297
  }
306
- var rulesetName = validator.isString(ruleset) ? ruleset : ruleset.name;
307
- return this.client.updateRelease(releaseName, rulesetName)
308
- .then(function () {
298
+ const rulesetName = validator.isString(ruleset) ? ruleset : ruleset.name;
299
+ return this.client.updateOrCreateRelease(releaseName, rulesetName)
300
+ .then(() => {
309
301
  return;
310
302
  });
311
- };
312
- SecurityRules.prototype.getBucketName = function (bucket) {
313
- var bucketName = (typeof bucket !== 'undefined') ? bucket : this.app.options.storageBucket;
303
+ }
304
+ getBucketName(bucket) {
305
+ const bucketName = (typeof bucket !== 'undefined') ? bucket : this.app.options.storageBucket;
314
306
  if (!validator.isNonEmptyString(bucketName)) {
315
307
  throw new security_rules_internal_1.FirebaseSecurityRulesError('invalid-argument', 'Bucket name not specified or invalid. Specify a default bucket name via the ' +
316
308
  'storageBucket option when initializing the app, or specify the bucket name ' +
317
309
  'explicitly when calling the rules API.');
318
310
  }
319
311
  return bucketName;
320
- };
321
- SecurityRules.CLOUD_FIRESTORE = 'cloud.firestore';
322
- SecurityRules.FIREBASE_STORAGE = 'firebase.storage';
323
- return SecurityRules;
324
- }());
312
+ }
313
+ }
325
314
  exports.SecurityRules = SecurityRules;
315
+ SecurityRules.CLOUD_FIRESTORE = 'cloud.firestore';
316
+ SecurityRules.FIREBASE_STORAGE = 'firebase.storage';
326
317
  function stripProjectIdPrefix(name) {
327
318
  return name.split('/').pop();
328
319
  }
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.2.0 */
1
+ /*! firebase-admin v11.0.1 */
2
2
  /*!
3
3
  * Copyright 2020 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.2.0 */
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.getStorage = void 0;
19
+ exports.getStorage = exports.Storage = void 0;
20
20
  /**
21
21
  * Cloud Storage for Firebase.
22
22
  *
23
23
  * @packageDocumentation
24
24
  */
25
- var app_1 = require("../app");
26
- var storage_1 = require("./storage");
25
+ const app_1 = require("../app");
26
+ const storage_1 = require("./storage");
27
27
  var storage_2 = require("./storage");
28
28
  Object.defineProperty(exports, "Storage", { enumerable: true, get: function () { return storage_2.Storage; } });
29
29
  /**
@@ -47,9 +47,9 @@ Object.defineProperty(exports, "Storage", { enumerable: true, get: function () {
47
47
  */
48
48
  function getStorage(app) {
49
49
  if (typeof app === 'undefined') {
50
- app = app_1.getApp();
50
+ app = (0, app_1.getApp)();
51
51
  }
52
- var firebaseApp = app;
53
- return firebaseApp.getOrInitService('storage', function (app) { return new storage_1.Storage(app); });
52
+ const firebaseApp = app;
53
+ return firebaseApp.getOrInitService('storage', (app) => new storage_1.Storage(app));
54
54
  }
55
55
  exports.getStorage = getStorage;
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.2.0 */
1
+ /*! firebase-admin v11.0.1 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.2.0 */
1
+ /*! firebase-admin v11.0.1 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.2.0 */
1
+ /*! firebase-admin v11.0.1 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.2.0 */
1
+ /*! firebase-admin v11.0.1 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -18,22 +18,22 @@
18
18
  */
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
20
  exports.Storage = void 0;
21
- var error_1 = require("../utils/error");
22
- var credential_internal_1 = require("../app/credential-internal");
23
- var utils = require("../utils/index");
24
- var validator = require("../utils/validator");
21
+ const error_1 = require("../utils/error");
22
+ const credential_internal_1 = require("../app/credential-internal");
23
+ const utils = require("../utils/index");
24
+ const validator = require("../utils/validator");
25
25
  /**
26
26
  * The default `Storage` service if no
27
27
  * app is provided or the `Storage` service associated with the provided
28
28
  * app.
29
29
  */
30
- var Storage = /** @class */ (function () {
30
+ class Storage {
31
31
  /**
32
32
  * @param app - The app for this Storage service.
33
33
  * @constructor
34
34
  * @internal
35
35
  */
36
- function Storage(app) {
36
+ constructor(app) {
37
37
  if (!validator.isNonNullObject(app) || !('options' in app)) {
38
38
  throw new error_1.FirebaseError({
39
39
  code: 'storage/invalid-argument',
@@ -41,16 +41,16 @@ var Storage = /** @class */ (function () {
41
41
  });
42
42
  }
43
43
  if (!process.env.STORAGE_EMULATOR_HOST && process.env.FIREBASE_STORAGE_EMULATOR_HOST) {
44
- var firebaseStorageEmulatorHost = process.env.FIREBASE_STORAGE_EMULATOR_HOST;
44
+ const firebaseStorageEmulatorHost = process.env.FIREBASE_STORAGE_EMULATOR_HOST;
45
45
  if (firebaseStorageEmulatorHost.match(/https?:\/\//)) {
46
46
  throw new error_1.FirebaseError({
47
47
  code: 'storage/invalid-emulator-host',
48
48
  message: 'FIREBASE_STORAGE_EMULATOR_HOST should not contain a protocol (http or https).',
49
49
  });
50
50
  }
51
- process.env.STORAGE_EMULATOR_HOST = "http://" + process.env.FIREBASE_STORAGE_EMULATOR_HOST;
51
+ process.env.STORAGE_EMULATOR_HOST = `http://${process.env.FIREBASE_STORAGE_EMULATOR_HOST}`;
52
52
  }
53
- var storage;
53
+ let storage;
54
54
  try {
55
55
  storage = require('@google-cloud/storage').Storage;
56
56
  }
@@ -59,11 +59,11 @@ var Storage = /** @class */ (function () {
59
59
  code: 'storage/missing-dependencies',
60
60
  message: 'Failed to import the Cloud Storage client library for Node.js. '
61
61
  + 'Make sure to install the "@google-cloud/storage" npm package. '
62
- + ("Original error: " + err),
62
+ + `Original error: ${err}`,
63
63
  });
64
64
  }
65
- var projectId = utils.getExplicitProjectId(app);
66
- var credential = app.options.credential;
65
+ const projectId = utils.getExplicitProjectId(app);
66
+ const credential = app.options.credential;
67
67
  if (credential instanceof credential_internal_1.ServiceAccountCredential) {
68
68
  this.storageClient = new storage({
69
69
  // When the SDK is initialized with ServiceAccountCredentials an explicit projectId is
@@ -75,7 +75,7 @@ var Storage = /** @class */ (function () {
75
75
  },
76
76
  });
77
77
  }
78
- else if (credential_internal_1.isApplicationDefault(app.options.credential)) {
78
+ else if ((0, credential_internal_1.isApplicationDefault)(app.options.credential)) {
79
79
  // Try to use the Google application default credentials.
80
80
  this.storageClient = new storage();
81
81
  }
@@ -97,8 +97,8 @@ var Storage = /** @class */ (function () {
97
97
  * @returns A {@link https://cloud.google.com/nodejs/docs/reference/storage/latest/Bucket | Bucket}
98
98
  * instance as defined in the `@google-cloud/storage` package.
99
99
  */
100
- Storage.prototype.bucket = function (name) {
101
- var bucketName = (typeof name !== 'undefined')
100
+ bucket(name) {
101
+ const bucketName = (typeof name !== 'undefined')
102
102
  ? name : this.appInternal.options.storageBucket;
103
103
  if (validator.isNonEmptyString(bucketName)) {
104
104
  return this.storageClient.bucket(bucketName);
@@ -109,18 +109,13 @@ var Storage = /** @class */ (function () {
109
109
  'storageBucket option when initializing the app, or specify the bucket name ' +
110
110
  'explicitly when calling the getBucket() method.',
111
111
  });
112
- };
113
- Object.defineProperty(Storage.prototype, "app", {
114
- /**
115
- * Optional app whose `Storage` service to
116
- * return. If not provided, the default `Storage` service will be returned.
117
- */
118
- get: function () {
119
- return this.appInternal;
120
- },
121
- enumerable: false,
122
- configurable: true
123
- });
124
- return Storage;
125
- }());
112
+ }
113
+ /**
114
+ * Optional app whose `Storage` service to
115
+ * return. If not provided, the default `Storage` service will be returned.
116
+ */
117
+ get app() {
118
+ return this.appInternal;
119
+ }
120
+ }
126
121
  exports.Storage = Storage;
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.2.0 */
1
+ /*! firebase-admin v11.0.1 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
@@ -16,6 +16,8 @@
16
16
  * limitations under the License.
17
17
  */
18
18
  /// <reference types="node" />
19
+ /// <reference types="node" />
20
+ /// <reference types="node" />
19
21
  import { FirebaseApp } from '../app/firebase-app';
20
22
  import http = require('http');
21
23
  import { EventEmitter } from 'events';