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/common/encoding.js
CHANGED
|
@@ -1,96 +1,73 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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.convertInvoker = exports.serviceAccountFromShorthand = exports.convertIfPresent = exports.copyIfPresent = exports.durationFromSeconds = void 0;
|
|
25
|
-
const params_1 = require("../params");
|
|
1
|
+
const require_params_types = require('../params/types.js');
|
|
2
|
+
require('../params/index.js');
|
|
3
|
+
|
|
4
|
+
//#region src/common/encoding.ts
|
|
26
5
|
/** Get a google.protobuf.Duration for a number of seconds. */
|
|
27
6
|
function durationFromSeconds(s) {
|
|
28
|
-
|
|
7
|
+
return `${s}s`;
|
|
29
8
|
}
|
|
30
|
-
exports.durationFromSeconds = durationFromSeconds;
|
|
31
9
|
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
10
|
+
* Utility function to help copy fields from type A to B.
|
|
11
|
+
* As a safety net, catches typos or fields that aren't named the same
|
|
12
|
+
* in A and B, but cannot verify that both Src and Dest have the same type for the same field.
|
|
13
|
+
*/
|
|
36
14
|
function copyIfPresent(dest, src, ...fields) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
15
|
+
if (!src) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
for (const field of fields) {
|
|
19
|
+
if (!Object.prototype.hasOwnProperty.call(src, field)) {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
dest[field] = src[field];
|
|
23
|
+
}
|
|
46
24
|
}
|
|
47
|
-
exports.copyIfPresent = copyIfPresent;
|
|
48
25
|
function convertIfPresent(dest, src, destField, srcField, converter = (from) => {
|
|
49
|
-
|
|
26
|
+
return from;
|
|
50
27
|
}) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
28
|
+
if (!src) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (!Object.prototype.hasOwnProperty.call(src, srcField)) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
dest[destField] = converter(src[srcField]);
|
|
58
35
|
}
|
|
59
|
-
exports.convertIfPresent = convertIfPresent;
|
|
60
36
|
function serviceAccountFromShorthand(serviceAccount) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
throw new Error(`Invalid option for serviceAccount: '${serviceAccount}'. Valid options are 'default', a service account email, or '{serviceAccountName}@'`);
|
|
78
|
-
}
|
|
37
|
+
if (serviceAccount === "default") {
|
|
38
|
+
return null;
|
|
39
|
+
} else if (serviceAccount instanceof require_params_types.Expression) {
|
|
40
|
+
return serviceAccount;
|
|
41
|
+
} else if (serviceAccount.endsWith("@")) {
|
|
42
|
+
if (!process.env.GCLOUD_PROJECT) {
|
|
43
|
+
throw new Error(`Unable to determine email for service account '${serviceAccount}' because process.env.GCLOUD_PROJECT is not set.`);
|
|
44
|
+
}
|
|
45
|
+
return `${serviceAccount}${process.env.GCLOUD_PROJECT}.iam.gserviceaccount.com`;
|
|
46
|
+
} else if (serviceAccount.includes("@")) {
|
|
47
|
+
return serviceAccount;
|
|
48
|
+
} else {
|
|
49
|
+
throw new Error(`Invalid option for serviceAccount: '${serviceAccount}'. Valid options are 'default', a service account email, or '{serviceAccountName}@'`);
|
|
50
|
+
}
|
|
79
51
|
}
|
|
80
|
-
exports.serviceAccountFromShorthand = serviceAccountFromShorthand;
|
|
81
52
|
function convertInvoker(invoker) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
53
|
+
if (typeof invoker === "string") {
|
|
54
|
+
invoker = [invoker];
|
|
55
|
+
}
|
|
56
|
+
if (invoker.length === 0) {
|
|
57
|
+
throw new Error("Invalid option for invoker: Must be a non-empty array.");
|
|
58
|
+
}
|
|
59
|
+
if (invoker.find((inv) => inv.length === 0)) {
|
|
60
|
+
throw new Error("Invalid option for invoker: Must be a non-empty string.");
|
|
61
|
+
}
|
|
62
|
+
if (invoker.length > 1 && invoker.find((inv) => inv === "public" || inv === "private")) {
|
|
63
|
+
throw new Error("Invalid option for invoker: Cannot have 'public' or 'private' in an array of service accounts.");
|
|
64
|
+
}
|
|
65
|
+
return invoker;
|
|
95
66
|
}
|
|
67
|
+
|
|
68
|
+
//#endregion
|
|
69
|
+
exports.convertIfPresent = convertIfPresent;
|
|
96
70
|
exports.convertInvoker = convertInvoker;
|
|
71
|
+
exports.copyIfPresent = copyIfPresent;
|
|
72
|
+
exports.durationFromSeconds = durationFromSeconds;
|
|
73
|
+
exports.serviceAccountFromShorthand = serviceAccountFromShorthand;
|
package/lib/common/onInit.js
CHANGED
|
@@ -1,36 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const logger = require("../logger");
|
|
1
|
+
const require_logger_index = require('../logger/index.js');
|
|
2
|
+
|
|
3
|
+
//#region src/common/onInit.ts
|
|
5
4
|
let initCallback = null;
|
|
6
5
|
let didInit = false;
|
|
7
6
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
* Registers a callback that should be run when in a production environment
|
|
8
|
+
* before executing any functions code.
|
|
9
|
+
* Calling this function more than once leads to undefined behavior.
|
|
10
|
+
* @param callback initialization callback to be run before any function executes.
|
|
11
|
+
*/
|
|
13
12
|
function onInit(callback) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
if (initCallback) {
|
|
14
|
+
require_logger_index.warn("Setting onInit callback more than once. Only the most recent callback will be called");
|
|
15
|
+
}
|
|
16
|
+
initCallback = callback;
|
|
17
|
+
didInit = false;
|
|
19
18
|
}
|
|
20
|
-
exports.onInit = onInit;
|
|
21
19
|
/** @internal */
|
|
22
20
|
function withInit(func) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
// non-promises and forward promises.
|
|
33
|
-
return func(...args);
|
|
34
|
-
};
|
|
21
|
+
return async (...args) => {
|
|
22
|
+
if (!didInit) {
|
|
23
|
+
if (initCallback) {
|
|
24
|
+
await initCallback();
|
|
25
|
+
}
|
|
26
|
+
didInit = true;
|
|
27
|
+
}
|
|
28
|
+
return func(...args);
|
|
29
|
+
};
|
|
35
30
|
}
|
|
36
|
-
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
exports.onInit = onInit;
|
|
34
|
+
exports.withInit = withInit;
|
package/lib/common/options.js
CHANGED
|
@@ -1,44 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.RESET_VALUE = exports.ResetValue = void 0;
|
|
4
|
-
// The MIT License (MIT)
|
|
5
|
-
//
|
|
6
|
-
// Copyright (c) 2022 Firebase
|
|
7
|
-
//
|
|
8
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
10
|
-
// in the Software without restriction, including without limitation the rights
|
|
11
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
13
|
-
// furnished to do so, subject to the following conditions:
|
|
14
|
-
//
|
|
15
|
-
// The above copyright notice and this permission notice shall be included in all
|
|
16
|
-
// copies or substantial portions of the Software.
|
|
17
|
-
//
|
|
18
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
-
// SOFTWARE.
|
|
1
|
+
|
|
2
|
+
//#region src/common/options.ts
|
|
25
3
|
/**
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
class ResetValue {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
exports.ResetValue = ResetValue;
|
|
4
|
+
* Special configuration type to reset configuration to platform default.
|
|
5
|
+
*
|
|
6
|
+
* @alpha
|
|
7
|
+
*/
|
|
8
|
+
var ResetValue = class ResetValue {
|
|
9
|
+
toJSON() {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
constructor() {}
|
|
13
|
+
static getInstance() {
|
|
14
|
+
return new ResetValue();
|
|
15
|
+
}
|
|
16
|
+
};
|
|
41
17
|
/**
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
18
|
+
* Special configuration value to reset configuration to platform default.
|
|
19
|
+
*/
|
|
20
|
+
const RESET_VALUE = ResetValue.getInstance();
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.RESET_VALUE = RESET_VALUE;
|
|
24
|
+
exports.ResetValue = ResetValue;
|
package/lib/common/params.d.ts
CHANGED
|
@@ -15,13 +15,13 @@ export type NullSafe<S extends null | undefined | string> = S extends null ? nev
|
|
|
15
15
|
* A type that extracts parameter name enclosed in bracket as string.
|
|
16
16
|
* Ignore wildcard matches
|
|
17
17
|
*
|
|
18
|
-
* For example,
|
|
19
|
-
* For example,
|
|
20
|
-
* For example,
|
|
18
|
+
* For example, VarName<"{uid}"> is "uid".
|
|
19
|
+
* For example, VarName<"{uid=*}"> is "uid".
|
|
20
|
+
* For example, VarName<"{uid=**}"> is "uid".
|
|
21
21
|
*/
|
|
22
|
-
export type
|
|
22
|
+
export type VarName<Part extends string> = Part extends `{${infer Param}=**}` ? Param : Part extends `{${infer Param}=*}` ? Param : Part extends `{${infer Param}}` ? Param : never;
|
|
23
23
|
/**
|
|
24
|
-
* A type that maps all parameter capture
|
|
24
|
+
* A type that maps all parameter capture groups into keys of a record.
|
|
25
25
|
* For example, ParamsOf<"users/{uid}"> is { uid: string }
|
|
26
26
|
* ParamsOf<"users/{uid}/logs/{log}"> is { uid: string; log: string }
|
|
27
27
|
* ParamsOf<"some/static/data"> is {}
|
|
@@ -29,5 +29,5 @@ export type Extract<Part extends string> = Part extends `{${infer Param}=**}` ?
|
|
|
29
29
|
* For flexibility reasons, ParamsOf<string> is Record<string, string>
|
|
30
30
|
*/
|
|
31
31
|
export type ParamsOf<PathPattern extends string | Expression<string>> = PathPattern extends Expression<string> ? Record<string, string> : string extends PathPattern ? Record<string, string> : {
|
|
32
|
-
[Key in
|
|
32
|
+
[Key in VarName<Split<NullSafe<Exclude<PathPattern, Expression<string>>>, "/">[number]>]: string;
|
|
33
33
|
};
|
package/lib/common/params.js
CHANGED
|
@@ -1,23 +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 });
|