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.
Files changed (157) 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 +19 -4
  101. package/lib/params/index.js +153 -129
  102. package/lib/params/types.d.ts +17 -0
  103. package/lib/params/types.js +390 -382
  104. package/lib/runtime/loader.js +114 -148
  105. package/lib/runtime/manifest.js +106 -126
  106. package/lib/types/global.d.js +0 -0
  107. package/lib/v1/cloud-functions.d.ts +2 -2
  108. package/lib/v1/cloud-functions.js +193 -241
  109. package/lib/v1/config.d.ts +4 -7
  110. package/lib/v1/config.js +13 -75
  111. package/lib/v1/function-builder.js +239 -368
  112. package/lib/v1/function-configuration.js +70 -63
  113. package/lib/v1/index.js +118 -73
  114. package/lib/v1/providers/analytics.js +189 -210
  115. package/lib/v1/providers/auth.d.ts +2 -1
  116. package/lib/v1/providers/auth.js +159 -164
  117. package/lib/v1/providers/database.js +237 -242
  118. package/lib/v1/providers/firestore.js +131 -130
  119. package/lib/v1/providers/https.d.ts +2 -1
  120. package/lib/v1/providers/https.js +79 -86
  121. package/lib/v1/providers/pubsub.js +175 -172
  122. package/lib/v1/providers/remoteConfig.js +64 -68
  123. package/lib/v1/providers/storage.js +161 -163
  124. package/lib/v1/providers/tasks.d.ts +1 -1
  125. package/lib/v1/providers/tasks.js +65 -80
  126. package/lib/v1/providers/testLab.js +94 -94
  127. package/lib/v2/core.d.ts +1 -1
  128. package/lib/v2/core.js +5 -32
  129. package/lib/v2/index.d.ts +6 -3
  130. package/lib/v2/index.js +123 -75
  131. package/lib/v2/options.js +88 -114
  132. package/lib/v2/providers/alerts/alerts.js +76 -95
  133. package/lib/v2/providers/alerts/appDistribution.js +73 -78
  134. package/lib/v2/providers/alerts/billing.js +49 -53
  135. package/lib/v2/providers/alerts/crashlytics.js +110 -102
  136. package/lib/v2/providers/alerts/index.js +56 -53
  137. package/lib/v2/providers/alerts/performance.js +64 -74
  138. package/lib/v2/providers/database.js +177 -180
  139. package/lib/v2/providers/dataconnect.d.ts +95 -0
  140. package/lib/v2/providers/dataconnect.js +137 -0
  141. package/lib/v2/providers/eventarc.js +55 -77
  142. package/lib/v2/providers/firestore.js +262 -260
  143. package/lib/v2/providers/https.d.ts +3 -2
  144. package/lib/v2/providers/https.js +210 -247
  145. package/lib/v2/providers/identity.d.ts +2 -1
  146. package/lib/v2/providers/identity.js +96 -105
  147. package/lib/v2/providers/pubsub.js +149 -167
  148. package/lib/v2/providers/remoteConfig.js +54 -63
  149. package/lib/v2/providers/scheduler.js +84 -96
  150. package/lib/v2/providers/storage.js +147 -162
  151. package/lib/v2/providers/tasks.d.ts +1 -1
  152. package/lib/v2/providers/tasks.js +68 -95
  153. package/lib/v2/providers/testLab.js +55 -64
  154. package/lib/v2/trace.js +18 -19
  155. package/package.json +290 -226
  156. package/protos/compiledFirestore.mjs +3512 -0
  157. package/protos/update.sh +28 -7
@@ -1,154 +1,143 @@
1
- "use strict";
2
- // The MIT License (MIT)
3
- //
4
- // Copyright (c) 2017 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 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.error = exports.warn = exports.info = exports.log = exports.debug = exports.write = void 0;
25
- const util_1 = require("util");
26
- const trace_1 = require("../common/trace");
27
- const common_1 = require("./common");
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
2
+ const require_common_trace = require('../common/trace.js');
3
+ const require_logger_common = require('./common.js');
4
+ let util = require("util");
5
+ util = require_rolldown_runtime.__toESM(util);
6
+
7
+ //#region src/logger/index.ts
8
+ var logger_exports = /* @__PURE__ */ require_rolldown_runtime.__export({
9
+ debug: () => debug,
10
+ error: () => error,
11
+ info: () => info,
12
+ log: () => log,
13
+ warn: () => warn,
14
+ write: () => write
15
+ });
28
16
  /** @internal */
