firebase-admin 9.12.0 → 10.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 (189) hide show
  1. package/README.md +7 -3
  2. package/lib/app/core.d.ts +188 -0
  3. package/lib/app/core.js +19 -0
  4. package/lib/app/credential-factory.d.ts +123 -0
  5. package/lib/app/credential-factory.js +150 -0
  6. package/lib/app/credential-internal.d.ts +90 -0
  7. package/lib/{credential → app}/credential-internal.js +15 -13
  8. package/lib/app/credential.d.ts +45 -0
  9. package/lib/app/credential.js +19 -0
  10. package/lib/app/firebase-app.d.ts +51 -0
  11. package/lib/{firebase-app.js → app/firebase-app.js} +26 -156
  12. package/lib/app/firebase-namespace.d.ts +163 -0
  13. package/lib/{firebase-namespace.js → app/firebase-namespace.js} +99 -111
  14. package/lib/app/index.d.ts +27 -0
  15. package/lib/app/index.js +31 -0
  16. package/lib/app/lifecycle.d.ts +60 -0
  17. package/lib/app/lifecycle.js +165 -0
  18. package/lib/app-check/app-check-api-client-internal.d.ts +32 -0
  19. package/lib/app-check/app-check-api-client-internal.js +10 -10
  20. package/lib/app-check/app-check-api.d.ts +95 -0
  21. package/lib/app-check/app-check-api.js +19 -0
  22. package/lib/app-check/app-check-namespace.d.ts +65 -0
  23. package/lib/app-check/app-check-namespace.js +18 -0
  24. package/lib/app-check/app-check.d.ts +49 -0
  25. package/lib/app-check/app-check.js +13 -10
  26. package/lib/app-check/index.d.ts +19 -126
  27. package/lib/app-check/index.js +45 -1
  28. package/lib/app-check/token-generator.d.ts +25 -0
  29. package/lib/app-check/token-generator.js +9 -9
  30. package/lib/app-check/token-verifier.d.ts +17 -0
  31. package/lib/app-check/token-verifier.js +6 -6
  32. package/lib/auth/action-code-settings-builder.d.ts +87 -0
  33. package/lib/auth/action-code-settings-builder.js +4 -2
  34. package/lib/auth/auth-api-request.d.ts +174 -0
  35. package/lib/auth/auth-api-request.js +197 -124
  36. package/lib/auth/auth-config.d.ts +575 -0
  37. package/lib/auth/auth-config.js +43 -34
  38. package/lib/auth/auth-namespace.d.ts +255 -0
  39. package/lib/auth/auth-namespace.js +18 -0
  40. package/lib/auth/auth.d.ts +40 -0
  41. package/lib/auth/auth.js +12 -772
  42. package/lib/auth/base-auth.d.ts +613 -0
  43. package/lib/auth/base-auth.js +951 -0
  44. package/lib/auth/identifier.d.ts +57 -0
  45. package/lib/auth/identifier.js +1 -1
  46. package/lib/auth/index.d.ts +25 -1897
  47. package/lib/auth/index.js +54 -1
  48. package/lib/auth/tenant-manager.d.ts +146 -0
  49. package/lib/auth/tenant-manager.js +151 -39
  50. package/lib/auth/tenant.d.ts +130 -0
  51. package/lib/auth/tenant.js +62 -16
  52. package/lib/auth/token-generator.d.ts +44 -0
  53. package/lib/auth/token-generator.js +11 -9
  54. package/lib/auth/token-verifier.d.ts +150 -0
  55. package/lib/auth/token-verifier.js +27 -15
  56. package/lib/auth/user-import-builder.d.ts +322 -0
  57. package/lib/auth/user-import-builder.js +9 -9
  58. package/lib/auth/user-record.d.ts +265 -0
  59. package/lib/auth/user-record.js +80 -45
  60. package/lib/credential/index.d.ts +24 -66
  61. package/lib/credential/index.js +101 -1
  62. package/lib/database/database-namespace.d.ts +95 -0
  63. package/lib/database/database-namespace.js +23 -0
  64. package/lib/database/database.d.ts +66 -0
  65. package/lib/database/{database-internal.js → database.js} +16 -9
  66. package/lib/database/index.d.ts +55 -54
  67. package/lib/database/index.js +84 -13
  68. package/lib/{firebase-namespace.d.ts → default-namespace.d.ts} +7 -14
  69. package/lib/default-namespace.js +4 -5
  70. package/lib/esm/app/index.js +10 -0
  71. package/lib/esm/app-check/index.js +4 -0
  72. package/lib/esm/auth/index.js +14 -0
  73. package/lib/esm/database/index.js +6 -0
  74. package/lib/esm/firestore/index.js +23 -0
  75. package/lib/esm/installations/index.js +4 -0
  76. package/lib/esm/instance-id/index.js +4 -0
  77. package/lib/esm/machine-learning/index.js +5 -0
  78. package/lib/esm/messaging/index.js +4 -0
  79. package/lib/esm/package.json +1 -0
  80. package/lib/esm/project-management/index.js +8 -0
  81. package/lib/esm/remote-config/index.js +4 -0
  82. package/lib/esm/security-rules/index.js +6 -0
  83. package/lib/esm/storage/index.js +4 -0
  84. package/lib/firebase-namespace-api.d.ts +34 -186
  85. package/lib/firebase-namespace-api.js +37 -2
  86. package/lib/firestore/firestore-internal.d.ts +32 -0
  87. package/lib/firestore/firestore-internal.js +3 -3
  88. package/lib/firestore/firestore-namespace.d.ts +50 -0
  89. package/lib/firestore/firestore-namespace.js +47 -0
  90. package/lib/firestore/index.d.ts +37 -35
  91. package/lib/firestore/index.js +61 -30
  92. package/lib/index.d.ts +2 -2
  93. package/lib/index.js +1 -1
  94. package/lib/installations/index.d.ts +34 -63
  95. package/lib/installations/index.js +45 -1
  96. package/lib/installations/installations-namespace.d.ts +55 -0
  97. package/lib/installations/installations-namespace.js +18 -0
  98. package/lib/installations/installations-request-handler.d.ts +43 -0
  99. package/lib/installations/installations-request-handler.js +4 -4
  100. package/lib/installations/installations.d.ts +38 -0
  101. package/lib/installations/installations.js +6 -5
  102. package/lib/instance-id/index.d.ts +23 -45
  103. package/lib/instance-id/index.js +54 -1
  104. package/lib/instance-id/instance-id-namespace.d.ts +38 -0
  105. package/lib/instance-id/instance-id-namespace.js +3 -0
  106. package/lib/instance-id/instance-id.d.ts +47 -0
  107. package/lib/instance-id/instance-id.js +14 -19
  108. package/lib/machine-learning/index.d.ts +19 -216
  109. package/lib/machine-learning/index.js +46 -1
  110. package/lib/machine-learning/machine-learning-api-client.d.ts +102 -0
  111. package/lib/machine-learning/machine-learning-api-client.js +6 -6
  112. package/lib/machine-learning/machine-learning-namespace.d.ts +85 -0
  113. package/lib/machine-learning/machine-learning-namespace.js +18 -0
  114. package/lib/machine-learning/machine-learning-utils.d.ts +22 -0
  115. package/lib/machine-learning/machine-learning-utils.js +1 -1
  116. package/lib/machine-learning/machine-learning.d.ts +181 -0
  117. package/lib/machine-learning/machine-learning.js +72 -37
  118. package/lib/messaging/batch-request-internal.d.ts +55 -0
  119. package/lib/messaging/batch-request-internal.js +9 -9
  120. package/lib/messaging/index.d.ts +18 -1140
  121. package/lib/messaging/index.js +45 -1
  122. package/lib/messaging/messaging-api-request-internal.d.ts +50 -0
  123. package/lib/messaging/messaging-api-request-internal.js +8 -8
  124. package/lib/messaging/messaging-api.d.ts +980 -0
  125. package/lib/messaging/messaging-api.js +19 -0
  126. package/lib/messaging/messaging-errors-internal.d.ts +31 -0
  127. package/lib/messaging/messaging-errors-internal.js +7 -7
  128. package/lib/messaging/messaging-internal.d.ts +27 -0
  129. package/lib/messaging/messaging-internal.js +2 -2
  130. package/lib/messaging/messaging-namespace.d.ts +181 -0
  131. package/lib/messaging/messaging-namespace.js +18 -0
  132. package/lib/messaging/messaging.d.ts +269 -0
  133. package/lib/messaging/messaging.js +83 -91
  134. package/lib/project-management/android-app.d.ts +110 -0
  135. package/lib/project-management/android-app.js +24 -15
  136. package/lib/project-management/app-metadata.d.ts +85 -0
  137. package/lib/project-management/app-metadata.js +37 -0
  138. package/lib/project-management/index.d.ts +21 -331
  139. package/lib/project-management/index.js +51 -24
  140. package/lib/project-management/ios-app.d.ts +66 -0
  141. package/lib/project-management/ios-app.js +15 -8
  142. package/lib/project-management/project-management-api-request-internal.d.ts +17 -0
  143. package/lib/project-management/project-management-api-request-internal.js +15 -15
  144. package/lib/project-management/project-management-namespace.d.ts +82 -0
  145. package/lib/project-management/project-management-namespace.js +18 -0
  146. package/lib/project-management/project-management.d.ts +115 -0
  147. package/lib/project-management/project-management.js +22 -25
  148. package/lib/remote-config/index.d.ts +19 -336
  149. package/lib/remote-config/index.js +45 -1
  150. package/lib/remote-config/remote-config-api-client-internal.d.ts +28 -0
  151. package/lib/remote-config/remote-config-api-client-internal.js +3 -3
  152. package/lib/remote-config/remote-config-api.d.ts +258 -0
  153. package/lib/remote-config/remote-config-api.js +18 -0
  154. package/lib/remote-config/remote-config-namespace.d.ts +105 -0
  155. package/lib/remote-config/remote-config-namespace.js +18 -0
  156. package/lib/remote-config/remote-config.d.ts +94 -0
  157. package/lib/remote-config/remote-config.js +27 -26
  158. package/lib/security-rules/index.d.ts +18 -184
  159. package/lib/security-rules/index.js +46 -1
  160. package/lib/security-rules/security-rules-api-client-internal.d.ts +73 -0
  161. package/lib/security-rules/security-rules-api-client-internal.js +1 -1
  162. package/lib/security-rules/security-rules-internal.d.ts +21 -0
  163. package/lib/security-rules/security-rules-internal.js +1 -1
  164. package/lib/security-rules/security-rules-namespace.d.ts +69 -0
  165. package/lib/security-rules/security-rules-namespace.js +18 -0
  166. package/lib/security-rules/security-rules.d.ts +196 -0
  167. package/lib/security-rules/security-rules.js +73 -55
  168. package/lib/storage/index.d.ts +16 -32
  169. package/lib/storage/index.js +38 -1
  170. package/lib/storage/storage-namespace.d.ts +45 -0
  171. package/lib/storage/storage-namespace.js +18 -0
  172. package/lib/storage/storage.d.ts +42 -0
  173. package/lib/storage/storage.js +9 -6
  174. package/lib/utils/api-request.d.ts +230 -0
  175. package/lib/utils/api-request.js +25 -25
  176. package/lib/utils/crypto-signer.d.ts +128 -0
  177. package/lib/utils/crypto-signer.js +9 -9
  178. package/lib/utils/deep-copy.d.ts +40 -0
  179. package/lib/utils/deep-copy.js +6 -6
  180. package/lib/utils/error.d.ts +650 -0
  181. package/lib/utils/error.js +34 -34
  182. package/lib/utils/index.d.ts +105 -0
  183. package/lib/utils/index.js +22 -21
  184. package/lib/utils/jwt.d.ts +131 -0
  185. package/lib/utils/jwt.js +11 -11
  186. package/lib/utils/validator.d.ts +144 -0
  187. package/lib/utils/validator.js +37 -37
  188. package/package.json +110 -8
  189. package/lib/credential/credential.js +0 -44
