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.
Files changed (156) hide show
  1. package/lib/_virtual/rolldown_runtime.js +34 -0
  2. package/lib/bin/firebase-functions.js +78 -103
  3. package/lib/common/app.js +35 -55
  4. package/lib/common/change.js +54 -75
  5. package/lib/common/config.js +41 -41
  6. package/lib/common/debug.js +23 -47
  7. package/lib/common/encoding.js +59 -82
  8. package/lib/common/onInit.js +26 -28
  9. package/lib/common/options.js +22 -42
  10. package/lib/common/params.d.ts +6 -6
  11. package/lib/common/params.js +0 -23
  12. package/lib/common/providers/database.js +270 -300
  13. package/lib/common/providers/firestore.js +66 -92
  14. package/lib/common/providers/https.d.ts +0 -1
  15. package/lib/common/providers/https.js +537 -539
  16. package/lib/common/providers/identity.js +393 -444
  17. package/lib/common/providers/tasks.js +64 -98
  18. package/lib/common/timezone.js +544 -542
  19. package/lib/common/trace.d.ts +0 -1
  20. package/lib/common/trace.js +63 -55
  21. package/lib/common/utilities/assertions.d.ts +11 -0
  22. package/lib/common/utilities/assertions.js +18 -0
  23. package/lib/common/utilities/encoder.js +20 -37
  24. package/lib/common/utilities/path-pattern.js +106 -132
  25. package/lib/common/utilities/path.js +28 -27
  26. package/lib/common/utilities/utils.js +23 -45
  27. package/lib/esm/_virtual/rolldown_runtime.mjs +16 -0
  28. package/lib/esm/bin/firebase-functions.mjs +91 -0
  29. package/lib/esm/common/app.mjs +39 -0
  30. package/lib/esm/common/change.mjs +57 -0
  31. package/lib/esm/common/config.mjs +45 -0
  32. package/lib/esm/common/debug.mjs +28 -0
  33. package/lib/esm/common/encoding.mjs +69 -0
  34. package/lib/esm/common/onInit.mjs +33 -0
  35. package/lib/esm/common/options.mjs +22 -0
  36. package/lib/esm/common/params.mjs +1 -0
  37. package/lib/esm/common/providers/database.mjs +269 -0
  38. package/lib/esm/common/providers/firestore.mjs +78 -0
  39. package/lib/esm/common/providers/https.mjs +573 -0
  40. package/lib/esm/common/providers/identity.mjs +428 -0
  41. package/lib/esm/common/providers/tasks.mjs +67 -0
  42. package/lib/esm/common/timezone.mjs +544 -0
  43. package/lib/esm/common/trace.mjs +73 -0
  44. package/lib/esm/common/utilities/assertions.mjs +17 -0
  45. package/lib/esm/common/utilities/encoder.mjs +21 -0
  46. package/lib/esm/common/utilities/path-pattern.mjs +116 -0
  47. package/lib/esm/common/utilities/path.mjs +35 -0
  48. package/lib/esm/common/utilities/utils.mjs +29 -0
  49. package/lib/esm/function-configuration.mjs +1 -0
  50. package/lib/esm/logger/common.mjs +23 -0
  51. package/lib/esm/logger/compat.mjs +25 -0
  52. package/lib/esm/logger/index.mjs +131 -0
  53. package/lib/esm/params/index.mjs +160 -0
  54. package/lib/esm/params/types.mjs +400 -0
  55. package/lib/esm/runtime/loader.mjs +132 -0
  56. package/lib/esm/runtime/manifest.mjs +134 -0
  57. package/lib/esm/types/global.d.mjs +1 -0
  58. package/lib/esm/v1/cloud-functions.mjs +206 -0
  59. package/lib/esm/v1/config.mjs +14 -0
  60. package/lib/esm/v1/function-builder.mjs +252 -0
  61. package/lib/esm/v1/function-configuration.mjs +72 -0
  62. package/lib/esm/v1/index.mjs +27 -0
  63. package/lib/esm/v1/providers/analytics.mjs +212 -0
  64. package/lib/esm/v1/providers/auth.mjs +156 -0
  65. package/lib/esm/v1/providers/database.mjs +243 -0
  66. package/lib/esm/v1/providers/firestore.mjs +131 -0
  67. package/lib/esm/v1/providers/https.mjs +82 -0
  68. package/lib/esm/v1/providers/pubsub.mjs +175 -0
  69. package/lib/esm/v1/providers/remoteConfig.mjs +64 -0
  70. package/lib/esm/v1/providers/storage.mjs +163 -0
  71. package/lib/esm/v1/providers/tasks.mjs +63 -0
  72. package/lib/esm/v1/providers/testLab.mjs +94 -0
  73. package/lib/esm/v2/core.mjs +4 -0
  74. package/lib/esm/v2/index.mjs +28 -0
  75. package/lib/esm/v2/options.mjs +102 -0
  76. package/lib/esm/v2/providers/alerts/alerts.mjs +85 -0
  77. package/lib/esm/v2/providers/alerts/appDistribution.mjs +75 -0
  78. package/lib/esm/v2/providers/alerts/billing.mjs +51 -0
  79. package/lib/esm/v2/providers/alerts/crashlytics.mjs +122 -0
  80. package/lib/esm/v2/providers/alerts/index.mjs +22 -0
  81. package/lib/esm/v2/providers/alerts/performance.mjs +66 -0
  82. package/lib/esm/v2/providers/database.mjs +197 -0
  83. package/lib/esm/v2/providers/dataconnect.mjs +130 -0
  84. package/lib/esm/v2/providers/eventarc.mjs +51 -0
  85. package/lib/esm/v2/providers/firestore.mjs +294 -0
  86. package/lib/esm/v2/providers/https.mjs +210 -0
  87. package/lib/esm/v2/providers/identity.mjs +103 -0
  88. package/lib/esm/v2/providers/pubsub.mjs +148 -0
  89. package/lib/esm/v2/providers/remoteConfig.mjs +52 -0
  90. package/lib/esm/v2/providers/scheduler.mjs +84 -0
  91. package/lib/esm/v2/providers/storage.mjs +155 -0
  92. package/lib/esm/v2/providers/tasks.mjs +65 -0
  93. package/lib/esm/v2/providers/testLab.mjs +53 -0
  94. package/lib/esm/v2/trace.mjs +20 -0
  95. package/lib/function-configuration.d.ts +0 -0
  96. package/lib/function-configuration.js +0 -0
  97. package/lib/logger/common.js +21 -41
  98. package/lib/logger/compat.js +18 -33
  99. package/lib/logger/index.js +119 -130
  100. package/lib/params/index.d.ts +4 -2
  101. package/lib/params/index.js +150 -144
  102. package/lib/params/types.js +389 -423
  103. package/lib/runtime/loader.js +114 -148
  104. package/lib/runtime/manifest.js +106 -126
  105. package/lib/types/global.d.js +0 -0
  106. package/lib/v1/cloud-functions.d.ts +2 -2
  107. package/lib/v1/cloud-functions.js +193 -241
  108. package/lib/v1/config.d.ts +4 -7
  109. package/lib/v1/config.js +13 -75
  110. package/lib/v1/function-builder.js +239 -368
  111. package/lib/v1/function-configuration.js +70 -63
  112. package/lib/v1/index.js +118 -73
  113. package/lib/v1/providers/analytics.js +188 -235
  114. package/lib/v1/providers/auth.d.ts +2 -1
  115. package/lib/v1/providers/auth.js +159 -164
  116. package/lib/v1/providers/database.js +237 -242
  117. package/lib/v1/providers/firestore.js +131 -130
  118. package/lib/v1/providers/https.d.ts +2 -1
  119. package/lib/v1/providers/https.js +79 -86
  120. package/lib/v1/providers/pubsub.js +175 -172
  121. package/lib/v1/providers/remoteConfig.js +64 -68
  122. package/lib/v1/providers/storage.js +161 -163
  123. package/lib/v1/providers/tasks.d.ts +1 -1
  124. package/lib/v1/providers/tasks.js +65 -80
  125. package/lib/v1/providers/testLab.js +94 -94
  126. package/lib/v2/core.d.ts +1 -1
  127. package/lib/v2/core.js +5 -32
  128. package/lib/v2/index.d.ts +6 -3
  129. package/lib/v2/index.js +123 -75
  130. package/lib/v2/options.js +88 -114
  131. package/lib/v2/providers/alerts/alerts.js +76 -95
  132. package/lib/v2/providers/alerts/appDistribution.js +73 -78
  133. package/lib/v2/providers/alerts/billing.js +49 -53
  134. package/lib/v2/providers/alerts/crashlytics.js +110 -102
  135. package/lib/v2/providers/alerts/index.js +56 -53
  136. package/lib/v2/providers/alerts/performance.js +64 -74
  137. package/lib/v2/providers/database.js +177 -180
  138. package/lib/v2/providers/dataconnect.d.ts +95 -0
  139. package/lib/v2/providers/dataconnect.js +137 -0
  140. package/lib/v2/providers/eventarc.js +55 -77
  141. package/lib/v2/providers/firestore.js +262 -260
  142. package/lib/v2/providers/https.d.ts +3 -2
  143. package/lib/v2/providers/https.js +210 -247
  144. package/lib/v2/providers/identity.d.ts +2 -1
  145. package/lib/v2/providers/identity.js +96 -105
  146. package/lib/v2/providers/pubsub.js +149 -167
  147. package/lib/v2/providers/remoteConfig.js +54 -63
  148. package/lib/v2/providers/scheduler.js +84 -96
  149. package/lib/v2/providers/storage.js +147 -162
  150. package/lib/v2/providers/tasks.d.ts +1 -1
  151. package/lib/v2/providers/tasks.js +68 -95
  152. package/lib/v2/providers/testLab.js +55 -64
  153. package/lib/v2/trace.js +18 -19
  154. package/package.json +290 -226
  155. package/protos/compiledFirestore.mjs +3512 -0
  156. package/protos/update.sh +28 -7