29
17
  function removeCircular(obj, refs = new Set()) {
30
- if (typeof obj !== "object" || !obj) {
31
- return obj;
32
- }
33
- // If the object defines its own toJSON, prefer that.
34
- if (obj.toJSON && typeof obj.toJSON === "function") {
35
- return obj.toJSON();
36
- }
37
- if (refs.has(obj)) {
38
- return "[Circular]";
39
- }
40
- else {
41
- refs.add(obj);
42
- }
43
- let returnObj;
44
- if (Array.isArray(obj)) {
45
- returnObj = new Array(obj.length);
46
- }
47
- else {
48
- returnObj = {};
49
- }
50
- for (const k in obj) {
51
- if (obj.hasOwnProperty(k)) {
52
- try {
53
- if (refs.has(obj[k])) {
54
- returnObj[k] = "[Circular]";
55
- }
56
- else {
57
- returnObj[k] = removeCircular(obj[k], refs);
58
- }
59
- }
60
- catch {
61
- returnObj[k] = "[Error - cannot serialize]";
62
- }
63
- }
64
- else {
65
- returnObj[k] = "[Error - defined in the prototype but missing in the object]";
66
- }
67
- }
68
- refs.delete(obj);
69
- return returnObj;
18
+ if (typeof obj !== "object" || !obj) {
19
+ return obj;
20
+ }
21
+ if (obj.toJSON && typeof obj.toJSON === "function") {
22
+ return obj.toJSON();
23
+ }
24
+ if (refs.has(obj)) {
25
+ return "[Circular]";
26
+ } else {
27
+ refs.add(obj);
28
+ }
29
+ let returnObj;
30
+ if (Array.isArray(obj)) {
31
+ returnObj = new Array(obj.length);
32
+ } else {
33
+ returnObj = {};
34
+ }
35
+ for (const k in obj) {
36
+ if (obj.hasOwnProperty(k)) {
37
+ try {
38
+ if (refs.has(obj[k])) {
39
+ returnObj[k] = "[Circular]";
40
+ } else {
41
+ returnObj[k] = removeCircular(obj[k], refs);
42
+ }
43
+ } catch {
44
+ returnObj[k] = "[Error - cannot serialize]";
45
+ }
46
+ } else {
47
+ returnObj[k] = "[Error - defined in the prototype but missing in the object]";
48
+ }
49
+ }
50
+ refs.delete(obj);
51
+ return returnObj;
70
52
  }
71
53
  /**
72
- * Writes a `LogEntry` to `stdout`/`stderr` (depending on severity).
73
- * @param entry - The `LogEntry` including severity, message, and any additional structured metadata.
74
- * @public
75
- */
54
+ * Writes a `LogEntry` to `stdout`/`stderr` (depending on severity).
55
+ * @param entry - The `LogEntry` including severity, message, and any additional structured metadata.
56
+ * @public
57
+ */
76
58
  function write(entry) {
77
- const ctx = trace_1.traceContext.getStore();
78
- if (ctx === null || ctx === void 0 ? void 0 : ctx.traceId) {
79
- entry["logging.googleapis.com/trace"] = `projects/${process.env.GCLOUD_PROJECT}/traces/${ctx.traceId}`;
80
- }
81
- common_1.UNPATCHED_CONSOLE[common_1.CONSOLE_SEVERITY[entry.severity]](JSON.stringify(removeCircular(entry)));
59
+ const ctx = require_common_trace.traceContext.getStore();
60
+ if (ctx?.traceId) {
61
+ entry["logging.googleapis.com/trace"] = `projects/${process.env.GCLOUD_PROJECT}/traces/${ctx.traceId}`;
62
+ }
63
+ require_logger_common.UNPATCHED_CONSOLE[require_logger_common.CONSOLE_SEVERITY[entry.severity]](JSON.stringify(removeCircular(entry)));
82
64
  }
