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
|
* @license
|
|
@@ -17,9 +17,10 @@
|
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.
|
|
20
|
+
exports.FunctionsApiClient = exports.EMULATED_SERVICE_ACCOUNT_DEFAULT = void 0;
|
|
21
21
|
const api_request_1 = require("../utils/api-request");
|
|
22
22
|
const error_1 = require("../utils/error");
|
|
23
|
+
const error_2 = require("./error");
|
|
23
24
|
const utils = require("../utils/index");
|
|
24
25
|
const validator = require("../utils/validator");
|
|
25
26
|
const credential_internal_1 = require("../app/credential-internal");
|
|
@@ -41,9 +42,14 @@ class FunctionsApiClient {
|
|
|
41
42
|
constructor(app) {
|
|
42
43
|
this.app = app;
|
|
43
44
|
if (!validator.isNonNullObject(app) || !('options' in app)) {
|
|
44
|
-
throw new FirebaseFunctionsError(
|
|
45
|
+
throw new error_2.FirebaseFunctionsError({
|
|
46
|
+
code: 'invalid-argument',
|
|
47
|
+
message: 'First argument passed to getFunctions() must be a valid Firebase app instance.'
|
|
48
|
+
});
|
|
45
49
|
}
|
|
46
|
-
|
|
50
|
+
const emulatorHost = process.env.CLOUD_TASKS_EMULATOR_HOST?.trim();
|
|
51
|
+
this.emulatorHost = emulatorHost || undefined;
|
|
52
|
+
this.httpClient = new FunctionsHttpClient(app, this.emulatorHost);
|
|
47
53
|
}
|
|
48
54
|
/**
|
|
49
55
|
* Deletes a task from a queue.
|
|
@@ -54,29 +60,42 @@ class FunctionsApiClient {
|
|
|
54
60
|
*/
|
|
55
61
|
async delete(id, functionName, extensionId) {
|
|
56
62
|
if (!validator.isNonEmptyString(functionName)) {
|
|
57
|
-
throw new FirebaseFunctionsError(
|
|
63
|
+
throw new error_2.FirebaseFunctionsError({
|
|
64
|
+
code: 'invalid-argument',
|
|
65
|
+
message: 'Function name must be a non empty string'
|
|
66
|
+
});
|
|
58
67
|
}
|
|
59
68
|
if (!validator.isTaskId(id)) {
|
|
60
|
-
throw new FirebaseFunctionsError(
|
|
61
|
-
|
|
69
|
+
throw new error_2.FirebaseFunctionsError({
|
|
70
|
+
code: 'invalid-argument',
|
|
71
|
+
message: 'id can contain only letters ([A-Za-z]), numbers ([0-9]), '
|
|
72
|
+
+ 'hyphens (-), or underscores (_). The maximum length is 500 characters.'
|
|
73
|
+
});
|
|
62
74
|
}
|
|
63
75
|
let resources;
|
|
64
76
|
try {
|
|
65
77
|
resources = utils.parseResourceName(functionName, 'functions');
|
|
66
78
|
}
|
|
67
79
|
catch (err) {
|
|
68
|
-
throw new FirebaseFunctionsError(
|
|
80
|
+
throw new error_2.FirebaseFunctionsError({
|
|
81
|
+
code: 'invalid-argument',
|
|
82
|
+
message: 'Function name must be a single string or a qualified resource name',
|
|
83
|
+
cause: err,
|
|
84
|
+
});
|
|
69
85
|
}
|
|
70
86
|
resources.projectId = resources.projectId || await this.getProjectId();
|
|
71
87
|
resources.locationId = resources.locationId || DEFAULT_LOCATION;
|
|
72
88
|
if (!validator.isNonEmptyString(resources.resourceId)) {
|
|
73
|
-
throw new FirebaseFunctionsError(
|
|
89
|
+
throw new error_2.FirebaseFunctionsError({
|
|
90
|
+
code: 'invalid-argument',
|
|
91
|
+
message: 'No valid function name specified to enqueue tasks for.'
|
|
92
|
+
});
|
|
74
93
|
}
|
|
75
94
|
if (typeof extensionId !== 'undefined' && validator.isNonEmptyString(extensionId)) {
|
|
76
95
|
resources.resourceId = `ext-${extensionId}-${resources.resourceId}`;
|
|
77
96
|
}
|
|
78
97
|
try {
|
|
79
|
-
const serviceUrl = tasksEmulatorUrl(resources)?.concat('/', id)
|
|
98
|
+
const serviceUrl = tasksEmulatorUrl(resources, this.emulatorHost)?.concat('/', id)
|
|
80
99
|
?? await this.getUrl(resources, CLOUD_TASKS_API_URL_FORMAT.concat('/', id));
|
|
81
100
|
const request = {
|
|
82
101
|
method: 'DELETE',
|
|
@@ -108,26 +127,36 @@ class FunctionsApiClient {
|
|
|
108
127
|
*/
|
|
109
128
|
async enqueue(data, functionName, extensionId, opts) {
|
|
110
129
|
if (!validator.isNonEmptyString(functionName)) {
|
|
111
|
-
throw new FirebaseFunctionsError(
|
|
130
|
+
throw new error_2.FirebaseFunctionsError({
|
|
131
|
+
code: 'invalid-argument',
|
|
132
|
+
message: 'Function name must be a non empty string'
|
|
133
|
+
});
|
|
112
134
|
}
|
|
113
135
|
let resources;
|
|
114
136
|
try {
|
|
115
137
|
resources = utils.parseResourceName(functionName, 'functions');
|
|
116
138
|
}
|
|
117
139
|
catch (err) {
|
|
118
|
-
throw new FirebaseFunctionsError(
|
|
140
|
+
throw new error_2.FirebaseFunctionsError({
|
|
141
|
+
code: 'invalid-argument',
|
|
142
|
+
message: 'Function name must be a single string or a qualified resource name',
|
|
143
|
+
cause: err,
|
|
144
|
+
});
|
|
119
145
|
}
|
|
120
146
|
resources.projectId = resources.projectId || await this.getProjectId();
|
|
121
147
|
resources.locationId = resources.locationId || DEFAULT_LOCATION;
|
|
122
148
|
if (!validator.isNonEmptyString(resources.resourceId)) {
|
|
123
|
-
throw new FirebaseFunctionsError(
|
|
149
|
+
throw new error_2.FirebaseFunctionsError({
|
|
150
|
+
code: 'invalid-argument',
|
|
151
|
+
message: 'No valid function name specified to enqueue tasks for.'
|
|
152
|
+
});
|
|
124
153
|
}
|
|
125
154
|
if (typeof extensionId !== 'undefined' && validator.isNonEmptyString(extensionId)) {
|
|
126
155
|
resources.resourceId = `ext-${extensionId}-${resources.resourceId}`;
|
|
127
156
|
}
|
|
128
157
|
const task = this.validateTaskOptions(data, resources, opts);
|
|
129
158
|
try {
|
|
130
|
-
const serviceUrl = tasksEmulatorUrl(resources) ??
|
|
159
|
+
const serviceUrl = tasksEmulatorUrl(resources, this.emulatorHost) ??
|
|
131
160
|
await this.getUrl(resources, CLOUD_TASKS_API_URL_FORMAT);
|
|
132
161
|
const taskPayload = await this.updateTaskPayload(task, resources, extensionId);
|
|
133
162
|
const request = {
|
|
@@ -143,7 +172,12 @@ class FunctionsApiClient {
|
|
|
143
172
|
catch (err) {
|
|
144
173
|
if (err instanceof api_request_1.RequestResponseError) {
|
|
145
174
|
if (err.response.status === 409) {
|
|
146
|
-
throw new FirebaseFunctionsError(
|
|
175
|
+
throw new error_2.FirebaseFunctionsError({
|
|
176
|
+
code: 'task-already-exists',
|
|
177
|
+
message: `A task with ID ${opts?.id} already exists`,
|
|
178
|
+
httpResponse: (0, error_1.toHttpResponse)(err.response),
|
|
179
|
+
cause: err,
|
|
180
|
+
});
|
|
147
181
|
}
|
|
148
182
|
else {
|
|
149
183
|
throw this.toFirebaseError(err);
|
|
@@ -186,9 +220,12 @@ class FunctionsApiClient {
|
|
|
186
220
|
return utils.findProjectId(this.app)
|
|
187
221
|
.then((projectId) => {
|
|
188
222
|
if (!validator.isNonEmptyString(projectId)) {
|
|
189
|
-
throw new FirebaseFunctionsError(
|
|
190
|
-
|
|
191
|
-
|
|
223
|
+
throw new error_2.FirebaseFunctionsError({
|
|
224
|
+
code: 'unknown-error',
|
|
225
|
+
message: 'Failed to determine project ID. Initialize the '
|
|
226
|
+
+ 'SDK with service account credentials or set project ID as an app option. '
|
|
227
|
+
+ 'Alternatively, set the GOOGLE_CLOUD_PROJECT environment variable.'
|
|
228
|
+
});
|
|
192
229
|
}
|
|
193
230
|
this.projectId = projectId;
|
|
194
231
|
return projectId;
|
|
@@ -201,8 +238,11 @@ class FunctionsApiClient {
|
|
|
201
238
|
return utils.findServiceAccountEmail(this.app)
|
|
202
239
|
.then((accountId) => {
|
|
203
240
|
if (!validator.isNonEmptyString(accountId)) {
|
|
204
|
-
throw new FirebaseFunctionsError(
|
|
205
|
-
|
|
241
|
+
throw new error_2.FirebaseFunctionsError({
|
|
242
|
+
code: 'unknown-error',
|
|
243
|
+
message: 'Failed to determine service account. Initialize the '
|
|
244
|
+
+ 'SDK with service account credentials or set service account ID as an app option.'
|
|
245
|
+
});
|
|
206
246
|
}
|
|
207
247
|
this.accountId = accountId;
|
|
208
248
|
return accountId;
|
|
@@ -224,21 +264,32 @@ class FunctionsApiClient {
|
|
|
224
264
|
};
|
|
225
265
|
if (typeof opts !== 'undefined') {
|
|
226
266
|
if (!validator.isNonNullObject(opts)) {
|
|
227
|
-
throw new FirebaseFunctionsError(
|
|
267
|
+
throw new error_2.FirebaseFunctionsError({
|
|
268
|
+
code: 'invalid-argument',
|
|
269
|
+
message: 'TaskOptions must be a non-null object'
|
|
270
|
+
});
|
|
228
271
|
}
|
|
229
272
|
if ('scheduleTime' in opts && 'scheduleDelaySeconds' in opts) {
|
|
230
|
-
throw new FirebaseFunctionsError(
|
|
231
|
-
|
|
273
|
+
throw new error_2.FirebaseFunctionsError({
|
|
274
|
+
code: 'invalid-argument',
|
|
275
|
+
message: 'Both scheduleTime and scheduleDelaySeconds are provided. Only one value should be set.'
|
|
276
|
+
});
|
|
232
277
|
}
|
|
233
278
|
if ('scheduleTime' in opts && typeof opts.scheduleTime !== 'undefined') {
|
|
234
279
|
if (!(opts.scheduleTime instanceof Date)) {
|
|
235
|
-
throw new FirebaseFunctionsError(
|
|
280
|
+
throw new error_2.FirebaseFunctionsError({
|
|
281
|
+
code: 'invalid-argument',
|
|
282
|
+
message: 'scheduleTime must be a valid Date object.'
|
|
283
|
+
});
|
|
236
284
|
}
|
|
237
285
|
task.scheduleTime = opts.scheduleTime.toISOString();
|
|
238
286
|
}
|
|
239
287
|
if ('scheduleDelaySeconds' in opts && typeof opts.scheduleDelaySeconds !== 'undefined') {
|
|
240
288
|
if (!validator.isNumber(opts.scheduleDelaySeconds) || opts.scheduleDelaySeconds < 0) {
|
|
241
|
-
throw new FirebaseFunctionsError(
|
|
289
|
+
throw new error_2.FirebaseFunctionsError({
|
|
290
|
+
code: 'invalid-argument',
|
|
291
|
+
message: 'scheduleDelaySeconds must be a non-negative duration in seconds.'
|
|
292
|
+
});
|
|
242
293
|
}
|
|
243
294
|
const date = new Date();
|
|
244
295
|
date.setSeconds(date.getSeconds() + opts.scheduleDelaySeconds);
|
|
@@ -247,15 +298,21 @@ class FunctionsApiClient {
|
|
|
247
298
|
if (typeof opts.dispatchDeadlineSeconds !== 'undefined') {
|
|
248
299
|
if (!validator.isNumber(opts.dispatchDeadlineSeconds) || opts.dispatchDeadlineSeconds < 15
|
|
249
300
|
|| opts.dispatchDeadlineSeconds > 1800) {
|
|
250
|
-
throw new FirebaseFunctionsError(
|
|
251
|
-
|
|
301
|
+
throw new error_2.FirebaseFunctionsError({
|
|
302
|
+
code: 'invalid-argument',
|
|
303
|
+
message: 'dispatchDeadlineSeconds must be a non-negative duration in seconds '
|
|
304
|
+
+ 'and must be in the range of 15s to 30 mins.'
|
|
305
|
+
});
|
|
252
306
|
}
|
|
253
307
|
task.dispatchDeadline = `${opts.dispatchDeadlineSeconds}s`;
|
|
254
308
|
}
|
|
255
309
|
if ('id' in opts && typeof opts.id !== 'undefined') {
|
|
256
310
|
if (!validator.isTaskId(opts.id)) {
|
|
257
|
-
throw new FirebaseFunctionsError(
|
|
258
|
-
|
|
311
|
+
throw new error_2.FirebaseFunctionsError({
|
|
312
|
+
code: 'invalid-argument',
|
|
313
|
+
message: 'id can contain only letters ([A-Za-z]), numbers ([0-9]), '
|
|
314
|
+
+ 'hyphens (-), or underscores (_). The maximum length is 500 characters.'
|
|
315
|
+
});
|
|
259
316
|
}
|
|
260
317
|
const resourcePath = utils.formatString(CLOUD_TASKS_API_RESOURCE_PATH, {
|
|
261
318
|
projectId: resources.projectId,
|
|
@@ -266,7 +323,10 @@ class FunctionsApiClient {
|
|
|
266
323
|
}
|
|
267
324
|
if (typeof opts.uri !== 'undefined') {
|
|
268
325
|
if (!validator.isURL(opts.uri)) {
|
|
269
|
-
throw new FirebaseFunctionsError(
|
|
326
|
+
throw new error_2.FirebaseFunctionsError({
|
|
327
|
+
code: 'invalid-argument',
|
|
328
|
+
message: 'uri must be a valid URL string.'
|
|
329
|
+
});
|
|
270
330
|
}
|
|
271
331
|
task.httpRequest.url = opts.uri;
|
|
272
332
|
}
|
|
@@ -274,7 +334,7 @@ class FunctionsApiClient {
|
|
|
274
334
|
return task;
|
|
275
335
|
}
|
|
276
336
|
async updateTaskPayload(task, resources, extensionId) {
|
|
277
|
-
const defaultUrl =
|
|
337
|
+
const defaultUrl = this.emulatorHost ?
|
|
278
338
|
''
|
|
279
339
|
: await this.getUrl(resources, FIREBASE_FUNCTION_URL_FORMAT);
|
|
280
340
|
const functionUrl = validator.isNonEmptyString(task.httpRequest.url)
|
|
@@ -295,7 +355,7 @@ class FunctionsApiClient {
|
|
|
295
355
|
task.httpRequest.oidcToken = { serviceAccountEmail: account };
|
|
296
356
|
}
|
|
297
357
|
catch (e) {
|
|
298
|
-
if (
|
|
358
|
+
if (this.emulatorHost) {
|
|
299
359
|
task.httpRequest.oidcToken = { serviceAccountEmail: exports.EMULATED_SERVICE_ACCOUNT_DEFAULT };
|
|
300
360
|
}
|
|
301
361
|
else {
|
|
@@ -306,20 +366,25 @@ class FunctionsApiClient {
|
|
|
306
366
|
return task;
|
|
307
367
|
}
|
|
308
368
|
toFirebaseError(err) {
|
|
309
|
-
if (err instanceof error_1.
|
|
369
|
+
if (err instanceof error_1.FirebaseError) {
|
|
310
370
|
return err;
|
|
311
371
|
}
|
|
312
372
|
const response = err.response;
|
|
313
373
|
if (!response.isJson()) {
|
|
314
|
-
return new FirebaseFunctionsError(
|
|
374
|
+
return new error_2.FirebaseFunctionsError({
|
|
375
|
+
code: 'unknown-error',
|
|
376
|
+
message: `Unexpected response with status: ${response.status} and body: ${response.text}`,
|
|
377
|
+
httpResponse: (0, error_1.toHttpResponse)(response),
|
|
378
|
+
cause: err
|
|
379
|
+
});
|
|
315
380
|
}
|
|
316
381
|
const error = response.data.error || {};
|
|
317
382
|
let code = 'unknown-error';
|
|
318
|
-
if (error.status && error.status in
|
|
319
|
-
code =
|
|
383
|
+
if (error.status && error.status in error_2.FUNCTIONS_ERROR_CODE_MAPPING) {
|
|
384
|
+
code = error_2.FUNCTIONS_ERROR_CODE_MAPPING[error.status];
|
|
320
385
|
}
|
|
321
|
-
const message = error.message ||
|
|
322
|
-
return new FirebaseFunctionsError(code, message);
|
|
386
|
+
const message = error.message || 'Unknown server error';
|
|
387
|
+
return new error_2.FirebaseFunctionsError({ code, message, httpResponse: (0, error_1.toHttpResponse)(response), cause: err });
|
|
323
388
|
}
|
|
324
389
|
}
|
|
325
390
|
exports.FunctionsApiClient = FunctionsApiClient;
|
|
@@ -328,45 +393,20 @@ exports.FunctionsApiClient = FunctionsApiClient;
|
|
|
328
393
|
* when communicating with the Emulator.
|
|
329
394
|
*/
|
|
330
395
|
class FunctionsHttpClient extends api_request_1.AuthorizedHttpClient {
|
|
396
|
+
constructor(app, emulatorHost) {
|
|
397
|
+
super(app);
|
|
398
|
+
this.emulatorHost = emulatorHost;
|
|
399
|
+
}
|
|
331
400
|
getToken() {
|
|
332
|
-
if (
|
|
401
|
+
if (this.emulatorHost) {
|
|
333
402
|
return Promise.resolve('owner');
|
|
334
403
|
}
|
|
335
404
|
return super.getToken();
|
|
336
405
|
}
|
|
337
406
|
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
INVALID_CREDENTIAL: 'invalid-credential',
|
|
342
|
-
INTERNAL: 'internal-error',
|
|
343
|
-
FAILED_PRECONDITION: 'failed-precondition',
|
|
344
|
-
PERMISSION_DENIED: 'permission-denied',
|
|
345
|
-
UNAUTHENTICATED: 'unauthenticated',
|
|
346
|
-
NOT_FOUND: 'not-found',
|
|
347
|
-
UNKNOWN: 'unknown-error',
|
|
348
|
-
};
|
|
349
|
-
/**
|
|
350
|
-
* Firebase Functions error code structure. This extends PrefixedFirebaseError.
|
|
351
|
-
*
|
|
352
|
-
* @param code - The error code.
|
|
353
|
-
* @param message - The error message.
|
|
354
|
-
* @constructor
|
|
355
|
-
*/
|
|
356
|
-
class FirebaseFunctionsError extends error_1.PrefixedFirebaseError {
|
|
357
|
-
constructor(code, message) {
|
|
358
|
-
super('functions', code, message);
|
|
359
|
-
/* tslint:disable:max-line-length */
|
|
360
|
-
// Set the prototype explicitly. See the following link for more details:
|
|
361
|
-
// https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
|
|
362
|
-
/* tslint:enable:max-line-length */
|
|
363
|
-
this.__proto__ = FirebaseFunctionsError.prototype;
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
exports.FirebaseFunctionsError = FirebaseFunctionsError;
|
|
367
|
-
function tasksEmulatorUrl(resources) {
|
|
368
|
-
if (process.env.CLOUD_TASKS_EMULATOR_HOST) {
|
|
369
|
-
return `http://${process.env.CLOUD_TASKS_EMULATOR_HOST}/projects/${resources.projectId}/locations/${resources.locationId}/queues/${resources.resourceId}/tasks`;
|
|
407
|
+
function tasksEmulatorUrl(resources, emulatorHost) {
|
|
408
|
+
if (emulatorHost) {
|
|
409
|
+
return `http://${emulatorHost}/projects/${resources.projectId}/locations/${resources.locationId}/queues/${resources.resourceId}/tasks`;
|
|
370
410
|
}
|
|
371
411
|
return undefined;
|
|
372
412
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v14.0.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* @license
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
20
|
exports.TaskQueue = exports.Functions = void 0;
|
|
21
21
|
const functions_api_client_internal_1 = require("./functions-api-client-internal");
|
|
22
|
+
const error_1 = require("./error");
|
|
22
23
|
const validator = require("../utils/validator");
|
|
23
24
|
/**
|
|
24
25
|
* The Firebase `Functions` service interface.
|
|
@@ -73,13 +74,22 @@ class TaskQueue {
|
|
|
73
74
|
this.client = client;
|
|
74
75
|
this.extensionId = extensionId;
|
|
75
76
|
if (!validator.isNonEmptyString(functionName)) {
|
|
76
|
-
throw new
|
|
77
|
+
throw new error_1.FirebaseFunctionsError({
|
|
78
|
+
code: 'invalid-argument',
|
|
79
|
+
message: '`functionName` must be a non-empty string.'
|
|
80
|
+
});
|
|
77
81
|
}
|
|
78
82
|
if (!validator.isNonNullObject(client) || !('enqueue' in client)) {
|
|
79
|
-
throw new
|
|
83
|
+
throw new error_1.FirebaseFunctionsError({
|
|
84
|
+
code: 'invalid-argument',
|
|
85
|
+
message: 'Must provide a valid FunctionsApiClient instance to create a new TaskQueue.'
|
|
86
|
+
});
|
|
80
87
|
}
|
|
81
88
|
if (typeof extensionId !== 'undefined' && !validator.isString(extensionId)) {
|
|
82
|
-
throw new
|
|
89
|
+
throw new error_1.FirebaseFunctionsError({
|
|
90
|
+
code: 'invalid-argument',
|
|
91
|
+
message: '`extensionId` must be a string.'
|
|
92
|
+
});
|
|
83
93
|
}
|
|
84
94
|
}
|
|
85
95
|
/**
|
package/lib/functions/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v14.0.0 */
|
|
2
2
|
/*!
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2021 Google LLC
|
|
@@ -51,3 +51,4 @@ export { Functions, TaskQueue } from './functions';
|
|
|
51
51
|
* service associated with the provided app.
|
|
52
52
|
*/
|
|
53
53
|
export declare function getFunctions(app?: App): Functions;
|
|
54
|
+
export { FirebaseFunctionsError, FunctionsErrorCode } from './error';
|
package/lib/functions/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v14.0.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* @license
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.TaskQueue = exports.Functions = void 0;
|
|
20
|
+
exports.FunctionsErrorCode = exports.FirebaseFunctionsError = exports.TaskQueue = exports.Functions = void 0;
|
|
21
21
|
exports.getFunctions = getFunctions;
|
|
22
22
|
/**
|
|
23
23
|
* Firebase Functions service.
|
|
@@ -62,3 +62,6 @@ function getFunctions(app) {
|
|
|
62
62
|
const firebaseApp = app;
|
|
63
63
|
return firebaseApp.getOrInitService('functions', (app) => new functions_1.Functions(app));
|
|
64
64
|
}
|
|
65
|
+
var error_1 = require("./error");
|
|
66
|
+
Object.defineProperty(exports, "FirebaseFunctionsError", { enumerable: true, get: function () { return error_1.FirebaseFunctionsError; } });
|
|
67
|
+
Object.defineProperty(exports, "FunctionsErrorCode", { enumerable: true, get: function () { return error_1.FunctionsErrorCode; } });
|
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v14.0.0 */
|
|
2
2
|
/*!
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2017 Google LLC
|
|
@@ -15,10 +15,15 @@
|
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
export
|
|
18
|
+
/**
|
|
19
|
+
* Firebase App and SDK initialization.
|
|
20
|
+
*
|
|
21
|
+
* @packageDocumentation
|
|
22
|
+
*/
|
|
23
|
+
export { App, AppOptions, FirebaseArrayIndexError } from './app/core';
|
|
24
|
+
export { initializeApp, getApp, getApps, deleteApp } from './app/lifecycle';
|
|
25
|
+
export { Credential, ServiceAccount, GoogleOAuthAccessToken } from './app/credential';
|
|
26
|
+
export { applicationDefault, cert, refreshToken } from './app/credential-factory';
|
|
27
|
+
export { FirebaseError, ErrorInfo, HttpResponse } from './utils/error';
|
|
28
|
+
export { FirebaseAppError, AppErrorCode } from './app/error';
|
|
29
|
+
export declare const SDK_VERSION: string;
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v14.0.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* @license
|
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
* See the License for the specific language governing permissions and
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.SDK_VERSION = exports.AppErrorCode = exports.FirebaseAppError = exports.FirebaseError = exports.refreshToken = exports.cert = exports.applicationDefault = exports.deleteApp = exports.getApps = exports.getApp = exports.initializeApp = void 0;
|
|
21
|
+
const utils_1 = require("./utils");
|
|
20
22
|
// Only Node.js has a process variable that is of [[Class]] process
|
|
21
23
|
const processGlobal = typeof process !== 'undefined' ? process : 0;
|
|
22
24
|
if (Object.prototype.toString.call(processGlobal) !== '[object process]') {
|
|
@@ -34,4 +36,18 @@ https://firebase.google.com/docs/web/setup
|
|
|
34
36
|
// tslint:disable-next-line:no-console
|
|
35
37
|
console.error(message);
|
|
36
38
|
}
|
|
37
|
-
|
|
39
|
+
var lifecycle_1 = require("./app/lifecycle");
|
|
40
|
+
Object.defineProperty(exports, "initializeApp", { enumerable: true, get: function () { return lifecycle_1.initializeApp; } });
|
|
41
|
+
Object.defineProperty(exports, "getApp", { enumerable: true, get: function () { return lifecycle_1.getApp; } });
|
|
42
|
+
Object.defineProperty(exports, "getApps", { enumerable: true, get: function () { return lifecycle_1.getApps; } });
|
|
43
|
+
Object.defineProperty(exports, "deleteApp", { enumerable: true, get: function () { return lifecycle_1.deleteApp; } });
|
|
44
|
+
var credential_factory_1 = require("./app/credential-factory");
|
|
45
|
+
Object.defineProperty(exports, "applicationDefault", { enumerable: true, get: function () { return credential_factory_1.applicationDefault; } });
|
|
46
|
+
Object.defineProperty(exports, "cert", { enumerable: true, get: function () { return credential_factory_1.cert; } });
|
|
47
|
+
Object.defineProperty(exports, "refreshToken", { enumerable: true, get: function () { return credential_factory_1.refreshToken; } });
|
|
48
|
+
var error_1 = require("./utils/error");
|
|
49
|
+
Object.defineProperty(exports, "FirebaseError", { enumerable: true, get: function () { return error_1.FirebaseError; } });
|
|
50
|
+
var error_2 = require("./app/error");
|
|
51
|
+
Object.defineProperty(exports, "FirebaseAppError", { enumerable: true, get: function () { return error_2.FirebaseAppError; } });
|
|
52
|
+
Object.defineProperty(exports, "AppErrorCode", { enumerable: true, get: function () { return error_2.AppErrorCode; } });
|
|
53
|
+
exports.SDK_VERSION = (0, utils_1.getSdkVersion)();
|
|
@@ -0,0 +1,48 @@
|
|
|
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 { FirebaseError, ErrorInfo } from '../utils/error';
|
|
18
|
+
/**
|
|
19
|
+
* The constant mapping for valid Installations client error codes.
|
|
20
|
+
*/
|
|
21
|
+
export declare const InstallationsErrorCode: {
|
|
22
|
+
readonly INVALID_ARGUMENT: "invalid-argument";
|
|
23
|
+
readonly INVALID_PROJECT_ID: "invalid-project-id";
|
|
24
|
+
readonly INVALID_INSTALLATION_ID: "invalid-installation-id";
|
|
25
|
+
readonly API_ERROR: "api-error";
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* The type definition for valid Installations client error codes.
|
|
29
|
+
*/
|
|
30
|
+
export type InstallationsErrorCode = typeof InstallationsErrorCode[keyof typeof InstallationsErrorCode];
|
|
31
|
+
/**
|
|
32
|
+
* Internal Installations client error code mapping used to construct ErrorInfo.
|
|
33
|
+
*/
|
|
34
|
+
export declare const installationsClientErrorCode: {
|
|
35
|
+
readonly [K in keyof typeof InstallationsErrorCode]: ErrorInfo;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Firebase Installations error code structure. This extends `FirebaseError`.
|
|
39
|
+
*/
|
|
40
|
+
export declare class FirebaseInstallationsError extends FirebaseError {
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
* @param info - The error code info.
|
|
44
|
+
* @param message - The error message. This will override the default
|
|
45
|
+
* message if provided.
|
|
46
|
+
*/
|
|
47
|
+
constructor(info: ErrorInfo, message?: string);
|
|
48
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/*! firebase-admin v14.0.0 */
|
|
2
|
+
"use strict";
|
|
3
|
+
/*!
|
|
4
|
+
* Copyright 2026 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.FirebaseInstallationsError = exports.installationsClientErrorCode = exports.InstallationsErrorCode = void 0;
|
|
20
|
+
const error_1 = require("../utils/error");
|
|
21
|
+
/**
|
|
22
|
+
* The constant mapping for valid Installations client error codes.
|
|
23
|
+
*/
|
|
24
|
+
exports.InstallationsErrorCode = {
|
|
25
|
+
INVALID_ARGUMENT: 'invalid-argument',
|
|
26
|
+
INVALID_PROJECT_ID: 'invalid-project-id',
|
|
27
|
+
INVALID_INSTALLATION_ID: 'invalid-installation-id',
|
|
28
|
+
API_ERROR: 'api-error',
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Internal Installations client error code mapping used to construct ErrorInfo.
|
|
32
|
+
*/
|
|
33
|
+
exports.installationsClientErrorCode = {
|
|
34
|
+
INVALID_ARGUMENT: {
|
|
35
|
+
code: exports.InstallationsErrorCode.INVALID_ARGUMENT,
|
|
36
|
+
message: 'Invalid argument provided.',
|
|
37
|
+
},
|
|
38
|
+
INVALID_PROJECT_ID: {
|
|
39
|
+
code: exports.InstallationsErrorCode.INVALID_PROJECT_ID,
|
|
40
|
+
message: 'Invalid project ID provided.',
|
|
41
|
+
},
|
|
42
|
+
INVALID_INSTALLATION_ID: {
|
|
43
|
+
code: exports.InstallationsErrorCode.INVALID_INSTALLATION_ID,
|
|
44
|
+
message: 'Invalid installation ID provided.',
|
|
45
|
+
},
|
|
46
|
+
API_ERROR: {
|
|
47
|
+
code: exports.InstallationsErrorCode.API_ERROR,
|
|
48
|
+
message: 'Installation ID API call failed.',
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Firebase Installations error code structure. This extends `FirebaseError`.
|
|
53
|
+
*/
|
|
54
|
+
class FirebaseInstallationsError extends error_1.FirebaseError {
|
|
55
|
+
/**
|
|
56
|
+
*
|
|
57
|
+
* @param info - The error code info.
|
|
58
|
+
* @param message - The error message. This will override the default
|
|
59
|
+
* message if provided.
|
|
60
|
+
*/
|
|
61
|
+
constructor(info, message) {
|
|
62
|
+
// Override default message if custom message provided.
|
|
63
|
+
super({
|
|
64
|
+
code: `installations/${info.code}`,
|
|
65
|
+
message: message || info.message,
|
|
66
|
+
httpResponse: info.httpResponse,
|
|
67
|
+
cause: info.cause,
|
|
68
|
+
});
|
|
69
|
+
/** @internal */
|
|
70
|
+
this.codePrefix = 'installations';
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.FirebaseInstallationsError = FirebaseInstallationsError;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v14.0.0 */
|
|
2
2
|
/*!
|
|
3
3
|
* Copyright 2021 Google LLC
|
|
4
4
|
*
|
|
@@ -50,4 +50,4 @@ export { Installations };
|
|
|
50
50
|
* provided app.
|
|
51
51
|
*/
|
|
52
52
|
export declare function getInstallations(app?: App): Installations;
|
|
53
|
-
export { FirebaseInstallationsError,
|
|
53
|
+
export { FirebaseInstallationsError, InstallationsErrorCode, } from './error';
|