@open-norantec/herbal 1.0.2-alpha.23 → 1.0.2-alpha.25

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.
@@ -8,6 +8,6 @@ export declare abstract class Client {
8
8
  readonly options: CreateClientOptions;
9
9
  protected document: OpenAPIObject;
10
10
  constructor(options: CreateClientOptions);
11
- abstract generateClientSourceFile(): string;
11
+ abstract generateClientSourceFile(): Promise<string>;
12
12
  createSchema(group?: string): void;
13
13
  }
@@ -1,5 +1,41 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
+ return new (P || (P = Promise))(function (resolve, reject) {
6
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10
+ });
11
+ };
12
+ var __generator = (this && this.__generator) || function (thisArg, body) {
13
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
14
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
15
+ function verb(n) { return function (v) { return step([n, v]); }; }
16
+ function step(op) {
17
+ if (f) throw new TypeError("Generator is already executing.");
18
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
19
+ 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;
20
+ if (y = 0, t) op = [op[0] & 2, t.value];
21
+ switch (op[0]) {
22
+ case 0: case 1: t = op; break;
23
+ case 4: _.label++; return { value: op[1], done: false };
24
+ case 5: _.label++; y = op[1]; op = [0]; continue;
25
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
26
+ default:
27
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
28
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
29
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
30
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
31
+ if (t[2]) _.ops.pop();
32
+ _.trys.pop(); continue;
33
+ }
34
+ op = body.call(thisArg, _);
35
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
36
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
37
+ }
38
+ };
3
39
  Object.defineProperty(exports, "__esModule", { value: true });
4
40
  var commander_1 = require("commander");
5
41
  var forge_1 = require("@open-norantec/forge");
@@ -177,21 +213,28 @@ command
177
213
  ' if (!isClient(client)) { client = entry?.default; }',
178
214
  " if (!isClient(client)) return '';",
179
215
  ' client.instance.createSchema(context?.group);',
180
- " return client.instance.generateClientSourceFile() ?? '';",
216
+ ' return client.instance.generateClientSourceFile();',
181
217
  '};',
182
218
  ].join('\n');
183
219
  },
184
- rewriteOutputFile: function (code) {
185
- try {
186
- var generateCodeMethod = requireFromString(code);
187
- if (typeof generateCodeMethod !== 'function')
188
- return '';
189
- return generateCodeMethod({ group: options === null || options === void 0 ? void 0 : options.group });
190
- }
191
- catch (_a) {
192
- return '';
193
- }
194
- },
220
+ rewriteOutputFile: function (code) { return __awaiter(void 0, void 0, void 0, function () {
221
+ var generateCodeMethod, _a;
222
+ return __generator(this, function (_b) {
223
+ switch (_b.label) {
224
+ case 0:
225
+ _b.trys.push([0, 2, , 3]);
226
+ generateCodeMethod = requireFromString(code);
227
+ if (typeof generateCodeMethod !== 'function')
228
+ return [2, ''];
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, _b.sent()];
231
+ case 2:
232
+ _a = _b.sent();
233
+ return [2, ''];
234
+ case 3: return [2];
235
+ }
236
+ });
237
+ }); },
195
238
  }); },
196
239
  };
197
240
  }));
@@ -1,22 +1,7 @@
1
1
  import 'reflect-metadata';
2
- import { SchemaObject } from 'zod-openapi/dist/openapi3-ts/dist/model/openapi31';
3
2
  import { Client, CreateClientOptions } from '../abstracts/client.abstract.class';
4
- declare namespace OpenApiToTypescript {
5
- interface Options {
6
- useInterface?: boolean;
7
- export?: boolean;
8
- generateJSDoc?: boolean;
9
- preferUnknown?: boolean;
10
- singleLine?: boolean;
11
- }
12
- interface TypeResult {
13
- code: string;
14
- name?: string;
15
- }
16
- }
17
- export declare function convertOpenApiToTypescript(schema: SchemaObject, name?: string, options?: OpenApiToTypescript.Options): OpenApiToTypescript.TypeResult;
18
3
  export declare class TypeScriptClient extends Client implements Client {
19
4
  constructor(options: CreateClientOptions);
20
- generateClientSourceFile(): string;
5
+ generateClientSourceFile(): Promise<string>;
6
+ private schemaToTypeScriptLiteral;
21
7
  }
22
- export {};
@@ -14,346 +14,224 @@ var __extends = (this && this.__extends) || (function () {
14
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
15
  };
16
16
  })();
17
- var __assign = (this && this.__assign) || function () {
18
- __assign = Object.assign || function(t) {
19
- for (var s, i = 1, n = arguments.length; i < n; i++) {
20
- s = arguments[i];
21
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
- t[p] = s[p];
23
- }
24
- return t;
25
- };
26
- return __assign.apply(this, arguments);
17
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
27
25
  };
28
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
29
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
30
- if (ar || !(i in from)) {
31
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
32
- ar[i] = from[i];
33
- }
26
+ var __generator = (this && this.__generator) || function (thisArg, body) {
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
+ function verb(n) { return function (v) { return step([n, v]); }; }
30
+ function step(op) {
31
+ if (f) throw new TypeError("Generator is already executing.");
32
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
+ 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;
34
+ if (y = 0, t) op = [op[0] & 2, t.value];
35
+ switch (op[0]) {
36
+ case 0: case 1: t = op; break;
37
+ case 4: _.label++; return { value: op[1], done: false };
38
+ case 5: _.label++; y = op[1]; op = [0]; continue;
39
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
+ default:
41
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
+ if (t[2]) _.ops.pop();
46
+ _.trys.pop(); continue;
47
+ }
48
+ op = body.call(thisArg, _);
49
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
34
51
  }
35
- return to.concat(ar || Array.prototype.slice.call(from));
36
52
  };
37
53
  Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.TypeScriptClient = exports.convertOpenApiToTypescript = void 0;