@@ -0,0 +1,322 @@
1
+ /*! firebase-admin v10.0.0 */
2
+ /*!
3
+ * Copyright 2018 Google Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /// <reference types="node" />
18
+ import { FirebaseArrayIndexError } from '../app/index';
19
+ import { UpdateMultiFactorInfoRequest, MultiFactorUpdateSettings } from './auth-config';
20
+ export declare type HashAlgorithmType = 'SCRYPT' | 'STANDARD_SCRYPT' | 'HMAC_SHA512' | 'HMAC_SHA256' | 'HMAC_SHA1' | 'HMAC_MD5' | 'MD5' | 'PBKDF_SHA1' | 'BCRYPT' | 'PBKDF2_SHA256' | 'SHA512' | 'SHA256' | 'SHA1';
21
+ /**
22
+ * Interface representing the user import options needed for
23
+ * {@link BaseAuth.importUsers} method. This is used to
24
+ * provide the password hashing algorithm information.
25
+ */
26
+ export interface UserImportOptions {
27
+ /**
28
+ * The password hashing information.
29
+ */
30
+ hash: {
31
+ /**
32
+ * The password hashing algorithm identifier. The following algorithm
33
+ * identifiers are supported:
34
+ * `SCRYPT`, `STANDARD_SCRYPT`, `HMAC_SHA512`, `HMAC_SHA256`, `HMAC_SHA1`,
35
+ * `HMAC_MD5`, `MD5`, `PBKDF_SHA1`, `BCRYPT`, `PBKDF2_SHA256`, `SHA512`,
36
+ * `SHA256` and `SHA1`.
37
+ */
38
+ algorithm: HashAlgorithmType;
39
+ /**
40
+ * The signing key used in the hash algorithm in buffer bytes.
41
+ * Required by hashing algorithms `SCRYPT`, `HMAC_SHA512`, `HMAC_SHA256`,
42
+ * `HAMC_SHA1` and `HMAC_MD5`.
43
+ */
44
+ key?: Buffer;
45
+ /**
46
+ * The salt separator in buffer bytes which is appended to salt when
47
+ * verifying a password. This is only used by the `SCRYPT` algorithm.
48
+ */
49
+ saltSeparator?: Buffer;
50
+ /**
51
+ * The number of rounds for hashing calculation.
52
+ * Required for `SCRYPT`, `MD5`, `SHA512`, `SHA256`, `SHA1`, `PBKDF_SHA1` and
53
+ * `PBKDF2_SHA256`.
54
+ */
55
+ rounds?: number;
56
+ /**
57
+ * The memory cost required for `SCRYPT` algorithm, or the CPU/memory cost.
58
+ * Required for `STANDARD_SCRYPT` algorithm.
59
+ */
60
+ memoryCost?: number;
61
+ /**
62
+ * The parallelization of the hashing algorithm. Required for the
63
+ * `STANDARD_SCRYPT` algorithm.
64
+ */
65
+ parallelization?: number;
66
+ /**
67
+ * The block size (normally 8) of the hashing algorithm. Required for the
68
+ * `STANDARD_SCRYPT` algorithm.
69
+ */
70
+ blockSize?: number;
71
+ /**
72
+ * The derived key length of the hashing algorithm. Required for the
73
+ * `STANDARD_SCRYPT` algorithm.
74
+ */
75
+ derivedKeyLength?: number;
76
+ };
77
+ }
78
+ /**
79
+ * Interface representing a user to import to Firebase Auth via the
80
+ * {@link BaseAuth.importUsers} method.
81
+ */
82
+ export interface UserImportRecord {
83
+ /**
84
+ * The user's `uid`.
85
+ */
86
+ uid: string;
87
+ /**
88
+ * The user's primary email, if set.
89
+ */
90
+ email?: string;
91
+ /**
92
+ * Whether or not the user's primary email is verified.
93
+ */
94
+ emailVerified?: boolean;
95
+ /**
96
+ * The user's display name.
97
+ */
98
+ displayName?: string;
99
+ /**
100
+ * The user's primary phone number, if set.
101
+ */
102
+ phoneNumber?: string;
103
+ /**
104
+ * The user's photo URL.
105
+ */
106
+ photoURL?: string;
107
+ /**
108
+ * Whether or not the user is disabled: `true` for disabled; `false` for
109
+ * enabled.
110
+ */
111
+ disabled?: boolean;
112
+ /**
113
+ * Additional metadata about the user.
114
+ */
115
+ metadata?: UserMetadataRequest;
116
+ /**
117
+ * An array of providers (for example, Google, Facebook) linked to the user.
118
+ */
119
+ providerData?: UserProviderRequest[];
120
+ /**
121
+ * The user's custom claims object if available, typically used to define
122
+ * user roles and propagated to an authenticated user's ID token.
123
+ */
124
+ customClaims?: {
125
+ [key: string]: any;
126
+ };
127
+ /**
128
+ * The buffer of bytes representing the user's hashed password.
129
+ * When a user is to be imported with a password hash,
130
+ * {@link UserImportOptions} are required to be
131
+ * specified to identify the hashing algorithm used to generate this hash.
132
+ */
133
+ passwordHash?: Buffer;
134
+ /**
135
+ * The buffer of bytes representing the user's password salt.
136
+ */
137
+ passwordSalt?: Buffer;
138
+ /**
139
+ * The identifier of the tenant where user is to be imported to.
140
+ * When not provided in an `admin.auth.Auth` context, the user is uploaded to
141
+ * the default parent project.
142
+ * When not provided in an `admin.auth.TenantAwareAuth` context, the user is uploaded
143
+ * to the tenant corresponding to that `TenantAwareAuth` instance's tenant ID.
144
+ */
145
+ tenantId?: string;
146
+ /**
147
+ * The user's multi-factor related properties.
148
+ */
149
+ multiFactor?: MultiFactorUpdateSettings;
150
+ }
151
+ /**
152
+ * User metadata to include when importing a user.
153
+ */
154
+ export interface UserMetadataRequest {
155
+ /**
156
+ * The date the user last signed in, formatted as a UTC string.
157
+ */
158
+ lastSignInTime?: string;
159
+ /**
160
+ * The date the user was created, formatted as a UTC string.
161
+ */
162
+ creationTime?: string;
163
+ }
164
+ /**
165
+ * User provider data to include when importing a user.
166
+ */
167
+ export interface UserProviderRequest {
168
+ /**
169
+ * The user identifier for the linked provider.
170
+ */
171
+ uid: string;
172
+ /**
173
+ * The display name for the linked provider.
174
+ */
175
+ displayName?: string;
176
+ /**
177
+ * The email for the linked provider.
178
+ */
179
+ email?: string;
180
+ /**
181
+ * The phone number for the linked provider.
182
+ */
183
+ phoneNumber?: string;
184
+ /**
185
+ * The photo URL for the linked provider.
186
+ */
187
+ photoURL?: string;
188
+ /**
189
+ * The linked provider ID (for example, "google.com" for the Google provider).
190
+ */
191
+ providerId: string;
192
+ }
193
+ /**
194
+ * Interface representing the response from the
195
+ * {@link BaseAuth.importUsers} method for batch
196
+ * importing users to Firebase Auth.
197
+ */
198
+ export interface UserImportResult {
199
+ /**
200
+ * The number of user records that failed to import to Firebase Auth.
201
+ */
202
+ failureCount: number;
203
+ /**
204
+ * The number of user records that successfully imported to Firebase Auth.
205
+ */
206
+ successCount: number;
207
+ /**
208
+ * An array of errors corresponding to the provided users to import. The
209
+ * length of this array is equal to [`failureCount`](#failureCount).
210
+ */
211
+ errors: FirebaseArrayIndexError[];
212
+ }
213
+ /** Interface representing an Auth second factor in Auth server format. */
214
+ export interface AuthFactorInfo {
215
+ mfaEnrollmentId?: string;
216
+ displayName?: string;
217
+ phoneInfo?: string;
218
+ enrolledAt?: string;
219
+ [key: string]: any;
220
+ }
221
+ /** UploadAccount endpoint request user interface. */
222
+ interface UploadAccountUser {
223
+ localId: string;
224
+ email?: string;
225
+ emailVerified?: boolean;
226
+ displayName?: string;
227
+ disabled?: boolean;
228
+ photoUrl?: string;
229
+ phoneNumber?: string;
230
+ providerUserInfo?: Array<{
231
+ rawId: string;
232
+ providerId: string;
233
+ email?: string;
234
+ displayName?: string;
235
+ photoUrl?: string;
236
+ }>;
237
+ mfaInfo?: AuthFactorInfo[];
238
+ passwordHash?: string;
239
+ salt?: string;
240
+ lastLoginAt?: number;
241
+ createdAt?: number;
242
+ customAttributes?: string;
243
+ tenantId?: string;
244
+ }
245
+ /** UploadAccount endpoint request hash options. */
246
+ export interface UploadAccountOptions {
247
+ hashAlgorithm?: string;
248
+ signerKey?: string;
249
+ rounds?: number;
250
+ memoryCost?: number;
251
+ saltSeparator?: string;
252
+ cpuMemCost?: number;
253
+ parallelization?: number;
254
+ blockSize?: number;
255
+ dkLen?: number;
256
+ }
257
+ /** UploadAccount endpoint complete request interface. */
258
+ export interface UploadAccountRequest extends UploadAccountOptions {
259
+ users?: UploadAccountUser[];
260
+ }
261
+ /** Callback function to validate an UploadAccountUser object. */
262
+ export declare type ValidatorFunction = (data: UploadAccountUser) => void;
263
+ /**
264
+ * Converts a client format second factor object to server format.
265
+ * @param multiFactorInfo - The client format second factor.
266
+ * @returns The corresponding AuthFactorInfo server request format.
267
+ */
268
+ export declare function convertMultiFactorInfoToServerFormat(multiFactorInfo: UpdateMultiFactorInfoRequest): AuthFactorInfo;
269
+ /**
270
+ * Class that provides a helper for building/validating uploadAccount requests and
271
+ * UserImportResult responses.
272
+ */
273
+ export declare class UserImportBuilder {
274
+ private requiresHashOptions;
275
+ private validatedUsers;
276
+ private validatedOptions;
277
+ private indexMap;
278
+ private userImportResultErrors;
279
+ /**
280
+ * @param {UserImportRecord[]} users The list of user records to import.
281
+ * @param {UserImportOptions=} options The import options which includes hashing
282
+ * algorithm details.
283
+ * @param {ValidatorFunction=} userRequestValidator The user request validator function.
284
+ * @constructor
285
+ */
286
+ constructor(users: UserImportRecord[], options?: UserImportOptions, userRequestValidator?: ValidatorFunction);
287
+ /**
288
+ * Returns the corresponding constructed uploadAccount request.
289
+ * @returns {UploadAccountRequest} The constructed uploadAccount request.
290
+ */
291
+ buildRequest(): UploadAccountRequest;
292
+ /**
293
+ * Populates the UserImportResult using the client side detected errors and the server
294
+ * side returned errors.
295
+ * @returns {UserImportResult} The user import result based on the returned failed
296
+ * uploadAccount response.
297
+ */
298
+ buildResponse(failedUploads: Array<{
299
+ index: number;
300
+ message: string;
301
+ }>): UserImportResult;
302
+ /**
303
+ * Validates and returns the hashing options of the uploadAccount request.
304
+ * Throws an error whenever an invalid or missing options is detected.
305
+ * @param {UserImportOptions} options The UserImportOptions.
306
+ * @param {boolean} requiresHashOptions Whether to require hash options.
307
+ * @returns {UploadAccountOptions} The populated UploadAccount options.
308
+ */
309
+ private populateOptions;
310
+ /**
311
+ * Validates and returns the users list of the uploadAccount request.
312
+ * Whenever a user with an error is detected, the error is cached and will later be
313
+ * merged into the user import result. This allows the processing of valid users without
314
+ * failing early on the first error detected.
315
+ * @param {UserImportRecord[]} users The UserImportRecords to convert to UnploadAccountUser
316
+ * objects.
317
+ * @param {ValidatorFunction=} userValidator The user validator function.
318
+ * @returns {UploadAccountUser[]} The populated uploadAccount users.
319
+ */
320
+ private populateUsers;
321
+ }
322
+ export {};
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v9.12.0 */
1
+ /*! firebase-admin v10.0.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2018 Google Inc.
@@ -23,8 +23,8 @@ var validator = require("../utils/validator");
23
23
  var error_1 = require("../utils/error");
24
24
  /**
25
25
  * Converts a client format second factor object to server format.
26
- * @param multiFactorInfo The client format second factor.
27
- * @return The corresponding AuthFactorInfo server request format.
26
+ * @param multiFactorInfo - The client format second factor.
27
+ * @returns The corresponding AuthFactorInfo server request format.
28
28
  */
