firebase-admin 9.12.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 (84) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +90 -0
  3. package/lib/app-check/app-check-api-client-internal.js +197 -0
  4. package/lib/app-check/app-check.js +79 -0
  5. package/lib/app-check/index.d.ts +160 -0
  6. package/lib/app-check/index.js +19 -0
  7. package/lib/app-check/token-generator.js +161 -0
  8. package/lib/app-check/token-verifier.js +152 -0
  9. package/lib/auth/action-code-settings-builder.js +118 -0
  10. package/lib/auth/auth-api-request.js +1856 -0
  11. package/lib/auth/auth-config.js +636 -0
  12. package/lib/auth/auth.js +836 -0
  13. package/lib/auth/identifier.js +40 -0
  14. package/lib/auth/index.d.ts +1927 -0
  15. package/lib/auth/index.js +18 -0
  16. package/lib/auth/tenant-manager.js +140 -0
  17. package/lib/auth/tenant.js +171 -0
  18. package/lib/auth/token-generator.js +200 -0
  19. package/lib/auth/token-verifier.js +259 -0
  20. package/lib/auth/user-import-builder.js +387 -0
  21. package/lib/auth/user-record.js +346 -0
  22. package/lib/credential/credential-internal.js +391 -0
  23. package/lib/credential/credential.js +44 -0
  24. package/lib/credential/index.d.ts +169 -0
  25. package/lib/credential/index.js +23 -0
  26. package/lib/database/database-internal.js +266 -0
  27. package/lib/database/index.d.ts +89 -0
  28. package/lib/database/index.js +31 -0
  29. package/lib/default-namespace.js +31 -0
  30. package/lib/firebase-app.js +349 -0
  31. package/lib/firebase-namespace-api.d.ts +243 -0
  32. package/lib/firebase-namespace-api.js +18 -0
  33. package/lib/firebase-namespace.d.ts +31 -0
  34. package/lib/firebase-namespace.js +417 -0
  35. package/lib/firestore/firestore-internal.js +105 -0
  36. package/lib/firestore/index.d.ts +50 -0
  37. package/lib/firestore/index.js +47 -0
  38. package/lib/index.d.ts +24 -0
  39. package/lib/index.js +27 -0
  40. package/lib/installations/index.d.ts +81 -0
  41. package/lib/installations/index.js +18 -0
  42. package/lib/installations/installations-request-handler.js +117 -0
  43. package/lib/installations/installations.js +62 -0
  44. package/lib/instance-id/index.d.ts +83 -0
  45. package/lib/instance-id/index.js +18 -0
  46. package/lib/instance-id/instance-id.js +87 -0
  47. package/lib/machine-learning/index.d.ts +249 -0
  48. package/lib/machine-learning/index.js +18 -0
  49. package/lib/machine-learning/machine-learning-api-client.js +304 -0
  50. package/lib/machine-learning/machine-learning-utils.js +62 -0
  51. package/lib/machine-learning/machine-learning.js +364 -0
  52. package/lib/messaging/batch-request-internal.js +129 -0
  53. package/lib/messaging/index.d.ts +1174 -0
  54. package/lib/messaging/index.js +18 -0
  55. package/lib/messaging/messaging-api-request-internal.js +128 -0
  56. package/lib/messaging/messaging-errors-internal.js +106 -0
  57. package/lib/messaging/messaging-internal.js +484 -0
  58. package/lib/messaging/messaging.js +846 -0
  59. package/lib/project-management/android-app.js +176 -0
  60. package/lib/project-management/index.d.ts +363 -0
  61. package/lib/project-management/index.js +41 -0
  62. package/lib/project-management/ios-app.js +88 -0
  63. package/lib/project-management/project-management-api-request-internal.js +273 -0
  64. package/lib/project-management/project-management.js +254 -0
  65. package/lib/remote-config/index.d.ts +369 -0
  66. package/lib/remote-config/index.js +18 -0
  67. package/lib/remote-config/remote-config-api-client-internal.js +407 -0
  68. package/lib/remote-config/remote-config.js +304 -0
  69. package/lib/security-rules/index.d.ts +216 -0
  70. package/lib/security-rules/index.js +18 -0
  71. package/lib/security-rules/security-rules-api-client-internal.js +237 -0
  72. package/lib/security-rules/security-rules-internal.js +41 -0
  73. package/lib/security-rules/security-rules.js +310 -0
  74. package/lib/storage/index.d.ts +60 -0
  75. package/lib/storage/index.js +18 -0
  76. package/lib/storage/storage.js +123 -0
  77. package/lib/utils/api-request.js +845 -0
  78. package/lib/utils/crypto-signer.js +237 -0
  79. package/lib/utils/deep-copy.js +78 -0
  80. package/lib/utils/error.js +1063 -0
  81. package/lib/utils/index.js +217 -0
  82. package/lib/utils/jwt.js +355 -0
  83. package/lib/utils/validator.js +271 -0
  84. package/package.json +122 -0
