yapi-apifox-to-typescript 4.2.3 → 5.0.1

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/lib/cjs/utils.js CHANGED
@@ -1,816 +1,411 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
- exports.__esModule = true;
6
- exports.getFilteredCat = exports.getCachedPrettierOptions = void 0;
7
- exports.getNormalizedRelativePath = getNormalizedRelativePath;
8
- exports.getPrettier = getPrettier;
9
- exports.getPrettierOptions = getPrettierOptions;
10
- exports.getRequestDataJsonSchema = getRequestDataJsonSchema;
11
- exports.getResponseDataJsonSchema = getResponseDataJsonSchema;
12
- exports.httpGet = httpGet;
13
- exports.isGetLikeMethod = isGetLikeMethod;
14
- exports.isPostLikeMethod = isPostLikeMethod;
15
- exports.jsonSchemaStringToJsonSchema = jsonSchemaStringToJsonSchema;
16
- exports.jsonSchemaToJSTTJsonSchema = jsonSchemaToJSTTJsonSchema;
17
- exports.jsonSchemaToType = jsonSchemaToType;
18
- exports.jsonToJsonSchema = jsonToJsonSchema;
19
- exports.mockjsTemplateToJsonSchema = mockjsTemplateToJsonSchema;
20
- exports.processJsonSchema = processJsonSchema;
21
- exports.propDefinitionsToJsonSchema = propDefinitionsToJsonSchema;
22
- exports.reachJsonSchema = reachJsonSchema;
23
- exports.sortByWeights = sortByWeights;
24
- exports.throwError = throwError;
25
- exports.toUnixPath = toUnixPath;
26
- exports.traverseJsonSchema = traverseJsonSchema;
27
-
28
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
29
-
30
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
31
-
32
- var _createForOfIteratorHelperLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelperLoose"));
33
-
34
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
35
-
36
- var _fsExtra = _interopRequireDefault(require("fs-extra"));
37
-
38
- var _json = _interopRequireDefault(require("json5"));
39
-
40
- var _nodeFetch = _interopRequireDefault(require("node-fetch"));
41
-
42
- var _path = _interopRequireDefault(require("path"));
43
-
44
- var _prettier = _interopRequireDefault(require("prettier"));
45
-
46
- var _proxyAgent = _interopRequireDefault(require("proxy-agent"));
47
-
48
- var _toJsonSchema = _interopRequireDefault(require("to-json-schema"));
49
-
50
- var _vtils = require("vtils");
51
-
52
- var _types = require("./types");
53
-
54
- var _jsonSchemaToTypescript = require("json-schema-to-typescript");
55
-
56
- var _helpers = require("./helpers");
57
-
58
- var _url2 = require("url");
59
-
1
+ const require_runtime = require("./_virtual/_rolldown/runtime.js");
2
+ const require_types = require("./types.js");
3
+ const require_helpers = require("./helpers.js");
4
+ const require_mini_ut = require("./mini-ut.js");
5
+ let fs_extra = require("fs-extra");
6
+ fs_extra = require_runtime.__toESM(fs_extra);
7
+ let path = require("path");
8
+ path = require_runtime.__toESM(path);
9
+ let json5 = require("json5");
10
+ json5 = require_runtime.__toESM(json5);
11
+ let node_fetch = require("node-fetch");
12
+ node_fetch = require_runtime.__toESM(node_fetch);
13
+ let prettier = require("prettier");
14
+ prettier = require_runtime.__toESM(prettier);
15
+ let to_json_schema = require("to-json-schema");
16
+ to_json_schema = require_runtime.__toESM(to_json_schema);
17
+ let json_schema_to_typescript = require("json-schema-to-typescript");
18
+ let url = require("url");
19
+ //#region src/utils.ts
60
20
  /**
61
- * 抛出错误。
62
- *
63
- * @param msg 错误信息
64
- */
65
- function throwError() {
66
- for (var _len = arguments.length, msg = new Array(_len), _key = 0; _key < _len; _key++) {
67
- msg[_key] = arguments[_key];
68
- }
69
-
70
- /* istanbul ignore next */
71
- throw new Error(msg.join(''));
21
+ * 抛出错误。
22
+ *
23
+ * @param msg 错误信息
24
+ */
25
+ function throwError(...msg) {
26
+ /* istanbul ignore next */
27
+ throw new Error(msg.join(""));
72
28
  }
73
29
  /**
74
- * 将路径统一为 unix 风格的路径。
75
- *
76
- * @param path 路径
77
- * @returns unix 风格的路径
78
- */
79
-
80
-
81
- function toUnixPath(path) {
82
- return path.replace(/[/\\]+/g, '/');
30
+ * 将路径统一为 unix 风格的路径。
31
+ *
32
+ * @param path 路径
33
+ * @returns unix 风格的路径
34
+ */
35
+ function toUnixPath(path$2) {
36
+ return path$2.replace(/[/\\]+/g, "/");
83
37
  }
84
38
  /**
85
- * 获得规范化的相对路径。
86
- *
87
- * @param from 来源路径
88
- * @param to 去向路径
89
- * @returns 相对路径
90
- */
91
-
92
-
39
+ * 获得规范化的相对路径。
40
+ *
41
+ * @param from 来源路径
42
+ * @param to 去向路径
43
+ * @returns 相对路径
44
+ */
93
45
  function getNormalizedRelativePath(from, to) {
94
- return toUnixPath(_path.default.relative(_path.default.dirname(from), to)).replace(/^(?=[^.])/, './').replace(/\.(ts|js)x?$/i, '');
46
+ return toUnixPath(path.default.relative(path.default.dirname(from), to)).replace(/^(?=[^.])/, "./").replace(/\.(ts|js)x?$/i, "");
95
47
  }
96
48
  /**
97
- * 原地遍历 JSONSchema。
98
- */
99
-
100
-
101
- function traverseJsonSchema(jsonSchema, cb, currentPath) {
102
- if (currentPath === void 0) {
103
- currentPath = [];
104
- }
105
-
106
- /* istanbul ignore if */
107
- if (!(0, _vtils.isObject)(jsonSchema)) return jsonSchema; // Mock.toJSONSchema 产生的 properties 为数组,然而 JSONSchema4 的 properties 为对象
108
-
109
- if ((0, _vtils.isArray)(jsonSchema.properties)) {
110
- jsonSchema.properties = jsonSchema.properties.reduce(function (props, js) {
111
- props[js.name] = js;
112
- return props;
113
- }, {});
114
- } // 处理传入的 JSONSchema
115
-
116
-
117
- cb(jsonSchema, currentPath); // 继续处理对象的子元素
118
-
119
- if (jsonSchema.properties) {
120
- (0, _vtils.forOwn)(jsonSchema.properties, function (item, key) {
121
- return traverseJsonSchema(item, cb, [].concat(currentPath, [key]));
122
- });
123
- } // 继续处理数组的子元素
124
-
125
-
126
- if (jsonSchema.items) {
127
- (0, _vtils.castArray)(jsonSchema.items).forEach(function (item, index) {
128
- return traverseJsonSchema(item, cb, [].concat(currentPath, [index]));
129
- });
130
- } // 处理 oneOf
131
-
132
-
133
- if (jsonSchema.oneOf) {
134
- jsonSchema.oneOf.forEach(function (item) {
135
- return traverseJsonSchema(item, cb, currentPath);
136
- });
137
- } // 处理 anyOf
138
-
139
-
140
- if (jsonSchema.anyOf) {
141
- jsonSchema.anyOf.forEach(function (item) {
142
- return traverseJsonSchema(item, cb, currentPath);
143
- });
144
- } // 处理 allOf
145
-
146
-
147
- if (jsonSchema.allOf) {
148
- jsonSchema.allOf.forEach(function (item) {
149
- return traverseJsonSchema(item, cb, currentPath);
150
- });
151
- }
152
-
153
- return jsonSchema;
49
+ * 原地遍历 JSONSchema。
50
+ */
51
+ function traverseJsonSchema(jsonSchema, cb, currentPath = []) {
52
+ /* istanbul ignore if */
53
+ if (!require_mini_ut.isObject(jsonSchema)) return jsonSchema;
54
+ if (require_mini_ut.isArray(jsonSchema.properties)) jsonSchema.properties = jsonSchema.properties.reduce((props, js) => {
55
+ props[js.name] = js;
56
+ return props;
57
+ }, {});
58
+ cb(jsonSchema, currentPath);
59
+ if (jsonSchema.properties) require_mini_ut.forOwn(jsonSchema.properties, (item, key) => traverseJsonSchema(item, cb, [...currentPath, key]));
60
+ if (jsonSchema.items) require_mini_ut.castArray(jsonSchema.items).forEach((item, index) => traverseJsonSchema(item, cb, [...currentPath, index]));
61
+ if (jsonSchema.oneOf) jsonSchema.oneOf.forEach((item) => traverseJsonSchema(item, cb, currentPath));
62
+ if (jsonSchema.anyOf) jsonSchema.anyOf.forEach((item) => traverseJsonSchema(item, cb, currentPath));
63
+ if (jsonSchema.allOf) jsonSchema.allOf.forEach((item) => traverseJsonSchema(item, cb, currentPath));
64
+ return jsonSchema;
154
65
  }
155
66
  /**
156
- * 原地处理 JSONSchema。
157
- *
158
- * @param jsonSchema 待处理的 JSONSchema
159
- * @returns 处理后的 JSONSchema
160
- */
161
-
162
-
67
+ * 原地处理 JSONSchema。
68
+ *
69
+ * @param jsonSchema 待处理的 JSONSchema
70
+ * @returns 处理后的 JSONSchema
71
+ */
163
72
  function processJsonSchema(jsonSchema, customTypeMapping) {
164
- return traverseJsonSchema(jsonSchema, function (jsonSchema) {
165
- // 删除通过 swagger 导入时未剔除的 ref
166
- delete jsonSchema.$ref;
167
- delete jsonSchema.$$ref; // 数组只取第一个判断类型
168
-
169
- if (jsonSchema.type === 'array' && Array.isArray(jsonSchema.items) && jsonSchema.items.length) {
170
- jsonSchema.items = jsonSchema.items[0];
171
- } // 处理类型名称为标准的 JSONSchema 类型名称
172
-
173
-
174
- if (jsonSchema.type) {
175
- // 类型映射表,键都为小写
176
- var typeMapping = (0, _extends2.default)({
177
- byte: 'integer',
178
- short: 'integer',
179
- int: 'integer',
180
- long: 'integer',
181
- float: 'number',
182
- double: 'number',
183
- bigdecimal: 'number',
184
- char: 'string',
185
- void: 'null'
186
- }, (0, _vtils.mapKeys)(customTypeMapping, function (_, key) {
187
- return key.toLowerCase();
188
- }));
189
- var isMultiple = Array.isArray(jsonSchema.type);
190
- var types = (0, _vtils.castArray)(jsonSchema.type).map(function (type) {
191
- // 所有类型转成小写,如:String -> string
192
- type = type.toLowerCase(); // 映射为标准的 JSONSchema 类型
193
-
194
- type = typeMapping[type] || type;
195
- return type;
196
- });
197
- jsonSchema.type = isMultiple ? types : types[0];
198
- } // 移除字段名称首尾空格
199
-
200
-
201
- if (jsonSchema.properties) {
202
- (0, _vtils.forOwn)(jsonSchema.properties, function (_, prop) {
203
- var propDef = jsonSchema.properties[prop];
204
- delete jsonSchema.properties[prop];
205
- jsonSchema.properties[prop.trim()] = propDef;
206
- });
207
-
208
- if (Array.isArray(jsonSchema.required)) {
209
- jsonSchema.required = jsonSchema.required.map(function (prop) {
210
- return prop.trim();
211
- });
212
- }
213
- }
214
-
215
- return jsonSchema;
216
- });
73
+ return traverseJsonSchema(jsonSchema, (jsonSchema) => {
74
+ delete jsonSchema.$ref;
75
+ delete jsonSchema.$$ref;
76
+ if (jsonSchema.type === "array" && Array.isArray(jsonSchema.items) && jsonSchema.items.length) jsonSchema.items = jsonSchema.items[0];
77
+ if (jsonSchema.type) {
78
+ const typeMapping = {
79
+ byte: "integer",
80
+ short: "integer",
81
+ int: "integer",
82
+ long: "integer",
83
+ float: "number",
84
+ double: "number",
85
+ bigdecimal: "number",
86
+ char: "string",
87
+ void: "null",
88
+ ...require_mini_ut.mapKeys(customTypeMapping, (_, key) => key.toLowerCase())
89
+ };
90
+ const isMultiple = Array.isArray(jsonSchema.type);
91
+ const types = require_mini_ut.castArray(jsonSchema.type).map((type) => {
92
+ type = type.toLowerCase();
93
+ type = typeMapping[type] || type;
94
+ return type;
95
+ });
96
+ jsonSchema.type = isMultiple ? types : types[0];
97
+ }
98
+ if (jsonSchema.properties) {
99
+ require_mini_ut.forOwn(jsonSchema.properties, (_, prop) => {
100
+ const propDef = jsonSchema.properties[prop];
101
+ delete jsonSchema.properties[prop];
102
+ jsonSchema.properties[prop.trim()] = propDef;
103
+ });
104
+ if (Array.isArray(jsonSchema.required)) jsonSchema.required = jsonSchema.required.map((prop) => prop.trim());
105
+ }
106
+ return jsonSchema;
107
+ });
217
108
  }
218
109
  /**
219
- * 获取适用于 JSTT 的 JSONSchema。
220
- *
221
- * @param jsonSchema 待处理的 JSONSchema
222
- * @returns 适用于 JSTT 的 JSONSchema
223
- */
224
-
225
-
110
+ * 获取适用于 JSTT 的 JSONSchema。
111
+ *
112
+ * @param jsonSchema 待处理的 JSONSchema
113
+ * @returns 适用于 JSTT 的 JSONSchema
114
+ */
226
115
  function jsonSchemaToJSTTJsonSchema(jsonSchema, typeName) {
227
- if (jsonSchema) {
228
- // 去除最外层的 description 以防止 JSTT 提取它作为类型的注释
229
- delete jsonSchema.description;
230
- }
231
-
232
- return traverseJsonSchema(jsonSchema, function (jsonSchema, currentPath) {
233
- // 支持类型引用
234
- var refValue = // YApi 低版本不支持配置 title,可以在 description 里配置
235
- jsonSchema.title == null ? jsonSchema.description : jsonSchema.title;
236
-
237
- if (refValue != null && refValue.startsWith('&')) {
238
- var typeRelativePath = refValue.substring(1);
239
- var typeAbsolutePath = toUnixPath(_path.default.resolve(_path.default.dirname(("/" + currentPath.join('/')).replace(/\/{2,}/g, '/')), typeRelativePath).replace(/^[a-z]+:/i, ''));
240
- var typeAbsolutePathArr = typeAbsolutePath.split('/').filter(Boolean);
241
- var tsTypeLeft = '';
242
- var tsTypeRight = typeName;
243
-
244
- for (var _iterator = (0, _createForOfIteratorHelperLoose2.default)(typeAbsolutePathArr), _step; !(_step = _iterator()).done;) {
245
- var key = _step.value;
246
- tsTypeLeft += 'NonNullable<';
247
- tsTypeRight += "[" + JSON.stringify(key) + "]>";
248
- }
249
-
250
- var tsType = "" + tsTypeLeft + tsTypeRight;
251
- jsonSchema.tsType = tsType;
252
- } // 去除 title 和 id,防止 json-schema-to-typescript 提取它们作为接口名
253
-
254
-
255
- delete jsonSchema.title;
256
- delete jsonSchema.id; // 忽略数组长度限制
257
-
258
- delete jsonSchema.minItems;
259
- delete jsonSchema.maxItems;
260
-
261
- if (jsonSchema.type === 'object') {
262
- // 将 additionalProperties 设为 false
263
- jsonSchema.additionalProperties = false;
264
- } // 删除 default,防止 json-schema-to-typescript 根据它推测类型
265
-
266
-
267
- delete jsonSchema.default;
268
- return jsonSchema;
269
- });
116
+ if (jsonSchema) delete jsonSchema.description;
117
+ return traverseJsonSchema(jsonSchema, (jsonSchema, currentPath) => {
118
+ const refValue = jsonSchema.title == null ? jsonSchema.description : jsonSchema.title;
119
+ if (refValue?.startsWith("&")) {
120
+ const typeRelativePath = refValue.substring(1);
121
+ const typeAbsolutePathArr = toUnixPath(path.default.resolve(path.default.dirname(`/${currentPath.join("/")}`.replace(/\/{2,}/g, "/")), typeRelativePath).replace(/^[a-z]+:/i, "")).split("/").filter(Boolean);
122
+ let tsTypeLeft = "";
123
+ let tsTypeRight = typeName;
124
+ for (const key of typeAbsolutePathArr) {
125
+ tsTypeLeft += "NonNullable<";
126
+ tsTypeRight += `[${JSON.stringify(key)}]>`;
127
+ }
128
+ jsonSchema.tsType = `${tsTypeLeft}${tsTypeRight}`;
129
+ }
130
+ delete jsonSchema.title;
131
+ delete jsonSchema.id;
132
+ delete jsonSchema.minItems;
133
+ delete jsonSchema.maxItems;
134
+ if (jsonSchema.type === "object") jsonSchema.additionalProperties = false;
135
+ delete jsonSchema.default;
136
+ return jsonSchema;
137
+ });
270
138
  }
271
139
  /**
272
- * 将 JSONSchema 字符串转为 JSONSchema 对象。
273
- *
274
- * @param str 要转换的 JSONSchema 字符串
275
- * @returns 转换后的 JSONSchema 对象
276
- */
277
-
278
-
140
+ * 将 JSONSchema 字符串转为 JSONSchema 对象。
141
+ *
142
+ * @param str 要转换的 JSONSchema 字符串
143
+ * @returns 转换后的 JSONSchema 对象
144
+ */
279
145
  function jsonSchemaStringToJsonSchema(str, customTypeMapping) {
280
- return processJsonSchema(JSON.parse(str), customTypeMapping);
146
+ return processJsonSchema(JSON.parse(str), customTypeMapping);
281
147
  }
282
148
  /**
283
- * 获得 JSON 数据的 JSONSchema 对象。
284
- *
285
- * @param json JSON 数据
286
- * @returns JSONSchema 对象
287
- */
288
-
289
-
149
+ * 获得 JSON 数据的 JSONSchema 对象。
150
+ *
151
+ * @param json JSON 数据
152
+ * @returns JSONSchema 对象
153
+ */
290
154
  function jsonToJsonSchema(json, customTypeMapping) {
291
- var schema = (0, _toJsonSchema.default)(json, {
292
- required: false,
293
- arrays: {
294
- mode: 'first'
295
- },
296
- objects: {
297
- additionalProperties: false
298
- },
299
- strings: {
300
- detectFormat: false
301
- },
302
- postProcessFnc: function postProcessFnc(type, schema, value) {
303
- if (!schema.description && !!value && type !== 'object') {
304
- schema.description = JSON.stringify(value);
305
- }
306
-
307
- return schema;
308
- }
309
- });
310
- delete schema.description;
311
- return processJsonSchema(schema, customTypeMapping);
155
+ const schema = (0, to_json_schema.default)(json, {
156
+ required: false,
157
+ arrays: { mode: "first" },
158
+ objects: { additionalProperties: false },
159
+ strings: { detectFormat: false },
160
+ postProcessFnc: (type, schema, value) => {
161
+ if (!schema.description && !!value && type !== "object") schema.description = JSON.stringify(value);
162
+ return schema;
163
+ }
164
+ });
165
+ delete schema.description;
166
+ return processJsonSchema(schema, customTypeMapping);
312
167
  }
313
168
  /**
314
- * 获得 mockjs 模板的 JSONSchema 对象。
315
- *
316
- * @param template mockjs 模板
317
- * @returns JSONSchema 对象
318
- */
319
-
320
-
169
+ * 获得 mockjs 模板的 JSONSchema 对象。
170
+ *
171
+ * @param template mockjs 模板
172
+ * @returns JSONSchema 对象
173
+ */
321
174
  function mockjsTemplateToJsonSchema(template, customTypeMapping) {
322
- var actions = []; // https://github.com/nuysoft/Mock/blob/refactoring/src/mock/constant.js#L27
323
-
324
- var keyRe = /(.+)\|(?:\+(\d+)|([+-]?\d+-?[+-]?\d*)?(?:\.(\d+-?\d*))?)/; // https://github.com/nuysoft/Mock/wiki/Mock.Random
325
-
326
- var numberPatterns = ['natural', 'integer', 'float', 'range', 'increment'];
327
- var boolPatterns = ['boolean', 'bool'];
328
-
329
- var normalizeValue = function normalizeValue(value) {
330
- if (typeof value === 'string' && value.startsWith('@')) {
331
- var pattern = value.slice(1);
332
-
333
- if (numberPatterns.some(function (p) {
334
- return pattern.startsWith(p);
335
- })) {
336
- return 1;
337
- }
338
-
339
- if (boolPatterns.some(function (p) {
340
- return pattern.startsWith(p);
341
- })) {
342
- return true;
343
- }
344
- }
345
-
346
- return value;
347
- };
348
-
349
- (0, _vtils.traverse)(template, function (value, key, parent) {
350
- if (typeof key === 'string') {
351
- actions.push(function () {
352
- delete parent[key];
353
- parent[// https://github.com/nuysoft/Mock/blob/refactoring/src/mock/schema/schema.js#L16
354
- key.replace(keyRe, '$1')] = normalizeValue(value);
355
- });
356
- }
357
- });
358
- actions.forEach(function (action) {
359
- return action();
360
- });
361
- return jsonToJsonSchema(template, customTypeMapping);
175
+ const actions = [];
176
+ const keyRe = /(.+)\|(?:\+(\d+)|([+-]?\d+-?[+-]?\d*)?(?:\.(\d+-?\d*))?)/;
177
+ const numberPatterns = [
178
+ "natural",
179
+ "integer",
180
+ "float",
181
+ "range",
182
+ "increment"
183
+ ];
184
+ const boolPatterns = ["boolean", "bool"];
185
+ const normalizeValue = (value) => {
186
+ if (typeof value === "string" && value.startsWith("@")) {
187
+ const pattern = value.slice(1);
188
+ if (numberPatterns.some((p) => pattern.startsWith(p))) return 1;
189
+ if (boolPatterns.some((p) => pattern.startsWith(p))) return true;
190
+ }
191
+ return value;
192
+ };
193
+ require_mini_ut.traverse(template, (value, key, parent) => {
194
+ if (typeof key === "string") actions.push(() => {
195
+ delete parent[key];
196
+ parent[key.replace(keyRe, "$1")] = normalizeValue(value);
197
+ });
198
+ });
199
+ actions.forEach((action) => action());
200
+ return jsonToJsonSchema(template, customTypeMapping);
362
201
  }
363
202
  /**
364
- * 获得属性定义列表的 JSONSchema 对象。
365
- *
366
- * @param propDefinitions 属性定义列表
367
- * @returns JSONSchema 对象
368
- */
369
-
370
-
203
+ * 获得属性定义列表的 JSONSchema 对象。
204
+ *
205
+ * @param propDefinitions 属性定义列表
206
+ * @returns JSONSchema 对象
207
+ */
371
208
  function propDefinitionsToJsonSchema(propDefinitions, customTypeMapping) {
372
- return processJsonSchema({
373
- type: 'object',
374
- required: propDefinitions.reduce(function (res, prop) {
375
- if (prop.required) {
376
- res.push(prop.name);
377
- }
378
-
379
- return res;
380
- }, []),
381
- properties: propDefinitions.reduce(function (res, prop) {
382
- res[prop.name] = (0, _extends2.default)({
383
- type: prop.type,
384
- description: prop.comment
385
- }, prop.type === 'file' ? {
386
- tsType: _helpers.FileData.name
387
- } : {});
388
- return res;
389
- }, {})
390
- }, customTypeMapping);
209
+ return processJsonSchema({
210
+ type: "object",
211
+ required: propDefinitions.reduce((res, prop) => {
212
+ if (prop.required) res.push(prop.name);
213
+ return res;
214
+ }, []),
215
+ properties: propDefinitions.reduce((res, prop) => {
216
+ res[prop.name] = {
217
+ type: prop.type,
218
+ description: prop.comment,
219
+ ...prop.type === "file" ? { tsType: require_helpers.FileData.name } : {}
220
+ };
221
+ return res;
222
+ }, {})
223
+ }, customTypeMapping);
391
224
  }
392
-
393
225
  var JSTTOptions = {
394
- bannerComment: '',
395
- style: {
396
- bracketSpacing: false,
397
- printWidth: 120,
398
- semi: true,
399
- singleQuote: true,
400
- tabWidth: 2,
401
- trailingComma: 'none',
402
- useTabs: false
403
- }
226
+ bannerComment: "",
227
+ style: {
228
+ bracketSpacing: false,
229
+ printWidth: 120,
230
+ semi: true,
231
+ singleQuote: true,
232
+ tabWidth: 2,
233
+ trailingComma: "none",
234
+ useTabs: false
235
+ }
404
236
  };
405
237
  /**
406
- * 根据 JSONSchema 对象生产 TypeScript 类型定义。
407
- *
408
- * @param jsonSchema JSONSchema 对象
409
- * @param typeName 类型名称
410
- * @returns TypeScript 类型定义
411
- */
412
-
413
- function jsonSchemaToType(_x, _x2) {
414
- return _jsonSchemaToType.apply(this, arguments);
415
- }
416
-
417
- function _jsonSchemaToType() {
418
- _jsonSchemaToType = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(jsonSchema, typeName) {
419
- var fakeTypeName, code;
420
- return _regenerator.default.wrap(function _callee$(_context) {
421
- while (1) {
422
- switch (_context.prev = _context.next) {
423
- case 0:
424
- if (!(0, _vtils.isEmpty)(jsonSchema)) {
425
- _context.next = 2;
426
- break;
427
- }
428
-
429
- return _context.abrupt("return", "export interface " + typeName + " {}");
430
-
431
- case 2:
432
- if (!jsonSchema.__is_any__) {
433
- _context.next = 5;
434
- break;
435
- }
436
-
437
- delete jsonSchema.__is_any__;
438
- return _context.abrupt("return", "export type " + typeName + " = any");
439
-
440
- case 5:
441
- // JSTT 会转换 typeName,因此传入一个全大写的假 typeName,生成代码后再替换回真正的 typeName
442
- fakeTypeName = 'THISISAFAKETYPENAME';
443
- _context.next = 8;
444
- return (0, _jsonSchemaToTypescript.compile)(jsonSchemaToJSTTJsonSchema((0, _vtils.cloneDeepFast)(jsonSchema), typeName), fakeTypeName, JSTTOptions);
445
-
446
- case 8:
447
- code = _context.sent;
448
- return _context.abrupt("return", code.replace(fakeTypeName, typeName).trim());
449
-
450
- case 10:
451
- case "end":
452
- return _context.stop();
453
- }
454
- }
455
- }, _callee);
456
- }));
457
- return _jsonSchemaToType.apply(this, arguments);
238
+ * 根据 JSONSchema 对象生产 TypeScript 类型定义。
239
+ *
240
+ * @param jsonSchema JSONSchema 对象
241
+ * @param typeName 类型名称
242
+ * @returns TypeScript 类型定义
243
+ */
244
+ async function jsonSchemaToType(jsonSchema, typeName) {
245
+ if (require_mini_ut.isEmpty(jsonSchema)) return `export interface ${typeName} {}`;
246
+ if (jsonSchema.__is_any__) {
247
+ delete jsonSchema.__is_any__;
248
+ return `export type ${typeName} = any`;
249
+ }
250
+ const fakeTypeName = "THISISAFAKETYPENAME";
251
+ return (await (0, json_schema_to_typescript.compile)(jsonSchemaToJSTTJsonSchema(require_mini_ut.cloneDeepFast(jsonSchema), typeName), fakeTypeName, JSTTOptions)).replace(fakeTypeName, typeName).trim();
458
252
  }
459
-
460
253
  function getRequestDataJsonSchema(interfaceInfo, customTypeMapping) {
461
- var jsonSchema; // 处理表单数据(仅 POST 类接口)
462
-
463
- if (isPostLikeMethod(interfaceInfo.method)) {
464
- switch (interfaceInfo.req_body_type) {
465
- case _types.RequestBodyType.form:
466
- jsonSchema = propDefinitionsToJsonSchema(interfaceInfo.req_body_form.map(function (item) {
467
- return {
468
- name: item.name,
469
- required: item.required === _types.Required.true,
470
- type: item.type === _types.RequestFormItemType.file ? 'file' : 'string',
471
- comment: item.desc
472
- };
473
- }), customTypeMapping);
474
- break;
475
-
476
- case _types.RequestBodyType.json:
477
- if (interfaceInfo.req_body_other) {
478
- jsonSchema = interfaceInfo.req_body_is_json_schema ? jsonSchemaStringToJsonSchema(interfaceInfo.req_body_other, customTypeMapping) : jsonToJsonSchema(_json.default.parse(interfaceInfo.req_body_other), customTypeMapping);
479
- }
480
-
481
- break;
482
-
483
- default:
484
- /* istanbul ignore next */
485
- break;
486
- }
487
- } // 处理查询数据
488
-
489
-
490
- if ((0, _vtils.isArray)(interfaceInfo.req_query) && interfaceInfo.req_query.length) {
491
- var queryJsonSchema = propDefinitionsToJsonSchema(interfaceInfo.req_query.map(function (item) {
492
- return {
493
- name: item.name,
494
- required: item.required === _types.Required.true,
495
- type: item.type || 'string',
496
- comment: item.desc
497
- };
498
- }), customTypeMapping);
499
- /* istanbul ignore else */
500
-
501
- if (jsonSchema) {
502
- jsonSchema.properties = (0, _extends2.default)({}, jsonSchema.properties, queryJsonSchema.properties);
503
- jsonSchema.required = [].concat(Array.isArray(jsonSchema.required) ? jsonSchema.required : [], Array.isArray(queryJsonSchema.required) ? queryJsonSchema.required : []);
504
- } else {
505
- jsonSchema = queryJsonSchema;
506
- }
507
- } // 处理路径参数
508
-
509
-
510
- if ((0, _vtils.isArray)(interfaceInfo.req_params) && interfaceInfo.req_params.length) {
511
- var paramsJsonSchema = propDefinitionsToJsonSchema(interfaceInfo.req_params.map(function (item) {
512
- return {
513
- name: item.name,
514
- required: true,
515
- type: item.type || 'string',
516
- comment: item.desc
517
- };
518
- }), customTypeMapping);
519
- /* istanbul ignore else */
520
-
521
- if (jsonSchema) {
522
- jsonSchema.properties = (0, _extends2.default)({}, jsonSchema.properties, paramsJsonSchema.properties);
523
- jsonSchema.required = [].concat(Array.isArray(jsonSchema.required) ? jsonSchema.required : [], Array.isArray(paramsJsonSchema.required) ? paramsJsonSchema.required : []);
524
- } else {
525
- jsonSchema = paramsJsonSchema;
526
- }
527
- }
528
-
529
- return jsonSchema || {};
254
+ let jsonSchema;
255
+ if (isPostLikeMethod(interfaceInfo.method)) switch (interfaceInfo.req_body_type) {
256
+ case require_types.RequestBodyType.form:
257
+ jsonSchema = propDefinitionsToJsonSchema(interfaceInfo.req_body_form.map((item) => ({
258
+ name: item.name,
259
+ required: item.required === require_types.Required.true,
260
+ type: item.type === require_types.RequestFormItemType.file ? "file" : "string",
261
+ comment: item.desc
262
+ })), customTypeMapping);
263
+ break;
264
+ case require_types.RequestBodyType.json: if (interfaceInfo.req_body_other) jsonSchema = interfaceInfo.req_body_is_json_schema ? jsonSchemaStringToJsonSchema(interfaceInfo.req_body_other, customTypeMapping) : jsonToJsonSchema(json5.default.parse(interfaceInfo.req_body_other), customTypeMapping);
265
+ }
266
+ if (require_mini_ut.isArray(interfaceInfo.req_query) && interfaceInfo.req_query.length) {
267
+ const queryJsonSchema = propDefinitionsToJsonSchema(interfaceInfo.req_query.map((item) => ({
268
+ name: item.name,
269
+ required: item.required === require_types.Required.true,
270
+ type: item.type || "string",
271
+ comment: item.desc
272
+ })), customTypeMapping);
273
+ /* istanbul ignore else */
274
+ if (jsonSchema) {
275
+ jsonSchema.properties = {
276
+ ...jsonSchema.properties,
277
+ ...queryJsonSchema.properties
278
+ };
279
+ jsonSchema.required = [...Array.isArray(jsonSchema.required) ? jsonSchema.required : [], ...Array.isArray(queryJsonSchema.required) ? queryJsonSchema.required : []];
280
+ } else jsonSchema = queryJsonSchema;
281
+ }
282
+ if (require_mini_ut.isArray(interfaceInfo.req_params) && interfaceInfo.req_params.length) {
283
+ const paramsJsonSchema = propDefinitionsToJsonSchema(interfaceInfo.req_params.map((item) => ({
284
+ name: item.name,
285
+ required: true,
286
+ type: item.type || "string",
287
+ comment: item.desc
288
+ })), customTypeMapping);
289
+ /* istanbul ignore else */
290
+ if (jsonSchema) {
291
+ jsonSchema.properties = {
292
+ ...jsonSchema.properties,
293
+ ...paramsJsonSchema.properties
294
+ };
295
+ jsonSchema.required = [...Array.isArray(jsonSchema.required) ? jsonSchema.required : [], ...Array.isArray(paramsJsonSchema.required) ? paramsJsonSchema.required : []];
296
+ } else jsonSchema = paramsJsonSchema;
297
+ }
298
+ return jsonSchema || {};
530
299
  }
531
-
532
300
  function getResponseDataJsonSchema(interfaceInfo, customTypeMapping, dataKey) {
533
- var jsonSchema = {};
534
-
535
- switch (interfaceInfo.res_body_type) {
536
- case _types.ResponseBodyType.json:
537
- if (interfaceInfo.res_body) {
538
- jsonSchema = interfaceInfo.res_body_is_json_schema ? jsonSchemaStringToJsonSchema(interfaceInfo.res_body, customTypeMapping) : mockjsTemplateToJsonSchema(_json.default.parse(interfaceInfo.res_body), customTypeMapping);
539
- }
540
-
541
- break;
542
-
543
- default:
544
- jsonSchema = {
545
- __is_any__: true
546
- };
547
- break;
548
- }
549
-
550
- if (dataKey && jsonSchema) {
551
- jsonSchema = reachJsonSchema(jsonSchema, dataKey);
552
- }
553
-
554
- return jsonSchema;
301
+ let jsonSchema = {};
302
+ switch (interfaceInfo.res_body_type) {
303
+ case require_types.ResponseBodyType.json:
304
+ if (interfaceInfo.res_body) jsonSchema = interfaceInfo.res_body_is_json_schema ? jsonSchemaStringToJsonSchema(interfaceInfo.res_body, customTypeMapping) : mockjsTemplateToJsonSchema(json5.default.parse(interfaceInfo.res_body), customTypeMapping);
305
+ break;
306
+ default: jsonSchema = { __is_any__: true };
307
+ }
308
+ if (dataKey && jsonSchema) jsonSchema = reachJsonSchema(jsonSchema, dataKey);
309
+ return jsonSchema;
555
310
  }
556
-
557
- function reachJsonSchema(jsonSchema, path) {
558
- var last = jsonSchema;
559
-
560
- for (var _iterator2 = (0, _createForOfIteratorHelperLoose2.default)((0, _vtils.castArray)(path)), _step2; !(_step2 = _iterator2()).done;) {
561
- var _last$properties;
562
-
563
- var segment = _step2.value;
564
-
565
- var _last = (_last$properties = last.properties) == null ? void 0 : _last$properties[segment];
566
-
567
- if (!_last) {
568
- return jsonSchema;
569
- }
570
-
571
- last = _last;
572
- }
573
-
574
- return last;
311
+ function reachJsonSchema(jsonSchema, path$3) {
312
+ let last = jsonSchema;
313
+ for (const segment of require_mini_ut.castArray(path$3)) {
314
+ const _last = last.properties?.[segment];
315
+ if (!_last) return jsonSchema;
316
+ last = _last;
317
+ }
318
+ return last;
575
319
  }
576
-
577
320
  function sortByWeights(list) {
578
- list.sort(function (a, b) {
579
- var _x$weights;
580
-
581
- var x = a.weights.length > b.weights.length ? b : a;
582
- var minLen = Math.min(a.weights.length, b.weights.length);
583
- var maxLen = Math.max(a.weights.length, b.weights.length);
584
-
585
- (_x$weights = x.weights).push.apply(_x$weights, new Array(maxLen - minLen).fill(0));
586
-
587
- var w = a.weights.reduce(function (w, _, i) {
588
- if (w === 0) {
589
- w = a.weights[i] - b.weights[i];
590
- }
591
-
592
- return w;
593
- }, 0);
594
- return w;
595
- });
596
- return list;
321
+ list.sort((a, b) => {
322
+ const x = a.weights.length > b.weights.length ? b : a;
323
+ const minLen = Math.min(a.weights.length, b.weights.length);
324
+ const maxLen = Math.max(a.weights.length, b.weights.length);
325
+ x.weights.push(...new Array(maxLen - minLen).fill(0));
326
+ return a.weights.reduce((w, _, i) => {
327
+ if (w === 0) w = a.weights[i] - b.weights[i];
328
+ return w;
329
+ }, 0);
330
+ });
331
+ return list;
597
332
  }
598
-
599
333
  function isGetLikeMethod(method) {
600
- return method === _types.Method.GET || method === _types.Method.OPTIONS || method === _types.Method.HEAD;
334
+ return method === require_types.Method.GET || method === require_types.Method.OPTIONS || method === require_types.Method.HEAD;
601
335
  }
602
-
603
336
  function isPostLikeMethod(method) {
604
- return !isGetLikeMethod(method);
605
- }
606
-
607
- function getPrettier(_x3) {
608
- return _getPrettier.apply(this, arguments);
609
- }
610
-
611
- function _getPrettier() {
612
- _getPrettier = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(cwd) {
613
- var projectPrettierPath;
614
- return _regenerator.default.wrap(function _callee2$(_context2) {
615
- while (1) {
616
- switch (_context2.prev = _context2.next) {
617
- case 0:
618
- projectPrettierPath = _path.default.join(cwd, 'node_modules/prettier');
619
- _context2.next = 3;
620
- return _fsExtra.default.pathExists(projectPrettierPath);
621
-
622
- case 3:
623
- if (!_context2.sent) {
624
- _context2.next = 5;
625
- break;
626
- }
627
-
628
- return _context2.abrupt("return", require(projectPrettierPath));
629
-
630
- case 5:
631
- return _context2.abrupt("return", require('prettier'));
632
-
633
- case 6:
634
- case "end":
635
- return _context2.stop();
636
- }
637
- }
638
- }, _callee2);
639
- }));
640
- return _getPrettier.apply(this, arguments);
337
+ return !isGetLikeMethod(method);
641
338
  }
642
-
643
- function getPrettierOptions() {
644
- return _getPrettierOptions.apply(this, arguments);
339
+ async function getPrettier(cwd) {
340
+ const projectPrettierPath = path.default.join(cwd, "node_modules/prettier");
341
+ if (await fs_extra.default.pathExists(projectPrettierPath)) return require(projectPrettierPath);
342
+ return require("prettier");
645
343
  }
646
-
647
- function _getPrettierOptions() {
648
- _getPrettierOptions = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
649
- var prettierOptions, _yield$run, prettierConfigPathErr, prettierConfigPath, _yield$run2, prettierConfigErr, prettierConfig;
650
-
651
- return _regenerator.default.wrap(function _callee3$(_context3) {
652
- while (1) {
653
- switch (_context3.prev = _context3.next) {
654
- case 0:
655
- prettierOptions = {
656
- parser: 'typescript',
657
- printWidth: 120,
658
- tabWidth: 2,
659
- singleQuote: true,
660
- semi: false,
661
- trailingComma: 'all',
662
- bracketSpacing: false,
663
- endOfLine: 'lf'
664
- }; // 测试时跳过本地配置的解析
665
-
666
- if (!process.env.JEST_WORKER_ID) {
667
- _context3.next = 3;
668
- break;
669
- }
670
-
671
- return _context3.abrupt("return", prettierOptions);
672
-
673
- case 3:
674
- _context3.next = 5;
675
- return (0, _vtils.run)(function () {
676
- return _prettier.default.resolveConfigFile();
677
- });
678
-
679
- case 5:
680
- _yield$run = _context3.sent;
681
- prettierConfigPathErr = _yield$run[0];
682
- prettierConfigPath = _yield$run[1];
683
-
684
- if (!(prettierConfigPathErr || !prettierConfigPath)) {
685
- _context3.next = 10;
686
- break;
687
- }
688
-
689
- return _context3.abrupt("return", prettierOptions);
690
-
691
- case 10:
692
- _context3.next = 12;
693
- return (0, _vtils.run)(function () {
694
- return _prettier.default.resolveConfig(prettierConfigPath);
695
- });
696
-
697
- case 12:
698
- _yield$run2 = _context3.sent;
699
- prettierConfigErr = _yield$run2[0];
700
- prettierConfig = _yield$run2[1];
701
-
702
- if (!(prettierConfigErr || !prettierConfig)) {
703
- _context3.next = 17;
704
- break;
705
- }
706
-
707
- return _context3.abrupt("return", prettierOptions);
708
-
709
- case 17:
710
- return _context3.abrupt("return", (0, _extends2.default)({}, prettierOptions, prettierConfig, {
711
- parser: 'typescript'
712
- }));
713
-
714
- case 18:
715
- case "end":
716
- return _context3.stop();
717
- }
718
- }
719
- }, _callee3);
720
- }));
721
- return _getPrettierOptions.apply(this, arguments);
344
+ async function getPrettierOptions() {
345
+ const prettierOptions = {
346
+ parser: "typescript",
347
+ printWidth: 120,
348
+ tabWidth: 2,
349
+ singleQuote: true,
350
+ semi: false,
351
+ trailingComma: "all",
352
+ bracketSpacing: false,
353
+ endOfLine: "lf"
354
+ };
355
+ if (process.env.JEST_WORKER_ID) return prettierOptions;
356
+ const [prettierConfigPathErr, prettierConfigPath] = await require_mini_ut.run(() => prettier.default.resolveConfigFile());
357
+ if (prettierConfigPathErr || !prettierConfigPath) return prettierOptions;
358
+ const [prettierConfigErr, prettierConfig] = await require_mini_ut.run(() => prettier.default.resolveConfig(prettierConfigPath));
359
+ if (prettierConfigErr || !prettierConfig) return prettierOptions;
360
+ return {
361
+ ...prettierOptions,
362
+ ...prettierConfig,
363
+ parser: "typescript"
364
+ };
722
365
  }
