@ywfe/fe-tools 1.0.2-beta.13 → 1.0.2-beta.2
Sign up to get free protection for your applications and to get access to all the features.
- package/{lib/ywfe-tools.esm.js → dist/bundle.js} +155 -100
- package/dist/bundle.js.map +1 -0
- package/package.json +17 -20
- package/index.ts +0 -2
- package/jest.config.js +0 -12
- package/lib/index.d.ts +0 -2
- package/lib/request.d.ts +0 -9
- package/lib/userInputToJson.d.ts +0 -8
- package/lib/ywfe-tools.cjs.js +0 -8782
- package/lib/ywfe-tools.cjs.js.map +0 -1
- package/lib/ywfe-tools.esm.js.map +0 -1
- package/request.ts +0 -49
- package/rollup.config.js +0 -73
- package/tsconfig.json +0 -10
- package/tsconfig.type.json +0 -8
- package/userInputToJson.ts +0 -18
@@ -1,3 +1,5 @@
|
|
1
|
+
import require$$1 from 'fs';
|
2
|
+
|
1
3
|
/******************************************************************************
|
2
4
|
Copyright (c) Microsoft Corporation.
|
3
5
|
|
@@ -11,111 +13,131 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11
13
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
12
14
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
13
15
|
PERFORMANCE OF THIS SOFTWARE.
|
14
|
-
***************************************************************************** */
|
15
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
16
|
-
|
17
|
-
|
18
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
19
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
20
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
21
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
22
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
23
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
24
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
25
|
-
});
|
26
|
-
}
|
27
|
-
|
28
|
-
function __generator(thisArg, body) {
|
29
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
30
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
31
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
32
|
-
function step(op) {
|
33
|
-
if (f) throw new TypeError("Generator is already executing.");
|
34
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
35
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
36
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
37
|
-
switch (op[0]) {
|
38
|
-
case 0: case 1: t = op; break;
|
39
|
-
case 4: _.label++; return { value: op[1], done: false };
|
40
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
41
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
42
|
-
default:
|
43
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
44
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
45
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
46
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
47
|
-
if (t[2]) _.ops.pop();
|
48
|
-
_.trys.pop(); continue;
|
49
|
-
}
|
50
|
-
op = body.call(thisArg, _);
|
51
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
52
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
53
|
-
}
|
54
|
-
}
|
55
|
-
|
56
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
57
|
-
var e = new Error(message);
|
58
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
59
|
-
};
|
16
|
+
***************************************************************************** */
|
17
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
60
18
|
|
61
|
-
function
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
return __generator(this, function (_c) {
|
66
|
-
switch (_c.label) {
|
67
|
-
case 0:
|
68
|
-
console.log(input);
|
69
|
-
return [4 /*yield*/, feTools.request({
|
70
|
-
input: {
|
71
|
-
url: "https://fc-typechat.ywwl.com/userInputToJson",
|
72
|
-
method: "GET"
|
73
|
-
}
|
74
|
-
})];
|
75
|
-
case 1:
|
76
|
-
res = _c.sent();
|
77
|
-
return [2 /*return*/, res];
|
78
|
-
}
|
79
|
-
});
|
19
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
20
|
+
function adopt(value) {
|
21
|
+
return value instanceof P ? value : new P(function (resolve) {
|
22
|
+
resolve(value);
|
80
23
|
});
|
24
|
+
}
|
25
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
26
|
+
function fulfilled(value) {
|
27
|
+
try {
|
28
|
+
step(generator.next(value));
|
29
|
+
} catch (e) {
|
30
|
+
reject(e);
|
31
|
+
}
|
32
|
+
}
|
33
|
+
function rejected(value) {
|
34
|
+
try {
|
35
|
+
step(generator["throw"](value));
|
36
|
+
} catch (e) {
|
37
|
+
reject(e);
|
38
|
+
}
|
39
|
+
}
|
40
|
+
function step(result) {
|
41
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
42
|
+
}
|
43
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
44
|
+
});
|
81
45
|
}
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
46
|
+
function __generator(thisArg, body) {
|
47
|
+
var _ = {
|
48
|
+
label: 0,
|
49
|
+
sent: function () {
|
50
|
+
if (t[0] & 1) throw t[1];
|
51
|
+
return t[1];
|
52
|
+
},
|
53
|
+
trys: [],
|
54
|
+
ops: []
|
55
|
+
},
|
56
|
+
f,
|
57
|
+
y,
|
58
|
+
t,
|
59
|
+
g;
|
60
|
+
return g = {
|
61
|
+
next: verb(0),
|
62
|
+
"throw": verb(1),
|
63
|
+
"return": verb(2)
|
64
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
65
|
+
return this;
|
66
|
+
}), g;
|
67
|
+
function verb(n) {
|
68
|
+
return function (v) {
|
69
|
+
return step([n, v]);
|
70
|
+
};
|
71
|
+
}
|
72
|
+
function step(op) {
|
73
|
+
if (f) throw new TypeError("Generator is already executing.");
|
74
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
75
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
76
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
77
|
+
switch (op[0]) {
|
78
|
+
case 0:
|
79
|
+
case 1:
|
80
|
+
t = op;
|
81
|
+
break;
|
82
|
+
case 4:
|
83
|
+
_.label++;
|
84
|
+
return {
|
85
|
+
value: op[1],
|
86
|
+
done: false
|
87
|
+
};
|
88
|
+
case 5:
|
89
|
+
_.label++;
|
90
|
+
y = op[1];
|
91
|
+
op = [0];
|
92
|
+
continue;
|
93
|
+
case 7:
|
94
|
+
op = _.ops.pop();
|
95
|
+
_.trys.pop();
|
96
|
+
continue;
|
97
|
+
default:
|
98
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
99
|
+
_ = 0;
|
100
|
+
continue;
|
101
|
+
}
|
102
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
103
|
+
_.label = op[1];
|
104
|
+
break;
|
105
|
+
}
|
106
|
+
if (op[0] === 6 && _.label < t[1]) {
|
107
|
+
_.label = t[1];
|
108
|
+
t = op;
|
109
|
+
break;
|
110
|
+
}
|
111
|
+
if (t && _.label < t[2]) {
|
112
|
+
_.label = t[2];
|
113
|
+
_.ops.push(op);
|
114
|
+
break;
|
115
|
+
}
|
116
|
+
if (t[2]) _.ops.pop();
|
117
|
+
_.trys.pop();
|
118
|
+
continue;
|
119
|
+
}
|
120
|
+
op = body.call(thisArg, _);
|
121
|
+
} catch (e) {
|
122
|
+
op = [6, e];
|
123
|
+
y = 0;
|
124
|
+
} finally {
|
125
|
+
f = t = 0;
|
126
|
+
}
|
127
|
+
if (op[0] & 5) throw op[1];
|
128
|
+
return {
|
129
|
+
value: op[0] ? op[1] : void 0,
|
130
|
+
done: true
|
131
|
+
};
|
132
|
+
}
|
106
133
|
}
|
134
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
135
|
+
var e = new Error(message);
|
136
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
137
|
+
};
|
107
138
|
|
108
139
|
var ywfeUtils_esm = {};
|
109
140
|
|
110
|
-
var empty = {};
|
111
|
-
|
112
|
-
var empty$1 = /*#__PURE__*/Object.freeze({
|
113
|
-
__proto__: null,
|
114
|
-
default: empty
|
115
|
-
});
|
116
|
-
|
117
|
-
var require$$1 = /*@__PURE__*/getAugmentedNamespace(empty$1);
|
118
|
-
|
119
141
|
(function (exports) {
|
120
142
|
|
121
143
|
Object.defineProperty(exports, '__esModule', { value: true });
|
@@ -8775,5 +8797,38 @@ function request(_a) {
|
|
8775
8797
|
});
|
8776
8798
|
}
|
8777
8799
|
|
8778
|
-
|
8779
|
-
|
8800
|
+
function userInputToJson(_a) {
|
8801
|
+
return __awaiter(this, arguments, void 0, function (_b) {
|
8802
|
+
var res;
|
8803
|
+
var input = _b.input;
|
8804
|
+
return __generator(this, function (_c) {
|
8805
|
+
switch (_c.label) {
|
8806
|
+
case 0:
|
8807
|
+
input.userInput, input.rules;
|
8808
|
+
return [4 /*yield*/, feTools.request({
|
8809
|
+
input: {
|
8810
|
+
url: "https://fc-typechat.ywwl.com/userInputToJson",
|
8811
|
+
method: "GET"
|
8812
|
+
}
|
8813
|
+
})];
|
8814
|
+
case 1:
|
8815
|
+
res = _c.sent();
|
8816
|
+
return [2 /*return*/, res];
|
8817
|
+
}
|
8818
|
+
});
|
8819
|
+
});
|
8820
|
+
}
|
8821
|
+
|
8822
|
+
function JSON2String(_a) {
|
8823
|
+
var input = _a.input;
|
8824
|
+
var _b = input.data, data = _b === void 0 ? {} : _b;
|
8825
|
+
try {
|
8826
|
+
return "```json" + JSON.stringify(data) + "json```";
|
8827
|
+
}
|
8828
|
+
catch (error) {
|
8829
|
+
return "```json" + JSON.stringify({}) + "json```";
|
8830
|
+
}
|
8831
|
+
}
|
8832
|
+
|
8833
|
+
export { JSON2String, request, userInputToJson };
|
8834
|
+
//# sourceMappingURL=bundle.js.map
|