54
+ exports.TypeScriptClient = void 0;
39
55
  require("reflect-metadata");
40
56
  var client_abstract_class_1 = require("../abstracts/client.abstract.class");
41
- var OpenApiToTypescriptConverter = (function () {
42
- function OpenApiToTypescriptConverter(options) {
43
- if (options === void 0) { options = {}; }
44
- this.options = __assign({ useInterface: false, export: true, generateJSDoc: true, preferUnknown: true, singleLine: true }, options);
45
- }
46
- OpenApiToTypescriptConverter.prototype.convert = function (schema, name) {
47
- var typeString = this.parseSchema(schema, 0, name);
48
- if (name) {
49
- var exportKeyword = this.options.export ? 'export ' : '';
50
- if (this.options.useInterface && schema.type === 'object' && schema.properties) {
51
- var code_1 = "".concat(exportKeyword).concat(typeString);
52
- return { code: code_1, name: name };
53
- }
54
- var code = "".concat(exportKeyword, "type ").concat(name, " = ").concat(typeString, ";");
55
- return { code: code, name: name };
56
- }
57
- return { code: typeString };
58
- };
59
- OpenApiToTypescriptConverter.prototype.generateTypes = function (schemas) {
60
- var _this = this;
61
- if (!schemas)
62
- return '';
63
- var lines = [];
64
- Object.entries(schemas).forEach(function (_a) {
65
- var name = _a[0], schema = _a[1];
66
- var result = _this.convert(schema, name);
67
- lines.push(result.code);
68
- });
69
- return lines.join('\n');
70
- };
71
- OpenApiToTypescriptConverter.fromZodResult = function (result, name, options) {
72
- var converter = new OpenApiToTypescriptConverter(options);
73
- return converter.convert(result.schema, name);
74
- };
75
- OpenApiToTypescriptConverter.prototype.parseSchema = function (schema, depth, name) {
76
- if (depth === void 0) { depth = 0; }
77
- if ('$ref' in schema && typeof schema.$ref === 'string') {
78
- return this.refToTypeName(schema.$ref);
79
- }
80
- var s = schema;
81
- if (s.oneOf) {
82
- return this.parseOneOf(s.oneOf, depth);
83
- }
84
- if (s.anyOf) {
85
- return this.parseAnyOf(s.anyOf, depth);
86
- }
87
- if (s.allOf) {
88
- return this.parseAllOf(s.allOf, depth);
89
- }
90
- switch (s.type) {
91
- case 'object':
92
- return this.parseObject(s, depth, name);
93
- case 'array':
94
- return this.parseArray(s, depth);
95
- case 'string':
96
- return this.parseString(s);
97
- case 'integer':
98
- case 'number':
99
- return 'number';
100
- case 'boolean':
101
- return 'boolean';
102
- default:
103
- if (s.enum) {
104
- return this.parseEnum(s.enum);
105
- }
106
- if (Array.isArray(s.type)) {
107
- return s.type.join(' | ');
108
- }
109
- if (Object.keys(s).length === 0 || (s.type === undefined && !s.enum)) {
110
- return this.options.preferUnknown ? 'unknown' : 'any';
111
- }
112
- return this.options.preferUnknown ? 'unknown' : 'any';
113
- }
114
- };
115
- OpenApiToTypescriptConverter.prototype.parseObject = function (schema, depth, name) {
116
- var _this = this;
117
- if (schema.additionalProperties && !schema.properties) {
118
- if (typeof schema.additionalProperties === 'boolean') {
119
- return 'Record<string, unknown>';
120
- }
121
- var valueType = this.parseSchema(schema.additionalProperties, depth);
122
- return "Record<string, ".concat(valueType, ">");
123
- }
124
- var properties = schema.properties || {};
125
- var required = schema.required || [];
126
- if (Object.keys(properties).length === 0) {
127
- if (schema.additionalProperties) {
128
- if (typeof schema.additionalProperties === 'boolean') {
129
- return 'Record<string, unknown>';
130
- }
131
- var valueType = this.parseSchema(schema.additionalProperties, depth);
132
- return "Record<string, ".concat(valueType, ">");
133
- }
134
- return 'Record<string, never>';
135
- }
136
- if (this.options.useInterface && name && depth === 0) {
137
- var props_1 = [];
138
- Object.entries(properties).forEach(function (_a) {
139
- var key = _a[0], propSchema = _a[1];
140
- var isRequired = required.includes(key);
141
- var tsType = _this.parseSchema(propSchema, depth + 1);
142
- var optional = isRequired ? '' : '?';
143
- props_1.push("".concat(key).concat(optional, ": ").concat(tsType));
144
- });
145
- return "interface ".concat(name, " { ").concat(props_1.join('; '), " }");
146
- }
147
- var props = [];
148
- Object.entries(properties).forEach(function (_a) {
149
- var key = _a[0], propSchema = _a[1];
150
- var isRequired = required.includes(key);
151
- var tsType = _this.parseSchema(propSchema, depth + 1);
152
- var optional = isRequired ? '' : '?';
153
- props.push("".concat(key).concat(optional, ": ").concat(tsType));
154
- });
155
- return "{ ".concat(props.join('; '), " }");
156
- };
157
- OpenApiToTypescriptConverter.prototype.parseArray = function (schema, depth) {
158
- var _this = this;
159
- var items = schema.items;
160
- if (!items) {
161
- return 'unknown[]';
162
- }
163
- if (Array.isArray(items)) {
164
- var types = items.map(function (item) { return _this.parseSchema(item, depth); });
165
- return "[".concat(types.join(', '), "]");
166
- }
167
- var itemType = this.parseSchema(items, depth);
168
- if (itemType.includes('|') || itemType.includes('&')) {
169
- return "(".concat(itemType, ")[]");
170
- }
171
- return "".concat(itemType, "[]");
172
- };
173
- OpenApiToTypescriptConverter.prototype.parseString = function (schema) {
174
- if (schema.enum) {
175
- return this.parseEnum(schema.enum);
176
- }
177
- return 'string';
178
- };
179
- OpenApiToTypescriptConverter.prototype.parseEnum = function (values) {
180
- var literals = values.map(function (v) {
181
- if (v === null)
182
- return 'null';
183
- if (typeof v === 'string') {
184
- return "'".concat(v.replace(/'/g, "\\'"), "'");
185
- }
186
- return String(v);
187
- });
188
- return literals.join(' | ');
189
- };
190
- OpenApiToTypescriptConverter.prototype.parseOneOf = function (schemas, depth) {
191
- var _this = this;
192
- var types = schemas.map(function (s) { return _this.parseSchema(s, depth); });
193
- return types.join(' | ');
194
- };
195
- OpenApiToTypescriptConverter.prototype.parseAnyOf = function (schemas, depth) {
196
- var _this = this;
197
- var types = schemas.map(function (s) { return _this.parseSchema(s, depth); });
198
- return types.join(' | ');
199
- };
200
- OpenApiToTypescriptConverter.prototype.parseAllOf = function (schemas, depth) {
201
- var _this = this;
202
- var types = schemas.map(function (s) {
203
- var parsed = _this.parseSchema(s, depth);
204
- return parsed;
205
- });
206
- var uniqueTypes = __spreadArray([], Array.from(new Set(types)), true);
207
- if (uniqueTypes.length === 1) {
208
- return uniqueTypes[0];
209
- }
210
- return uniqueTypes.join(' & ');
211
- };
212
- OpenApiToTypescriptConverter.prototype.refToTypeName = function (ref) {
213
- var parts = ref.split('/');
214
- return parts[parts.length - 1] || 'unknown';
215
- };
216
- return OpenApiToTypescriptConverter;
217
- }());
218
- function convertOpenApiToTypescript(schema, name, options) {
219
- var converter = new OpenApiToTypescriptConverter(options);
220
- return converter.convert(schema, name);
221
- }
222
- exports.convertOpenApiToTypescript = convertOpenApiToTypescript;
57
+ var json_schema_to_typescript_1 = require("json-schema-to-typescript");
223
58
  var TypeScriptClient = (function (_super) {
224
59
  __extends(TypeScriptClient, _super);
225
60
  function TypeScriptClient(options) {
226
61
  return _super.call(this, options) || this;
227
62
  }
228
63
  TypeScriptClient.prototype.generateClientSourceFile = function () {
229
- var _a;
230
- var options = this.options;
231
- if (!(options === null || options === void 0 ? void 0 : options.Module))
232
- throw new Error("Parameter 'Module' must be specified");
233
- var METHOD_TYPE_MAP_NAME = 'MethodTypeMap';
234
- var METHOD_TYPE_MAP_KEYS_NAME = 'MethodTypeMapKeys';
235
- var RESPONSE_CALLBACK_DATA_NAME = 'ResponseCallbackData';
236
- var REQUEST_OPTIONS_NAME = 'RequestOptions';
237
- var RESULT_TYPE_NAME = 'Result';
238
- var REQUEST_METHOD_MAP_NAME = 'REQUEST_METHOD_MAP';
239
- var RESPONSE_CACHE_MAP_NAME = 'RESPONSE_CACHE_MAP';
240
- var REQUEST_BODY_TYPE_ANNOTATION = "".concat(METHOD_TYPE_MAP_NAME, "[T]['request']");
241
- var RESULT_TYPE_ANNOTATION = "".concat(RESULT_TYPE_NAME, "<").concat(METHOD_TYPE_MAP_NAME, "[T]['response']>");
242
- var methodTypeMapCodeLines = Object.entries((_a = this.document.paths) !== null && _a !== void 0 ? _a : {})
243
- .map(function (_a) {
244
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
245
- var pathname = _a[0], schema = _a[1];
246
- var requestSchema = (_e = (_d = (_c = (_b = schema === null || schema === void 0 ? void 0 : schema.post) === null || _b === void 0 ? void 0 : _b.requestBody) === null || _c === void 0 ? void 0 : _c.content) === null || _d === void 0 ? void 0 : _d['application/json']) === null || _e === void 0 ? void 0 : _e.schema;
247
- var responseSchema = (_k = (_j = (_h = (_g = (_f = schema === null || schema === void 0 ? void 0 : schema.post) === null || _f === void 0 ? void 0 : _f.responses) === null || _g === void 0 ? void 0 : _g['200']) === null || _h === void 0 ? void 0 : _h.content) === null || _j === void 0 ? void 0 : _j['application/json']) === null || _k === void 0 ? void 0 : _k.schema;
248
- if (!requestSchema && !responseSchema)
249
- return null;
250
- return [
251
- "'".concat(pathname, "': {"),
252
- " request: ".concat(((_l = convertOpenApiToTypescript(requestSchema)) === null || _l === void 0 ? void 0 : _l.code) || 'any', ";"),
253
- " response: ".concat(((_m = convertOpenApiToTypescript(responseSchema)) === null || _m === void 0 ? void 0 : _m.code) || 'any', ";"),
254
- ' };',
255
- ].join('');
256
- })
257
- .filter(function (value) { return value !== null; }).map(function (line) { return " ".concat(line); });
258
- methodTypeMapCodeLines.unshift("export interface ".concat(METHOD_TYPE_MAP_NAME, " {"));
259
- methodTypeMapCodeLines.push('}');
260
- return [
261
- "import * as hash from 'object-hash';",
262
- "import * as _ from 'lodash';",
263
- "\n".concat(methodTypeMapCodeLines.join('\n')),
264
- "\ntype ".concat(METHOD_TYPE_MAP_KEYS_NAME, " = keyof ").concat(METHOD_TYPE_MAP_NAME, ";"),
265
- "\ntype ".concat(RESPONSE_CALLBACK_DATA_NAME, "<K extends ").concat(METHOD_TYPE_MAP_KEYS_NAME, "> = {"),
266
- ' url: K;',
267
- " result: ".concat(RESULT_TYPE_NAME, "<").concat(METHOD_TYPE_MAP_NAME, "[K]['response']>;"),
268
- '};',
269
- "\nexport interface ".concat(REQUEST_OPTIONS_NAME, " extends RequestInit {"),
270
- ' headers?: Record<string, any>;',
271
- ' ignoreCache?: boolean;',
272
- ' prefix?: string;',
273
- ' timeout?: number;',
274
- ' getAuthorizationCredential?: () => string;',
275
- " onRequest?: (context: { cached: boolean; id: string; options: Omit<".concat(REQUEST_OPTIONS_NAME, ", 'getAuthorizationCredential' | 'onRequest' | 'onResponse'>; prefix: string | undefined; requestBody: string; url: string; }) => void | Promise<void>;"),
276
- " onResponse?: <K extends ".concat(METHOD_TYPE_MAP_KEYS_NAME, ">(response: ").concat(RESPONSE_CALLBACK_DATA_NAME, "<K>, id: string) => void | Promise<void>;"),
277
- '}',
278
- "\nexport interface ".concat(RESULT_TYPE_NAME, "<T> {"),
279
- ' error: Error | null;',
280
- " response: T | null;",
281
- ' status: number;',
282
- ' statusText: string;',
283
- ' headers?: Record<string, any>;',
284
- '}',
285
- '\nexport class Client {',
286
- " public constructor(private readonly options: ".concat(REQUEST_OPTIONS_NAME, " = {}) {}"),
287
- "\n protected readonly ".concat(REQUEST_METHOD_MAP_NAME, " = new Map<keyof ").concat(METHOD_TYPE_MAP_NAME, ", (...params: any[]) => Promise<unknown>>();"),
288
- "\n protected readonly ".concat(RESPONSE_CACHE_MAP_NAME, " = new Map<string, ").concat(RESULT_TYPE_NAME, "<unknown>>();"),
289
- "\n public createRequest<T extends keyof ".concat(METHOD_TYPE_MAP_NAME, ">(url: T): (requestBody?: ").concat(REQUEST_BODY_TYPE_ANNOTATION, ", options?: ").concat(REQUEST_OPTIONS_NAME, ") => Promise<").concat(RESULT_TYPE_ANNOTATION, "> {"),
290
- " if (typeof this.".concat(REQUEST_METHOD_MAP_NAME, ".get(url) !== 'function') {"),
291
- " this.".concat(REQUEST_METHOD_MAP_NAME, ".set(url, (requestBody?: ").concat(REQUEST_BODY_TYPE_ANNOTATION, ", options?: ").concat(REQUEST_OPTIONS_NAME, ") => this.request.call(this, url, requestBody, options));"),
292
- ' }',
293
- " return this.".concat(REQUEST_METHOD_MAP_NAME, ".get(url) as (requestBody?: ").concat(REQUEST_BODY_TYPE_ANNOTATION, ", options?: ").concat(REQUEST_OPTIONS_NAME, ") => Promise<").concat(RESULT_TYPE_ANNOTATION, ">;"),
294
- ' }',
295
- "\n public async request<T extends keyof ".concat(METHOD_TYPE_MAP_NAME, ">(url: T, requestBody?: ").concat(REQUEST_BODY_TYPE_ANNOTATION, ", options?: Omit<").concat(REQUEST_OPTIONS_NAME, ", 'getAuthorizationCredential' | 'onRequest' | 'onResponse'>): Promise<").concat(RESULT_TYPE_ANNOTATION, "> {"),
296
- ' const id = `${Math.random().toString(32).slice(2)}${Date.now().toString(16)}`;',
297
- ' const requestHash = hash(requestBody ?? null);',
298
- ' const requestBodyString = JSON.stringify(requestBody);',
299
- " const finalOptions = _.merge({}, this?.options, _.omit(options, ['getAuthorizationCredential', 'onRequest', 'onResponse']));",
300
- " const onRequestOptions = _.omit(finalOptions, ['getAuthorizationCredential', 'onRequest', 'onResponse']);",
301
- ' const { getAuthorizationCredential, onResponse, onRequest, ignoreCache, timeout, prefix, ...requestOptions } = finalOptions;',
302
- " if (this.".concat(RESPONSE_CACHE_MAP_NAME, ".has(requestHash) && !ignoreCache) {"),
303
- ' onRequest?.({',
304
- ' prefix,',
305
- ' url,',
306
- ' requestBody: requestBodyString,',
307
- ' cached: true,',
308
- ' options: onRequestOptions,',
309
- ' id,',
310
- ' });',
311
- " return this.".concat(RESPONSE_CACHE_MAP_NAME, ".get(requestHash) as ").concat(RESULT_TYPE_ANNOTATION, ";"),
312
- ' }',
313
- ' onRequest?.({',
314
- ' prefix,',
315
- ' url,',
316
- ' id,',
317
- ' requestBody: requestBodyString,',
318
- ' cached: false,',
319
- ' options: onRequestOptions,',
320
- ' });',
321
- ' const credential = getAuthorizationCredential?.();',
322
- ' const abortController = new AbortController();',
323
- ' if (timeout! > 0) {',
324
- ' setTimeout(() => {',
325
- ' abortController.abort();',
326
- ' }, timeout);',
327
- ' }',
328
- " const result: ".concat(RESULT_TYPE_ANNOTATION, " = await fetch((prefix ?? '') + url, {"),
329
- ' ...requestOptions,',
330
- ' body: JSON.stringify(requestBody),',
331
- " method: 'POST',",
332
- ' signal: abortController.signal,',
333
- ' headers: {',
334
- ' ...requestOptions?.headers,',
335
- " 'Content-Type': 'application/json',",
336
- " Authorization: (typeof credential === 'string' && credential.length > 0) ? credential : finalOptions?.headers?.Authorization,",
337
- ' },',
338
- ' }).then((response) => {',
339
- ' const status = response?.status;',
340
- ' const statusText = response?.statusText;',
341
- ' const headers = Array.from(response?.headers?.entries?.() ?? []).reduce((result, [key, value]) => {',
342
- " if (typeof key !== 'string' || key.length === 0) return result;",
343
- ' result[key] = value;',
344
- ' return result;',
345
- ' }, {});',
346
- ' if (!response?.ok) {',
347
- ' return response.text().then((errorText) => ({ error: new Error(errorText), response: null, headers, status, statusText }));',
348
- ' }',
349
- " return response.json().then((response) => ({ error: null, response, headers, status, statusText } as ".concat(RESULT_TYPE_ANNOTATION, "));"),
350
- " }).catch((error) => Promise.resolve({ error, response: null, headers: {}, status: 0, statusText: '' }));",
351
- " onResponse?.({ url, result }, id);",
352
- " this.".concat(RESPONSE_CACHE_MAP_NAME, ".set(requestHash, result);"),
353
- ' return result;',
354
- ' }',
355
- '}\n',
356
- ].join('\n');
64
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
65
+ return __awaiter(this, void 0, void 0, function () {
66
+ var options, METHOD_TYPE_MAP_NAME, METHOD_TYPE_MAP_KEYS_NAME, RESPONSE_CALLBACK_DATA_NAME, REQUEST_OPTIONS_NAME, RESULT_TYPE_NAME, REQUEST_METHOD_MAP_NAME, RESPONSE_CACHE_MAP_NAME, REQUEST_BODY_TYPE_ANNOTATION, RESULT_TYPE_ANNOTATION, methodTypeMapCodeLines, _i, _l, _m, pathname, schema, requestSchema, responseSchema, requestTypeLiteral, responseTypeLiteral;
67
+ return __generator(this, function (_o) {
68
+ switch (_o.label) {
69
+ case 0:
70
+ options = this.options;
71
+ if (!(options === null || options === void 0 ? void 0 : options.Module))
72
+ throw new Error("Parameter 'Module' must be specified");
73
+ METHOD_TYPE_MAP_NAME = 'MethodTypeMap';
74
+ METHOD_TYPE_MAP_KEYS_NAME = 'MethodTypeMapKeys';
75
+ RESPONSE_CALLBACK_DATA_NAME = 'ResponseCallbackData';
76
+ REQUEST_OPTIONS_NAME = 'RequestOptions';
77
+ RESULT_TYPE_NAME = 'Result';
78
+ REQUEST_METHOD_MAP_NAME = 'REQUEST_METHOD_MAP';
79
+ RESPONSE_CACHE_MAP_NAME = 'RESPONSE_CACHE_MAP';
80
+ REQUEST_BODY_TYPE_ANNOTATION = "".concat(METHOD_TYPE_MAP_NAME, "[T]['request']");
81
+ RESULT_TYPE_ANNOTATION = "".concat(RESULT_TYPE_NAME, "<").concat(METHOD_TYPE_MAP_NAME, "[T]['response']>");
82
+ methodTypeMapCodeLines = [];
83
+ _i = 0, _l = Object.entries((_a = this.document.paths) !== null && _a !== void 0 ? _a : {});
84
+ _o.label = 1;
85
+ case 1:
86
+ if (!(_i < _l.length)) return [3, 5];
87
+ _m = _l[_i], pathname = _m[0], schema = _m[1];
88
+ requestSchema = (_e = (_d = (_c = (_b = schema === null || schema === void 0 ? void 0 : schema.post) === null || _b === void 0 ? void 0 : _b.requestBody) === null || _c === void 0 ? void 0 : _c.content) === null || _d === void 0 ? void 0 : _d['application/json']) === null || _e === void 0 ? void 0 : _e.schema;
89
+ responseSchema = (_k = (_j = (_h = (_g = (_f = schema === null || schema === void 0 ? void 0 : schema.post) === null || _f === void 0 ? void 0 : _f.responses) === null || _g === void 0 ? void 0 : _g['200']) === null || _h === void 0 ? void 0 : _h.content) === null || _j === void 0 ? void 0 : _j['application/json']) === null || _k === void 0 ? void 0 : _k.schema;
90
+ if (!requestSchema && !responseSchema)
91
+ return [3, 4];
92
+ return [4, this.schemaToTypeScriptLiteral(requestSchema)];
93
+ case 2:
94
+ requestTypeLiteral = _o.sent();
95
+ return [4, this.schemaToTypeScriptLiteral(responseSchema)];
96
+ case 3:
97
+ responseTypeLiteral = _o.sent();
98
+ methodTypeMapCodeLines.push(["'".concat(pathname, "': {"), " request: ".concat(requestTypeLiteral, ";"), " response: ".concat(responseTypeLiteral, ";"), ' };'].join(''));
99
+ _o.label = 4;
100
+ case 4:
101
+ _i++;
102
+ return [3, 1];
103
+ case 5:
104
+ methodTypeMapCodeLines.unshift("export interface ".concat(METHOD_TYPE_MAP_NAME, " {"));
105
+ methodTypeMapCodeLines.push('}');
106
+ return [2, [
107
+ "import * as hash from 'object-hash';",
108
+ "import * as _ from 'lodash';",
109
+ "\n".concat(methodTypeMapCodeLines.join('\n')),
110
+ "\ntype ".concat(METHOD_TYPE_MAP_KEYS_NAME, " = keyof ").concat(METHOD_TYPE_MAP_NAME, ";"),
111
+ "\ntype ".concat(RESPONSE_CALLBACK_DATA_NAME, "<K extends ").concat(METHOD_TYPE_MAP_KEYS_NAME, "> = {"),
112
+ ' url: K;',
113
+ " result: ".concat(RESULT_TYPE_NAME, "<").concat(METHOD_TYPE_MAP_NAME, "[K]['response']>;"),
114
+ '};',
115
+ "\nexport interface ".concat(REQUEST_OPTIONS_NAME, " extends RequestInit {"),
116
+ ' headers?: Record<string, any>;',
117
+ ' ignoreCache?: boolean;',
118
+ ' prefix?: string;',
119
+ ' timeout?: number;',
120
+ ' getAuthorizationCredential?: () => string;',
121
+ " onRequest?: (context: { cached: boolean; id: string; options: Omit<".concat(REQUEST_OPTIONS_NAME, ", 'getAuthorizationCredential' | 'onRequest' | 'onResponse'>; prefix: string | undefined; requestBody: string; url: string; }) => void | Promise<void>;"),
122
+ " onResponse?: <K extends ".concat(METHOD_TYPE_MAP_KEYS_NAME, ">(response: ").concat(RESPONSE_CALLBACK_DATA_NAME, "<K>, id: string) => void | Promise<void>;"),
123
+ '}',
124
+ "\nexport interface ".concat(RESULT_TYPE_NAME, "<T> {"),
125
+ ' error: Error | null;',
126
+ " response: T | null;",
127
+ ' status: number;',
128
+ ' statusText: string;',
129
+ ' headers?: Record<string, any>;',
130
+ '}',
131
+ '\nexport class Client {',
132
+ " public constructor(private readonly options: ".concat(REQUEST_OPTIONS_NAME, " = {}) {}"),
133
+ "\n protected readonly ".concat(REQUEST_METHOD_MAP_NAME, " = new Map<keyof ").concat(METHOD_TYPE_MAP_NAME, ", (...params: any[]) => Promise<unknown>>();"),
134
+ "\n protected readonly ".concat(RESPONSE_CACHE_MAP_NAME, " = new Map<string, ").concat(RESULT_TYPE_NAME, "<unknown>>();"),
135
+ "\n public createRequest<T extends keyof ".concat(METHOD_TYPE_MAP_NAME, ">(url: T): (requestBody?: ").concat(REQUEST_BODY_TYPE_ANNOTATION, ", options?: ").concat(REQUEST_OPTIONS_NAME, ") => Promise<").concat(RESULT_TYPE_ANNOTATION, "> {"),
136
+ " if (typeof this.".concat(REQUEST_METHOD_MAP_NAME, ".get(url) !== 'function') {"),
137
+ " this.".concat(REQUEST_METHOD_MAP_NAME, ".set(url, (requestBody?: ").concat(REQUEST_BODY_TYPE_ANNOTATION, ", options?: ").concat(REQUEST_OPTIONS_NAME, ") => this.request.call(this, url, requestBody, options));"),
138
+ ' }',
139
+ " return this.".concat(REQUEST_METHOD_MAP_NAME, ".get(url) as (requestBody?: ").concat(REQUEST_BODY_TYPE_ANNOTATION, ", options?: ").concat(REQUEST_OPTIONS_NAME, ") => Promise<").concat(RESULT_TYPE_ANNOTATION, ">;"),
140
+ ' }',
141
+ "\n public async request<T extends keyof ".concat(METHOD_TYPE_MAP_NAME, ">(url: T, requestBody?: ").concat(REQUEST_BODY_TYPE_ANNOTATION, ", options?: Omit<").concat(REQUEST_OPTIONS_NAME, ", 'getAuthorizationCredential' | 'onRequest' | 'onResponse'>): Promise<").concat(RESULT_TYPE_ANNOTATION, "> {"),
142
+ ' const id = `${Math.random().toString(32).slice(2)}${Date.now().toString(16)}`;',
143
+ ' const requestHash = hash(requestBody ?? null);',
144
+ ' const requestBodyString = JSON.stringify(requestBody);',
145
+ " const finalOptions = _.merge({}, this?.options, _.omit(options, ['getAuthorizationCredential', 'onRequest', 'onResponse']));",
146
+ " const onRequestOptions = _.omit(finalOptions, ['getAuthorizationCredential', 'onRequest', 'onResponse']);",
147
+ ' const { getAuthorizationCredential, onResponse, onRequest, ignoreCache, timeout, prefix, ...requestOptions } = finalOptions;',
148
+ " if (this.".concat(RESPONSE_CACHE_MAP_NAME, ".has(requestHash) && !ignoreCache) {"),
149
+ ' onRequest?.({',
150
+ ' prefix,',
151
+ ' url,',
152
+ ' requestBody: requestBodyString,',
153
+ ' cached: true,',
154
+ ' options: onRequestOptions,',
155
+ ' id,',
156
+ ' });',
157
+ " return this.".concat(RESPONSE_CACHE_MAP_NAME, ".get(requestHash) as ").concat(RESULT_TYPE_ANNOTATION, ";"),
158
+ ' }',
159
+ ' onRequest?.({',
160
+ ' prefix,',
161
+ ' url,',
162
+ ' id,',
163
+ ' requestBody: requestBodyString,',
164
+ ' cached: false,',
165
+ ' options: onRequestOptions,',
166
+ ' });',
167
+ ' const credential = getAuthorizationCredential?.();',
168
+ ' const abortController = new AbortController();',
169
+ ' if (timeout! > 0) {',
170
+ ' setTimeout(() => {',
171
+ ' abortController.abort();',
172
+ ' }, timeout);',
173
+ ' }',
174
+ " const result: ".concat(RESULT_TYPE_ANNOTATION, " = await fetch((prefix ?? '') + url, {"),
175
+ ' ...requestOptions,',
176
+ ' body: JSON.stringify(requestBody),',
177
+ " method: 'POST',",
178
+ ' signal: abortController.signal,',
179
+ ' headers: {',
180
+ ' ...requestOptions?.headers,',
181
+ " 'Content-Type': 'application/json',",
182
+ " Authorization: (typeof credential === 'string' && credential.length > 0) ? credential : finalOptions?.headers?.Authorization,",
183
+ ' },',
184
+ ' }).then((response) => {',
185
+ ' const status = response?.status;',
186
+ ' const statusText = response?.statusText;',
187
+ ' const headers = Array.from(response?.headers?.entries?.() ?? []).reduce((result, [key, value]) => {',
188
+ " if (typeof key !== 'string' || key.length === 0) return result;",
189
+ ' result[key] = value;',
190
+ ' return result;',
191
+ ' }, {});',
192
+ ' if (!response?.ok) {',
193
+ ' return response.text().then((errorText) => ({ error: new Error(errorText), response: null, headers, status, statusText }));',
194
+ ' }',
195
+ " return response.json().then((response) => ({ error: null, response, headers, status, statusText } as ".concat(RESULT_TYPE_ANNOTATION, "));"),
196
+ " }).catch((error) => Promise.resolve({ error, response: null, headers: {}, status: 0, statusText: '' }));",
197
+ " onResponse?.({ url, result }, id);",
198
+ " this.".concat(RESPONSE_CACHE_MAP_NAME, ".set(requestHash, result);"),
199
+ ' return result;',
200
+ ' }',
201
+ '}\n',
202
+ ].join('\n')];
203
+ }
204
+ });
205
+ });
206
+ };
207
+ TypeScriptClient.prototype.schemaToTypeScriptLiteral = function (schema) {
208
+ return __awaiter(this, void 0, void 0, function () {
209
+ var interfaceName;
210
+ return __generator(this, function (_a) {
211
+ switch (_a.label) {
212
+ case 0:
213
+ interfaceName = "Interface_".concat(Math.random().toString(36).slice(2));
214
+ return [4, (0, json_schema_to_typescript_1.compile)(schema, interfaceName, {
215
+ format: true,
216
+ bannerComment: '',
217
+ additionalProperties: false,
218
+ style: {
219
+ singleQuote: true,
220
+ semi: true,
221
+ trailingComma: 'none',
222
+ },
223
+ }).then(function (code) {
224
+ return code
225
+ .trim()
226
+ .split('\n')
227
+ .map(function (line, index) { return "".concat(index === 0 ? '' : ' ').concat(line.trim()); })
228
+ .join('')
229
+ .slice("export interface ".concat(interfaceName, " ").length);
230
+ })];
231
+ case 1: return [2, _a.sent()];
232
+ }
233
+ });
234
+ });
357
235
  };
358
236
  return TypeScriptClient;
359
237
  }(client_abstract_class_1.Client));
package/dist/core.d.ts CHANGED
@@ -2,7 +2,6 @@ import 'reflect-metadata';
2
2
  import { HeaderUtil } from '@open-norantec/utilities/dist/header-util.class';
3
3
  import { z } from 'zod';
4
4
  import { Request } from './types/request.type';
5
- import { ModuleRef } from '@nestjs/core';
6
5
  export * from '@nestjs/core';
7
6
  interface LegacyMethodContext<IS extends z.Schema<any>> {
8
7
  headers: ReturnType<typeof HeaderUtil.parse>;
@@ -15,7 +14,6 @@ export type MethodHandler<IS extends z.Schema<any>, OS extends z.Schema<any>> =
15
14
  }>;
16
15
  export declare class HerbalController {
17
16
  protected registerMethod: <IS extends z.ZodType<any, z.ZodTypeDef, any>, OS extends z.ZodType<any, z.ZodTypeDef, any>>(inputSchema: IS, outputSchema: OS, callback: (context: LegacyMethodContext<IS>) => Promise<z.TypeOf<OS>>) => MethodHandler<IS, OS>;
18
- protected moduleRef: ModuleRef;
19
17
  private $handleRequest;
20
18
  private $call;
21
19
  }
package/dist/core.js CHANGED
@@ -70,7 +70,6 @@ var zod_1 = require("zod");
70
70
  var _ = require("lodash");
71
71
  var string_util_class_1 = require("@open-norantec/utilities/dist/string-util.class");
72
72
  var utilities_1 = require("@open-norantec/utilities");
73
- var core_1 = require("@nestjs/core");
74
73
  var controller_util_class_1 = require("./utilities/controller-util.class");
75
74
  __exportStar(require("@nestjs/core"), exports);
76
75
  var HerbalController = exports.HerbalController = (function () {
@@ -123,7 +122,6 @@ var HerbalController = exports.HerbalController = (function () {
123
122
  traceId: request.traceId,
124
123
  transaction: request.transaction,
125
124
  url: request.originalUrl,
126
- controller: this,
127
125
  })];
128
126
  case 1:
129
127
  result = (_e.data = _f.sent(),
@@ -166,16 +164,12 @@ var HerbalController = exports.HerbalController = (function () {
166
164
  callFn = (_b = (_a = controller_util_class_1.ControllerUtil.getPool(this)) === null || _a === void 0 ? void 0 : _a.getCallFn) === null || _b === void 0 ? void 0 : _b.call(_a, name);
167
165
  if (typeof callFn !== 'function')
168
166
  throw new common_1.NotFoundException("Method ".concat(name, " not found"));
169
- return [4, callFn(context)];
167
+ return [4, callFn(this, context)];
170
168
  case 1: return [2, _c.sent()];
171
169
  }
172
170
  });
173
171
  });
174
172
  };