@@ -1,170 +1,136 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loadStack = exports.mergeRequiredAPIs = exports.extractStack = void 0;
4
- // The MIT License (MIT)
5
- //
6
- // Copyright (c) 2021 Firebase
7
- //
8
- // Permission is hereby granted, free of charge, to any person obtaining a copy
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
- * Dynamically load import function to prevent TypeScript from
30
- * transpiling into a require.
31
- *
32
- * See https://github.com/microsoft/TypeScript/issues/43329.
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
- const absolutePath = path.resolve(functionsDir);
39
- try {
40
- return require(path.resolve(absolutePath));
41
- }
42
- catch (e) {
43
- if (e.code === "ERR_REQUIRE_ESM" || e.code === "ERR_REQUIRE_ASYNC_MODULE") {
44
- // This is an ESM package, or one containing top-level awaits!
45
- const modulePath = require.resolve(absolutePath);
46
- // Resolve module path to file:// URL. Required for windows support.
47
- const moduleURL = url.pathToFileURL(modulePath).href;
48
- return await dynamicImport(moduleURL);
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
- /* @internal */
54
- function extractStack(module, endpoints, requiredAPIs, extensions, prefix = "") {
55
- for (const [name, valAsUnknown] of Object.entries(module)) {
56
- // We're introspecting untrusted code here. Any is appropraite
57
- const val = valAsUnknown;
58
- if (typeof val === "function" && val.__endpoint && typeof val.__endpoint === "object") {
59
- const funcName = prefix + name;
60
- endpoints[funcName] = {
61
- ...val.__endpoint,
62
- entryPoint: funcName.replace(/-/g, "."),
63
- };
64
- if (val.__requiredAPIs && Array.isArray(val.__requiredAPIs)) {
65
- requiredAPIs.push(...val.__requiredAPIs);
66
- }
67
- }
68
- else if (isFirebaseRefExtension(val)) {
69
- extensions[val.instanceId] = {
70
- params: convertExtensionParams(val.params),
71
- ref: val.FIREBASE_EXTENSION_REFERENCE,
72
- events: val.events || [],
73
- };
74
- }
75
- else if (isFirebaseLocalExtension(val)) {
76
- extensions[val.instanceId] = {
77
- params: convertExtensionParams(val.params),
78
- localPath: val.FIREBASE_EXTENSION_LOCAL_PATH,
79
- events: val.events || [],
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
- return txt.charAt(0).toUpperCase() + txt.substring(1).toLowerCase();
60
+ return txt.charAt(0).toUpperCase() + txt.substring(1).toLowerCase();
90
61
  }
91
62
  function snakeToCamelCase(txt) {
92
- let ret = txt.toLowerCase();
93
- ret = ret.replace(/_/g, " ");
94
- ret = ret.replace(/\w\S*/g, toTitleCase);
95
- ret = ret.charAt(0).toLowerCase() + ret.substring(1);
96
- return ret;
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
- const systemPrefixes = {
100
- FUNCTION: "firebaseextensions.v1beta.function",
101
- V2FUNCTION: "firebaseextensions.v1beta.v2function",
102
- };
103
- const converted = {};
104
- for (const [rawKey, paramVal] of Object.entries(params)) {
105
- let key = rawKey;
106
- if (rawKey.startsWith("_") && rawKey !== "_EVENT_ARC_REGION") {
107
- const prefix = rawKey.substring(1).split("_")[0];
108
- const suffix = rawKey.substring(2 + prefix.length); // 2 for underscores
109
- key = `${systemPrefixes[prefix]}/${snakeToCamelCase(suffix)}`;
110
- }
111
- if (Array.isArray(paramVal)) {
112
- converted[key] = paramVal.join(",");
113
- }
114
- else {
115
- converted[key] = paramVal;
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
- return typeof value === "object" && value !== null;
91
+ return typeof value === "object" && value !== null;
122
92
  }
123
93
  const isFirebaseLocalExtension = (val) => {
124
- return (isObject(val) &&
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
- return (isObject(val) &&
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
- const apiToReasons = {};
140
- for (const { api, reason } of requiredAPIs) {
141
- const reasons = apiToReasons[api] || new Set();
142
- reasons.add(reason);
143
- apiToReasons[api] = reasons;
144
- }
145
- const merged = [];
146
- for (const [api, reasons] of Object.entries(apiToReasons)) {
147
- merged.push({ api, reason: Array.from(reasons).join(" ") });
148
- }
149
- return merged;
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
- const endpoints = {};
155
- const requiredAPIs = [];
156
- const extensions = {};
157
- const mod = await loadModule(functionsDir);
158
- extractStack(mod, endpoints, requiredAPIs, extensions);
159
- const stack = {
160
- endpoints,
161
- specVersion: "v1alpha1",
162
- requiredAPIs: mergeRequiredAPIs(requiredAPIs),
163
- extensions,
164
- };
165
- if (params.declaredParams.length > 0) {
166
- stack.params = params.declaredParams.map((p) => p.toSpec());
167
- }
168
- return stack;
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;
@@ -1,159 +1,139 @@
1
- "use strict";
2
- // The MIT License (MIT)
3
- //
4
- // Copyright (c) 2021 Firebase
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
- * Returns the JSON representation of a ManifestStack, which has CEL
29
- * expressions in its options as object types, with its expressions
30
- * transformed into the actual CEL strings.
31
- *
32
- * @alpha
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
- const wireStack = stack;
36
- const traverse = function traverse(obj) {
37
- for (const [key, val] of Object.entries(obj)) {
38
- if (val instanceof params_1.Expression) {
39
- obj[key] = val.toCEL();
40
- }
41
- else if (val instanceof options_1.ResetValue) {
42
- obj[key] = val.toJSON();
43
- }
44
- else if (typeof val === "object" && val !== null) {
45
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
46
- traverse(val);
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
- availableMemoryMb: null,
56
- timeoutSeconds: null,
57
- minInstances: null,
58
- maxInstances: null,
59
- ingressSettings: null,
60
- concurrency: null,
61
- serviceAccountEmail: null,
62
- vpc: null,
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
- const endpoint = {};
66
- if (opts.every((opt) => !(opt === null || opt === void 0 ? void 0 : opt.preserveExternalChanges))) {
67
- for (const key of Object.keys(resetOptions)) {
68
- endpoint[key] = options_1.RESET_VALUE;
69
- }
70
- }
71
- return endpoint;
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
- * @internal
75
- */
49
+ * @internal
50
+ */
76
51
  function initV1Endpoint(...opts) {
77
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
78
- const { concurrency, ...resetOpts } = RESETTABLE_OPTIONS;
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
- * @internal
84
- */
56
+ * @internal
57
+ */
85
58
  function initV2Endpoint(...opts) {
86
- return initEndpoint(RESETTABLE_OPTIONS, ...opts);
59
+ return initEndpoint(RESETTABLE_OPTIONS, ...opts);
87
60
  }
88
- exports.initV2Endpoint = initV2Endpoint;
89
61
  const RESETTABLE_RETRY_CONFIG_OPTIONS = {
90
- maxAttempts: null,
91
- maxDoublings: null,
92
- maxBackoffSeconds: null,
93
- maxRetrySeconds: null,
94
- minBackoffSeconds: null,
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
- maxConcurrentDispatches: null,
98
- maxDispatchesPerSecond: null,
69
+ maxConcurrentDispatches: null,
70
+ maxDispatchesPerSecond: null
99
71
  };
100
72
  /**
101
- * @internal
102
- */
73
+ * @internal
74
+ */
103
75
  function initTaskQueueTrigger(...opts) {
104
- const taskQueueTrigger = {
105
- retryConfig: {},
106
- rateLimits: {},
107
- };
108
- if (opts.every((opt) => !(opt === null || opt === void 0 ? void 0 : opt.preserveExternalChanges))) {
109
- for (const key of Object.keys(RESETTABLE_RETRY_CONFIG_OPTIONS)) {
110
- taskQueueTrigger.retryConfig[key] = options_1.RESET_VALUE;
111
- }
112
- for (const key of Object.keys(RESETTABLE_RATE_LIMITS_OPTIONS)) {
113
- taskQueueTrigger.rateLimits[key] = options_1.RESET_VALUE;
114
- }
115
- }
116
- return taskQueueTrigger;
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
- retryCount: null,
121
- maxDoublings: null,
122
- maxRetryDuration: null,
123
- maxBackoffDuration: null,
124
- minBackoffDuration: null,
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
- retryCount: null,
128
- maxDoublings: null,
129
- maxRetrySeconds: null,
130
- minBackoffSeconds: null,
131
- maxBackoffSeconds: null,
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
- let scheduleTrigger = {
135
- schedule,
136
- retryConfig: {},
137
- };
138
- if (opts.every((opt) => !(opt === null || opt === void 0 ? void 0 : opt.preserveExternalChanges))) {
139
- for (const key of Object.keys(resetOptions)) {
140
- scheduleTrigger.retryConfig[key] = options_1.RESET_VALUE;
141
- }
142
- scheduleTrigger = { ...scheduleTrigger, timeZone: options_1.RESET_VALUE };
143
- }
144
- return scheduleTrigger;
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
- * @internal
148
- */
121
+ * @internal
122
+ */
149
123
  function initV1ScheduleTrigger(schedule, ...opts) {
150
- return initScheduleTrigger(RESETTABLE_V1_SCHEDULE_OPTIONS, schedule, ...opts);
124
+ return initScheduleTrigger(RESETTABLE_V1_SCHEDULE_OPTIONS, schedule, ...opts);
151
125
  }
152
- exports.initV1ScheduleTrigger = initV1ScheduleTrigger;
153
126
  /**
154
- * @internal
155
- */
127
+ * @internal
128
+ */
156
129
  function initV2ScheduleTrigger(schedule, ...opts) {
157
- return initScheduleTrigger(RESETTABLE_V2_SCHEDULE_OPTIONS, schedule, ...opts);
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
  /**