firebase-admin 10.3.0 → 11.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. package/README.md +1 -2
  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 +1 -1
  7. package/lib/app/credential-internal.js +97 -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 +61 -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 +1 -1
  89. package/lib/functions/functions-api-client-internal.js +71 -93
  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 +1 -1
  165. package/lib/security-rules/security-rules-api-client-internal.js +95 -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 +82 -91
  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 +5 -5
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.3.0 */
1
+ /*! firebase-admin v11.0.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2020 Google Inc.
@@ -17,15 +17,15 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.DatabaseService = void 0;
20
- var url_1 = require("url");
21
- var path = require("path");
22
- var error_1 = require("../utils/error");
23
- var validator = require("../utils/validator");
24
- var api_request_1 = require("../utils/api-request");
25
- var index_1 = require("../utils/index");
26
- var TOKEN_REFRESH_THRESHOLD_MILLIS = 5 * 60 * 1000;
27
- var DatabaseService = /** @class */ (function () {
28
- function DatabaseService(app) {
20
+ const url_1 = require("url");
21
+ const path = require("path");
22
+ const error_1 = require("../utils/error");
23
+ const validator = require("../utils/validator");
24
+ const api_request_1 = require("../utils/api-request");
25
+ const index_1 = require("../utils/index");
26
+ const TOKEN_REFRESH_THRESHOLD_MILLIS = 5 * 60 * 1000;
27
+ class DatabaseService {
28
+ constructor(app) {
29
29
  this.databases = {};
30
30
  if (!validator.isNonNullObject(app) || !('options' in app)) {
31
31
  throw new error_1.FirebaseDatabaseError({
@@ -35,66 +35,56 @@ var DatabaseService = /** @class */ (function () {
35
35
  }
36
36
  this.appInternal = app;
37
37
  }
38
- Object.defineProperty(DatabaseService.prototype, "firebaseApp", {
39
- get: function () {
40
- return this.app;
41
- },
42
- enumerable: false,
43
- configurable: true
44
- });
38
+ get firebaseApp() {
39
+ return this.app;
40
+ }
45
41
  /**
46
42
  * @internal
47
43
  */
48
- DatabaseService.prototype.delete = function () {
49
- var _this = this;
44
+ delete() {
50
45
  if (this.tokenListener) {
51
46
  this.firebaseApp.INTERNAL.removeAuthTokenListener(this.tokenListener);
52
47
  clearTimeout(this.tokenRefreshTimeout);
53
48
  }
54
- var promises = [];
55
- for (var _i = 0, _a = Object.keys(this.databases); _i < _a.length; _i++) {
56
- var dbUrl = _a[_i];
57
- var db = this.databases[dbUrl];
49
+ const promises = [];
50
+ for (const dbUrl of Object.keys(this.databases)) {
51
+ const db = this.databases[dbUrl];
58
52
  promises.push(db.INTERNAL.delete());
59
53
  }
60
- return Promise.all(promises).then(function () {
61
- _this.databases = {};
54
+ return Promise.all(promises).then(() => {
55
+ this.databases = {};
62
56
  });
63
- };
64
- Object.defineProperty(DatabaseService.prototype, "app", {
65
- /**
66
- * Returns the app associated with this DatabaseService instance.
67
- *
68
- * @returns The app associated with this DatabaseService instance.
69
- */
70
- get: function () {
71
- return this.appInternal;
72
- },
73
- enumerable: false,
74
- configurable: true
75
- });
76
- DatabaseService.prototype.getDatabase = function (url) {
77
- var dbUrl = this.ensureUrl(url);
57
+ }
58
+ /**
59
+ * Returns the app associated with this DatabaseService instance.
60
+ *
61
+ * @returns The app associated with this DatabaseService instance.
62
+ */
63
+ get app() {
64
+ return this.appInternal;
65
+ }
66
+ getDatabase(url) {
67
+ const dbUrl = this.ensureUrl(url);
78
68
  if (!validator.isNonEmptyString(dbUrl)) {
79
69
  throw new error_1.FirebaseDatabaseError({
80
70
  code: 'invalid-argument',
81
71
  message: 'Database URL must be a valid, non-empty URL string.',
82
72
  });
83
73
  }
84
- var db = this.databases[dbUrl];
74
+ let db = this.databases[dbUrl];
85
75
  if (typeof db === 'undefined') {
86
76
  // eslint-disable-next-line @typescript-eslint/no-var-requires
87
- var rtdb = require('@firebase/database-compat/standalone');
88
- db = rtdb.initStandalone(this.appInternal, dbUrl, index_1.getSdkVersion()).instance;
89
- var rulesClient_1 = new DatabaseRulesClient(this.app, dbUrl);
90
- db.getRules = function () {
91
- return rulesClient_1.getRules();
77
+ const rtdb = require('@firebase/database-compat/standalone');
78
+ db = rtdb.initStandalone(this.appInternal, dbUrl, (0, index_1.getSdkVersion)()).instance;
79
+ const rulesClient = new DatabaseRulesClient(this.app, dbUrl);
80
+ db.getRules = () => {
81
+ return rulesClient.getRules();
92
82
  };
93
- db.getRulesJSON = function () {
94
- return rulesClient_1.getRulesJSON();
83
+ db.getRulesJSON = () => {
84
+ return rulesClient.getRulesJSON();
95
85
  };
96
- db.setRules = function (source) {
97
- return rulesClient_1.setRules(source);
86
+ db.setRules = (source) => {
87
+ return rulesClient.setRules(source);
98
88
  };
99
89
  this.databases[dbUrl] = db;
100
90
  }
@@ -103,32 +93,31 @@ var DatabaseService = /** @class */ (function () {
103
93
  this.firebaseApp.INTERNAL.addAuthTokenListener(this.tokenListener);
104
94
  }
105
95
  return db;
106
- };
96
+ }
107
97
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
108
- DatabaseService.prototype.onTokenChange = function (_) {
109
- var token = this.firebaseApp.INTERNAL.getCachedToken();
98
+ onTokenChange(_) {
99
+ const token = this.firebaseApp.INTERNAL.getCachedToken();
110
100
  if (token) {
111
- var delayMillis = token.expirationTime - TOKEN_REFRESH_THRESHOLD_MILLIS - Date.now();
101
+ const delayMillis = token.expirationTime - TOKEN_REFRESH_THRESHOLD_MILLIS - Date.now();
112
102
  // If the new token is set to expire soon (unlikely), do nothing. Somebody will eventually
113
103
  // notice and refresh the token, at which point this callback will fire again.
114
104
  if (delayMillis > 0) {
115
105
  this.scheduleTokenRefresh(delayMillis);
116
106
  }
117
107
  }
118
- };
119
- DatabaseService.prototype.scheduleTokenRefresh = function (delayMillis) {
120
- var _this = this;
108
+ }
109
+ scheduleTokenRefresh(delayMillis) {
121
110
  clearTimeout(this.tokenRefreshTimeout);
122
- this.tokenRefreshTimeout = setTimeout(function () {
123
- _this.firebaseApp.INTERNAL.getToken(/*forceRefresh=*/ true)
124
- .catch(function () {
111
+ this.tokenRefreshTimeout = setTimeout(() => {
112
+ this.firebaseApp.INTERNAL.getToken(/*forceRefresh=*/ true)
113
+ .catch(() => {
125
114
  // Ignore the error since this might just be an intermittent failure. If we really cannot
126
115
  // refresh the token, an error will be logged once the existing token expires and we try
127
116
  // to fetch a fresh one.
128
117
  });
129
118
  }, delayMillis);
130
- };
131
- DatabaseService.prototype.ensureUrl = function (url) {
119
+ }
120
+ ensureUrl(url) {
132
121
  if (typeof url !== 'undefined') {
133
122
  return url;
134
123
  }
@@ -139,21 +128,20 @@ var DatabaseService = /** @class */ (function () {
139
128
  code: 'invalid-argument',
140
129
  message: 'Can\'t determine Firebase Database URL.',
141
130
  });
142
- };
143
- return DatabaseService;
144
- }());
131
+ }
132
+ }
145
133
  exports.DatabaseService = DatabaseService;
146
- var RULES_URL_PATH = '.settings/rules.json';
134
+ const RULES_URL_PATH = '.settings/rules.json';
147
135
  /**
148
136
  * A helper client for managing RTDB security rules.
149
137
  */
150
- var DatabaseRulesClient = /** @class */ (function () {
151
- function DatabaseRulesClient(app, dbUrl) {
152
- var parsedUrl = new url_1.URL(dbUrl);
153
- var emulatorHost = process.env.FIREBASE_DATABASE_EMULATOR_HOST;
138
+ class DatabaseRulesClient {
139
+ constructor(app, dbUrl) {
140
+ let parsedUrl = new url_1.URL(dbUrl);
141
+ const emulatorHost = process.env.FIREBASE_DATABASE_EMULATOR_HOST;
154
142
  if (emulatorHost) {
155
- var namespace = extractNamespace(parsedUrl);
156
- parsedUrl = new url_1.URL("http://" + emulatorHost + "?ns=" + namespace);
143
+ const namespace = extractNamespace(parsedUrl);
144
+ parsedUrl = new url_1.URL(`http://${emulatorHost}?ns=${namespace}`);
157
145
  }
158
146
  parsedUrl.pathname = path.join(parsedUrl.pathname, RULES_URL_PATH);
159
147
  this.dbUrl = parsedUrl.toString();
@@ -165,44 +153,42 @@ var DatabaseRulesClient = /** @class */ (function () {
165
153
  *
166
154
  * @returns A promise fulfilled with the rules as a raw string.
167
155
  */
168
- DatabaseRulesClient.prototype.getRules = function () {
169
- var _this = this;
170
- var req = {
156
+ getRules() {
157
+ const req = {
171
158
  method: 'GET',
172
159
  url: this.dbUrl,
173
160
  };
174
161
  return this.httpClient.send(req)
175
- .then(function (resp) {
162
+ .then((resp) => {
176
163
  if (!resp.text) {
177
164
  throw new error_1.FirebaseAppError(error_1.AppErrorCodes.INTERNAL_ERROR, 'HTTP response missing data.');
178
165
  }
179
166
  return resp.text;
180
167
  })
181
- .catch(function (err) {
182
- throw _this.handleError(err);
168
+ .catch((err) => {
169
+ throw this.handleError(err);
183
170
  });
184
- };
171
+ }
185
172
  /**
186
173
  * Gets the currently applied security rules as a parsed JSON object. Any comments in
187
174
  * the original source are stripped away.
188
175
  *
189
176
  * @returns {Promise<object>} A promise fulfilled with the parsed rules source.
190
177
  */
191
- DatabaseRulesClient.prototype.getRulesJSON = function () {
192
- var _this = this;
193
- var req = {
178
+ getRulesJSON() {
179
+ const req = {
194
180
  method: 'GET',
195
181
  url: this.dbUrl,
196
182
  data: { format: 'strict' },
197
183
  };
198
184
  return this.httpClient.send(req)
199
- .then(function (resp) {
185
+ .then((resp) => {
200
186
  return resp.data;
201
187
  })
202
- .catch(function (err) {
203
- throw _this.handleError(err);
188
+ .catch((err) => {
189
+ throw this.handleError(err);
204
190
  });
205
- };
191
+ }
206
192
  /**
207
193
  * Sets the specified rules on the Firebase Database instance. If the rules source is
208
194
  * specified as a string or a Buffer, it may include comments.
@@ -211,18 +197,17 @@ var DatabaseRulesClient = /** @class */ (function () {
211
197
  * or empty.
212
198
  * @returns {Promise<void>} Resolves when the rules are set on the Database.
213
199
  */
214
- DatabaseRulesClient.prototype.setRules = function (source) {
215
- var _this = this;
200
+ setRules(source) {
216
201
  if (!validator.isNonEmptyString(source) &&
217
202
  !validator.isBuffer(source) &&
218
203
  !validator.isNonNullObject(source)) {
219
- var error = new error_1.FirebaseDatabaseError({
204
+ const error = new error_1.FirebaseDatabaseError({
220
205
  code: 'invalid-argument',
221
206
  message: 'Source must be a non-empty string, Buffer or an object.',
222
207
  });
223
208
  return Promise.reject(error);
224
209
  }
225
- var req = {
210
+ const req = {
226
211
  method: 'PUT',
227
212
  url: this.dbUrl,
228
213
  data: source,
@@ -231,14 +216,14 @@ var DatabaseRulesClient = /** @class */ (function () {
231
216
  },
232
217
  };
233
218
  return this.httpClient.send(req)
234
- .then(function () {
219
+ .then(() => {
235
220
  return;
236
221
  })
237
- .catch(function (err) {
238
- throw _this.handleError(err);
222
+ .catch((err) => {
223
+ throw this.handleError(err);
239
224
  });
240
- };
241
- DatabaseRulesClient.prototype.handleError = function (err) {
225
+ }
226
+ handleError(err) {
242
227
  if (err instanceof api_request_1.HttpError) {
243
228
  return new error_1.FirebaseDatabaseError({
244
229
  code: error_1.AppErrorCodes.INTERNAL_ERROR,
@@ -246,28 +231,27 @@ var DatabaseRulesClient = /** @class */ (function () {
246
231
  });
247
232
  }
248
233
  return err;
249
- };
250
- DatabaseRulesClient.prototype.getErrorMessage = function (err) {
251
- var intro = 'Error while accessing security rules';
234
+ }
235
+ getErrorMessage(err) {
236
+ const intro = 'Error while accessing security rules';
252
237
  try {
253
- var body = err.response.data;
238
+ const body = err.response.data;
254
239
  if (body && body.error) {
255
- return intro + ": " + body.error.trim();
240
+ return `${intro}: ${body.error.trim()}`;
256
241
  }
257
242
  }
258
- catch (_a) {
243
+ catch {
259
244
  // Ignore parsing errors
260
245
  }
261
- return intro + ": " + err.response.text;
262
- };
263
- return DatabaseRulesClient;
264
- }());
246
+ return `${intro}: ${err.response.text}`;
247
+ }
248
+ }
265
249
  function extractNamespace(parsedUrl) {
266
- var ns = parsedUrl.searchParams.get('ns');
250
+ const ns = parsedUrl.searchParams.get('ns');
267
251
  if (ns) {
268
252
  return ns;
269
253
  }
270
- var hostname = parsedUrl.hostname;
271
- var dotIndex = hostname.indexOf('.');
254
+ const hostname = parsedUrl.hostname;
255
+ const dotIndex = hostname.indexOf('.');
272
256
  return hostname.substring(0, dotIndex).toLowerCase();
273
257
  }
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.3.0 */
1
+ /*! firebase-admin v11.0.0 */
2
2
  /*!
3
3
  * Copyright 2020 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.3.0 */
1
+ /*! firebase-admin v11.0.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2020 Google Inc.
@@ -17,9 +17,9 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.getDatabaseWithUrl = exports.getDatabase = exports.ServerValue = exports.enableLogging = void 0;
20
- var standalone_1 = require("@firebase/database-compat/standalone");
21
- var app_1 = require("../app");
22
- var database_1 = require("./database");
20
+ const standalone_1 = require("@firebase/database-compat/standalone");
21
+ const app_1 = require("../app");
22
+ const database_1 = require("./database");
23
23
  // TODO: Remove the following any-cast once the typins in @firebase/database-types are fixed.
24
24
  /**
25
25
  * {@link https://firebase.google.com/docs/reference/js/firebase.database#enablelogging | enableLogging}
@@ -59,7 +59,7 @@ exports.ServerValue = standalone_1.ServerValue;
59
59
  * is provided or the `Database` service associated with the provided app.
60
60
  */
61
61
  function getDatabase(app) {
62
- return getDatabaseInstance({ app: app });
62
+ return getDatabaseInstance({ app });
63
63
  }
64
64
  exports.getDatabase = getDatabase;
65
65
  /**
@@ -89,15 +89,15 @@ exports.getDatabase = getDatabase;
89
89
  * is provided or the `Database` service associated with the provided app.
90
90
  */
91
91
  function getDatabaseWithUrl(url, app) {
92
- return getDatabaseInstance({ url: url, app: app });
92
+ return getDatabaseInstance({ url, app });
93
93
  }
94
94
  exports.getDatabaseWithUrl = getDatabaseWithUrl;
95
95
  function getDatabaseInstance(options) {
96
- var app = options.app;
96
+ let { app } = options;
97
97
  if (typeof app === 'undefined') {
98
- app = app_1.getApp();
98
+ app = (0, app_1.getApp)();
99
99
  }
100
- var firebaseApp = app;
101
- var dbService = firebaseApp.getOrInitService('database', function (app) { return new database_1.DatabaseService(app); });
100
+ const firebaseApp = app;
101
+ const dbService = firebaseApp.getOrInitService('database', (app) => new database_1.DatabaseService(app));
102
102
  return dbService.getDatabase(options.url);
103
103
  }
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.3.0 */
1
+ /*! firebase-admin v11.0.0 */
2
2
  /*!
3
3
  * Copyright 2020 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.3.0 */
1
+ /*! firebase-admin v11.0.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -16,7 +16,7 @@
16
16
  * See the License for the specific language governing permissions and
17
17
  * limitations under the License.
18
18
  */
19
- var firebase_namespace_1 = require("./app/firebase-namespace");
19
+ const firebase_namespace_1 = require("./app/firebase-namespace");
20
20
  // Inject a circular default export to allow users to use both:
21
21
  //
22
22
  // import firebaseAdmin from 'firebase-admin';
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.3.0 */
1
+ /*! firebase-admin v11.0.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2022 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.3.0 */
1
+ /*! firebase-admin v11.0.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.3.0 */
1
+ /*! firebase-admin v11.0.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2022 Google Inc.