corebasic 1.0.266 → 1.0.268
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/dist/libs/features.js +4 -2
- package/libs/features.ts +5 -2
- package/package.json +1 -1
package/dist/libs/features.js
CHANGED
|
@@ -49,16 +49,18 @@ const getFeatureUrl = (api) => { const url = api.split(' ')[1]; if (!url)
|
|
|
49
49
|
throw new Error(`Invalid Feature url in api: ${api}`); return url; };
|
|
50
50
|
const getFeature = (name) => features[name];
|
|
51
51
|
function getLeaf(feature, req) {
|
|
52
|
+
if (feature)
|
|
53
|
+
return feature.split(/\.(query|command)\./)[0];
|
|
52
54
|
if (req) {
|
|
53
55
|
for (let key in features) {
|
|
54
56
|
const feature = features[key];
|
|
55
57
|
if (feature.featureless && feature.api === req.method.toUpperCase() + ' ' + req.path)
|
|
56
58
|
return key.split(/\.(query|command)\./)[0];
|
|
57
59
|
}
|
|
58
|
-
|
|
60
|
+
throw new Error(`Invalid feature for extracting leaf in getLeaf()`);
|
|
59
61
|
}
|
|
60
62
|
else {
|
|
61
|
-
|
|
63
|
+
throw new Error(`Invalid feature for extracting leaf in getLeaf()`);
|
|
62
64
|
}
|
|
63
65
|
}
|
|
64
66
|
const DEPLOY_TOKEN_SECRET = process.env.DEPLOY_TOKEN_SECRET || "MY_SECRET_DEPLOY_TOKEN";
|
package/libs/features.ts
CHANGED
|
@@ -157,15 +157,18 @@ const getFeatureUrl = (api: string): string => { const url = api.split(' ')[1];
|
|
|
157
157
|
const getFeature = (name: string): FeatureEntry | undefined => features[name]
|
|
158
158
|
|
|
159
159
|
function getLeaf(feature: string, req?: ExpressRequest): string {
|
|
160
|
+
if (feature)
|
|
161
|
+
return feature.split(/\.(query|command)\./)[0]!
|
|
162
|
+
|
|
160
163
|
if (req) {
|
|
161
164
|
for(let key in features) {
|
|
162
165
|
const feature = features[key]!
|
|
163
166
|
if (feature.featureless && feature.api === req.method.toUpperCase() + ' ' + req.path)
|
|
164
167
|
return key.split(/\.(query|command)\./)[0]!
|
|
165
168
|
}
|
|
166
|
-
|
|
169
|
+
throw new Error(`Invalid feature for extracting leaf in getLeaf()`)
|
|
167
170
|
} else {
|
|
168
|
-
|
|
171
|
+
throw new Error(`Invalid feature for extracting leaf in getLeaf()`)
|
|
169
172
|
}
|
|
170
173
|
}
|
|
171
174
|
|