firebase-functions 6.6.0 → 7.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/_virtual/rolldown_runtime.js +34 -0
- package/lib/bin/firebase-functions.js +78 -103
- package/lib/common/app.js +35 -55
- package/lib/common/change.js +54 -75
- package/lib/common/config.js +41 -41
- package/lib/common/debug.js +23 -47
- package/lib/common/encoding.js +59 -82
- package/lib/common/onInit.js +26 -28
- package/lib/common/options.js +22 -42
- package/lib/common/params.d.ts +6 -6
- package/lib/common/params.js +0 -23
- package/lib/common/providers/database.js +270 -300
- package/lib/common/providers/firestore.js +66 -92
- package/lib/common/providers/https.d.ts +0 -1
- package/lib/common/providers/https.js +537 -539
- package/lib/common/providers/identity.js +393 -444
- package/lib/common/providers/tasks.js +64 -98
- package/lib/common/timezone.js +544 -542
- package/lib/common/trace.d.ts +0 -1
- package/lib/common/trace.js +63 -55
- package/lib/common/utilities/assertions.d.ts +11 -0
- package/lib/common/utilities/assertions.js +18 -0
- package/lib/common/utilities/encoder.js +20 -37
- package/lib/common/utilities/path-pattern.js +106 -132
- package/lib/common/utilities/path.js +28 -27
- package/lib/common/utilities/utils.js +23 -45
- package/lib/esm/_virtual/rolldown_runtime.mjs +16 -0
- package/lib/esm/bin/firebase-functions.mjs +91 -0
- package/lib/esm/common/app.mjs +39 -0
- package/lib/esm/common/change.mjs +57 -0
- package/lib/esm/common/config.mjs +45 -0
- package/lib/esm/common/debug.mjs +28 -0
- package/lib/esm/common/encoding.mjs +69 -0
- package/lib/esm/common/onInit.mjs +33 -0
- package/lib/esm/common/options.mjs +22 -0
- package/lib/esm/common/params.mjs +1 -0
- package/lib/esm/common/providers/database.mjs +269 -0
- package/lib/esm/common/providers/firestore.mjs +78 -0
- package/lib/esm/common/providers/https.mjs +573 -0
- package/lib/esm/common/providers/identity.mjs +428 -0
- package/lib/esm/common/providers/tasks.mjs +67 -0
- package/lib/esm/common/timezone.mjs +544 -0
- package/lib/esm/common/trace.mjs +73 -0
- package/lib/esm/common/utilities/assertions.mjs +17 -0
- package/lib/esm/common/utilities/encoder.mjs +21 -0
- package/lib/esm/common/utilities/path-pattern.mjs +116 -0
- package/lib/esm/common/utilities/path.mjs +35 -0
- package/lib/esm/common/utilities/utils.mjs +29 -0
- package/lib/esm/function-configuration.mjs +1 -0
- package/lib/esm/logger/common.mjs +23 -0
- package/lib/esm/logger/compat.mjs +25 -0
- package/lib/esm/logger/index.mjs +131 -0
- package/lib/esm/params/index.mjs +160 -0
- package/lib/esm/params/types.mjs +400 -0
- package/lib/esm/runtime/loader.mjs +132 -0
- package/lib/esm/runtime/manifest.mjs +134 -0
- package/lib/esm/types/global.d.mjs +1 -0
- package/lib/esm/v1/cloud-functions.mjs +206 -0
- package/lib/esm/v1/config.mjs +14 -0
- package/lib/esm/v1/function-builder.mjs +252 -0
- package/lib/esm/v1/function-configuration.mjs +72 -0
- package/lib/esm/v1/index.mjs +27 -0
- package/lib/esm/v1/providers/analytics.mjs +212 -0
- package/lib/esm/v1/providers/auth.mjs +156 -0
- package/lib/esm/v1/providers/database.mjs +243 -0
- package/lib/esm/v1/providers/firestore.mjs +131 -0
- package/lib/esm/v1/providers/https.mjs +82 -0
- package/lib/esm/v1/providers/pubsub.mjs +175 -0
- package/lib/esm/v1/providers/remoteConfig.mjs +64 -0
- package/lib/esm/v1/providers/storage.mjs +163 -0
- package/lib/esm/v1/providers/tasks.mjs +63 -0
- package/lib/esm/v1/providers/testLab.mjs +94 -0
- package/lib/esm/v2/core.mjs +4 -0
- package/lib/esm/v2/index.mjs +28 -0
- package/lib/esm/v2/options.mjs +102 -0
- package/lib/esm/v2/providers/alerts/alerts.mjs +85 -0
- package/lib/esm/v2/providers/alerts/appDistribution.mjs +75 -0
- package/lib/esm/v2/providers/alerts/billing.mjs +51 -0
- package/lib/esm/v2/providers/alerts/crashlytics.mjs +122 -0
- package/lib/esm/v2/providers/alerts/index.mjs +22 -0
- package/lib/esm/v2/providers/alerts/performance.mjs +66 -0
- package/lib/esm/v2/providers/database.mjs +197 -0
- package/lib/esm/v2/providers/dataconnect.mjs +130 -0
- package/lib/esm/v2/providers/eventarc.mjs +51 -0
- package/lib/esm/v2/providers/firestore.mjs +294 -0
- package/lib/esm/v2/providers/https.mjs +210 -0
- package/lib/esm/v2/providers/identity.mjs +103 -0
- package/lib/esm/v2/providers/pubsub.mjs +148 -0
- package/lib/esm/v2/providers/remoteConfig.mjs +52 -0
- package/lib/esm/v2/providers/scheduler.mjs +84 -0
- package/lib/esm/v2/providers/storage.mjs +155 -0
- package/lib/esm/v2/providers/tasks.mjs +65 -0
- package/lib/esm/v2/providers/testLab.mjs +53 -0
- package/lib/esm/v2/trace.mjs +20 -0
- package/lib/function-configuration.d.ts +0 -0
- package/lib/function-configuration.js +0 -0
- package/lib/logger/common.js +21 -41
- package/lib/logger/compat.js +18 -33
- package/lib/logger/index.js +119 -130
- package/lib/params/index.d.ts +4 -2
- package/lib/params/index.js +150 -144
- package/lib/params/types.js +389 -423
- package/lib/runtime/loader.js +114 -148
- package/lib/runtime/manifest.js +106 -126
- package/lib/types/global.d.js +0 -0
- package/lib/v1/cloud-functions.d.ts +2 -2
- package/lib/v1/cloud-functions.js +193 -241
- package/lib/v1/config.d.ts +4 -7
- package/lib/v1/config.js +13 -75
- package/lib/v1/function-builder.js +239 -368
- package/lib/v1/function-configuration.js +70 -63
- package/lib/v1/index.js +118 -73
- package/lib/v1/providers/analytics.js +188 -235
- package/lib/v1/providers/auth.d.ts +2 -1
- package/lib/v1/providers/auth.js +159 -164
- package/lib/v1/providers/database.js +237 -242
- package/lib/v1/providers/firestore.js +131 -130
- package/lib/v1/providers/https.d.ts +2 -1
- package/lib/v1/providers/https.js +79 -86
- package/lib/v1/providers/pubsub.js +175 -172
- package/lib/v1/providers/remoteConfig.js +64 -68
- package/lib/v1/providers/storage.js +161 -163
- package/lib/v1/providers/tasks.d.ts +1 -1
- package/lib/v1/providers/tasks.js +65 -80
- package/lib/v1/providers/testLab.js +94 -94
- package/lib/v2/core.d.ts +1 -1
- package/lib/v2/core.js +5 -32
- package/lib/v2/index.d.ts +6 -3
- package/lib/v2/index.js +123 -75
- package/lib/v2/options.js +88 -114
- package/lib/v2/providers/alerts/alerts.js +76 -95
- package/lib/v2/providers/alerts/appDistribution.js +73 -78
- package/lib/v2/providers/alerts/billing.js +49 -53
- package/lib/v2/providers/alerts/crashlytics.js +110 -102
- package/lib/v2/providers/alerts/index.js +56 -53
- package/lib/v2/providers/alerts/performance.js +64 -74
- package/lib/v2/providers/database.js +177 -180
- package/lib/v2/providers/dataconnect.d.ts +95 -0
- package/lib/v2/providers/dataconnect.js +137 -0
- package/lib/v2/providers/eventarc.js +55 -77
- package/lib/v2/providers/firestore.js +262 -260
- package/lib/v2/providers/https.d.ts +3 -2
- package/lib/v2/providers/https.js +210 -247
- package/lib/v2/providers/identity.d.ts +2 -1
- package/lib/v2/providers/identity.js +96 -105
- package/lib/v2/providers/pubsub.js +149 -167
- package/lib/v2/providers/remoteConfig.js +54 -63
- package/lib/v2/providers/scheduler.js +84 -96
- package/lib/v2/providers/storage.js +147 -162
- package/lib/v2/providers/tasks.d.ts +1 -1
- package/lib/v2/providers/tasks.js +68 -95
- package/lib/v2/providers/testLab.js +55 -64
- package/lib/v2/trace.js +18 -19
- package/package.json +321 -88
- package/protos/compiledFirestore.mjs +3512 -0
- package/protos/update.sh +28 -7
|
@@ -1,150 +1,151 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const path_1 = require("path");
|
|
26
|
-
const change_1 = require("../../common/change");
|
|
27
|
-
const firestore_1 = require("../../common/providers/firestore");
|
|
28
|
-
const cloud_functions_1 = require("../cloud-functions");
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.js');
|
|
2
|
+
const require_common_change = require('../../common/change.js');
|
|
3
|
+
const require_v1_cloud_functions = require('../cloud-functions.js');
|
|
4
|
+
const require_common_providers_firestore = require('../../common/providers/firestore.js');
|
|
5
|
+
let path = require("path");
|
|
6
|
+
path = require_rolldown_runtime.__toESM(path);
|
|
7
|
+
|
|
8
|
+
//#region src/v1/providers/firestore.ts
|
|
9
|
+
var firestore_exports = /* @__PURE__ */ require_rolldown_runtime.__export({
|
|
10
|
+
DatabaseBuilder: () => DatabaseBuilder,
|
|
11
|
+
DocumentBuilder: () => DocumentBuilder,
|
|
12
|
+
NamespaceBuilder: () => NamespaceBuilder,
|
|
13
|
+
_databaseWithOptions: () => _databaseWithOptions,
|
|
14
|
+
_documentWithOptions: () => _documentWithOptions,
|
|
15
|
+
_namespaceWithOptions: () => _namespaceWithOptions,
|
|
16
|
+
beforeSnapshotConstructor: () => beforeSnapshotConstructor,
|
|
17
|
+
database: () => database,
|
|
18
|
+
defaultDatabase: () => defaultDatabase,
|
|
19
|
+
document: () => document,
|
|
20
|
+
namespace: () => namespace,
|
|
21
|
+
provider: () => provider,
|
|
22
|
+
service: () => service,
|
|
23
|
+
snapshotConstructor: () => snapshotConstructor
|
|
24
|
+
});
|
|
29
25
|
/** @internal */
|
|
30
|
-
|
|
26
|
+
const provider = "google.firestore";
|
|
31
27
|
/** @internal */
|
|
32
|
-
|
|
28
|
+
const service = "firestore.googleapis.com";
|
|
33
29
|
/** @internal */
|
|
34
|
-
|
|
30
|
+
const defaultDatabase = "(default)";
|
|
35
31
|
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
function document(path) {
|
|
43
|
-
|
|
32
|
+
* Select the Firestore document to listen to for events.
|
|
33
|
+
* @param path Full database path to listen to. This includes the name of
|
|
34
|
+
* the collection that the document is a part of. For example, if the
|
|
35
|
+
* collection is named "users" and the document is named "Ada", then the
|
|
36
|
+
* path is "/users/Ada".
|
|
37
|
+
*/
|
|
38
|
+
function document(path$1) {
|
|
39
|
+
return _documentWithOptions(path$1, {});
|
|
44
40
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
function namespace(namespace) {
|
|
48
|
-
return _namespaceWithOptions(namespace, {});
|
|
41
|
+
function namespace(namespace$1) {
|
|
42
|
+
return _namespaceWithOptions(namespace$1, {});
|
|
49
43
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
function database(database) {
|
|
53
|
-
return _databaseWithOptions(database, {});
|
|
44
|
+
function database(database$1) {
|
|
45
|
+
return _databaseWithOptions(database$1, {});
|
|
54
46
|
}
|
|
55
|
-
exports.database = database;
|
|
56
47
|
/** @internal */
|
|
57
|
-
function _databaseWithOptions(database =
|
|
58
|
-
|
|
48
|
+
function _databaseWithOptions(database$1 = defaultDatabase, options) {
|
|
49
|
+
return new DatabaseBuilder(database$1, options);
|
|
59
50
|
}
|
|
60
|
-
exports._databaseWithOptions = _databaseWithOptions;
|
|
61
51
|
/** @internal */
|
|
62
|
-
function _namespaceWithOptions(namespace, options) {
|
|
63
|
-
|
|
52
|
+
function _namespaceWithOptions(namespace$1, options) {
|
|
53
|
+
return _databaseWithOptions(defaultDatabase, options).namespace(namespace$1);
|
|
64
54
|
}
|
|
65
|
-
exports._namespaceWithOptions = _namespaceWithOptions;
|
|
66
55
|
/** @internal */
|
|
67
|
-
function _documentWithOptions(path, options) {
|
|
68
|
-
|
|
56
|
+
function _documentWithOptions(path$1, options) {
|
|
57
|
+
return _databaseWithOptions(defaultDatabase, options).document(path$1);
|
|
69
58
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
exports.NamespaceBuilder = NamespaceBuilder;
|
|
59
|
+
var DatabaseBuilder = class {
|
|
60
|
+
constructor(database$1, options) {
|
|
61
|
+
this.database = database$1;
|
|
62
|
+
this.options = options;
|
|
63
|
+
}
|
|
64
|
+
namespace(namespace$1) {
|
|
65
|
+
return new NamespaceBuilder(this.database, this.options, namespace$1);
|
|
66
|
+
}
|
|
67
|
+
document(path$1) {
|
|
68
|
+
return new NamespaceBuilder(this.database, this.options).document(path$1);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
var NamespaceBuilder = class {
|
|
72
|
+
constructor(database$1, options, namespace$1) {
|
|
73
|
+
this.database = database$1;
|
|
74
|
+
this.options = options;
|
|
75
|
+
this.namespace = namespace$1;
|
|
76
|
+
}
|
|
77
|
+
document(path$1) {
|
|
78
|
+
return new DocumentBuilder(() => {
|
|
79
|
+
if (!process.env.GCLOUD_PROJECT) {
|
|
80
|
+
throw new Error("process.env.GCLOUD_PROJECT is not set.");
|
|
81
|
+
}
|
|
82
|
+
const database$1 = path.posix.join("projects", process.env.GCLOUD_PROJECT, "databases", this.database);
|
|
83
|
+
return path.posix.join(database$1, this.namespace ? `documents@${this.namespace}` : "documents", path$1);
|
|
84
|
+
}, this.options);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
101
87
|
function snapshotConstructor(event) {
|
|
102
|
-
|
|
103
|
-
return (0, firestore_1.createSnapshotFromJson)(event.data, event.context.resource.name, (_b = (_a = event === null || event === void 0 ? void 0 : event.data) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.readTime, (_d = (_c = event === null || event === void 0 ? void 0 : event.data) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.updateTime);
|
|
88
|
+
return require_common_providers_firestore.createSnapshotFromJson(event.data, event.context.resource.name, event?.data?.value?.readTime, event?.data?.value?.updateTime);
|
|
104
89
|
}
|
|
105
|
-
exports.snapshotConstructor = snapshotConstructor;
|
|
106
|
-
// TODO remove this function when wire format changes to new format
|
|
107
90
|
function beforeSnapshotConstructor(event) {
|
|
108
|
-
|
|
109
|
-
return (0, firestore_1.createBeforeSnapshotFromJson)(event.data, event.context.resource.name, (_b = (_a = event === null || event === void 0 ? void 0 : event.data) === null || _a === void 0 ? void 0 : _a.oldValue) === null || _b === void 0 ? void 0 : _b.readTime, undefined);
|
|
91
|
+
return require_common_providers_firestore.createBeforeSnapshotFromJson(event.data, event.context.resource.name, event?.data?.oldValue?.readTime, undefined);
|
|
110
92
|
}
|
|
111
|
-
exports.beforeSnapshotConstructor = beforeSnapshotConstructor;
|
|
112
93
|
function changeConstructor(raw) {
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
class DocumentBuilder {
|
|
116
|
-
constructor(triggerResource, options) {
|
|
117
|
-
this.triggerResource = triggerResource;
|
|
118
|
-
this.options = options;
|
|
119
|
-
// TODO what validation do we want to do here?
|
|
120
|
-
}
|
|
121
|
-
/** Respond to all document writes (creates, updates, or deletes). */
|
|
122
|
-
onWrite(handler) {
|
|
123
|
-
return this.onOperation(handler, "document.write", changeConstructor);
|
|
124
|
-
}
|
|
125
|
-
/** Respond only to document updates. */
|
|
126
|
-
onUpdate(handler) {
|
|
127
|
-
return this.onOperation(handler, "document.update", changeConstructor);
|
|
128
|
-
}
|
|
129
|
-
/** Respond only to document creations. */
|
|
130
|
-
onCreate(handler) {
|
|
131
|
-
return this.onOperation(handler, "document.create", snapshotConstructor);
|
|
132
|
-
}
|
|
133
|
-
/** Respond only to document deletions. */
|
|
134
|
-
onDelete(handler) {
|
|
135
|
-
return this.onOperation(handler, "document.delete", beforeSnapshotConstructor);
|
|
136
|
-
}
|
|
137
|
-
onOperation(handler, eventType, dataConstructor) {
|
|
138
|
-
return (0, cloud_functions_1.makeCloudFunction)({
|
|
139
|
-
handler,
|
|
140
|
-
provider: exports.provider,
|
|
141
|
-
eventType,
|
|
142
|
-
service: exports.service,
|
|
143
|
-
triggerResource: this.triggerResource,
|
|
144
|
-
legacyEventType: `providers/cloud.firestore/eventTypes/${eventType}`,
|
|
145
|
-
dataConstructor,
|
|
146
|
-
options: this.options,
|
|
147
|
-
});
|
|
148
|
-
}
|
|
94
|
+
return require_common_change.Change.fromObjects(beforeSnapshotConstructor(raw), snapshotConstructor(raw));
|
|
149
95
|
}
|
|
96
|
+
var DocumentBuilder = class {
|
|
97
|
+
constructor(triggerResource, options) {
|
|
98
|
+
this.triggerResource = triggerResource;
|
|
99
|
+
this.options = options;
|
|
100
|
+
}
|
|
101
|
+
/** Respond to all document writes (creates, updates, or deletes). */
|
|
102
|
+
onWrite(handler) {
|
|
103
|
+
return this.onOperation(handler, "document.write", changeConstructor);
|
|
104
|
+
}
|
|
105
|
+
/** Respond only to document updates. */
|
|
106
|
+
onUpdate(handler) {
|
|
107
|
+
return this.onOperation(handler, "document.update", changeConstructor);
|
|
108
|
+
}
|
|
109
|
+
/** Respond only to document creations. */
|
|
110
|
+
onCreate(handler) {
|
|
111
|
+
return this.onOperation(handler, "document.create", snapshotConstructor);
|
|
112
|
+
}
|
|
113
|
+
/** Respond only to document deletions. */
|
|
114
|
+
onDelete(handler) {
|
|
115
|
+
return this.onOperation(handler, "document.delete", beforeSnapshotConstructor);
|
|
116
|
+
}
|
|
117
|
+
onOperation(handler, eventType, dataConstructor) {
|
|
118
|
+
return require_v1_cloud_functions.makeCloudFunction({
|
|
119
|
+
handler,
|
|
120
|
+
provider,
|
|
121
|
+
eventType,
|
|
122
|
+
service,
|
|
123
|
+
triggerResource: this.triggerResource,
|
|
124
|
+
legacyEventType: `providers/cloud.firestore/eventTypes/${eventType}`,
|
|
125
|
+
dataConstructor,
|
|
126
|
+
options: this.options
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
//#endregion
|
|
132
|
+
exports.DatabaseBuilder = DatabaseBuilder;
|
|
150
133
|
exports.DocumentBuilder = DocumentBuilder;
|
|
134
|
+
exports.NamespaceBuilder = NamespaceBuilder;
|
|
135
|
+
exports._databaseWithOptions = _databaseWithOptions;
|
|
136
|
+
exports._documentWithOptions = _documentWithOptions;
|
|
137
|
+
exports._namespaceWithOptions = _namespaceWithOptions;
|
|
138
|
+
exports.beforeSnapshotConstructor = beforeSnapshotConstructor;
|
|
139
|
+
exports.database = database;
|
|
140
|
+
exports.defaultDatabase = defaultDatabase;
|
|
141
|
+
exports.document = document;
|
|
142
|
+
Object.defineProperty(exports, 'firestore_exports', {
|
|
143
|
+
enumerable: true,
|
|
144
|
+
get: function () {
|
|
145
|
+
return firestore_exports;
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
exports.namespace = namespace;
|
|
149
|
+
exports.provider = provider;
|
|
150
|
+
exports.service = service;
|
|
151
|
+
exports.snapshotConstructor = snapshotConstructor;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as express from "express";
|
|
2
2
|
import { CallableContext, FunctionsErrorCode, HttpsError, Request } from "../../common/providers/https";
|
|
3
3
|
import { HttpsFunction, Runnable } from "../cloud-functions";
|
|
4
|
-
export {
|
|
4
|
+
export { HttpsError };
|
|
5
|
+
export type { Request, CallableContext, FunctionsErrorCode };
|
|
5
6
|
/**
|
|
6
7
|
* Handle HTTP requests.
|
|
7
8
|
* @param handler A function that takes a request and response object,
|
|
@@ -1,99 +1,92 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
// SOFTWARE.
|
|
23
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports._onCallWithOptions = exports._onRequestWithOptions = exports.onCall = exports.onRequest = exports.HttpsError = void 0;
|
|
25
|
-
const encoding_1 = require("../../common/encoding");
|
|
26
|
-
const https_1 = require("../../common/providers/https");
|
|
27
|
-
Object.defineProperty(exports, "HttpsError", { enumerable: true, get: function () { return https_1.HttpsError; } });
|
|
28
|
-
const cloud_functions_1 = require("../cloud-functions");
|
|
29
|
-
const manifest_1 = require("../../runtime/manifest");
|
|
30
|
-
const onInit_1 = require("../../common/onInit");
|
|
31
|
-
const trace_1 = require("../../v2/trace");
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.js');
|
|
2
|
+
const require_runtime_manifest = require('../../runtime/manifest.js');
|
|
3
|
+
const require_common_encoding = require('../../common/encoding.js');
|
|
4
|
+
const require_common_onInit = require('../../common/onInit.js');
|
|
5
|
+
const require_v1_cloud_functions = require('../cloud-functions.js');
|
|
6
|
+
const require_common_providers_https = require('../../common/providers/https.js');
|
|
7
|
+
const require_v2_trace = require('../../v2/trace.js');
|
|
8
|
+
|
|
9
|
+
//#region src/v1/providers/https.ts
|
|
10
|
+
var https_exports = /* @__PURE__ */ require_rolldown_runtime.__export({
|
|
11
|
+
HttpsError: () => require_common_providers_https.HttpsError,
|
|
12
|
+
_onCallWithOptions: () => _onCallWithOptions,
|
|
13
|
+
_onRequestWithOptions: () => _onRequestWithOptions,
|
|
14
|
+
onCall: () => onCall,
|
|
15
|
+
onRequest: () => onRequest
|
|
16
|
+
});
|
|
32
17
|
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
18
|
+
* Handle HTTP requests.
|
|
19
|
+
* @param handler A function that takes a request and response object,
|
|
20
|
+
* same signature as an Express app.
|
|
21
|
+
*/
|
|
37
22
|
function onRequest(handler) {
|
|
38
|
-
|
|
23
|
+
return _onRequestWithOptions(handler, {});
|
|
39
24
|
}
|
|
40
|
-
exports.onRequest = onRequest;
|
|
41
25
|
/**
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
26
|
+
* Declares a callable method for clients to call using a Firebase SDK.
|
|
27
|
+
* @param handler A method that takes a data and context and returns a value.
|
|
28
|
+
*/
|
|
45
29
|
function onCall(handler) {
|
|
46
|
-
|
|
30
|
+
return _onCallWithOptions(handler, {});
|
|
47
31
|
}
|
|
48
|
-
exports.onCall = onCall;
|
|
49
32
|
/** @internal */
|
|
50
33
|
function _onRequestWithOptions(handler, options) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
(0, encoding_1.convertIfPresent)(cloudFunction.__endpoint.httpsTrigger, options, "invoker", "invoker", encoding_1.convertInvoker);
|
|
68
|
-
return cloudFunction;
|
|
34
|
+
const cloudFunction = (req, res) => {
|
|
35
|
+
return require_v2_trace.wrapTraceContext(require_common_onInit.withInit(require_common_providers_https.withErrorHandler(handler)))(req, res);
|
|
36
|
+
};
|
|
37
|
+
cloudFunction.__trigger = {
|
|
38
|
+
...require_v1_cloud_functions.optionsToTrigger(options),
|
|
39
|
+
httpsTrigger: {}
|
|
40
|
+
};
|
|
41
|
+
require_common_encoding.convertIfPresent(cloudFunction.__trigger.httpsTrigger, options, "invoker", "invoker", require_common_encoding.convertInvoker);
|
|
42
|
+
cloudFunction.__endpoint = {
|
|
43
|
+
platform: "gcfv1",
|
|
44
|
+
...require_runtime_manifest.initV1Endpoint(options),
|
|
45
|
+
...require_v1_cloud_functions.optionsToEndpoint(options),
|
|
46
|
+
httpsTrigger: {}
|
|
47
|
+
};
|
|
48
|
+
require_common_encoding.convertIfPresent(cloudFunction.__endpoint.httpsTrigger, options, "invoker", "invoker", require_common_encoding.convertInvoker);
|
|
49
|
+
return cloudFunction;
|
|
69
50
|
}
|
|
70
|
-
exports._onRequestWithOptions = _onRequestWithOptions;
|
|
71
51
|
/** @internal */
|
|
72
52
|
function _onCallWithOptions(handler, options) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
53
|
+
const fixedLen = (data, context) => {
|
|
54
|
+
return require_common_onInit.withInit(handler)(data, context);
|
|
55
|
+
};
|
|
56
|
+
const func = require_v2_trace.wrapTraceContext(require_common_providers_https.onCallHandler({
|
|
57
|
+
enforceAppCheck: options.enforceAppCheck,
|
|
58
|
+
consumeAppCheckToken: options.consumeAppCheckToken,
|
|
59
|
+
cors: {
|
|
60
|
+
origin: true,
|
|
61
|
+
methods: "POST"
|
|
62
|
+
}
|
|
63
|
+
}, fixedLen, "gcfv1"));
|
|
64
|
+
func.__trigger = {
|
|
65
|
+
labels: {},
|
|
66
|
+
...require_v1_cloud_functions.optionsToTrigger(options),
|
|
67
|
+
httpsTrigger: {}
|
|
68
|
+
};
|
|
69
|
+
func.__trigger.labels["deployment-callable"] = "true";
|
|
70
|
+
func.__endpoint = {
|
|
71
|
+
platform: "gcfv1",
|
|
72
|
+
labels: {},
|
|
73
|
+
...require_runtime_manifest.initV1Endpoint(options),
|
|
74
|
+
...require_v1_cloud_functions.optionsToEndpoint(options),
|
|
75
|
+
callableTrigger: {}
|
|
76
|
+
};
|
|
77
|
+
func.run = fixedLen;
|
|
78
|
+
return func;
|
|
98
79
|
}
|
|
80
|
+
|
|
81
|
+
//#endregion
|
|
82
|
+
exports.HttpsError = require_common_providers_https.HttpsError;
|
|
99
83
|
exports._onCallWithOptions = _onCallWithOptions;
|
|
84
|
+
exports._onRequestWithOptions = _onRequestWithOptions;
|
|
85
|
+
Object.defineProperty(exports, 'https_exports', {
|
|
86
|
+
enumerable: true,
|
|
87
|
+
get: function () {
|
|
88
|
+
return https_exports;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
exports.onCall = onCall;
|
|
92
|
+
exports.onRequest = onRequest;
|