firebase-admin 13.9.0 → 14.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 +1 -2
- package/lib/app/core.d.ts +2 -38
- package/lib/app/core.js +1 -1
- package/lib/app/credential-factory.d.ts +1 -1
- package/lib/app/credential-factory.js +1 -1
- package/lib/app/credential-internal.d.ts +1 -1
- package/lib/app/credential-internal.js +48 -17
- package/lib/app/credential.d.ts +1 -1
- package/lib/app/credential.js +1 -1
- package/lib/app/error.d.ts +47 -0
- package/lib/app/error.js +57 -0
- package/lib/app/firebase-app.d.ts +1 -1
- package/lib/app/firebase-app.js +28 -12
- package/lib/app/index.d.ts +4 -3
- package/lib/app/index.js +6 -4
- package/lib/app/lifecycle.d.ts +2 -2
- package/lib/app/lifecycle.js +46 -21
- package/lib/app-check/app-check-api-client-internal.d.ts +2 -16
- package/lib/app-check/app-check-api-client-internal.js +71 -47
- package/lib/app-check/app-check-api.d.ts +19 -1
- package/lib/app-check/app-check-api.js +1 -1
- package/lib/app-check/app-check.d.ts +1 -1
- package/lib/app-check/app-check.js +7 -3
- package/lib/app-check/error.d.ts +47 -0
- package/lib/app-check/error.js +65 -0
- package/lib/app-check/index.d.ts +2 -1
- package/lib/app-check/index.js +5 -2
- package/lib/app-check/token-generator.d.ts +1 -1
- package/lib/app-check/token-generator.js +43 -13
- package/lib/app-check/token-verifier.d.ts +1 -1
- package/lib/app-check/token-verifier.js +39 -11
- package/lib/auth/action-code-settings-builder.d.ts +1 -1
- package/lib/auth/action-code-settings-builder.js +16 -16
- package/lib/auth/auth-api-request.d.ts +6 -4
- package/lib/auth/auth-api-request.js +277 -166
- package/lib/auth/auth-config.d.ts +31 -2
- package/lib/auth/auth-config.js +103 -103
- package/lib/auth/auth.d.ts +1 -1
- package/lib/auth/auth.js +1 -1
- package/lib/auth/base-auth.d.ts +2 -1
- package/lib/auth/base-auth.js +29 -27
- package/lib/auth/error.d.ts +137 -0
- package/lib/auth/error.js +690 -0
- package/lib/auth/identifier.d.ts +1 -1
- package/lib/auth/identifier.js +1 -1
- package/lib/auth/index.d.ts +2 -2
- package/lib/auth/index.js +4 -4
- package/lib/auth/project-config-manager.d.ts +1 -1
- package/lib/auth/project-config-manager.js +1 -1
- package/lib/auth/project-config.d.ts +1 -1
- package/lib/auth/project-config.js +4 -4
- package/lib/auth/tenant-manager.d.ts +2 -1
- package/lib/auth/tenant-manager.js +13 -10
- package/lib/auth/tenant.d.ts +1 -1
- package/lib/auth/tenant.js +7 -7
- package/lib/auth/token-generator.d.ts +1 -1
- package/lib/auth/token-generator.js +13 -13
- package/lib/auth/token-verifier.d.ts +1 -1
- package/lib/auth/token-verifier.js +22 -22
- package/lib/auth/user-import-builder.d.ts +1 -1
- package/lib/auth/user-import-builder.js +22 -22
- package/lib/auth/user-record.d.ts +1 -1
- package/lib/auth/user-record.js +6 -6
- package/lib/credential/index.d.ts +1 -1
- package/lib/credential/index.js +1 -1
- package/lib/data-connect/data-connect-api-client-internal.d.ts +1 -16
- package/lib/data-connect/data-connect-api-client-internal.js +122 -65
- package/lib/data-connect/data-connect-api.d.ts +1 -1
- package/lib/data-connect/data-connect-api.js +1 -1
- package/lib/data-connect/data-connect.d.ts +1 -1
- package/lib/data-connect/data-connect.js +1 -1
- package/lib/data-connect/error.d.ts +47 -0
- package/lib/data-connect/error.js +66 -0
- package/lib/data-connect/index.d.ts +2 -1
- package/lib/data-connect/index.js +5 -2
- package/lib/data-connect/validate-admin-args.d.ts +1 -1
- package/lib/data-connect/validate-admin-args.js +6 -3
- package/lib/database/database.d.ts +1 -1
- package/lib/database/database.js +11 -6
- package/lib/database/error.d.ts +39 -0
- package/lib/database/error.js +49 -0
- package/lib/database/index.d.ts +2 -2
- package/lib/database/index.js +4 -3
- package/lib/esm/app/index.js +2 -1
- package/lib/esm/app-check/index.js +2 -0
- package/lib/esm/auth/index.js +1 -1
- package/lib/esm/data-connect/index.js +2 -0
- package/lib/esm/database/index.js +1 -0
- package/lib/esm/eventarc/index.js +2 -0
- package/lib/esm/extensions/index.js +2 -0
- package/lib/esm/firebase-admin/index.js +13 -0
- package/lib/esm/firestore/index.js +1 -0
- package/lib/esm/functions/index.js +2 -0
- package/lib/esm/installations/index.js +1 -1
- package/lib/esm/machine-learning/index.js +2 -0
- package/lib/esm/messaging/index.js +1 -1
- package/lib/esm/phone-number-verification/index.js +2 -0
- package/lib/esm/project-management/index.js +1 -0
- package/lib/esm/remote-config/index.js +2 -0
- package/lib/esm/security-rules/index.js +2 -0
- package/lib/esm/storage/index.js +2 -0
- package/lib/eventarc/cloudevent.d.ts +1 -1
- package/lib/eventarc/cloudevent.js +1 -1
- package/lib/eventarc/error.d.ts +38 -0
- package/lib/eventarc/error.js +47 -0
- package/lib/eventarc/eventarc-client-internal.d.ts +1 -1
- package/lib/eventarc/eventarc-client-internal.js +24 -9
- package/lib/eventarc/eventarc-utils.d.ts +1 -13
- package/lib/eventarc/eventarc-utils.js +36 -26
- package/lib/eventarc/eventarc.d.ts +1 -1
- package/lib/eventarc/eventarc.js +18 -6
- package/lib/eventarc/index.d.ts +2 -1
- package/lib/eventarc/index.js +5 -2
- package/lib/extensions/error.d.ts +41 -0
- package/lib/extensions/error.js +50 -0
- package/lib/extensions/extensions-api-client-internal.d.ts +1 -13
- package/lib/extensions/extensions-api-client-internal.js +40 -28
- package/lib/extensions/extensions-api.d.ts +1 -1
- package/lib/extensions/extensions-api.js +1 -1
- package/lib/extensions/extensions.d.ts +1 -1
- package/lib/extensions/extensions.js +18 -5
- package/lib/extensions/index.d.ts +2 -1
- package/lib/extensions/index.js +5 -2
- package/lib/firestore/error.d.ts +41 -0
- package/lib/firestore/error.js +51 -0
- package/lib/firestore/firestore-internal.d.ts +2 -1
- package/lib/firestore/firestore-internal.js +6 -6
- package/lib/firestore/index.d.ts +2 -2
- package/lib/firestore/index.js +7 -7
- package/lib/functions/error.d.ts +48 -0
- package/lib/functions/error.js +67 -0
- package/lib/functions/functions-api-client-internal.d.ts +1 -16
- package/lib/functions/functions-api-client-internal.js +111 -71
- package/lib/functions/functions-api.d.ts +1 -1
- package/lib/functions/functions-api.js +1 -1
- package/lib/functions/functions.d.ts +1 -1
- package/lib/functions/functions.js +14 -4
- package/lib/functions/index.d.ts +2 -1
- package/lib/functions/index.js +5 -2
- package/lib/index.d.ts +13 -8
- package/lib/index.js +19 -3
- package/lib/installations/error.d.ts +48 -0
- package/lib/installations/error.js +73 -0
- package/lib/installations/index.d.ts +2 -2
- package/lib/installations/index.js +4 -4
- package/lib/installations/installations-request-handler.d.ts +1 -1
- package/lib/installations/installations-request-handler.js +11 -5
- package/lib/installations/installations.d.ts +1 -1
- package/lib/installations/installations.js +3 -3
- package/lib/machine-learning/error.d.ts +53 -0
- package/lib/machine-learning/error.js +84 -0
- package/lib/machine-learning/index.d.ts +2 -1
- package/lib/machine-learning/index.js +5 -2
- package/lib/machine-learning/machine-learning-api-client.d.ts +1 -1
- package/lib/machine-learning/machine-learning-api-client.js +61 -24
- package/lib/machine-learning/machine-learning.d.ts +1 -1
- package/lib/machine-learning/machine-learning.js +21 -9
- package/lib/messaging/error.d.ts +63 -0
- package/lib/messaging/error.js +286 -0
- package/lib/messaging/index.d.ts +3 -3
- package/lib/messaging/index.js +4 -4
- package/lib/messaging/messaging-api-request-internal.d.ts +1 -1
- package/lib/messaging/messaging-api-request-internal.js +1 -1
- package/lib/messaging/messaging-api.d.ts +1 -280
- package/lib/messaging/messaging-api.js +1 -1
- package/lib/messaging/messaging-errors-internal.d.ts +2 -2
- package/lib/messaging/messaging-errors-internal.js +11 -8
- package/lib/messaging/messaging-internal.d.ts +1 -1
- package/lib/messaging/messaging-internal.js +48 -48
- package/lib/messaging/messaging.d.ts +1 -1
- package/lib/messaging/messaging.js +47 -50
- package/lib/phone-number-verification/error.d.ts +43 -0
- package/lib/phone-number-verification/error.js +48 -0
- package/lib/phone-number-verification/index.d.ts +2 -1
- package/lib/phone-number-verification/index.js +5 -2
- package/lib/phone-number-verification/phone-number-verification-api-client-internal.d.ts +1 -18
- package/lib/phone-number-verification/phone-number-verification-api-client-internal.js +2 -26
- package/lib/phone-number-verification/phone-number-verification-api.d.ts +2 -2
- package/lib/phone-number-verification/phone-number-verification-api.js +5 -4
- package/lib/phone-number-verification/phone-number-verification.d.ts +1 -1
- package/lib/phone-number-verification/phone-number-verification.js +1 -1
- package/lib/phone-number-verification/token-verifier.d.ts +1 -1
- package/lib/phone-number-verification/token-verifier.js +68 -20
- package/lib/project-management/android-app.d.ts +1 -1
- package/lib/project-management/android-app.js +15 -6
- package/lib/project-management/app-metadata.d.ts +1 -1
- package/lib/project-management/app-metadata.js +1 -1
- package/lib/project-management/error.d.ts +45 -0
- package/lib/project-management/error.js +55 -0
- package/lib/project-management/index.d.ts +2 -2
- package/lib/project-management/index.js +4 -3
- package/lib/project-management/ios-app.d.ts +1 -1
- package/lib/project-management/ios-app.js +6 -3
- package/lib/project-management/project-management-api-request-internal.d.ts +1 -1
- package/lib/project-management/project-management-api-request-internal.js +18 -6
- package/lib/project-management/project-management.d.ts +1 -1
- package/lib/project-management/project-management.js +13 -7
- package/lib/remote-config/condition-evaluator-internal.d.ts +1 -1
- package/lib/remote-config/condition-evaluator-internal.js +4 -4
- package/lib/remote-config/error.d.ts +49 -0
- package/lib/remote-config/error.js +70 -0
- package/lib/remote-config/index.d.ts +2 -1
- package/lib/remote-config/index.js +5 -2
- package/lib/remote-config/internal/value-impl.d.ts +1 -1
- package/lib/remote-config/internal/value-impl.js +1 -1
- package/lib/remote-config/remote-config-api-client-internal.d.ts +2 -13
- package/lib/remote-config/remote-config-api-client-internal.js +80 -52
- package/lib/remote-config/remote-config-api.d.ts +1 -1
- package/lib/remote-config/remote-config-api.js +1 -1
- package/lib/remote-config/remote-config.d.ts +1 -1
- package/lib/remote-config/remote-config.js +92 -23
- package/lib/security-rules/error.d.ts +45 -0
- package/lib/security-rules/error.js +54 -0
- package/lib/security-rules/index.d.ts +2 -1
- package/lib/security-rules/index.js +5 -2
- package/lib/security-rules/security-rules-api-client-internal.d.ts +1 -1
- package/lib/security-rules/security-rules-api-client-internal.js +50 -18
- package/lib/security-rules/security-rules.d.ts +1 -1
- package/lib/security-rules/security-rules.js +32 -11
- package/lib/storage/error.d.ts +41 -0
- package/lib/storage/error.js +50 -0
- package/lib/storage/index.d.ts +2 -1
- package/lib/storage/index.js +8 -5
- package/lib/storage/storage.d.ts +1 -1
- package/lib/storage/storage.js +12 -12
- package/lib/storage/utils.d.ts +1 -1
- package/lib/storage/utils.js +1 -1
- package/lib/utils/api-request.d.ts +12 -12
- package/lib/utils/api-request.js +97 -55
- package/lib/utils/crypto-signer.d.ts +1 -1
- package/lib/utils/crypto-signer.js +2 -7
- package/lib/utils/deep-copy.d.ts +1 -1
- package/lib/utils/deep-copy.js +1 -1
- package/lib/utils/error.d.ts +75 -570
- package/lib/utils/error.js +53 -1047
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +2 -2
- package/lib/utils/jwt.d.ts +1 -1
- package/lib/utils/jwt.js +1 -2
- package/lib/utils/validator.d.ts +1 -1
- package/lib/utils/validator.js +1 -1
- package/package.json +25 -33
- package/lib/app/firebase-namespace.d.ts +0 -163
- package/lib/app/firebase-namespace.js +0 -335
- package/lib/app-check/app-check-namespace.d.ts +0 -72
- package/lib/app-check/app-check-namespace.js +0 -18
- package/lib/auth/auth-namespace.d.ts +0 -257
- package/lib/auth/auth-namespace.js +0 -18
- package/lib/database/database-namespace.d.ts +0 -95
- package/lib/database/database-namespace.js +0 -23
- package/lib/default-namespace.d.ts +0 -24
- package/lib/default-namespace.js +0 -30
- package/lib/esm/instance-id/index.js +0 -6
- package/lib/firebase-namespace-api.d.ts +0 -91
- package/lib/firebase-namespace-api.js +0 -58
- package/lib/firestore/firestore-namespace.d.ts +0 -71
- package/lib/firestore/firestore-namespace.js +0 -52
- package/lib/installations/installations-namespace.d.ts +0 -55
- package/lib/installations/installations-namespace.js +0 -18
- package/lib/instance-id/index.d.ts +0 -62
- package/lib/instance-id/index.js +0 -74
- package/lib/instance-id/instance-id-namespace.d.ts +0 -38
- package/lib/instance-id/instance-id-namespace.js +0 -3
- package/lib/instance-id/instance-id.d.ts +0 -47
- package/lib/instance-id/instance-id.js +0 -77
- package/lib/machine-learning/machine-learning-namespace.d.ts +0 -81
- package/lib/machine-learning/machine-learning-namespace.js +0 -18
- package/lib/machine-learning/machine-learning-utils.d.ts +0 -22
- package/lib/machine-learning/machine-learning-utils.js +0 -47
- package/lib/messaging/messaging-namespace.d.ts +0 -161
- package/lib/messaging/messaging-namespace.js +0 -18
- package/lib/project-management/project-management-namespace.d.ts +0 -82
- package/lib/project-management/project-management-namespace.js +0 -18
- package/lib/remote-config/remote-config-namespace.d.ts +0 -141
- package/lib/remote-config/remote-config-namespace.js +0 -18
- package/lib/security-rules/security-rules-internal.d.ts +0 -21
- package/lib/security-rules/security-rules-internal.js +0 -26
- package/lib/security-rules/security-rules-namespace.d.ts +0 -69
- package/lib/security-rules/security-rules-namespace.js +0 -18
- package/lib/storage/storage-namespace.d.ts +0 -45
- package/lib/storage/storage-namespace.js +0 -18
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v14.0.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2021 Google LLC
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.
|
|
19
|
+
exports.InstallationsErrorCode = exports.FirebaseInstallationsError = exports.Installations = void 0;
|
|
20
20
|
exports.getInstallations = getInstallations;
|
|
21
21
|
/**
|
|
22
22
|
* Firebase Instance ID service.
|
|
@@ -60,6 +60,6 @@ function getInstallations(app) {
|
|
|
60
60
|
const firebaseApp = app;
|
|
61
61
|
return firebaseApp.getOrInitService('installations', (app) => new installations_1.Installations(app));
|
|
62
62
|
}
|
|
63
|
-
var error_1 = require("
|
|
63
|
+
var error_1 = require("./error");
|
|
64
64
|
Object.defineProperty(exports, "FirebaseInstallationsError", { enumerable: true, get: function () { return error_1.FirebaseInstallationsError; } });
|
|
65
|
-
Object.defineProperty(exports, "
|
|
65
|
+
Object.defineProperty(exports, "InstallationsErrorCode", { enumerable: true, get: function () { return error_1.InstallationsErrorCode; } });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v14.0.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* @license
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
*/
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
20
|
exports.FirebaseInstallationsRequestHandler = void 0;
|
|
21
|
-
const error_1 = require("
|
|
21
|
+
const error_1 = require("./error");
|
|
22
|
+
const error_2 = require("../utils/error");
|
|
22
23
|
const api_request_1 = require("../utils/api-request");
|
|
23
24
|
const utils = require("../utils/index");
|
|
24
25
|
const validator = require("../utils/validator");
|
|
@@ -56,7 +57,7 @@ class FirebaseInstallationsRequestHandler {
|
|
|
56
57
|
}
|
|
57
58
|
deleteInstallation(fid) {
|
|
58
59
|
if (!validator.isNonEmptyString(fid)) {
|
|
59
|
-
return Promise.reject(new error_1.FirebaseInstallationsError(error_1.
|
|
60
|
+
return Promise.reject(new error_1.FirebaseInstallationsError(error_1.installationsClientErrorCode.INVALID_INSTALLATION_ID, 'Installation ID must be a non-empty string.'));
|
|
60
61
|
}
|
|
61
62
|
return this.invokeRequestHandler(new api_request_1.ApiSettings(fid, 'DELETE'));
|
|
62
63
|
}
|
|
@@ -87,7 +88,12 @@ class FirebaseInstallationsRequestHandler {
|
|
|
87
88
|
const template = ERROR_CODES[response.status];
|
|
88
89
|
const message = template ?
|
|
89
90
|
`Installation ID "${apiSettings.getEndpoint()}": ${template}` : errorMessage;
|
|
90
|
-
throw new error_1.FirebaseInstallationsError(
|
|
91
|
+
throw new error_1.FirebaseInstallationsError({
|
|
92
|
+
...error_1.installationsClientErrorCode.API_ERROR,
|
|
93
|
+
message,
|
|
94
|
+
httpResponse: (0, error_2.toHttpResponse)(response),
|
|
95
|
+
cause: err,
|
|
96
|
+
});
|
|
91
97
|
}
|
|
92
98
|
// In case of timeouts and other network errors, the HttpClient returns a
|
|
93
99
|
// FirebaseError wrapped in the response. Simply throw it here.
|
|
@@ -102,7 +108,7 @@ class FirebaseInstallationsRequestHandler {
|
|
|
102
108
|
.then((projectId) => {
|
|
103
109
|
if (!validator.isNonEmptyString(projectId)) {
|
|
104
110
|
// Assert for an explicit projct ID (either via AppOptions or the cert itself).
|
|
105
|
-
throw new error_1.FirebaseInstallationsError(error_1.
|
|
111
|
+
throw new error_1.FirebaseInstallationsError(error_1.installationsClientErrorCode.INVALID_PROJECT_ID, 'Failed to determine project ID for Installations. Initialize the '
|
|
106
112
|
+ 'SDK with service account credentials or set project ID as an app option. '
|
|
107
113
|
+ 'Alternatively set the GOOGLE_CLOUD_PROJECT environment variable.');
|
|
108
114
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v14.0.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2021 Google LLC
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.Installations = void 0;
|
|
20
|
-
const error_1 = require("
|
|
20
|
+
const error_1 = require("./error");
|
|
21
21
|
const installations_request_handler_1 = require("./installations-request-handler");
|
|
22
22
|
const validator = require("../utils/validator");
|
|
23
23
|
/**
|
|
@@ -31,7 +31,7 @@ class Installations {
|
|
|
31
31
|
*/
|
|
32
32
|
constructor(app) {
|
|
33
33
|
if (!validator.isNonNullObject(app) || !('options' in app)) {
|
|
34
|
-
throw new error_1.FirebaseInstallationsError(error_1.
|
|
34
|
+
throw new error_1.FirebaseInstallationsError(error_1.installationsClientErrorCode.INVALID_ARGUMENT, 'First argument passed to admin.installations() must be a valid Firebase app instance.');
|
|
35
35
|
}
|
|
36
36
|
this.app_ = app;
|
|
37
37
|
this.requestHandler = new installations_request_handler_1.FirebaseInstallationsRequestHandler(app);
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*! firebase-admin v14.0.0 */
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright 2020 Google LLC
|
|
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 { FirebaseError, ErrorInfo } from '../utils/error';
|
|
18
|
+
/**
|
|
19
|
+
* The constant mapping for valid Machine Learning client error codes.
|
|
20
|
+
*/
|
|
21
|
+
export declare const MachineLearningErrorCode: {
|
|
22
|
+
readonly ALREADY_EXISTS: "already-exists";
|
|
23
|
+
readonly AUTHENTICATION_ERROR: "authentication-error";
|
|
24
|
+
readonly INTERNAL_ERROR: "internal-error";
|
|
25
|
+
readonly INVALID_ARGUMENT: "invalid-argument";
|
|
26
|
+
readonly INVALID_SERVER_RESPONSE: "invalid-server-response";
|
|
27
|
+
readonly NOT_FOUND: "not-found";
|
|
28
|
+
readonly RESOURCE_EXHAUSTED: "resource-exhausted";
|
|
29
|
+
readonly SERVICE_UNAVAILABLE: "service-unavailable";
|
|
30
|
+
readonly UNKNOWN_ERROR: "unknown-error";
|
|
31
|
+
readonly CANCELLED: "cancelled";
|
|
32
|
+
readonly DEADLINE_EXCEEDED: "deadline-exceeded";
|
|
33
|
+
readonly PERMISSION_DENIED: "permission-denied";
|
|
34
|
+
readonly FAILED_PRECONDITION: "failed-precondition";
|
|
35
|
+
readonly ABORTED: "aborted";
|
|
36
|
+
readonly OUT_OF_RANGE: "out-of-range";
|
|
37
|
+
readonly DATA_LOSS: "data-loss";
|
|
38
|
+
readonly UNAUTHENTICATED: "unauthenticated";
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* The type definition for valid Machine Learning client error codes.
|
|
42
|
+
*/
|
|
43
|
+
export type MachineLearningErrorCode = typeof MachineLearningErrorCode[keyof typeof MachineLearningErrorCode];
|
|
44
|
+
/**
|
|
45
|
+
* Firebase Machine Learning error code structure. This extends `FirebaseError`.
|
|
46
|
+
*/
|
|
47
|
+
export declare class FirebaseMachineLearningError extends FirebaseError {
|
|
48
|
+
/**
|
|
49
|
+
* @param info - The error code info.
|
|
50
|
+
* @param message - The error message. If provided, this will override the default message.
|
|
51
|
+
*/
|
|
52
|
+
constructor(info: ErrorInfo, message?: string);
|
|
53
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/*! firebase-admin v14.0.0 */
|
|
2
|
+
"use strict";
|
|
3
|
+
/*!
|
|
4
|
+
* Copyright 2020 Google LLC
|
|
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 });
|
|
19
|
+
exports.FirebaseMachineLearningError = exports.MachineLearningErrorCode = void 0;
|
|
20
|
+
const error_1 = require("../utils/error");
|
|
21
|
+
/**
|
|
22
|
+
* The constant mapping for valid Machine Learning client error codes.
|
|
23
|
+
*/
|
|
24
|
+
exports.MachineLearningErrorCode = {
|
|
25
|
+
ALREADY_EXISTS: 'already-exists',
|
|
26
|
+
AUTHENTICATION_ERROR: 'authentication-error',
|
|
27
|
+
INTERNAL_ERROR: 'internal-error',
|
|
28
|
+
INVALID_ARGUMENT: 'invalid-argument',
|
|
29
|
+
INVALID_SERVER_RESPONSE: 'invalid-server-response',
|
|
30
|
+
NOT_FOUND: 'not-found',
|
|
31
|
+
RESOURCE_EXHAUSTED: 'resource-exhausted',
|
|
32
|
+
SERVICE_UNAVAILABLE: 'service-unavailable',
|
|
33
|
+
UNKNOWN_ERROR: 'unknown-error',
|
|
34
|
+
CANCELLED: 'cancelled',
|
|
35
|
+
DEADLINE_EXCEEDED: 'deadline-exceeded',
|
|
36
|
+
PERMISSION_DENIED: 'permission-denied',
|
|
37
|
+
FAILED_PRECONDITION: 'failed-precondition',
|
|
38
|
+
ABORTED: 'aborted',
|
|
39
|
+
OUT_OF_RANGE: 'out-of-range',
|
|
40
|
+
DATA_LOSS: 'data-loss',
|
|
41
|
+
UNAUTHENTICATED: 'unauthenticated',
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Firebase Machine Learning error code structure. This extends `FirebaseError`.
|
|
45
|
+
*/
|
|
46
|
+
class FirebaseMachineLearningError extends error_1.FirebaseError {
|
|
47
|
+
/** @internal */
|
|
48
|
+
static fromOperationError(code, message) {
|
|
49
|
+
switch (code) {
|
|
50
|
+
case 1: return new FirebaseMachineLearningError({ code: 'cancelled', message });
|
|
51
|
+
case 2: return new FirebaseMachineLearningError({ code: 'unknown-error', message });
|
|
52
|
+
case 3: return new FirebaseMachineLearningError({ code: 'invalid-argument', message });
|
|
53
|
+
case 4: return new FirebaseMachineLearningError({ code: 'deadline-exceeded', message });
|
|
54
|
+
case 5: return new FirebaseMachineLearningError({ code: 'not-found', message });
|
|
55
|
+
case 6: return new FirebaseMachineLearningError({ code: 'already-exists', message });
|
|
56
|
+
case 7: return new FirebaseMachineLearningError({ code: 'permission-denied', message });
|
|
57
|
+
case 8: return new FirebaseMachineLearningError({ code: 'resource-exhausted', message });
|
|
58
|
+
case 9: return new FirebaseMachineLearningError({ code: 'failed-precondition', message });
|
|
59
|
+
case 10: return new FirebaseMachineLearningError({ code: 'aborted', message });
|
|
60
|
+
case 11: return new FirebaseMachineLearningError({ code: 'out-of-range', message });
|
|
61
|
+
case 13: return new FirebaseMachineLearningError({ code: 'internal-error', message });
|
|
62
|
+
case 14: return new FirebaseMachineLearningError({ code: 'service-unavailable', message });
|
|
63
|
+
case 15: return new FirebaseMachineLearningError({ code: 'data-loss', message });
|
|
64
|
+
case 16: return new FirebaseMachineLearningError({ code: 'unauthenticated', message });
|
|
65
|
+
default:
|
|
66
|
+
return new FirebaseMachineLearningError({ code: 'unknown-error', message });
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* @param info - The error code info.
|
|
71
|
+
* @param message - The error message. If provided, this will override the default message.
|
|
72
|
+
*/
|
|
73
|
+
constructor(info, message) {
|
|
74
|
+
super({
|
|
75
|
+
code: `machine-learning/${info.code}`,
|
|
76
|
+
message: message || info.message,
|
|
77
|
+
httpResponse: info.httpResponse,
|
|
78
|
+
cause: info.cause,
|
|
79
|
+
});
|
|
80
|
+
/** @internal */
|
|
81
|
+
this.codePrefix = 'machine-learning';
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.FirebaseMachineLearningError = FirebaseMachineLearningError;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v14.0.0 */
|
|
2
2
|
/*!
|
|
3
3
|
* Copyright 2020 Google LLC
|
|
4
4
|
*
|
|
@@ -50,3 +50,4 @@ export { GcsTfliteModelOptions, ListModelsOptions, ModelOptions, ModelOptionsBas
|
|
|
50
50
|
* `MachineLearning` service associated with the provided app.
|
|
51
51
|
*/
|
|
52
52
|
export declare function getMachineLearning(app?: App): MachineLearning;
|
|
53
|
+
export { FirebaseMachineLearningError, MachineLearningErrorCode } from './error';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v14.0.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2020 Google LLC
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.Model = exports.MachineLearning = void 0;
|
|
19
|
+
exports.MachineLearningErrorCode = exports.FirebaseMachineLearningError = exports.Model = exports.MachineLearning = void 0;
|
|
20
20
|
exports.getMachineLearning = getMachineLearning;
|
|
21
21
|
/**
|
|
22
22
|
* Firebase Machine Learning.
|
|
@@ -61,3 +61,6 @@ function getMachineLearning(app) {
|
|
|
61
61
|
const firebaseApp = app;
|
|
62
62
|
return firebaseApp.getOrInitService('machineLearning', (app) => new machine_learning_1.MachineLearning(app));
|
|
63
63
|
}
|
|
64
|
+
var error_1 = require("./error");
|
|
65
|
+
Object.defineProperty(exports, "FirebaseMachineLearningError", { enumerable: true, get: function () { return error_1.FirebaseMachineLearningError; } });
|
|
66
|
+
Object.defineProperty(exports, "MachineLearningErrorCode", { enumerable: true, get: function () { return error_1.MachineLearningErrorCode; } });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v14.0.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2020 Google LLC
|
|
@@ -22,7 +22,7 @@ const api_request_1 = require("../utils/api-request");
|
|
|
22
22
|
const error_1 = require("../utils/error");
|
|
23
23
|
const utils = require("../utils/index");
|
|
24
24
|
const validator = require("../utils/validator");
|
|
25
|
-
const
|
|
25
|
+
const error_2 = require("./error");
|
|
26
26
|
const ML_V1BETA2_API = 'https://firebaseml.googleapis.com/v1beta2';
|
|
27
27
|
const FIREBASE_VERSION_HEADER = {
|
|
28
28
|
'X-Firebase-Client': `fire-admin-node/${utils.getSdkVersion()}`,
|
|
@@ -44,15 +44,18 @@ class MachineLearningApiClient {
|
|
|
44
44
|
constructor(app) {
|
|
45
45
|
this.app = app;
|
|
46
46
|
if (!validator.isNonNullObject(app) || !('options' in app)) {
|
|
47
|
-
throw new
|
|
48
|
-
|
|
47
|
+
throw new error_2.FirebaseMachineLearningError({
|
|
48
|
+
code: 'invalid-argument',
|
|
49
|
+
message: 'First argument passed to admin.machineLearning() must be a valid '
|
|
50
|
+
+ 'Firebase app instance.'
|
|
51
|
+
});
|
|
49
52
|
}
|
|
50
53
|
this.httpClient = new api_request_1.AuthorizedHttpClient(app);
|
|
51
54
|
}
|
|
52
55
|
createModel(model) {
|
|
53
56
|
if (!validator.isNonNullObject(model) ||
|
|
54
57
|
!validator.isNonEmptyString(model.displayName)) {
|
|
55
|
-
const err = new
|
|
58
|
+
const err = new error_2.FirebaseMachineLearningError({ code: 'invalid-argument', message: 'Invalid model content.' });
|
|
56
59
|
return Promise.reject(err);
|
|
57
60
|
}
|
|
58
61
|
return this.getProjectUrl()
|
|
@@ -69,7 +72,10 @@ class MachineLearningApiClient {
|
|
|
69
72
|
if (!validator.isNonEmptyString(modelId) ||
|
|
70
73
|
!validator.isNonNullObject(model) ||
|
|
71
74
|
!validator.isNonEmptyArray(updateMask)) {
|
|
72
|
-
const err = new
|
|
75
|
+
const err = new error_2.FirebaseMachineLearningError({
|
|
76
|
+
code: 'invalid-argument',
|
|
77
|
+
message: 'Invalid model or mask content.',
|
|
78
|
+
});
|
|
73
79
|
return Promise.reject(err);
|
|
74
80
|
}
|
|
75
81
|
return this.getProjectUrl()
|
|
@@ -99,25 +105,31 @@ class MachineLearningApiClient {
|
|
|
99
105
|
}
|
|
100
106
|
listModels(options = {}) {
|
|
101
107
|
if (!validator.isNonNullObject(options)) {
|
|
102
|
-
const err = new
|
|
108
|
+
const err = new error_2.FirebaseMachineLearningError({ code: 'invalid-argument', message: 'Invalid ListModelsOptions' });
|
|
103
109
|
return Promise.reject(err);
|
|
104
110
|
}
|
|
105
111
|
if (typeof options.filter !== 'undefined' && !validator.isNonEmptyString(options.filter)) {
|
|
106
|
-
const err = new
|
|
112
|
+
const err = new error_2.FirebaseMachineLearningError({ code: 'invalid-argument', message: 'Invalid list filter.' });
|
|
107
113
|
return Promise.reject(err);
|
|
108
114
|
}
|
|
109
115
|
if (typeof options.pageSize !== 'undefined') {
|
|
110
116
|
if (!validator.isNumber(options.pageSize)) {
|
|
111
|
-
const err = new
|
|
117
|
+
const err = new error_2.FirebaseMachineLearningError({ code: 'invalid-argument', message: 'Invalid page size.' });
|
|
112
118
|
return Promise.reject(err);
|
|
113
119
|
}
|
|
114
120
|
if (options.pageSize < 1 || options.pageSize > 100) {
|
|
115
|
-
const err = new
|
|
121
|
+
const err = new error_2.FirebaseMachineLearningError({
|
|
122
|
+
code: 'invalid-argument',
|
|
123
|
+
message: 'Page size must be between 1 and 100.'
|
|
124
|
+
});
|
|
116
125
|
return Promise.reject(err);
|
|
117
126
|
}
|
|
118
127
|
}
|
|
119
128
|
if (typeof options.pageToken !== 'undefined' && !validator.isNonEmptyString(options.pageToken)) {
|
|
120
|
-
const err = new
|
|
129
|
+
const err = new error_2.FirebaseMachineLearningError({
|
|
130
|
+
code: 'invalid-argument',
|
|
131
|
+
message: 'Next page token must be a non-empty string.'
|
|
132
|
+
});
|
|
121
133
|
return Promise.reject(err);
|
|
122
134
|
}
|
|
123
135
|
return this.getProjectUrl()
|
|
@@ -153,11 +165,14 @@ class MachineLearningApiClient {
|
|
|
153
165
|
return Promise.resolve(op.response);
|
|
154
166
|
}
|
|
155
167
|
else if (op.error) {
|
|
156
|
-
const err =
|
|
168
|
+
const err = error_2.FirebaseMachineLearningError.fromOperationError(op.error.code, op.error.message);
|
|
157
169
|
return Promise.reject(err);
|
|
158
170
|
}
|
|
159
171
|
// Done operations must have either a response or an error.
|
|
160
|
-
throw new
|
|
172
|
+
throw new error_2.FirebaseMachineLearningError({
|
|
173
|
+
code: 'invalid-server-response',
|
|
174
|
+
message: 'Invalid operation response.'
|
|
175
|
+
});
|
|
161
176
|
}
|
|
162
177
|
// Operation is not done
|
|
163
178
|
if (options?.wait) {
|
|
@@ -166,7 +181,10 @@ class MachineLearningApiClient {
|
|
|
166
181
|
const metadata = op.metadata || {};
|
|
167
182
|
const metadataType = metadata['@type'] || '';
|
|
168
183
|
if (!metadataType.includes('ModelOperationMetadata')) {
|
|
169
|
-
throw new
|
|
184
|
+
throw new error_2.FirebaseMachineLearningError({
|
|
185
|
+
code: 'invalid-server-response',
|
|
186
|
+
message: `Unknown Metadata type: ${JSON.stringify(metadata)}`
|
|
187
|
+
});
|
|
170
188
|
}
|
|
171
189
|
return this.getModel(extractModelId(metadata.name));
|
|
172
190
|
}
|
|
@@ -183,7 +201,7 @@ class MachineLearningApiClient {
|
|
|
183
201
|
return null;
|
|
184
202
|
}
|
|
185
203
|
if (responseData.error) {
|
|
186
|
-
const err =
|
|
204
|
+
const err = error_2.FirebaseMachineLearningError.fromOperationError(responseData.error.code, responseData.error.message);
|
|
187
205
|
throw err;
|
|
188
206
|
}
|
|
189
207
|
return responseData.response;
|
|
@@ -231,20 +249,30 @@ class MachineLearningApiClient {
|
|
|
231
249
|
});
|
|
232
250
|
}
|
|
233
251
|
toFirebaseError(err) {
|
|
234
|
-
if (err instanceof error_1.
|
|
252
|
+
if (err instanceof error_1.FirebaseError) {
|
|
235
253
|
return err;
|
|
236
254
|
}
|
|
237
255
|
const response = err.response;
|
|
238
256
|
if (!response.isJson()) {
|
|
239
|
-
return new
|
|
257
|
+
return new error_2.FirebaseMachineLearningError({
|
|
258
|
+
code: 'unknown-error',
|
|
259
|
+
message: `Unexpected response with status: ${response.status} and body: ${response.text}`,
|
|
260
|
+
httpResponse: (0, error_1.toHttpResponse)(response),
|
|
261
|
+
cause: err
|
|
262
|
+
});
|
|
240
263
|
}
|
|
241
264
|
const error = response.data.error || {};
|
|
242
265
|
let code = 'unknown-error';
|
|
243
266
|
if (error.status && error.status in ERROR_CODE_MAPPING) {
|
|
244
267
|
code = ERROR_CODE_MAPPING[error.status];
|
|
245
268
|
}
|
|
246
|
-
const message = error.message ||
|
|
247
|
-
return new
|
|
269
|
+
const message = error.message || 'Unknown server error';
|
|
270
|
+
return new error_2.FirebaseMachineLearningError({
|
|
271
|
+
code,
|
|
272
|
+
message,
|
|
273
|
+
httpResponse: (0, error_1.toHttpResponse)(response),
|
|
274
|
+
cause: err
|
|
275
|
+
});
|
|
248
276
|
}
|
|
249
277
|
getProjectUrl() {
|
|
250
278
|
return this.getProjectIdPrefix()
|
|
@@ -259,9 +287,12 @@ class MachineLearningApiClient {
|
|
|
259
287
|
return utils.findProjectId(this.app)
|
|
260
288
|
.then((projectId) => {
|
|
261
289
|
if (!validator.isNonEmptyString(projectId)) {
|
|
262
|
-
throw new
|
|
263
|
-
|
|
264
|
-
|
|
290
|
+
throw new error_2.FirebaseMachineLearningError({
|
|
291
|
+
code: 'invalid-argument',
|
|
292
|
+
message: 'Failed to determine project ID. Initialize the SDK with service account credentials, or '
|
|
293
|
+
+ 'set project ID as an app option. Alternatively, set the GOOGLE_CLOUD_PROJECT '
|
|
294
|
+
+ 'environment variable.'
|
|
295
|
+
});
|
|
265
296
|
}
|
|
266
297
|
this.projectIdPrefix = `projects/${projectId}`;
|
|
267
298
|
return this.projectIdPrefix;
|
|
@@ -269,10 +300,16 @@ class MachineLearningApiClient {
|
|
|
269
300
|
}
|
|
270
301
|
getModelName(modelId) {
|
|
271
302
|
if (!validator.isNonEmptyString(modelId)) {
|
|
272
|
-
throw new
|
|
303
|
+
throw new error_2.FirebaseMachineLearningError({
|
|
304
|
+
code: 'invalid-argument',
|
|
305
|
+
message: 'Model ID must be a non-empty string.'
|
|
306
|
+
});
|
|
273
307
|
}
|
|
274
308
|
if (modelId.indexOf('/') !== -1) {
|
|
275
|
-
throw new
|
|
309
|
+
throw new error_2.FirebaseMachineLearningError({
|
|
310
|
+
code: 'invalid-argument',
|
|
311
|
+
message: 'Model ID must not contain any "/" characters.'
|
|
312
|
+
});
|
|
276
313
|
}
|
|
277
314
|
return `models/${modelId}`;
|
|
278
315
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v14.0.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2020 Google LLC
|
|
@@ -18,12 +18,11 @@
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.Model = exports.MachineLearning = void 0;
|
|
20
20
|
const index_1 = require("../storage/index");
|
|
21
|
-
const error_1 = require("../utils/error");
|
|
22
21
|
const validator = require("../utils/validator");
|
|
23
22
|
const deep_copy_1 = require("../utils/deep-copy");
|
|
24
23
|
const utils = require("../utils");
|
|
25
24
|
const machine_learning_api_client_1 = require("./machine-learning-api-client");
|
|
26
|
-
const
|
|
25
|
+
const error_1 = require("./error");
|
|
27
26
|
/**
|
|
28
27
|
* The Firebase `MachineLearning` service interface.
|
|
29
28
|
*/
|
|
@@ -35,8 +34,8 @@ class MachineLearning {
|
|
|
35
34
|
*/
|
|
36
35
|
constructor(app) {
|
|
37
36
|
if (!validator.isNonNullObject(app) || !('options' in app)) {
|
|
38
|
-
throw new error_1.
|
|
39
|
-
code: '
|
|
37
|
+
throw new error_1.FirebaseMachineLearningError({
|
|
38
|
+
code: 'invalid-argument',
|
|
40
39
|
message: 'First argument passed to admin.machineLearning() must be a ' +
|
|
41
40
|
'valid Firebase app instance.',
|
|
42
41
|
});
|
|
@@ -126,7 +125,10 @@ class MachineLearning {
|
|
|
126
125
|
return this.client.listModels(options)
|
|
127
126
|
.then((resp) => {
|
|
128
127
|
if (!validator.isNonNullObject(resp)) {
|
|
129
|
-
throw new
|
|
128
|
+
throw new error_1.FirebaseMachineLearningError({
|
|
129
|
+
code: 'invalid-argument',
|
|
130
|
+
message: `Invalid ListModels response: ${JSON.stringify(resp)}`
|
|
131
|
+
});
|
|
130
132
|
}
|
|
131
133
|
let models = [];
|
|
132
134
|
if (resp.models) {
|
|
@@ -163,7 +165,11 @@ class MachineLearning {
|
|
|
163
165
|
return modelOptions;
|
|
164
166
|
})
|
|
165
167
|
.catch((err) => {
|
|
166
|
-
throw new
|
|
168
|
+
throw new error_1.FirebaseMachineLearningError({
|
|
169
|
+
code: 'internal-error',
|
|
170
|
+
message: `Error during signing upload url: ${err.message}`,
|
|
171
|
+
cause: err,
|
|
172
|
+
});
|
|
167
173
|
});
|
|
168
174
|
}
|
|
169
175
|
return Promise.resolve(modelOptions);
|
|
@@ -174,7 +180,10 @@ class MachineLearning {
|
|
|
174
180
|
const gcsRegex = /^gs:\/\/([a-z0-9_.-]{3,63})\/(.+)$/;
|
|
175
181
|
const matches = gcsRegex.exec(unsignedUrl);
|
|
176
182
|
if (!matches) {
|
|
177
|
-
throw new
|
|
183
|
+
throw new error_1.FirebaseMachineLearningError({
|
|
184
|
+
code: 'invalid-argument',
|
|
185
|
+
message: `Invalid unsigned url: ${unsignedUrl}`
|
|
186
|
+
});
|
|
178
187
|
}
|
|
179
188
|
const bucketName = matches[1];
|
|
180
189
|
const blobName = matches[2];
|
|
@@ -314,7 +323,10 @@ class Model {
|
|
|
314
323
|
!validator.isNonEmptyString(model.updateTime) ||
|
|
315
324
|
!validator.isNonEmptyString(model.displayName) ||
|
|
316
325
|
!validator.isNonEmptyString(model.etag)) {
|
|
317
|
-
throw new
|
|
326
|
+
throw new error_1.FirebaseMachineLearningError({
|
|
327
|
+
code: 'invalid-server-response',
|
|
328
|
+
message: `Invalid Model response: ${JSON.stringify(model)}`
|
|
329
|
+
});
|
|
318
330
|
}
|
|
319
331
|
const tmpModel = (0, deep_copy_1.deepCopy)(model);
|
|
320
332
|
// If tflite Model is specified, it must have a source of {gcsTfliteUri}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/*! firebase-admin v14.0.0 */
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
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 { ErrorInfo, FirebaseError } from '../utils/error';
|
|
18
|
+
/**
|
|
19
|
+
* The constant mapping for valid Messaging client error codes.
|
|
20
|
+
*/
|
|
21
|
+
export declare const MessagingErrorCode: {
|
|
22
|
+
readonly INVALID_ARGUMENT: "invalid-argument";
|
|
23
|
+
readonly INVALID_RECIPIENT: "invalid-recipient";
|
|
24
|
+
readonly INVALID_PAYLOAD: "invalid-payload";
|
|
25
|
+
readonly INVALID_DATA_PAYLOAD_KEY: "invalid-data-payload-key";
|
|
26
|
+
readonly PAYLOAD_SIZE_LIMIT_EXCEEDED: "payload-size-limit-exceeded";
|
|
27
|
+
readonly INVALID_OPTIONS: "invalid-options";
|
|
28
|
+
readonly INVALID_REGISTRATION_TOKEN: "invalid-registration-token";
|
|
29
|
+
readonly REGISTRATION_TOKEN_NOT_REGISTERED: "registration-token-not-registered";
|
|
30
|
+
readonly MISMATCHED_CREDENTIAL: "mismatched-credential";
|
|
31
|
+
readonly INVALID_PACKAGE_NAME: "invalid-package-name";
|
|
32
|
+
readonly DEVICE_MESSAGE_RATE_EXCEEDED: "device-message-rate-exceeded";
|
|
33
|
+
readonly TOPICS_MESSAGE_RATE_EXCEEDED: "topics-message-rate-exceeded";
|
|
34
|
+
readonly TOPICS_SUBSCRIPTION_RATE_EXCEEDED: "topics-subscription-rate-exceeded";
|
|
35
|
+
readonly MESSAGE_RATE_EXCEEDED: "message-rate-exceeded";
|
|
36
|
+
readonly THIRD_PARTY_AUTH_ERROR: "third-party-auth-error";
|
|
37
|
+
readonly TOO_MANY_TOPICS: "too-many-topics";
|
|
38
|
+
readonly AUTHENTICATION_ERROR: "authentication-error";
|
|
39
|
+
readonly SERVER_UNAVAILABLE: "server-unavailable";
|
|
40
|
+
readonly INTERNAL_ERROR: "internal-error";
|
|
41
|
+
readonly UNKNOWN_ERROR: "unknown-error";
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* The type definition for valid Messaging client error codes.
|
|
45
|
+
*/
|
|
46
|
+
export type MessagingErrorCode = typeof MessagingErrorCode[keyof typeof MessagingErrorCode];
|
|
47
|
+
/**
|
|
48
|
+
* Internal Messaging client error code mapping used to construct ErrorInfo.
|
|
49
|
+
*/
|
|
50
|
+
export declare const messagingClientErrorCode: {
|
|
51
|
+
readonly [K in keyof typeof MessagingErrorCode]: ErrorInfo;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Firebase Messaging error code structure. This extends `FirebaseError`.
|
|
55
|
+
*/
|
|
56
|
+
export declare class FirebaseMessagingError extends FirebaseError {
|
|
57
|
+
/**
|
|
58
|
+
*
|
|
59
|
+
* @param info - The error code info.
|
|
60
|
+
* @param message - The error message. This will override the default message if provided.
|
|
61
|
+
*/
|
|
62
|
+
constructor(info: ErrorInfo, message?: string);
|
|
63
|
+
}
|