error.d.ts 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  1. /*! firebase-admin v12.1.1 */
  2. /*!
  3. * @license
  4. * Copyright 2017 Google Inc.
  5. *
  6. * Licensed under the Apache License, Version 2.0 (the "License");
  7. * you may not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. import { FirebaseError as FirebaseErrorInterface } from '../app';
  19. /**
  20. * Defines error info type. This includes a code and message string.
  21. */
  22. export interface ErrorInfo {
  23. code: string;
  24. message: string;
  25. }
  26. /**
  27. * Firebase error code structure. This extends Error.
  28. */
  29. export declare class FirebaseError extends Error implements FirebaseErrorInterface {
  30. private errorInfo;
  31. /** @returns The error code. */
  32. get code(): string;
  33. /** @returns The error message. */
  34. get message(): string;
  35. /** @returns The object representation of the error. */
  36. toJSON(): object;
  37. }
  38. /**
  39. * A FirebaseError with a prefix in front of the error code.
  40. */
  41. export declare class PrefixedFirebaseError extends FirebaseError {
  42. private codePrefix;
  43. /**
  44. * Allows the error type to be checked without needing to know implementation details
  45. * of the code prefixing.
  46. *
  47. * @param code - The non-prefixed error code to test against.
  48. * @returns True if the code matches, false otherwise.
  49. */
  50. hasCode(code: string): boolean;
  51. }
  52. /**
  53. * Firebase App error code structure. This extends PrefixedFirebaseError.
  54. */
  55. export declare class FirebaseAppError extends PrefixedFirebaseError {
  56. }
  57. /**
  58. * Firebase Auth error code structure. This extends PrefixedFirebaseError.
  59. */
  60. export declare class FirebaseAuthError extends PrefixedFirebaseError {
  61. }
  62. /**
  63. * Firebase Database error code structure. This extends FirebaseError.
  64. */
  65. export declare class FirebaseDatabaseError extends FirebaseError {
  66. }
  67. /**
  68. * Firebase Firestore error code structure. This extends FirebaseError.
  69. */
  70. export declare class FirebaseFirestoreError extends FirebaseError {
  71. }
  72. /**
  73. * Firebase instance ID error code structure. This extends FirebaseError.
  74. */
  75. export declare class FirebaseInstanceIdError extends FirebaseError {
  76. }
  77. /**
  78. * Firebase Installations service error code structure. This extends `FirebaseError`.
  79. */
  80. export declare class FirebaseInstallationsError extends FirebaseError {
  81. }
  82. /**
  83. * Firebase Messaging error code structure. This extends PrefixedFirebaseError.
  84. */
  85. export declare class FirebaseMessagingError extends PrefixedFirebaseError {
  86. }
  87. /**
  88. * Firebase project management error code structure. This extends PrefixedFirebaseError.
  89. */
  90. export declare class FirebaseProjectManagementError extends PrefixedFirebaseError {
  91. }
  92. /**
  93. * App client error codes and their default messages.
  94. */
  95. export declare class AppErrorCodes {
  96. static APP_DELETED: string;
  97. static DUPLICATE_APP: string;
  98. static INVALID_ARGUMENT: string;
  99. static INTERNAL_ERROR: string;
  100. static INVALID_APP_NAME: string;
  101. static INVALID_APP_OPTIONS: string;
  102. static INVALID_CREDENTIAL: string;
  103. static NETWORK_ERROR: string;
  104. static NETWORK_TIMEOUT: string;
  105. static NO_APP: string;
  106. static UNABLE_TO_PARSE_RESPONSE: string;
  107. }
  108. /**
  109. * Auth client error codes and their default messages.
  110. */
  111. export declare class AuthClientErrorCode {
  112. static AUTH_BLOCKING_TOKEN_EXPIRED: {
  113. code: string;
  114. message: string;
  115. };
  116. static BILLING_NOT_ENABLED: {
  117. code: string;
  118. message: string;
  119. };
  120. static CLAIMS_TOO_LARGE: {
  121. code: string;
  122. message: string;
  123. };
  124. static CONFIGURATION_EXISTS: {
  125. code: string;
  126. message: string;
  127. };
  128. static CONFIGURATION_NOT_FOUND: {
  129. code: string;
  130. message: string;
  131. };
  132. static ID_TOKEN_EXPIRED: {
  133. code: string;
  134. message: string;
  135. };
  136. static INVALID_ARGUMENT: {
  137. code: string;
  138. message: string;
  139. };
  140. static INVALID_CONFIG: {
  141. code: string;
  142. message: string;
  143. };
  144. static EMAIL_ALREADY_EXISTS: {
  145. code: string;
  146. message: string;
  147. };
  148. static EMAIL_NOT_FOUND: {
  149. code: string;
  150. message: string;
  151. };
  152. static FORBIDDEN_CLAIM: {
  153. code: string;
  154. message: string;
  155. };
  156. static INVALID_ID_TOKEN: {
  157. code: string;
  158. message: string;
  159. };
  160. static ID_TOKEN_REVOKED: {
  161. code: string;
  162. message: string;
  163. };
  164. static INTERNAL_ERROR: {
  165. code: string;
  166. message: string;
  167. };
  168. static INVALID_CLAIMS: {
  169. code: string;
  170. message: string;
  171. };
  172. static INVALID_CONTINUE_URI: {
  173. code: string;
  174. message: string;
  175. };
  176. static INVALID_CREATION_TIME: {
  177. code: string;
  178. message: string;
  179. };
  180. static INVALID_CREDENTIAL: {
  181. code: string;
  182. message: string;
  183. };
  184. static INVALID_DISABLED_FIELD: {
  185. code: string;
  186. message: string;
  187. };
  188. static INVALID_DISPLAY_NAME: {
  189. code: string;
  190. message: string;
  191. };
  192. static INVALID_DYNAMIC_LINK_DOMAIN: {
  193. code: string;
  194. message: string;
  195. };
  196. static INVALID_EMAIL_VERIFIED: {
  197. code: string;
  198. message: string;
  199. };
  200. static INVALID_EMAIL: {
  201. code: string;
  202. message: string;
  203. };
  204. static INVALID_NEW_EMAIL: {
  205. code: string;
  206. message: string;
  207. };
  208. static INVALID_ENROLLED_FACTORS: {
  209. code: string;
  210. message: string;
  211. };
  212. static INVALID_ENROLLMENT_TIME: {
  213. code: string;
  214. message: string;
  215. };
  216. static INVALID_HASH_ALGORITHM: {
  217. code: string;
  218. message: string;
  219. };
  220. static INVALID_HASH_BLOCK_SIZE: {
  221. code: string;
  222. message: string;
  223. };
  224. static INVALID_HASH_DERIVED_KEY_LENGTH: {
  225. code: string;
  226. message: string;
  227. };
  228. static INVALID_HASH_KEY: {
  229. code: string;
  230. message: string;
  231. };
  232. static INVALID_HASH_MEMORY_COST: {
  233. code: string;
  234. message: string;
  235. };
  236. static INVALID_HASH_PARALLELIZATION: {
  237. code: string;
  238. message: string;
  239. };
  240. static INVALID_HASH_ROUNDS: {
  241. code: string;
  242. message: string;
  243. };
  244. static INVALID_HASH_SALT_SEPARATOR: {
  245. code: string;
  246. message: string;
  247. };
  248. static INVALID_LAST_SIGN_IN_TIME: {
  249. code: string;
  250. message: string;
  251. };
  252. static INVALID_NAME: {
  253. code: string;
  254. message: string;
  255. };
  256. static INVALID_OAUTH_CLIENT_ID: {
  257. code: string;
  258. message: string;
  259. };
  260. static INVALID_PAGE_TOKEN: {
  261. code: string;
  262. message: string;
  263. };
  264. static INVALID_PASSWORD: {
  265. code: string;
  266. message: string;
  267. };
  268. static INVALID_PASSWORD_HASH: {
  269. code: string;
  270. message: string;
  271. };
  272. static INVALID_PASSWORD_SALT: {
  273. code: string;
  274. message: string;
  275. };
  276. static INVALID_PHONE_NUMBER: {
  277. code: string;
  278. message: string;
  279. };
  280. static INVALID_PHOTO_URL: {
  281. code: string;
  282. message: string;
  283. };
  284. static INVALID_PROJECT_ID: {
  285. code: string;
  286. message: string;
  287. };
  288. static INVALID_PROVIDER_DATA: {
  289. code: string;
  290. message: string;
  291. };
  292. static INVALID_PROVIDER_ID: {
  293. code: string;
  294. message: string;
  295. };
  296. static INVALID_PROVIDER_UID: {
  297. code: string;
  298. message: string;
  299. };
  300. static INVALID_OAUTH_RESPONSETYPE: {
  301. code: string;
  302. message: string;
  303. };
  304. static INVALID_SESSION_COOKIE_DURATION: {
  305. code: string;
  306. message: string;
  307. };
  308. static INVALID_TENANT_ID: {
  309. code: string;
  310. message: string;
  311. };
  312. static INVALID_TENANT_TYPE: {
  313. code: string;
  314. message: string;
  315. };
  316. static INVALID_TESTING_PHONE_NUMBER: {
  317. code: string;
  318. message: string;
  319. };
  320. static INVALID_UID: {
  321. code: string;
  322. message: string;
  323. };
  324. static INVALID_USER_IMPORT: {
  325. code: string;
  326. message: string;
  327. };
  328. static INVALID_TOKENS_VALID_AFTER_TIME: {
  329. code: string;
  330. message: string;
  331. };
  332. static MISMATCHING_TENANT_ID: {
  333. code: string;
  334. message: string;
  335. };
  336. static MISSING_ANDROID_PACKAGE_NAME: {
  337. code: string;
  338. message: string;
  339. };
  340. static MISSING_CONFIG: {
  341. code: string;
  342. message: string;
  343. };
  344. static MISSING_CONTINUE_URI: {
  345. code: string;
  346. message: string;
  347. };
  348. static MISSING_DISPLAY_NAME: {
  349. code: string;
  350. message: string;
  351. };
  352. static MISSING_EMAIL: {
  353. code: string;
  354. message: string;
  355. };
  356. static MISSING_IOS_BUNDLE_ID: {
  357. code: string;
  358. message: string;
  359. };
  360. static MISSING_ISSUER: {
  361. code: string;
  362. message: string;
  363. };
  364. static MISSING_HASH_ALGORITHM: {
  365. code: string;
  366. message: string;
  367. };
  368. static MISSING_OAUTH_CLIENT_ID: {
  369. code: string;
  370. message: string;
  371. };
  372. static MISSING_OAUTH_CLIENT_SECRET: {
  373. code: string;
  374. message: string;
  375. };
  376. static MISSING_PROVIDER_ID: {
  377. code: string;
  378. message: string;
  379. };
  380. static MISSING_SAML_RELYING_PARTY_CONFIG: {
  381. code: string;
  382. message: string;
  383. };
  384. static MAXIMUM_TEST_PHONE_NUMBER_EXCEEDED: {
  385. code: string;
  386. message: string;
  387. };
  388. static MAXIMUM_USER_COUNT_EXCEEDED: {
  389. code: string;
  390. message: string;
  391. };
  392. static MISSING_UID: {
  393. code: string;
  394. message: string;
  395. };
  396. static OPERATION_NOT_ALLOWED: {
  397. code: string;
  398. message: string;
  399. };
  400. static PHONE_NUMBER_ALREADY_EXISTS: {
  401. code: string;
  402. message: string;
  403. };
  404. static PROJECT_NOT_FOUND: {
  405. code: string;
  406. message: string;
  407. };
  408. static INSUFFICIENT_PERMISSION: {
  409. code: string;
  410. message: string;
  411. };
  412. static QUOTA_EXCEEDED: {
  413. code: string;
  414. message: string;
  415. };
  416. static SECOND_FACTOR_LIMIT_EXCEEDED: {
  417. code: string;
  418. message: string;
  419. };
  420. static SECOND_FACTOR_UID_ALREADY_EXISTS: {
  421. code: string;
  422. message: string;
  423. };
  424. static SESSION_COOKIE_EXPIRED: {
  425. code: string;
  426. message: string;
  427. };
  428. static SESSION_COOKIE_REVOKED: {
  429. code: string;
  430. message: string;
  431. };
  432. static TENANT_NOT_FOUND: {
  433. code: string;
  434. message: string;
  435. };
  436. static UID_ALREADY_EXISTS: {
  437. code: string;
  438. message: string;
  439. };
  440. static UNAUTHORIZED_DOMAIN: {
  441. code: string;
  442. message: string;
  443. };
  444. static UNSUPPORTED_FIRST_FACTOR: {
  445. code: string;
  446. message: string;
  447. };
  448. static UNSUPPORTED_SECOND_FACTOR: {
  449. code: string;
  450. message: string;
  451. };
  452. static UNSUPPORTED_TENANT_OPERATION: {
  453. code: string;
  454. message: string;
  455. };
  456. static UNVERIFIED_EMAIL: {
  457. code: string;
  458. message: string;
  459. };
  460. static USER_NOT_FOUND: {
  461. code: string;
  462. message: string;
  463. };
  464. static NOT_FOUND: {
  465. code: string;
  466. message: string;
  467. };
  468. static USER_DISABLED: {
  469. code: string;
  470. message: string;
  471. };
  472. static USER_NOT_DISABLED: {
  473. code: string;
  474. message: string;
  475. };
  476. static INVALID_RECAPTCHA_ACTION: {
  477. code: string;
  478. message: string;
  479. };
  480. static INVALID_RECAPTCHA_ENFORCEMENT_STATE: {
  481. code: string;
  482. message: string;
  483. };
  484. static RECAPTCHA_NOT_ENABLED: {
  485. code: string;
  486. message: string;
  487. };
  488. }
  489. /**
  490. * Messaging client error codes and their default messages.
  491. */
  492. export declare class MessagingClientErrorCode {
  493. static INVALID_ARGUMENT: {
  494. code: string;
  495. message: string;
  496. };
  497. static INVALID_RECIPIENT: {
  498. code: string;
  499. message: string;
  500. };
  501. static INVALID_PAYLOAD: {
  502. code: string;
  503. message: string;
  504. };
  505. static INVALID_DATA_PAYLOAD_KEY: {
  506. code: string;
  507. message: string;
  508. };
  509. static PAYLOAD_SIZE_LIMIT_EXCEEDED: {
  510. code: string;
  511. message: string;
  512. };
  513. static INVALID_OPTIONS: {
  514. code: string;
  515. message: string;
  516. };
  517. static INVALID_REGISTRATION_TOKEN: {
  518. code: string;
  519. message: string;
  520. };
  521. static REGISTRATION_TOKEN_NOT_REGISTERED: {
  522. code: string;
  523. message: string;
  524. };
  525. static MISMATCHED_CREDENTIAL: {
  526. code: string;
  527. message: string;
  528. };
  529. static INVALID_PACKAGE_NAME: {
  530. code: string;
  531. message: string;
  532. };
  533. static DEVICE_MESSAGE_RATE_EXCEEDED: {
  534. code: string;
  535. message: string;
  536. };
  537. static TOPICS_MESSAGE_RATE_EXCEEDED: {
  538. code: string;
  539. message: string;
  540. };
  541. static MESSAGE_RATE_EXCEEDED: {
  542. code: string;
  543. message: string;
  544. };
  545. static THIRD_PARTY_AUTH_ERROR: {
  546. code: string;
  547. message: string;
  548. };
  549. static TOO_MANY_TOPICS: {
  550. code: string;
  551. message: string;
  552. };
  553. static AUTHENTICATION_ERROR: {
  554. code: string;
  555. message: string;
  556. };
  557. static SERVER_UNAVAILABLE: {
  558. code: string;
  559. message: string;
  560. };
  561. static INTERNAL_ERROR: {
  562. code: string;
  563. message: string;
  564. };
  565. static UNKNOWN_ERROR: {
  566. code: string;
  567. message: string;
  568. };
  569. }
  570. export declare class InstallationsClientErrorCode {
  571. static INVALID_ARGUMENT: {
  572. code: string;
  573. message: string;
  574. };
  575. static INVALID_PROJECT_ID: {
  576. code: string;
  577. message: string;
  578. };
  579. static INVALID_INSTALLATION_ID: {
  580. code: string;
  581. message: string;
  582. };
  583. static API_ERROR: {
  584. code: string;
  585. message: string;
  586. };
  587. }
  588. export declare class InstanceIdClientErrorCode extends InstallationsClientErrorCode {
  589. static INVALID_INSTANCE_ID: {
  590. code: string;
  591. message: string;
  592. };
  593. }
  594. export type ProjectManagementErrorCode = 'already-exists' | 'authentication-error' | 'internal-error' | 'invalid-argument' | 'invalid-project-id' | 'invalid-server-response' | 'not-found' | 'service-unavailable' | 'unknown-error';