175
- __decorate([
176
- (0, common_1.Inject)(core_1.ModuleRef),
177
- __metadata("design:type", core_1.ModuleRef)
178
- ], HerbalController.prototype, "moduleRef", void 0);
179
173
  __decorate([
180
174
  (0, common_1.Post)('*'),
181
175
  __param(0, (0, common_1.Req)()),
@@ -16,25 +16,24 @@ export interface MethodRegisterOptions<IS extends z.Schema<any>, OS extends z.Sc
16
16
  disableTransaction?: boolean;
17
17
  }
18
18
  export type MethodRegisterFn<C> = <IS extends z.Schema<any>, OS extends z.Schema<any>>(name: string, options: MethodRegisterOptions<IS, OS>, callback: MethodCallback<IS, OS, C>) => void;
19
- export interface MethodContext<IS extends z.Schema<any>, C> extends RequestContext {
20
- controller: C;
19
+ export interface MethodContext<IS extends z.Schema<any>> extends RequestContext {
21
20
  headers: ReturnType<typeof HeaderUtil.parse>;
22
21
  input: z.infer<IS>;
23
22
  url: string;
24
23
  }
25
- export type MethodCallContext<IS extends z.Schema<any>, C> = Omit<MethodContext<IS, C>, 'input'>;
26
- export type MethodCallback<IS extends z.Schema<any>, OS extends z.Schema<any>, C> = (context: MethodContext<IS, C>) => Promise<z.infer<OS>>;
24
+ export type MethodCallContext<IS extends z.Schema<any>> = Omit<MethodContext<IS>, 'input'>;
25
+ export type MethodCallback<IS extends z.Schema<any>, OS extends z.Schema<any>, C> = (this: C, context: MethodContext<IS>) => Promise<z.infer<OS>>;
27
26
  declare class MethodConfig<IS extends z.Schema<any>, OS extends z.Schema<any>, C> {
28
27
  readonly name: string;
29
28
  readonly options: MethodRegisterOptions<IS, OS>;
30
29
  protected readonly callback: MethodCallback<IS, OS, C>;
31
30
  constructor(name: string, options: MethodRegisterOptions<IS, OS>, callback: MethodCallback<IS, OS, C>);
32
- call(callContext: MethodCallContext<IS, C>): Promise<z.TypeOf<OS>>;
31
+ call(controller: C, callContext: MethodCallContext<IS>): Promise<z.TypeOf<OS>>;
33
32
  }
34
33
  declare class MethodPool {
35
34
  protected readonly methods: Map<string, MethodConfig<any, any, any>>;
36
35
  registerMethod<IS extends z.Schema<any>, OS extends z.Schema<any>, C>(name: string, options: MethodRegisterOptions<IS, OS>, callback: MethodCallback<IS, OS, C>): void;
37
- getCallFn(name: string): ((callContext: MethodCallContext<any, any>) => Promise<any>) | null;
36
+ getCallFn(name: string): ((controller: any, callContext: MethodCallContext<any>) => Promise<any>) | null;
38
37
  getAuthAdapters(name: string): Constructor<AuthAdapter>[] | null | undefined;
39
38
  getOpenAPIPathsObject(group?: string): PathsObject;
40
39
  }
@@ -54,7 +53,7 @@ export interface ControllerUtilCreateOptions {
54
53
  export declare class ControllerUtil {
55
54
  static getPool(targetPrototype: object): MethodPool | null;
56
55
  static create(createOptions?: ControllerUtilCreateOptions): {
57
- <C>(options: HerbalControllerOptions<C>): ClassDecorator;
56
+ <C>(options?: HerbalControllerOptions<C> | undefined): ClassDecorator;
58
57
  isHerbalController: typeof isHerbalController;
59
58
  getControllerName: typeof getControllerName;
60
59
  };
@@ -96,7 +96,7 @@ var MethodConfig = (function () {
96
96
  this.options = options;
97
97
  this.callback = callback;
98
98
  }
99
- MethodConfig.prototype.call = function (callContext) {
99
+ MethodConfig.prototype.call = function (controller, callContext) {
100
100
  var _a, _b, _c, _d, _e, _f;
101
101
  return __awaiter(this, void 0, void 0, function () {
102
102
  var inputSchema, outputSchema, parsedBody_1, input, rawResponse_1, response, error_1;
@@ -118,7 +118,7 @@ var MethodConfig = (function () {
118
118
  }
119
119
  else if (input instanceof Error)
120
120
  throw input;
121
- return [4, this.callback(__assign(__assign({}, callContext), { input: input }))];
121
+ return [4, this.callback.call(controller, __assign(__assign({}, callContext), { input: input }))];
122
122
  case 2:
123
123
  rawResponse_1 = _g.sent();
124
124
  response = _.attempt(function () { return outputSchema.parse(rawResponse_1); });
@@ -174,6 +174,8 @@ var MethodPool = (function () {
174
174
  var clientGroups = typeof config.options.clientGroups === 'function'
175
175
  ? config.options.clientGroups(defaultGroupName)
176
176
  : (_b = config === null || config === void 0 ? void 0 : config.options) === null || _b === void 0 ? void 0 : _b.clientGroups;
177
+ if (!Array.isArray(clientGroups) && !string_util_class_1.StringUtil.isFalsyString(group) && defaultGroupName !== group)
178
+ return;
177
179
  if (Array.isArray(clientGroups) && !clientGroups.includes(currentGroupName))
178
180
  return;
179
181
  result["/".concat(name)] = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-norantec/herbal",
3
- "version": "1.0.2-alpha.23",
3
+ "version": "1.0.2-alpha.25",
4
4
  "description": "Herbal is a builder and toolchain for Nest.js applications",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -42,6 +42,7 @@
42
42
  "@open-norantec/utilities": "latest",
43
43
  "commander": "^12.1.0",
44
44
  "fs-extra": "^11.3.4",
45
+ "json-schema-to-typescript": "^15.0.4",
45
46
  "lodash": "^4.17.21",
46
47
  "nest-winston": "^1.10.2",
47
48
  "nj-request-scope": "^1.0.10",