@ywfe/fe-tools 1.2.1-beta.32 → 1.2.1-beta.34
Sign up to get free protection for your applications and to get access to all the features.
- package/JSON2String.ts +2 -5
- package/lib/JSON2String.d.ts +1 -3
- package/lib/userInputToJson.d.ts +5 -1
- package/lib/ywfe-tools.cjs +13 -24
- package/lib/ywfe-tools.cjs.map +1 -1
- package/lib/ywfe-tools.esm.js +13 -24
- 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 +1 -2
- package/userInputToJson.ts +3 -7
package/JSON2String.ts
CHANGED
@@ -4,14 +4,11 @@ interface Input {
|
|
4
4
|
// Ctrl-S保存代码
|
5
5
|
function JSON2String({input}: { input: Input }){
|
6
6
|
const { data } = input;
|
7
|
-
const result:{content: string} = {content:''};
|
8
7
|
try {
|
9
8
|
const str = JSON.stringify(data);
|
10
|
-
|
11
|
-
return result;
|
9
|
+
return '```json' + str + 'json```'
|
12
10
|
} catch (error) {
|
13
|
-
|
14
|
-
return result;
|
11
|
+
return '```json' + '{}' + 'json```'
|
15
12
|
}
|
16
13
|
}
|
17
14
|
export default JSON2String
|
package/lib/JSON2String.d.ts
CHANGED
package/lib/userInputToJson.d.ts
CHANGED
package/lib/ywfe-tools.cjs
CHANGED
@@ -8728,6 +8728,7 @@ function request(_a) {
|
|
8728
8728
|
};
|
8729
8729
|
prefix = getBasePath();
|
8730
8730
|
requestUrl = isValidURL(input.url) ? input.url : "".concat(prefix).concat(input.url);
|
8731
|
+
console.log('requestUrl', requestUrl, isValidURL(input.url));
|
8731
8732
|
fetchOption = {
|
8732
8733
|
method: method,
|
8733
8734
|
headers: {
|
@@ -8746,13 +8747,11 @@ function request(_a) {
|
|
8746
8747
|
response = _c.sent();
|
8747
8748
|
if (!response.ok) {
|
8748
8749
|
message = "An error has occured: ".concat(response.status);
|
8749
|
-
console.log('req result', message);
|
8750
8750
|
return [2 /*return*/, { success: false, message: message }];
|
8751
8751
|
}
|
8752
8752
|
return [4 /*yield*/, response.json()];
|
8753
8753
|
case 2:
|
8754
8754
|
result = _c.sent();
|
8755
|
-
console.log('req result', result);
|
8756
8755
|
return [2 /*return*/, result];
|
8757
8756
|
}
|
8758
8757
|
});
|
@@ -8761,28 +8760,21 @@ function request(_a) {
|
|
8761
8760
|
|
8762
8761
|
function userInputToJson(_a) {
|
8763
8762
|
return __awaiter(this, arguments, void 0, function (_b) {
|
8764
|
-
var res
|
8763
|
+
var res;
|
8765
8764
|
var input = _b.input;
|
8766
8765
|
return __generator(this, function (_c) {
|
8767
8766
|
switch (_c.label) {
|
8768
|
-
case 0:
|
8769
|
-
|
8770
|
-
|
8771
|
-
|
8772
|
-
|
8773
|
-
|
8774
|
-
|
8775
|
-
},
|
8776
|
-
})];
|
8767
|
+
case 0: return [4 /*yield*/, request({
|
8768
|
+
input: {
|
8769
|
+
url: "https://fc-typechat.ywwl.com/userInputToJson",
|
8770
|
+
method: "GET",
|
8771
|
+
params: input,
|
8772
|
+
},
|
8773
|
+
})];
|
8777
8774
|
case 1:
|
8778
8775
|
res = _c.sent();
|
8779
|
-
|
8780
|
-
|
8781
|
-
return [2 /*return*/, result.success ? result.data : result];
|
8782
|
-
}
|
8783
|
-
else {
|
8784
|
-
return [2 /*return*/, res.success ? res.data : res];
|
8785
|
-
}
|
8776
|
+
console.log('userINput1', res);
|
8777
|
+
return [2 /*return*/, res];
|
8786
8778
|
}
|
8787
8779
|
});
|
8788
8780
|
});
|
@@ -8792,15 +8784,12 @@ function userInputToJson(_a) {
|
|
8792
8784
|
function JSON2String(_a) {
|
8793
8785
|
var input = _a.input;
|
8794
8786
|
var data = input.data;
|
8795
|
-
var result = { content: '' };
|
8796
8787
|
try {
|
8797
8788
|
var str = JSON.stringify(data);
|
8798
|
-
|
8799
|
-
return result;
|
8789
|
+
return '```json' + str + 'json```';
|
8800
8790
|
}
|
8801
8791
|
catch (error) {
|
8802
|
-
|
8803
|
-
return result;
|
8792
|
+
return '```json' + '{}' + 'json```';
|
8804
8793
|
}
|
8805
8794
|
}
|
8806
8795
|
|