validator.d.ts 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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. /// <reference types="node" />
  19. /**
  20. * Validates that a value is a byte buffer.
  21. *
  22. * @param value - The value to validate.
  23. * @returns Whether the value is byte buffer or not.
  24. */
  25. export declare function isBuffer(value: any): value is Buffer;
  26. /**
  27. * Validates that a value is an array.
  28. *
  29. * @param value - The value to validate.
  30. * @returns Whether the value is an array or not.
  31. */
  32. export declare function isArray<T>(value: any): value is T[];
  33. /**
  34. * Validates that a value is a non-empty array.
  35. *
  36. * @param value - The value to validate.
  37. * @returns Whether the value is a non-empty array or not.
  38. */
  39. export declare function isNonEmptyArray<T>(value: any): value is T[];
  40. /**
  41. * Validates that a value is a boolean.
  42. *
  43. * @param value - The value to validate.
  44. * @returns Whether the value is a boolean or not.
  45. */
  46. export declare function isBoolean(value: any): boolean;
  47. /**
  48. * Validates that a value is a number.
  49. *
  50. * @param value - The value to validate.
  51. * @returns Whether the value is a number or not.
  52. */
  53. export declare function isNumber(value: any): boolean;
  54. /**
  55. * Validates that a value is a string.
  56. *
  57. * @param value - The value to validate.
  58. * @returns Whether the value is a string or not.
  59. */
  60. export declare function isString(value: any): value is string;
  61. /**
  62. * Validates that a value is a base64 string.
  63. *
  64. * @param value - The value to validate.
  65. * @returns Whether the value is a base64 string or not.
  66. */
  67. export declare function isBase64String(value: any): boolean;
  68. /**
  69. * Validates that a value is a non-empty string.
  70. *
  71. * @param value - The value to validate.
  72. * @returns Whether the value is a non-empty string or not.
  73. */
  74. export declare function isNonEmptyString(value: any): value is string;
  75. /**
  76. * Validates that a value is a nullable object.
  77. *
  78. * @param value - The value to validate.
  79. * @returns Whether the value is an object or not.
  80. */
  81. export declare function isObject(value: any): boolean;
  82. /**
  83. * Validates that a value is a non-null object.
  84. *
  85. * @param value - The value to validate.
  86. * @returns Whether the value is a non-null object or not.
  87. */
  88. export declare function isNonNullObject<T>(value: T | null | undefined): value is T;
  89. /**
  90. * Validates that a string is a valid Firebase Auth uid.
  91. *
  92. * @param uid - The string to validate.
  93. * @returns Whether the string is a valid Firebase Auth uid.
  94. */
  95. export declare function isUid(uid: any): boolean;
  96. /**
  97. * Validates that a string is a valid Firebase Auth password.
  98. *
  99. * @param password - The password string to validate.
  100. * @returns Whether the string is a valid Firebase Auth password.
  101. */
  102. export declare function isPassword(password: any): boolean;
  103. /**
  104. * Validates that a string is a valid email.
  105. *
  106. * @param email - The string to validate.
  107. * @returns Whether the string is valid email or not.
  108. */
  109. export declare function isEmail(email: any): boolean;
  110. /**
  111. * Validates that a string is a valid phone number.
  112. *
  113. * @param phoneNumber - The string to validate.
  114. * @returns Whether the string is a valid phone number or not.
  115. */
  116. export declare function isPhoneNumber(phoneNumber: any): boolean;
  117. /**
  118. * Validates that a string is a valid ISO date string.
  119. *
  120. * @param dateString - The string to validate.
  121. * @returns Whether the string is a valid ISO date string.
  122. */
  123. export declare function isISODateString(dateString: any): boolean;
  124. /**
  125. * Validates that a string is a valid UTC date string.
  126. *
  127. * @param dateString - The string to validate.
  128. * @returns Whether the string is a valid UTC date string.
  129. */
  130. export declare function isUTCDateString(dateString: any): boolean;
  131. /**
  132. * Validates that a string is a valid web URL.
  133. *
  134. * @param urlStr - The string to validate.
  135. * @returns Whether the string is valid web URL or not.
  136. */
  137. export declare function isURL(urlStr: any): boolean;
  138. /**
  139. * Validates that the provided topic is a valid FCM topic name.
  140. *
  141. * @param topic - The topic to validate.
  142. * @returns Whether the provided topic is a valid FCM topic name.
  143. */
  144. export declare function isTopic(topic: any): boolean;
  145. /**
  146. * Validates that the provided string can be used as a task ID
  147. * for Cloud Tasks.
  148. *
  149. * @param taskId - the task ID to validate.
  150. * @returns Whether the provided task ID is valid.
  151. */
  152. export declare function isTaskId(taskId: any): boolean;