29
29
  function convertMultiFactorInfoToServerFormat(multiFactorInfo) {
30
30
  var enrolledAt;
@@ -67,7 +67,7 @@ function isPhoneFactor(multiFactorInfo) {
67
67
  /**
68
68
  * @param {any} obj The object to check for number field within.
69
69
  * @param {string} key The entry key.
70
- * @return {number} The corresponding number if available. Otherwise, NaN.
70
+ * @returns {number} The corresponding number if available. Otherwise, NaN.
71
71
  */
72
72
  function getNumberField(obj, key) {
73
73
  if (typeof obj[key] !== 'undefined' && obj[key] !== null) {
@@ -80,7 +80,7 @@ function getNumberField(obj, key) {
80
80
  * fields are provided.
81
81
  * @param {UserImportRecord} user The UserImportRecord to conver to UploadAccountUser.
82
82
  * @param {ValidatorFunction=} userValidator The user validator function.
83
- * @return {UploadAccountUser} The corresponding UploadAccountUser to return.
83
+ * @returns {UploadAccountUser} The corresponding UploadAccountUser to return.
84
84
  */
85
85
  function populateUploadAccountUser(user, userValidator) {
86
86
  var result = {
@@ -176,7 +176,7 @@ var UserImportBuilder = /** @class */ (function () {
176
176
  }
177
177
  /**
178
178
  * Returns the corresponding constructed uploadAccount request.
179
- * @return {UploadAccountRequest} The constructed uploadAccount request.
179
+ * @returns {UploadAccountRequest} The constructed uploadAccount request.
180
180
  */
181
181
  UserImportBuilder.prototype.buildRequest = function () {
182
182
  var users = this.validatedUsers.map(function (user) {
@@ -187,7 +187,7 @@ var UserImportBuilder = /** @class */ (function () {
187
187
  /**
188
188
  * Populates the UserImportResult using the client side detected errors and the server
189
189
  * side returned errors.
190
- * @return {UserImportResult} The user import result based on the returned failed
190
+ * @returns {UserImportResult} The user import result based on the returned failed
191
191
  * uploadAccount response.
192
192
  */
193
193
  UserImportBuilder.prototype.buildResponse = function (failedUploads) {
@@ -219,7 +219,7 @@ var UserImportBuilder = /** @class */ (function () {
219
219
  * Throws an error whenever an invalid or missing options is detected.
220
220
  * @param {UserImportOptions} options The UserImportOptions.
221
221
  * @param {boolean} requiresHashOptions Whether to require hash options.
222
- * @return {UploadAccountOptions} The populated UploadAccount options.
222
+ * @returns {UploadAccountOptions} The populated UploadAccount options.
223
223
  */
224
224
  UserImportBuilder.prototype.populateOptions = function (options, requiresHashOptions) {
225
225
  var populatedOptions;
@@ -356,7 +356,7 @@ var UserImportBuilder = /** @class */ (function () {
356
356
  * @param {UserImportRecord[]} users The UserImportRecords to convert to UnploadAccountUser
357
357
  * objects.
358
358
  * @param {ValidatorFunction=} userValidator The user validator function.
359
- * @return {UploadAccountUser[]} The populated uploadAccount users.
359
+ * @returns {UploadAccountUser[]} The populated uploadAccount users.
360
360
  */
361
361
  UserImportBuilder.prototype.populateUsers = function (users, userValidator) {
362
362
  var _this = this;
@@ -0,0 +1,265 @@
1
+ /*! firebase-admin v10.0.0 */
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
+ export interface MultiFactorInfoResponse {
19
+ mfaEnrollmentId: string;
20
+ displayName?: string;
21
+ phoneInfo?: string;
22
+ enrolledAt?: string;
23
+ [key: string]: any;
24
+ }
25
+ export interface ProviderUserInfoResponse {
26
+ rawId: string;
27
+ displayName?: string;
28
+ email?: string;
29
+ photoUrl?: string;
30
+ phoneNumber?: string;
31
+ providerId: string;
32
+ federatedId?: string;
33
+ }
34
+ export interface GetAccountInfoUserResponse {
35
+ localId: string;
36
+ email?: string;
37
+ emailVerified?: boolean;
38
+ phoneNumber?: string;
39
+ displayName?: string;
40
+ photoUrl?: string;
41
+ disabled?: boolean;
42
+ passwordHash?: string;
43
+ salt?: string;
44
+ customAttributes?: string;
45
+ validSince?: string;
46
+ tenantId?: string;
47
+ providerUserInfo?: ProviderUserInfoResponse[];
48
+ mfaInfo?: MultiFactorInfoResponse[];
49
+ createdAt?: string;
50
+ lastLoginAt?: string;
51
+ lastRefreshAt?: string;
52
+ [key: string]: any;
53
+ }
54
+ /**
55
+ * Interface representing the common properties of a user-enrolled second factor.
56
+ */
57
+ export declare abstract class MultiFactorInfo {
58
+ /**
59
+ * The ID of the enrolled second factor. This ID is unique to the user.
60
+ */
61
+ readonly uid: string;
62
+ /**
63
+ * The optional display name of the enrolled second factor.
64
+ */
65
+ readonly displayName?: string;
66
+ /**
67
+ * The type identifier of the second factor. For SMS second factors, this is `phone`.
68
+ */
69
+ readonly factorId: string;
70
+ /**
71
+ * The optional date the second factor was enrolled, formatted as a UTC string.
72
+ */
73
+ readonly enrollmentTime?: string;
74
+ /**
75
+ * Returns a JSON-serializable representation of this object.
76
+ *
77
+ * @returns A JSON-serializable representation of this object.
78
+ */
79
+ toJSON(): object;
80
+ /**
81
+ * Initializes the MultiFactorInfo object using the provided server response.
82
+ *
83
+ * @param response - The server side response.
84
+ */
85
+ private initFromServerResponse;
86
+ }
87
+ /**
88
+ * Interface representing a phone specific user-enrolled second factor.
89
+ */
90
+ export declare class PhoneMultiFactorInfo extends MultiFactorInfo {
91
+ /**
92
+ * The phone number associated with a phone second factor.
93
+ */
94
+ readonly phoneNumber: string;
95
+ /**
96
+ * {@inheritdoc MultiFactorInfo.toJSON}
97
+ */
98
+ toJSON(): object;
99
+ }
100
+ /**
101
+ * The multi-factor related user settings.
102
+ */
103
+ export declare class MultiFactorSettings {
104
+ /**
105
+ * List of second factors enrolled with the current user.
106
+ * Currently only phone second factors are supported.
107
+ */
108
+ enrolledFactors: MultiFactorInfo[];
109
+ /**
110
+ * Returns a JSON-serializable representation of this multi-factor object.
111
+ *
112
+ * @returns A JSON-serializable representation of this multi-factor object.
113
+ */
114
+ toJSON(): object;
115
+ }
116
+ /**
117
+ * Represents a user's metadata.
118
+ */
119
+ export declare class UserMetadata {
120
+ /**
121
+ * The date the user was created, formatted as a UTC string.
122
+ */
123
+ readonly creationTime: string;
124
+ /**
125
+ * The date the user last signed in, formatted as a UTC string.
126
+ */
127
+ readonly lastSignInTime: string;
128
+ /**
129
+ * The time at which the user was last active (ID token refreshed),
130
+ * formatted as a UTC Date string (eg 'Sat, 03 Feb 2001 04:05:06 GMT').
131
+ * Returns null if the user was never active.
132
+ */
133
+ readonly lastRefreshTime?: string | null;
134
+ /**
135
+ * Returns a JSON-serializable representation of this object.
136
+ *
137
+ * @returns A JSON-serializable representation of this object.
138
+ */
139
+ toJSON(): object;
140
+ }
141
+ /**
142
+ * Represents a user's info from a third-party identity provider
143
+ * such as Google or Facebook.
144
+ */
145
+ export declare class UserInfo {
146
+ /**
147
+ * The user identifier for the linked provider.
148
+ */
149
+ readonly uid: string;
150
+ /**
151
+ * The display name for the linked provider.
152
+ */
153
+ readonly displayName: string;
154
+ /**
155
+ * The email for the linked provider.
156
+ */
157
+ readonly email: string;
158
+ /**
159
+ * The photo URL for the linked provider.
160
+ */
161
+ readonly photoURL: string;
162
+ /**
163
+ * The linked provider ID (for example, "google.com" for the Google provider).
164
+ */
165
+ readonly providerId: string;
166
+ /**
167
+ * The phone number for the linked provider.
168
+ */
169
+ readonly phoneNumber: string;
170
+ /**
171
+ * Returns a JSON-serializable representation of this object.
172
+ *
173
+ * @returns A JSON-serializable representation of this object.
174
+ */
175
+ toJSON(): object;
176
+ }
177
+ /**
178
+ * Represents a user.
179
+ */
180
+ export declare class UserRecord {
181
+ /**
182
+ * The user's `uid`.
183
+ */
184
+ readonly uid: string;
185
+ /**
186
+ * The user's primary email, if set.
187
+ */
188
+ readonly email?: string;
189
+ /**
190
+ * Whether or not the user's primary email is verified.
191
+ */
192
+ readonly emailVerified: boolean;
193
+ /**
194
+ * The user's display name.
195
+ */
196
+ readonly displayName?: string;
197
+ /**
198
+ * The user's photo URL.
199
+ */
200
+ readonly photoURL?: string;
201
+ /**
202
+ * The user's primary phone number, if set.
203
+ */
204
+ readonly phoneNumber?: string;
205
+ /**
206
+ * Whether or not the user is disabled: `true` for disabled; `false` for
207
+ * enabled.
208
+ */
209
+ readonly disabled: boolean;
210
+ /**
211
+ * Additional metadata about the user.
212
+ */
213
+ readonly metadata: UserMetadata;
214
+ /**
215
+ * An array of providers (for example, Google, Facebook) linked to the user.
216
+ */
217
+ readonly providerData: UserInfo[];
218
+ /**
219
+ * The user's hashed password (base64-encoded), only if Firebase Auth hashing
220
+ * algorithm (SCRYPT) is used. If a different hashing algorithm had been used
221
+ * when uploading this user, as is typical when migrating from another Auth
222
+ * system, this will be an empty string. If no password is set, this is
223
+ * null. This is only available when the user is obtained from
224
+ * {@link BaseAuth.listUsers}.
225
+ */
226
+ readonly passwordHash?: string;
227
+ /**
228
+ * The user's password salt (base64-encoded), only if Firebase Auth hashing
229
+ * algorithm (SCRYPT) is used. If a different hashing algorithm had been used to
230
+ * upload this user, typical when migrating from another Auth system, this will
231
+ * be an empty string. If no password is set, this is null. This is only
232
+ * available when the user is obtained from {@link BaseAuth.listUsers}.
233
+ */
234
+ readonly passwordSalt?: string;
235
+ /**
236
+ * The user's custom claims object if available, typically used to define
237
+ * user roles and propagated to an authenticated user's ID token.
238
+ * This is set via {@link BaseAuth.setCustomUserClaims}
239
+ */
240
+ readonly customClaims?: {
241
+ [key: string]: any;
242
+ };
243
+ /**
244
+ * The ID of the tenant the user belongs to, if available.
245
+ */
246
+ readonly tenantId?: string | null;
247
+ /**
248
+ * The date the user's tokens are valid after, formatted as a UTC string.
249
+ * This is updated every time the user's refresh token are revoked either
250
+ * from the {@link BaseAuth.revokeRefreshTokens}
251
+ * API or from the Firebase Auth backend on big account changes (password
252
+ * resets, password or email updates, etc).
253
+ */
254
+ readonly tokensValidAfterTime?: string;
255
+ /**
256
+ * The multi-factor related properties for the current user, if available.
257
+ */
258
+ readonly multiFactor?: MultiFactorSettings;
259
+ /**
260
+ * Returns a JSON-serializable representation of this object.
261
+ *
262
+ * @returns A JSON-serializable representation of this object.
263
+ */
264
+ toJSON(): object;
265
+ }