83
- exports.write = write;
84
65
  /**
85
- * Writes a `DEBUG` severity log. If the last argument provided is a plain object,
86
- * it is added to the `jsonPayload` in the Cloud Logging entry.
87
- * @param args - Arguments, concatenated into the log message with space separators.
88
- * @public
89
- */
66
+ * Writes a `DEBUG` severity log. If the last argument provided is a plain object,
67
+ * it is added to the `jsonPayload` in the Cloud Logging entry.
68
+ * @param args - Arguments, concatenated into the log message with space separators.
69
+ * @public
70
+ */
90
71
  function debug(...args) {
91
- write(entryFromArgs("DEBUG", args));
72
+ write(entryFromArgs("DEBUG", args));
92
73
  }
93
- exports.debug = debug;
94
74
  /**
95
- * Writes an `INFO` severity log. If the last argument provided is a plain object,
96
- * it is added to the `jsonPayload` in the Cloud Logging entry.
97
- * @param args - Arguments, concatenated into the log message with space separators.
98
- * @public
99
- */
75
+ * Writes an `INFO` severity log. If the last argument provided is a plain object,
76
+ * it is added to the `jsonPayload` in the Cloud Logging entry.
77
+ * @param args - Arguments, concatenated into the log message with space separators.
78
+ * @public
79
+ */
100
80
  function log(...args) {
101
- write(entryFromArgs("INFO", args));
81
+ write(entryFromArgs("INFO", args));
102
82
  }
103
- exports.log = log;
104
83
  /**
105
- * Writes an `INFO` severity log. If the last argument provided is a plain object,
106
- * it is added to the `jsonPayload` in the Cloud Logging entry.
107
- * @param args - Arguments, concatenated into the log message with space separators.
108
- * @public
109
- */
84
+ * Writes an `INFO` severity log. If the last argument provided is a plain object,
85
+ * it is added to the `jsonPayload` in the Cloud Logging entry.
86
+ * @param args - Arguments, concatenated into the log message with space separators.
87
+ * @public
88
+ */
110
89
  function info(...args) {
111
- write(entryFromArgs("INFO", args));
90
+ write(entryFromArgs("INFO", args));
112
91
  }
113
- exports.info = info;
114
92
  /**
115
- * Writes a `WARNING` severity log. If the last argument provided is a plain object,
116
- * it is added to the `jsonPayload` in the Cloud Logging entry.
117
- * @param args - Arguments, concatenated into the log message with space separators.
118
- * @public
119
- */
93
+ * Writes a `WARNING` severity log. If the last argument provided is a plain object,
94
+ * it is added to the `jsonPayload` in the Cloud Logging entry.
95
+ * @param args - Arguments, concatenated into the log message with space separators.
96
+ * @public
97
+ */
120
98
  function warn(...args) {
121
- write(entryFromArgs("WARNING", args));
99
+ write(entryFromArgs("WARNING", args));
122
100
  }
123
- exports.warn = warn;
124
101
  /**
125
- * Writes an `ERROR` severity log. If the last argument provided is a plain object,
126
- * it is added to the `jsonPayload` in the Cloud Logging entry.
127
- * @param args - Arguments, concatenated into the log message with space separators.
128
- * @public
129
- */
102
+ * Writes an `ERROR` severity log. If the last argument provided is a plain object,
103
+ * it is added to the `jsonPayload` in the Cloud Logging entry.
104
+ * @param args - Arguments, concatenated into the log message with space separators.
105
+ * @public
106
+ */
130
107
  function error(...args) {
131
- write(entryFromArgs("ERROR", args));
108
+ write(entryFromArgs("ERROR", args));
132
109
  }
133
- exports.error = error;
134
110
  /** @hidden */
