@ywfe/fe-tools 1.2.1-beta.30 → 1.2.1-beta.32
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/userInputToJson.d.ts +1 -5
- package/lib/ywfe-tools.cjs +21 -16
- package/lib/ywfe-tools.cjs.map +1 -1
- package/lib/ywfe-tools.esm.js +21 -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 +4 -10
- package/userInputToJson.ts +7 -2
package/lib/userInputToJson.d.ts
CHANGED
package/lib/ywfe-tools.cjs
CHANGED
|
@@ -8723,13 +8723,8 @@ 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);
|
|
@@ -8751,11 +8746,13 @@ function request(_a) {
|
|
|
8751
8746
|
response = _c.sent();
|
|
8752
8747
|
if (!response.ok) {
|
|
8753
8748
|
message = "An error has occured: ".concat(response.status);
|
|
8749
|
+
console.log('req result', message);
|
|
8754
8750
|
return [2 /*return*/, { success: false, message: message }];
|
|
8755
8751
|
}
|
|
8756
8752
|
return [4 /*yield*/, response.json()];
|
|
8757
8753
|
case 2:
|
|
8758
8754
|
result = _c.sent();
|
|
8755
|
+
console.log('req result', result);
|
|
8759
8756
|
return [2 /*return*/, result];
|
|
8760
8757
|
}
|
|
8761
8758
|
});
|
|
@@ -8764,20 +8761,28 @@ function request(_a) {
|
|
|
8764
8761
|
|
|
8765
8762
|
function userInputToJson(_a) {
|
|
8766
8763
|
return __awaiter(this, arguments, void 0, function (_b) {
|
|
8767
|
-
var res;
|
|
8764
|
+
var res, result;
|
|
8768
8765
|
var input = _b.input;
|
|
8769
8766
|
return __generator(this, function (_c) {
|
|
8770
8767
|
switch (_c.label) {
|
|
8771
|
-
case 0:
|
|
8772
|
-
|
|
8773
|
-
|
|
8774
|
-
|
|
8775
|
-
|
|
8776
|
-
|
|
8777
|
-
|
|
8768
|
+
case 0:
|
|
8769
|
+
console.log("input", input);
|
|
8770
|
+
return [4 /*yield*/, request({
|
|
8771
|
+
input: {
|
|
8772
|
+
url: "https://fc-typechat.ywwl.com/userInputToJson",
|
|
8773
|
+
method: "GET",
|
|
8774
|
+
params: input,
|
|
8775
|
+
},
|
|
8776
|
+
})];
|
|
8778
8777
|
case 1:
|
|
8779
8778
|
res = _c.sent();
|
|
8780
|
-
|
|
8779
|
+
if (res.success) {
|
|
8780
|
+
result = res.data;
|
|
8781
|
+
return [2 /*return*/, result.success ? result.data : result];
|
|
8782
|
+
}
|
|
8783
|
+
else {
|
|
8784
|
+
return [2 /*return*/, res.success ? res.data : res];
|
|
8785
|
+
}
|
|
8781
8786
|
}
|
|
8782
8787
|
});
|
|
8783
8788
|
});
|