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
|
|
@@ -20,9 +20,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
20
20
|
exports.EventarcApiClient = void 0;
|
|
21
21
|
const validator = require("../utils/validator");
|
|
22
22
|
const eventarc_utils_1 = require("./eventarc-utils");
|
|
23
|
+
const error_1 = require("./error");
|
|
23
24
|
const api_request_1 = require("../utils/api-request");
|
|
24
25
|
const utils = require("../utils");
|
|
25
|
-
const
|
|
26
|
+
const error_2 = require("../utils/error");
|
|
26
27
|
const EVENTARC_API = 'https://eventarcpublishing.googleapis.com/v1';
|
|
27
28
|
const FIREBASE_VERSION_HEADER = {
|
|
28
29
|
'X-Firebase-Client': `fire-admin-node/${utils.getSdkVersion()}`,
|
|
@@ -39,7 +40,10 @@ class EventarcApiClient {
|
|
|
39
40
|
this.app = app;
|
|
40
41
|
this.channel = channel;
|
|
41
42
|
if (!validator.isNonNullObject(app) || !('options' in app)) {
|
|
42
|
-
throw new
|
|
43
|
+
throw new error_1.FirebaseEventarcError({
|
|
44
|
+
code: 'invalid-argument',
|
|
45
|
+
message: 'First argument passed to Channel() must be a valid Eventarc service instance.'
|
|
46
|
+
});
|
|
43
47
|
}
|
|
44
48
|
this.httpClient = new api_request_1.AuthorizedHttpClient(app);
|
|
45
49
|
this.resolvedChannelName = this.resolveChannelName(channel.name);
|
|
@@ -51,9 +55,12 @@ class EventarcApiClient {
|
|
|
51
55
|
return utils.findProjectId(this.app)
|
|
52
56
|
.then((projectId) => {
|
|
53
57
|
if (!validator.isNonEmptyString(projectId)) {
|
|
54
|
-
throw new
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
throw new error_1.FirebaseEventarcError({
|
|
59
|
+
code: 'unknown-error',
|
|
60
|
+
message: 'Failed to determine project ID. Initialize the '
|
|
61
|
+
+ 'SDK with service account credentials or set project ID as an app option. '
|
|
62
|
+
+ 'Alternatively, set the GOOGLE_CLOUD_PROJECT environment variable.'
|
|
63
|
+
});
|
|
57
64
|
}
|
|
58
65
|
this.projectId = projectId;
|
|
59
66
|
return projectId;
|
|
@@ -100,11 +107,16 @@ class EventarcApiClient {
|
|
|
100
107
|
});
|
|
101
108
|
}
|
|
102
109
|
toFirebaseError(err) {
|
|
103
|
-
if (err instanceof
|
|
110
|
+
if (err instanceof error_2.FirebaseError) {
|
|
104
111
|
return err;
|
|
105
112
|
}
|
|
106
113
|
const response = err.response;
|
|
107
|
-
return new
|
|
114
|
+
return new error_1.FirebaseEventarcError({
|
|
115
|
+
code: 'unknown-error',
|
|
116
|
+
message: `Unexpected response with status: ${response.status}.`,
|
|
117
|
+
httpResponse: (0, error_2.toHttpResponse)(response),
|
|
118
|
+
cause: err,
|
|
119
|
+
});
|
|
108
120
|
}
|
|
109
121
|
resolveChannelName(name) {
|
|
110
122
|
if (!name.includes('/')) {
|
|
@@ -115,7 +127,10 @@ class EventarcApiClient {
|
|
|
115
127
|
else {
|
|
116
128
|
const match = CHANNEL_NAME_REGEX.exec(name);
|
|
117
129
|
if (match === null || match.length < 4) {
|
|
118
|
-
throw new
|
|
130
|
+
throw new error_1.FirebaseEventarcError({
|
|
131
|
+
code: 'invalid-argument',
|
|
132
|
+
message: 'Invalid channel name format.'
|
|
133
|
+
});
|
|
119
134
|
}
|
|
120
135
|
const projectId = match[2];
|
|
121
136
|
const location = match[3];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v14.0.0 */
|
|
2
2
|
/*!
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2022 Google LLC
|
|
@@ -15,17 +15,5 @@
|
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { PrefixedFirebaseError } from '../utils/error';
|
|
19
18
|
import { CloudEvent } from './cloudevent';
|
|
20
|
-
export type EventarcErrorCode = 'unknown-error' | 'invalid-argument';
|
|
21
|
-
/**
|
|
22
|
-
* Firebase Eventarc error code structure. This extends PrefixedFirebaseError.
|
|
23
|
-
*
|
|
24
|
-
* @param code - The error code.
|
|
25
|
-
* @param message - The error message.
|
|
26
|
-
* @constructor
|
|
27
|
-
*/
|
|
28
|
-
export declare class FirebaseEventarcError extends PrefixedFirebaseError {
|
|
29
|
-
constructor(code: EventarcErrorCode, message: string);
|
|
30
|
-
}
|
|
31
19
|
export declare function toCloudEventProtoFormat(ce: CloudEvent): any;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v14.0.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* @license
|
|
@@ -17,45 +17,40 @@
|
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.FirebaseEventarcError = void 0;
|
|
21
20
|
exports.toCloudEventProtoFormat = toCloudEventProtoFormat;
|
|
22
|
-
const error_1 = require("
|
|
23
|
-
const uuid_1 = require("uuid");
|
|
21
|
+
const error_1 = require("./error");
|
|
24
22
|
const validator = require("../utils/validator");
|
|
23
|
+
const node_crypto_1 = require("node:crypto");
|
|
25
24
|
// List of CloudEvent properties that are handled "by hand" and should be skipped by
|
|
26
25
|
// automatic attribute copy.
|
|
27
26
|
const TOP_LEVEL_CE_ATTRS = ['id', 'type', 'specversion', 'source', 'data', 'time', 'datacontenttype', 'subject'];
|
|
28
|
-
/**
|
|
29
|
-
* Firebase Eventarc error code structure. This extends PrefixedFirebaseError.
|
|
30
|
-
*
|
|
31
|
-
* @param code - The error code.
|
|
32
|
-
* @param message - The error message.
|
|
33
|
-
* @constructor
|
|
34
|
-
*/
|
|
35
|
-
class FirebaseEventarcError extends error_1.PrefixedFirebaseError {
|
|
36
|
-
constructor(code, message) {
|
|
37
|
-
super('eventarc', code, message);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
exports.FirebaseEventarcError = FirebaseEventarcError;
|
|
41
27
|
function toCloudEventProtoFormat(ce) {
|
|
42
28
|
const source = ce.source ?? process.env.EVENTARC_CLOUD_EVENT_SOURCE;
|
|
43
29
|
if (typeof source === 'undefined' || !validator.isNonEmptyString(source)) {
|
|
44
|
-
throw new FirebaseEventarcError(
|
|
30
|
+
throw new error_1.FirebaseEventarcError({
|
|
31
|
+
code: 'invalid-argument',
|
|
32
|
+
message: "CloudEvent 'source' is required."
|
|
33
|
+
});
|
|
45
34
|
}
|
|
46
35
|
if (!validator.isNonEmptyString(ce.type)) {
|
|
47
|
-
throw new FirebaseEventarcError(
|
|
36
|
+
throw new error_1.FirebaseEventarcError({
|
|
37
|
+
code: 'invalid-argument',
|
|
38
|
+
message: "CloudEvent 'type' is required."
|
|
39
|
+
});
|
|
48
40
|
}
|
|
49
41
|
const out = {
|
|
50
42
|
'@type': 'type.googleapis.com/io.cloudevents.v1.CloudEvent',
|
|
51
|
-
'id': ce.id ?? (0,
|
|
43
|
+
'id': ce.id ?? (0, node_crypto_1.randomUUID)(),
|
|
52
44
|
'type': ce.type,
|
|
53
45
|
'specVersion': ce.specversion ?? '1.0',
|
|
54
46
|
'source': source
|
|
55
47
|
};
|
|
56
48
|
if (typeof ce.time !== 'undefined') {
|
|
57
49
|
if (!validator.isISODateString(ce.time)) {
|
|
58
|
-
throw new FirebaseEventarcError(
|
|
50
|
+
throw new error_1.FirebaseEventarcError({
|
|
51
|
+
code: 'invalid-argument',
|
|
52
|
+
message: "CloudEvent 'tyme' must be in ISO date format."
|
|
53
|
+
});
|
|
59
54
|
}
|
|
60
55
|
setAttribute(out, 'time', {
|
|
61
56
|
'ceTimestamp': ce.time
|
|
@@ -68,7 +63,10 @@ function toCloudEventProtoFormat(ce) {
|
|
|
68
63
|
}
|
|
69
64
|
if (typeof ce.datacontenttype !== 'undefined') {
|
|
70
65
|
if (!validator.isNonEmptyString(ce.datacontenttype)) {
|
|
71
|
-
throw new FirebaseEventarcError(
|
|
66
|
+
throw new error_1.FirebaseEventarcError({
|
|
67
|
+
code: 'invalid-argument',
|
|
68
|
+
message: "CloudEvent 'datacontenttype' if specified must be non-empty string."
|
|
69
|
+
});
|
|
72
70
|
}
|
|
73
71
|
setAttribute(out, 'datacontenttype', {
|
|
74
72
|
'ceString': ce.datacontenttype
|
|
@@ -76,14 +74,20 @@ function toCloudEventProtoFormat(ce) {
|
|
|
76
74
|
}
|
|
77
75
|
if (ce.subject) {
|
|
78
76
|
if (!validator.isNonEmptyString(ce.subject)) {
|
|
79
|
-
throw new FirebaseEventarcError(
|
|
77
|
+
throw new error_1.FirebaseEventarcError({
|
|
78
|
+
code: 'invalid-argument',
|
|
79
|
+
message: "CloudEvent 'subject' if specified must be non-empty string."
|
|
80
|
+
});
|
|
80
81
|
}
|
|
81
82
|
setAttribute(out, 'subject', {
|
|
82
83
|
'ceString': ce.subject
|
|
83
84
|
});
|
|
84
85
|
}
|
|
85
86
|
if (typeof ce.data === 'undefined') {
|
|
86
|
-
throw new FirebaseEventarcError(
|
|
87
|
+
throw new error_1.FirebaseEventarcError({
|
|
88
|
+
code: 'invalid-argument',
|
|
89
|
+
message: "CloudEvent 'data' is required."
|
|
90
|
+
});
|
|
87
91
|
}
|
|
88
92
|
if (validator.isObject(ce.data)) {
|
|
89
93
|
out['textData'] = JSON.stringify(ce.data);
|
|
@@ -102,14 +106,20 @@ function toCloudEventProtoFormat(ce) {
|
|
|
102
106
|
}
|
|
103
107
|
}
|
|
104
108
|
else {
|
|
105
|
-
throw new FirebaseEventarcError(
|
|
109
|
+
throw new error_1.FirebaseEventarcError({
|
|
110
|
+
code: 'invalid-argument',
|
|
111
|
+
message: `CloudEvent 'data' must be string or an object (which are converted to JSON), got '${typeof ce.data}'.`
|
|
112
|
+
});
|
|
106
113
|
}
|
|
107
114
|
for (const attr in ce) {
|
|
108
115
|
if (TOP_LEVEL_CE_ATTRS.includes(attr)) {
|
|
109
116
|
continue;
|
|
110
117
|
}
|
|
111
118
|
if (!validator.isNonEmptyString(ce[attr])) {
|
|
112
|
-
throw new FirebaseEventarcError(
|
|
119
|
+
throw new error_1.FirebaseEventarcError({
|
|
120
|
+
code: 'invalid-argument',
|
|
121
|
+
message: `CloudEvent extension attributes ('${attr}') must be string.`
|
|
122
|
+
});
|
|
113
123
|
}
|
|
114
124
|
setAttribute(out, attr, {
|
|
115
125
|
'ceString': ce[attr]
|
package/lib/eventarc/eventarc.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v14.0.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* @license
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
20
|
exports.Channel = exports.Eventarc = void 0;
|
|
21
21
|
const validator = require("../utils/validator");
|
|
22
|
-
const
|
|
22
|
+
const error_1 = require("./error");
|
|
23
23
|
const eventarc_client_internal_1 = require("./eventarc-client-internal");
|
|
24
24
|
/**
|
|
25
25
|
* Eventarc service bound to the provided app.
|
|
@@ -30,7 +30,10 @@ class Eventarc {
|
|
|
30
30
|
*/
|
|
31
31
|
constructor(app) {
|
|
32
32
|
if (!validator.isNonNullObject(app) || !('options' in app)) {
|
|
33
|
-
throw new
|
|
33
|
+
throw new error_1.FirebaseEventarcError({
|
|
34
|
+
code: 'invalid-argument',
|
|
35
|
+
message: 'First argument passed to Eventarc() must be a valid Firebase app instance.'
|
|
36
|
+
});
|
|
34
37
|
}
|
|
35
38
|
this.appInternal = app;
|
|
36
39
|
}
|
|
@@ -69,7 +72,10 @@ class Eventarc {
|
|
|
69
72
|
allowedEventTypes = opts?.allowedEventTypes;
|
|
70
73
|
}
|
|
71
74
|
else if (typeof opts?.allowedEventTypes !== 'undefined') {
|
|
72
|
-
throw new
|
|
75
|
+
throw new error_1.FirebaseEventarcError({
|
|
76
|
+
code: 'invalid-argument',
|
|
77
|
+
message: 'AllowedEventTypes must be either an array of strings or a comma separated string.'
|
|
78
|
+
});
|
|
73
79
|
}
|
|
74
80
|
return new Channel(this, channel, allowedEventTypes);
|
|
75
81
|
}
|
|
@@ -84,10 +90,16 @@ class Channel {
|
|
|
84
90
|
*/
|
|
85
91
|
constructor(eventarc, name, allowedEventTypes) {
|
|
86
92
|
if (!validator.isNonNullObject(eventarc)) {
|
|
87
|
-
throw new
|
|
93
|
+
throw new error_1.FirebaseEventarcError({
|
|
94
|
+
code: 'invalid-argument',
|
|
95
|
+
message: 'First argument passed to Channel() must be a valid Eventarc service instance.'
|
|
96
|
+
});
|
|
88
97
|
}
|
|
89
98
|
if (!validator.isNonEmptyString(name)) {
|
|
90
|
-
throw new
|
|
99
|
+
throw new error_1.FirebaseEventarcError({
|
|
100
|
+
code: 'invalid-argument',
|
|
101
|
+
message: 'name is required.'
|
|
102
|
+
});
|
|
91
103
|
}
|
|
92
104
|
this.nameInternal = name;
|
|
93
105
|
this.eventarcInternal = eventarc;
|
package/lib/eventarc/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 2022 Google LLC
|
|
@@ -51,3 +51,4 @@ export { Eventarc, Channel, ChannelOptions } from './eventarc';
|
|
|
51
51
|
* app.
|
|
52
52
|
*/
|
|
53
53
|
export declare function getEventarc(app?: App): Eventarc;
|
|
54
|
+
export { FirebaseEventarcError, EventarcErrorCode } from './error';
|
package/lib/eventarc/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.Channel = exports.Eventarc = void 0;
|
|
20
|
+
exports.EventarcErrorCode = exports.FirebaseEventarcError = exports.Channel = exports.Eventarc = void 0;
|
|
21
21
|
exports.getEventarc = getEventarc;
|
|
22
22
|
/**
|
|
23
23
|
* Firebase Eventarc.
|
|
@@ -62,3 +62,6 @@ function getEventarc(app) {
|
|
|
62
62
|
const firebaseApp = app;
|
|
63
63
|
return firebaseApp.getOrInitService('eventarc', (app) => new eventarc_1.Eventarc(app));
|
|
64
64
|
}
|
|
65
|
+
var error_1 = require("./error");
|
|
66
|
+
Object.defineProperty(exports, "FirebaseEventarcError", { enumerable: true, get: function () { return error_1.FirebaseEventarcError; } });
|
|
67
|
+
Object.defineProperty(exports, "EventarcErrorCode", { enumerable: true, get: function () { return error_1.EventarcErrorCode; } });
|
|
@@ -0,0 +1,41 @@
|
|
|
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 Extensions client error codes.
|
|
20
|
+
*/
|
|
21
|
+
export declare const ExtensionsErrorCode: {
|
|
22
|
+
readonly INVALID_ARGUMENT: "invalid-argument";
|
|
23
|
+
readonly NOT_FOUND: "not-found";
|
|
24
|
+
readonly FORBIDDEN: "forbidden";
|
|
25
|
+
readonly INTERNAL_ERROR: "internal-error";
|
|
26
|
+
readonly UNKNOWN_ERROR: "unknown-error";
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The type definition for valid Extensions client error codes.
|
|
30
|
+
*/
|
|
31
|
+
export type ExtensionsErrorCode = typeof ExtensionsErrorCode[keyof typeof ExtensionsErrorCode];
|
|
32
|
+
/**
|
|
33
|
+
* Firebase Extensions error code structure. This extends `FirebaseError`.
|
|
34
|
+
*/
|
|
35
|
+
export declare class FirebaseExtensionsError extends FirebaseError {
|
|
36
|
+
/**
|
|
37
|
+
* @param info - The error code info.
|
|
38
|
+
* @param message - The error message. If provided, this will override the default message.
|
|
39
|
+
*/
|
|
40
|
+
constructor(info: ErrorInfo, message?: string);
|
|
41
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
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.FirebaseExtensionsError = exports.ExtensionsErrorCode = void 0;
|
|
20
|
+
const error_1 = require("../utils/error");
|
|
21
|
+
/**
|
|
22
|
+
* The constant mapping for valid Extensions client error codes.
|
|
23
|
+
*/
|
|
24
|
+
exports.ExtensionsErrorCode = {
|
|
25
|
+
INVALID_ARGUMENT: 'invalid-argument',
|
|
26
|
+
NOT_FOUND: 'not-found',
|
|
27
|
+
FORBIDDEN: 'forbidden',
|
|
28
|
+
INTERNAL_ERROR: 'internal-error',
|
|
29
|
+
UNKNOWN_ERROR: 'unknown-error',
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Firebase Extensions error code structure. This extends `FirebaseError`.
|
|
33
|
+
*/
|
|
34
|
+
class FirebaseExtensionsError extends error_1.FirebaseError {
|
|
35
|
+
/**
|
|
36
|
+
* @param info - The error code info.
|
|
37
|
+
* @param message - The error message. If provided, this will override the default message.
|
|
38
|
+
*/
|
|
39
|
+
constructor(info, message) {
|
|
40
|
+
super({
|
|
41
|
+
code: `Extensions/${info.code}`,
|
|
42
|
+
message: message || info.message,
|
|
43
|
+
httpResponse: info.httpResponse,
|
|
44
|
+
cause: info.cause,
|
|
45
|
+
});
|
|
46
|
+
/** @internal */
|
|
47
|
+
this.codePrefix = 'Extensions';
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.FirebaseExtensionsError = FirebaseExtensionsError;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v14.0.0 */
|
|
2
2
|
/*!
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2022 Google LLC
|
|
@@ -15,16 +15,4 @@
|
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { PrefixedFirebaseError } from '../utils/error';
|
|
19
|
-
type ExtensionsErrorCode = 'invalid-argument' | 'not-found' | 'forbidden' | 'internal-error' | 'unknown-error';
|
|
20
|
-
/**
|
|
21
|
-
* Firebase Extensions error code structure. This extends PrefixedFirebaseError.
|
|
22
|
-
*
|
|
23
|
-
* @param code - The error code.
|
|
24
|
-
* @param message - The error message.
|
|
25
|
-
* @constructor
|
|
26
|
-
*/
|
|
27
|
-
export declare class FirebaseExtensionsError extends PrefixedFirebaseError {
|
|
28
|
-
constructor(code: ExtensionsErrorCode, message: string);
|
|
29
|
-
}
|
|
30
18
|
export {};
|
|
@@ -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,11 @@
|
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.
|
|
20
|
+
exports.ExtensionsApiClient = 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");
|
|
24
|
+
const error_3 = require("../app/error");
|
|
23
25
|
const validator = require("../utils/validator");
|
|
24
26
|
const utils = require("../utils");
|
|
25
27
|
const FIREBASE_FUNCTIONS_CONFIG_HEADERS = {
|
|
@@ -37,7 +39,10 @@ class ExtensionsApiClient {
|
|
|
37
39
|
constructor(app) {
|
|
38
40
|
this.app = app;
|
|
39
41
|
if (!validator.isNonNullObject(app) || !('options' in app)) {
|
|
40
|
-
throw new
|
|
42
|
+
throw new error_3.FirebaseAppError({
|
|
43
|
+
code: 'invalid-argument',
|
|
44
|
+
message: 'First argument passed to getExtensions() must be a valid Firebase app instance.'
|
|
45
|
+
});
|
|
41
46
|
}
|
|
42
47
|
this.httpClient = new api_request_1.AuthorizedHttpClient(this.app);
|
|
43
48
|
}
|
|
@@ -64,42 +69,49 @@ class ExtensionsApiClient {
|
|
|
64
69
|
return `${this.getExtensionsApiUri()}/${EXTENSIONS_API_VERSION}/projects/${projectId}/instances/${instanceId}/runtimeData`;
|
|
65
70
|
}
|
|
66
71
|
toFirebaseError(err) {
|
|
67
|
-
if (err instanceof error_1.
|
|
72
|
+
if (err instanceof error_1.FirebaseError) {
|
|
68
73
|
return err;
|
|
69
74
|
}
|
|
70
75
|
const response = err.response;
|
|
71
76
|
if (!response?.isJson()) {
|
|
72
|
-
return new FirebaseExtensionsError(
|
|
77
|
+
return new error_2.FirebaseExtensionsError({
|
|
78
|
+
code: 'unknown-error',
|
|
79
|
+
message: `Unexpected response with status: ${response.status} and body: ${response.text}`,
|
|
80
|
+
httpResponse: (0, error_1.toHttpResponse)(response),
|
|
81
|
+
cause: err
|
|
82
|
+
});
|
|
73
83
|
}
|
|
74
84
|
const error = response.data?.error;
|
|
75
|
-
const message = error?.message ||
|
|
85
|
+
const message = error?.message || 'Unknown server error';
|
|
76
86
|
switch (error.code) {
|
|
77
87
|
case 403:
|
|
78
|
-
return new FirebaseExtensionsError(
|
|
88
|
+
return new error_2.FirebaseExtensionsError({
|
|
89
|
+
code: 'forbidden',
|
|
90
|
+
message,
|
|
91
|
+
httpResponse: (0, error_1.toHttpResponse)(response),
|
|
92
|
+
cause: err,
|
|
93
|
+
});
|
|
79
94
|
case 404:
|
|
80
|
-
return new FirebaseExtensionsError(
|
|
95
|
+
return new error_2.FirebaseExtensionsError({
|
|
96
|
+
code: 'not-found',
|
|
97
|
+
message,
|
|
98
|
+
httpResponse: (0, error_1.toHttpResponse)(response),
|
|
99
|
+
cause: err,
|
|
100
|
+
});
|
|
81
101
|
case 500:
|
|
82
|
-
return new FirebaseExtensionsError(
|
|
102
|
+
return new error_2.FirebaseExtensionsError({
|
|
103
|
+
code: 'internal-error',
|
|
104
|
+
message,
|
|
105
|
+
httpResponse: (0, error_1.toHttpResponse)(response),
|
|
106
|
+
cause: err,
|
|
107
|
+
});
|
|
83
108
|
}
|
|
84
|
-
return new FirebaseExtensionsError(
|
|
109
|
+
return new error_2.FirebaseExtensionsError({
|
|
110
|
+
code: 'unknown-error',
|
|
111
|
+
message,
|
|
112
|
+
httpResponse: (0, error_1.toHttpResponse)(response),
|
|
113
|
+
cause: err,
|
|
114
|
+
});
|
|
85
115
|
}
|
|
86
116
|
}
|
|
87
117
|
exports.ExtensionsApiClient = ExtensionsApiClient;
|
|
88
|
-
/**
|
|
89
|
-
* Firebase Extensions error code structure. This extends PrefixedFirebaseError.
|
|
90
|
-
*
|
|
91
|
-
* @param code - The error code.
|
|
92
|
-
* @param message - The error message.
|
|
93
|
-
* @constructor
|
|
94
|
-
*/
|
|
95
|
-
class FirebaseExtensionsError extends error_1.PrefixedFirebaseError {
|
|
96
|
-
constructor(code, message) {
|
|
97
|
-
super('Extensions', code, message);
|
|
98
|
-
/* tslint:disable:max-line-length */
|
|
99
|
-
// Set the prototype explicitly. See the following link for more details:
|
|
100
|
-
// https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
|
|
101
|
-
/* tslint:enable:max-line-length */
|
|
102
|
-
this.__proto__ = FirebaseExtensionsError.prototype;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
exports.FirebaseExtensionsError = FirebaseExtensionsError;
|
|
@@ -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.Runtime = exports.Extensions = void 0;
|
|
21
21
|
const extensions_api_client_internal_1 = require("./extensions-api-client-internal");
|
|
22
|
+
const error_1 = require("./error");
|
|
22
23
|
const validator = require("../utils/validator");
|
|
23
24
|
/**
|
|
24
25
|
* The Firebase `Extensions` service interface.
|
|
@@ -58,11 +59,17 @@ class Runtime {
|
|
|
58
59
|
constructor(client) {
|
|
59
60
|
this.projectId = this.getProjectId();
|
|
60
61
|
if (!validator.isNonEmptyString(process.env['EXT_INSTANCE_ID'])) {
|
|
61
|
-
throw new
|
|
62
|
+
throw new error_1.FirebaseExtensionsError({
|
|
63
|
+
code: 'invalid-argument',
|
|
64
|
+
message: 'Runtime is only available from within a running Extension instance.'
|
|
65
|
+
});
|
|
62
66
|
}
|
|
63
67
|
this.extensionInstanceId = process.env['EXT_INSTANCE_ID'];
|
|
64
68
|
if (!validator.isNonNullObject(client) || !('updateRuntimeData' in client)) {
|
|
65
|
-
throw new
|
|
69
|
+
throw new error_1.FirebaseExtensionsError({
|
|
70
|
+
code: 'invalid-argument',
|
|
71
|
+
message: 'Must provide a valid ExtensionsApiClient instance to create a new Runtime.'
|
|
72
|
+
});
|
|
66
73
|
}
|
|
67
74
|
this.client = client;
|
|
68
75
|
}
|
|
@@ -103,7 +110,10 @@ class Runtime {
|
|
|
103
110
|
*/
|
|
104
111
|
async setFatalError(errorMessage) {
|
|
105
112
|
if (!validator.isNonEmptyString(errorMessage)) {
|
|
106
|
-
throw new
|
|
113
|
+
throw new error_1.FirebaseExtensionsError({
|
|
114
|
+
code: 'invalid-argument',
|
|
115
|
+
message: 'errorMessage must not be empty'
|
|
116
|
+
});
|
|
107
117
|
}
|
|
108
118
|
await this.client.updateRuntimeData(this.projectId, this.extensionInstanceId, {
|
|
109
119
|
fatalError: {
|
|
@@ -114,7 +124,10 @@ class Runtime {
|
|
|
114
124
|
getProjectId() {
|
|
115
125
|
const projectId = process.env['PROJECT_ID'];
|
|
116
126
|
if (!validator.isNonEmptyString(projectId)) {
|
|
117
|
-
throw new
|
|
127
|
+
throw new error_1.FirebaseExtensionsError({
|
|
128
|
+
code: 'invalid-argument',
|
|
129
|
+
message: 'PROJECT_ID must not be undefined in Extensions runtime environment'
|
|
130
|
+
});
|
|
118
131
|
}
|
|
119
132
|
return projectId;
|
|
120
133
|
}
|
|
@@ -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 { SettableProcessingState } from './extensions-api';
|
|
|
51
51
|
* service associated with the provided app.
|
|
52
52
|
*/
|
|
53
53
|
export declare function getExtensions(app?: App): Extensions;
|
|
54
|
+
export { FirebaseExtensionsError, ExtensionsErrorCode } from './error';
|
package/lib/extensions/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.Runtime = exports.Extensions = void 0;
|
|
20
|
+
exports.ExtensionsErrorCode = exports.FirebaseExtensionsError = exports.Runtime = exports.Extensions = void 0;
|
|
21
21
|
exports.getExtensions = getExtensions;
|
|
22
22
|
/**
|
|
23
23
|
* Firebase Extensions service.
|
|
@@ -62,3 +62,6 @@ function getExtensions(app) {
|
|
|
62
62
|
const firebaseApp = app;
|
|
63
63
|
return firebaseApp.getOrInitService('extensions', (app) => new extensions_1.Extensions(app));
|
|
64
64
|
}
|
|
65
|
+
var error_1 = require("./error");
|
|
66
|
+
Object.defineProperty(exports, "FirebaseExtensionsError", { enumerable: true, get: function () { return error_1.FirebaseExtensionsError; } });
|
|
67
|
+
Object.defineProperty(exports, "ExtensionsErrorCode", { enumerable: true, get: function () { return error_1.ExtensionsErrorCode; } });
|