firebase-admin 9.12.0 → 10.0.1

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 +202 -127
  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 +24 -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 +55 -0
  89. package/lib/firestore/firestore-namespace.js +48 -0
  90. package/lib/firestore/index.d.ts +37 -35
  91. package/lib/firestore/index.js +62 -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 +36 -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 +112 -10
  189. package/lib/credential/credential.js +0 -44
@@ -0,0 +1,181 @@
1
+ /*! firebase-admin v10.0.1 */
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 '../app';
18
+ import { ListModelsOptions, ModelOptions } from './machine-learning-api-client';
19
+ /** Response object for a listModels operation. */
20
+ export interface ListModelsResult {
21
+ /** A list of models in your project. */
22
+ readonly models: Model[];
23
+ /**
24
+ * A token you can use to retrieve the next page of results. If null, the
25
+ * current page is the final page.
26
+ */
27
+ readonly pageToken?: string;
28
+ }
29
+ /**
30
+ * A TensorFlow Lite Model output object
31
+ *
32
+ * One of either the `gcsTfliteUri` or `automlModel` properties will be
33
+ * defined.
34
+ */
35
+ export interface TFLiteModel {
36
+ /** The size of the model. */
37
+ readonly sizeBytes: number;
38
+ /** The URI from which the model was originally provided to Firebase. */
39
+ readonly gcsTfliteUri?: string;
40
+ /**
41
+ * The AutoML model reference from which the model was originally provided
42
+ * to Firebase.
43
+ */
44
+ readonly automlModel?: string;
45
+ }
46
+ /**
47
+ * The Firebase `MachineLearning` service interface.
48
+ */
49
+ export declare class MachineLearning {
50
+ private readonly client;
51
+ private readonly appInternal;
52
+ /**
53
+ * The {@link firebase-admin.app#App} associated with the current `MachineLearning`
54
+ * service instance.
55
+ */
56
+ get app(): App;
57
+ /**
58
+ * Creates a model in the current Firebase project.
59
+ *
60
+ * @param model - The model to create.
61
+ *
62
+ * @returns A Promise fulfilled with the created model.
63
+ */
64
+ createModel(model: ModelOptions): Promise<Model>;
65
+ /**
66
+ * Updates a model's metadata or model file.
67
+ *
68
+ * @param modelId - The ID of the model to update.
69
+ * @param model - The model fields to update.
70
+ *
71
+ * @returns A Promise fulfilled with the updated model.
72
+ */
73
+ updateModel(modelId: string, model: ModelOptions): Promise<Model>;
74
+ /**
75
+ * Publishes a Firebase ML model.
76
+ *
77
+ * A published model can be downloaded to client apps.
78
+ *
79
+ * @param modelId - The ID of the model to publish.
80
+ *
81
+ * @returns A Promise fulfilled with the published model.
82
+ */
83
+ publishModel(modelId: string): Promise<Model>;
84
+ /**
85
+ * Unpublishes a Firebase ML model.
86
+ *
87
+ * @param modelId - The ID of the model to unpublish.
88
+ *
89
+ * @returns A Promise fulfilled with the unpublished model.
90
+ */
91
+ unpublishModel(modelId: string): Promise<Model>;
92
+ /**
93
+ * Gets the model specified by the given ID.
94
+ *
95
+ * @param modelId - The ID of the model to get.
96
+ *
97
+ * @returns A Promise fulfilled with the model object.
98
+ */
99
+ getModel(modelId: string): Promise<Model>;
100
+ /**
101
+ * Lists the current project's models.
102
+ *
103
+ * @param options - The listing options.
104
+ *
105
+ * @returns A promise that
106
+ * resolves with the current (filtered) list of models and the next page
107
+ * token. For the last page, an empty list of models and no page token
108
+ * are returned.
109
+ */
110
+ listModels(options?: ListModelsOptions): Promise<ListModelsResult>;
111
+ /**
112
+ * Deletes a model from the current project.
113
+ *
114
+ * @param modelId - The ID of the model to delete.
115
+ */
116
+ deleteModel(modelId: string): Promise<void>;
117
+ private setPublishStatus;
118
+ private signUrlIfPresent;
119
+ private signUrl;
120
+ }
121
+ /**
122
+ * A Firebase ML Model output object.
123
+ */
124
+ export declare class Model {
125
+ private model;
126
+ private readonly client?;
127
+ /** The ID of the model. */
128
+ get modelId(): string;
129
+ /**
130
+ * The model's name. This is the name you use from your app to load the
131
+ * model.
132
+ */
133
+ get displayName(): string;
134
+ /**
135
+ * The model's tags, which can be used to group or filter models in list
136
+ * operations.
137
+ */
138
+ get tags(): string[];
139
+ /** The timestamp of the model's creation. */
140
+ get createTime(): string;
141
+ /** The timestamp of the model's most recent update. */
142
+ get updateTime(): string;
143
+ /** Error message when model validation fails. */
144
+ get validationError(): string | undefined;
145
+ /** True if the model is published. */
146
+ get published(): boolean;
147
+ /**
148
+ * The ETag identifier of the current version of the model. This value
149
+ * changes whenever you update any of the model's properties.
150
+ */
151
+ get etag(): string;
152
+ /**
153
+ * The hash of the model's `tflite` file. This value changes only when
154
+ * you upload a new TensorFlow Lite model.
155
+ */
156
+ get modelHash(): string | undefined;
157
+ /** Metadata about the model's TensorFlow Lite model file. */
158
+ get tfliteModel(): TFLiteModel | undefined;
159
+ /**
160
+ * True if the model is locked by a server-side operation. You can't make
161
+ * changes to a locked model. See {@link Model.waitForUnlocked}.
162
+ */
163
+ get locked(): boolean;
164
+ /**
165
+ * Return the model as a JSON object.
166
+ */
167
+ toJSON(): {
168
+ [key: string]: any;
169
+ };
170
+ /**
171
+ * Wait for the model to be unlocked.
172
+ *
173
+ * @param maxTimeMillis - The maximum time in milliseconds to wait.
174
+ * If not specified, a default maximum of 2 minutes is used.
175
+ *
176
+ * @returns A promise that resolves when the model is unlocked
177
+ * or the maximum wait time has passed.
178
+ */
179
+ waitForUnlocked(maxTimeMillis?: number): Promise<void>;
180
+ private static validateAndClone;
181
+ }
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v9.12.0 */
1
+ /*! firebase-admin v10.0.1 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2020 Google Inc.
@@ -17,19 +17,21 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.Model = exports.MachineLearning = void 0;
20
- var machine_learning_api_client_1 = require("./machine-learning-api-client");
20
+ var index_1 = require("../storage/index");
21
21
  var error_1 = require("../utils/error");
22
22
  var validator = require("../utils/validator");
23
- var machine_learning_utils_1 = require("./machine-learning-utils");
24
23
  var deep_copy_1 = require("../utils/deep-copy");
25
24
  var utils = require("../utils");
25
+ var machine_learning_api_client_1 = require("./machine-learning-api-client");
26
+ var machine_learning_utils_1 = require("./machine-learning-utils");
26
27
  /**
27
- * The Firebase Machine Learning class
28
+ * The Firebase `MachineLearning` service interface.
28
29
  */
