firebase-functions 4.6.0 → 4.8.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/common/onInit.d.ts +7 -0
- package/lib/common/onInit.js +36 -0
- package/lib/common/providers/database.d.ts +9 -1
- package/lib/common/providers/database.js +3 -0
- package/lib/params/index.d.ts +25 -24
- package/lib/params/index.js +34 -30
- package/lib/params/types.d.ts +60 -49
- package/lib/params/types.js +56 -15
- package/lib/v1/cloud-functions.js +2 -0
- package/lib/v1/index.d.ts +1 -0
- package/lib/v1/index.js +3 -1
- package/lib/v1/providers/https.js +9 -5
- package/lib/v2/core.d.ts +1 -0
- package/lib/v2/core.js +3 -1
- package/lib/v2/index.d.ts +1 -1
- package/lib/v2/index.js +3 -1
- package/lib/v2/providers/alerts/alerts.js +2 -1
- package/lib/v2/providers/alerts/appDistribution.js +3 -2
- package/lib/v2/providers/alerts/billing.js +2 -1
- package/lib/v2/providers/alerts/crashlytics.js +2 -1
- package/lib/v2/providers/alerts/performance.d.ts +0 -4
- package/lib/v2/providers/alerts/performance.js +7 -1
- package/lib/v2/providers/database.js +5 -2
- package/lib/v2/providers/eventarc.js +2 -1
- package/lib/v2/providers/firestore.js +3 -2
- package/lib/v2/providers/https.d.ts +2 -2
- package/lib/v2/providers/https.js +4 -3
- package/lib/v2/providers/identity.js +2 -1
- package/lib/v2/providers/pubsub.js +2 -1
- package/lib/v2/providers/remoteConfig.js +4 -2
- package/lib/v2/providers/scheduler.js +2 -1
- package/lib/v2/providers/storage.d.ts +5 -5
- package/lib/v2/providers/storage.js +5 -3
- package/lib/v2/providers/tasks.js +2 -1
- package/lib/v2/providers/testLab.js +2 -1
- package/package.json +4 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registers a callback that should be run when in a production environment
|
|
3
|
+
* before executing any functions code.
|
|
4
|
+
* Calling this function more than once leads to undefined behavior.
|
|
5
|
+
* @param callback initialization callback to be run before any function executes.
|
|
6
|
+
*/
|
|
7
|
+
export declare function onInit(callback: () => unknown): void;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withInit = exports.onInit = void 0;
|
|
4
|
+
const logger = require("../logger");
|
|
5
|
+
let initCallback = null;
|
|
6
|
+
let didInit = false;
|
|
7
|
+
/**
|
|
8
|
+
* Registers a callback that should be run when in a production environment
|
|
9
|
+
* before executing any functions code.
|
|
10
|
+
* Calling this function more than once leads to undefined behavior.
|
|
11
|
+
* @param callback initialization callback to be run before any function executes.
|
|
12
|
+
*/
|
|
13
|
+
function onInit(callback) {
|
|
14
|
+
if (initCallback) {
|
|
15
|
+
logger.warn("Setting onInit callback more than once. Only the most recent callback will be called");
|
|
16
|
+
}
|
|
17
|
+
initCallback = callback;
|
|
18
|
+
didInit = false;
|
|
19
|
+
}
|
|
20
|
+
exports.onInit = onInit;
|
|
21
|
+
/** @internal */
|
|
22
|
+
function withInit(func) {
|
|
23
|
+
return async (...args) => {
|
|
24
|
+
if (!didInit) {
|
|
25
|
+
if (initCallback) {
|
|
26
|
+
await initCallback();
|
|
27
|
+
}
|
|
28
|
+
didInit = true;
|
|
29
|
+
}
|
|
30
|
+
// Note: This cast is actually inaccurate because it may be a promise, but
|
|
31
|
+
// it doesn't actually matter because the async function will promisify
|
|
32
|
+
// non-promises and forward promises.
|
|
33
|
+
return func(...args);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
exports.withInit = withInit;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { App } from "firebase-admin/app";
|
|
2
2
|
import * as database from "firebase-admin/database";
|
|
3
|
+
/**
|
|
4
|
+
* Pulled from @firebase/database-types, make sure the interface is updated on dependencies upgrades.
|
|
5
|
+
* Represents a child snapshot of a `Reference` that is being iterated over. The key will never be undefined.
|
|
6
|
+
*/
|
|
7
|
+
interface IteratedDataSnapshot extends DataSnapshot {
|
|
8
|
+
key: string;
|
|
9
|
+
}
|
|
3
10
|
/**
|
|
4
11
|
* Interface representing a Firebase Realtime database data snapshot.
|
|
5
12
|
*/
|
|
@@ -97,7 +104,7 @@ export declare class DataSnapshot implements database.DataSnapshot {
|
|
|
97
104
|
* @return `true` if enumeration was canceled due to your callback
|
|
98
105
|
* returning `true`.
|
|
99
106
|
*/
|
|
100
|
-
forEach(action: (a:
|
|
107
|
+
forEach(action: (a: IteratedDataSnapshot) => boolean | void): boolean;
|
|
101
108
|
/**
|
|
102
109
|
* Returns `true` if the specified child path has (non-`null`) data.
|
|
103
110
|
*
|
|
@@ -141,3 +148,4 @@ export declare class DataSnapshot implements database.DataSnapshot {
|
|
|
141
148
|
/** @hidden */
|
|
142
149
|
private _fullPath;
|
|
143
150
|
}
|
|
151
|
+
export {};
|
package/lib/params/index.d.ts
CHANGED
|
@@ -3,69 +3,70 @@
|
|
|
3
3
|
* @alpha
|
|
4
4
|
*/
|
|
5
5
|
import { BooleanParam, Expression, IntParam, Param, ParamOptions, SecretParam, StringParam, ListParam } from "./types";
|
|
6
|
+
export { BUCKET_PICKER, TextInput, SelectInput, SelectOptions, MultiSelectInput, select, multiSelect, } from "./types";
|
|
6
7
|
export { ParamOptions, Expression };
|
|
7
8
|
type SecretOrExpr = Param<any> | SecretParam;
|
|
8
9
|
export declare const declaredParams: SecretOrExpr[];
|
|
9
10
|
/**
|
|
10
|
-
* A
|
|
11
|
+
* A built-in parameter that resolves to the default RTDB database URL associated
|
|
11
12
|
* with the project, without prompting the deployer. Empty string if none exists.
|
|
12
13
|
*/
|
|
13
14
|
export declare const databaseURL: Param<string>;
|
|
14
15
|
/**
|
|
15
|
-
* A
|
|
16
|
+
* A built-in parameter that resolves to the Cloud project ID associated with
|
|
16
17
|
* the project, without prompting the deployer.
|
|
17
18
|
*/
|
|
18
19
|
export declare const projectID: Param<string>;
|
|
19
20
|
/**
|
|
20
|
-
* A
|
|
21
|
+
* A built-in parameter that resolves to the Cloud project ID, without prompting
|
|
21
22
|
* the deployer.
|
|
22
23
|
*/
|
|
23
24
|
export declare const gcloudProject: Param<string>;
|
|
24
25
|
/**
|
|
25
|
-
* A builtin
|
|
26
|
+
* A builtin parameter that resolves to the Cloud storage bucket associated
|
|
26
27
|
* with the function, without prompting the deployer. Empty string if not
|
|
27
28
|
* defined.
|
|
28
29
|
*/
|
|
29
30
|
export declare const storageBucket: Param<string>;
|
|
30
31
|
/**
|
|
31
32
|
* Declares a secret param, that will persist values only in Cloud Secret Manager.
|
|
32
|
-
* Secrets are stored interally as bytestrings. Use ParamOptions
|
|
33
|
+
* Secrets are stored interally as bytestrings. Use `ParamOptions.as` to provide type
|
|
33
34
|
* hinting during parameter resolution.
|
|
34
35
|
*
|
|
35
|
-
* @param name The name of the environment variable to use to load the
|
|
36
|
-
* @param options Configuration options for the
|
|
37
|
-
* @returns A
|
|
36
|
+
* @param name The name of the environment variable to use to load the parameter.
|
|
37
|
+
* @param options Configuration options for the parameter.
|
|
38
|
+
* @returns A parameter with a `string` return type for `.value`.
|
|
38
39
|
*/
|
|
39
40
|
export declare function defineSecret(name: string): SecretParam;
|
|
40
41
|
/**
|
|
41
|
-
* Declare a string
|
|
42
|
+
* Declare a string parameter.
|
|
42
43
|
*
|
|
43
|
-
* @param name The name of the environment variable to use to load the
|
|
44
|
-
* @param options Configuration options for the
|
|
45
|
-
* @returns A
|
|
44
|
+
* @param name The name of the environment variable to use to load the parameter.
|
|
45
|
+
* @param options Configuration options for the parameter.
|
|
46
|
+
* @returns A parameter with a `string` return type for `.value`.
|
|
46
47
|
*/
|
|
47
48
|
export declare function defineString(name: string, options?: ParamOptions<string>): StringParam;
|
|
48
49
|
/**
|
|
49
|
-
* Declare a boolean
|
|
50
|
+
* Declare a boolean parameter.
|
|
50
51
|
*
|
|
51
|
-
* @param name The name of the environment variable to use to load the
|
|
52
|
-
* @param options Configuration options for the
|
|
53
|
-
* @returns A
|
|
52
|
+
* @param name The name of the environment variable to use to load the parameter.
|
|
53
|
+
* @param options Configuration options for the parameter.
|
|
54
|
+
* @returns A parameter with a `boolean` return type for `.value`.
|
|
54
55
|
*/
|
|
55
56
|
export declare function defineBoolean(name: string, options?: ParamOptions<boolean>): BooleanParam;
|
|
56
57
|
/**
|
|
57
|
-
* Declare an integer
|
|
58
|
+
* Declare an integer parameter.
|
|
58
59
|
*
|
|
59
|
-
* @param name The name of the environment variable to use to load the
|
|
60
|
-
* @param options Configuration options for the
|
|
61
|
-
* @returns A
|
|
60
|
+
* @param name The name of the environment variable to use to load the parameter.
|
|
61
|
+
* @param options Configuration options for the parameter.
|
|
62
|
+
* @returns A parameter with a `number` return type for `.value`.
|
|
62
63
|
*/
|
|
63
64
|
export declare function defineInt(name: string, options?: ParamOptions<number>): IntParam;
|
|
64
65
|
/**
|
|
65
|
-
* Declare a list
|
|
66
|
+
* Declare a list parameter.
|
|
66
67
|
*
|
|
67
|
-
* @param name The name of the environment variable to use to load the
|
|
68
|
-
* @param options Configuration options for the
|
|
69
|
-
* @returns A
|
|
68
|
+
* @param name The name of the environment variable to use to load the parameter.
|
|
69
|
+
* @param options Configuration options for the parameter.
|
|
70
|
+
* @returns A parameter with a `string[]` return type for `.value`.
|
|
70
71
|
*/
|
|
71
72
|
export declare function defineList(name: string, options?: ParamOptions<string[]>): ListParam;
|
package/lib/params/index.js
CHANGED
|
@@ -21,16 +21,20 @@
|
|
|
21
21
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
// SOFTWARE.
|
|
23
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 = void 0;
|
|
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;
|
|
25
25
|
/**
|
|
26
26
|
* @hidden
|
|
27
27
|
* @alpha
|
|
28
28
|
*/
|
|
29
29
|
const types_1 = require("./types");
|
|
30
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; } });
|
|
31
35
|
exports.declaredParams = [];
|
|
32
36
|
/**
|
|
33
|
-
* Use a helper to manage the list such that
|
|
37
|
+
* Use a helper to manage the list such that parameters are uniquely
|
|
34
38
|
* registered once only but order is preserved.
|
|
35
39
|
* @internal
|
|
36
40
|
*/
|
|
@@ -51,34 +55,34 @@ function clearParams() {
|
|
|
51
55
|
}
|
|
52
56
|
exports.clearParams = clearParams;
|
|
53
57
|
/**
|
|
54
|
-
* A
|
|
58
|
+
* A built-in parameter that resolves to the default RTDB database URL associated
|
|
55
59
|
* with the project, without prompting the deployer. Empty string if none exists.
|
|
56
60
|
*/
|
|
57
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) || ""; });
|
|
58
62
|
/**
|
|
59
|
-
* A
|
|
63
|
+
* A built-in parameter that resolves to the Cloud project ID associated with
|
|
60
64
|
* the project, without prompting the deployer.
|
|
61
65
|
*/
|
|
62
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) || ""; });
|
|
63
67
|
/**
|
|
64
|
-
* A
|
|
68
|
+
* A built-in parameter that resolves to the Cloud project ID, without prompting
|
|
65
69
|
* the deployer.
|
|
66
70
|
*/
|
|
67
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) || ""; });
|
|
68
72
|
/**
|
|
69
|
-
* A builtin
|
|
73
|
+
* A builtin parameter that resolves to the Cloud storage bucket associated
|
|
70
74
|
* with the function, without prompting the deployer. Empty string if not
|
|
71
75
|
* defined.
|
|
72
76
|
*/
|
|
73
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) || ""; });
|
|
74
78
|
/**
|
|
75
79
|
* Declares a secret param, that will persist values only in Cloud Secret Manager.
|
|
76
|
-
* Secrets are stored interally as bytestrings. Use ParamOptions
|
|
80
|
+
* Secrets are stored interally as bytestrings. Use `ParamOptions.as` to provide type
|
|
77
81
|
* hinting during parameter resolution.
|
|
78
82
|
*
|
|
79
|
-
* @param name The name of the environment variable to use to load the
|
|
80
|
-
* @param options Configuration options for the
|
|
81
|
-
* @returns A
|
|
83
|
+
* @param name The name of the environment variable to use to load the parameter.
|
|
84
|
+
* @param options Configuration options for the parameter.
|
|
85
|
+
* @returns A parameter with a `string` return type for `.value`.
|
|
82
86
|
*/
|
|
83
87
|
function defineSecret(name) {
|
|
84
88
|
const param = new types_1.SecretParam(name);
|
|
@@ -87,11 +91,11 @@ function defineSecret(name) {
|
|
|
87
91
|
}
|
|
88
92
|
exports.defineSecret = defineSecret;
|
|
89
93
|
/**
|
|
90
|
-
* Declare a string
|
|
94
|
+
* Declare a string parameter.
|
|
91
95
|
*
|
|
92
|
-
* @param name The name of the environment variable to use to load the
|
|
93
|
-
* @param options Configuration options for the
|
|
94
|
-
* @returns A
|
|
96
|
+
* @param name The name of the environment variable to use to load the parameter.
|
|
97
|
+
* @param options Configuration options for the parameter.
|
|
98
|
+
* @returns A parameter with a `string` return type for `.value`.
|
|
95
99
|
*/
|
|
96
100
|
function defineString(name, options = {}) {
|
|
97
101
|
const param = new types_1.StringParam(name, options);
|
|
@@ -100,11 +104,11 @@ function defineString(name, options = {}) {
|
|
|
100
104
|
}
|
|
101
105
|
exports.defineString = defineString;
|
|
102
106
|
/**
|
|
103
|
-
* Declare a boolean
|
|
107
|
+
* Declare a boolean parameter.
|
|
104
108
|
*
|
|
105
|
-
* @param name The name of the environment variable to use to load the
|
|
106
|
-
* @param options Configuration options for the
|
|
107
|
-
* @returns A
|
|
109
|
+
* @param name The name of the environment variable to use to load the parameter.
|
|
110
|
+
* @param options Configuration options for the parameter.
|
|
111
|
+
* @returns A parameter with a `boolean` return type for `.value`.
|
|
108
112
|
*/
|
|
109
113
|
function defineBoolean(name, options = {}) {
|
|
110
114
|
const param = new types_1.BooleanParam(name, options);
|
|
@@ -113,11 +117,11 @@ function defineBoolean(name, options = {}) {
|
|
|
113
117
|
}
|
|
114
118
|
exports.defineBoolean = defineBoolean;
|
|
115
119
|
/**
|
|
116
|
-
* Declare an integer
|
|
120
|
+
* Declare an integer parameter.
|
|
117
121
|
*
|
|
118
|
-
* @param name The name of the environment variable to use to load the
|
|
119
|
-
* @param options Configuration options for the
|
|
120
|
-
* @returns A
|
|
122
|
+
* @param name The name of the environment variable to use to load the parameter.
|
|
123
|
+
* @param options Configuration options for the parameter.
|
|
124
|
+
* @returns A parameter with a `number` return type for `.value`.
|
|
121
125
|
*/
|
|
122
126
|
function defineInt(name, options = {}) {
|
|
123
127
|
const param = new types_1.IntParam(name, options);
|
|
@@ -126,11 +130,11 @@ function defineInt(name, options = {}) {
|
|
|
126
130
|
}
|
|
127
131
|
exports.defineInt = defineInt;
|
|
128
132
|
/**
|
|
129
|
-
* Declare a float
|
|
133
|
+
* Declare a float parameter.
|
|
130
134
|
*
|
|
131
|
-
* @param name The name of the environment variable to use to load the
|
|
132
|
-
* @param options Configuration options for the
|
|
133
|
-
* @returns A
|
|
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`.
|
|
134
138
|
*
|
|
135
139
|
* @internal
|
|
136
140
|
*/
|
|
@@ -141,11 +145,11 @@ function defineFloat(name, options = {}) {
|
|
|
141
145
|
}
|
|
142
146
|
exports.defineFloat = defineFloat;
|
|
143
147
|
/**
|
|
144
|
-
* Declare a list
|
|
148
|
+
* Declare a list parameter.
|
|
145
149
|
*
|
|
146
|
-
* @param name The name of the environment variable to use to load the
|
|
147
|
-
* @param options Configuration options for the
|
|
148
|
-
* @returns A
|
|
150
|
+
* @param name The name of the environment variable to use to load the parameter.
|
|
151
|
+
* @param options Configuration options for the parameter.
|
|
152
|
+
* @returns A parameter with a `string[]` return type for `.value`.
|
|
149
153
|
*/
|
|
150
154
|
function defineList(name, options = {}) {
|
|
151
155
|
const param = new types_1.ListParam(name, options);
|
package/lib/params/types.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export declare abstract class Expression<T extends string | number | boolean | string[]> {
|
|
2
|
-
/** Returns the
|
|
2
|
+
/** Returns the expression's runtime value, based on the CLI's resolution of parameters. */
|
|
3
3
|
value(): T;
|
|
4
|
-
/** Returns the
|
|
4
|
+
/** Returns the expression's representation as a braced CEL expression. */
|
|
5
5
|
toCEL(): string;
|
|
6
|
+
/** Returns the expression's representation as JSON. */
|
|
6
7
|
toJSON(): string;
|
|
7
8
|
}
|
|
8
9
|
/**
|
|
@@ -25,83 +26,93 @@ export declare class CompareExpression<T extends string | number | boolean | str
|
|
|
25
26
|
rhs: T | Expression<T>;
|
|
26
27
|
constructor(cmp: "==" | "!=" | ">" | ">=" | "<" | "<=", lhs: Expression<T>, rhs: T | Expression<T>);
|
|
27
28
|
toString(): string;
|
|
28
|
-
/** Returns a TernaryExpression which can resolve to one of two values, based on the resolution of this comparison. */
|
|
29
|
+
/** Returns a `TernaryExpression` which can resolve to one of two values, based on the resolution of this comparison. */
|
|
29
30
|
thenElse<retT extends string | number | boolean | string[]>(ifTrue: retT | Expression<retT>, ifFalse: retT | Expression<retT>): TernaryExpression<retT>;
|
|
30
31
|
}
|
|
31
32
|
/** @hidden */
|
|
32
33
|
type ParamValueType = "string" | "list" | "boolean" | "int" | "float" | "secret";
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
/** Create a select input from a series of values. */
|
|
35
|
+
export declare function select<T>(options: T[]): SelectInput<T>;
|
|
36
|
+
/** Create a select input from a map of labels to vaues. */
|
|
37
|
+
export declare function select<T>(optionsWithLabels: Record<string, T>): SelectInput<T>;
|
|
38
|
+
/** Create a multi-select input from a series of values. */
|
|
39
|
+
export declare function multiSelect(options: string[]): MultiSelectInput;
|
|
40
|
+
/** Create a multi-select input from map of labels to values. */
|
|
41
|
+
export declare function multiSelect(options: Record<string, string>): MultiSelectInput;
|
|
42
|
+
type ParamInput<T> = TextInput<T> | SelectInput<T> | (T extends string[] ? MultiSelectInput : never) | (T extends string ? ResourceInput : never);
|
|
42
43
|
/**
|
|
43
|
-
* Specifies that a
|
|
44
|
-
* to type it in interactively at deploy
|
|
44
|
+
* Specifies that a parameter's value should be determined by prompting the user
|
|
45
|
+
* to type it in interactively at deploy time. Input that does not match the
|
|
45
46
|
* provided validationRegex, if present, will be retried.
|
|
46
47
|
*/
|
|
47
48
|
export interface TextInput<T = unknown> {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
49
|
+
text: {
|
|
50
|
+
example?: string;
|
|
51
|
+
/**
|
|
52
|
+
* A regular expression (or an escaped string to compile into a regular
|
|
53
|
+
* expression) which the prompted text must satisfy; the prompt will retry
|
|
54
|
+
* until input matching the regex is provided.
|
|
55
|
+
*/
|
|
56
|
+
validationRegex?: string | RegExp;
|
|
57
|
+
/**
|
|
58
|
+
* A custom error message to display when retrying the prompt based on input
|
|
59
|
+
* failing to conform to the validationRegex,
|
|
60
|
+
*/
|
|
61
|
+
validationErrorMessage?: string;
|
|
62
|
+
};
|
|
60
63
|
}
|
|
61
64
|
/**
|
|
62
|
-
* Specifies that a
|
|
65
|
+
* Specifies that a parameter's value should be determined by having the user
|
|
63
66
|
* select from a list containing all the project's resources of a certain
|
|
64
67
|
* type. Currently, only type:"storage.googleapis.com/Bucket" is supported.
|
|
65
68
|
*/
|
|
66
69
|
export interface ResourceInput {
|
|
67
70
|
resource: {
|
|
68
|
-
type:
|
|
71
|
+
type: "storage.googleapis.com/Bucket";
|
|
69
72
|
};
|
|
70
73
|
}
|
|
71
74
|
/**
|
|
72
|
-
*
|
|
73
|
-
|
|
75
|
+
* Autogenerate a list of buckets in a project that a user can select from.
|
|
76
|
+
*/
|
|
77
|
+
export declare const BUCKET_PICKER: ResourceInput;
|
|
78
|
+
/**
|
|
79
|
+
* Specifies that a parameter's value should be determined by having the user select
|
|
80
|
+
* from a list of pre-canned options interactively at deploy time.
|
|
74
81
|
*/
|
|
75
82
|
export interface SelectInput<T = unknown> {
|
|
76
|
-
|
|
83
|
+
select: {
|
|
84
|
+
options: Array<SelectOptions<T>>;
|
|
85
|
+
};
|
|
77
86
|
}
|
|
78
87
|
/**
|
|
79
|
-
* Specifies that a
|
|
80
|
-
* a subset from a list of pre-canned options interactively at deploy
|
|
81
|
-
* Will result in errors if used on
|
|
88
|
+
* Specifies that a parameter's value should be determined by having the user select
|
|
89
|
+
* a subset from a list of pre-canned options interactively at deploy time.
|
|
90
|
+
* Will result in errors if used on parameters of type other than `string[]`.
|
|
82
91
|
*/
|
|
83
92
|
export interface MultiSelectInput {
|
|
84
|
-
|
|
93
|
+
multiSelect: {
|
|
94
|
+
options: Array<SelectOptions<string>>;
|
|
95
|
+
};
|
|
85
96
|
}
|
|
86
97
|
/**
|
|
87
|
-
* One of the options provided to a SelectInput
|
|
98
|
+
* One of the options provided to a `SelectInput`, containing a value and
|
|
88
99
|
* optionally a human-readable label to display in the selection interface.
|
|
89
100
|
*/
|
|
90
101
|
export interface SelectOptions<T = unknown> {
|
|
91
102
|
label?: string;
|
|
92
103
|
value: T;
|
|
93
104
|
}
|
|
94
|
-
/** The wire representation of a
|
|
105
|
+
/** The wire representation of a parameter when it's sent to the CLI. A superset of `ParamOptions`. */
|
|
95
106
|
export type ParamSpec<T extends string | number | boolean | string[]> = {
|
|
96
107
|
/** The name of the parameter which will be stored in .env files. Use UPPERCASE. */
|
|
97
108
|
name: string;
|
|
98
109
|
/** An optional default value to be used while prompting for input. Can be a literal or another parametrized expression. */
|
|
99
110
|
default?: T | Expression<T>;
|
|
100
|
-
/** An optional human-readable string to be used as a replacement for the
|
|
111
|
+
/** An optional human-readable string to be used as a replacement for the parameter's name when prompting. */
|
|
101
112
|
label?: string;
|
|
102
|
-
/** An optional long-form description of the
|
|
113
|
+
/** An optional long-form description of the parameter to be displayed while prompting. */
|
|
103
114
|
description?: string;
|
|
104
|
-
/** The way in which the Firebase CLI will prompt for the value of this
|
|
115
|
+
/** The way in which the Firebase CLI will prompt for the value of this parameter. Defaults to a TextInput. */
|
|
105
116
|
input?: ParamInput<T>;
|
|
106
117
|
};
|
|
107
118
|
/**
|
|
@@ -120,7 +131,7 @@ export type WireParamSpec<T extends string | number | boolean | string[]> = {
|
|
|
120
131
|
type: ParamValueType;
|
|
121
132
|
input?: ParamInput<T>;
|
|
122
133
|
};
|
|
123
|
-
/** Configuration options which can be used to customize the prompting behavior of a
|
|
134
|
+
/** Configuration options which can be used to customize the prompting behavior of a parameter. */
|
|
124
135
|
export type ParamOptions<T extends string | number | boolean | string[]> = Omit<ParamSpec<T>, "name" | "type">;
|
|
125
136
|
/**
|
|
126
137
|
* Represents a parametrized value that will be read from .env files if present,
|
|
@@ -132,22 +143,22 @@ export declare abstract class Param<T extends string | number | boolean | string
|
|
|
132
143
|
readonly options: ParamOptions<T>;
|
|
133
144
|
static type: ParamValueType;
|
|
134
145
|
constructor(name: string, options?: ParamOptions<T>);
|
|
135
|
-
/** Returns a parametrized expression of Boolean type, based on comparing the value of this
|
|
146
|
+
/** Returns a parametrized expression of Boolean type, based on comparing the value of this parameter to a literal or a different expression. */
|
|
136
147
|
cmp(cmp: "==" | "!=" | ">" | ">=" | "<" | "<=", rhs: T | Expression<T>): CompareExpression<T>;
|
|
137
|
-
/** Returns a parametrized expression of Boolean type, based on comparing the value of this
|
|
148
|
+
/** Returns a parametrized expression of Boolean type, based on comparing the value of this parameter to a literal or a different expression. */
|
|
138
149
|
equals(rhs: T | Expression<T>): CompareExpression<T>;
|
|
139
|
-
/** Returns a parametrized expression of Boolean type, based on comparing the value of this
|
|
150
|
+
/** Returns a parametrized expression of Boolean type, based on comparing the value of this parameter to a literal or a different expression. */
|
|
140
151
|
notEquals(rhs: T | Expression<T>): CompareExpression<T>;
|
|
141
|
-
/** Returns a parametrized expression of Boolean type, based on comparing the value of this
|
|
152
|
+
/** Returns a parametrized expression of Boolean type, based on comparing the value of this parameter to a literal or a different expression. */
|
|
142
153
|
greaterThan(rhs: T | Expression<T>): CompareExpression<T>;
|
|
143
|
-
/** Returns a parametrized expression of Boolean type, based on comparing the value of this
|
|
154
|
+
/** Returns a parametrized expression of Boolean type, based on comparing the value of this parameter to a literal or a different expression. */
|
|
144
155
|
greaterThanOrEqualTo(rhs: T | Expression<T>): CompareExpression<T>;
|
|
145
|
-
/** Returns a parametrized expression of Boolean type, based on comparing the value of this
|
|
156
|
+
/** Returns a parametrized expression of Boolean type, based on comparing the value of this parameter to a literal or a different expression. */
|
|
146
157
|
lessThan(rhs: T | Expression<T>): CompareExpression<T>;
|
|
147
|
-
/** Returns a parametrized expression of Boolean type, based on comparing the value of this
|
|
158
|
+
/** Returns a parametrized expression of Boolean type, based on comparing the value of this parameter to a literal or a different expression. */
|
|
148
159
|
lessThanOrEqualTo(rhs: T | Expression<T>): CompareExpression<T>;
|
|
149
160
|
/**
|
|
150
|
-
* Returns a parametrized expression of Boolean type, based on comparing the value of this
|
|
161
|
+
* Returns a parametrized expression of Boolean type, based on comparing the value of this parameter to a literal or a different expression.
|
|
151
162
|
* @deprecated A typo. Use lessThanOrEqualTo instead.
|
|
152
163
|
*/
|
|
153
164
|
lessThanorEqualTo(rhs: T | Expression<T>): CompareExpression<T>;
|