135
111
  function entryFromArgs(severity, args) {
136
- let entry = {};
137
- const lastArg = args[args.length - 1];
138
- if (lastArg && typeof lastArg === "object" && lastArg.constructor === Object) {
139
- entry = args.pop();
140
- }
141
- // mimic `console.*` behavior, see https://nodejs.org/api/console.html#console_console_log_data_args
142
- let message = (0, util_1.format)(...args);
143
- if (severity === "ERROR" && !args.find((arg) => arg instanceof Error)) {
144
- message = new Error(message).stack || message;
145
- }
146
- const out = {
147
- ...entry,
148
- severity,
149
- };
150
- if (message) {
151
- out.message = message;
152
- }
153
- return out;
112
+ let entry = {};
113
+ const lastArg = args[args.length - 1];
114
+ if (lastArg && typeof lastArg === "object" && lastArg.constructor === Object) {
115
+ entry = args.pop();
116
+ }
117
+ let message = (0, util.format)(...args);
118
+ if (severity === "ERROR" && !args.find((arg) => arg instanceof Error)) {
119
+ message = new Error(message).stack || message;
120
+ }
121
+ const out = {
122
+ ...entry,
123
+ severity
124
+ };
125
+ if (message) {
126
+ out.message = message;
127
+ }
128
+ return out;
154
129
  }
130
+
131
+ //#endregion
132
+ exports.debug = debug;
133
+ exports.error = error;
134
+ exports.info = info;
135
+ exports.log = log;
136
+ Object.defineProperty(exports, 'logger_exports', {
137
+ enumerable: true,
138
+ get: function () {
139
+ return logger_exports;
140
+ }
141
+ });
142
+ exports.warn = warn;
143
+ exports.write = write;
@@ -2,10 +2,12 @@
2
2
  * @hidden
3
3
  * @alpha
4
4
  */
5
- import { BooleanParam, Expression, IntParam, Param, ParamOptions, SecretParam, StringParam, ListParam } from "./types";
6
- export { BUCKET_PICKER, TextInput, SelectInput, SelectOptions, MultiSelectInput, select, multiSelect, } from "./types";
7
- export { ParamOptions, Expression };
8
- type SecretOrExpr = Param<any> | SecretParam;
5
+ import { BooleanParam, Expression, IntParam, Param, ParamOptions, SecretParam, JsonSecretParam, StringParam, ListParam } from "./types";
6
+ export { BUCKET_PICKER, select, multiSelect } from "./types";
7
+ export type { TextInput, SelectInput, SelectOptions, MultiSelectInput } from "./types";
8
+ export { Expression };
9
+ export type { ParamOptions };
10
+ type SecretOrExpr = Param<any> | SecretParam | JsonSecretParam<any>;
9
11
  export declare const declaredParams: SecretOrExpr[];
10
12
  /**
11
13
  * A built-in parameter that resolves to the default RTDB database URL associated
@@ -37,6 +39,19 @@ export declare const storageBucket: Param<string>;
37
39
  * @returns A parameter with a `string` return type for `.value`.
38
40
  */
39
41
  export declare function defineSecret(name: string): SecretParam;