29
30
  var MachineLearning = /** @class */ (function () {
30
31
  /**
31
- * @param {FirebaseApp} app The app for this ML service.
32
+ * @param app - The app for this ML service.
32
33
  * @constructor
34
+ * @internal
33
35
  */
34
36
  function MachineLearning(app) {
35
37
  if (!validator.isNonNullObject(app) || !('options' in app)) {
@@ -44,9 +46,8 @@ var MachineLearning = /** @class */ (function () {
44
46
  }
45
47
  Object.defineProperty(MachineLearning.prototype, "app", {
46
48
  /**
47
- * Returns the app associated with this ML instance.
48
- *
49
- * @return {FirebaseApp} The app associated with this ML instance.
49
+ * The {@link firebase-admin.app#App} associated with the current `MachineLearning`
50
+ * service instance.
50
51
  */
51
52
  get: function () {
52
53
  return this.appInternal;
@@ -55,11 +56,11 @@ var MachineLearning = /** @class */ (function () {
55
56
  configurable: true
56
57
  });
57
58
  /**
58
- * Creates a model in Firebase ML.
59
+ * Creates a model in the current Firebase project.
59
60
  *
60
- * @param {ModelOptions} model The model to create.
61
+ * @param model - The model to create.
61
62
  *
62
- * @return {Promise<Model>} A Promise fulfilled with the created model.
63
+ * @returns A Promise fulfilled with the created model.
63
64
  */
64
65
  MachineLearning.prototype.createModel = function (model) {
65
66
  var _this = this;
@@ -69,12 +70,12 @@ var MachineLearning = /** @class */ (function () {
69
70
  .then(function (modelResponse) { return new Model(modelResponse, _this.client); });
70
71
  };
71
72
  /**
72
- * Updates a model in Firebase ML.
73
+ * Updates a model's metadata or model file.
73
74
  *
74
- * @param {string} modelId The id of the model to update.
75
- * @param {ModelOptions} model The model fields to update.
75
+ * @param modelId - The ID of the model to update.
76
+ * @param model - The model fields to update.
76
77
  *
77
- * @return {Promise<Model>} A Promise fulfilled with the updated model.
78
+ * @returns A Promise fulfilled with the updated model.
78
79
  */
79
80
  MachineLearning.prototype.updateModel = function (modelId, model) {
80
81
  var _this = this;
@@ -85,31 +86,33 @@ var MachineLearning = /** @class */ (function () {
85
86
  .then(function (modelResponse) { return new Model(modelResponse, _this.client); });
86
87
  };
87
88
  /**
88
- * Publishes a model in Firebase ML.
89
+ * Publishes a Firebase ML model.
90
+ *
91
+ * A published model can be downloaded to client apps.
89
92
  *
90
- * @param {string} modelId The id of the model to publish.
93
+ * @param modelId - The ID of the model to publish.
91
94
  *
92
- * @return {Promise<Model>} A Promise fulfilled with the published model.
95
+ * @returns A Promise fulfilled with the published model.
93
96
  */
94
97
  MachineLearning.prototype.publishModel = function (modelId) {
95
98
  return this.setPublishStatus(modelId, true);
96
99
  };
97
100
  /**
98
- * Unpublishes a model in Firebase ML.
101
+ * Unpublishes a Firebase ML model.
99
102
  *
100
- * @param {string} modelId The id of the model to unpublish.
103
+ * @param modelId - The ID of the model to unpublish.
101
104
  *
102
- * @return {Promise<Model>} A Promise fulfilled with the unpublished model.
105
+ * @returns A Promise fulfilled with the unpublished model.
103
106
  */
104
107
  MachineLearning.prototype.unpublishModel = function (modelId) {
105
108
  return this.setPublishStatus(modelId, false);
106
109
  };
107
110
  /**
108
- * Gets a model from Firebase ML.
111
+ * Gets the model specified by the given ID.
109
112
  *
110
- * @param {string} modelId The id of the model to get.
113
+ * @param modelId - The ID of the model to get.
111
114
  *
112
- * @return {Promise<Model>} A Promise fulfilled with the unpublished model.
115
+ * @returns A Promise fulfilled with the model object.
113
116
  */
114
117
  MachineLearning.prototype.getModel = function (modelId) {
115
118
  var _this = this;
@@ -117,14 +120,14 @@ var MachineLearning = /** @class */ (function () {
117
120
  .then(function (modelResponse) { return new Model(modelResponse, _this.client); });
118
121
  };
119
122
  /**
120
- * Lists models from Firebase ML.
123
+ * Lists the current project's models.
121
124
  *
122
- * @param {ListModelsOptions} options The listing options.
125
+ * @param options - The listing options.
123
126
  *
124
- * @return {Promise<{models: Model[], pageToken?: string}>} A promise that
127
+ * @returns A promise that
125
128
  * resolves with the current (filtered) list of models and the next page
126
- * token. For the last page, an empty list of models and no page token are
127
- * returned.
129
+ * token. For the last page, an empty list of models and no page token
130
+ * are returned.
128
131
  */
129
132
  MachineLearning.prototype.listModels = function (options) {
130
133
  var _this = this;
@@ -146,9 +149,9 @@ var MachineLearning = /** @class */ (function () {
146
149
  });
147
150
  };
148
151
  /**
149
- * Deletes a model from Firebase ML.
152
+ * Deletes a model from the current project.
150
153
  *
151
- * @param {string} modelId The id of the model to delete.
154
+ * @param modelId - The ID of the model to delete.
152
155
  */
153
156
  MachineLearning.prototype.deleteModel = function (modelId) {
154
157
  return this.client.deleteModel(modelId);
@@ -185,7 +188,7 @@ var MachineLearning = /** @class */ (function () {
185
188
  }
186
189
  var bucketName = matches[1];
187
190
  var blobName = matches[2];
188
- var bucket = this.appInternal.storage().bucket(bucketName);
191
+ var bucket = index_1.getStorage(this.app).bucket(bucketName);
189
192
  var blob = bucket.file(blobName);
190
193
  return blob.getSignedUrl({
191
194
  action: 'read',
@@ -199,11 +202,15 @@ exports.MachineLearning = MachineLearning;
199
202
  * A Firebase ML Model output object.
200
203
  */
201
204
  var Model = /** @class */ (function () {
205
+ /**
206
+ * @internal
207
+ */
202
208
  function Model(model, client) {
203
209
  this.model = Model.validateAndClone(model);
204
210
  this.client = client;
205
211
  }
206
212
  Object.defineProperty(Model.prototype, "modelId", {
213
+ /** The ID of the model. */
207
214
  get: function () {
208
215
  return extractModelId(this.model.name);
209
216
  },
@@ -211,6 +218,10 @@ var Model = /** @class */ (function () {
211
218
  configurable: true
212
219
  });
213
220
  Object.defineProperty(Model.prototype, "displayName", {
221
+ /**
222
+ * The model's name. This is the name you use from your app to load the
223
+ * model.
224
+ */
214
225
  get: function () {
215
226
  return this.model.displayName;
216
227
  },
@@ -218,6 +229,10 @@ var Model = /** @class */ (function () {
218
229
  configurable: true
219
230
  });
220
231
  Object.defineProperty(Model.prototype, "tags", {
232
+ /**
233
+ * The model's tags, which can be used to group or filter models in list
234
+ * operations.
235
+ */
221
236
  get: function () {
222
237
  return this.model.tags || [];
223
238
  },
@@ -225,6 +240,7 @@ var Model = /** @class */ (function () {
225
240
  configurable: true
226
241
  });
227
242
  Object.defineProperty(Model.prototype, "createTime", {
243
+ /** The timestamp of the model's creation. */
228
244
  get: function () {
229
245
  return new Date(this.model.createTime).toUTCString();
230
246
  },
@@ -232,6 +248,7 @@ var Model = /** @class */ (function () {
232
248
  configurable: true
233
249
  });
234
250
  Object.defineProperty(Model.prototype, "updateTime", {
251
+ /** The timestamp of the model's most recent update. */
235
252
  get: function () {
236
253
  return new Date(this.model.updateTime).toUTCString();
237
254
  },
@@ -239,6 +256,7 @@ var Model = /** @class */ (function () {
239
256
  configurable: true
240
257
  });
241
258
  Object.defineProperty(Model.prototype, "validationError", {
259
+ /** Error message when model validation fails. */
242
260
  get: function () {
243
261
  var _a, _b;
244
262
  return (_b = (_a = this.model.state) === null || _a === void 0 ? void 0 : _a.validationError) === null || _b === void 0 ? void 0 : _b.message;
@@ -247,6 +265,7 @@ var Model = /** @class */ (function () {
247
265
  configurable: true
248
266
  });
249
267
  Object.defineProperty(Model.prototype, "published", {
268
+ /** True if the model is published. */
250
269
  get: function () {
251
270
  var _a;
252
271
  return ((_a = this.model.state) === null || _a === void 0 ? void 0 : _a.published) || false;
@@ -255,6 +274,10 @@ var Model = /** @class */ (function () {
255
274
  configurable: true
256
275
  });
257
276
  Object.defineProperty(Model.prototype, "etag", {
277
+ /**
278
+ * The ETag identifier of the current version of the model. This value
279
+ * changes whenever you update any of the model's properties.
280
+ */
258
281
  get: function () {
259
282
  return this.model.etag;
260
283
  },
@@ -262,6 +285,10 @@ var Model = /** @class */ (function () {
262
285
  configurable: true
263
286
  });
264
287
  Object.defineProperty(Model.prototype, "modelHash", {
288
+ /**
289
+ * The hash of the model's `tflite` file. This value changes only when
290
+ * you upload a new TensorFlow Lite model.
291
+ */
265
292
  get: function () {
266
293
  return this.model.modelHash;
267
294
  },
@@ -269,6 +296,7 @@ var Model = /** @class */ (function () {
269
296
  configurable: true
270
297
  });
271
298
  Object.defineProperty(Model.prototype, "tfliteModel", {
299
+ /** Metadata about the model's TensorFlow Lite model file. */
272
300
  get: function () {
273
301
  // Make a copy so people can't directly modify the private this.model object.
274
302
  return deep_copy_1.deepCopy(this.model.tfliteModel);
@@ -278,8 +306,8 @@ var Model = /** @class */ (function () {
278
306
  });
279
307
  Object.defineProperty(Model.prototype, "locked", {
280
308
  /**
281
- * Locked indicates if there are active long running operations on the model.
282
- * Models may not be modified when they are locked.
309
+ * True if the model is locked by a server-side operation. You can't make
310
+ * changes to a locked model. See {@link Model.waitForUnlocked}.
283
311
  */
284
312
  get: function () {
285
313
  var _a, _b;
@@ -288,6 +316,9 @@ var Model = /** @class */ (function () {
288
316
  enumerable: false,
289
317
  configurable: true
290
318
  });
319
+ /**
320
+ * Return the model as a JSON object.
321
+ */
291
322
  Model.prototype.toJSON = function () {
292
323
  // We can't just return this.model because it has extra fields and
293
324
  // different formats etc. So we build the expected model object.
@@ -314,9 +345,13 @@ var Model = /** @class */ (function () {
314
345
  return jsonModel;
315
346
  };
316
347
  /**
317
- * Wait for the active operations on the model to complete.
318
- * @param maxTimeMillis The number of milliseconds to wait for the model to be unlocked. If unspecified,
319
- * a default will be used.
348
+ * Wait for the model to be unlocked.
349
+ *
350
+ * @param maxTimeMillis - The maximum time in milliseconds to wait.
351
+ * If not specified, a default maximum of 2 minutes is used.
352
+ *
353
+ * @returns A promise that resolves when the model is unlocked
354
+ * or the maximum wait time has passed.
320
355
  */
321
356
  Model.prototype.waitForUnlocked = function (maxTimeMillis) {
322
357
  var _this = this;
@@ -0,0 +1,55 @@
1
+ /*! firebase-admin v10.0.1 */
2
+ /*!
3
+ * Copyright 2019 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 { HttpClient, HttpResponse } from '../utils/api-request';
18
+ /**
19
+ * Represents a request that can be sent as part of an HTTP batch request.
20
+ */
21
+ export interface SubRequest {
22
+ url: string;
23
+ body: object;
24
+ headers?: {
25
+ [key: string]: any;
26
+ };
27
+ }
28
+ /**
29
+ * An HTTP client that can be used to make batch requests. This client is not tied to any service
30
+ * (FCM or otherwise). Therefore it can be used to make batch requests to any service that allows
31
+ * it. If this requirement ever arises we can move this implementation to the utils module
32
+ * where it can be easily shared among other modules.
33
+ */
34
+ export declare class BatchRequestClient {
35
+ private readonly httpClient;
36
+ private readonly batchUrl;
37
+ private readonly commonHeaders?;
38
+ /**
39
+ * @param {HttpClient} httpClient The client that will be used to make HTTP calls.
40
+ * @param {string} batchUrl The URL that accepts batch requests.
41
+ * @param {object=} commonHeaders Optional headers that will be included in all requests.
42
+ *
43
+ * @constructor
44
+ */
45
+ constructor(httpClient: HttpClient, batchUrl: string, commonHeaders?: object | undefined);
46
+ /**
47
+ * Sends the given array of sub requests as a single batch, and parses the results into an array
48
+ * of HttpResponse objects.
49
+ *
50
+ * @param requests - An array of sub requests to send.
51
+ * @returns A promise that resolves when the send operation is complete.
52
+ */
53
+ send(requests: SubRequest[]): Promise<HttpResponse[]>;
54
+ private getMultipartPayload;
55
+ }
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v9.12.0 */
1
+ /*! firebase-admin v10.0.1 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2019 Google Inc.
@@ -44,8 +44,8 @@ var BatchRequestClient = /** @class */ (function () {
44
44
  * Sends the given array of sub requests as a single batch, and parses the results into an array
45
45
  * of HttpResponse objects.
46
46
  *
47
- * @param {SubRequest[]} requests An array of sub requests to send.
48
- * @return {Promise<HttpResponse[]>} A promise that resolves when the send operation is complete.
47
+ * @param requests - An array of sub requests to send.
48
+ * @returns A promise that resolves when the send operation is complete.
49
49
  */
50
50
  BatchRequestClient.prototype.send = function (requests) {
51
51
  var _this = this;
@@ -89,10 +89,10 @@ exports.BatchRequestClient = BatchRequestClient;
89
89
  * API, sets the content-type header to application/http, and the content-transfer-encoding to
90
90
  * binary.
91
91
  *
92
- * @param {SubRequest} request A sub request that will be used to populate the part.
93
- * @param {string} boundary Multipart boundary string.
94
- * @param {number} idx An index number that is used to set the content-id header.
95
- * @return {string} The part as a string that can be included in the HTTP body.
92
+ * @param request - A sub request that will be used to populate the part.
93
+ * @param boundary - Multipart boundary string.
94
+ * @param idx - An index number that is used to set the content-id header.
95
+ * @returns The part as a string that can be included in the HTTP body.
96
96
  */
97
97
  function createPart(request, boundary, idx) {
98
98
  var serializedRequest = serializeSubRequest(request);
@@ -110,8 +110,8 @@ function createPart(request, boundary, idx) {
110
110
  * format of the string is the wire format of a typical HTTP request, consisting of a header and a
111
111
  * body.
112
112
  *
113
- * @param request {SubRequest} The sub request to be serialized.
114
- * @return {string} String representation of the SubRequest.
113
+ * @param request - The sub request to be serialized.
114
+ * @returns String representation of the SubRequest.
115
115
  */
116
116
  function serializeSubRequest(request) {
117
117
  var requestBody = JSON.stringify(request.body);