@@ -0,0 +1,369 @@
1
+ /*! firebase-admin v9.12.0 */
2
+ /*!
3
+ * Copyright 2020 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
+ import { app } from '../firebase-namespace-api';
18
+ /**
19
+ * Gets the {@link remoteConfig.RemoteConfig `RemoteConfig`} service for the
20
+ * default app or a given app.
21
+ *
22
+ * `admin.remoteConfig()` can be called with no arguments to access the default
23
+ * app's {@link remoteConfig.RemoteConfig `RemoteConfig`} service or as
24
+ * `admin.remoteConfig(app)` to access the
25
+ * {@link remoteConfig.RemoteConfig `RemoteConfig`} service associated with a
26
+ * specific app.
27
+ *
28
+ * @example
29
+ * ```javascript
30
+ * // Get the `RemoteConfig` service for the default app
31
+ * var defaultRemoteConfig = admin.remoteConfig();
32
+ * ```
33
+ *
34
+ * @example
35
+ * ```javascript
36
+ * // Get the `RemoteConfig` service for a given app
37
+ * var otherRemoteConfig = admin.remoteConfig(otherApp);
38
+ * ```
39
+ *
40
+ * @param app Optional app for which to return the `RemoteConfig` service.
41
+ * If not provided, the default `RemoteConfig` service is returned.
42
+ *
43
+ * @return The default `RemoteConfig` service if no
44
+ * app is provided, or the `RemoteConfig` service associated with the provided
45
+ * app.
46
+ */
47
+ export declare function remoteConfig(app?: app.App): remoteConfig.RemoteConfig;
48
+ export declare namespace remoteConfig {
49
+ /**
50
+ * Interface representing options for Remote Config list versions operation.
51
+ */
52
+ interface ListVersionsOptions {
53
+ /**
54
+ * The maximum number of items to return per page.
55
+ */
56
+ pageSize?: number;
57
+ /**
58
+ * The `nextPageToken` value returned from a previous list versions request, if any.
59
+ */
60
+ pageToken?: string;
61
+ /**
62
+ * Specifies the newest version number to include in the results.
63
+ * If specified, must be greater than zero. Defaults to the newest version.
64
+ */
65
+ endVersionNumber?: string | number;
66
+ /**
67
+ * Specifies the earliest update time to include in the results. Any entries updated before this
68
+ * time are omitted.
69
+ */
70
+ startTime?: Date | string;
71
+ /**
72
+ * Specifies the latest update time to include in the results. Any entries updated on or after
73
+ * this time are omitted.
74
+ */
75
+ endTime?: Date | string;
76
+ }
77
+ /**
78
+ * Interface representing a list of Remote Config template versions.
79
+ */
80
+ interface ListVersionsResult {
81
+ /**
82
+ * A list of version metadata objects, sorted in reverse chronological order.
83
+ */
84
+ versions: Version[];
85
+ /**
86
+ * Token to retrieve the next page of results, or empty if there are no more results
87
+ * in the list.
88
+ */
89
+ nextPageToken?: string;
90
+ }
91
+ /**
92
+ * Interface representing a Remote Config condition.
93
+ * A condition targets a specific group of users. A list of these conditions make up
94
+ * part of a Remote Config template.
95
+ */
96
+ interface RemoteConfigCondition {
97
+ /**
98
+ * A non-empty and unique name of this condition.
99
+ */
100
+ name: string;
101
+ /**
102
+ * The logic of this condition.
103
+ * See the documentation on
104
+ * {@link https://firebase.google.com/docs/remote-config/condition-reference condition expressions}
105
+ * for the expected syntax of this field.
106
+ */
107
+ expression: string;
108
+ /**
109
+ * The color associated with this condition for display purposes in the Firebase Console.
110
+ * Not specifying this value results in the console picking an arbitrary color to associate
111
+ * with the condition.
112
+ */
113
+ tagColor?: TagColor;
114
+ }
115
+ /**
116
+ * Interface representing a Remote Config parameter.
117
+ * At minimum, a `defaultValue` or a `conditionalValues` entry must be present for the
118
+ * parameter to have any effect.
119
+ */
120
+ interface RemoteConfigParameter {
121
+ /**
122
+ * The value to set the parameter to, when none of the named conditions evaluate to `true`.
123
+ */
124
+ defaultValue?: RemoteConfigParameterValue;
125
+ /**
126
+ * A `(condition name, value)` map. The condition name of the highest priority
127
+ * (the one listed first in the Remote Config template's conditions list) determines the value of
128
+ * this parameter.
129
+ */
130
+ conditionalValues?: {
131
+ [key: string]: RemoteConfigParameterValue;
132
+ };
133
+ /**
134
+ * A description for this parameter. Should not be over 100 characters and may contain any
135
+ * Unicode characters.
136
+ */
137
+ description?: string;
138
+ /**
139
+ * The data type for all values of this parameter in the current version of the template.
140
+ * Defaults to `ParameterValueType.STRING` if unspecified.
141
+ */
142
+ valueType?: ParameterValueType;
143
+ }
144
+ /**
145
+ * Interface representing a Remote Config parameter group.
146
+ * Grouping parameters is only for management purposes and does not affect client-side
147
+ * fetching of parameter values.
148
+ */
149
+ interface RemoteConfigParameterGroup {
150
+ /**
151
+ * A description for the group. Its length must be less than or equal to 256 characters.
152
+ * A description may contain any Unicode characters.
153
+ */
154
+ description?: string;
155
+ /**
156
+ * Map of parameter keys to their optional default values and optional conditional values for
157
+ * parameters that belong to this group. A parameter only appears once per
158
+ * Remote Config template. An ungrouped parameter appears at the top level, whereas a
159
+ * parameter organized within a group appears within its group's map of parameters.
160
+ */
161
+ parameters: {
162
+ [key: string]: RemoteConfigParameter;
163
+ };
164
+ }
165
+ /**
166
+ * Interface representing an explicit parameter value.
167
+ */
168
+ interface ExplicitParameterValue {
169
+ /**
170
+ * The `string` value that the parameter is set to.
171
+ */
172
+ value: string;
173
+ }
174
+ /**
175
+ * Interface representing an in-app-default value.
176
+ */
177
+ interface InAppDefaultValue {
178
+ /**
179
+ * If `true`, the parameter is omitted from the parameter values returned to a client.
180
+ */
181
+ useInAppDefault: boolean;
182
+ }
183
+ /**
184
+ * Type representing a Remote Config parameter value.
185
+ * A `RemoteConfigParameterValue` could be either an `ExplicitParameterValue` or
186
+ * an `InAppDefaultValue`.
187
+ */
188
+ type RemoteConfigParameterValue = ExplicitParameterValue | InAppDefaultValue;
189
+ /**
190
+ * Interface representing a Remote Config template.
191
+ */
192
+ interface RemoteConfigTemplate {
193
+ /**
194
+ * A list of conditions in descending order by priority.
195
+ */
196
+ conditions: RemoteConfigCondition[];
197
+ /**
198
+ * Map of parameter keys to their optional default values and optional conditional values.
199
+ */
200
+ parameters: {
201
+ [key: string]: RemoteConfigParameter;
202
+ };
203
+ /**
204
+ * Map of parameter group names to their parameter group objects.
205
+ * A group's name is mutable but must be unique among groups in the Remote Config template.
206
+ * The name is limited to 256 characters and intended to be human-readable. Any Unicode
207
+ * characters are allowed.
208
+ */
209
+ parameterGroups: {
210
+ [key: string]: RemoteConfigParameterGroup;
211
+ };
212
+ /**
213
+ * ETag of the current Remote Config template (readonly).
214
+ */
215
+ readonly etag: string;
216
+ /**
217
+ * Version information for the current Remote Config template.
218
+ */
219
+ version?: Version;
220
+ }
221
+ /**
222
+ * Interface representing a Remote Config user.
223
+ */
224
+ interface RemoteConfigUser {
225
+ /**
226
+ * Email address. Output only.
227
+ */
228
+ email: string;
229
+ /**
230
+ * Display name. Output only.
231
+ */
232
+ name?: string;
233
+ /**
234
+ * Image URL. Output only.
235
+ */
236
+ imageUrl?: string;
237
+ }
238
+ /**
239
+ * Colors that are associated with conditions for display purposes.
240
+ */
241
+ type TagColor = 'BLUE' | 'BROWN' | 'CYAN' | 'DEEP_ORANGE' | 'GREEN' | 'INDIGO' | 'LIME' | 'ORANGE' | 'PINK' | 'PURPLE' | 'TEAL';
242
+ /**
243
+ * Type representing a Remote Config parameter value data type.
244
+ * Defaults to `STRING` if unspecified.
245
+ */
246
+ type ParameterValueType = 'STRING' | 'BOOLEAN' | 'NUMBER' | 'JSON';
247
+ /**
248
+ * Interface representing a Remote Config template version.
249
+ * Output only, except for the version description. Contains metadata about a particular
250
+ * version of the Remote Config template. All fields are set at the time the specified Remote
251
+ * Config template is published. A version's description field may be specified in
252
+ * `publishTemplate` calls.
253
+ */
254
+ interface Version {
255
+ /**
256
+ * The version number of a Remote Config template.
257
+ */
258
+ versionNumber?: string;
259
+ /**
260
+ * The timestamp of when this version of the Remote Config template was written to the
261
+ * Remote Config backend.
262
+ */
263
+ updateTime?: string;
264
+ /**
265
+ * The origin of the template update action.
266
+ */
267
+ updateOrigin?: ('REMOTE_CONFIG_UPDATE_ORIGIN_UNSPECIFIED' | 'CONSOLE' | 'REST_API' | 'ADMIN_SDK_NODE');
268
+ /**
269
+ * The type of the template update action.
270
+ */
271
+ updateType?: ('REMOTE_CONFIG_UPDATE_TYPE_UNSPECIFIED' | 'INCREMENTAL_UPDATE' | 'FORCED_UPDATE' | 'ROLLBACK');
272
+ /**
273
+ * Aggregation of all metadata fields about the account that performed the update.
274
+ */
275
+ updateUser?: RemoteConfigUser;
276
+ /**
277
+ * The user-provided description of the corresponding Remote Config template.
278
+ */
279
+ description?: string;
280
+ /**
281
+ * The version number of the Remote Config template that has become the current version
282
+ * due to a rollback. Only present if this version is the result of a rollback.
283
+ */
284
+ rollbackSource?: string;
285
+ /**
286
+ * Indicates whether this Remote Config template was published before version history was
287
+ * supported.
288
+ */
289
+ isLegacy?: boolean;
290
+ }
291
+ /**
292
+ * The Firebase `RemoteConfig` service interface.
293
+ */
294
+ interface RemoteConfig {
295
+ app: app.App;
296
+ /**
297
+ * Gets the current active version of the {@link remoteConfig.RemoteConfigTemplate
298
+ * `RemoteConfigTemplate`} of the project.
299
+ *
300
+ * @return A promise that fulfills with a `RemoteConfigTemplate`.
301
+ */
302
+ getTemplate(): Promise<RemoteConfigTemplate>;
303
+ /**
304
+ * Gets the requested version of the {@link remoteConfig.RemoteConfigTemplate
305
+ * `RemoteConfigTemplate`} of the project.
306
+ *
307
+ * @param versionNumber Version number of the Remote Config template to look up.
308
+ *
309
+ * @return A promise that fulfills with a `RemoteConfigTemplate`.
310
+ */
311
+ getTemplateAtVersion(versionNumber: number | string): Promise<RemoteConfigTemplate>;
312
+ /**
313
+ * Validates a {@link remoteConfig.RemoteConfigTemplate `RemoteConfigTemplate`}.
314
+ *
315
+ * @param template The Remote Config template to be validated.
316
+ * @returns A promise that fulfills with the validated `RemoteConfigTemplate`.
317
+ */
318
+ validateTemplate(template: RemoteConfigTemplate): Promise<RemoteConfigTemplate>;
319
+ /**
320
+ * Publishes a Remote Config template.
321
+ *
322
+ * @param template The Remote Config template to be published.
323
+ * @param options Optional options object when publishing a Remote Config template:
324
+ * - {boolean} `force` Setting this to `true` forces the Remote Config template to
325
+ * be updated and circumvent the ETag. This approach is not recommended
326
+ * because it risks causing the loss of updates to your Remote Config
327
+ * template if multiple clients are updating the Remote Config template.
328
+ * See {@link https://firebase.google.com/docs/remote-config/use-config-rest#etag_usage_and_forced_updates
329
+ * ETag usage and forced updates}.
330
+ *
331
+ * @return A Promise that fulfills with the published `RemoteConfigTemplate`.
332
+ */
333
+ publishTemplate(template: RemoteConfigTemplate, options?: {
334
+ force: boolean;
335
+ }): Promise<RemoteConfigTemplate>;
336
+ /**
337
+ * Rolls back a project's published Remote Config template to the specified version.
338
+ * A rollback is equivalent to getting a previously published Remote Config
339
+ * template and re-publishing it using a force update.
340
+ *
341
+ * @param versionNumber The version number of the Remote Config template to roll back to.
342
+ * The specified version number must be lower than the current version number, and not have
343
+ * been deleted due to staleness. Only the last 300 versions are stored.
344
+ * All versions that correspond to non-active Remote Config templates (that is, all except the
345
+ * template that is being fetched by clients) are also deleted if they are more than 90 days old.
346
+ * @return A promise that fulfills with the published `RemoteConfigTemplate`.
347
+ */
348
+ rollback(versionNumber: string | number): Promise<RemoteConfigTemplate>;
349
+ /**
350
+ * Gets a list of Remote Config template versions that have been published, sorted in reverse
351
+ * chronological order. Only the last 300 versions are stored.
352
+ * All versions that correspond to non-active Remote Config templates (that is, all except the
353
+ * template that is being fetched by clients) are also deleted if they are more than 90 days old.
354
+ *
355
+ * @param options Optional {@link remoteConfig.ListVersionsOptions `ListVersionsOptions`}
356
+ * object for getting a list of template versions.
357
+ * @return A promise that fulfills with a `ListVersionsResult`.
358
+ */
359
+ listVersions(options?: ListVersionsOptions): Promise<ListVersionsResult>;
360
+ /**
361
+ * Creates and returns a new Remote Config template from a JSON string.
362
+ *
363
+ * @param json The JSON string to populate a Remote Config template.
364
+ *
365
+ * @return A new template instance.
366
+ */
367
+ createTemplateFromJSON(json: string): RemoteConfigTemplate;
368
+ }
369
+ }
@@ -0,0 +1,18 @@
1
+ /*! firebase-admin v9.12.0 */
2
+ "use strict";
3
+ /*!
4
+ * Copyright 2020 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
+ Object.defineProperty(exports, "__esModule", { value: true });