UNPKG

47.3 kBJavaScriptView Raw
1/*! firebase-admin v10.0.0 */
2"use strict";
3/*!
4 * @license
5 * Copyright 2017 Google Inc.
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19var __extends = (this && this.__extends) || (function () {
20 var extendStatics = function (d, b) {
21 extendStatics = Object.setPrototypeOf ||
22 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
23 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
24 return extendStatics(d, b);
25 };
26 return function (d, b) {
27 extendStatics(d, b);
28 function __() { this.constructor = d; }
29 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
30 };
31})();
32Object.defineProperty(exports, "__esModule", { value: true });
33exports.InstanceIdClientErrorCode = exports.InstallationsClientErrorCode = exports.MessagingClientErrorCode = exports.AuthClientErrorCode = exports.AppErrorCodes = exports.FirebaseProjectManagementError = exports.FirebaseMessagingError = exports.FirebaseInstallationsError = exports.FirebaseInstanceIdError = exports.FirebaseFirestoreError = exports.FirebaseDatabaseError = exports.FirebaseAuthError = exports.FirebaseAppError = exports.PrefixedFirebaseError = exports.FirebaseError = void 0;
34var deep_copy_1 = require("../utils/deep-copy");
35/**
36 * Firebase error code structure. This extends Error.
37 *
38 * @param errorInfo - The error information (code and message).
39 * @constructor
40 */
41var FirebaseError = /** @class */ (function (_super) {
42 __extends(FirebaseError, _super);
43 function FirebaseError(errorInfo) {
44 var _this = _super.call(this, errorInfo.message) || this;
45 _this.errorInfo = errorInfo;
46 /* tslint:disable:max-line-length */
47 // Set the prototype explicitly. See the following link for more details:
48 // https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
49 /* tslint:enable:max-line-length */
50 _this.__proto__ = FirebaseError.prototype;
51 return _this;
52 }
53 Object.defineProperty(FirebaseError.prototype, "code", {
54 /** @returns The error code. */
55 get: function () {
56 return this.errorInfo.code;
57 },
58 enumerable: false,
59 configurable: true
60 });
61 Object.defineProperty(FirebaseError.prototype, "message", {
62 /** @returns The error message. */
63 get: function () {
64 return this.errorInfo.message;
65 },
66 enumerable: false,
67 configurable: true
68 });
69 /** @returns The object representation of the error. */
70 FirebaseError.prototype.toJSON = function () {
71 return {
72 code: this.code,
73 message: this.message,
74 };
75 };
76 return FirebaseError;
77}(Error));
78exports.FirebaseError = FirebaseError;
79/**
80 * A FirebaseError with a prefix in front of the error code.
81 *
82 * @param codePrefix - The prefix to apply to the error code.
83 * @param code - The error code.
84 * @param message - The error message.
85 * @constructor
86 */
87var PrefixedFirebaseError = /** @class */ (function (_super) {
88 __extends(PrefixedFirebaseError, _super);
89 function PrefixedFirebaseError(codePrefix, code, message) {
90 var _this = _super.call(this, {
91 code: codePrefix + "/" + code,
92 message: message,
93 }) || this;
94 _this.codePrefix = codePrefix;
95 /* tslint:disable:max-line-length */
96 // Set the prototype explicitly. See the following link for more details:
97 // https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
98 /* tslint:enable:max-line-length */
99 _this.__proto__ = PrefixedFirebaseError.prototype;
100 return _this;
101 }
102 /**
103 * Allows the error type to be checked without needing to know implementation details
104 * of the code prefixing.
105 *
106 * @param code - The non-prefixed error code to test against.
107 * @returns True if the code matches, false otherwise.
108 */
109 PrefixedFirebaseError.prototype.hasCode = function (code) {
110 return this.codePrefix + "/" + code === this.code;
111 };
112 return PrefixedFirebaseError;
113}(FirebaseError));
114exports.PrefixedFirebaseError = PrefixedFirebaseError;
115/**
116 * Firebase App error code structure. This extends PrefixedFirebaseError.
117 *
118 * @param code - The error code.
119 * @param message - The error message.
120 * @constructor
121 */
122var FirebaseAppError = /** @class */ (function (_super) {
123 __extends(FirebaseAppError, _super);
124 function FirebaseAppError(code, message) {
125 var _this = _super.call(this, 'app', code, message) || this;
126 /* tslint:disable:max-line-length */
127 // Set the prototype explicitly. See the following link for more details:
128 // https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
129 /* tslint:enable:max-line-length */
130 _this.__proto__ = FirebaseAppError.prototype;
131 return _this;
132 }
133 return FirebaseAppError;
134}(PrefixedFirebaseError));
135exports.FirebaseAppError = FirebaseAppError;
136/**
137 * Firebase Auth error code structure. This extends PrefixedFirebaseError.
138 *
139 * @param info - The error code info.
140 * @param [message] The error message. This will override the default
141 * message if provided.
142 * @constructor
143 */
144var FirebaseAuthError = /** @class */ (function (_super) {
145 __extends(FirebaseAuthError, _super);
146 function FirebaseAuthError(info, message) {
147 var _this =
148 // Override default message if custom message provided.
149 _super.call(this, 'auth', info.code, message || info.message) || this;
150 /* tslint:disable:max-line-length */
151 // Set the prototype explicitly. See the following link for more details:
152 // https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
153 /* tslint:enable:max-line-length */
154 _this.__proto__ = FirebaseAuthError.prototype;
155 return _this;
156 }
157 /**
158 * Creates the developer-facing error corresponding to the backend error code.
159 *
160 * @param serverErrorCode - The server error code.
161 * @param [message] The error message. The default message is used
162 * if not provided.
163 * @param [rawServerResponse] The error's raw server response.
164 * @returns The corresponding developer-facing error.
165 */
166 FirebaseAuthError.fromServerError = function (serverErrorCode, message, rawServerResponse) {
167 // serverErrorCode could contain additional details:
168 // ERROR_CODE : Detailed message which can also contain colons
169 var colonSeparator = (serverErrorCode || '').indexOf(':');
170 var customMessage = null;
171 if (colonSeparator !== -1) {
172 customMessage = serverErrorCode.substring(colonSeparator + 1).trim();
173 serverErrorCode = serverErrorCode.substring(0, colonSeparator).trim();
174 }
175 // If not found, default to internal error.
176 var clientCodeKey = AUTH_SERVER_TO_CLIENT_CODE[serverErrorCode] || 'INTERNAL_ERROR';
177 var error = deep_copy_1.deepCopy(AuthClientErrorCode[clientCodeKey]);
178 // Server detailed message should have highest priority.
179 error.message = customMessage || message || error.message;
180 if (clientCodeKey === 'INTERNAL_ERROR' && typeof rawServerResponse !== 'undefined') {
181 try {
182 error.message += " Raw server response: \"" + JSON.stringify(rawServerResponse) + "\"";
183 }
184 catch (e) {
185 // Ignore JSON parsing error.
186 }
187 }
188 return new FirebaseAuthError(error);
189 };
190 return FirebaseAuthError;
191}(PrefixedFirebaseError));
192exports.FirebaseAuthError = FirebaseAuthError;
193/**
194 * Firebase Database error code structure. This extends FirebaseError.
195 *
196 * @param info - The error code info.
197 * @param [message] The error message. This will override the default
198 * message if provided.
199 * @constructor
200 */
201var FirebaseDatabaseError = /** @class */ (function (_super) {
202 __extends(FirebaseDatabaseError, _super);
203 function FirebaseDatabaseError(info, message) {
204 // Override default message if custom message provided.
205 return _super.call(this, { code: 'database/' + info.code, message: message || info.message }) || this;
206 }
207 return FirebaseDatabaseError;
208}(FirebaseError));
209exports.FirebaseDatabaseError = FirebaseDatabaseError;
210/**
211 * Firebase Firestore error code structure. This extends FirebaseError.
212 *
213 * @param info - The error code info.
214 * @param [message] The error message. This will override the default
215 * message if provided.
216 * @constructor
217 */
218var FirebaseFirestoreError = /** @class */ (function (_super) {
219 __extends(FirebaseFirestoreError, _super);
220 function FirebaseFirestoreError(info, message) {
221 // Override default message if custom message provided.
222 return _super.call(this, { code: 'firestore/' + info.code, message: message || info.message }) || this;
223 }
224 return FirebaseFirestoreError;
225}(FirebaseError));
226exports.FirebaseFirestoreError = FirebaseFirestoreError;
227/**
228 * Firebase instance ID error code structure. This extends FirebaseError.
229 *
230 * @param info - The error code info.
231 * @param [message] The error message. This will override the default
232 * message if provided.
233 * @constructor
234 */
235var FirebaseInstanceIdError = /** @class */ (function (_super) {
236 __extends(FirebaseInstanceIdError, _super);
237 function FirebaseInstanceIdError(info, message) {
238 var _this =
239 // Override default message if custom message provided.
240 _super.call(this, { code: 'instance-id/' + info.code, message: message || info.message }) || this;
241 _this.__proto__ = FirebaseInstanceIdError.prototype;
242 return _this;
243 }
244 return FirebaseInstanceIdError;
245}(FirebaseError));
246exports.FirebaseInstanceIdError = FirebaseInstanceIdError;
247/**
248 * Firebase Installations service error code structure. This extends `FirebaseError`.
249 *
250 * @param info - The error code info.
251 * @param message - The error message. This will override the default
252 * message if provided.
253 * @constructor
254 */
255var FirebaseInstallationsError = /** @class */ (function (_super) {
256 __extends(FirebaseInstallationsError, _super);
257 function FirebaseInstallationsError(info, message) {
258 var _this =
259 // Override default message if custom message provided.
260 _super.call(this, { code: 'installations/' + info.code, message: message || info.message }) || this;
261 _this.__proto__ = FirebaseInstallationsError.prototype;
262 return _this;
263 }
264 return FirebaseInstallationsError;
265}(FirebaseError));
266exports.FirebaseInstallationsError = FirebaseInstallationsError;
267/**
268 * Firebase Messaging error code structure. This extends PrefixedFirebaseError.
269 *
270 * @param info - The error code info.
271 * @param [message] The error message. This will override the default message if provided.
272 * @constructor
273 */
274var FirebaseMessagingError = /** @class */ (function (_super) {
275 __extends(FirebaseMessagingError, _super);
276 function FirebaseMessagingError(info, message) {
277 var _this =
278 // Override default message if custom message provided.
279 _super.call(this, 'messaging', info.code, message || info.message) || this;
280 /* tslint:disable:max-line-length */
281 // Set the prototype explicitly. See the following link for more details:
282 // https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
283 /* tslint:enable:max-line-length */
284 _this.__proto__ = FirebaseMessagingError.prototype;
285 return _this;
286 }
287 /**
288 * Creates the developer-facing error corresponding to the backend error code.
289 *
290 * @param serverErrorCode - The server error code.
291 * @param [message] The error message. The default message is used
292 * if not provided.
293 * @param [rawServerResponse] The error's raw server response.
294 * @returns The corresponding developer-facing error.
295 */
296 FirebaseMessagingError.fromServerError = function (serverErrorCode, message, rawServerResponse) {
297 // If not found, default to unknown error.
298 var clientCodeKey = 'UNKNOWN_ERROR';
299 if (serverErrorCode && serverErrorCode in MESSAGING_SERVER_TO_CLIENT_CODE) {
300 clientCodeKey = MESSAGING_SERVER_TO_CLIENT_CODE[serverErrorCode];
301 }
302 var error = deep_copy_1.deepCopy(MessagingClientErrorCode[clientCodeKey]);
303 error.message = message || error.message;
304 if (clientCodeKey === 'UNKNOWN_ERROR' && typeof rawServerResponse !== 'undefined') {
305 try {
306 error.message += " Raw server response: \"" + JSON.stringify(rawServerResponse) + "\"";
307 }
308 catch (e) {
309 // Ignore JSON parsing error.
310 }
311 }
312 return new FirebaseMessagingError(error);
313 };
314 FirebaseMessagingError.fromTopicManagementServerError = function (serverErrorCode, message, rawServerResponse) {
315 // If not found, default to unknown error.
316 var clientCodeKey = TOPIC_MGT_SERVER_TO_CLIENT_CODE[serverErrorCode] || 'UNKNOWN_ERROR';
317 var error = deep_copy_1.deepCopy(MessagingClientErrorCode[clientCodeKey]);
318 error.message = message || error.message;
319 if (clientCodeKey === 'UNKNOWN_ERROR' && typeof rawServerResponse !== 'undefined') {
320 try {
321 error.message += " Raw server response: \"" + JSON.stringify(rawServerResponse) + "\"";
322 }
323 catch (e) {
324 // Ignore JSON parsing error.
325 }
326 }
327 return new FirebaseMessagingError(error);
328 };
329 return FirebaseMessagingError;
330}(PrefixedFirebaseError));
331exports.FirebaseMessagingError = FirebaseMessagingError;
332/**
333 * Firebase project management error code structure. This extends PrefixedFirebaseError.
334 *
335 * @param code - The error code.
336 * @param message - The error message.
337 * @constructor
338 */
339var FirebaseProjectManagementError = /** @class */ (function (_super) {
340 __extends(FirebaseProjectManagementError, _super);
341 function FirebaseProjectManagementError(code, message) {
342 var _this = _super.call(this, 'project-management', code, message) || this;
343 /* tslint:disable:max-line-length */
344 // Set the prototype explicitly. See the following link for more details:
345 // https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
346 /* tslint:enable:max-line-length */
347 _this.__proto__ = FirebaseProjectManagementError.prototype;
348 return _this;
349 }
350 return FirebaseProjectManagementError;
351}(PrefixedFirebaseError));
352exports.FirebaseProjectManagementError = FirebaseProjectManagementError;
353/**
354 * App client error codes and their default messages.
355 */
356var AppErrorCodes = /** @class */ (function () {
357 function AppErrorCodes() {
358 }
359 AppErrorCodes.APP_DELETED = 'app-deleted';
360 AppErrorCodes.DUPLICATE_APP = 'duplicate-app';
361 AppErrorCodes.INVALID_ARGUMENT = 'invalid-argument';
362 AppErrorCodes.INTERNAL_ERROR = 'internal-error';
363 AppErrorCodes.INVALID_APP_NAME = 'invalid-app-name';
364 AppErrorCodes.INVALID_APP_OPTIONS = 'invalid-app-options';
365 AppErrorCodes.INVALID_CREDENTIAL = 'invalid-credential';
366 AppErrorCodes.NETWORK_ERROR = 'network-error';
367 AppErrorCodes.NETWORK_TIMEOUT = 'network-timeout';
368 AppErrorCodes.NO_APP = 'no-app';
369 AppErrorCodes.UNABLE_TO_PARSE_RESPONSE = 'unable-to-parse-response';
370 return AppErrorCodes;
371}());
372exports.AppErrorCodes = AppErrorCodes;
373/**
374 * Auth client error codes and their default messages.
375 */
376var AuthClientErrorCode = /** @class */ (function () {
377 function AuthClientErrorCode() {
378 }
379 AuthClientErrorCode.BILLING_NOT_ENABLED = {
380 code: 'billing-not-enabled',
381 message: 'Feature requires billing to be enabled.',
382 };
383 AuthClientErrorCode.CLAIMS_TOO_LARGE = {
384 code: 'claims-too-large',
385 message: 'Developer claims maximum payload size exceeded.',
386 };
387 AuthClientErrorCode.CONFIGURATION_EXISTS = {
388 code: 'configuration-exists',
389 message: 'A configuration already exists with the provided identifier.',
390 };
391 AuthClientErrorCode.CONFIGURATION_NOT_FOUND = {
392 code: 'configuration-not-found',
393 message: 'There is no configuration corresponding to the provided identifier.',
394 };
395 AuthClientErrorCode.ID_TOKEN_EXPIRED = {
396 code: 'id-token-expired',
397 message: 'The provided Firebase ID token is expired.',
398 };
399 AuthClientErrorCode.INVALID_ARGUMENT = {
400 code: 'argument-error',
401 message: 'Invalid argument provided.',
402 };
403 AuthClientErrorCode.INVALID_CONFIG = {
404 code: 'invalid-config',
405 message: 'The provided configuration is invalid.',
406 };
407 AuthClientErrorCode.EMAIL_ALREADY_EXISTS = {
408 code: 'email-already-exists',
409 message: 'The email address is already in use by another account.',
410 };
411 AuthClientErrorCode.EMAIL_NOT_FOUND = {
412 code: 'email-not-found',
413 message: 'There is no user record corresponding to the provided email.',
414 };
415 AuthClientErrorCode.FORBIDDEN_CLAIM = {
416 code: 'reserved-claim',
417 message: 'The specified developer claim is reserved and cannot be specified.',
418 };
419 AuthClientErrorCode.INVALID_ID_TOKEN = {
420 code: 'invalid-id-token',
421 message: 'The provided ID token is not a valid Firebase ID token.',
422 };
423 AuthClientErrorCode.ID_TOKEN_REVOKED = {
424 code: 'id-token-revoked',
425 message: 'The Firebase ID token has been revoked.',
426 };
427 AuthClientErrorCode.INTERNAL_ERROR = {
428 code: 'internal-error',
429 message: 'An internal error has occurred.',
430 };
431 AuthClientErrorCode.INVALID_CLAIMS = {
432 code: 'invalid-claims',
433 message: 'The provided custom claim attributes are invalid.',
434 };
435 AuthClientErrorCode.INVALID_CONTINUE_URI = {
436 code: 'invalid-continue-uri',
437 message: 'The continue URL must be a valid URL string.',
438 };
439 AuthClientErrorCode.INVALID_CREATION_TIME = {
440 code: 'invalid-creation-time',
441 message: 'The creation time must be a valid UTC date string.',
442 };
443 AuthClientErrorCode.INVALID_CREDENTIAL = {
444 code: 'invalid-credential',
445 message: 'Invalid credential object provided.',
446 };
447 AuthClientErrorCode.INVALID_DISABLED_FIELD = {
448 code: 'invalid-disabled-field',
449 message: 'The disabled field must be a boolean.',
450 };
451 AuthClientErrorCode.INVALID_DISPLAY_NAME = {
452 code: 'invalid-display-name',
453 message: 'The displayName field must be a valid string.',
454 };
455 AuthClientErrorCode.INVALID_DYNAMIC_LINK_DOMAIN = {
456 code: 'invalid-dynamic-link-domain',
457 message: 'The provided dynamic link domain is not configured or authorized ' +
458 'for the current project.',
459 };
460 AuthClientErrorCode.INVALID_EMAIL_VERIFIED = {
461 code: 'invalid-email-verified',
462 message: 'The emailVerified field must be a boolean.',
463 };
464 AuthClientErrorCode.INVALID_EMAIL = {
465 code: 'invalid-email',
466 message: 'The email address is improperly formatted.',
467 };
468 AuthClientErrorCode.INVALID_ENROLLED_FACTORS = {
469 code: 'invalid-enrolled-factors',
470 message: 'The enrolled factors must be a valid array of MultiFactorInfo objects.',
471 };
472 AuthClientErrorCode.INVALID_ENROLLMENT_TIME = {
473 code: 'invalid-enrollment-time',
474 message: 'The second factor enrollment time must be a valid UTC date string.',
475 };
476 AuthClientErrorCode.INVALID_HASH_ALGORITHM = {
477 code: 'invalid-hash-algorithm',
478 message: 'The hash algorithm must match one of the strings in the list of ' +
479 'supported algorithms.',
480 };
481 AuthClientErrorCode.INVALID_HASH_BLOCK_SIZE = {
482 code: 'invalid-hash-block-size',
483 message: 'The hash block size must be a valid number.',
484 };
485 AuthClientErrorCode.INVALID_HASH_DERIVED_KEY_LENGTH = {
486 code: 'invalid-hash-derived-key-length',
487 message: 'The hash derived key length must be a valid number.',
488 };
489 AuthClientErrorCode.INVALID_HASH_KEY = {
490 code: 'invalid-hash-key',
491 message: 'The hash key must a valid byte buffer.',
492 };
493 AuthClientErrorCode.INVALID_HASH_MEMORY_COST = {
494 code: 'invalid-hash-memory-cost',
495 message: 'The hash memory cost must be a valid number.',
496 };
497 AuthClientErrorCode.INVALID_HASH_PARALLELIZATION = {
498 code: 'invalid-hash-parallelization',
499 message: 'The hash parallelization must be a valid number.',
500 };
501 AuthClientErrorCode.INVALID_HASH_ROUNDS = {
502 code: 'invalid-hash-rounds',
503 message: 'The hash rounds must be a valid number.',
504 };
505 AuthClientErrorCode.INVALID_HASH_SALT_SEPARATOR = {
506 code: 'invalid-hash-salt-separator',
507 message: 'The hashing algorithm salt separator field must be a valid byte buffer.',
508 };
509 AuthClientErrorCode.INVALID_LAST_SIGN_IN_TIME = {
510 code: 'invalid-last-sign-in-time',
511 message: 'The last sign-in time must be a valid UTC date string.',
512 };
513 AuthClientErrorCode.INVALID_NAME = {
514 code: 'invalid-name',
515 message: 'The resource name provided is invalid.',
516 };
517 AuthClientErrorCode.INVALID_OAUTH_CLIENT_ID = {
518 code: 'invalid-oauth-client-id',
519 message: 'The provided OAuth client ID is invalid.',
520 };
521 AuthClientErrorCode.INVALID_PAGE_TOKEN = {
522 code: 'invalid-page-token',
523 message: 'The page token must be a valid non-empty string.',
524 };
525 AuthClientErrorCode.INVALID_PASSWORD = {
526 code: 'invalid-password',
527 message: 'The password must be a string with at least 6 characters.',
528 };
529 AuthClientErrorCode.INVALID_PASSWORD_HASH = {
530 code: 'invalid-password-hash',
531 message: 'The password hash must be a valid byte buffer.',
532 };
533 AuthClientErrorCode.INVALID_PASSWORD_SALT = {
534 code: 'invalid-password-salt',
535 message: 'The password salt must be a valid byte buffer.',
536 };
537 AuthClientErrorCode.INVALID_PHONE_NUMBER = {
538 code: 'invalid-phone-number',
539 message: 'The phone number must be a non-empty E.164 standard compliant identifier ' +
540 'string.',
541 };
542 AuthClientErrorCode.INVALID_PHOTO_URL = {
543 code: 'invalid-photo-url',
544 message: 'The photoURL field must be a valid URL.',
545 };
546 AuthClientErrorCode.INVALID_PROJECT_ID = {
547 code: 'invalid-project-id',
548 message: 'Invalid parent project. Either parent project doesn\'t exist or didn\'t enable multi-tenancy.',
549 };
550 AuthClientErrorCode.INVALID_PROVIDER_DATA = {
551 code: 'invalid-provider-data',
552 message: 'The providerData must be a valid array of UserInfo objects.',
553 };
554 AuthClientErrorCode.INVALID_PROVIDER_ID = {
555 code: 'invalid-provider-id',
556 message: 'The providerId must be a valid supported provider identifier string.',
557 };
558 AuthClientErrorCode.INVALID_PROVIDER_UID = {
559 code: 'invalid-provider-uid',
560 message: 'The providerUid must be a valid provider uid string.',
561 };
562 AuthClientErrorCode.INVALID_OAUTH_RESPONSETYPE = {
563 code: 'invalid-oauth-responsetype',
564 message: 'Only exactly one OAuth responseType should be set to true.',
565 };
566 AuthClientErrorCode.INVALID_SESSION_COOKIE_DURATION = {
567 code: 'invalid-session-cookie-duration',
568 message: 'The session cookie duration must be a valid number in milliseconds ' +
569 'between 5 minutes and 2 weeks.',
570 };
571 AuthClientErrorCode.INVALID_TENANT_ID = {
572 code: 'invalid-tenant-id',
573 message: 'The tenant ID must be a valid non-empty string.',
574 };
575 AuthClientErrorCode.INVALID_TENANT_TYPE = {
576 code: 'invalid-tenant-type',
577 message: 'Tenant type must be either "full_service" or "lightweight".',
578 };
579 AuthClientErrorCode.INVALID_TESTING_PHONE_NUMBER = {
580 code: 'invalid-testing-phone-number',
581 message: 'Invalid testing phone number or invalid test code provided.',
582 };
583 AuthClientErrorCode.INVALID_UID = {
584 code: 'invalid-uid',
585 message: 'The uid must be a non-empty string with at most 128 characters.',
586 };
587 AuthClientErrorCode.INVALID_USER_IMPORT = {
588 code: 'invalid-user-import',
589 message: 'The user record to import is invalid.',
590 };
591 AuthClientErrorCode.INVALID_TOKENS_VALID_AFTER_TIME = {
592 code: 'invalid-tokens-valid-after-time',
593 message: 'The tokensValidAfterTime must be a valid UTC number in seconds.',
594 };
595 AuthClientErrorCode.MISMATCHING_TENANT_ID = {
596 code: 'mismatching-tenant-id',
597 message: 'User tenant ID does not match with the current TenantAwareAuth tenant ID.',
598 };
599 AuthClientErrorCode.MISSING_ANDROID_PACKAGE_NAME = {
600 code: 'missing-android-pkg-name',
601 message: 'An Android Package Name must be provided if the Android App is ' +
602 'required to be installed.',
603 };
604 AuthClientErrorCode.MISSING_CONFIG = {
605 code: 'missing-config',
606 message: 'The provided configuration is missing required attributes.',
607 };
608 AuthClientErrorCode.MISSING_CONTINUE_URI = {
609 code: 'missing-continue-uri',
610 message: 'A valid continue URL must be provided in the request.',
611 };
612 AuthClientErrorCode.MISSING_DISPLAY_NAME = {
613 code: 'missing-display-name',
614 message: 'The resource being created or edited is missing a valid display name.',
615 };
616 AuthClientErrorCode.MISSING_EMAIL = {
617 code: 'missing-email',
618 message: 'The email is required for the specified action. For example, a multi-factor user ' +
619 'requires a verified email.',
620 };
621 AuthClientErrorCode.MISSING_IOS_BUNDLE_ID = {
622 code: 'missing-ios-bundle-id',
623 message: 'The request is missing an iOS Bundle ID.',
624 };
625 AuthClientErrorCode.MISSING_ISSUER = {
626 code: 'missing-issuer',
627 message: 'The OAuth/OIDC configuration issuer must not be empty.',
628 };
629 AuthClientErrorCode.MISSING_HASH_ALGORITHM = {
630 code: 'missing-hash-algorithm',
631 message: 'Importing users with password hashes requires that the hashing ' +
632 'algorithm and its parameters be provided.',
633 };
634 AuthClientErrorCode.MISSING_OAUTH_CLIENT_ID = {
635 code: 'missing-oauth-client-id',
636 message: 'The OAuth/OIDC configuration client ID must not be empty.',
637 };
638 AuthClientErrorCode.MISSING_OAUTH_CLIENT_SECRET = {
639 code: 'missing-oauth-client-secret',
640 message: 'The OAuth configuration client secret is required to enable OIDC code flow.',
641 };
642 AuthClientErrorCode.MISSING_PROVIDER_ID = {
643 code: 'missing-provider-id',
644 message: 'A valid provider ID must be provided in the request.',
645 };
646 AuthClientErrorCode.MISSING_SAML_RELYING_PARTY_CONFIG = {
647 code: 'missing-saml-relying-party-config',
648 message: 'The SAML configuration provided is missing a relying party configuration.',
649 };
650 AuthClientErrorCode.MAXIMUM_TEST_PHONE_NUMBER_EXCEEDED = {
651 code: 'test-phone-number-limit-exceeded',
652 message: 'The maximum allowed number of test phone number / code pairs has been exceeded.',
653 };
654 AuthClientErrorCode.MAXIMUM_USER_COUNT_EXCEEDED = {
655 code: 'maximum-user-count-exceeded',
656 message: 'The maximum allowed number of users to import has been exceeded.',
657 };
658 AuthClientErrorCode.MISSING_UID = {
659 code: 'missing-uid',
660 message: 'A uid identifier is required for the current operation.',
661 };
662 AuthClientErrorCode.OPERATION_NOT_ALLOWED = {
663 code: 'operation-not-allowed',
664 message: 'The given sign-in provider is disabled for this Firebase project. ' +
665 'Enable it in the Firebase console, under the sign-in method tab of the ' +
666 'Auth section.',
667 };
668 AuthClientErrorCode.PHONE_NUMBER_ALREADY_EXISTS = {
669 code: 'phone-number-already-exists',
670 message: 'The user with the provided phone number already exists.',
671 };
672 AuthClientErrorCode.PROJECT_NOT_FOUND = {
673 code: 'project-not-found',
674 message: 'No Firebase project was found for the provided credential.',
675 };
676 AuthClientErrorCode.INSUFFICIENT_PERMISSION = {
677 code: 'insufficient-permission',
678 message: 'Credential implementation provided to initializeApp() via the "credential" property ' +
679 'has insufficient permission to access the requested resource. See ' +
680 'https://firebase.google.com/docs/admin/setup for details on how to authenticate this SDK ' +
681 'with appropriate permissions.',
682 };
683 AuthClientErrorCode.QUOTA_EXCEEDED = {
684 code: 'quota-exceeded',
685 message: 'The project quota for the specified operation has been exceeded.',
686 };
687 AuthClientErrorCode.SECOND_FACTOR_LIMIT_EXCEEDED = {
688 code: 'second-factor-limit-exceeded',
689 message: 'The maximum number of allowed second factors on a user has been exceeded.',
690 };
691 AuthClientErrorCode.SECOND_FACTOR_UID_ALREADY_EXISTS = {
692 code: 'second-factor-uid-already-exists',
693 message: 'The specified second factor "uid" already exists.',
694 };
695 AuthClientErrorCode.SESSION_COOKIE_EXPIRED = {
696 code: 'session-cookie-expired',
697 message: 'The Firebase session cookie is expired.',
698 };
699 AuthClientErrorCode.SESSION_COOKIE_REVOKED = {
700 code: 'session-cookie-revoked',
701 message: 'The Firebase session cookie has been revoked.',
702 };
703 AuthClientErrorCode.TENANT_NOT_FOUND = {
704 code: 'tenant-not-found',
705 message: 'There is no tenant corresponding to the provided identifier.',
706 };
707 AuthClientErrorCode.UID_ALREADY_EXISTS = {
708 code: 'uid-already-exists',
709 message: 'The user with the provided uid already exists.',
710 };
711 AuthClientErrorCode.UNAUTHORIZED_DOMAIN = {
712 code: 'unauthorized-continue-uri',
713 message: 'The domain of the continue URL is not whitelisted. Whitelist the domain in the ' +
714 'Firebase console.',
715 };
716 AuthClientErrorCode.UNSUPPORTED_FIRST_FACTOR = {
717 code: 'unsupported-first-factor',
718 message: 'A multi-factor user requires a supported first factor.',
719 };
720 AuthClientErrorCode.UNSUPPORTED_SECOND_FACTOR = {
721 code: 'unsupported-second-factor',
722 message: 'The request specified an unsupported type of second factor.',
723 };
724 AuthClientErrorCode.UNSUPPORTED_TENANT_OPERATION = {
725 code: 'unsupported-tenant-operation',
726 message: 'This operation is not supported in a multi-tenant context.',
727 };
728 AuthClientErrorCode.UNVERIFIED_EMAIL = {
729 code: 'unverified-email',
730 message: 'A verified email is required for the specified action. For example, a multi-factor user ' +
731 'requires a verified email.',
732 };
733 AuthClientErrorCode.USER_NOT_FOUND = {
734 code: 'user-not-found',
735 message: 'There is no user record corresponding to the provided identifier.',
736 };
737 AuthClientErrorCode.NOT_FOUND = {
738 code: 'not-found',
739 message: 'The requested resource was not found.',
740 };
741 AuthClientErrorCode.USER_DISABLED = {
742 code: 'user-disabled',
743 message: 'The user record is disabled.',
744 };
745 AuthClientErrorCode.USER_NOT_DISABLED = {
746 code: 'user-not-disabled',
747 message: 'The user must be disabled in order to bulk delete it (or you must pass force=true).',
748 };
749 return AuthClientErrorCode;
750}());
751exports.AuthClientErrorCode = AuthClientErrorCode;
752/**
753 * Messaging client error codes and their default messages.
754 */
755var MessagingClientErrorCode = /** @class */ (function () {
756 function MessagingClientErrorCode() {
757 }
758 MessagingClientErrorCode.INVALID_ARGUMENT = {
759 code: 'invalid-argument',
760 message: 'Invalid argument provided.',
761 };
762 MessagingClientErrorCode.INVALID_RECIPIENT = {
763 code: 'invalid-recipient',
764 message: 'Invalid message recipient provided.',
765 };
766 MessagingClientErrorCode.INVALID_PAYLOAD = {
767 code: 'invalid-payload',
768 message: 'Invalid message payload provided.',
769 };
770 MessagingClientErrorCode.INVALID_DATA_PAYLOAD_KEY = {
771 code: 'invalid-data-payload-key',
772 message: 'The data message payload contains an invalid key. See the reference documentation ' +
773 'for the DataMessagePayload type for restricted keys.',
774 };
775 MessagingClientErrorCode.PAYLOAD_SIZE_LIMIT_EXCEEDED = {
776 code: 'payload-size-limit-exceeded',
777 message: 'The provided message payload exceeds the FCM size limits. See the error documentation ' +
778 'for more details.',
779 };
780 MessagingClientErrorCode.INVALID_OPTIONS = {
781 code: 'invalid-options',
782 message: 'Invalid message options provided.',
783 };
784 MessagingClientErrorCode.INVALID_REGISTRATION_TOKEN = {
785 code: 'invalid-registration-token',
786 message: 'Invalid registration token provided. Make sure it matches the registration token ' +
787 'the client app receives from registering with FCM.',
788 };
789 MessagingClientErrorCode.REGISTRATION_TOKEN_NOT_REGISTERED = {
790 code: 'registration-token-not-registered',
791 message: 'The provided registration token is not registered. A previously valid registration ' +
792 'token can be unregistered for a variety of reasons. See the error documentation for more ' +
793 'details. Remove this registration token and stop using it to send messages.',
794 };
795 MessagingClientErrorCode.MISMATCHED_CREDENTIAL = {
796 code: 'mismatched-credential',
797 message: 'The credential used to authenticate this SDK does not have permission to send ' +
798 'messages to the device corresponding to the provided registration token. Make sure the ' +
799 'credential and registration token both belong to the same Firebase project.',
800 };
801 MessagingClientErrorCode.INVALID_PACKAGE_NAME = {
802 code: 'invalid-package-name',
803 message: 'The message was addressed to a registration token whose package name does not match ' +
804 'the provided "restrictedPackageName" option.',
805 };
806 MessagingClientErrorCode.DEVICE_MESSAGE_RATE_EXCEEDED = {
807 code: 'device-message-rate-exceeded',
808 message: 'The rate of messages to a particular device is too high. Reduce the number of ' +
809 'messages sent to this device and do not immediately retry sending to this device.',
810 };
811 MessagingClientErrorCode.TOPICS_MESSAGE_RATE_EXCEEDED = {
812 code: 'topics-message-rate-exceeded',
813 message: 'The rate of messages to subscribers to a particular topic is too high. Reduce the ' +
814 'number of messages sent for this topic, and do not immediately retry sending to this topic.',
815 };
816 MessagingClientErrorCode.MESSAGE_RATE_EXCEEDED = {
817 code: 'message-rate-exceeded',
818 message: 'Sending limit exceeded for the message target.',
819 };
820 MessagingClientErrorCode.THIRD_PARTY_AUTH_ERROR = {
821 code: 'third-party-auth-error',
822 message: 'A message targeted to an iOS device could not be sent because the required APNs ' +
823 'SSL certificate was not uploaded or has expired. Check the validity of your development ' +
824 'and production certificates.',
825 };
826 MessagingClientErrorCode.TOO_MANY_TOPICS = {
827 code: 'too-many-topics',
828 message: 'The maximum number of topics the provided registration token can be subscribed to ' +
829 'has been exceeded.',
830 };
831 MessagingClientErrorCode.AUTHENTICATION_ERROR = {
832 code: 'authentication-error',
833 message: 'An error occurred when trying to authenticate to the FCM servers. Make sure the ' +
834 'credential used to authenticate this SDK has the proper permissions. See ' +
835 'https://firebase.google.com/docs/admin/setup for setup instructions.',
836 };
837 MessagingClientErrorCode.SERVER_UNAVAILABLE = {
838 code: 'server-unavailable',
839 message: 'The FCM server could not process the request in time. See the error documentation ' +
840 'for more details.',
841 };
842 MessagingClientErrorCode.INTERNAL_ERROR = {
843 code: 'internal-error',
844 message: 'An internal error has occurred. Please retry the request.',
845 };
846 MessagingClientErrorCode.UNKNOWN_ERROR = {
847 code: 'unknown-error',
848 message: 'An unknown server error was returned.',
849 };
850 return MessagingClientErrorCode;
851}());
852exports.MessagingClientErrorCode = MessagingClientErrorCode;
853var InstallationsClientErrorCode = /** @class */ (function () {
854 function InstallationsClientErrorCode() {
855 }
856 InstallationsClientErrorCode.INVALID_ARGUMENT = {
857 code: 'invalid-argument',
858 message: 'Invalid argument provided.',
859 };
860 InstallationsClientErrorCode.INVALID_PROJECT_ID = {
861 code: 'invalid-project-id',
862 message: 'Invalid project ID provided.',
863 };
864 InstallationsClientErrorCode.INVALID_INSTALLATION_ID = {
865 code: 'invalid-installation-id',
866 message: 'Invalid installation ID provided.',
867 };
868 InstallationsClientErrorCode.API_ERROR = {
869 code: 'api-error',
870 message: 'Installation ID API call failed.',
871 };
872 return InstallationsClientErrorCode;
873}());
874exports.InstallationsClientErrorCode = InstallationsClientErrorCode;
875var InstanceIdClientErrorCode = /** @class */ (function (_super) {
876 __extends(InstanceIdClientErrorCode, _super);
877 function InstanceIdClientErrorCode() {
878 return _super !== null && _super.apply(this, arguments) || this;
879 }
880 InstanceIdClientErrorCode.INVALID_INSTANCE_ID = {
881 code: 'invalid-instance-id',
882 message: 'Invalid instance ID provided.',
883 };
884 return InstanceIdClientErrorCode;
885}(InstallationsClientErrorCode));
886exports.InstanceIdClientErrorCode = InstanceIdClientErrorCode;
887/** @const {ServerToClientCode} Auth server to client enum error codes. */
888var AUTH_SERVER_TO_CLIENT_CODE = {
889 // Feature being configured or used requires a billing account.
890 BILLING_NOT_ENABLED: 'BILLING_NOT_ENABLED',
891 // Claims payload is too large.
892 CLAIMS_TOO_LARGE: 'CLAIMS_TOO_LARGE',
893 // Configuration being added already exists.
894 CONFIGURATION_EXISTS: 'CONFIGURATION_EXISTS',
895 // Configuration not found.
896 CONFIGURATION_NOT_FOUND: 'CONFIGURATION_NOT_FOUND',
897 // Provided credential has insufficient permissions.
898 INSUFFICIENT_PERMISSION: 'INSUFFICIENT_PERMISSION',
899 // Provided configuration has invalid fields.
900 INVALID_CONFIG: 'INVALID_CONFIG',
901 // Provided configuration identifier is invalid.
902 INVALID_CONFIG_ID: 'INVALID_PROVIDER_ID',
903 // ActionCodeSettings missing continue URL.
904 INVALID_CONTINUE_URI: 'INVALID_CONTINUE_URI',
905 // Dynamic link domain in provided ActionCodeSettings is not authorized.
906 INVALID_DYNAMIC_LINK_DOMAIN: 'INVALID_DYNAMIC_LINK_DOMAIN',
907 // uploadAccount provides an email that already exists.
908 DUPLICATE_EMAIL: 'EMAIL_ALREADY_EXISTS',
909 // uploadAccount provides a localId that already exists.
910 DUPLICATE_LOCAL_ID: 'UID_ALREADY_EXISTS',
911 // Request specified a multi-factor enrollment ID that already exists.
912 DUPLICATE_MFA_ENROLLMENT_ID: 'SECOND_FACTOR_UID_ALREADY_EXISTS',
913 // setAccountInfo email already exists.
914 EMAIL_EXISTS: 'EMAIL_ALREADY_EXISTS',
915 // /accounts:sendOobCode for password reset when user is not found.
916 EMAIL_NOT_FOUND: 'EMAIL_NOT_FOUND',
917 // Reserved claim name.
918 FORBIDDEN_CLAIM: 'FORBIDDEN_CLAIM',
919 // Invalid claims provided.
920 INVALID_CLAIMS: 'INVALID_CLAIMS',
921 // Invalid session cookie duration.
922 INVALID_DURATION: 'INVALID_SESSION_COOKIE_DURATION',
923 // Invalid email provided.
924 INVALID_EMAIL: 'INVALID_EMAIL',
925 // Invalid tenant display name. This can be thrown on CreateTenant and UpdateTenant.
926 INVALID_DISPLAY_NAME: 'INVALID_DISPLAY_NAME',
927 // Invalid ID token provided.
928 INVALID_ID_TOKEN: 'INVALID_ID_TOKEN',
929 // Invalid tenant/parent resource name.
930 INVALID_NAME: 'INVALID_NAME',
931 // OIDC configuration has an invalid OAuth client ID.
932 INVALID_OAUTH_CLIENT_ID: 'INVALID_OAUTH_CLIENT_ID',
933 // Invalid page token.
934 INVALID_PAGE_SELECTION: 'INVALID_PAGE_TOKEN',
935 // Invalid phone number.
936 INVALID_PHONE_NUMBER: 'INVALID_PHONE_NUMBER',
937 // Invalid agent project. Either agent project doesn't exist or didn't enable multi-tenancy.
938 INVALID_PROJECT_ID: 'INVALID_PROJECT_ID',
939 // Invalid provider ID.
940 INVALID_PROVIDER_ID: 'INVALID_PROVIDER_ID',
941 // Invalid service account.
942 INVALID_SERVICE_ACCOUNT: 'INVALID_SERVICE_ACCOUNT',
943 // Invalid testing phone number.
944 INVALID_TESTING_PHONE_NUMBER: 'INVALID_TESTING_PHONE_NUMBER',
945 // Invalid tenant type.
946 INVALID_TENANT_TYPE: 'INVALID_TENANT_TYPE',
947 // Missing Android package name.
948 MISSING_ANDROID_PACKAGE_NAME: 'MISSING_ANDROID_PACKAGE_NAME',
949 // Missing configuration.
950 MISSING_CONFIG: 'MISSING_CONFIG',
951 // Missing configuration identifier.
952 MISSING_CONFIG_ID: 'MISSING_PROVIDER_ID',
953 // Missing tenant display name: This can be thrown on CreateTenant and UpdateTenant.
954 MISSING_DISPLAY_NAME: 'MISSING_DISPLAY_NAME',
955 // Email is required for the specified action. For example a multi-factor user requires
956 // a verified email.
957 MISSING_EMAIL: 'MISSING_EMAIL',
958 // Missing iOS bundle ID.
959 MISSING_IOS_BUNDLE_ID: 'MISSING_IOS_BUNDLE_ID',
960 // Missing OIDC issuer.
961 MISSING_ISSUER: 'MISSING_ISSUER',
962 // No localId provided (deleteAccount missing localId).
963 MISSING_LOCAL_ID: 'MISSING_UID',
964 // OIDC configuration is missing an OAuth client ID.
965 MISSING_OAUTH_CLIENT_ID: 'MISSING_OAUTH_CLIENT_ID',
966 // Missing provider ID.
967 MISSING_PROVIDER_ID: 'MISSING_PROVIDER_ID',
968 // Missing SAML RP config.
969 MISSING_SAML_RELYING_PARTY_CONFIG: 'MISSING_SAML_RELYING_PARTY_CONFIG',
970 // Empty user list in uploadAccount.
971 MISSING_USER_ACCOUNT: 'MISSING_UID',
972 // Password auth disabled in console.
973 OPERATION_NOT_ALLOWED: 'OPERATION_NOT_ALLOWED',
974 // Provided credential has insufficient permissions.
975 PERMISSION_DENIED: 'INSUFFICIENT_PERMISSION',
976 // Phone number already exists.
977 PHONE_NUMBER_EXISTS: 'PHONE_NUMBER_ALREADY_EXISTS',
978 // Project not found.
979 PROJECT_NOT_FOUND: 'PROJECT_NOT_FOUND',
980 // In multi-tenancy context: project creation quota exceeded.
981 QUOTA_EXCEEDED: 'QUOTA_EXCEEDED',
982 // Currently only 5 second factors can be set on the same user.
983 SECOND_FACTOR_LIMIT_EXCEEDED: 'SECOND_FACTOR_LIMIT_EXCEEDED',
984 // Tenant not found.
985 TENANT_NOT_FOUND: 'TENANT_NOT_FOUND',
986 // Tenant ID mismatch.
987 TENANT_ID_MISMATCH: 'MISMATCHING_TENANT_ID',
988 // Token expired error.
989 TOKEN_EXPIRED: 'ID_TOKEN_EXPIRED',
990 // Continue URL provided in ActionCodeSettings has a domain that is not whitelisted.
991 UNAUTHORIZED_DOMAIN: 'UNAUTHORIZED_DOMAIN',
992 // A multi-factor user requires a supported first factor.
993 UNSUPPORTED_FIRST_FACTOR: 'UNSUPPORTED_FIRST_FACTOR',
994 // The request specified an unsupported type of second factor.
995 UNSUPPORTED_SECOND_FACTOR: 'UNSUPPORTED_SECOND_FACTOR',
996 // Operation is not supported in a multi-tenant context.
997 UNSUPPORTED_TENANT_OPERATION: 'UNSUPPORTED_TENANT_OPERATION',
998 // A verified email is required for the specified action. For example a multi-factor user
999 // requires a verified email.
1000 UNVERIFIED_EMAIL: 'UNVERIFIED_EMAIL',
1001 // User on which action is to be performed is not found.
1002 USER_NOT_FOUND: 'USER_NOT_FOUND',
1003 // Password provided is too weak.
1004 WEAK_PASSWORD: 'INVALID_PASSWORD',
1005};
1006/** @const {ServerToClientCode} Messaging server to client enum error codes. */
1007var MESSAGING_SERVER_TO_CLIENT_CODE = {
1008 /* GENERIC ERRORS */
1009 // Generic invalid message parameter provided.
1010 InvalidParameters: 'INVALID_ARGUMENT',
1011 // Mismatched sender ID.
1012 MismatchSenderId: 'MISMATCHED_CREDENTIAL',
1013 // FCM server unavailable.
1014 Unavailable: 'SERVER_UNAVAILABLE',
1015 // FCM server internal error.
1016 InternalServerError: 'INTERNAL_ERROR',
1017 /* SEND ERRORS */
1018 // Invalid registration token format.
1019 InvalidRegistration: 'INVALID_REGISTRATION_TOKEN',
1020 // Registration token is not registered.
1021 NotRegistered: 'REGISTRATION_TOKEN_NOT_REGISTERED',
1022 // Registration token does not match restricted package name.
1023 InvalidPackageName: 'INVALID_PACKAGE_NAME',
1024 // Message payload size limit exceeded.
1025 MessageTooBig: 'PAYLOAD_SIZE_LIMIT_EXCEEDED',
1026 // Invalid key in the data message payload.
1027 InvalidDataKey: 'INVALID_DATA_PAYLOAD_KEY',
1028 // Invalid time to live option.
1029 InvalidTtl: 'INVALID_OPTIONS',
1030 // Device message rate exceeded.
1031 DeviceMessageRateExceeded: 'DEVICE_MESSAGE_RATE_EXCEEDED',
1032 // Topics message rate exceeded.
1033 TopicsMessageRateExceeded: 'TOPICS_MESSAGE_RATE_EXCEEDED',
1034 // Invalid APNs credentials.
1035 InvalidApnsCredential: 'THIRD_PARTY_AUTH_ERROR',
1036 /* FCM v1 canonical error codes */
1037 NOT_FOUND: 'REGISTRATION_TOKEN_NOT_REGISTERED',
1038 PERMISSION_DENIED: 'MISMATCHED_CREDENTIAL',
1039 RESOURCE_EXHAUSTED: 'MESSAGE_RATE_EXCEEDED',
1040 UNAUTHENTICATED: 'THIRD_PARTY_AUTH_ERROR',
1041 /* FCM v1 new error codes */
1042 APNS_AUTH_ERROR: 'THIRD_PARTY_AUTH_ERROR',
1043 INTERNAL: 'INTERNAL_ERROR',
1044 INVALID_ARGUMENT: 'INVALID_ARGUMENT',
1045 QUOTA_EXCEEDED: 'MESSAGE_RATE_EXCEEDED',
1046 SENDER_ID_MISMATCH: 'MISMATCHED_CREDENTIAL',
1047 THIRD_PARTY_AUTH_ERROR: 'THIRD_PARTY_AUTH_ERROR',
1048 UNAVAILABLE: 'SERVER_UNAVAILABLE',
1049 UNREGISTERED: 'REGISTRATION_TOKEN_NOT_REGISTERED',
1050 UNSPECIFIED_ERROR: 'UNKNOWN_ERROR',
1051};
1052/** @const {ServerToClientCode} Topic management (IID) server to client enum error codes. */
1053var TOPIC_MGT_SERVER_TO_CLIENT_CODE = {
1054 /* TOPIC SUBSCRIPTION MANAGEMENT ERRORS */
1055 NOT_FOUND: 'REGISTRATION_TOKEN_NOT_REGISTERED',
1056 INVALID_ARGUMENT: 'INVALID_REGISTRATION_TOKEN',
1057 TOO_MANY_TOPICS: 'TOO_MANY_TOPICS',
1058 RESOURCE_EXHAUSTED: 'TOO_MANY_TOPICS',
1059 PERMISSION_DENIED: 'AUTHENTICATION_ERROR',
1060 DEADLINE_EXCEEDED: 'SERVER_UNAVAILABLE',
1061 INTERNAL: 'INTERNAL_ERROR',
1062 UNKNOWN: 'UNKNOWN_ERROR',
1063};