42
+ /**
43
+ * Declares a secret parameter that retrieves a structured JSON object in Cloud Secret Manager.
44
+ * This is useful for managing groups of related configuration values, such as all settings
45
+ * for a third-party API, as a single unit.
46
+ *
47
+ * The secret value must be a valid JSON string. At runtime, the value will be automatically parsed
48
+ * and returned as a JavaScript object. If the value is not set or is not valid JSON, an error will be thrown.
49
+ *
50
+ * @param name The name of the environment variable to use to load the parameter.
51
+ * @returns A parameter whose `.value()` method returns the parsed JSON object.
52
+ * ```
53
+ */
54
+ export declare function defineJsonSecret<T = any>(name: string): JsonSecretParam<T>;
40
55
  /**
41
56
  * Declare a string parameter.
42
57
  *
@@ -1,158 +1,182 @@
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 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.defineList = exports.defineFloat = exports.defineInt = exports.defineBoolean = exports.defineString = exports.defineSecret = exports.storageBucket = exports.gcloudProject = exports.projectID = exports.databaseURL = exports.clearParams = exports.declaredParams = exports.Expression = exports.multiSelect = exports.select = exports.BUCKET_PICKER = void 0;
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
2
+ const require_params_types = require('./types.js');
3
+
4
+ //#region src/params/index.ts
5
+ var params_exports = /* @__PURE__ */ require_rolldown_runtime.__export({
6
+ BUCKET_PICKER: () => require_params_types.BUCKET_PICKER,
7
+ Expression: () => require_params_types.Expression,
8
+ clearParams: () => clearParams,
9
+ databaseURL: () => databaseURL,
10
+ declaredParams: () => declaredParams,
11
+ defineBoolean: () => defineBoolean,
12
+ defineFloat: () => defineFloat,
13
+ defineInt: () => defineInt,
14
+ defineJsonSecret: () => defineJsonSecret,
15
+ defineList: () => defineList,
16
+ defineSecret: () => defineSecret,
17
+ defineString: () => defineString,
18
+ gcloudProject: () => gcloudProject,
19
+ multiSelect: () => require_params_types.multiSelect,
20
+ projectID: () => projectID,
21
+ select: () => require_params_types.select,
22
+ storageBucket: () => storageBucket
23
+ });
24
+ const declaredParams = [];
25
25
  /**
26
- * @hidden
27
- * @alpha
28
- */
29
- const types_1 = require("./types");
30
- Object.defineProperty(exports, "Expression", { enumerable: true, get: function () { return types_1.Expression; } });
31
- var types_2 = require("./types");
32
- Object.defineProperty(exports, "BUCKET_PICKER", { enumerable: true, get: function () { return types_2.BUCKET_PICKER; } });
33
- Object.defineProperty(exports, "select", { enumerable: true, get: function () { return types_2.select; } });
34
- Object.defineProperty(exports, "multiSelect", { enumerable: true, get: function () { return types_2.multiSelect; } });
35
- exports.declaredParams = [];
36
- /**
37
- * Use a helper to manage the list such that parameters are uniquely
38
- * registered once only but order is preserved.
39
- * @internal
40
- */
26
+ * Use a helper to manage the list such that parameters are uniquely
27
+ * registered once only but order is preserved.
28
+ * @internal
29
+ */
41
30
  function registerParam(param) {
42
- for (let i = 0; i < exports.declaredParams.length; i++) {
43
- if (exports.declaredParams[i].name === param.name) {
44
- exports.declaredParams.splice(i, 1);
45
- }
46
- }
47
- exports.declaredParams.push(param);
31
+ for (let i = 0; i < declaredParams.length; i++) {
32
+ if (declaredParams[i].name === param.name) {
33
+ declaredParams.splice(i, 1);
34
+ }
35
+ }
36
+ declaredParams.push(param);
48
37
  }
49
38
  /**
50
- * For testing.
51
- * @internal
52
- */
39
+ * For testing.
40
+ * @internal
41
+ */
53
42
  function clearParams() {
54
- exports.declaredParams.splice(0, exports.declaredParams.length);
43
+ declaredParams.splice(0, declaredParams.length);
55
44
  }
