firebase-functions 6.6.0 → 7.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/_virtual/rolldown_runtime.js +34 -0
- package/lib/bin/firebase-functions.js +78 -103
- package/lib/common/app.js +35 -55
- package/lib/common/change.js +54 -75
- package/lib/common/config.js +41 -41
- package/lib/common/debug.js +23 -47
- package/lib/common/encoding.js +59 -82
- package/lib/common/onInit.js +26 -28
- package/lib/common/options.js +22 -42
- package/lib/common/params.d.ts +6 -6
- package/lib/common/params.js +0 -23
- package/lib/common/providers/database.js +270 -300
- package/lib/common/providers/firestore.js +66 -92
- package/lib/common/providers/https.d.ts +0 -1
- package/lib/common/providers/https.js +537 -539
- package/lib/common/providers/identity.js +393 -444
- package/lib/common/providers/tasks.js +64 -98
- package/lib/common/timezone.js +544 -542
- package/lib/common/trace.d.ts +0 -1
- package/lib/common/trace.js +63 -55
- package/lib/common/utilities/assertions.d.ts +11 -0
- package/lib/common/utilities/assertions.js +18 -0
- package/lib/common/utilities/encoder.js +20 -37
- package/lib/common/utilities/path-pattern.js +106 -132
- package/lib/common/utilities/path.js +28 -27
- package/lib/common/utilities/utils.js +23 -45
- package/lib/esm/_virtual/rolldown_runtime.mjs +16 -0
- package/lib/esm/bin/firebase-functions.mjs +91 -0
- package/lib/esm/common/app.mjs +39 -0
- package/lib/esm/common/change.mjs +57 -0
- package/lib/esm/common/config.mjs +45 -0
- package/lib/esm/common/debug.mjs +28 -0
- package/lib/esm/common/encoding.mjs +69 -0
- package/lib/esm/common/onInit.mjs +33 -0
- package/lib/esm/common/options.mjs +22 -0
- package/lib/esm/common/params.mjs +1 -0
- package/lib/esm/common/providers/database.mjs +269 -0
- package/lib/esm/common/providers/firestore.mjs +78 -0
- package/lib/esm/common/providers/https.mjs +573 -0
- package/lib/esm/common/providers/identity.mjs +428 -0
- package/lib/esm/common/providers/tasks.mjs +67 -0
- package/lib/esm/common/timezone.mjs +544 -0
- package/lib/esm/common/trace.mjs +73 -0
- package/lib/esm/common/utilities/assertions.mjs +17 -0
- package/lib/esm/common/utilities/encoder.mjs +21 -0
- package/lib/esm/common/utilities/path-pattern.mjs +116 -0
- package/lib/esm/common/utilities/path.mjs +35 -0
- package/lib/esm/common/utilities/utils.mjs +29 -0
- package/lib/esm/function-configuration.mjs +1 -0
- package/lib/esm/logger/common.mjs +23 -0
- package/lib/esm/logger/compat.mjs +25 -0
- package/lib/esm/logger/index.mjs +131 -0
- package/lib/esm/params/index.mjs +160 -0
- package/lib/esm/params/types.mjs +400 -0
- package/lib/esm/runtime/loader.mjs +132 -0
- package/lib/esm/runtime/manifest.mjs +134 -0
- package/lib/esm/types/global.d.mjs +1 -0
- package/lib/esm/v1/cloud-functions.mjs +206 -0
- package/lib/esm/v1/config.mjs +14 -0
- package/lib/esm/v1/function-builder.mjs +252 -0
- package/lib/esm/v1/function-configuration.mjs +72 -0
- package/lib/esm/v1/index.mjs +27 -0
- package/lib/esm/v1/providers/analytics.mjs +212 -0
- package/lib/esm/v1/providers/auth.mjs +156 -0
- package/lib/esm/v1/providers/database.mjs +243 -0
- package/lib/esm/v1/providers/firestore.mjs +131 -0
- package/lib/esm/v1/providers/https.mjs +82 -0
- package/lib/esm/v1/providers/pubsub.mjs +175 -0
- package/lib/esm/v1/providers/remoteConfig.mjs +64 -0
- package/lib/esm/v1/providers/storage.mjs +163 -0
- package/lib/esm/v1/providers/tasks.mjs +63 -0
- package/lib/esm/v1/providers/testLab.mjs +94 -0
- package/lib/esm/v2/core.mjs +4 -0
- package/lib/esm/v2/index.mjs +28 -0
- package/lib/esm/v2/options.mjs +102 -0
- package/lib/esm/v2/providers/alerts/alerts.mjs +85 -0
- package/lib/esm/v2/providers/alerts/appDistribution.mjs +75 -0
- package/lib/esm/v2/providers/alerts/billing.mjs +51 -0
- package/lib/esm/v2/providers/alerts/crashlytics.mjs +122 -0
- package/lib/esm/v2/providers/alerts/index.mjs +22 -0
- package/lib/esm/v2/providers/alerts/performance.mjs +66 -0
- package/lib/esm/v2/providers/database.mjs +197 -0
- package/lib/esm/v2/providers/dataconnect.mjs +130 -0
- package/lib/esm/v2/providers/eventarc.mjs +51 -0
- package/lib/esm/v2/providers/firestore.mjs +294 -0
- package/lib/esm/v2/providers/https.mjs +210 -0
- package/lib/esm/v2/providers/identity.mjs +103 -0
- package/lib/esm/v2/providers/pubsub.mjs +148 -0
- package/lib/esm/v2/providers/remoteConfig.mjs +52 -0
- package/lib/esm/v2/providers/scheduler.mjs +84 -0
- package/lib/esm/v2/providers/storage.mjs +155 -0
- package/lib/esm/v2/providers/tasks.mjs +65 -0
- package/lib/esm/v2/providers/testLab.mjs +53 -0
- package/lib/esm/v2/trace.mjs +20 -0
- package/lib/function-configuration.d.ts +0 -0
- package/lib/function-configuration.js +0 -0
- package/lib/logger/common.js +21 -41
- package/lib/logger/compat.js +18 -33
- package/lib/logger/index.js +119 -130
- package/lib/params/index.d.ts +4 -2
- package/lib/params/index.js +150 -144
- package/lib/params/types.js +389 -423
- package/lib/runtime/loader.js +114 -148
- package/lib/runtime/manifest.js +106 -126
- package/lib/types/global.d.js +0 -0
- package/lib/v1/cloud-functions.d.ts +2 -2
- package/lib/v1/cloud-functions.js +193 -241
- package/lib/v1/config.d.ts +4 -7
- package/lib/v1/config.js +13 -75
- package/lib/v1/function-builder.js +239 -368
- package/lib/v1/function-configuration.js +70 -63
- package/lib/v1/index.js +118 -73
- package/lib/v1/providers/analytics.js +188 -235
- package/lib/v1/providers/auth.d.ts +2 -1
- package/lib/v1/providers/auth.js +159 -164
- package/lib/v1/providers/database.js +237 -242
- package/lib/v1/providers/firestore.js +131 -130
- package/lib/v1/providers/https.d.ts +2 -1
- package/lib/v1/providers/https.js +79 -86
- package/lib/v1/providers/pubsub.js +175 -172
- package/lib/v1/providers/remoteConfig.js +64 -68
- package/lib/v1/providers/storage.js +161 -163
- package/lib/v1/providers/tasks.d.ts +1 -1
- package/lib/v1/providers/tasks.js +65 -80
- package/lib/v1/providers/testLab.js +94 -94
- package/lib/v2/core.d.ts +1 -1
- package/lib/v2/core.js +5 -32
- package/lib/v2/index.d.ts +6 -3
- package/lib/v2/index.js +123 -75
- package/lib/v2/options.js +88 -114
- package/lib/v2/providers/alerts/alerts.js +76 -95
- package/lib/v2/providers/alerts/appDistribution.js +73 -78
- package/lib/v2/providers/alerts/billing.js +49 -53
- package/lib/v2/providers/alerts/crashlytics.js +110 -102
- package/lib/v2/providers/alerts/index.js +56 -53
- package/lib/v2/providers/alerts/performance.js +64 -74
- package/lib/v2/providers/database.js +177 -180
- package/lib/v2/providers/dataconnect.d.ts +95 -0
- package/lib/v2/providers/dataconnect.js +137 -0
- package/lib/v2/providers/eventarc.js +55 -77
- package/lib/v2/providers/firestore.js +262 -260
- package/lib/v2/providers/https.d.ts +3 -2
- package/lib/v2/providers/https.js +210 -247
- package/lib/v2/providers/identity.d.ts +2 -1
- package/lib/v2/providers/identity.js +96 -105
- package/lib/v2/providers/pubsub.js +149 -167
- package/lib/v2/providers/remoteConfig.js +54 -63
- package/lib/v2/providers/scheduler.js +84 -96
- package/lib/v2/providers/storage.js +147 -162
- package/lib/v2/providers/tasks.d.ts +1 -1
- package/lib/v2/providers/tasks.js +68 -95
- package/lib/v2/providers/testLab.js +55 -64
- package/lib/v2/trace.js +18 -19
- package/package.json +290 -226
- package/protos/compiledFirestore.mjs +3512 -0
- package/protos/update.sh +28 -7
package/lib/v2/options.js
CHANGED
|
@@ -1,133 +1,107 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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.__getSpec = exports.optionsToEndpoint = exports.optionsToTriggerAnnotations = exports.getGlobalOptions = exports.setGlobalOptions = exports.RESET_VALUE = void 0;
|
|
25
|
-
/**
|
|
26
|
-
* Options to configure cloud functions.
|
|
27
|
-
* @packageDocumentation
|
|
28
|
-
*/
|
|
29
|
-
const encoding_1 = require("../common/encoding");
|
|
30
|
-
const options_1 = require("../common/options");
|
|
31
|
-
const params_1 = require("../params");
|
|
32
|
-
const types_1 = require("../params/types");
|
|
33
|
-
const logger = require("../logger");
|
|
34
|
-
var options_2 = require("../common/options");
|
|
35
|
-
Object.defineProperty(exports, "RESET_VALUE", { enumerable: true, get: function () { return options_2.RESET_VALUE; } });
|
|
1
|
+
const require_logger_index = require('../logger/index.js');
|
|
2
|
+
const require_params_types = require('../params/types.js');
|
|
3
|
+
const require_params_index = require('../params/index.js');
|
|
4
|
+
const require_common_options = require('../common/options.js');
|
|
5
|
+
const require_common_encoding = require('../common/encoding.js');
|
|
6
|
+
|
|
7
|
+
//#region src/v2/options.ts
|
|
36
8
|
const MemoryOptionToMB = {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
9
|
+
"128MiB": 128,
|
|
10
|
+
"256MiB": 256,
|
|
11
|
+
"512MiB": 512,
|
|
12
|
+
"1GiB": 1024,
|
|
13
|
+
"2GiB": 2048,
|
|
14
|
+
"4GiB": 4096,
|
|
15
|
+
"8GiB": 8192,
|
|
16
|
+
"16GiB": 16384,
|
|
17
|
+
"32GiB": 32768
|
|
46
18
|
};
|
|
47
19
|
let globalOptions;
|
|
48
20
|
/**
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
21
|
+
* Sets default options for all functions written using the 2nd gen SDK.
|
|
22
|
+
* @param options Options to set as default
|
|
23
|
+
*/
|
|
52
24
|
function setGlobalOptions(options) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
25
|
+
if (globalOptions) {
|
|
26
|
+
require_logger_index.warn("Calling setGlobalOptions twice leads to undefined behavior");
|
|
27
|
+
}
|
|
28
|
+
globalOptions = options;
|
|
57
29
|
}
|
|
58
|
-
exports.setGlobalOptions = setGlobalOptions;
|
|
59
30
|
/**
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
31
|
+
* Get the currently set default options.
|
|
32
|
+
* Used only for trigger generation.
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
64
35
|
function getGlobalOptions() {
|
|
65
|
-
|
|
36
|
+
return globalOptions || {};
|
|
66
37
|
}
|
|
67
|
-
exports.getGlobalOptions = getGlobalOptions;
|
|
68
38
|
/**
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
39
|
+
* Apply GlobalOptions to trigger definitions.
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
72
42
|
function optionsToTriggerAnnotations(opts) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
43
|
+
const annotation = {};
|
|
44
|
+
require_common_encoding.copyIfPresent(annotation, opts, "concurrency", "minInstances", "maxInstances", "ingressSettings", "labels", "vpcConnector", "vpcConnectorEgressSettings", "secrets");
|
|
45
|
+
require_common_encoding.convertIfPresent(annotation, opts, "availableMemoryMb", "memory", (mem) => {
|
|
46
|
+
return MemoryOptionToMB[mem];
|
|
47
|
+
});
|
|
48
|
+
require_common_encoding.convertIfPresent(annotation, opts, "regions", "region", (region) => {
|
|
49
|
+
if (typeof region === "string") {
|
|
50
|
+
return [region];
|
|
51
|
+
}
|
|
52
|
+
return region;
|
|
53
|
+
});
|
|
54
|
+
require_common_encoding.convertIfPresent(annotation, opts, "serviceAccountEmail", "serviceAccount", require_common_encoding.serviceAccountFromShorthand);
|
|
55
|
+
require_common_encoding.convertIfPresent(annotation, opts, "timeout", "timeoutSeconds", require_common_encoding.durationFromSeconds);
|
|
56
|
+
require_common_encoding.convertIfPresent(annotation, opts, "failurePolicy", "retry", (retry) => {
|
|
57
|
+
return retry ? { retry: true } : null;
|
|
58
|
+
});
|
|
59
|
+
return annotation;
|
|
90
60
|
}
|
|
91
|
-
exports.optionsToTriggerAnnotations = optionsToTriggerAnnotations;
|
|
92
61
|
/**
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
62
|
+
* Apply GlobalOptions to endpoint manifest.
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
96
65
|
function optionsToEndpoint(opts) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
return endpoint;
|
|
66
|
+
const endpoint = {};
|
|
67
|
+
require_common_encoding.copyIfPresent(endpoint, opts, "omit", "concurrency", "minInstances", "maxInstances", "ingressSettings", "labels", "timeoutSeconds", "cpu");
|
|
68
|
+
require_common_encoding.convertIfPresent(endpoint, opts, "serviceAccountEmail", "serviceAccount");
|
|
69
|
+
if (opts.vpcConnector !== undefined) {
|
|
70
|
+
if (opts.vpcConnector === null || opts.vpcConnector instanceof require_common_options.ResetValue) {
|
|
71
|
+
endpoint.vpc = require_common_options.RESET_VALUE;
|
|
72
|
+
} else {
|
|
73
|
+
const vpc = { connector: opts.vpcConnector };
|
|
74
|
+
require_common_encoding.convertIfPresent(vpc, opts, "egressSettings", "vpcConnectorEgressSettings");
|
|
75
|
+
endpoint.vpc = vpc;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
require_common_encoding.convertIfPresent(endpoint, opts, "availableMemoryMb", "memory", (mem) => {
|
|
79
|
+
return typeof mem === "object" ? mem : MemoryOptionToMB[mem];
|
|
80
|
+
});
|
|
81
|
+
require_common_encoding.convertIfPresent(endpoint, opts, "region", "region", (region) => {
|
|
82
|
+
if (typeof region === "string") {
|
|
83
|
+
return [region];
|
|
84
|
+
}
|
|
85
|
+
return region;
|
|
86
|
+
});
|
|
87
|
+
require_common_encoding.convertIfPresent(endpoint, opts, "secretEnvironmentVariables", "secrets", (secrets) => secrets.map((secret) => ({ key: secret instanceof require_params_types.SecretParam ? secret.name : secret })));
|
|
88
|
+
return endpoint;
|
|
121
89
|
}
|
|
122
|
-
exports.optionsToEndpoint = optionsToEndpoint;
|
|
123
90
|
/**
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
91
|
+
* @hidden
|
|
92
|
+
* @alpha
|
|
93
|
+
*/
|
|
127
94
|
function __getSpec() {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
95
|
+
return {
|
|
96
|
+
globalOptions: getGlobalOptions(),
|
|
97
|
+
params: require_params_index.declaredParams.map((p) => p.toSpec())
|
|
98
|
+
};
|
|
132
99
|
}
|
|
100
|
+
|
|
101
|
+
//#endregion
|
|
102
|
+
exports.RESET_VALUE = require_common_options.RESET_VALUE;
|
|
133
103
|
exports.__getSpec = __getSpec;
|
|
104
|
+
exports.getGlobalOptions = getGlobalOptions;
|
|
105
|
+
exports.optionsToEndpoint = optionsToEndpoint;
|
|
106
|
+
exports.optionsToTriggerAnnotations = optionsToTriggerAnnotations;
|
|
107
|
+
exports.setGlobalOptions = setGlobalOptions;
|
|
@@ -1,108 +1,89 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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.convertAlertAndApp = exports.getOptsAndAlertTypeAndApp = exports.getEndpointAnnotation = exports.onAlertPublished = exports.eventType = void 0;
|
|
25
|
-
const manifest_1 = require("../../../runtime/manifest");
|
|
26
|
-
const trace_1 = require("../../trace");
|
|
27
|
-
const options = require("../../options");
|
|
28
|
-
const onInit_1 = require("../../../common/onInit");
|
|
1
|
+
const require_runtime_manifest = require('../../../runtime/manifest.js');
|
|
2
|
+
const require_common_onInit = require('../../../common/onInit.js');
|
|
3
|
+
const require_v2_trace = require('../../trace.js');
|
|
4
|
+
const require_v2_options = require('../../options.js');
|
|
5
|
+
|
|
6
|
+
//#region src/v2/providers/alerts/alerts.ts
|
|
29
7
|
/** @internal */
|
|
30
|
-
|
|
8
|
+
const eventType = "google.firebase.firebasealerts.alerts.v1.published";
|
|
31
9
|
function onAlertPublished(alertTypeOrOpts, handler) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
10
|
+
const [opts, alertType, appId] = getOptsAndAlertTypeAndApp(alertTypeOrOpts);
|
|
11
|
+
const func = (raw) => {
|
|
12
|
+
return require_v2_trace.wrapTraceContext(require_common_onInit.withInit(handler))(convertAlertAndApp(raw));
|
|
13
|
+
};
|
|
14
|
+
func.run = handler;
|
|
15
|
+
func.__endpoint = getEndpointAnnotation(opts, alertType, appId);
|
|
16
|
+
return func;
|
|
39
17
|
}
|
|
40
|
-
exports.onAlertPublished = onAlertPublished;
|
|
41
18
|
/**
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
19
|
+
* Helper function for getting the endpoint annotation used in alert handling functions.
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
45
22
|
function getEndpointAnnotation(opts, alertType, appId) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
endpoint.eventTrigger.eventFilters.appid = appId;
|
|
68
|
-
}
|
|
69
|
-
return endpoint;
|
|
23
|
+
const baseOpts = require_v2_options.optionsToEndpoint(require_v2_options.getGlobalOptions());
|
|
24
|
+
const specificOpts = require_v2_options.optionsToEndpoint(opts);
|
|
25
|
+
const endpoint = {
|
|
26
|
+
...require_runtime_manifest.initV2Endpoint(require_v2_options.getGlobalOptions(), opts),
|
|
27
|
+
platform: "gcfv2",
|
|
28
|
+
...baseOpts,
|
|
29
|
+
...specificOpts,
|
|
30
|
+
labels: {
|
|
31
|
+
...baseOpts?.labels,
|
|
32
|
+
...specificOpts?.labels
|
|
33
|
+
},
|
|
34
|
+
eventTrigger: {
|
|
35
|
+
eventType,
|
|
36
|
+
eventFilters: { alerttype: alertType },
|
|
37
|
+
retry: opts.retry ?? false
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
if (appId) {
|
|
41
|
+
endpoint.eventTrigger.eventFilters.appid = appId;
|
|
42
|
+
}
|
|
43
|
+
return endpoint;
|
|
70
44
|
}
|
|
71
|
-
exports.getEndpointAnnotation = getEndpointAnnotation;
|
|
72
45
|
/**
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
46
|
+
* Helper function to parse the function opts, alert type, and appId.
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
76
49
|
function getOptsAndAlertTypeAndApp(alertTypeOrOpts) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
50
|
+
let opts;
|
|
51
|
+
let alertType;
|
|
52
|
+
let appId;
|
|
53
|
+
if (typeof alertTypeOrOpts === "string") {
|
|
54
|
+
alertType = alertTypeOrOpts;
|
|
55
|
+
opts = {};
|
|
56
|
+
} else {
|
|
57
|
+
alertType = alertTypeOrOpts.alertType;
|
|
58
|
+
appId = alertTypeOrOpts.appId;
|
|
59
|
+
opts = { ...alertTypeOrOpts };
|
|
60
|
+
delete opts.alertType;
|
|
61
|
+
delete opts.appId;
|
|
62
|
+
}
|
|
63
|
+
return [
|
|
64
|
+
opts,
|
|
65
|
+
alertType,
|
|
66
|
+
appId
|
|
67
|
+
];
|
|
92
68
|
}
|
|
93
|
-
exports.getOptsAndAlertTypeAndApp = getOptsAndAlertTypeAndApp;
|
|
94
69
|
/**
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
70
|
+
* Helper function to covert alert type & app id in the CloudEvent to camel case.
|
|
71
|
+
* @internal
|
|
72
|
+
*/
|
|
98
73
|
function convertAlertAndApp(raw) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
74
|
+
const event = { ...raw };
|
|
75
|
+
if ("alerttype" in event) {
|
|
76
|
+
event.alertType = event.alerttype;
|
|
77
|
+
}
|
|
78
|
+
if ("appid" in event) {
|
|
79
|
+
event.appId = event.appid;
|
|
80
|
+
}
|
|
81
|
+
return event;
|
|
107
82
|
}
|
|
83
|
+
|
|
84
|
+
//#endregion
|
|
108
85
|
exports.convertAlertAndApp = convertAlertAndApp;
|
|
86
|
+
exports.eventType = eventType;
|
|
87
|
+
exports.getEndpointAnnotation = getEndpointAnnotation;
|
|
88
|
+
exports.getOptsAndAlertTypeAndApp = getOptsAndAlertTypeAndApp;
|
|
89
|
+
exports.onAlertPublished = onAlertPublished;
|
|
@@ -1,90 +1,85 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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.getOptsAndApp = exports.onInAppFeedbackPublished = exports.onNewTesterIosDevicePublished = exports.inAppFeedbackAlert = exports.newTesterIosDeviceAlert = void 0;
|
|
25
|
-
const trace_1 = require("../../trace");
|
|
26
|
-
const alerts_1 = require("./alerts");
|
|
27
|
-
const onInit_1 = require("../../../common/onInit");
|
|
1
|
+
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.js');
|
|
2
|
+
const require_common_onInit = require('../../../common/onInit.js');
|
|
3
|
+
const require_v2_trace = require('../../trace.js');
|
|
4
|
+
const require_v2_providers_alerts_alerts = require('./alerts.js');
|
|
5
|
+
|
|
6
|
+
//#region src/v2/providers/alerts/appDistribution.ts
|
|
7
|
+
var appDistribution_exports = /* @__PURE__ */ require_rolldown_runtime.__export({
|
|
8
|
+
getOptsAndApp: () => getOptsAndApp,
|
|
9
|
+
inAppFeedbackAlert: () => inAppFeedbackAlert,
|
|
10
|
+
newTesterIosDeviceAlert: () => newTesterIosDeviceAlert,
|
|
11
|
+
onInAppFeedbackPublished: () => onInAppFeedbackPublished,
|
|
12
|
+
onNewTesterIosDevicePublished: () => onNewTesterIosDevicePublished
|
|
13
|
+
});
|
|
28
14
|
/** @internal */
|
|
29
|
-
|
|
15
|
+
const newTesterIosDeviceAlert = "appDistribution.newTesterIosDevice";
|
|
30
16
|
/** @internal */
|
|
31
|
-
|
|
17
|
+
const inAppFeedbackAlert = "appDistribution.inAppFeedback";
|
|
32
18
|
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
19
|
+
* Declares a function that can handle adding a new tester iOS device.
|
|
20
|
+
* @param appIdOrOptsOrHandler - A specific application, options, or an event-handling function.
|
|
21
|
+
* @param handler - Event handler which is run every time a new tester iOS device is added.
|
|
22
|
+
* @returns A function that you can export and deploy.
|
|
23
|
+
*/
|
|
38
24
|
function onNewTesterIosDevicePublished(appIdOrOptsOrHandler, handler) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
25
|
+
if (typeof appIdOrOptsOrHandler === "function") {
|
|
26
|
+
handler = appIdOrOptsOrHandler;
|
|
27
|
+
appIdOrOptsOrHandler = {};
|
|
28
|
+
}
|
|
29
|
+
const [opts, appId] = getOptsAndApp(appIdOrOptsOrHandler);
|
|
30
|
+
const func = (raw) => {
|
|
31
|
+
return require_v2_trace.wrapTraceContext(require_common_onInit.withInit(handler))(require_v2_providers_alerts_alerts.convertAlertAndApp(raw));
|
|
32
|
+
};
|
|
33
|
+
func.run = handler;
|
|
34
|
+
func.__endpoint = require_v2_providers_alerts_alerts.getEndpointAnnotation(opts, newTesterIosDeviceAlert, appId);
|
|
35
|
+
return func;
|
|
50
36
|
}
|
|
51
|
-
exports.onNewTesterIosDevicePublished = onNewTesterIosDevicePublished;
|
|
52
37
|
/**
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
38
|
+
* Declares a function that can handle receiving new in-app feedback from a tester.
|
|
39
|
+
* @param appIdOrOptsOrHandler - A specific application, options, or an event-handling function.
|
|
40
|
+
* @param handler - Event handler which is run every time new feedback is received.
|
|
41
|
+
* @returns A function that you can export and deploy.
|
|
42
|
+
*/
|
|
58
43
|
function onInAppFeedbackPublished(appIdOrOptsOrHandler, handler) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
44
|
+
if (typeof appIdOrOptsOrHandler === "function") {
|
|
45
|
+
handler = appIdOrOptsOrHandler;
|
|
46
|
+
appIdOrOptsOrHandler = {};
|
|
47
|
+
}
|
|
48
|
+
const [opts, appId] = getOptsAndApp(appIdOrOptsOrHandler);
|
|
49
|
+
const func = (raw) => {
|
|
50
|
+
return require_v2_trace.wrapTraceContext(require_common_onInit.withInit(handler))(require_v2_providers_alerts_alerts.convertAlertAndApp(raw));
|
|
51
|
+
};
|
|
52
|
+
func.run = handler;
|
|
53
|
+
func.__endpoint = require_v2_providers_alerts_alerts.getEndpointAnnotation(opts, inAppFeedbackAlert, appId);
|
|
54
|
+
return func;
|
|
70
55
|
}
|
|
71
|
-
exports.onInAppFeedbackPublished = onInAppFeedbackPublished;
|
|
72
56
|
/**
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
57
|
+
* Helper function to parse the function opts and appId.
|
|
58
|
+
* @internal
|
|
59
|
+
*/
|
|
76
60
|
function getOptsAndApp(appIdOrOpts) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
return [opts, appId];
|
|
61
|
+
let opts;
|
|
62
|
+
let appId;
|
|
63
|
+
if (typeof appIdOrOpts === "string") {
|
|
64
|
+
opts = {};
|
|
65
|
+
appId = appIdOrOpts;
|
|
66
|
+
} else {
|
|
67
|
+
appId = appIdOrOpts.appId;
|
|
68
|
+
opts = { ...appIdOrOpts };
|
|
69
|
+
delete opts.appId;
|
|
70
|
+
}
|
|
71
|
+
return [opts, appId];
|
|
89
72
|
}
|
|
73
|
+
|
|
74
|
+
//#endregion
|
|
75
|
+
Object.defineProperty(exports, 'appDistribution_exports', {
|
|
76
|
+
enumerable: true,
|
|
77
|
+
get: function () {
|
|
78
|
+
return appDistribution_exports;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
90
81
|
exports.getOptsAndApp = getOptsAndApp;
|
|
82
|
+
exports.inAppFeedbackAlert = inAppFeedbackAlert;
|
|
83
|
+
exports.newTesterIosDeviceAlert = newTesterIosDeviceAlert;
|
|
84
|
+
exports.onInAppFeedbackPublished = onInAppFeedbackPublished;
|
|
85
|
+
exports.onNewTesterIosDevicePublished = onNewTesterIosDevicePublished;
|