723
-
724
- var getCachedPrettierOptions = (0, _vtils.memoize)(getPrettierOptions);
725
- exports.getCachedPrettierOptions = getCachedPrettierOptions;
726
-
727
- function httpGet(_x4, _x5) {
728
- return _httpGet.apply(this, arguments);
366
+ var getCachedPrettierOptions = require_mini_ut.memoize(getPrettierOptions);
367
+ async function httpGet(url$1, query) {
368
+ const _url = new url.URL(url$1);
369
+ if (query) Object.keys(query).forEach((key) => {
370
+ _url.searchParams.set(key, query[key]);
371
+ });
372
+ url$1 = _url.toString();
373
+ return await (await (0, node_fetch.default)(url$1, { method: "GET" })).json();
729
374
  }
730
375
  /**
731
- * 获取过滤后的菜单
732
- */
733
-
734
-
735
- function _httpGet() {
736
- _httpGet = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(url, query) {
737
- var _url, res;
738
-
739
- return _regenerator.default.wrap(function _callee4$(_context4) {
740
- while (1) {
741
- switch (_context4.prev = _context4.next) {
742
- case 0:
743
- _url = new _url2.URL(url);
744
-
745
- if (query) {
746
- Object.keys(query).forEach(function (key) {
747
- _url.searchParams.set(key, query[key]);
748
- });
749
- }
750
-
751
- url = _url.toString();
752
- _context4.next = 5;
753
- return (0, _nodeFetch.default)(url, {
754
- method: 'GET',
755
- agent: new _proxyAgent.default()
756
- });
757
-
758
- case 5:
759
- res = _context4.sent;
760
- return _context4.abrupt("return", res.json());
761
-
762
- case 7:
763
- case "end":
764
- return _context4.stop();
765
- }
766
- }
767
- }, _callee4);
768
- }));
769
- return _httpGet.apply(this, arguments);
770
- }
771
-
772
- var getFilteredCat = function getFilteredCat(cat, cats, isApifox) {
773
- if (isApifox === void 0) {
774
- isApifox = false;
775
- }
776
-
777
- // 分类处理
778
- // 数组化
779
- var categoryIds = (0, _vtils.castArray)(cat.id); // 全部分类
780
-
781
- if (categoryIds.includes(0)) {
782
- var _categoryIds;
783
-
784
- (_categoryIds = categoryIds).push.apply(_categoryIds, cats.map(function (c) {
785
- return c._id;
786
- }));
787
- } // 唯一化
788
-
789
-
790
- categoryIds = (0, _vtils.uniq)(categoryIds); // 去掉被排除的分类
791
-
792
- var excludedCategoryIds = categoryIds.filter(function (id) {
793
- return id < 0;
794
- }).map(Math.abs);
795
- categoryIds = categoryIds.filter(function (id) {
796
- return !excludedCategoryIds.includes(Math.abs(id));
797
- }); // 删除不存在的分类
798
-
799
- if (!isApifox) {
800
- categoryIds = categoryIds.filter(function (id) {
801
- return !!cats.find(function (c) {
802
- return c._id === id;
803
- });
804
- });
805
- } else {
806
- categoryIds = categoryIds.filter(function (id) {
807
- return id !== 0;
808
- });
809
- } // 顺序化
810
-
811
-
812
- categoryIds = categoryIds.sort();
813
- return categoryIds;
376
+ * 获取过滤后的菜单
377
+ */
378
+ var getFilteredCat = (cat, cats, isApifox = false) => {
379
+ let categoryIds = require_mini_ut.castArray(cat.id);
380
+ if (categoryIds.includes(0)) categoryIds.push(...cats.map((c) => c._id));
381
+ categoryIds = require_mini_ut.uniq(categoryIds);
382
+ const excludedCategoryIds = categoryIds.filter((id) => id < 0).map(Math.abs);
383
+ categoryIds = categoryIds.filter((id) => !excludedCategoryIds.includes(Math.abs(id)));
384
+ if (!isApifox) categoryIds = categoryIds.filter((id) => !!cats.find((c) => c._id === id));
385
+ else categoryIds = categoryIds.filter((id) => id !== 0);
386
+ categoryIds = categoryIds.sort();
387
+ return categoryIds;
814
388
  };
815
-
816
- exports.getFilteredCat = getFilteredCat;
389
+ //#endregion
390
+ exports.getCachedPrettierOptions = getCachedPrettierOptions;
391
+ exports.getFilteredCat = getFilteredCat;
392
+ exports.getNormalizedRelativePath = getNormalizedRelativePath;
393
+ exports.getPrettier = getPrettier;
394
+ exports.getPrettierOptions = getPrettierOptions;
395
+ exports.getRequestDataJsonSchema = getRequestDataJsonSchema;
396
+ exports.getResponseDataJsonSchema = getResponseDataJsonSchema;
397
+ exports.httpGet = httpGet;
398
+ exports.isGetLikeMethod = isGetLikeMethod;
399
+ exports.isPostLikeMethod = isPostLikeMethod;
400
+ exports.jsonSchemaStringToJsonSchema = jsonSchemaStringToJsonSchema;
401
+ exports.jsonSchemaToJSTTJsonSchema = jsonSchemaToJSTTJsonSchema;
402
+ exports.jsonSchemaToType = jsonSchemaToType;
403
+ exports.jsonToJsonSchema = jsonToJsonSchema;
404
+ exports.mockjsTemplateToJsonSchema = mockjsTemplateToJsonSchema;
405
+ exports.processJsonSchema = processJsonSchema;
406
+ exports.propDefinitionsToJsonSchema = propDefinitionsToJsonSchema;
407
+ exports.reachJsonSchema = reachJsonSchema;
408
+ exports.sortByWeights = sortByWeights;
409
+ exports.throwError = throwError;
410
+ exports.toUnixPath = toUnixPath;
411
+ exports.traverseJsonSchema = traverseJsonSchema;