56
- exports.clearParams = clearParams;
57
45
  /**
58
- * A built-in parameter that resolves to the default RTDB database URL associated
59
- * with the project, without prompting the deployer. Empty string if none exists.
60
- */
61
- exports.databaseURL = new types_1.InternalExpression("DATABASE_URL", (env) => { var _a; return ((_a = JSON.parse(env.FIREBASE_CONFIG)) === null || _a === void 0 ? void 0 : _a.databaseURL) || ""; });
46
+ * A built-in parameter that resolves to the default RTDB database URL associated
47
+ * with the project, without prompting the deployer. Empty string if none exists.
48
+ */
49
+ const databaseURL = new require_params_types.InternalExpression("DATABASE_URL", (env) => JSON.parse(env.FIREBASE_CONFIG)?.databaseURL || "");
62
50
  /**
63
- * A built-in parameter that resolves to the Cloud project ID associated with
64
- * the project, without prompting the deployer.
65
- */
66
- exports.projectID = new types_1.InternalExpression("PROJECT_ID", (env) => { var _a; return ((_a = JSON.parse(env.FIREBASE_CONFIG)) === null || _a === void 0 ? void 0 : _a.projectId) || ""; });
51
+ * A built-in parameter that resolves to the Cloud project ID associated with
52
+ * the project, without prompting the deployer.
53
+ */
54
+ const projectID = new require_params_types.InternalExpression("PROJECT_ID", (env) => JSON.parse(env.FIREBASE_CONFIG)?.projectId || "");
67
55
  /**
68
- * A built-in parameter that resolves to the Cloud project ID, without prompting
69
- * the deployer.
70
- */
71
- exports.gcloudProject = new types_1.InternalExpression("GCLOUD_PROJECT", (env) => { var _a; return ((_a = JSON.parse(env.FIREBASE_CONFIG)) === null || _a === void 0 ? void 0 : _a.projectId) || ""; });
56
+ * A built-in parameter that resolves to the Cloud project ID, without prompting
57
+ * the deployer.
58
+ */
59
+ const gcloudProject = new require_params_types.InternalExpression("GCLOUD_PROJECT", (env) => JSON.parse(env.FIREBASE_CONFIG)?.projectId || "");
72
60
  /**
73
- * A builtin parameter that resolves to the Cloud storage bucket associated
74
- * with the function, without prompting the deployer. Empty string if not
75
- * defined.
76
- */
77
- exports.storageBucket = new types_1.InternalExpression("STORAGE_BUCKET", (env) => { var _a; return ((_a = JSON.parse(env.FIREBASE_CONFIG)) === null || _a === void 0 ? void 0 : _a.storageBucket) || ""; });
61
+ * A builtin parameter that resolves to the Cloud storage bucket associated
62
+ * with the function, without prompting the deployer. Empty string if not
63
+ * defined.
64
+ */
65
+ const storageBucket = new require_params_types.InternalExpression("STORAGE_BUCKET", (env) => JSON.parse(env.FIREBASE_CONFIG)?.storageBucket || "");
78
66
  /**
79
- * Declares a secret param, that will persist values only in Cloud Secret Manager.
80
- * Secrets are stored internally as bytestrings. Use `ParamOptions.as` to provide type
81
- * hinting during parameter resolution.
82
- *
83
- * @param name The name of the environment variable to use to load the parameter.
84
- * @returns A parameter with a `string` return type for `.value`.
85
- */
67
+ * Declares a secret param, that will persist values only in Cloud Secret Manager.
68
+ * Secrets are stored internally as bytestrings. Use `ParamOptions.as` to provide type
69
+ * hinting during parameter resolution.
70
+ *
71
+ * @param name The name of the environment variable to use to load the parameter.
72
+ * @returns A parameter with a `string` return type for `.value`.
73
+ */
86
74
  function defineSecret(name) {
87
- const param = new types_1.SecretParam(name);
88
- registerParam(param);
89
- return param;
75
+ const param = new require_params_types.SecretParam(name);
76
+ registerParam(param);
77
+ return param;
78
+ }
79
+ /**
80
+ * Declares a secret parameter that retrieves a structured JSON object in Cloud Secret Manager.
81
+ * This is useful for managing groups of related configuration values, such as all settings
82
+ * for a third-party API, as a single unit.
83
+ *
84
+ * The secret value must be a valid JSON string. At runtime, the value will be automatically parsed
85
+ * and returned as a JavaScript object. If the value is not set or is not valid JSON, an error will be thrown.
86
+ *
87
+ * @param name The name of the environment variable to use to load the parameter.
88
+ * @returns A parameter whose `.value()` method returns the parsed JSON object.
89
+ * ```
90
+ */
91
+ function defineJsonSecret(name) {
92
+ const param = new require_params_types.JsonSecretParam(name);
93
+ registerParam(param);
94
+ return param;
90
95
  }
91
- exports.defineSecret = defineSecret;
92
96
  /**
93
- * Declare a string parameter.
94
- *
95
- * @param name The name of the environment variable to use to load the parameter.
96
- * @param options Configuration options for the parameter.
97
- * @returns A parameter with a `string` return type for `.value`.
98
- */
97
+ * Declare a string parameter.
98
+ *
99
+ * @param name The name of the environment variable to use to load the parameter.
100
+ * @param options Configuration options for the parameter.
101
+ * @returns A parameter with a `string` return type for `.value`.
102
+ */
99
103
  function defineString(name, options = {}) {
100
- const param = new types_1.StringParam(name, options);
101
- registerParam(param);
102
- return param;
104
+ const param = new require_params_types.StringParam(name, options);
105
+ registerParam(param);
106
+ return param;
103
107
  }
