@open-norantec/herbal 1.0.2-alpha.25 → 1.0.2-alpha.27
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/dist/cli/herbal.js
CHANGED
|
@@ -218,18 +218,19 @@ command
|
|
|
218
218
|
].join('\n');
|
|
219
219
|
},
|
|
220
220
|
rewriteOutputFile: function (code) { return __awaiter(void 0, void 0, void 0, function () {
|
|
221
|
-
var generateCodeMethod,
|
|
222
|
-
return __generator(this, function (
|
|
223
|
-
switch (
|
|
221
|
+
var generateCodeMethod, error_1;
|
|
222
|
+
return __generator(this, function (_a) {
|
|
223
|
+
switch (_a.label) {
|
|
224
224
|
case 0:
|
|
225
|
-
|
|
225
|
+
_a.trys.push([0, 2, , 3]);
|
|
226
226
|
generateCodeMethod = requireFromString(code);
|
|
227
227
|
if (typeof generateCodeMethod !== 'function')
|
|
228
228
|
return [2, ''];
|
|
229
229
|
return [4, Promise.resolve(generateCodeMethod({ group: options === null || options === void 0 ? void 0 : options.group })).then(function (generatedCode) { return generatedCode !== null && generatedCode !== void 0 ? generatedCode : ''; })];
|
|
230
|
-
case 1: return [2,
|
|
230
|
+
case 1: return [2, _a.sent()];
|
|
231
231
|
case 2:
|
|
232
|
-
|
|
232
|
+
error_1 = _a.sent();
|
|
233
|
+
log('error', "Failed to generate client code:", error_1 instanceof Error ? error_1.message : String(error_1));
|
|
233
234
|
return [2, ''];
|
|
234
235
|
case 3: return [2];
|
|
235
236
|
}
|
|
@@ -210,7 +210,7 @@ var TypeScriptClient = (function (_super) {
|
|
|
210
210
|
return __generator(this, function (_a) {
|
|
211
211
|
switch (_a.label) {
|
|
212
212
|
case 0:
|
|
213
|
-
interfaceName = "
|
|
213
|
+
interfaceName = "Interface".concat(Math.random().toString(36).slice(2));
|
|
214
214
|
return [4, (0, json_schema_to_typescript_1.compile)(schema, interfaceName, {
|
|
215
215
|
format: true,
|
|
216
216
|
bannerComment: '',
|
|
@@ -226,7 +226,7 @@ var TypeScriptClient = (function (_super) {
|
|
|
226
226
|
.split('\n')
|
|
227
227
|
.map(function (line, index) { return "".concat(index === 0 ? '' : ' ').concat(line.trim()); })
|
|
228
228
|
.join('')
|
|
229
|
-
.
|
|
229
|
+
.replace(/^export\s+interface\s+Interface[a-zA-Z0-9-_]+\s+\{/, '{');
|
|
230
230
|
})];
|
|
231
231
|
case 1: return [2, _a.sent()];
|
|
232
232
|
}
|