firebase-functions 6.5.0 → 7.0.0-rc.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/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 +19 -4
- package/lib/params/index.js +153 -129
- package/lib/params/types.d.ts +17 -0
- package/lib/params/types.js +390 -382
- 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 +189 -210
- 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 +290 -226
- package/protos/compiledFirestore.mjs +3512 -0
- package/protos/update.sh +28 -7
|
@@ -1,178 +1,176 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
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.ObjectBuilder = exports.BucketBuilder = exports._objectWithOptions = exports._bucketWithOptions = exports.object = exports.bucket = exports.service = exports.provider = void 0;
|
|
25
|
-
const config_1 = require("../../common/config");
|
|
26
|
-
const cloud_functions_1 = require("../cloud-functions");
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.js');
|
|
2
|
+
const require_common_config = require('../../common/config.js');
|
|
3
|
+
const require_v1_cloud_functions = require('../cloud-functions.js');
|
|
4
|
+
|
|
5
|
+
//#region src/v1/providers/storage.ts
|
|
6
|
+
var storage_exports = /* @__PURE__ */ require_rolldown_runtime.__export({
|
|
7
|
+
BucketBuilder: () => BucketBuilder,
|
|
8
|
+
ObjectBuilder: () => ObjectBuilder,
|
|
9
|
+
_bucketWithOptions: () => _bucketWithOptions,
|
|
10
|
+
_objectWithOptions: () => _objectWithOptions,
|
|
11
|
+
bucket: () => bucket,
|
|
12
|
+
object: () => object,
|
|
13
|
+
provider: () => provider,
|
|
14
|
+
service: () => service
|
|
15
|
+
});
|
|
27
16
|
/** @internal */
|
|
28
|
-
|
|
17
|
+
const provider = "google.storage";
|
|
29
18
|
/** @internal */
|
|
30
|
-
|
|
19
|
+
const service = "storage.googleapis.com";
|
|
31
20
|
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
function bucket(bucket) {
|
|
40
|
-
|
|
21
|
+
* Registers a Cloud Function scoped to a specific storage bucket.
|
|
22
|
+
*
|
|
23
|
+
* @param bucket Name of the bucket to which this Cloud Function is
|
|
24
|
+
* scoped.
|
|
25
|
+
*
|
|
26
|
+
* @returns Storage bucket builder interface.
|
|
27
|
+
*/
|
|
28
|
+
function bucket(bucket$1) {
|
|
29
|
+
return _bucketWithOptions({}, bucket$1);
|
|
41
30
|
}
|
|
42
|
-
exports.bucket = bucket;
|
|
43
31
|
/**
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
32
|
+
* Registers a Cloud Function scoped to the default storage bucket for the
|
|
33
|
+
* project.
|
|
34
|
+
*
|
|
35
|
+
* @returns Storage object builder interface.
|
|
36
|
+
*/
|
|
49
37
|
function object() {
|
|
50
|
-
|
|
38
|
+
return _objectWithOptions({});
|
|
51
39
|
}
|
|
52
|
-
exports.object = object;
|
|
53
40
|
/** @internal */
|
|
54
|
-
function _bucketWithOptions(options, bucket) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return new BucketBuilder(resourceGetter, options);
|
|
41
|
+
function _bucketWithOptions(options, bucket$1) {
|
|
42
|
+
const resourceGetter = () => {
|
|
43
|
+
bucket$1 = bucket$1 || require_common_config.firebaseConfig().storageBucket;
|
|
44
|
+
if (!bucket$1) {
|
|
45
|
+
throw new Error("Missing bucket name. If you are unit testing, please provide a bucket name" + " through `functions.storage.bucket(bucketName)`, or set process.env.FIREBASE_CONFIG.");
|
|
46
|
+
}
|
|
47
|
+
if (!/^[a-z\d][a-z\d\\._-]{1,230}[a-z\d]$/.test(bucket$1)) {
|
|
48
|
+
throw new Error(`Invalid bucket name ${bucket$1}`);
|
|
49
|
+
}
|
|
50
|
+
return `projects/_/buckets/${bucket$1}`;
|
|
51
|
+
};
|
|
52
|
+
return new BucketBuilder(resourceGetter, options);
|
|
67
53
|
}
|
|
68
|
-
exports._bucketWithOptions = _bucketWithOptions;
|
|
69
54
|
/** @internal */
|
|
70
55
|
function _objectWithOptions(options) {
|
|
71
|
-
|
|
56
|
+
return _bucketWithOptions(options).object();
|
|
72
57
|
}
|
|
73
|
-
exports._objectWithOptions = _objectWithOptions;
|
|
74
58
|
/**
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
exports.BucketBuilder = BucketBuilder;
|
|
59
|
+
* The Google Cloud Storage bucket builder interface.
|
|
60
|
+
*
|
|
61
|
+
* Access via `functions.storage.bucket()`.
|
|
62
|
+
*/
|
|
63
|
+
var BucketBuilder = class {
|
|
64
|
+
/** @internal */
|
|
65
|
+
constructor(triggerResource, options) {
|
|
66
|
+
this.triggerResource = triggerResource;
|
|
67
|
+
this.options = options;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Event handler which fires every time a Google Cloud Storage change occurs.
|
|
71
|
+
*
|
|
72
|
+
* @returns Storage object builder interface scoped to the specified storage
|
|
73
|
+
* bucket.
|
|
74
|
+
*/
|
|
75
|
+
object() {
|
|
76
|
+
return new ObjectBuilder(this.triggerResource, this.options);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
96
79
|
/**
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
80
|
+
* The Google Cloud Storage object builder interface.
|
|
81
|
+
*
|
|
82
|
+
* Access via `functions.storage.object()`.
|
|
83
|
+
*/
|
|
84
|
+
var ObjectBuilder = class {
|
|
85
|
+
/** @internal */
|
|
86
|
+
constructor(triggerResource, options) {
|
|
87
|
+
this.triggerResource = triggerResource;
|
|
88
|
+
this.options = options;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Event handler sent only when a bucket has enabled object versioning.
|
|
92
|
+
* This event indicates that the live version of an object has become an
|
|
93
|
+
* archived version, either because it was archived or because it was
|
|
94
|
+
* overwritten by the upload of an object of the same name.
|
|
95
|
+
*
|
|
96
|
+
* @param handler Event handler which is run every time a Google Cloud Storage
|
|
97
|
+
* archival occurs.
|
|
98
|
+
*
|
|
99
|
+
* @returns A function which you can export and deploy.
|
|
100
|
+
*/
|
|
101
|
+
onArchive(handler) {
|
|
102
|
+
return this.onOperation(handler, "object.archive");
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Event handler which fires every time a Google Cloud Storage deletion occurs.
|
|
106
|
+
*
|
|
107
|
+
* Sent when an object has been permanently deleted. This includes objects
|
|
108
|
+
* that are overwritten or are deleted as part of the bucket's lifecycle
|
|
109
|
+
* configuration. For buckets with object versioning enabled, this is not
|
|
110
|
+
* sent when an object is archived, even if archival occurs
|
|
111
|
+
* via the `storage.objects.delete` method.
|
|
112
|
+
*
|
|
113
|
+
* @param handler Event handler which is run every time a Google Cloud Storage
|
|
114
|
+
* deletion occurs.
|
|
115
|
+
*
|
|
116
|
+
* @returns A function which you can export and deploy.
|
|
117
|
+
*/
|
|
118
|
+
onDelete(handler) {
|
|
119
|
+
return this.onOperation(handler, "object.delete");
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Event handler which fires every time a Google Cloud Storage object
|
|
123
|
+
* creation occurs.
|
|
124
|
+
*
|
|
125
|
+
* Sent when a new object (or a new generation of an existing object)
|
|
126
|
+
* is successfully created in the bucket. This includes copying or rewriting
|
|
127
|
+
* an existing object. A failed upload does not trigger this event.
|
|
128
|
+
*
|
|
129
|
+
* @param handler Event handler which is run every time a Google Cloud Storage
|
|
130
|
+
* object creation occurs.
|
|
131
|
+
*
|
|
132
|
+
* @returns A function which you can export and deploy.
|
|
133
|
+
*/
|
|
134
|
+
onFinalize(handler) {
|
|
135
|
+
return this.onOperation(handler, "object.finalize");
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Event handler which fires every time the metadata of an existing object
|
|
139
|
+
* changes.
|
|
140
|
+
*
|
|
141
|
+
* @param handler Event handler which is run every time a Google Cloud Storage
|
|
142
|
+
* metadata update occurs.
|
|
143
|
+
*
|
|
144
|
+
* @returns A function which you can export and deploy.
|
|
145
|
+
*/
|
|
146
|
+
onMetadataUpdate(handler) {
|
|
147
|
+
return this.onOperation(handler, "object.metadataUpdate");
|
|
148
|
+
}
|
|
149
|
+
/** @hidden */
|
|
150
|
+
onOperation(handler, eventType) {
|
|
151
|
+
return require_v1_cloud_functions.makeCloudFunction({
|
|
152
|
+
handler,
|
|
153
|
+
provider,
|
|
154
|
+
service,
|
|
155
|
+
eventType,
|
|
156
|
+
triggerResource: this.triggerResource,
|
|
157
|
+
options: this.options
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
//#endregion
|
|
163
|
+
exports.BucketBuilder = BucketBuilder;
|
|
178
164
|
exports.ObjectBuilder = ObjectBuilder;
|
|
165
|
+
exports._bucketWithOptions = _bucketWithOptions;
|
|
166
|
+
exports._objectWithOptions = _objectWithOptions;
|
|
167
|
+
exports.bucket = bucket;
|
|
168
|
+
exports.object = object;
|
|
169
|
+
exports.provider = provider;
|
|
170
|
+
exports.service = service;
|
|
171
|
+
Object.defineProperty(exports, 'storage_exports', {
|
|
172
|
+
enumerable: true,
|
|
173
|
+
get: function () {
|
|
174
|
+
return storage_exports;
|
|
175
|
+
}
|
|
176
|
+
});
|
|
@@ -2,7 +2,7 @@ import * as express from "express";
|
|
|
2
2
|
import { Request } from "../../common/providers/https";
|
|
3
3
|
import { RateLimits, RetryConfig, TaskContext } from "../../common/providers/tasks";
|
|
4
4
|
import { ManifestEndpoint, ManifestRequiredAPI } from "../../runtime/manifest";
|
|
5
|
-
export { RetryConfig, RateLimits, TaskContext };
|
|
5
|
+
export type { RetryConfig, RateLimits, TaskContext };
|
|
6
6
|
/**
|
|
7
7
|
* Options for configuring the task queue to listen to.
|
|
8
8
|
*/
|
|
@@ -1,85 +1,70 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
//
|
|
13
|
-
// The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
// copies or substantial portions of the Software.
|
|
15
|
-
//
|
|
16
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
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.taskQueue = exports.TaskQueueBuilder = void 0;
|
|
25
|
-
const encoding_1 = require("../../common/encoding");
|
|
26
|
-
const tasks_1 = require("../../common/providers/tasks");
|
|
27
|
-
const manifest_1 = require("../../runtime/manifest");
|
|
28
|
-
const cloud_functions_1 = require("../cloud-functions");
|
|
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_v1_cloud_functions = require('../cloud-functions.js');
|
|
5
|
+
const require_common_providers_tasks = require('../../common/providers/tasks.js');
|
|
6
|
+
|
|
7
|
+
//#region src/v1/providers/tasks.ts
|
|
8
|
+
var tasks_exports = /* @__PURE__ */ require_rolldown_runtime.__export({
|
|
9
|
+
TaskQueueBuilder: () => TaskQueueBuilder,
|
|
10
|
+
taskQueue: () => taskQueue
|
|
11
|
+
});
|
|
29
12
|
/**
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
},
|
|
71
|
-
];
|
|
72
|
-
func.run = handler;
|
|
73
|
-
return func;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
exports.TaskQueueBuilder = TaskQueueBuilder;
|
|
13
|
+
* Builder for creating a `TaskQueueFunction`.
|
|
14
|
+
*/
|
|
15
|
+
var TaskQueueBuilder = class {
|
|
16
|
+
/** @internal */
|
|
17
|
+
constructor(tqOpts, depOpts) {
|
|
18
|
+
this.tqOpts = tqOpts;
|
|
19
|
+
this.depOpts = depOpts;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Creates a handler for tasks sent to a Google Cloud Tasks queue.
|
|
23
|
+
* @param handler - A callback to handle task requests.
|
|
24
|
+
* @returns A function you can export and deploy.
|
|
25
|
+
*/
|
|
26
|
+
onDispatch(handler) {
|
|
27
|
+
const fixedLen = (data, context) => handler(data, context);
|
|
28
|
+
const func = require_common_providers_tasks.onDispatchHandler(fixedLen);
|
|
29
|
+
func.__trigger = {
|
|
30
|
+
...require_v1_cloud_functions.optionsToTrigger(this.depOpts || {}),
|
|
31
|
+
taskQueueTrigger: {}
|
|
32
|
+
};
|
|
33
|
+
require_common_encoding.copyIfPresent(func.__trigger.taskQueueTrigger, this.tqOpts, "retryConfig");
|
|
34
|
+
require_common_encoding.copyIfPresent(func.__trigger.taskQueueTrigger, this.tqOpts, "rateLimits");
|
|
35
|
+
require_common_encoding.convertIfPresent(func.__trigger.taskQueueTrigger, this.tqOpts, "invoker", "invoker", require_common_encoding.convertInvoker);
|
|
36
|
+
func.__endpoint = {
|
|
37
|
+
platform: "gcfv1",
|
|
38
|
+
...require_runtime_manifest.initV1Endpoint(this.depOpts),
|
|
39
|
+
...require_v1_cloud_functions.optionsToEndpoint(this.depOpts),
|
|
40
|
+
taskQueueTrigger: require_runtime_manifest.initTaskQueueTrigger(this.depOpts)
|
|
41
|
+
};
|
|
42
|
+
require_common_encoding.copyIfPresent(func.__endpoint.taskQueueTrigger.retryConfig, this.tqOpts?.retryConfig || {}, "maxAttempts", "maxBackoffSeconds", "maxDoublings", "maxRetrySeconds", "minBackoffSeconds");
|
|
43
|
+
require_common_encoding.copyIfPresent(func.__endpoint.taskQueueTrigger.rateLimits, this.tqOpts?.rateLimits || {}, "maxConcurrentDispatches", "maxDispatchesPerSecond");
|
|
44
|
+
require_common_encoding.convertIfPresent(func.__endpoint.taskQueueTrigger, this.tqOpts, "invoker", "invoker", require_common_encoding.convertInvoker);
|
|
45
|
+
func.__requiredAPIs = [{
|
|
46
|
+
api: "cloudtasks.googleapis.com",
|
|
47
|
+
reason: "Needed for task queue functions"
|
|
48
|
+
}];
|
|
49
|
+
func.run = handler;
|
|
50
|
+
return func;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
77
53
|
/**
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
54
|
+
* Declares a function that can handle tasks enqueued using the Firebase Admin SDK.
|
|
55
|
+
* @param options - Configuration for the Task Queue that feeds into this function.
|
|
56
|
+
* Omitting options will configure a Task Queue with default settings.
|
|
57
|
+
*/
|
|
82
58
|
function taskQueue(options) {
|
|
83
|
-
|
|
59
|
+
return new TaskQueueBuilder(options);
|
|
84
60
|
}
|
|
61
|
+
|
|
62
|
+
//#endregion
|
|
63
|
+
exports.TaskQueueBuilder = TaskQueueBuilder;
|
|
85
64
|
exports.taskQueue = taskQueue;
|
|
65
|
+
Object.defineProperty(exports, 'tasks_exports', {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () {
|
|
68
|
+
return tasks_exports;
|
|
69
|
+
}
|
|
70
|
+
});
|