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.
- package/README.md +7 -3
- package/lib/app/core.d.ts +188 -0
- package/lib/app/core.js +19 -0
- package/lib/app/credential-factory.d.ts +123 -0
- package/lib/app/credential-factory.js +150 -0
- package/lib/app/credential-internal.d.ts +90 -0
- package/lib/{credential → app}/credential-internal.js +15 -13
- package/lib/app/credential.d.ts +45 -0
- package/lib/app/credential.js +19 -0
- package/lib/app/firebase-app.d.ts +51 -0
- package/lib/{firebase-app.js → app/firebase-app.js} +26 -156
- package/lib/app/firebase-namespace.d.ts +163 -0
- package/lib/{firebase-namespace.js → app/firebase-namespace.js} +99 -111
- package/lib/app/index.d.ts +27 -0
- package/lib/app/index.js +31 -0
- package/lib/app/lifecycle.d.ts +60 -0
- package/lib/app/lifecycle.js +165 -0
- package/lib/app-check/app-check-api-client-internal.d.ts +32 -0
- package/lib/app-check/app-check-api-client-internal.js +10 -10
- package/lib/app-check/app-check-api.d.ts +95 -0
- package/lib/app-check/app-check-api.js +19 -0
- package/lib/app-check/app-check-namespace.d.ts +65 -0
- package/lib/app-check/app-check-namespace.js +18 -0
- package/lib/app-check/app-check.d.ts +49 -0
- package/lib/app-check/app-check.js +13 -10
- package/lib/app-check/index.d.ts +19 -126
- package/lib/app-check/index.js +45 -1
- package/lib/app-check/token-generator.d.ts +25 -0
- package/lib/app-check/token-generator.js +9 -9
- package/lib/app-check/token-verifier.d.ts +17 -0
- package/lib/app-check/token-verifier.js +6 -6
- package/lib/auth/action-code-settings-builder.d.ts +87 -0
- package/lib/auth/action-code-settings-builder.js +4 -2
- package/lib/auth/auth-api-request.d.ts +174 -0
- package/lib/auth/auth-api-request.js +197 -124
- package/lib/auth/auth-config.d.ts +575 -0
- package/lib/auth/auth-config.js +43 -34
- package/lib/auth/auth-namespace.d.ts +255 -0
- package/lib/auth/auth-namespace.js +18 -0
- package/lib/auth/auth.d.ts +40 -0
- package/lib/auth/auth.js +12 -772
- package/lib/auth/base-auth.d.ts +613 -0
- package/lib/auth/base-auth.js +951 -0
- package/lib/auth/identifier.d.ts +57 -0
- package/lib/auth/identifier.js +1 -1
- package/lib/auth/index.d.ts +25 -1897
- package/lib/auth/index.js +54 -1
- package/lib/auth/tenant-manager.d.ts +146 -0
- package/lib/auth/tenant-manager.js +151 -39
- package/lib/auth/tenant.d.ts +130 -0
- package/lib/auth/tenant.js +62 -16
- package/lib/auth/token-generator.d.ts +44 -0
- package/lib/auth/token-generator.js +11 -9
- package/lib/auth/token-verifier.d.ts +150 -0
- package/lib/auth/token-verifier.js +27 -15
- package/lib/auth/user-import-builder.d.ts +322 -0
- package/lib/auth/user-import-builder.js +9 -9
- package/lib/auth/user-record.d.ts +265 -0
- package/lib/auth/user-record.js +80 -45
- package/lib/credential/index.d.ts +24 -66
- package/lib/credential/index.js +101 -1
- package/lib/database/database-namespace.d.ts +95 -0
- package/lib/database/database-namespace.js +23 -0
- package/lib/database/database.d.ts +66 -0
- package/lib/database/{database-internal.js → database.js} +16 -9
- package/lib/database/index.d.ts +55 -54
- package/lib/database/index.js +84 -13
- package/lib/{firebase-namespace.d.ts → default-namespace.d.ts} +7 -14
- package/lib/default-namespace.js +4 -5
- package/lib/esm/app/index.js +10 -0
- package/lib/esm/app-check/index.js +4 -0
- package/lib/esm/auth/index.js +14 -0
- package/lib/esm/database/index.js +6 -0
- package/lib/esm/firestore/index.js +23 -0
- package/lib/esm/installations/index.js +4 -0
- package/lib/esm/instance-id/index.js +4 -0
- package/lib/esm/machine-learning/index.js +5 -0
- package/lib/esm/messaging/index.js +4 -0
- package/lib/esm/package.json +1 -0
- package/lib/esm/project-management/index.js +8 -0
- package/lib/esm/remote-config/index.js +4 -0
- package/lib/esm/security-rules/index.js +6 -0
- package/lib/esm/storage/index.js +4 -0
- package/lib/firebase-namespace-api.d.ts +34 -186
- package/lib/firebase-namespace-api.js +37 -2
- package/lib/firestore/firestore-internal.d.ts +32 -0
- package/lib/firestore/firestore-internal.js +3 -3
- package/lib/firestore/firestore-namespace.d.ts +50 -0
- package/lib/firestore/firestore-namespace.js +47 -0
- package/lib/firestore/index.d.ts +37 -35
- package/lib/firestore/index.js +61 -30
- package/lib/index.d.ts +2 -2
- package/lib/index.js +1 -1
- package/lib/installations/index.d.ts +34 -63
- package/lib/installations/index.js +45 -1
- package/lib/installations/installations-namespace.d.ts +55 -0
- package/lib/installations/installations-namespace.js +18 -0
- package/lib/installations/installations-request-handler.d.ts +43 -0
- package/lib/installations/installations-request-handler.js +4 -4
- package/lib/installations/installations.d.ts +38 -0
- package/lib/installations/installations.js +6 -5
- package/lib/instance-id/index.d.ts +23 -45
- package/lib/instance-id/index.js +54 -1
- package/lib/instance-id/instance-id-namespace.d.ts +38 -0
- package/lib/instance-id/instance-id-namespace.js +3 -0
- package/lib/instance-id/instance-id.d.ts +47 -0
- package/lib/instance-id/instance-id.js +14 -19
- package/lib/machine-learning/index.d.ts +19 -216
- package/lib/machine-learning/index.js +46 -1
- package/lib/machine-learning/machine-learning-api-client.d.ts +102 -0
- package/lib/machine-learning/machine-learning-api-client.js +6 -6
- package/lib/machine-learning/machine-learning-namespace.d.ts +85 -0
- package/lib/machine-learning/machine-learning-namespace.js +18 -0
- package/lib/machine-learning/machine-learning-utils.d.ts +22 -0
- package/lib/machine-learning/machine-learning-utils.js +1 -1
- package/lib/machine-learning/machine-learning.d.ts +181 -0
- package/lib/machine-learning/machine-learning.js +72 -37
- package/lib/messaging/batch-request-internal.d.ts +55 -0
- package/lib/messaging/batch-request-internal.js +9 -9
- package/lib/messaging/index.d.ts +18 -1140
- package/lib/messaging/index.js +45 -1
- package/lib/messaging/messaging-api-request-internal.d.ts +50 -0
- package/lib/messaging/messaging-api-request-internal.js +8 -8
- package/lib/messaging/messaging-api.d.ts +980 -0
- package/lib/messaging/messaging-api.js +19 -0
- package/lib/messaging/messaging-errors-internal.d.ts +31 -0
- package/lib/messaging/messaging-errors-internal.js +7 -7
- package/lib/messaging/messaging-internal.d.ts +27 -0
- package/lib/messaging/messaging-internal.js +2 -2
- package/lib/messaging/messaging-namespace.d.ts +181 -0
- package/lib/messaging/messaging-namespace.js +18 -0
- package/lib/messaging/messaging.d.ts +269 -0
- package/lib/messaging/messaging.js +83 -91
- package/lib/project-management/android-app.d.ts +110 -0
- package/lib/project-management/android-app.js +24 -15
- package/lib/project-management/app-metadata.d.ts +85 -0
- package/lib/project-management/app-metadata.js +37 -0
- package/lib/project-management/index.d.ts +21 -331
- package/lib/project-management/index.js +51 -24
- package/lib/project-management/ios-app.d.ts +66 -0
- package/lib/project-management/ios-app.js +15 -8
- package/lib/project-management/project-management-api-request-internal.d.ts +17 -0
- package/lib/project-management/project-management-api-request-internal.js +15 -15
- package/lib/project-management/project-management-namespace.d.ts +82 -0
- package/lib/project-management/project-management-namespace.js +18 -0
- package/lib/project-management/project-management.d.ts +115 -0
- package/lib/project-management/project-management.js +22 -25
- package/lib/remote-config/index.d.ts +19 -336
- package/lib/remote-config/index.js +45 -1
- package/lib/remote-config/remote-config-api-client-internal.d.ts +28 -0
- package/lib/remote-config/remote-config-api-client-internal.js +3 -3
- package/lib/remote-config/remote-config-api.d.ts +258 -0
- package/lib/remote-config/remote-config-api.js +18 -0
- package/lib/remote-config/remote-config-namespace.d.ts +105 -0
- package/lib/remote-config/remote-config-namespace.js +18 -0
- package/lib/remote-config/remote-config.d.ts +94 -0
- package/lib/remote-config/remote-config.js +27 -26
- package/lib/security-rules/index.d.ts +18 -184
- package/lib/security-rules/index.js +46 -1
- package/lib/security-rules/security-rules-api-client-internal.d.ts +73 -0
- package/lib/security-rules/security-rules-api-client-internal.js +1 -1
- package/lib/security-rules/security-rules-internal.d.ts +21 -0
- package/lib/security-rules/security-rules-internal.js +1 -1
- package/lib/security-rules/security-rules-namespace.d.ts +69 -0
- package/lib/security-rules/security-rules-namespace.js +18 -0
- package/lib/security-rules/security-rules.d.ts +196 -0
- package/lib/security-rules/security-rules.js +73 -55
- package/lib/storage/index.d.ts +16 -32
- package/lib/storage/index.js +38 -1
- package/lib/storage/storage-namespace.d.ts +45 -0
- package/lib/storage/storage-namespace.js +18 -0
- package/lib/storage/storage.d.ts +42 -0
- package/lib/storage/storage.js +9 -6
- package/lib/utils/api-request.d.ts +230 -0
- package/lib/utils/api-request.js +25 -25
- package/lib/utils/crypto-signer.d.ts +128 -0
- package/lib/utils/crypto-signer.js +9 -9
- package/lib/utils/deep-copy.d.ts +40 -0
- package/lib/utils/deep-copy.js +6 -6
- package/lib/utils/error.d.ts +650 -0
- package/lib/utils/error.js +34 -34
- package/lib/utils/index.d.ts +105 -0
- package/lib/utils/index.js +22 -21
- package/lib/utils/jwt.d.ts +131 -0
- package/lib/utils/jwt.js +11 -11
- package/lib/utils/validator.d.ts +144 -0
- package/lib/utils/validator.js +37 -37
- package/package.json +110 -8
- package/lib/credential/credential.js +0 -44
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v10.0.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2020 Google Inc.
|
|
@@ -17,30 +17,24 @@
|
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.InstanceId = void 0;
|
|
20
|
+
var installations_1 = require("../installations");
|
|
20
21
|
var error_1 = require("../utils/error");
|
|
21
22
|
var validator = require("../utils/validator");
|
|
22
23
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
24
|
+
* The `InstanceId` service enables deleting the Firebase instance IDs
|
|
25
|
+
* associated with Firebase client app instances.
|
|
25
26
|
*
|
|
26
|
-
* @
|
|
27
|
-
* ```javascript
|
|
28
|
-
* var instanceId = app.instanceId();
|
|
29
|
-
* // The above is shorthand for:
|
|
30
|
-
* // var instanceId = admin.instanceId(app);
|
|
31
|
-
* ```
|
|
32
|
-
*
|
|
33
|
-
* @return The `InstanceId` service for the
|
|
34
|
-
* current app.
|
|
27
|
+
* @deprecated Use {@link firebase-admin.installations#Installations} instead.
|
|
35
28
|
*/
|
|
36
29
|
var InstanceId = /** @class */ (function () {
|
|
37
30
|
/**
|
|
38
|
-
* @param app The app for this InstanceId service.
|
|
31
|
+
* @param app - The app for this InstanceId service.
|
|
39
32
|
* @constructor
|
|
33
|
+
* @internal
|
|
40
34
|
*/
|
|
41
35
|
function InstanceId(app) {
|
|
42
36
|
if (!validator.isNonNullObject(app) || !('options' in app)) {
|
|
43
|
-
throw new error_1.FirebaseInstanceIdError(error_1.InstanceIdClientErrorCode.INVALID_ARGUMENT, 'First argument passed to
|
|
37
|
+
throw new error_1.FirebaseInstanceIdError(error_1.InstanceIdClientErrorCode.INVALID_ARGUMENT, 'First argument passed to instanceId() must be a valid Firebase app instance.');
|
|
44
38
|
}
|
|
45
39
|
this.app_ = app;
|
|
46
40
|
}
|
|
@@ -50,15 +44,16 @@ var InstanceId = /** @class */ (function () {
|
|
|
50
44
|
* Note that Google Analytics for Firebase uses its own form of Instance ID to
|
|
51
45
|
* keep track of analytics data. Therefore deleting a Firebase Instance ID does
|
|
52
46
|
* not delete Analytics data. See
|
|
53
|
-
*
|
|
47
|
+
* {@link https://firebase.google.com/support/privacy/manage-iids#delete_an_instance_id |
|
|
48
|
+
* Delete an Instance ID}
|
|
54
49
|
* for more information.
|
|
55
50
|
*
|
|
56
|
-
* @param instanceId The instance ID to be deleted.
|
|
51
|
+
* @param instanceId - The instance ID to be deleted.
|
|
57
52
|
*
|
|
58
|
-
* @
|
|
53
|
+
* @returns A promise fulfilled when the instance ID is deleted.
|
|
59
54
|
*/
|
|
60
55
|
InstanceId.prototype.deleteInstanceId = function (instanceId) {
|
|
61
|
-
return this.app
|
|
56
|
+
return installations_1.getInstallations(this.app).deleteInstallation(instanceId)
|
|
62
57
|
.catch(function (err) {
|
|
63
58
|
if (err instanceof error_1.FirebaseInstallationsError) {
|
|
64
59
|
var code = err.code.replace('installations/', '');
|
|
@@ -74,7 +69,7 @@ var InstanceId = /** @class */ (function () {
|
|
|
74
69
|
/**
|
|
75
70
|
* Returns the app associated with this InstanceId instance.
|
|
76
71
|
*
|
|
77
|
-
* @
|
|
72
|
+
* @returns The app associated with this InstanceId instance.
|
|
78
73
|
*/
|
|
79
74
|
get: function () {
|
|
80
75
|
return this.app_;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v10.0.0 */
|
|
2
2
|
/*!
|
|
3
3
|
* Copyright 2020 Google Inc.
|
|
4
4
|
*
|
|
@@ -14,236 +14,39 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
import { app } from '../firebase-namespace-api';
|
|
18
17
|
/**
|
|
19
|
-
*
|
|
20
|
-
* default app or a given app.
|
|
18
|
+
* Firebase Machine Learning.
|
|
21
19
|
*
|
|
22
|
-
*
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
* @packageDocumentation
|
|
21
|
+
*/
|
|
22
|
+
import { App } from '../app';
|
|
23
|
+
import { MachineLearning } from './machine-learning';
|
|
24
|
+
export { MachineLearning, ListModelsResult, Model, TFLiteModel, } from './machine-learning';
|
|
25
|
+
export { AutoMLTfliteModelOptions, GcsTfliteModelOptions, ListModelsOptions, ModelOptions, ModelOptionsBase, } from './machine-learning-api-client';
|
|
26
|
+
/**
|
|
27
|
+
* Gets the {@link MachineLearning} service for the default app or a given app.
|
|
28
|
+
*
|
|
29
|
+
* `getMachineLearning()` can be called with no arguments to access the
|
|
30
|
+
* default app's `MachineLearning` service or as `getMachineLearning(app)` to access
|
|
31
|
+
* the `MachineLearning` service associated with a specific app.
|
|
27
32
|
*
|
|
28
33
|
* @example
|
|
29
34
|
* ```javascript
|
|
30
35
|
* // Get the MachineLearning service for the default app
|
|
31
|
-
*
|
|
36
|
+
* const defaultMachineLearning = getMachineLearning();
|
|
32
37
|
* ```
|
|
33
38
|
*
|
|
34
39
|
* @example
|
|
35
40
|
* ```javascript
|
|
36
41
|
* // Get the MachineLearning service for a given app
|
|
37
|
-
*
|
|
42
|
+
* const otherMachineLearning = getMachineLearning(otherApp);
|
|
38
43
|
* ```
|
|
39
44
|
*
|
|
40
|
-
* @param app Optional app whose `MachineLearning` service to
|
|
45
|
+
* @param app - Optional app whose `MachineLearning` service to
|
|
41
46
|
* return. If not provided, the default `MachineLearning` service
|
|
42
47
|
* will be returned.
|
|
43
48
|
*
|
|
44
|
-
* @
|
|
49
|
+
* @returns The default `MachineLearning` service if no app is provided or the
|
|
45
50
|
* `MachineLearning` service associated with the provided app.
|
|
46
51
|
*/
|
|
47
|
-
export declare function
|
|
48
|
-
export declare namespace machineLearning {
|
|
49
|
-
/**
|
|
50
|
-
* Firebase ML Model input objects
|
|
51
|
-
*/
|
|
52
|
-
interface ModelOptionsBase {
|
|
53
|
-
displayName?: string;
|
|
54
|
-
tags?: string[];
|
|
55
|
-
}
|
|
56
|
-
interface GcsTfliteModelOptions extends ModelOptionsBase {
|
|
57
|
-
tfliteModel: {
|
|
58
|
-
gcsTfliteUri: string;
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
interface AutoMLTfliteModelOptions extends ModelOptionsBase {
|
|
62
|
-
tfliteModel: {
|
|
63
|
-
automlModel: string;
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
type ModelOptions = ModelOptionsBase | GcsTfliteModelOptions | AutoMLTfliteModelOptions;
|
|
67
|
-
/**
|
|
68
|
-
* A TensorFlow Lite Model output object
|
|
69
|
-
*
|
|
70
|
-
* One of either the `gcsTfliteUri` or `automlModel` properties will be
|
|
71
|
-
* defined.
|
|
72
|
-
*/
|
|
73
|
-
interface TFLiteModel {
|
|
74
|
-
/** The size of the model. */
|
|
75
|
-
readonly sizeBytes: number;
|
|
76
|
-
/** The URI from which the model was originally provided to Firebase. */
|
|
77
|
-
readonly gcsTfliteUri?: string;
|
|
78
|
-
/**
|
|
79
|
-
* The AutoML model reference from which the model was originally provided
|
|
80
|
-
* to Firebase.
|
|
81
|
-
*/
|
|
82
|
-
readonly automlModel?: string;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* A Firebase ML Model output object
|
|
86
|
-
*/
|
|
87
|
-
interface Model {
|
|
88
|
-
/** The ID of the model. */
|
|
89
|
-
readonly modelId: string;
|
|
90
|
-
/**
|
|
91
|
-
* The model's name. This is the name you use from your app to load the
|
|
92
|
-
* model.
|
|
93
|
-
*/
|
|
94
|
-
readonly displayName: string;
|
|
95
|
-
/**
|
|
96
|
-
* The model's tags, which can be used to group or filter models in list
|
|
97
|
-
* operations.
|
|
98
|
-
*/
|
|
99
|
-
readonly tags?: string[];
|
|
100
|
-
/** The timestamp of the model's creation. */
|
|
101
|
-
readonly createTime: string;
|
|
102
|
-
/** The timestamp of the model's most recent update. */
|
|
103
|
-
readonly updateTime: string;
|
|
104
|
-
/** Error message when model validation fails. */
|
|
105
|
-
readonly validationError?: string;
|
|
106
|
-
/** True if the model is published. */
|
|
107
|
-
readonly published: boolean;
|
|
108
|
-
/**
|
|
109
|
-
* The ETag identifier of the current version of the model. This value
|
|
110
|
-
* changes whenever you update any of the model's properties.
|
|
111
|
-
*/
|
|
112
|
-
readonly etag: string;
|
|
113
|
-
/**
|
|
114
|
-
* The hash of the model's `tflite` file. This value changes only when
|
|
115
|
-
* you upload a new TensorFlow Lite model.
|
|
116
|
-
*/
|
|
117
|
-
readonly modelHash?: string;
|
|
118
|
-
/**
|
|
119
|
-
* True if the model is locked by a server-side operation. You can't make
|
|
120
|
-
* changes to a locked model. See {@link waitForUnlocked `waitForUnlocked()`}.
|
|
121
|
-
*/
|
|
122
|
-
readonly locked: boolean;
|
|
123
|
-
/**
|
|
124
|
-
* Wait for the model to be unlocked.
|
|
125
|
-
*
|
|
126
|
-
* @param {number} maxTimeMillis The maximum time in milliseconds to wait.
|
|
127
|
-
* If not specified, a default maximum of 2 minutes is used.
|
|
128
|
-
*
|
|
129
|
-
* @return {Promise<void>} A promise that resolves when the model is unlocked
|
|
130
|
-
* or the maximum wait time has passed.
|
|
131
|
-
*/
|
|
132
|
-
waitForUnlocked(maxTimeMillis?: number): Promise<void>;
|
|
133
|
-
/**
|
|
134
|
-
* Return the model as a JSON object.
|
|
135
|
-
*/
|
|
136
|
-
toJSON(): {
|
|
137
|
-
[key: string]: any;
|
|
138
|
-
};
|
|
139
|
-
/** Metadata about the model's TensorFlow Lite model file. */
|
|
140
|
-
readonly tfliteModel?: TFLiteModel;
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Interface representing options for listing Models.
|
|
144
|
-
*/
|
|
145
|
-
interface ListModelsOptions {
|
|
146
|
-
/**
|
|
147
|
-
* An expression that specifies how to filter the results.
|
|
148
|
-
*
|
|
149
|
-
* Examples:
|
|
150
|
-
*
|
|
151
|
-
* ```
|
|
152
|
-
* display_name = your_model
|
|
153
|
-
* display_name : experimental_*
|
|
154
|
-
* tags: face_detector AND tags: experimental
|
|
155
|
-
* state.published = true
|
|
156
|
-
* ```
|
|
157
|
-
*
|
|
158
|
-
* See https://firebase.google.com/docs/ml/manage-hosted-models#list_your_projects_models
|
|
159
|
-
*/
|
|
160
|
-
filter?: string;
|
|
161
|
-
/** The number of results to return in each page. */
|
|
162
|
-
pageSize?: number;
|
|
163
|
-
/** A token that specifies the result page to return. */
|
|
164
|
-
pageToken?: string;
|
|
165
|
-
}
|
|
166
|
-
/** Response object for a listModels operation. */
|
|
167
|
-
interface ListModelsResult {
|
|
168
|
-
/** A list of models in your project. */
|
|
169
|
-
readonly models: Model[];
|
|
170
|
-
/**
|
|
171
|
-
* A token you can use to retrieve the next page of results. If null, the
|
|
172
|
-
* current page is the final page.
|
|
173
|
-
*/
|
|
174
|
-
readonly pageToken?: string;
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* The Firebase `MachineLearning` service interface.
|
|
178
|
-
*
|
|
179
|
-
* Do not call this constructor directly. Instead, use
|
|
180
|
-
* [`admin.machineLearning()`](admin.machineLearning#machineLearning).
|
|
181
|
-
*/
|
|
182
|
-
interface MachineLearning {
|
|
183
|
-
/**
|
|
184
|
-
* The {@link app.App} associated with the current `MachineLearning`
|
|
185
|
-
* service instance.
|
|
186
|
-
*/
|
|
187
|
-
app: app.App;
|
|
188
|
-
/**
|
|
189
|
-
* Creates a model in the current Firebase project.
|
|
190
|
-
*
|
|
191
|
-
* @param {ModelOptions} model The model to create.
|
|
192
|
-
*
|
|
193
|
-
* @return {Promise<Model>} A Promise fulfilled with the created model.
|
|
194
|
-
*/
|
|
195
|
-
createModel(model: ModelOptions): Promise<Model>;
|
|
196
|
-
/**
|
|
197
|
-
* Updates a model's metadata or model file.
|
|
198
|
-
*
|
|
199
|
-
* @param {string} modelId The ID of the model to update.
|
|
200
|
-
* @param {ModelOptions} model The model fields to update.
|
|
201
|
-
*
|
|
202
|
-
* @return {Promise<Model>} A Promise fulfilled with the updated model.
|
|
203
|
-
*/
|
|
204
|
-
updateModel(modelId: string, model: ModelOptions): Promise<Model>;
|
|
205
|
-
/**
|
|
206
|
-
* Publishes a Firebase ML model.
|
|
207
|
-
*
|
|
208
|
-
* A published model can be downloaded to client apps.
|
|
209
|
-
*
|
|
210
|
-
* @param {string} modelId The ID of the model to publish.
|
|
211
|
-
*
|
|
212
|
-
* @return {Promise<Model>} A Promise fulfilled with the published model.
|
|
213
|
-
*/
|
|
214
|
-
publishModel(modelId: string): Promise<Model>;
|
|
215
|
-
/**
|
|
216
|
-
* Unpublishes a Firebase ML model.
|
|
217
|
-
*
|
|
218
|
-
* @param {string} modelId The ID of the model to unpublish.
|
|
219
|
-
*
|
|
220
|
-
* @return {Promise<Model>} A Promise fulfilled with the unpublished model.
|
|
221
|
-
*/
|
|
222
|
-
unpublishModel(modelId: string): Promise<Model>;
|
|
223
|
-
/**
|
|
224
|
-
* Gets the model specified by the given ID.
|
|
225
|
-
*
|
|
226
|
-
* @param {string} modelId The ID of the model to get.
|
|
227
|
-
*
|
|
228
|
-
* @return {Promise<Model>} A Promise fulfilled with the model object.
|
|
229
|
-
*/
|
|
230
|
-
getModel(modelId: string): Promise<Model>;
|
|
231
|
-
/**
|
|
232
|
-
* Lists the current project's models.
|
|
233
|
-
*
|
|
234
|
-
* @param {ListModelsOptions} options The listing options.
|
|
235
|
-
*
|
|
236
|
-
* @return {Promise<ListModelsResult>} A promise that
|
|
237
|
-
* resolves with the current (filtered) list of models and the next page
|
|
238
|
-
* token. For the last page, an empty list of models and no page token
|
|
239
|
-
* are returned.
|
|
240
|
-
*/
|
|
241
|
-
listModels(options?: ListModelsOptions): Promise<ListModelsResult>;
|
|
242
|
-
/**
|
|
243
|
-
* Deletes a model from the current project.
|
|
244
|
-
*
|
|
245
|
-
* @param {string} modelId The ID of the model to delete.
|
|
246
|
-
*/
|
|
247
|
-
deleteModel(modelId: string): Promise<void>;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
52
|
+
export declare function getMachineLearning(app?: App): MachineLearning;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v10.0.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2020 Google Inc.
|
|
@@ -16,3 +16,48 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.getMachineLearning = void 0;
|
|
20
|
+
/**
|
|
21
|
+
* Firebase Machine Learning.
|
|
22
|
+
*
|
|
23
|
+
* @packageDocumentation
|
|
24
|
+
*/
|
|
25
|
+
var app_1 = require("../app");
|
|
26
|
+
var machine_learning_1 = require("./machine-learning");
|
|
27
|
+
var machine_learning_2 = require("./machine-learning");
|
|
28
|
+
Object.defineProperty(exports, "MachineLearning", { enumerable: true, get: function () { return machine_learning_2.MachineLearning; } });
|
|
29
|
+
Object.defineProperty(exports, "Model", { enumerable: true, get: function () { return machine_learning_2.Model; } });
|
|
30
|
+
/**
|
|
31
|
+
* Gets the {@link MachineLearning} service for the default app or a given app.
|
|
32
|
+
*
|
|
33
|
+
* `getMachineLearning()` can be called with no arguments to access the
|
|
34
|
+
* default app's `MachineLearning` service or as `getMachineLearning(app)` to access
|
|
35
|
+
* the `MachineLearning` service associated with a specific app.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```javascript
|
|
39
|
+
* // Get the MachineLearning service for the default app
|
|
40
|
+
* const defaultMachineLearning = getMachineLearning();
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```javascript
|
|
45
|
+
* // Get the MachineLearning service for a given app
|
|
46
|
+
* const otherMachineLearning = getMachineLearning(otherApp);
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @param app - Optional app whose `MachineLearning` service to
|
|
50
|
+
* return. If not provided, the default `MachineLearning` service
|
|
51
|
+
* will be returned.
|
|
52
|
+
*
|
|
53
|
+
* @returns The default `MachineLearning` service if no app is provided or the
|
|
54
|
+
* `MachineLearning` service associated with the provided app.
|
|
55
|
+
*/
|
|
56
|
+
function getMachineLearning(app) {
|
|
57
|
+
if (typeof app === 'undefined') {
|
|
58
|
+
app = app_1.getApp();
|
|
59
|
+
}
|
|
60
|
+
var firebaseApp = app;
|
|
61
|
+
return firebaseApp.getOrInitService('machineLearning', function (app) { return new machine_learning_1.MachineLearning(app); });
|
|
62
|
+
}
|
|
63
|
+
exports.getMachineLearning = getMachineLearning;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/*! firebase-admin v10.0.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
|
+
/**
|
|
18
|
+
* Firebase ML Model input objects
|
|
19
|
+
*/
|
|
20
|
+
export interface ModelOptionsBase {
|
|
21
|
+
displayName?: string;
|
|
22
|
+
tags?: string[];
|
|
23
|
+
}
|
|
24
|
+
export interface GcsTfliteModelOptions extends ModelOptionsBase {
|
|
25
|
+
tfliteModel: {
|
|
26
|
+
gcsTfliteUri: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export interface AutoMLTfliteModelOptions extends ModelOptionsBase {
|
|
30
|
+
tfliteModel: {
|
|
31
|
+
automlModel: string;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export declare type ModelOptions = ModelOptionsBase | GcsTfliteModelOptions | AutoMLTfliteModelOptions;
|
|
35
|
+
/**
|
|
36
|
+
* Interface representing options for listing Models.
|
|
37
|
+
*/
|
|
38
|
+
export interface ListModelsOptions {
|
|
39
|
+
/**
|
|
40
|
+
* An expression that specifies how to filter the results.
|
|
41
|
+
*
|
|
42
|
+
* Examples:
|
|
43
|
+
*
|
|
44
|
+
* ```
|
|
45
|
+
* display_name = your_model
|
|
46
|
+
* display_name : experimental_*
|
|
47
|
+
* tags: face_detector AND tags: experimental
|
|
48
|
+
* state.published = true
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* See https://firebase.google.com/docs/ml/manage-hosted-models#list_your_projects_models
|
|
52
|
+
*/
|
|
53
|
+
filter?: string;
|
|
54
|
+
/** The number of results to return in each page. */
|
|
55
|
+
pageSize?: number;
|
|
56
|
+
/** A token that specifies the result page to return. */
|
|
57
|
+
pageToken?: string;
|
|
58
|
+
}
|
|
59
|
+
export interface StatusErrorResponse {
|
|
60
|
+
readonly code: number;
|
|
61
|
+
readonly message: string;
|
|
62
|
+
}
|
|
63
|
+
export declare type ModelUpdateOptions = ModelOptions & {
|
|
64
|
+
state?: {
|
|
65
|
+
published?: boolean;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
export declare function isGcsTfliteModelOptions(options: ModelOptions): options is GcsTfliteModelOptions;
|
|
69
|
+
export interface ModelContent {
|
|
70
|
+
readonly displayName?: string;
|
|
71
|
+
readonly tags?: string[];
|
|
72
|
+
readonly state?: {
|
|
73
|
+
readonly validationError?: StatusErrorResponse;
|
|
74
|
+
readonly published?: boolean;
|
|
75
|
+
};
|
|
76
|
+
readonly tfliteModel?: {
|
|
77
|
+
readonly gcsTfliteUri?: string;
|
|
78
|
+
readonly automlModel?: string;
|
|
79
|
+
readonly sizeBytes: number;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export interface ModelResponse extends ModelContent {
|
|
83
|
+
readonly name: string;
|
|
84
|
+
readonly createTime: string;
|
|
85
|
+
readonly updateTime: string;
|
|
86
|
+
readonly etag: string;
|
|
87
|
+
readonly modelHash?: string;
|
|
88
|
+
readonly activeOperations?: OperationResponse[];
|
|
89
|
+
}
|
|
90
|
+
export interface ListModelsResponse {
|
|
91
|
+
readonly models?: ModelResponse[];
|
|
92
|
+
readonly nextPageToken?: string;
|
|
93
|
+
}
|
|
94
|
+
export interface OperationResponse {
|
|
95
|
+
readonly name?: string;
|
|
96
|
+
readonly metadata?: {
|
|
97
|
+
[key: string]: any;
|
|
98
|
+
};
|
|
99
|
+
readonly done: boolean;
|
|
100
|
+
readonly error?: StatusErrorResponse;
|
|
101
|
+
readonly response?: ModelResponse;
|
|
102
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v10.0.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2020 Google Inc.
|
|
@@ -19,9 +19,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19
19
|
exports.MachineLearningApiClient = exports.isGcsTfliteModelOptions = void 0;
|
|
20
20
|
var api_request_1 = require("../utils/api-request");
|
|
21
21
|
var error_1 = require("../utils/error");
|
|
22
|
-
var machine_learning_utils_1 = require("./machine-learning-utils");
|
|
23
22
|
var utils = require("../utils/index");
|
|
24
23
|
var validator = require("../utils/validator");
|
|
24
|
+
var machine_learning_utils_1 = require("./machine-learning-utils");
|
|
25
25
|
var ML_V1BETA2_API = 'https://firebaseml.googleapis.com/v1beta2';
|
|
26
26
|
var FIREBASE_VERSION_HEADER = {
|
|
27
27
|
'X-Firebase-Client': "fire-admin-node/" + utils.getSdkVersion(),
|
|
@@ -39,7 +39,7 @@ exports.isGcsTfliteModelOptions = isGcsTfliteModelOptions;
|
|
|
39
39
|
/**
|
|
40
40
|
* Class that facilitates sending requests to the Firebase ML backend API.
|
|
41
41
|
*
|
|
42
|
-
* @
|
|
42
|
+
* @internal
|
|
43
43
|
*/
|
|
44
44
|
var MachineLearningApiClient = /** @class */ (function () {
|
|
45
45
|
function MachineLearningApiClient(app) {
|
|
@@ -152,8 +152,8 @@ var MachineLearningApiClient = /** @class */ (function () {
|
|
|
152
152
|
/**
|
|
153
153
|
* Handles a Long Running Operation coming back from the server.
|
|
154
154
|
*
|
|
155
|
-
* @param op The operation to handle
|
|
156
|
-
* @param options The options for polling
|
|
155
|
+
* @param op - The operation to handle
|
|
156
|
+
* @param options - The options for polling
|
|
157
157
|
*/
|
|
158
158
|
MachineLearningApiClient.prototype.handleOperation = function (op, options) {
|
|
159
159
|
if (op.done) {
|
|
@@ -221,7 +221,7 @@ var MachineLearningApiClient = /** @class */ (function () {
|
|
|
221
221
|
/**
|
|
222
222
|
* Gets the specified resource from the ML API. Resource names must be the full names including project
|
|
223
223
|
* number prefix.
|
|
224
|
-
* @param fullName Full resource name of the resource to get. e.g. projects/123465/operations/987654
|
|
224
|
+
* @param fullName - Full resource name of the resource to get. e.g. projects/123465/operations/987654
|
|
225
225
|
* @returns {Promise<T>} A promise that fulfulls with the resource.
|
|
226
226
|
*/
|
|
227
227
|
MachineLearningApiClient.prototype.getResourceWithFullName = function (fullName) {
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/*! firebase-admin v10.0.0 */
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright 2021 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 { ListModelsResult as TListModelsResult, MachineLearning as TMachineLearning, Model as TModel, TFLiteModel as TTFLiteModel } from './machine-learning';
|
|
19
|
+
import { AutoMLTfliteModelOptions as TAutoMLTfliteModelOptions, GcsTfliteModelOptions as TGcsTfliteModelOptions, ListModelsOptions as TListModelsOptions, ModelOptions as TModelOptions, ModelOptionsBase as TModelOptionsBase } from './machine-learning-api-client';
|
|
20
|
+
/**
|
|
21
|
+
* Gets the {@link firebase-admin.machine-learning#MachineLearning} service for the
|
|
22
|
+
* default app or a given app.
|
|
23
|
+
*
|
|
24
|
+
* `admin.machineLearning()` can be called with no arguments to access the
|
|
25
|
+
* default app's `MachineLearning` service or as `admin.machineLearning(app)` to access
|
|
26
|
+
* the `MachineLearning` service associated with a specific app.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```javascript
|
|
30
|
+
* // Get the MachineLearning service for the default app
|
|
31
|
+
* var defaultMachineLearning = admin.machineLearning();
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```javascript
|
|
36
|
+
* // Get the MachineLearning service for a given app
|
|
37
|
+
* var otherMachineLearning = admin.machineLearning(otherApp);
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @param app - Optional app whose `MachineLearning` service to
|
|
41
|
+
* return. If not provided, the default `MachineLearning` service
|
|
42
|
+
* will be returned.
|
|
43
|
+
*
|
|
44
|
+
* @returns The default `MachineLearning` service if no app is provided or the
|
|
45
|
+
* `MachineLearning` service associated with the provided app.
|
|
46
|
+
*/
|
|
47
|
+
export declare function machineLearning(app?: App): machineLearning.MachineLearning;
|
|
48
|
+
export declare namespace machineLearning {
|
|
49
|
+
/**
|
|
50
|
+
* Type alias to {@link firebase-admin.machine-learning#ListModelsResult}.
|
|
51
|
+
*/
|
|
52
|
+
type ListModelsResult = TListModelsResult;
|
|
53
|
+
/**
|
|
54
|
+
* Type alias to {@link firebase-admin.machine-learning#MachineLearning}.
|
|
55
|
+
*/
|
|
56
|
+
type MachineLearning = TMachineLearning;
|
|
57
|
+
/**
|
|
58
|
+
* Type alias to {@link firebase-admin.machine-learning#Model}.
|
|
59
|
+
*/
|
|
60
|
+
type Model = TModel;
|
|
61
|
+
/**
|
|
62
|
+
* Type alias to {@link firebase-admin.machine-learning#TFLiteModel}.
|
|
63
|
+
*/
|
|
64
|
+
type TFLiteModel = TTFLiteModel;
|
|
65
|
+
/**
|
|
66
|
+
* Type alias to {@link firebase-admin.machine-learning#AutoMLTfliteModelOptions}.
|
|
67
|
+
*/
|
|
68
|
+
type AutoMLTfliteModelOptions = TAutoMLTfliteModelOptions;
|
|
69
|
+
/**
|
|
70
|
+
* Type alias to {@link firebase-admin.machine-learning#GcsTfliteModelOptions}.
|
|
71
|
+
*/
|
|
72
|
+
type GcsTfliteModelOptions = TGcsTfliteModelOptions;
|
|
73
|
+
/**
|
|
74
|
+
* Type alias to {@link firebase-admin.machine-learning#ListModelsOptions}.
|
|
75
|
+
*/
|
|
76
|
+
type ListModelsOptions = TListModelsOptions;
|
|
77
|
+
/**
|
|
78
|
+
* Type alias to {@link firebase-admin.machine-learning#ModelOptions}.
|
|
79
|
+
*/
|
|
80
|
+
type ModelOptions = TModelOptions;
|
|
81
|
+
/**
|
|
82
|
+
* Type alias to {@link firebase-admin.machine-learning#ModelOptionsBase}.
|
|
83
|
+
*/
|
|
84
|
+
type ModelOptionsBase = TModelOptionsBase;
|
|
85
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*! firebase-admin v10.0.0 */
|
|
2
|
+
"use strict";
|
|
3
|
+
/*!
|
|
4
|
+
* Copyright 2021 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 });
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*! firebase-admin v10.0.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 { PrefixedFirebaseError } from '../utils/error';
|
|
18
|
+
export declare type MachineLearningErrorCode = 'already-exists' | 'authentication-error' | 'internal-error' | 'invalid-argument' | 'invalid-server-response' | 'not-found' | 'resource-exhausted' | 'service-unavailable' | 'unknown-error' | 'cancelled' | 'deadline-exceeded' | 'permission-denied' | 'failed-precondition' | 'aborted' | 'out-of-range' | 'data-loss' | 'unauthenticated';
|
|
19
|
+
export declare class FirebaseMachineLearningError extends PrefixedFirebaseError {
|
|
20
|
+
static fromOperationError(code: number, message: string): FirebaseMachineLearningError;
|
|
21
|
+
constructor(code: MachineLearningErrorCode, message: string);
|
|
22
|
+
}
|