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,185 +1,170 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
// SOFTWARE.
|
|
23
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.getOptsAndBucket = exports.onOperation = exports.onObjectMetadataUpdated = exports.onObjectDeleted = exports.onObjectFinalized = exports.onObjectArchived = exports.metadataUpdatedEvent = exports.deletedEvent = exports.finalizedEvent = exports.archivedEvent = void 0;
|
|
25
|
-
/**
|
|
26
|
-
* Cloud functions to handle events from Google Cloud Storage.
|
|
27
|
-
* @packageDocumentation
|
|
28
|
-
*/
|
|
29
|
-
const config_1 = require("../../common/config");
|
|
30
|
-
const encoding_1 = require("../../common/encoding");
|
|
31
|
-
const manifest_1 = require("../../runtime/manifest");
|
|
32
|
-
const trace_1 = require("../trace");
|
|
33
|
-
const options = require("../options");
|
|
34
|
-
const onInit_1 = require("../../common/onInit");
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.js');
|
|
2
|
+
const require_runtime_manifest = require('../../runtime/manifest.js');
|
|
3
|
+
const require_common_config = require('../../common/config.js');
|
|
4
|
+
const require_common_encoding = require('../../common/encoding.js');
|
|
5
|
+
const require_common_onInit = require('../../common/onInit.js');
|
|
6
|
+
const require_v2_trace = require('../trace.js');
|
|
7
|
+
const require_v2_options = require('../options.js');
|
|
8
|
+
|
|
9
|
+
//#region src/v2/providers/storage.ts
|
|
10
|
+
var storage_exports = /* @__PURE__ */ require_rolldown_runtime.__export({
|
|
11
|
+
archivedEvent: () => archivedEvent,
|
|
12
|
+
deletedEvent: () => deletedEvent,
|
|
13
|
+
finalizedEvent: () => finalizedEvent,
|
|
14
|
+
getOptsAndBucket: () => getOptsAndBucket,
|
|
15
|
+
metadataUpdatedEvent: () => metadataUpdatedEvent,
|
|
16
|
+
onObjectArchived: () => onObjectArchived,
|
|
17
|
+
onObjectDeleted: () => onObjectDeleted,
|
|
18
|
+
onObjectFinalized: () => onObjectFinalized,
|
|
19
|
+
onObjectMetadataUpdated: () => onObjectMetadataUpdated,
|
|
20
|
+
onOperation: () => onOperation
|
|
21
|
+
});
|
|
35
22
|
/** @internal */
|
|
36
|
-
|
|
23
|
+
const archivedEvent = "google.cloud.storage.object.v1.archived";
|
|
37
24
|
/** @internal */
|
|
38
|
-
|
|
25
|
+
const finalizedEvent = "google.cloud.storage.object.v1.finalized";
|
|
39
26
|
/** @internal */
|
|
40
|
-
|
|
27
|
+
const deletedEvent = "google.cloud.storage.object.v1.deleted";
|
|
41
28
|
/** @internal */
|
|
42
|
-
|
|
29
|
+
const metadataUpdatedEvent = "google.cloud.storage.object.v1.metadataUpdated";
|
|
43
30
|
/**
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
31
|
+
* Event handler sent only when a bucket has enabled object versioning.
|
|
32
|
+
* This event indicates that the live version of an object has become an
|
|
33
|
+
* archived version, either because it was archived or because it was
|
|
34
|
+
* overwritten by the upload of an object of the same name.
|
|
35
|
+
*
|
|
36
|
+
* @param bucketOrOptsOrHandler - Options or string that may (or may not) define the bucket to be used.
|
|
37
|
+
* @param handler - Event handler which is run every time a Google Cloud Storage archival occurs.
|
|
38
|
+
*/
|
|
52
39
|
function onObjectArchived(bucketOrOptsOrHandler, handler) {
|
|
53
|
-
|
|
40
|
+
return onOperation(archivedEvent, bucketOrOptsOrHandler, handler);
|
|
54
41
|
}
|
|
55
|
-
exports.onObjectArchived = onObjectArchived;
|
|
56
42
|
/**
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
43
|
+
* Event handler which fires every time a Google Cloud Storage object
|
|
44
|
+
* creation occurs.
|
|
45
|
+
*
|
|
46
|
+
* Sent when a new object (or a new generation of an existing object)
|
|
47
|
+
* is successfully created in the bucket. This includes copying or rewriting
|
|
48
|
+
* an existing object. A failed upload does not trigger this event.
|
|
49
|
+
*
|
|
50
|
+
* @param bucketOrOptsOrHandler - Options or string that may (or may not) define the bucket to be used.
|
|
51
|
+
* @param handler - Event handler which is run every time a Google Cloud Storage object creation occurs.
|
|
52
|
+
*/
|
|
67
53
|
function onObjectFinalized(bucketOrOptsOrHandler, handler) {
|
|
68
|
-
|
|
54
|
+
return onOperation(finalizedEvent, bucketOrOptsOrHandler, handler);
|
|
69
55
|
}
|
|
70
|
-
exports.onObjectFinalized = onObjectFinalized;
|
|
71
56
|
/**
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
57
|
+
* Event handler which fires every time a Google Cloud Storage deletion occurs.
|
|
58
|
+
*
|
|
59
|
+
* Sent when an object has been permanently deleted. This includes objects
|
|
60
|
+
* that are overwritten or are deleted as part of the bucket's lifecycle
|
|
61
|
+
* configuration. For buckets with object versioning enabled, this is not
|
|
62
|
+
* sent when an object is archived, even if archival occurs
|
|
63
|
+
* via the `storage.objects.delete` method.
|
|
64
|
+
*
|
|
65
|
+
* @param bucketOrOptsOrHandler - Options or string that may (or may not) define the bucket to be used.
|
|
66
|
+
* @param handler - Event handler which is run every time a Google Cloud Storage object deletion occurs.
|
|
67
|
+
*/
|
|
83
68
|
function onObjectDeleted(bucketOrOptsOrHandler, handler) {
|
|
84
|
-
|
|
69
|
+
return onOperation(deletedEvent, bucketOrOptsOrHandler, handler);
|
|
85
70
|
}
|
|
86
|
-
exports.onObjectDeleted = onObjectDeleted;
|
|
87
71
|
/**
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
72
|
+
* Event handler which fires every time the metadata of an existing object
|
|
73
|
+
* changes.
|
|
74
|
+
*
|
|
75
|
+
* @param bucketOrOptsOrHandler - Options or string that may (or may not) define the bucket to be used.
|
|
76
|
+
* @param handler - Event handler which is run every time a Google Cloud Storage object metadata update occurs.
|
|
77
|
+
*/
|
|
94
78
|
function onObjectMetadataUpdated(bucketOrOptsOrHandler, handler) {
|
|
95
|
-
|
|
79
|
+
return onOperation(metadataUpdatedEvent, bucketOrOptsOrHandler, handler);
|
|
96
80
|
}
|
|
97
|
-
exports.onObjectMetadataUpdated = onObjectMetadataUpdated;
|
|
98
81
|
/** @internal */
|
|
99
82
|
function onOperation(eventType, bucketOrOptsOrHandler, handler) {
|
|
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
|
-
eventType,
|
|
150
|
-
eventFilters: { bucket },
|
|
151
|
-
retry: (_a = opts.retry) !== null && _a !== void 0 ? _a : false,
|
|
152
|
-
},
|
|
153
|
-
};
|
|
154
|
-
(0, encoding_1.copyIfPresent)(endpoint.eventTrigger, opts, "retry", "retry");
|
|
155
|
-
return endpoint;
|
|
156
|
-
},
|
|
157
|
-
});
|
|
158
|
-
return func;
|
|
83
|
+
if (typeof bucketOrOptsOrHandler === "function") {
|
|
84
|
+
handler = bucketOrOptsOrHandler;
|
|
85
|
+
bucketOrOptsOrHandler = {};
|
|
86
|
+
}
|
|
87
|
+
const [opts, bucket] = getOptsAndBucket(bucketOrOptsOrHandler);
|
|
88
|
+
const func = (raw) => {
|
|
89
|
+
return require_v2_trace.wrapTraceContext(require_common_onInit.withInit(handler))(raw);
|
|
90
|
+
};
|
|
91
|
+
func.run = handler;
|
|
92
|
+
Object.defineProperty(func, "__trigger", { get: () => {
|
|
93
|
+
const baseOpts = require_v2_options.optionsToTriggerAnnotations(require_v2_options.getGlobalOptions());
|
|
94
|
+
const specificOpts = require_v2_options.optionsToTriggerAnnotations(opts);
|
|
95
|
+
return {
|
|
96
|
+
platform: "gcfv2",
|
|
97
|
+
...baseOpts,
|
|
98
|
+
...specificOpts,
|
|
99
|
+
labels: {
|
|
100
|
+
...baseOpts?.labels,
|
|
101
|
+
...specificOpts?.labels
|
|
102
|
+
},
|
|
103
|
+
eventTrigger: {
|
|
104
|
+
eventType,
|
|
105
|
+
resource: bucket
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
} });
|
|
109
|
+
func.__endpoint = {};
|
|
110
|
+
Object.defineProperty(func, "__endpoint", { get: () => {
|
|
111
|
+
const baseOpts = require_v2_options.optionsToEndpoint(require_v2_options.getGlobalOptions());
|
|
112
|
+
const specificOpts = require_v2_options.optionsToEndpoint(opts);
|
|
113
|
+
const endpoint = {
|
|
114
|
+
platform: "gcfv2",
|
|
115
|
+
...require_runtime_manifest.initV2Endpoint(require_v2_options.getGlobalOptions(), opts),
|
|
116
|
+
...baseOpts,
|
|
117
|
+
...specificOpts,
|
|
118
|
+
labels: {
|
|
119
|
+
...baseOpts?.labels,
|
|
120
|
+
...specificOpts?.labels
|
|
121
|
+
},
|
|
122
|
+
eventTrigger: {
|
|
123
|
+
eventType,
|
|
124
|
+
eventFilters: { bucket },
|
|
125
|
+
retry: opts.retry ?? false
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
require_common_encoding.copyIfPresent(endpoint.eventTrigger, opts, "retry", "retry");
|
|
129
|
+
return endpoint;
|
|
130
|
+
} });
|
|
131
|
+
return func;
|
|
159
132
|
}
|
|
160
|
-
exports.onOperation = onOperation;
|
|
161
133
|
/** @internal */
|
|
162
134
|
function getOptsAndBucket(bucketOrOpts) {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
if (typeof bucket === "string" && !/^[a-z\d][a-z\d\\._-]{1,230}[a-z\d]$/.test(bucket)) {
|
|
181
|
-
throw new Error(`Invalid bucket name ${bucket}`);
|
|
182
|
-
}
|
|
183
|
-
return [opts, bucket];
|
|
135
|
+
let bucket;
|
|
136
|
+
let opts;
|
|
137
|
+
if (typeof bucketOrOpts === "string" || "value" in bucketOrOpts) {
|
|
138
|
+
bucket = bucketOrOpts;
|
|
139
|
+
opts = {};
|
|
140
|
+
} else {
|
|
141
|
+
bucket = bucketOrOpts.bucket || require_common_config.firebaseConfig()?.storageBucket;
|
|
142
|
+
opts = { ...bucketOrOpts };
|
|
143
|
+
delete opts.bucket;
|
|
144
|
+
}
|
|
145
|
+
if (!bucket) {
|
|
146
|
+
throw new Error("Missing bucket name. If you are unit testing, please provide a bucket name" + " by providing bucket name directly in the event handler or by setting process.env.FIREBASE_CONFIG.");
|
|
147
|
+
}
|
|
148
|
+
if (typeof bucket === "string" && !/^[a-z\d][a-z\d\\._-]{1,230}[a-z\d]$/.test(bucket)) {
|
|
149
|
+
throw new Error(`Invalid bucket name ${bucket}`);
|
|
150
|
+
}
|
|
151
|
+
return [opts, bucket];
|
|
184
152
|
}
|
|
153
|
+
|
|
154
|
+
//#endregion
|
|
155
|
+
exports.archivedEvent = archivedEvent;
|
|
156
|
+
exports.deletedEvent = deletedEvent;
|
|
157
|
+
exports.finalizedEvent = finalizedEvent;
|
|
185
158
|
exports.getOptsAndBucket = getOptsAndBucket;
|
|
159
|
+
exports.metadataUpdatedEvent = metadataUpdatedEvent;
|
|
160
|
+
exports.onObjectArchived = onObjectArchived;
|
|
161
|
+
exports.onObjectDeleted = onObjectDeleted;
|
|
162
|
+
exports.onObjectFinalized = onObjectFinalized;
|
|
163
|
+
exports.onObjectMetadataUpdated = onObjectMetadataUpdated;
|
|
164
|
+
exports.onOperation = onOperation;
|
|
165
|
+
Object.defineProperty(exports, 'storage_exports', {
|
|
166
|
+
enumerable: true,
|
|
167
|
+
get: function () {
|
|
168
|
+
return storage_exports;
|
|
169
|
+
}
|
|
170
|
+
});
|
|
@@ -4,7 +4,7 @@ import * as options from "../options";
|
|
|
4
4
|
import { HttpsFunction } from "./https";
|
|
5
5
|
import { Expression } from "../../params";
|
|
6
6
|
import { SecretParam } from "../../params/types";
|
|
7
|
-
export { AuthData, Request, RateLimits, RetryConfig };
|
|
7
|
+
export type { AuthData, Request, RateLimits, RetryConfig };
|
|
8
8
|
export interface TaskQueueOptions extends options.EventHandlerOptions {
|
|
9
9
|
/** How a task should be retried in the event of a non-2xx return. */
|
|
10
10
|
retryConfig?: RetryConfig;
|
|
@@ -1,98 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
// furnished to do so, subject to the following conditions:
|
|
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.onTaskDispatched = void 0;
|
|
25
|
-
/**
|
|
26
|
-
* Cloud functions to handle Tasks enqueued with Google Cloud Tasks.
|
|
27
|
-
* @packageDocumentation
|
|
28
|
-
*/
|
|
29
|
-
const encoding_1 = require("../../common/encoding");
|
|
30
|
-
const tasks_1 = require("../../common/providers/tasks");
|
|
31
|
-
const options = require("../options");
|
|
32
|
-
const trace_1 = require("../trace");
|
|
33
|
-
const manifest_1 = require("../../runtime/manifest");
|
|
34
|
-
const onInit_1 = require("../../common/onInit");
|
|
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_v2_trace = require('../trace.js');
|
|
6
|
+
const require_common_providers_tasks = require('../../common/providers/tasks.js');
|
|
7
|
+
const require_v2_options = require('../options.js');
|
|
8
|
+
|
|
9
|
+
//#region src/v2/providers/tasks.ts
|
|
10
|
+
var tasks_exports = /* @__PURE__ */ require_rolldown_runtime.__export({ onTaskDispatched: () => onTaskDispatched });
|
|
35
11
|
function onTaskDispatched(optsOrHandler, handler) {
|
|
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
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
(0, encoding_1.copyIfPresent)(func.__endpoint.taskQueueTrigger.rateLimits, opts.rateLimits, "maxConcurrentDispatches", "maxDispatchesPerSecond");
|
|
87
|
-
(0, encoding_1.convertIfPresent)(func.__endpoint.taskQueueTrigger, options.getGlobalOptions(), "invoker", "invoker", encoding_1.convertInvoker);
|
|
88
|
-
(0, encoding_1.convertIfPresent)(func.__endpoint.taskQueueTrigger, opts, "invoker", "invoker", encoding_1.convertInvoker);
|
|
89
|
-
func.__requiredAPIs = [
|
|
90
|
-
{
|
|
91
|
-
api: "cloudtasks.googleapis.com",
|
|
92
|
-
reason: "Needed for task queue functions",
|
|
93
|
-
},
|
|
94
|
-
];
|
|
95
|
-
func.run = handler;
|
|
96
|
-
return func;
|
|
12
|
+
let opts;
|
|
13
|
+
if (arguments.length === 1) {
|
|
14
|
+
opts = {};
|
|
15
|
+
handler = optsOrHandler;
|
|
16
|
+
} else {
|
|
17
|
+
opts = optsOrHandler;
|
|
18
|
+
}
|
|
19
|
+
const fixedLen = (req) => handler(req);
|
|
20
|
+
const func = require_v2_trace.wrapTraceContext(require_common_onInit.withInit(require_common_providers_tasks.onDispatchHandler(fixedLen)));
|
|
21
|
+
Object.defineProperty(func, "__trigger", { get: () => {
|
|
22
|
+
const baseOpts$1 = require_v2_options.optionsToTriggerAnnotations(require_v2_options.getGlobalOptions());
|
|
23
|
+
const specificOpts$1 = require_v2_options.optionsToTriggerAnnotations(opts);
|
|
24
|
+
const taskQueueTrigger = {};
|
|
25
|
+
require_common_encoding.copyIfPresent(taskQueueTrigger, opts, "retryConfig", "rateLimits");
|
|
26
|
+
require_common_encoding.convertIfPresent(taskQueueTrigger, require_v2_options.getGlobalOptions(), "invoker", "invoker", require_common_encoding.convertInvoker);
|
|
27
|
+
require_common_encoding.convertIfPresent(taskQueueTrigger, opts, "invoker", "invoker", require_common_encoding.convertInvoker);
|
|
28
|
+
return {
|
|
29
|
+
platform: "gcfv2",
|
|
30
|
+
...baseOpts$1,
|
|
31
|
+
...specificOpts$1,
|
|
32
|
+
labels: {
|
|
33
|
+
...baseOpts$1?.labels,
|
|
34
|
+
...specificOpts$1?.labels
|
|
35
|
+
},
|
|
36
|
+
taskQueueTrigger
|
|
37
|
+
};
|
|
38
|
+
} });
|
|
39
|
+
const baseOpts = require_v2_options.optionsToEndpoint(require_v2_options.getGlobalOptions());
|
|
40
|
+
const specificOpts = require_v2_options.optionsToEndpoint(opts);
|
|
41
|
+
func.__endpoint = {
|
|
42
|
+
platform: "gcfv2",
|
|
43
|
+
...require_runtime_manifest.initV2Endpoint(require_v2_options.getGlobalOptions(), opts),
|
|
44
|
+
...baseOpts,
|
|
45
|
+
...specificOpts,
|
|
46
|
+
labels: {
|
|
47
|
+
...baseOpts?.labels,
|
|
48
|
+
...specificOpts?.labels
|
|
49
|
+
},
|
|
50
|
+
taskQueueTrigger: require_runtime_manifest.initTaskQueueTrigger(require_v2_options.getGlobalOptions(), opts)
|
|
51
|
+
};
|
|
52
|
+
require_common_encoding.copyIfPresent(func.__endpoint.taskQueueTrigger.retryConfig, opts.retryConfig, "maxAttempts", "maxBackoffSeconds", "maxDoublings", "maxRetrySeconds", "minBackoffSeconds");
|
|
53
|
+
require_common_encoding.copyIfPresent(func.__endpoint.taskQueueTrigger.rateLimits, opts.rateLimits, "maxConcurrentDispatches", "maxDispatchesPerSecond");
|
|
54
|
+
require_common_encoding.convertIfPresent(func.__endpoint.taskQueueTrigger, require_v2_options.getGlobalOptions(), "invoker", "invoker", require_common_encoding.convertInvoker);
|
|
55
|
+
require_common_encoding.convertIfPresent(func.__endpoint.taskQueueTrigger, opts, "invoker", "invoker", require_common_encoding.convertInvoker);
|
|
56
|
+
func.__requiredAPIs = [{
|
|
57
|
+
api: "cloudtasks.googleapis.com",
|
|
58
|
+
reason: "Needed for task queue functions"
|
|
59
|
+
}];
|
|
60
|
+
func.run = handler;
|
|
61
|
+
return func;
|
|
97
62
|
}
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
98
65
|
exports.onTaskDispatched = onTaskDispatched;
|
|
66
|
+
Object.defineProperty(exports, 'tasks_exports', {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () {
|
|
69
|
+
return tasks_exports;
|
|
70
|
+
}
|
|
71
|
+
});
|