104
- exports.defineString = defineString;
105
108
  /**
106
- * Declare a boolean parameter.
107
- *
108
- * @param name The name of the environment variable to use to load the parameter.
109
- * @param options Configuration options for the parameter.
110
- * @returns A parameter with a `boolean` return type for `.value`.
111
- */
109
+ * Declare a boolean parameter.
110
+ *
111
+ * @param name The name of the environment variable to use to load the parameter.
112
+ * @param options Configuration options for the parameter.
113
+ * @returns A parameter with a `boolean` return type for `.value`.
114
+ */
112
115
  function defineBoolean(name, options = {}) {
113
- const param = new types_1.BooleanParam(name, options);
114
- registerParam(param);
115
- return param;
116
+ const param = new require_params_types.BooleanParam(name, options);
117
+ registerParam(param);
118
+ return param;
116
119
  }
117
- exports.defineBoolean = defineBoolean;
118
120
  /**
119
- * Declare an integer parameter.
120
- *
121
- * @param name The name of the environment variable to use to load the parameter.
122
- * @param options Configuration options for the parameter.
123
- * @returns A parameter with a `number` return type for `.value`.
124
- */
121
+ * Declare an integer parameter.
122
+ *
123
+ * @param name The name of the environment variable to use to load the parameter.
124
+ * @param options Configuration options for the parameter.
125
+ * @returns A parameter with a `number` return type for `.value`.
126
+ */
125
127
  function defineInt(name, options = {}) {
126
- const param = new types_1.IntParam(name, options);
127
- registerParam(param);
128
- return param;
128
+ const param = new require_params_types.IntParam(name, options);
129
+ registerParam(param);
130
+ return param;
129
131
  }
130
- exports.defineInt = defineInt;
131
132
  /**
132
- * Declare a float parameter.
133
- *
134
- * @param name The name of the environment variable to use to load the parameter.
135
- * @param options Configuration options for the parameter.
136
- * @returns A parameter with a `number` return type for `.value`.
137
- *
138
- * @internal
139
- */
133
+ * Declare a float parameter.
134
+ *
135
+ * @param name The name of the environment variable to use to load the parameter.
136
+ * @param options Configuration options for the parameter.
137
+ * @returns A parameter with a `number` return type for `.value`.
138
+ *
139
+ * @internal
140
+ */
140
141
  function defineFloat(name, options = {}) {
141
- const param = new types_1.FloatParam(name, options);
142
- registerParam(param);
143
- return param;
142
+ const param = new require_params_types.FloatParam(name, options);
143
+ registerParam(param);
144
+ return param;
144
145
  }
145
- exports.defineFloat = defineFloat;
146
146
  /**
147
- * Declare a list parameter.
148
- *
149
- * @param name The name of the environment variable to use to load the parameter.
150
- * @param options Configuration options for the parameter.
151
- * @returns A parameter with a `string[]` return type for `.value`.
152
- */
147
+ * Declare a list parameter.
148
+ *
149
+ * @param name The name of the environment variable to use to load the parameter.
150
+ * @param options Configuration options for the parameter.
151
+ * @returns A parameter with a `string[]` return type for `.value`.
152
+ */
153
153
  function defineList(name, options = {}) {
154
- const param = new types_1.ListParam(name, options);
155
- registerParam(param);
156
- return param;
154
+ const param = new require_params_types.ListParam(name, options);
155
+ registerParam(param);
156
+ return param;
157
157
  }
158
+
159
+ //#endregion
160
+ exports.BUCKET_PICKER = require_params_types.BUCKET_PICKER;
161
+ exports.Expression = require_params_types.Expression;
162
+ exports.clearParams = clearParams;
163
+ exports.databaseURL = databaseURL;
164
+ exports.declaredParams = declaredParams;
165
+ exports.defineBoolean = defineBoolean;
166
+ exports.defineFloat = defineFloat;
167
+ exports.defineInt = defineInt;
168
+ exports.defineJsonSecret = defineJsonSecret;
158
169
  exports.defineList = defineList;
170
+ exports.defineSecret = defineSecret;
171
+ exports.defineString = defineString;
172
+ exports.gcloudProject = gcloudProject;
173
+ exports.multiSelect = require_params_types.multiSelect;
174
+ Object.defineProperty(exports, 'params_exports', {
175
+ enumerable: true,
176
+ get: function () {
177
+ return params_exports;
178
+ }
179
+ });
180
+ exports.projectID = projectID;
181
+ exports.select = require_params_types.select;
182
+ exports.storageBucket = storageBucket;