@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.
@@ -8721,16 +8721,12 @@ function request(_a) {
8721
8721
  return basePathMap.get(env);
8722
8722
  };
8723
8723
  isValidURL = function (url) {
8724
- var pattern = new RegExp("^(https?:\/\/)?" + // protocol
8725
- "((([a-z\d]([a-z\d-]*[a-z\d])*)\.)+[a-z]{2,}|" + // domain name
8726
- "((\d{1,3}\.){3}\d{1,3}))" + // OR ip (v4) address
8727
- "(\:\d+)?(\/[-a-z\d%_.~+]*)*" + // port and path
8728
- "(\?[;&a-z\d%_.~+=-]*)?" + // query string
8729
- "(\#[-a-z\d_]*)?$", "i"); // fragment locator
8730
- return !!pattern.test(url);
8724
+ var regex = /^https?:\/\//;
8725
+ return regex.test(url);
8731
8726
  };
8732
8727
  prefix = getBasePath();
8733
8728
  requestUrl = isValidURL(input.url) ? input.url : "".concat(prefix).concat(input.url);
8729
+ console.log('requestUrl', requestUrl, isValidURL(input.url));
8734
8730
  fetchOption = {
8735
8731
  method: method,
8736
8732
  headers: {
@@ -8762,20 +8758,28 @@ function request(_a) {
8762
8758
 
8763
8759
  function userInputToJson(_a) {
8764
8760
  return __awaiter(this, arguments, void 0, function (_b) {
8765
- var res;
8761
+ var res, result;
8766
8762
  var input = _b.input;
8767
8763
  return __generator(this, function (_c) {
8768
8764
  switch (_c.label) {
8769
- case 0: return [4 /*yield*/, request({
8770
- input: {
8771
- url: "https://fc-typechat.ywwl.com/userInputToJson",
8772
- method: "GET",
8773
- params: input,
8774
- },
8775
- })];
8765
+ case 0:
8766
+ console.log("input", input);
8767
+ return [4 /*yield*/, request({
8768
+ input: {
8769
+ url: "https://fc-typechat.ywwl.com/userInputToJson",
8770
+ method: "GET",
8771
+ params: input,
8772
+ },
8773
+ })];
8776
8774
  case 1:
8777
8775
  res = _c.sent();
8778
- return [2 /*return*/, res];
8776
+ if (res.success) {
8777
+ result = res.data;
8778
+ return [2 /*return*/, result.success ? result.data : result];
8779
+ }
8780
+ else {
8781
+ return [2 /*return*/, res.success ? res.data : res];
8782
+ }
8779
8783
  }
8780
8784
  });
8781
8785
  });