@ywfe/fe-tools 1.2.1-beta.30 → 1.2.1-beta.31
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/userInputToJson.d.ts +1 -5
- package/lib/ywfe-tools.cjs +20 -16
- package/lib/ywfe-tools.cjs.map +1 -1
- package/lib/ywfe-tools.esm.js +20 -16
- package/lib/ywfe-tools.esm.js.map +1 -1
- package/lib/ywfe-tools.umd.js +2 -2
- package/lib/ywfe-tools.umd.js.map +1 -1
- package/package.json +1 -1
- package/request.ts +3 -10
- package/userInputToJson.ts +7 -2
package/lib/userInputToJson.d.ts
CHANGED
package/lib/ywfe-tools.cjs
CHANGED
@@ -8723,16 +8723,12 @@ function request(_a) {
|
|
8723
8723
|
return basePathMap.get(env);
|
8724
8724
|
};
|
8725
8725
|
isValidURL = function (url) {
|
8726
|
-
var
|
8727
|
-
|
8728
|
-
"((\d{1,3}\.){3}\d{1,3}))" + // OR ip (v4) address
|
8729
|
-
"(\:\d+)?(\/[-a-z\d%_.~+]*)*" + // port and path
|
8730
|
-
"(\?[;&a-z\d%_.~+=-]*)?" + // query string
|
8731
|
-
"(\#[-a-z\d_]*)?$", "i"); // fragment locator
|
8732
|
-
return !!pattern.test(url);
|
8726
|
+
var regex = /^https?:\/\//;
|
8727
|
+
return regex.test(url);
|
8733
8728
|
};
|
8734
8729
|
prefix = getBasePath();
|
8735
8730
|
requestUrl = isValidURL(input.url) ? input.url : "".concat(prefix).concat(input.url);
|
8731
|
+
console.log('requestUrl', requestUrl, isValidURL(input.url));
|
8736
8732
|
fetchOption = {
|
8737
8733
|
method: method,
|
8738
8734
|
headers: {
|
@@ -8764,20 +8760,28 @@ function request(_a) {
|
|
8764
8760
|
|
8765
8761
|
function userInputToJson(_a) {
|
8766
8762
|
return __awaiter(this, arguments, void 0, function (_b) {
|
8767
|
-
var res;
|
8763
|
+
var res, result;
|
8768
8764
|
var input = _b.input;
|
8769
8765
|
return __generator(this, function (_c) {
|
8770
8766
|
switch (_c.label) {
|
8771
|
-
case 0:
|
8772
|
-
|
8773
|
-
|
8774
|
-
|
8775
|
-
|
8776
|
-
|
8777
|
-
|
8767
|
+
case 0:
|
8768
|
+
console.log("input", input);
|
8769
|
+
return [4 /*yield*/, request({
|
8770
|
+
input: {
|
8771
|
+
url: "https://fc-typechat.ywwl.com/userInputToJson",
|
8772
|
+
method: "GET",
|
8773
|
+
params: input,
|
8774
|
+
},
|
8775
|
+
})];
|
8778
8776
|
case 1:
|
8779
8777
|
res = _c.sent();
|
8780
|
-
|
8778
|
+
if (res.success) {
|
8779
|
+
result = res.data;
|
8780
|
+
return [2 /*return*/, result.success ? result.data : result];
|
8781
|
+
}
|
8782
|
+
else {
|
8783
|
+
return [2 /*return*/, res.success ? res.data : res];
|
8784
|
+
}
|
8781
8785
|
}
|
8782
8786
|
});
|
8783
8787
|
});
|