firebase-functions 6.6.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 +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 +290 -226
- package/protos/compiledFirestore.mjs +3512 -0
- package/protos/update.sh +28 -7
package/lib/runtime/loader.js
CHANGED
|
@@ -1,170 +1,136 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
10
|
-
// in the Software without restriction, including without limitation the rights
|
|
11
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
13
|
-
// furnished to do so, subject to the following conditions:
|
|
14
|
-
//
|
|
15
|
-
// The above copyright notice and this permission notice shall be included in
|
|
16
|
-
// all copies or substantial portions of the Software.
|
|
17
|
-
//
|
|
18
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
-
// SOFTWARE.
|
|
25
|
-
const path = require("path");
|
|
26
|
-
const url = require("url");
|
|
27
|
-
const params = require("../params");
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
|
+
const require_params_index = require('../params/index.js');
|
|
3
|
+
let path = require("path");
|
|
4
|
+
path = require_rolldown_runtime.__toESM(path);
|
|
5
|
+
let url = require("url");
|
|
6
|
+
url = require_rolldown_runtime.__toESM(url);
|
|
7
|
+
|
|
8
|
+
//#region src/runtime/loader.ts
|
|
28
9
|
/**
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
// eslint-disable-next-line @typescript-eslint/no-implied-eval
|
|
10
|
+
* Dynamically load import function to prevent TypeScript from
|
|
11
|
+
* transpiling into a require.
|
|
12
|
+
*
|
|
13
|
+
* See https://github.com/microsoft/TypeScript/issues/43329.
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
36
16
|
const dynamicImport = new Function("modulePath", "return import(modulePath)");
|
|
37
17
|
async function loadModule(functionsDir) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
throw e;
|
|
51
|
-
}
|
|
18
|
+
const absolutePath = path.resolve(functionsDir);
|
|
19
|
+
try {
|
|
20
|
+
return require(path.resolve(absolutePath));
|
|
21
|
+
} catch (e) {
|
|
22
|
+
if (e.code === "ERR_REQUIRE_ESM" || e.code === "ERR_REQUIRE_ASYNC_MODULE") {
|
|
23
|
+
const modulePath = require.resolve(absolutePath);
|
|
24
|
+
const moduleURL = url.pathToFileURL(modulePath).href;
|
|
25
|
+
return await dynamicImport(moduleURL);
|
|
26
|
+
}
|
|
27
|
+
throw e;
|
|
28
|
+
}
|
|
52
29
|
}
|
|
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
|
-
else if (isObject(val)) {
|
|
83
|
-
extractStack(val, endpoints, requiredAPIs, extensions, prefix + name + "-");
|
|
84
|
-
}
|
|
85
|
-
}
|
|
30
|
+
function extractStack(module$1, endpoints, requiredAPIs, extensions, prefix = "") {
|
|
31
|
+
for (const [name, valAsUnknown] of Object.entries(module$1)) {
|
|
32
|
+
const val = valAsUnknown;
|
|
33
|
+
if (typeof val === "function" && val.__endpoint && typeof val.__endpoint === "object") {
|
|
34
|
+
const funcName = prefix + name;
|
|
35
|
+
endpoints[funcName] = {
|
|
36
|
+
...val.__endpoint,
|
|
37
|
+
entryPoint: funcName.replace(/-/g, ".")
|
|
38
|
+
};
|
|
39
|
+
if (val.__requiredAPIs && Array.isArray(val.__requiredAPIs)) {
|
|
40
|
+
requiredAPIs.push(...val.__requiredAPIs);
|
|
41
|
+
}
|
|
42
|
+
} else if (isFirebaseRefExtension(val)) {
|
|
43
|
+
extensions[val.instanceId] = {
|
|
44
|
+
params: convertExtensionParams(val.params),
|
|
45
|
+
ref: val.FIREBASE_EXTENSION_REFERENCE,
|
|
46
|
+
events: val.events || []
|
|
47
|
+
};
|
|
48
|
+
} else if (isFirebaseLocalExtension(val)) {
|
|
49
|
+
extensions[val.instanceId] = {
|
|
50
|
+
params: convertExtensionParams(val.params),
|
|
51
|
+
localPath: val.FIREBASE_EXTENSION_LOCAL_PATH,
|
|
52
|
+
events: val.events || []
|
|
53
|
+
};
|
|
54
|
+
} else if (isObject(val)) {
|
|
55
|
+
extractStack(val, endpoints, requiredAPIs, extensions, prefix + name + "-");
|
|
56
|
+
}
|
|
57
|
+
}
|
|
86
58
|
}
|
|
87
|
-
exports.extractStack = extractStack;
|
|
88
59
|
function toTitleCase(txt) {
|
|
89
|
-
|
|
60
|
+
return txt.charAt(0).toUpperCase() + txt.substring(1).toLowerCase();
|
|
90
61
|
}
|
|
91
62
|
function snakeToCamelCase(txt) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
63
|
+
let ret = txt.toLowerCase();
|
|
64
|
+
ret = ret.replace(/_/g, " ");
|
|
65
|
+
ret = ret.replace(/\w\S*/g, toTitleCase);
|
|
66
|
+
ret = ret.charAt(0).toLowerCase() + ret.substring(1);
|
|
67
|
+
return ret;
|
|
97
68
|
}
|
|
98
69
|
function convertExtensionParams(params) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return converted;
|
|
70
|
+
const systemPrefixes = {
|
|
71
|
+
FUNCTION: "firebaseextensions.v1beta.function",
|
|
72
|
+
V2FUNCTION: "firebaseextensions.v1beta.v2function"
|
|
73
|
+
};
|
|
74
|
+
const converted = {};
|
|
75
|
+
for (const [rawKey, paramVal] of Object.entries(params)) {
|
|
76
|
+
let key = rawKey;
|
|
77
|
+
if (rawKey.startsWith("_") && rawKey !== "_EVENT_ARC_REGION") {
|
|
78
|
+
const prefix = rawKey.substring(1).split("_")[0];
|
|
79
|
+
const suffix = rawKey.substring(2 + prefix.length);
|
|
80
|
+
key = `${systemPrefixes[prefix]}/${snakeToCamelCase(suffix)}`;
|
|
81
|
+
}
|
|
82
|
+
if (Array.isArray(paramVal)) {
|
|
83
|
+
converted[key] = paramVal.join(",");
|
|
84
|
+
} else {
|
|
85
|
+
converted[key] = paramVal;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return converted;
|
|
119
89
|
}
|
|
120
90
|
function isObject(value) {
|
|
121
|
-
|
|
91
|
+
return typeof value === "object" && value !== null;
|
|
122
92
|
}
|
|
123
93
|
const isFirebaseLocalExtension = (val) => {
|
|
124
|
-
|
|
125
|
-
typeof val.FIREBASE_EXTENSION_LOCAL_PATH === "string" &&
|
|
126
|
-
typeof val.instanceId === "string" &&
|
|
127
|
-
isObject(val.params) &&
|
|
128
|
-
(!val.events || Array.isArray(val.events)));
|
|
94
|
+
return isObject(val) && typeof val.FIREBASE_EXTENSION_LOCAL_PATH === "string" && typeof val.instanceId === "string" && isObject(val.params) && (!val.events || Array.isArray(val.events));
|
|
129
95
|
};
|
|
130
96
|
const isFirebaseRefExtension = (val) => {
|
|
131
|
-
|
|
132
|
-
typeof val.FIREBASE_EXTENSION_REFERENCE === "string" &&
|
|
133
|
-
typeof val.instanceId === "string" &&
|
|
134
|
-
isObject(val.params) &&
|
|
135
|
-
(!val.events || Array.isArray(val.events)));
|
|
97
|
+
return isObject(val) && typeof val.FIREBASE_EXTENSION_REFERENCE === "string" && typeof val.instanceId === "string" && isObject(val.params) && (!val.events || Array.isArray(val.events));
|
|
136
98
|
};
|
|
137
|
-
/* @internal */
|
|
138
99
|
function mergeRequiredAPIs(requiredAPIs) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
100
|
+
const apiToReasons = {};
|
|
101
|
+
for (const { api, reason } of requiredAPIs) {
|
|
102
|
+
const reasons = apiToReasons[api] || new Set();
|
|
103
|
+
reasons.add(reason);
|
|
104
|
+
apiToReasons[api] = reasons;
|
|
105
|
+
}
|
|
106
|
+
const merged = [];
|
|
107
|
+
for (const [api, reasons] of Object.entries(apiToReasons)) {
|
|
108
|
+
merged.push({
|
|
109
|
+
api,
|
|
110
|
+
reason: Array.from(reasons).join(" ")
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
return merged;
|
|
150
114
|
}
|
|
151
|
-
exports.mergeRequiredAPIs = mergeRequiredAPIs;
|
|
152
|
-
/* @internal */
|
|
153
115
|
async function loadStack(functionsDir) {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
116
|
+
const endpoints = {};
|
|
117
|
+
const requiredAPIs = [];
|
|
118
|
+
const extensions = {};
|
|
119
|
+
const mod = await loadModule(functionsDir);
|
|
120
|
+
extractStack(mod, endpoints, requiredAPIs, extensions);
|
|
121
|
+
const stack = {
|
|
122
|
+
endpoints,
|
|
123
|
+
specVersion: "v1alpha1",
|
|
124
|
+
requiredAPIs: mergeRequiredAPIs(requiredAPIs),
|
|
125
|
+
extensions
|
|
126
|
+
};
|
|
127
|
+
if (require_params_index.declaredParams.length > 0) {
|
|
128
|
+
stack.params = require_params_index.declaredParams.map((p) => p.toSpec());
|
|
129
|
+
}
|
|
130
|
+
return stack;
|
|
169
131
|
}
|
|
132
|
+
|
|
133
|
+
//#endregion
|
|
134
|
+
exports.extractStack = extractStack;
|
|
170
135
|
exports.loadStack = loadStack;
|
|
136
|
+
exports.mergeRequiredAPIs = mergeRequiredAPIs;
|
package/lib/runtime/manifest.js
CHANGED
|
@@ -1,159 +1,139 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
// in the Software without restriction, including without limitation the rights
|
|
9
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
// furnished to do so, subject to the following conditions:
|
|
12
|
-
//
|
|
13
|
-
// The above copyright notice and this permission notice shall be included in
|
|
14
|
-
// all 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.initV2ScheduleTrigger = exports.initV1ScheduleTrigger = exports.initTaskQueueTrigger = exports.initV2Endpoint = exports.initV1Endpoint = exports.stackToWire = void 0;
|
|
25
|
-
const options_1 = require("../common/options");
|
|
26
|
-
const params_1 = require("../params");
|
|
1
|
+
const require_params_types = require('../params/types.js');
|
|
2
|
+
require('../params/index.js');
|
|
3
|
+
const require_common_options = require('../common/options.js');
|
|
4
|
+
|
|
5
|
+
//#region src/runtime/manifest.ts
|
|
27
6
|
/**
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
7
|
+
* Returns the JSON representation of a ManifestStack, which has CEL
|
|
8
|
+
* expressions in its options as object types, with its expressions
|
|
9
|
+
* transformed into the actual CEL strings.
|
|
10
|
+
*
|
|
11
|
+
* @alpha
|
|
12
|
+
*/
|
|
34
13
|
function stackToWire(stack) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
};
|
|
50
|
-
traverse(wireStack.endpoints);
|
|
51
|
-
return wireStack;
|
|
14
|
+
const wireStack = stack;
|
|
15
|
+
const traverse = function traverse$1(obj) {
|
|
16
|
+
for (const [key, val] of Object.entries(obj)) {
|
|
17
|
+
if (val instanceof require_params_types.Expression) {
|
|
18
|
+
obj[key] = val.toCEL();
|
|
19
|
+
} else if (val instanceof require_common_options.ResetValue) {
|
|
20
|
+
obj[key] = val.toJSON();
|
|
21
|
+
} else if (typeof val === "object" && val !== null) {
|
|
22
|
+
traverse$1(val);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
traverse(wireStack.endpoints);
|
|
27
|
+
return wireStack;
|
|
52
28
|
}
|
|
53
|
-
exports.stackToWire = stackToWire;
|
|
54
29
|
const RESETTABLE_OPTIONS = {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
30
|
+
availableMemoryMb: null,
|
|
31
|
+
timeoutSeconds: null,
|
|
32
|
+
minInstances: null,
|
|
33
|
+
maxInstances: null,
|
|
34
|
+
ingressSettings: null,
|
|
35
|
+
concurrency: null,
|
|
36
|
+
serviceAccountEmail: null,
|
|
37
|
+
vpc: null
|
|
63
38
|
};
|
|
64
39
|
function initEndpoint(resetOptions, ...opts) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
40
|
+
const endpoint = {};
|
|
41
|
+
if (opts.every((opt) => !opt?.preserveExternalChanges)) {
|
|
42
|
+
for (const key of Object.keys(resetOptions)) {
|
|
43
|
+
endpoint[key] = require_common_options.RESET_VALUE;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return endpoint;
|
|
72
47
|
}
|
|
73
48
|
/**
|
|
74
|
-
|
|
75
|
-
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
76
51
|
function initV1Endpoint(...opts) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
return initEndpoint({ ...resetOpts }, ...opts);
|
|
52
|
+
const { concurrency,...resetOpts } = RESETTABLE_OPTIONS;
|
|
53
|
+
return initEndpoint({ ...resetOpts }, ...opts);
|
|
80
54
|
}
|
|
81
|
-
exports.initV1Endpoint = initV1Endpoint;
|
|
82
55
|
/**
|
|
83
|
-
|
|
84
|
-
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
85
58
|
function initV2Endpoint(...opts) {
|
|
86
|
-
|
|
59
|
+
return initEndpoint(RESETTABLE_OPTIONS, ...opts);
|
|
87
60
|
}
|
|
88
|
-
exports.initV2Endpoint = initV2Endpoint;
|
|
89
61
|
const RESETTABLE_RETRY_CONFIG_OPTIONS = {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
62
|
+
maxAttempts: null,
|
|
63
|
+
maxDoublings: null,
|
|
64
|
+
maxBackoffSeconds: null,
|
|
65
|
+
maxRetrySeconds: null,
|
|
66
|
+
minBackoffSeconds: null
|
|
95
67
|
};
|
|
96
68
|
const RESETTABLE_RATE_LIMITS_OPTIONS = {
|
|
97
|
-
|
|
98
|
-
|
|
69
|
+
maxConcurrentDispatches: null,
|
|
70
|
+
maxDispatchesPerSecond: null
|
|
99
71
|
};
|
|
100
72
|
/**
|
|
101
|
-
|
|
102
|
-
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
103
75
|
function initTaskQueueTrigger(...opts) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
76
|
+
const taskQueueTrigger = {
|
|
77
|
+
retryConfig: {},
|
|
78
|
+
rateLimits: {}
|
|
79
|
+
};
|
|
80
|
+
if (opts.every((opt) => !opt?.preserveExternalChanges)) {
|
|
81
|
+
for (const key of Object.keys(RESETTABLE_RETRY_CONFIG_OPTIONS)) {
|
|
82
|
+
taskQueueTrigger.retryConfig[key] = require_common_options.RESET_VALUE;
|
|
83
|
+
}
|
|
84
|
+
for (const key of Object.keys(RESETTABLE_RATE_LIMITS_OPTIONS)) {
|
|
85
|
+
taskQueueTrigger.rateLimits[key] = require_common_options.RESET_VALUE;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return taskQueueTrigger;
|
|
117
89
|
}
|
|
118
|
-
exports.initTaskQueueTrigger = initTaskQueueTrigger;
|
|
119
90
|
const RESETTABLE_V1_SCHEDULE_OPTIONS = {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
91
|
+
retryCount: null,
|
|
92
|
+
maxDoublings: null,
|
|
93
|
+
maxRetryDuration: null,
|
|
94
|
+
maxBackoffDuration: null,
|
|
95
|
+
minBackoffDuration: null
|
|
125
96
|
};
|
|
126
97
|
const RESETTABLE_V2_SCHEDULE_OPTIONS = {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
98
|
+
retryCount: null,
|
|
99
|
+
maxDoublings: null,
|
|
100
|
+
maxRetrySeconds: null,
|
|
101
|
+
minBackoffSeconds: null,
|
|
102
|
+
maxBackoffSeconds: null
|
|
132
103
|
};
|
|
133
104
|
function initScheduleTrigger(resetOptions, schedule, ...opts) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
105
|
+
let scheduleTrigger = {
|
|
106
|
+
schedule,
|
|
107
|
+
retryConfig: {}
|
|
108
|
+
};
|
|
109
|
+
if (opts.every((opt) => !opt?.preserveExternalChanges)) {
|
|
110
|
+
for (const key of Object.keys(resetOptions)) {
|
|
111
|
+
scheduleTrigger.retryConfig[key] = require_common_options.RESET_VALUE;
|
|
112
|
+
}
|
|
113
|
+
scheduleTrigger = {
|
|
114
|
+
...scheduleTrigger,
|
|
115
|
+
timeZone: require_common_options.RESET_VALUE
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
return scheduleTrigger;
|
|
145
119
|
}
|
|
146
120
|
/**
|
|
147
|
-
|
|
148
|
-
|
|
121
|
+
* @internal
|
|
122
|
+
*/
|
|
149
123
|
function initV1ScheduleTrigger(schedule, ...opts) {
|
|
150
|
-
|
|
124
|
+
return initScheduleTrigger(RESETTABLE_V1_SCHEDULE_OPTIONS, schedule, ...opts);
|
|
151
125
|
}
|
|
152
|
-
exports.initV1ScheduleTrigger = initV1ScheduleTrigger;
|
|
153
126
|
/**
|
|
154
|
-
|
|
155
|
-
|
|
127
|
+
* @internal
|
|
128
|
+
*/
|
|
156
129
|
function initV2ScheduleTrigger(schedule, ...opts) {
|
|
157
|
-
|
|
130
|
+
return initScheduleTrigger(RESETTABLE_V2_SCHEDULE_OPTIONS, schedule, ...opts);
|
|
158
131
|
}
|
|
132
|
+
|
|
133
|
+
//#endregion
|
|
134
|
+
exports.initTaskQueueTrigger = initTaskQueueTrigger;
|
|
135
|
+
exports.initV1Endpoint = initV1Endpoint;
|
|
136
|
+
exports.initV1ScheduleTrigger = initV1ScheduleTrigger;
|
|
137
|
+
exports.initV2Endpoint = initV2Endpoint;
|
|
159
138
|
exports.initV2ScheduleTrigger = initV2ScheduleTrigger;
|
|
139
|
+
exports.stackToWire = stackToWire;
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Request, Response } from "express";
|
|
1
|
+
import type { Request, Response } from "express";
|
|
2
2
|
import { DeploymentOptions, FailurePolicy, Schedule } from "./function-configuration";
|
|
3
|
-
export { Request, Response };
|
|
3
|
+
export type { Request, Response };
|
|
4
4
|
import { ManifestEndpoint, ManifestRequiredAPI } from "../runtime/manifest";
|
|
5
5
|
export { Change } from "../common/change";
|
|
6
6
|
/**
|