firebase-functions 3.24.0 → 4.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -9
- package/lib/bin/firebase-functions.js +13 -15
- package/lib/common/app.d.ts +14 -0
- package/lib/common/app.js +62 -0
- package/lib/common/change.d.ts +0 -5
- package/lib/common/change.js +5 -7
- package/lib/common/config.d.ts +6 -0
- package/lib/common/config.js +49 -0
- package/lib/common/debug.js +2 -2
- package/lib/common/encoding.d.ts +0 -8
- package/lib/common/encoding.js +6 -29
- package/lib/common/options.d.ts +14 -0
- package/lib/common/options.js +44 -0
- package/lib/common/params.d.ts +32 -0
- package/lib/common/params.js +23 -0
- package/lib/common/providers/database.d.ts +17 -19
- package/lib/common/providers/database.js +68 -39
- package/lib/common/providers/https.d.ts +11 -52
- package/lib/common/providers/https.js +115 -110
- package/lib/common/providers/identity.d.ts +8 -8
- package/lib/common/providers/identity.js +71 -79
- package/lib/common/providers/tasks.d.ts +11 -10
- package/lib/common/providers/tasks.js +10 -9
- package/lib/common/timezone.js +538 -538
- package/lib/common/trace.d.ts +14 -0
- package/lib/common/trace.js +69 -0
- package/lib/{encoder.d.ts → common/utilities/encoder.d.ts} +0 -0
- package/lib/{encoder.js → common/utilities/encoder.js} +1 -1
- package/lib/{utilities → common/utilities}/path-pattern.d.ts +0 -0
- package/lib/{utilities → common/utilities}/path-pattern.js +17 -16
- package/lib/{utilities → common/utilities}/path.d.ts +0 -0
- package/lib/{utilities → common/utilities}/path.js +5 -7
- package/lib/{utils.d.ts → common/utilities/utils.d.ts} +1 -1
- package/lib/{utils.js → common/utilities/utils.js} +18 -12
- package/lib/logger/common.d.ts +1 -3
- package/lib/logger/common.js +9 -14
- package/lib/logger/compat.js +9 -9
- package/lib/logger/index.d.ts +1 -1
- package/lib/logger/index.js +24 -30
- package/lib/{v2/params → params}/index.d.ts +22 -9
- package/lib/{v2/params → params}/index.js +22 -14
- package/lib/params/types.d.ts +180 -0
- package/lib/params/types.js +289 -0
- package/lib/runtime/loader.js +12 -14
- package/lib/runtime/manifest.d.ts +56 -24
- package/lib/runtime/manifest.js +114 -4
- package/lib/v1/cloud-functions.d.ts +232 -0
- package/lib/v1/cloud-functions.js +205 -0
- package/lib/v1/config.d.ts +8 -0
- package/lib/v1/config.js +75 -0
- package/lib/{function-builder.d.ts → v1/function-builder.d.ts} +16 -16
- package/lib/{function-builder.js → v1/function-builder.js} +56 -46
- package/lib/v1/function-configuration.d.ts +197 -0
- package/lib/v1/function-configuration.js +70 -0
- package/lib/v1/index.d.ts +20 -0
- package/lib/{index.js → v1/index.js} +5 -10
- package/lib/{providers → v1/providers}/analytics.d.ts +5 -11
- package/lib/{providers → v1/providers}/analytics.js +49 -43
- package/lib/{providers → v1/providers}/auth.d.ts +28 -18
- package/lib/{providers → v1/providers}/auth.js +45 -34
- package/lib/{providers → v1/providers}/database.d.ts +25 -42
- package/lib/{providers → v1/providers}/database.js +46 -46
- package/lib/{providers → v1/providers}/firestore.d.ts +15 -33
- package/lib/{providers → v1/providers}/firestore.js +40 -44
- package/lib/{providers → v1/providers}/https.d.ts +3 -8
- package/lib/{providers → v1/providers}/https.js +14 -22
- package/lib/{providers → v1/providers}/pubsub.d.ts +8 -16
- package/lib/{providers → v1/providers}/pubsub.js +22 -26
- package/lib/{providers → v1/providers}/remoteConfig.d.ts +2 -11
- package/lib/{providers → v1/providers}/remoteConfig.js +9 -9
- package/lib/{providers → v1/providers}/storage.d.ts +11 -26
- package/lib/{providers → v1/providers}/storage.js +24 -29
- package/lib/{providers → v1/providers}/tasks.d.ts +6 -8
- package/lib/{providers → v1/providers}/tasks.js +12 -17
- package/lib/{providers → v1/providers}/testLab.d.ts +86 -46
- package/lib/{providers → v1/providers}/testLab.js +14 -14
- package/lib/v2/core.d.ts +4 -5
- package/lib/v2/index.d.ts +16 -14
- package/lib/v2/index.js +5 -1
- package/lib/v2/options.d.ts +52 -32
- package/lib/v2/options.js +32 -47
- package/lib/v2/providers/alerts/alerts.d.ts +20 -18
- package/lib/v2/providers/alerts/alerts.js +9 -6
- package/lib/v2/providers/alerts/appDistribution.d.ts +36 -26
- package/lib/v2/providers/alerts/appDistribution.js +10 -7
- package/lib/v2/providers/alerts/billing.d.ts +5 -5
- package/lib/v2/providers/alerts/billing.js +5 -4
- package/lib/v2/providers/alerts/crashlytics.d.ts +32 -30
- package/lib/v2/providers/alerts/crashlytics.js +10 -9
- package/lib/v2/providers/alerts/index.d.ts +5 -5
- package/lib/v2/providers/alerts/performance.d.ts +15 -3
- package/lib/v2/providers/alerts/performance.js +5 -7
- package/lib/v2/providers/database.d.ts +41 -38
- package/lib/v2/providers/database.js +22 -17
- package/lib/v2/providers/eventarc.d.ts +25 -23
- package/lib/v2/providers/eventarc.js +10 -7
- package/lib/v2/providers/https.d.ts +43 -33
- package/lib/v2/providers/https.js +18 -56
- package/lib/v2/providers/identity.d.ts +25 -23
- package/lib/v2/providers/identity.js +10 -7
- package/lib/v2/providers/pubsub.d.ts +25 -23
- package/lib/v2/providers/pubsub.js +11 -27
- package/lib/v2/providers/remoteConfig.d.ts +63 -0
- package/lib/v2/providers/remoteConfig.js +65 -0
- package/lib/v2/providers/scheduler.d.ts +14 -12
- package/lib/v2/providers/scheduler.js +16 -14
- package/lib/v2/providers/storage.d.ts +32 -30
- package/lib/v2/providers/storage.js +16 -32
- package/lib/v2/providers/tasks.d.ts +30 -26
- package/lib/v2/providers/tasks.js +14 -31
- package/lib/v2/providers/testLab.d.ts +110 -0
- package/lib/v2/providers/testLab.js +65 -0
- package/lib/v2/trace.d.ts +4 -0
- package/lib/v2/trace.js +21 -0
- package/package.json +62 -67
- package/lib/apps.d.ts +0 -35
- package/lib/apps.js +0 -112
- package/lib/cloud-functions.d.ts +0 -231
- package/lib/cloud-functions.js +0 -251
- package/lib/config.d.ts +0 -24
- package/lib/config.js +0 -117
- package/lib/function-configuration.d.ts +0 -108
- package/lib/function-configuration.js +0 -71
- package/lib/handler-builder.d.ts +0 -256
- package/lib/handler-builder.js +0 -349
- package/lib/index.d.ts +0 -19
- package/lib/setup.d.ts +0 -1
- package/lib/setup.js +0 -60
- package/lib/v2/params/types.d.ts +0 -118
- package/lib/v2/params/types.js +0 -196
package/lib/v2/params/types.js
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
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.ListParam = exports.BooleanParam = exports.FloatParam = exports.IntParam = exports.StringParam = exports.SecretParam = exports.Param = exports.CompareExpression = exports.TernaryExpression = exports.Expression = void 0;
|
|
25
|
-
/*
|
|
26
|
-
* A CEL expression which can be evaluated during function deployment, and
|
|
27
|
-
* resolved to a value of the generic type parameter: i.e, you can pass
|
|
28
|
-
* an Expression<number> as the value of an option that normally accepts numbers.
|
|
29
|
-
*/
|
|
30
|
-
class Expression {
|
|
31
|
-
// Returns the Expression's runtime value, based on the CLI's resolution of params.
|
|
32
|
-
value() {
|
|
33
|
-
throw new Error('Not implemented');
|
|
34
|
-
}
|
|
35
|
-
// Returns the Expression's representation as a braced CEL expression.
|
|
36
|
-
toCEL() {
|
|
37
|
-
return `{{ ${this.toString()} }}`;
|
|
38
|
-
}
|
|
39
|
-
toJSON() {
|
|
40
|
-
return this.toString();
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
exports.Expression = Expression;
|
|
44
|
-
function quoteIfString(literal) {
|
|
45
|
-
// TODO(vsfan@): CEL's string escape semantics are slightly different than Javascript's, what do we do here?
|
|
46
|
-
return typeof literal === 'string' ? `"${literal}"` : literal;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* A CEL expression corresponding to a ternary operator, e.g {{ cond ? ifTrue : ifFalse }}
|
|
50
|
-
*/
|
|
51
|
-
class TernaryExpression extends Expression {
|
|
52
|
-
constructor(test, ifTrue, ifFalse) {
|
|
53
|
-
super();
|
|
54
|
-
this.test = test;
|
|
55
|
-
this.ifTrue = ifTrue;
|
|
56
|
-
this.ifFalse = ifFalse;
|
|
57
|
-
this.ifTrue = ifTrue;
|
|
58
|
-
this.ifFalse = ifFalse;
|
|
59
|
-
}
|
|
60
|
-
value() {
|
|
61
|
-
return !!this.test.value ? this.ifTrue : this.ifFalse;
|
|
62
|
-
}
|
|
63
|
-
toString() {
|
|
64
|
-
return `${this.test} ? ${quoteIfString(this.ifTrue)} : ${quoteIfString(this.ifFalse)}`;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
exports.TernaryExpression = TernaryExpression;
|
|
68
|
-
/**
|
|
69
|
-
* A CEL expression that evaluates to boolean true or false based on a comparison
|
|
70
|
-
* between the value of another expression and a literal of that same type.
|
|
71
|
-
*/
|
|
72
|
-
class CompareExpression extends Expression {
|
|
73
|
-
constructor(cmp, lhs, rhs) {
|
|
74
|
-
super();
|
|
75
|
-
this.cmp = cmp;
|
|
76
|
-
this.lhs = lhs;
|
|
77
|
-
this.rhs = rhs;
|
|
78
|
-
}
|
|
79
|
-
value() {
|
|
80
|
-
const left = this.lhs.value();
|
|
81
|
-
switch (this.cmp) {
|
|
82
|
-
case '==':
|
|
83
|
-
return left === this.rhs;
|
|
84
|
-
case '>':
|
|
85
|
-
return left > this.rhs;
|
|
86
|
-
case '>=':
|
|
87
|
-
return left >= this.rhs;
|
|
88
|
-
case '<':
|
|
89
|
-
return left < this.rhs;
|
|
90
|
-
case '<=':
|
|
91
|
-
return left <= this.rhs;
|
|
92
|
-
default:
|
|
93
|
-
throw new Error('Unknown comparator ' + this.cmp);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
toString() {
|
|
97
|
-
return `${this.lhs} ${this.cmp} ${quoteIfString(this.rhs)}`;
|
|
98
|
-
}
|
|
99
|
-
then(ifTrue, ifFalse) {
|
|
100
|
-
return new TernaryExpression(this, ifTrue, ifFalse);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
exports.CompareExpression = CompareExpression;
|
|
104
|
-
class Param extends Expression {
|
|
105
|
-
constructor(name, options = {}) {
|
|
106
|
-
super();
|
|
107
|
-
this.name = name;
|
|
108
|
-
this.options = options;
|
|
109
|
-
}
|
|
110
|
-
value() {
|
|
111
|
-
throw new Error('Not implemented');
|
|
112
|
-
}
|
|
113
|
-
cmp(cmp, rhs) {
|
|
114
|
-
return new CompareExpression(cmp, this, rhs);
|
|
115
|
-
}
|
|
116
|
-
equals(rhs) {
|
|
117
|
-
return this.cmp('==', rhs);
|
|
118
|
-
}
|
|
119
|
-
toString() {
|
|
120
|
-
return `params.${this.name}`;
|
|
121
|
-
}
|
|
122
|
-
toSpec() {
|
|
123
|
-
const out = {
|
|
124
|
-
name: this.name,
|
|
125
|
-
...this.options,
|
|
126
|
-
type: this.constructor.type,
|
|
127
|
-
};
|
|
128
|
-
return out;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
exports.Param = Param;
|
|
132
|
-
Param.type = 'string';
|
|
133
|
-
class SecretParam {
|
|
134
|
-
constructor(name) {
|
|
135
|
-
this.name = name;
|
|
136
|
-
}
|
|
137
|
-
value() {
|
|
138
|
-
return process.env[this.name] || '';
|
|
139
|
-
}
|
|
140
|
-
toSpec() {
|
|
141
|
-
return {
|
|
142
|
-
type: 'secret',
|
|
143
|
-
name: this.name,
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
exports.SecretParam = SecretParam;
|
|
148
|
-
SecretParam.type = 'secret';
|
|
149
|
-
class StringParam extends Param {
|
|
150
|
-
value() {
|
|
151
|
-
return process.env[this.name] || '';
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
exports.StringParam = StringParam;
|
|
155
|
-
class IntParam extends Param {
|
|
156
|
-
value() {
|
|
157
|
-
return parseInt(process.env[this.name] || '0', 10) || 0;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
exports.IntParam = IntParam;
|
|
161
|
-
IntParam.type = 'int';
|
|
162
|
-
class FloatParam extends Param {
|
|
163
|
-
value() {
|
|
164
|
-
return parseFloat(process.env[this.name] || '0') || 0;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
exports.FloatParam = FloatParam;
|
|
168
|
-
FloatParam.type = 'float';
|
|
169
|
-
class BooleanParam extends Param {
|
|
170
|
-
value() {
|
|
171
|
-
return !!process.env[this.name];
|
|
172
|
-
}
|
|
173
|
-
then(ifTrue, ifFalse) {
|
|
174
|
-
return new TernaryExpression(this, ifTrue, ifFalse);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
exports.BooleanParam = BooleanParam;
|
|
178
|
-
BooleanParam.type = 'boolean';
|
|
179
|
-
class ListParam extends Param {
|
|
180
|
-
value() {
|
|
181
|
-
throw new Error('Not implemented');
|
|
182
|
-
}
|
|
183
|
-
toSpec() {
|
|
184
|
-
const out = {
|
|
185
|
-
name: this.name,
|
|
186
|
-
type: 'list',
|
|
187
|
-
...this.options,
|
|
188
|
-
};
|
|
189
|
-
if (this.options.default && this.options.default.length > 0) {
|
|
190
|
-
out.default = this.options.default.join(',');
|
|
191
|
-
}
|
|
192
|
-
return out;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
exports.ListParam = ListParam;
|
|
196
|
-
ListParam.type = 'list';
|