echoapi-converter 0.0.54 → 0.0.56

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/index.d.ts CHANGED
@@ -13,11 +13,11 @@ declare class ApipostToSwagger {
13
13
  private array2NamePathObj;
14
14
  private array2TreeExport;
15
15
  private handleApis;
16
- apiToswagger(apipostObj: ApipostObj, version: "2.0" | "3.0", language?: 'en' | 'zh-cn' | 'ja' | 'zh-hant' | 'id'): {
16
+ apiToswagger(apipostObj: ApipostObj, version: "2.0" | "3.0", language?: 'en' | 'zh-cn' | 'ja' | 'zh-hant' | 'id'): Promise<{
17
17
  status: "error" | "success";
18
18
  message: string;
19
19
  data: any;
20
- };
20
+ }>;
21
21
  }
22
22
 
23
23
  declare class SwaggerToApipost {
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var lodash = require('lodash');
6
+ var i18next = require('i18next');
6
7
  var apipostTools = require('apipost-tools');
7
8
  var urlParse = require('url-parse');
8
9
  var MockSchema = require('apipost-mock-schema');
@@ -11,11 +12,42 @@ var SwaggerClient = require('swagger-client');
11
12
 
12
13
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
14
 
15
+ var i18next__default = /*#__PURE__*/_interopDefaultLegacy(i18next);
14
16
  var urlParse__default = /*#__PURE__*/_interopDefaultLegacy(urlParse);
15
17
  var MockSchema__default = /*#__PURE__*/_interopDefaultLegacy(MockSchema);
16
18
  var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
17
19
  var SwaggerClient__default = /*#__PURE__*/_interopDefaultLegacy(SwaggerClient);
18
20
 
21
+ /******************************************************************************
22
+ Copyright (c) Microsoft Corporation.
23
+
24
+ Permission to use, copy, modify, and/or distribute this software for any
25
+ purpose with or without fee is hereby granted.
26
+
27
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
28
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
29
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
30
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
31
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
32
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
33
+ PERFORMANCE OF THIS SOFTWARE.
34
+ ***************************************************************************** */
35
+
36
+ function __awaiter(thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ }
45
+
46
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
47
+ var e = new Error(message);
48
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
49
+ };
50
+
19
51
  const DEFAULT_FIELD_TYPE$2 = [
20
52
  "array",
21
53
  "boolean",
@@ -282,60 +314,60 @@ const RULE_TYPES_ICON = {
282
314
  9: '(\\r\\n)',
283
315
  };
284
316
 
285
- var securityConnectionMessage$4 = "When connecting via a secure connection";
286
- var enableServerCertificateValidation$4 = "do not enable server certificate validation";
287
- var pleaseEnableServerCertificateValidation$4 = "please enable server certificate validation";
288
- var useClientVersion$4 = "and use client version";
289
- var specifyHandshakePath$4 = "with no specified handshake path";
290
- var performConnection$4 = "Perform the connection";
291
- var allowUnlimitedSendContent$4 = "And allow unlimited content to be sent";
292
- var allowMaxSendContentSize$4 = "And allow the maximum content size to be sent as";
293
- var leftPaddingLength$4 = "Left pad to a length of";
294
- var rightPaddingLength$4 = "Right pad to a length of";
295
- var paddingCharacter$4 = "padding character";
296
- var addEndingDelimiter$4 = "Add an ending delimiter";
297
- var requestEncodingFormat$4 = "The encoding format of the request message is";
298
- var addNewline$4 = "Add a newline character at the end of each request message";
299
- var addContentLength$4 = "Calculate the content length (excluding the header) and add it to the header (text format, header byte length is";
300
- var removeResponseHeader$4 = "The response message needs to remove the packet header (length of";
317
+ var securityConnectionMessageNoPath$4 = "When connecting via a secure connection, {{enable}} server certificate validation, and use client version {{version}} with no specified handshake path.";
318
+ var notNeedEnable$4 = "do not enable";
319
+ var needEnable$4 = "please enable";
320
+ var securityConnectionMessage$4 = "When connecting via a secure connection, {{enable}} server certificate validation, and use client version {{version}} with the specified handshake path {{path}}.";
321
+ var wsConfigMessage$4 = "When connecting via a secure connection, {{enable}} server certificate validation, and the maximum allowed message size for reception is {{content}}.";
322
+ var unlimited$4 = "unlimited";
323
+ var left$4 = "Left";
324
+ var right$4 = "Right";
325
+ var tcpMethodMessage$4 = "{{direction}} pad to a length of {{size}}, padding character: {{str}}";
326
+ var tcpMethodDelimiterMessage$4 = "Append the separator character {{str}} at the end.";
327
+ var requestEncodingFormat$4 = "The encoding format for the request message is {{format}}.";
328
+ var needAddRequestDataHandleFunction$4 = "Request data processing function needs to be added:";
329
+ var needAddResponseDataHandleFunction$4 = "Response data processing function needs to be added:";
330
+ var addNewline$4 = "Add a newline character {{str}} at the end of each request message";
331
+ var addContentLength$4 = "calculate the content length (excluding the packet header), and append it to the packet header (text format, packet header byte length is {{size}}).";
332
+ var removeResponseHeader$4 = "The response message needs to remove the packet header (length of {{size}} bytes)";
333
+ var trimTrailingNewline$4 = "strip the newline character {{str}} at the end of the line";
334
+ var convertXmlToJson$4 = "and convert the XML content to JSON format.";
335
+ var specialCharText$4 = "For text-type messages, the packet tail contains special character {{str}}";
336
+ var specialCharBinary$4 = "For binary-type messages, the packet tail contains special character {{str}}";
337
+ var headerBodyFormat$4 = "[Header+Body] formatted message (header contains the byte length of the body), with a header length of {{size}} bytes";
338
+ var fixedLength$4 = "The message has a fixed length of {{size}} bytes";
301
339
  var byte$4 = "bytes";
302
- var trimTrailingNewline$4 = "trim trailing newline characters";
303
- var convertXmlToJson$4 = "and convert the XML content to JSON format";
304
340
  var completeOnReceive$4 = "Completion is assumed upon data reception (subpacket handling is not addressed)";
305
- var specialCharText$4 = "For text-type messages, the packet tail contains special character";
306
- var specialCharBinary$4 = "For binary-type messages, the packet tail contains special character";
307
- var headerBodyFormat$4 = "[Header+Body] formatted message (header contains the byte length of the body)";
308
- var fixedLength$4 = "The message has a fixed length of";
309
341
  var serverAddress$4 = "Server address";
310
342
  var pktCompletion$4 = "Method to determine message reception completio";
311
343
  var createDir$4 = "Create directory";
312
344
  var createProj$4 = "Create project";
313
345
  var createEnv$4 = "Create environment";
314
346
  var en = {
347
+ securityConnectionMessageNoPath: securityConnectionMessageNoPath$4,
348
+ notNeedEnable: notNeedEnable$4,
349
+ needEnable: needEnable$4,
315
350
  securityConnectionMessage: securityConnectionMessage$4,
316
- enableServerCertificateValidation: enableServerCertificateValidation$4,
317
- pleaseEnableServerCertificateValidation: pleaseEnableServerCertificateValidation$4,
318
- useClientVersion: useClientVersion$4,
319
- specifyHandshakePath: specifyHandshakePath$4,
320
- performConnection: performConnection$4,
321
- allowUnlimitedSendContent: allowUnlimitedSendContent$4,
322
- allowMaxSendContentSize: allowMaxSendContentSize$4,
323
- leftPaddingLength: leftPaddingLength$4,
324
- rightPaddingLength: rightPaddingLength$4,
325
- paddingCharacter: paddingCharacter$4,
326
- addEndingDelimiter: addEndingDelimiter$4,
351
+ wsConfigMessage: wsConfigMessage$4,
352
+ unlimited: unlimited$4,
353
+ left: left$4,
354
+ right: right$4,
355
+ tcpMethodMessage: tcpMethodMessage$4,
356
+ tcpMethodDelimiterMessage: tcpMethodDelimiterMessage$4,
327
357
  requestEncodingFormat: requestEncodingFormat$4,
358
+ needAddRequestDataHandleFunction: needAddRequestDataHandleFunction$4,
359
+ needAddResponseDataHandleFunction: needAddResponseDataHandleFunction$4,
328
360
  addNewline: addNewline$4,
329
361
  addContentLength: addContentLength$4,
330
362
  removeResponseHeader: removeResponseHeader$4,
331
- byte: byte$4,
332
363
  trimTrailingNewline: trimTrailingNewline$4,
333
364
  convertXmlToJson: convertXmlToJson$4,
334
- completeOnReceive: completeOnReceive$4,
335
365
  specialCharText: specialCharText$4,
336
366
  specialCharBinary: specialCharBinary$4,
337
367
  headerBodyFormat: headerBodyFormat$4,
338
368
  fixedLength: fixedLength$4,
369
+ byte: byte$4,
370
+ completeOnReceive: completeOnReceive$4,
339
371
  serverAddress: serverAddress$4,
340
372
  pktCompletion: pktCompletion$4,
341
373
  createDir: createDir$4,
@@ -343,60 +375,60 @@ var en = {
343
375
  createEnv: createEnv$4
344
376
  };
345
377
 
346
- var securityConnectionMessage$3 = "Saat melakukan koneksi yang aman";
347
- var enableServerCertificateValidation$3 = "Tidak perlu mengaktifkan validasi sertifikat server";
348
- var pleaseEnableServerCertificateValidation$3 = "Silakan aktifkan validasi sertifikat server";
349
- var useClientVersion$3 = "Dan gunakan versi klien";
350
- var specifyHandshakePath$3 = "Dan tentukan path handshake";
351
- var performConnection$3 = "Lakukan koneksi";
352
- var allowUnlimitedSendContent$3 = "Dan izinkan isi yang dikirim tanpa batas";
353
- var allowMaxSendContentSize$3 = "Dan izinkan ukuran isi maksimum yang dikirim sebagai";
354
- var leftPaddingLength$3 = "Panjang padding di sebelah kiri";
355
- var rightPaddingLength$3 = "Panjang padding di sebelah kanan";
356
- var paddingCharacter$3 = "Karakter padding";
357
- var addEndingDelimiter$3 = "Tambahkan delimiter penutup";
358
- var requestEncodingFormat$3 = "Format enkripsi pesan permintaan adalah";
359
- var addNewline$3 = "Tambahkan karakter baris baru di akhir setiap pesan permintaan";
360
- var addContentLength$3 = "Hitung panjang isi (tidak termasuk header) dan tambahkan ke header (format teks, panjang byte header adalah";
361
- var removeResponseHeader$3 = "Hapus header respons (panjangnya adalah";
378
+ var securityConnectionMessageNoPath$3 = "Saat terhubung melalui koneksi yang aman, harap {{enable}} verifikasi sertifikat server dan gunakan versi klien {{version}} tanpa jalur handshake yang ditentukan.";
379
+ var notNeedEnable$3 = "tidak aktifkan";
380
+ var needEnable$3 = "aktifkan";
381
+ var securityConnectionMessage$3 = "Saat terhubung melalui koneksi yang aman, harap {{enable}} verifikasi sertifikat server, dan gunakan versi klien {{version}} dengan jalur handshake yang ditentukan {{path}}.";
382
+ var wsConfigMessage$3 = "Saat terhubung melalui koneksi yang aman, harap {{enable}} verifikasi sertifikat server, dan ukuran maksimum konten yang diperbolehkan untuk diterima adalah {{content}}.";
383
+ var unlimited$3 = "tidak terbatas";
384
+ var left$3 = "Isi sisi kiri hingga";
385
+ var right$3 = "Isi sisi kanan hingga";
386
+ var tcpMethodMessage$3 = "{{direction}} {{size}} karakter, gunakan karakter pengisi '{{str}}'.";
387
+ var tcpMethodDelimiterMessage$3 = "Tambahkan karakter pemisah {{str}} di akhir.";
388
+ var requestEncodingFormat$3 = "Format pengkodean untuk pesan permintaan adalah {{format}}.";
389
+ var needAddRequestDataHandleFunction$3 = "Perlu menambahkan fungsi pemrosesan data permintaan:";
390
+ var needAddResponseDataHandleFunction$3 = "Perlu menambahkan fungsi pemrosesan data respons:";
391
+ var addNewline$3 = "Tambahkan karakter baris baru {{str}} di akhir setiap pesan permintaan";
392
+ var addContentLength$3 = "hitung panjang konten (tidak termasuk header paket), dan tambahkan ke header paket (format teks, panjang byte header paket adalah {{size}}).";
393
+ var removeResponseHeader$3 = "Pesan respons perlu menghapus header paket (panjang {{size}} byte)";
394
+ var trimTrailingNewline$3 = "menghapus karakter baris baru {{str}} di akhir baris";
395
+ var convertXmlToJson$3 = "dan mengonversi konten dalam format XML menjadi format JSON.";
396
+ var specialCharText$3 = "Untuk pesan tipe teks, ujung paket mengandung karakter khusus {{str}}";
397
+ var specialCharBinary$3 = "Untuk pesan tipe biner, ujung paket mengandung karakter khusus {{str}}";
398
+ var headerBodyFormat$3 = "Pesan berformat [Kepala+Isi] (Kepala menyimpan panjang byte Isi), dengan panjang Kepala {{size}} byte";
399
+ var fixedLength$3 = "Pesan memiliki panjang tetap ({{size}} byte)";
362
400
  var byte$3 = "byte";
363
- var trimTrailingNewline$3 = "Hapus karakter baris baru di akhir";
364
- var convertXmlToJson$3 = "Dan ubah konten XML menjadi format JSON";
365
401
  var completeOnReceive$3 = "Anggap data diterima sebagai lengkap (tanpa menangani segmentasi paket)";
366
- var specialCharText$3 = "Pesan berakhir dengan karakter khusus (pesan teks)";
367
- var specialCharBinary$3 = "Pesan berakhir dengan karakter khusus (pesan biner)";
368
- var headerBodyFormat$3 = "[Header + Body] format pesan (header menyimpan panjang byte body)";
369
- var fixedLength$3 = "Pesan dengan panjang tetap";
370
402
  var serverAddress$3 = "Alamat server";
371
403
  var pktCompletion$3 = "Tentukan metode penyelesaian penerimaan pesan";
372
404
  var createDir$3 = "Buat direktori";
373
405
  var createProj$3 = "Buat proyek";
374
406
  var createEnv$3 = "Buat lingkungan";
375
407
  var id = {
408
+ securityConnectionMessageNoPath: securityConnectionMessageNoPath$3,
409
+ notNeedEnable: notNeedEnable$3,
410
+ needEnable: needEnable$3,
376
411
  securityConnectionMessage: securityConnectionMessage$3,
377
- enableServerCertificateValidation: enableServerCertificateValidation$3,
378
- pleaseEnableServerCertificateValidation: pleaseEnableServerCertificateValidation$3,
379
- useClientVersion: useClientVersion$3,
380
- specifyHandshakePath: specifyHandshakePath$3,
381
- performConnection: performConnection$3,
382
- allowUnlimitedSendContent: allowUnlimitedSendContent$3,
383
- allowMaxSendContentSize: allowMaxSendContentSize$3,
384
- leftPaddingLength: leftPaddingLength$3,
385
- rightPaddingLength: rightPaddingLength$3,
386
- paddingCharacter: paddingCharacter$3,
387
- addEndingDelimiter: addEndingDelimiter$3,
412
+ wsConfigMessage: wsConfigMessage$3,
413
+ unlimited: unlimited$3,
414
+ left: left$3,
415
+ right: right$3,
416
+ tcpMethodMessage: tcpMethodMessage$3,
417
+ tcpMethodDelimiterMessage: tcpMethodDelimiterMessage$3,
388
418
  requestEncodingFormat: requestEncodingFormat$3,
419
+ needAddRequestDataHandleFunction: needAddRequestDataHandleFunction$3,
420
+ needAddResponseDataHandleFunction: needAddResponseDataHandleFunction$3,
389
421
  addNewline: addNewline$3,
390
422
  addContentLength: addContentLength$3,
391
423
  removeResponseHeader: removeResponseHeader$3,
392
- byte: byte$3,
393
424
  trimTrailingNewline: trimTrailingNewline$3,
394
425
  convertXmlToJson: convertXmlToJson$3,
395
- completeOnReceive: completeOnReceive$3,
396
426
  specialCharText: specialCharText$3,
397
427
  specialCharBinary: specialCharBinary$3,
398
428
  headerBodyFormat: headerBodyFormat$3,
399
429
  fixedLength: fixedLength$3,
430
+ byte: byte$3,
431
+ completeOnReceive: completeOnReceive$3,
400
432
  serverAddress: serverAddress$3,
401
433
  pktCompletion: pktCompletion$3,
402
434
  createDir: createDir$3,
@@ -404,60 +436,60 @@ var id = {
404
436
  createEnv: createEnv$3
405
437
  };
406
438
 
407
- var securityConnectionMessage$2 = "安全接続を行う際に";
408
- var enableServerCertificateValidation$2 = "サーバー証明書の検証を有効にする必要はありません";
409
- var pleaseEnableServerCertificateValidation$2 = "サーバー証明書の検証を有効にしてください";
410
- var useClientVersion$2 = "クライアントバージョンを使用してください";
411
- var specifyHandshakePath$2 = "ハンドシェイクパスを指定してください";
412
- var performConnection$2 = "接続を行います";
413
- var allowUnlimitedSendContent$2 = "送信可能なコンテンツを無制限に許可します";
414
- var allowMaxSendContentSize$2 = "送信可能な最大コンテンツサイズをとして許可します";
415
- var leftPaddingLength$2 = "左側のパディング長さ";
416
- var rightPaddingLength$2 = "右側のパディング長さ";
417
- var paddingCharacter$2 = "パディング文字";
418
- var addEndingDelimiter$2 = "終了区切り文字を追加します";
419
- var requestEncodingFormat$2 = "リクエストメッセージのエンコーディング形式は";
420
- var addNewline$2 = "各リクエストメッセージの末尾に改行文字を追加します";
421
- var addContentLength$2 = "コンテンツ長さを計算(ヘッダーを除く)し、ヘッダーに追加します(テキスト形式、ヘッダーバイト長は";
422
- var removeResponseHeader$2 = "レスポンスヘッダーを削除します(長さは";
439
+ var securityConnectionMessageNoPath$2 = "安全な接続を介して接続する際は、サーバー証明書の検証を{{enable}}、クライアントバージョン{{version}}を使用し、指定されたハンドシェイクパスはありません。";
440
+ var notNeedEnable$2 = "無効にし";
441
+ var needEnable$2 = "有効にし";
442
+ var securityConnectionMessage$2 = "安全な接続を介して接続する際は、サーバー証明書の検証を{{enable}}、クライアントバージョン{{version}}と指定されたハンドシェイクパス {{path}} を使用してください。";
443
+ var wsConfigMessage$2 = "安全な接続を介して接続する際は、サーバー証明書の検証を{{enable}}、受信可能な最大メッセージサイズは{{content}}です。";
444
+ var unlimited$2 = "無制限";
445
+ var left$2 = "左側";
446
+ var right$2 = "右側";
447
+ var tcpMethodMessage$2 = "{{direction}}を長さ{{size}}にパディングし、パディング文字:{{str}}";
448
+ var tcpMethodDelimiterMessage$2 = "末尾に区切り文字{{str}}を追加します。";
449
+ var requestEncodingFormat$2 = "リクエストメッセージのエンコーディング形式は{{format}}です。";
450
+ var needAddRequestDataHandleFunction$2 = "リクエストデータ処理関数を追加する必要があります:";
451
+ var needAddResponseDataHandleFunction$2 = "応答データ処理関数を追加する必要があります:";
452
+ var addNewline$2 = "各リクエストメッセージの末尾に改行文字{{str}}を追加し";
453
+ var addContentLength$2 = "内容の長さを計算(パケットヘッダーを除く)して、それをパケットヘッダーに追加します(テキスト形式、パケットヘッダーのバイト長は{{size}}です)。";
454
+ var removeResponseHeader$2 = "応答メッセージは、パケットヘッダー(長さ{{size}}バイト)";
455
+ var trimTrailingNewline$2 = "を削除し、行末の改行文字{{str}}を取り除き";
456
+ var convertXmlToJson$2 = "XML形式の内容をJSON形式に変換する必要があります。";
457
+ var specialCharText$2 = "テキストタイプのメッセージでは、パケットの末尾に特殊文字 {{str}} が含まれています";
458
+ var specialCharBinary$2 = "バイナリタイプのメッセージでは、パケットの末尾に特殊文字 {{str}} が含まれています";
459
+ var headerBodyFormat$2 = "[ヘッダー+ボディ]フォーマットのメッセージ(ヘッダーにはボディのバイト長が含まれ、ヘッダー長は{{size}}バイトです)";
460
+ var fixedLength$2 = "メッセージは固定長({{size}}バイト)です";
423
461
  var byte$2 = "バイト";
424
- var trimTrailingNewline$2 = "行末の改行文字を削除します";
425
- var convertXmlToJson$2 = "XML形式のコンテンツをJSON形式に変換します";
426
462
  var completeOnReceive$2 = "データを受信した時点で完了とみなします(パケット分割は処理しません)";
427
- var specialCharText$2 = "メッセージの末尾に特殊文字が含まれています(テキストメッセージ)";
428
- var specialCharBinary$2 = "メッセージの末尾に特殊文字が含まれています(バイナリメッセージ)";
429
- var headerBodyFormat$2 = "[ヘッダー + ボディ]形式のメッセージ(ヘッダーにボディのバイト長を格納)";
430
- var fixedLength$2 = "固定長メッセージ";
431
463
  var serverAddress$2 = "サーバーアドレス";
432
464
  var pktCompletion$2 = "メッセージ受信完了方法を判断する";
433
465
  var createDir$2 = "ディレクトリを作成する";
434
466
  var createProj$2 = "プロジェクトを作成する";
435
467
  var createEnv$2 = "環境を作成する";
436
468
  var ja = {
469
+ securityConnectionMessageNoPath: securityConnectionMessageNoPath$2,
470
+ notNeedEnable: notNeedEnable$2,
471
+ needEnable: needEnable$2,
437
472
  securityConnectionMessage: securityConnectionMessage$2,
438
- enableServerCertificateValidation: enableServerCertificateValidation$2,
439
- pleaseEnableServerCertificateValidation: pleaseEnableServerCertificateValidation$2,
440
- useClientVersion: useClientVersion$2,
441
- specifyHandshakePath: specifyHandshakePath$2,
442
- performConnection: performConnection$2,
443
- allowUnlimitedSendContent: allowUnlimitedSendContent$2,
444
- allowMaxSendContentSize: allowMaxSendContentSize$2,
445
- leftPaddingLength: leftPaddingLength$2,
446
- rightPaddingLength: rightPaddingLength$2,
447
- paddingCharacter: paddingCharacter$2,
448
- addEndingDelimiter: addEndingDelimiter$2,
473
+ wsConfigMessage: wsConfigMessage$2,
474
+ unlimited: unlimited$2,
475
+ left: left$2,
476
+ right: right$2,
477
+ tcpMethodMessage: tcpMethodMessage$2,
478
+ tcpMethodDelimiterMessage: tcpMethodDelimiterMessage$2,
449
479
  requestEncodingFormat: requestEncodingFormat$2,
480
+ needAddRequestDataHandleFunction: needAddRequestDataHandleFunction$2,
481
+ needAddResponseDataHandleFunction: needAddResponseDataHandleFunction$2,
450
482
  addNewline: addNewline$2,
451
483
  addContentLength: addContentLength$2,
452
484
  removeResponseHeader: removeResponseHeader$2,
453
- byte: byte$2,
454
485
  trimTrailingNewline: trimTrailingNewline$2,
455
486
  convertXmlToJson: convertXmlToJson$2,
456
- completeOnReceive: completeOnReceive$2,
457
487
  specialCharText: specialCharText$2,
458
488
  specialCharBinary: specialCharBinary$2,
459
489
  headerBodyFormat: headerBodyFormat$2,
460
490
  fixedLength: fixedLength$2,
491
+ byte: byte$2,
492
+ completeOnReceive: completeOnReceive$2,
461
493
  serverAddress: serverAddress$2,
462
494
  pktCompletion: pktCompletion$2,
463
495
  createDir: createDir$2,
@@ -465,60 +497,60 @@ var ja = {
465
497
  createEnv: createEnv$2
466
498
  };
467
499
 
468
- var securityConnectionMessage$1 = "在通过安全连接时";
469
- var enableServerCertificateValidation$1 = "无需启用服务器证书验证";
470
- var pleaseEnableServerCertificateValidation$1 = "请启用服务器证书验证";
471
- var useClientVersion$1 = "并使用客户端版本";
472
- var specifyHandshakePath$1 = "和指定的握手路径";
473
- var performConnection$1 = "进行连接";
474
- var allowUnlimitedSendContent$1 = "并且允许接收的最大发送内容无限制。";
475
- var allowMaxSendContentSize$1 = "并且允许接收的最大发送内容为";
476
- var leftPaddingLength$1 = "左填充至长度";
477
- var rightPaddingLength$1 = "右填充至长度";
478
- var paddingCharacter$1 = "填充字符";
479
- var addEndingDelimiter$1 = "结尾添加分隔符";
480
- var requestEncodingFormat$1 = "请求报文的编码格式为";
481
- var addNewline$1 = "在每个请求报文的结尾添加换行符";
482
- var addContentLength$1 = "计算内容长度(不包括包头)并将其添加到包头(文本格式,包头字节长度为";
483
- var removeResponseHeader$1 = "响应报文需要去除包头(长度为";
500
+ var securityConnectionMessageNoPath$1 = "在通过安全连接时,{{enable}}服务器证书验证,并使用客户端版本 {{version}} , 无指定握手路径。";
501
+ var notNeedEnable$1 = "无需启用";
502
+ var needEnable$1 = "请启用";
503
+ var securityConnectionMessage$1 = "在通过安全连接时,{{enable}}服务器证书验证,并使用客户端版本 {{version}} ,指定握手路径为 {{path}} 。";
504
+ var wsConfigMessage$1 = "在通过安全连接时,{{enable}}服务器证书验证,并且允许接收的最大發送内容为{{content}}。";
505
+ var unlimited$1 = "无限制";
506
+ var left$1 = "左";
507
+ var right$1 = "右";
508
+ var tcpMethodMessage$1 = "{{direction}}填充至长度{{size}},填充字符为:{{str}}";
509
+ var tcpMethodDelimiterMessage$1 = "结尾添加分隔字符{{str}}";
510
+ var requestEncodingFormat$1 = "请求报文的编码格式为 {{format}}";
511
+ var needAddRequestDataHandleFunction$1 = "需要添加请求数据处理函数:";
512
+ var needAddResponseDataHandleFunction$1 = "需要添加请求数据处理函数:";
513
+ var addNewline$1 = "在每个请求报文的结尾添加换行符 {{str}}";
514
+ var addContentLength$1 = "计算内容长度(不包括包头)并将其添加到包头(文本格式,包头字节长度为 {{size}})";
515
+ var removeResponseHeader$1 = "响应报文需要去除包头(长度为 {{size}} 字节)";
516
+ var trimTrailingNewline$1 = "去除行尾的换行符 {{str}}";
517
+ var convertXmlToJson$1 = "将 XML 格式的内容转换为 JSON 格式。";
518
+ var specialCharText$1 = "文本类型的报文,包尾含特殊字符 {{str}}";
519
+ var specialCharBinary$1 = "二进制类型的报文,包尾含特殊字符 {{str}}";
520
+ var headerBodyFormat$1 = "[包头+包体]格式报文(包头存包体字节长度),包头长度为{{size}}字节";
521
+ var fixedLength$1 = "报文为固定长度({{size}}字节)";
484
522
  var byte$1 = "字节";
485
- var trimTrailingNewline$1 = "去除行尾的换行符";
486
- var convertXmlToJson$1 = "并将 XML 格式的内容转换为 JSON 格式";
487
523
  var completeOnReceive$1 = "收到数据即认为完成(不处理分包问题)";
488
- var specialCharText$1 = "包尾含特殊字符(文本报文)";
489
- var specialCharBinary$1 = "包尾含特殊字符(二进制报文)";
490
- var headerBodyFormat$1 = "[包头+包体]格式报文(包头存包体字节长度)";
491
- var fixedLength$1 = "定长报文";
492
524
  var serverAddress$1 = "服务端地址";
493
525
  var pktCompletion$1 = "判断报文接收完成方式";
494
526
  var createDir$1 = "新建目录";
495
527
  var createProj$1 = "新建项目";
496
528
  var createEnv$1 = "新建环境";
497
529
  var cn = {
530
+ securityConnectionMessageNoPath: securityConnectionMessageNoPath$1,
531
+ notNeedEnable: notNeedEnable$1,
532
+ needEnable: needEnable$1,
498
533
  securityConnectionMessage: securityConnectionMessage$1,
499
- enableServerCertificateValidation: enableServerCertificateValidation$1,
500
- pleaseEnableServerCertificateValidation: pleaseEnableServerCertificateValidation$1,
501
- useClientVersion: useClientVersion$1,
502
- specifyHandshakePath: specifyHandshakePath$1,
503
- performConnection: performConnection$1,
504
- allowUnlimitedSendContent: allowUnlimitedSendContent$1,
505
- allowMaxSendContentSize: allowMaxSendContentSize$1,
506
- leftPaddingLength: leftPaddingLength$1,
507
- rightPaddingLength: rightPaddingLength$1,
508
- paddingCharacter: paddingCharacter$1,
509
- addEndingDelimiter: addEndingDelimiter$1,
534
+ wsConfigMessage: wsConfigMessage$1,
535
+ unlimited: unlimited$1,
536
+ left: left$1,
537
+ right: right$1,
538
+ tcpMethodMessage: tcpMethodMessage$1,
539
+ tcpMethodDelimiterMessage: tcpMethodDelimiterMessage$1,
510
540
  requestEncodingFormat: requestEncodingFormat$1,
541
+ needAddRequestDataHandleFunction: needAddRequestDataHandleFunction$1,
542
+ needAddResponseDataHandleFunction: needAddResponseDataHandleFunction$1,
511
543
  addNewline: addNewline$1,
512
544
  addContentLength: addContentLength$1,
513
545
  removeResponseHeader: removeResponseHeader$1,
514
- byte: byte$1,
515
546
  trimTrailingNewline: trimTrailingNewline$1,
516
547
  convertXmlToJson: convertXmlToJson$1,
517
- completeOnReceive: completeOnReceive$1,
518
548
  specialCharText: specialCharText$1,
519
549
  specialCharBinary: specialCharBinary$1,
520
550
  headerBodyFormat: headerBodyFormat$1,
521
551
  fixedLength: fixedLength$1,
552
+ byte: byte$1,
553
+ completeOnReceive: completeOnReceive$1,
522
554
  serverAddress: serverAddress$1,
523
555
  pktCompletion: pktCompletion$1,
524
556
  createDir: createDir$1,
@@ -526,60 +558,60 @@ var cn = {
526
558
  createEnv: createEnv$1
527
559
  };
528
560
 
529
- var securityConnectionMessage = "在進行安全連線時";
530
- var enableServerCertificateValidation = "無需啟用伺服器憑證驗證";
531
- var pleaseEnableServerCertificateValidation = "請啟用伺服器憑證驗證";
532
- var useClientVersion = "並使用客戶端版本";
533
- var specifyHandshakePath = "和指定的握手路徑";
534
- var performConnection = "進行連線";
535
- var allowUnlimitedSendContent = "並允許無限制地發送內容";
536
- var allowMaxSendContentSize = "並允許發送的最大內容大小為";
537
- var leftPaddingLength = "左側填補長度";
538
- var rightPaddingLength = "右側填補長度";
539
- var paddingCharacter = "填補字符";
540
- var addEndingDelimiter = "在結尾添加分隔符";
541
- var requestEncodingFormat = "請求報文的編碼格式為";
542
- var addNewline = "在每個請求報文的結尾添加換行符";
543
- var addContentLength = "計算內容長度(不包括包頭)並將其添加到包頭(文本格式,包頭字節長度為";
544
- var removeResponseHeader = "移除響應報文的包頭(長度為";
561
+ var securityConnectionMessageNoPath = "在通過安全連接時,{{enable}}伺服器證書驗證,並使用客戶端版本{{version}},無指定握手路徑。";
562
+ var notNeedEnable = "無需啟用";
563
+ var needEnable = "請啟用";
564
+ var securityConnectionMessage = "在通過安全連接時,{{enable}}伺服器證書驗證,並使用客戶端版本{{version}},指定握手路徑為{{path}}。";
565
+ var wsConfigMessage = "在通過安全連接時,{{enable}}伺服器證書驗證,並且允許接收的最大發送內容為 {{content}}。";
566
+ var unlimited = "無限制";
567
+ var left = "左";
568
+ var right = "右";
569
+ var tcpMethodMessage = "{{direction}}填充至長度{{size}},填充字符為:{{str}}";
570
+ var tcpMethodDelimiterMessage = "結尾添加分隔字符{{str}}";
571
+ var requestEncodingFormat = "請求報文的編碼格式為 {{format}}";
572
+ var needAddRequestDataHandleFunction = "需要添加請求數據處理函數:";
573
+ var needAddResponseDataHandleFunction = "需添加響應數據處理函數:";
574
+ var addNewline = "在每個請求報文的結尾添加換行符 {{str}}";
575
+ var addContentLength = "計算內容長度(不包括包頭)並將其添加到包頭(文本格式,包頭字節長度為 {{size}})";
576
+ var removeResponseHeader = "響應報文需要去除包頭(長度為 {{size}} 字節)";
577
+ var trimTrailingNewline = "去除行尾的換行符 {{str}}";
578
+ var convertXmlToJson = "將 XML 格式的內容轉換為 JSON 格式。";
579
+ var specialCharText = "文本類型的報文,包尾含特殊字符 {{str}}";
580
+ var specialCharBinary = "二進制類型的報文,包尾含特殊字符 {{str}}";
581
+ var headerBodyFormat = "[包頭+包體]格式報文(包頭存包體字節長度),包頭長度為{{size}}字節";
582
+ var fixedLength = "報文為固定長度({{size}}字節)";
545
583
  var byte = "位元組";
546
- var trimTrailingNewline = "去除行尾的換行符";
547
- var convertXmlToJson = "並將 XML 格式的內容轉換為 JSON 格式";
548
584
  var completeOnReceive = "收到數據即認為完成(不處理分包問題)";
549
- var specialCharText = "包尾含特殊字符(文本報文)";
550
- var specialCharBinary = "包尾含特殊字符(二進制報文)";
551
- var headerBodyFormat = "[包頭+包體]格式報文(包頭存包體字節長度)";
552
- var fixedLength = "定長報文";
553
585
  var serverAddress = "伺服器地址";
554
586
  var pktCompletion = "判斷報文接收完成方式";
555
587
  var createDir = "新建目錄";
556
588
  var createProj = "新建項目";
557
589
  var createEnv = "新建環境";
558
590
  var tw = {
591
+ securityConnectionMessageNoPath: securityConnectionMessageNoPath,
592
+ notNeedEnable: notNeedEnable,
593
+ needEnable: needEnable,
559
594
  securityConnectionMessage: securityConnectionMessage,
560
- enableServerCertificateValidation: enableServerCertificateValidation,
561
- pleaseEnableServerCertificateValidation: pleaseEnableServerCertificateValidation,
562
- useClientVersion: useClientVersion,
563
- specifyHandshakePath: specifyHandshakePath,
564
- performConnection: performConnection,
565
- allowUnlimitedSendContent: allowUnlimitedSendContent,
566
- allowMaxSendContentSize: allowMaxSendContentSize,
567
- leftPaddingLength: leftPaddingLength,
568
- rightPaddingLength: rightPaddingLength,
569
- paddingCharacter: paddingCharacter,
570
- addEndingDelimiter: addEndingDelimiter,
595
+ wsConfigMessage: wsConfigMessage,
596
+ unlimited: unlimited,
597
+ left: left,
598
+ right: right,
599
+ tcpMethodMessage: tcpMethodMessage,
600
+ tcpMethodDelimiterMessage: tcpMethodDelimiterMessage,
571
601
  requestEncodingFormat: requestEncodingFormat,
602
+ needAddRequestDataHandleFunction: needAddRequestDataHandleFunction,
603
+ needAddResponseDataHandleFunction: needAddResponseDataHandleFunction,
572
604
  addNewline: addNewline,
573
605
  addContentLength: addContentLength,
574
606
  removeResponseHeader: removeResponseHeader,
575
- byte: byte,
576
607
  trimTrailingNewline: trimTrailingNewline,
577
608
  convertXmlToJson: convertXmlToJson,
578
- completeOnReceive: completeOnReceive,
579
609
  specialCharText: specialCharText,
580
610
  specialCharBinary: specialCharBinary,
581
611
  headerBodyFormat: headerBodyFormat,
582
612
  fixedLength: fixedLength,
613
+ byte: byte,
614
+ completeOnReceive: completeOnReceive,
583
615
  serverAddress: serverAddress,
584
616
  pktCompletion: pktCompletion,
585
617
  createDir: createDir,
@@ -587,9 +619,7 @@ var tw = {
587
619
  createEnv: createEnv
588
620
  };
589
621
 
590
- // utils/i18n.js
591
- // let i18nInstance:any = null;
592
- let language = 'en';
622
+ let i18nInstance = null;
593
623
  const resources = {
594
624
  "zh-cn": {
595
625
  translation: cn,
@@ -611,28 +641,29 @@ const resources = {
611
641
  * 获取或创建独立的 i18next 实例
612
642
  * @returns {i18next.i18n} - i18next 实例
613
643
  */
614
- const I18nInit = (lng) => {
615
- language = lng;
616
- // if (!i18nInstance) {
617
- // i18nInstance = i18next.createInstance();
618
- // await i18nInstance.init({
619
- // lng: lng,
620
- // fallbackLng: 'zh-cn',
621
- // resources,
622
- // });
623
- // }else{
624
- // await i18nInstance?.changeLanguage(lng);
625
- // }
626
- // return i18nInstance;
627
- };
644
+ const I18nInit = (lng) => __awaiter(void 0, void 0, void 0, function* () {
645
+ // language= lng;
646
+ if (!i18nInstance) {
647
+ i18nInstance = i18next__default["default"].createInstance();
648
+ yield i18nInstance.init({
649
+ lng: lng,
650
+ fallbackLng: 'zh-cn',
651
+ resources,
652
+ });
653
+ }
654
+ else {
655
+ yield (i18nInstance === null || i18nInstance === void 0 ? void 0 : i18nInstance.changeLanguage(lng));
656
+ }
657
+ return i18nInstance;
658
+ });
628
659
  /**
629
660
  * 根据语言和键获取翻译
630
661
  * @param {string} lng - 语言代码,例如 'en', 'zh'
631
662
  * @param {string} key - 翻译键,例如 'greeting'
632
663
  */
633
- const t = (key) => {
634
- var _a, _b;
635
- return ((_b = (_a = resources === null || resources === void 0 ? void 0 : resources[language]) === null || _a === void 0 ? void 0 : _a.translation) === null || _b === void 0 ? void 0 : _b[key]) || key;
664
+ const t = (key, data) => {
665
+ let result = i18nInstance.t(key, data);
666
+ return result || key;
636
667
  };
637
668
 
638
669
  // @ts-nocheck
@@ -770,7 +801,7 @@ const deepModelRef = (originSchema, schemaMap, startSchema, count = 0) => {
770
801
  // }
771
802
  // }
772
803
  // }
773
- // // 如果属性是一个对象,就递归查找
804
+ // // 如果属性是一个对象,就递归查找
774
805
  // else if (
775
806
  // Object.prototype.toString.call(value) === "[object Object]" &&
776
807
  // value !== null
@@ -930,11 +961,16 @@ const handleSocketMethodParameterDescription = (item, mode) => {
930
961
  let description = item === null || item === void 0 ? void 0 : item.description;
931
962
  let rules = item === null || item === void 0 ? void 0 : item.rules;
932
963
  if (mode == 'fixed_message') {
933
- let fillTypStr = (rules === null || rules === void 0 ? void 0 : rules.fill_type) == 'left' ? t('leftPaddingLength') : (rules === null || rules === void 0 ? void 0 : rules.fill_type) == 'right' ? t('rightPaddingLength') : '';
934
- return `${description}\n${fillTypStr}${rules === null || rules === void 0 ? void 0 : rules.length},${t('paddingCharacter')}${rules === null || rules === void 0 ? void 0 : rules.custom}`;
964
+ return `${description}\n${t('tcpMethodMessage', {
965
+ direction: (rules === null || rules === void 0 ? void 0 : rules.fill_type) == 'left' ? t('left') : (rules === null || rules === void 0 ? void 0 : rules.fill_type) == 'right' ? t('right') : '',
966
+ size: rules === null || rules === void 0 ? void 0 : rules.length,
967
+ str: rules === null || rules === void 0 ? void 0 : rules.custom
968
+ })}`;
935
969
  }
936
970
  else if (mode == 'delimiter_message') {
937
- return `${description}\n${t('addEndingDelimiter')}${RULE_TYPES_ICON[rules === null || rules === void 0 ? void 0 : rules.delimiter]}`;
971
+ return `${description}\n${t('tcpMethodDelimiterMessage', {
972
+ str: RULE_TYPES_ICON[rules === null || rules === void 0 ? void 0 : rules.delimiter]
973
+ })}`;
938
974
  }
939
975
  return description;
940
976
  };
@@ -1083,7 +1119,7 @@ const handlePathItemRequestBody = (body, pathItem, modelsObj) => {
1083
1119
  }
1084
1120
  };
1085
1121
  const createPathItem = (item, sourceObj, pid, pidName, modelsObj, apiVersion, target_type) => {
1086
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15;
1122
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19;
1087
1123
  const path = recursiveFolderPath("", sourceObj, pid, pidName);
1088
1124
  const pathItem = {
1089
1125
  'x-target-id': (item === null || item === void 0 ? void 0 : item.target_id) || '',
@@ -1136,23 +1172,35 @@ const createPathItem = (item, sourceObj, pid, pidName, modelsObj, apiVersion, ta
1136
1172
  switch (target_type) {
1137
1173
  case 'socketio':
1138
1174
  pathItem.description = `${pathItem.description}
1139
- ${t('securityConnectionMessage')},${((_o = item === null || item === void 0 ? void 0 : item.config) === null || _o === void 0 ? void 0 : _o.certificate_verification) == -1 ? t('enableServerCertificateValidation') : t('pleaseEnableServerCertificateValidation')},${t('useClientVersion')} ${((_p = item === null || item === void 0 ? void 0 : item.config) === null || _p === void 0 ? void 0 : _p.socket_version) || 'v4'}${t('specifyHandshakePath')} ${((_q = item === null || item === void 0 ? void 0 : item.config) === null || _q === void 0 ? void 0 : _q.shake_hands_path) || '/socket.io'} ${t('performConnection')}.`;
1175
+ ${((_o = item === null || item === void 0 ? void 0 : item.config) === null || _o === void 0 ? void 0 : _o.shake_hands_path) ? t('securityConnectionMessage', {
1176
+ enable: ((_p = item === null || item === void 0 ? void 0 : item.config) === null || _p === void 0 ? void 0 : _p.certificate_verification) == -1 ? t('notNeedEnable') : t('needEnable'),
1177
+ version: ((_q = item === null || item === void 0 ? void 0 : item.config) === null || _q === void 0 ? void 0 : _q.socket_version) || 'v4',
1178
+ path: (_r = item === null || item === void 0 ? void 0 : item.config) === null || _r === void 0 ? void 0 : _r.shake_hands_path
1179
+ }) : t('securityConnectionMessageNoPath', {
1180
+ enable: ((_s = item === null || item === void 0 ? void 0 : item.config) === null || _s === void 0 ? void 0 : _s.certificate_verification) == -1 ? t('notNeedEnable') : t('needEnable'),
1181
+ version: ((_t = item === null || item === void 0 ? void 0 : item.config) === null || _t === void 0 ? void 0 : _t.socket_version) || 'v4',
1182
+ })}
1183
+ `;
1140
1184
  break;
1141
1185
  case 'websocket2':
1142
1186
  pathItem.description = `${pathItem.description}
1143
- ${t('securityConnectionMessage')},${((_r = item === null || item === void 0 ? void 0 : item.config) === null || _r === void 0 ? void 0 : _r.certificate_verification) == -1 ? t('enableServerCertificateValidation') : t('pleaseEnableServerCertificateValidation')},${((_s = item === null || item === void 0 ? void 0 : item.config) === null || _s === void 0 ? void 0 : _s.information_size) == 0 ? t('allowUnlimitedSendContent') : `${t('allowMaxSendContentSize')}${((_t = item === null || item === void 0 ? void 0 : item.config) === null || _t === void 0 ? void 0 : _t.information_size) || 5}M。`}`;
1187
+ ${t('wsConfigMessage', {
1188
+ enable: ((_u = item === null || item === void 0 ? void 0 : item.config) === null || _u === void 0 ? void 0 : _u.certificate_verification) == -1 ? t('notNeedEnable') : t('needEnable'),
1189
+ content: !((_v = item === null || item === void 0 ? void 0 : item.config) === null || _v === void 0 ? void 0 : _v.information_size) || ((_w = item === null || item === void 0 ? void 0 : item.config) === null || _w === void 0 ? void 0 : _w.information_size) == 0 ? t('unlimited') : `${(_x = item === null || item === void 0 ? void 0 : item.config) === null || _x === void 0 ? void 0 : _x.information_size}M`
1190
+ })}
1191
+ `;
1144
1192
  break;
1145
1193
  }
1146
1194
  }
1147
- handlePathItemParameters("query", ((_v = (_u = item === null || item === void 0 ? void 0 : item.request) === null || _u === void 0 ? void 0 : _u.query) === null || _v === void 0 ? void 0 : _v.parameter) || [], pathItem);
1148
- handlePathItemParameters("header", ((_x = (_w = item === null || item === void 0 ? void 0 : item.request) === null || _w === void 0 ? void 0 : _w.header) === null || _x === void 0 ? void 0 : _x.parameter) || [], pathItem);
1149
- handlePathItemParameters("cookie", ((_z = (_y = item === null || item === void 0 ? void 0 : item.request) === null || _y === void 0 ? void 0 : _y.cookie) === null || _z === void 0 ? void 0 : _z.parameter) || [], pathItem);
1150
- handlePathItemParameters("path", ((_1 = (_0 = item === null || item === void 0 ? void 0 : item.request) === null || _0 === void 0 ? void 0 : _0.restful) === null || _1 === void 0 ? void 0 : _1.parameter) || [], pathItem);
1195
+ handlePathItemParameters("query", ((_z = (_y = item === null || item === void 0 ? void 0 : item.request) === null || _y === void 0 ? void 0 : _y.query) === null || _z === void 0 ? void 0 : _z.parameter) || [], pathItem);
1196
+ handlePathItemParameters("header", ((_1 = (_0 = item === null || item === void 0 ? void 0 : item.request) === null || _0 === void 0 ? void 0 : _0.header) === null || _1 === void 0 ? void 0 : _1.parameter) || [], pathItem);
1197
+ handlePathItemParameters("cookie", ((_3 = (_2 = item === null || item === void 0 ? void 0 : item.request) === null || _2 === void 0 ? void 0 : _2.cookie) === null || _3 === void 0 ? void 0 : _3.parameter) || [], pathItem);
1198
+ handlePathItemParameters("path", ((_5 = (_4 = item === null || item === void 0 ? void 0 : item.request) === null || _4 === void 0 ? void 0 : _4.restful) === null || _5 === void 0 ? void 0 : _5.parameter) || [], pathItem);
1151
1199
  if (target_type == 'socketio')
1152
- handlePathItemParameters("event", ((_3 = (_2 = item === null || item === void 0 ? void 0 : item.request) === null || _2 === void 0 ? void 0 : _2.event) === null || _3 === void 0 ? void 0 : _3.parameter) || [], pathItem);
1200
+ handlePathItemParameters("event", ((_7 = (_6 = item === null || item === void 0 ? void 0 : item.request) === null || _6 === void 0 ? void 0 : _6.event) === null || _7 === void 0 ? void 0 : _7.parameter) || [], pathItem);
1153
1201
  // 处理请体
1154
1202
  if (target_type == 'graphql') {
1155
- handleGraphqlRequestBody(((_5 = (_4 = item === null || item === void 0 ? void 0 : item.request) === null || _4 === void 0 ? void 0 : _4.body) === null || _5 === void 0 ? void 0 : _5.query_list) || [], ((_7 = (_6 = item === null || item === void 0 ? void 0 : item.request) === null || _6 === void 0 ? void 0 : _6.body) === null || _7 === void 0 ? void 0 : _7.query_schema) || {}, pathItem, modelsObj);
1203
+ handleGraphqlRequestBody(((_9 = (_8 = item === null || item === void 0 ? void 0 : item.request) === null || _8 === void 0 ? void 0 : _8.body) === null || _9 === void 0 ? void 0 : _9.query_list) || [], ((_11 = (_10 = item === null || item === void 0 ? void 0 : item.request) === null || _10 === void 0 ? void 0 : _10.body) === null || _11 === void 0 ? void 0 : _11.query_schema) || {}, pathItem, modelsObj);
1156
1204
  }
1157
1205
  else {
1158
1206
  handleMessagePathItemrequestBody((item === null || item === void 0 ? void 0 : item.message) || [], pathItem, modelsObj);
@@ -1164,28 +1212,23 @@ ${t('securityConnectionMessage')},${((_r = item === null || item === void 0 ?
1164
1212
  }
1165
1213
  else if (target_type == 'socket_method') {
1166
1214
  // 拼接description
1167
- const configs = (_8 = item === null || item === void 0 ? void 0 : item.request) === null || _8 === void 0 ? void 0 : _8.configs;
1215
+ const configs = (_12 = item === null || item === void 0 ? void 0 : item.request) === null || _12 === void 0 ? void 0 : _12.configs;
1168
1216
  if (lodash.isPlainObject(configs)) {
1169
- let requestString = `${t('requestEncodingFormat')} ${configs === null || configs === void 0 ? void 0 : configs.charset} ${lodash.isArray((_9 = configs === null || configs === void 0 ? void 0 : configs.func) === null || _9 === void 0 ? void 0 : _9.request) && ((_10 = configs === null || configs === void 0 ? void 0 : configs.func) === null || _10 === void 0 ? void 0 : _10.request.length) > 0 ?
1170
- (_11 = configs === null || configs === void 0 ? void 0 : configs.func) === null || _11 === void 0 ? void 0 : _11.request.map((r, index) => {
1171
- var _a;
1217
+ let requestString = `${t('requestEncodingFormat', { format: configs === null || configs === void 0 ? void 0 : configs.charset })} ${lodash.isArray((_13 = configs === null || configs === void 0 ? void 0 : configs.func) === null || _13 === void 0 ? void 0 : _13.request) && ((_14 = configs === null || configs === void 0 ? void 0 : configs.func) === null || _14 === void 0 ? void 0 : _14.request.length) > 0 ?
1218
+ `${t('needAddRequestDataHandleFunction')}\n${(_15 = configs === null || configs === void 0 ? void 0 : configs.func) === null || _15 === void 0 ? void 0 : _15.request.map((r, index) => {
1172
1219
  let str = getTcpMethodFucString(r);
1173
- if (index < ((_a = configs === null || configs === void 0 ? void 0 : configs.func) === null || _a === void 0 ? void 0 : _a.request.length) - 1) {
1174
- return str + ',';
1175
- }
1176
1220
  return str;
1177
- }) : ''}`;
1178
- let responseString = lodash.isArray((_12 = configs === null || configs === void 0 ? void 0 : configs.func) === null || _12 === void 0 ? void 0 : _12.response) && ((_13 = configs === null || configs === void 0 ? void 0 : configs.func) === null || _13 === void 0 ? void 0 : _13.response.length) > 0 ? (_14 = configs === null || configs === void 0 ? void 0 : configs.func) === null || _14 === void 0 ? void 0 : _14.response.map((r, index) => {
1179
- var _a;
1180
- let str = getTcpMethodFucString(r);
1181
- if (index < ((_a = configs === null || configs === void 0 ? void 0 : configs.func) === null || _a === void 0 ? void 0 : _a.request.length) - 1) {
1182
- return str + ',';
1183
- }
1184
- return str + '。';
1185
- }) : '';
1221
+ })}`
1222
+ : ''}`;
1223
+ let responseString = lodash.isArray((_16 = configs === null || configs === void 0 ? void 0 : configs.func) === null || _16 === void 0 ? void 0 : _16.response) && ((_17 = configs === null || configs === void 0 ? void 0 : configs.func) === null || _17 === void 0 ? void 0 : _17.response.length) > 0 ?
1224
+ `${t('needAddResponseDataHandleFunction')}\n${(_18 = configs === null || configs === void 0 ? void 0 : configs.func) === null || _18 === void 0 ? void 0 : _18.response.map((r, index) => {
1225
+ let str = getTcpMethodFucString(r);
1226
+ return str;
1227
+ })}`
1228
+ : '';
1186
1229
  pathItem.description = `${pathItem.description}\n${requestString}\n${responseString}`;
1187
1230
  }
1188
- handleSocketMethodRequestBody(((_15 = item === null || item === void 0 ? void 0 : item.request) === null || _15 === void 0 ? void 0 : _15.body) || {}, pathItem);
1231
+ handleSocketMethodRequestBody(((_19 = item === null || item === void 0 ? void 0 : item.request) === null || _19 === void 0 ? void 0 : _19.body) || {}, pathItem);
1189
1232
  // 处理响应
1190
1233
  pathItem.responses = handlePathItemResponse((item === null || item === void 0 ? void 0 : item.response) || {}, modelsObj);
1191
1234
  // 添加路径标签
@@ -1204,13 +1247,13 @@ ${t('securityConnectionMessage')},${((_r = item === null || item === void 0 ?
1204
1247
  const getTcpMethodFucString = (func) => {
1205
1248
  switch (func === null || func === void 0 ? void 0 : func.id) {
1206
1249
  case 'addCharToPacketEnd':
1207
- return `${t('addNewline')} ${func === null || func === void 0 ? void 0 : func.option}`;
1250
+ return t('addNewline', { str: func === null || func === void 0 ? void 0 : func.option });
1208
1251
  case 'calcLengthToPacketHeader':
1209
- return `${t('addContentLength')} ${func === null || func === void 0 ? void 0 : func.option})`;
1252
+ return t('addContentLength', { size: func === null || func === void 0 ? void 0 : func.option });
1210
1253
  case 'removePacketHeader':
1211
- return `${t('removeResponseHeader')}${func === null || func === void 0 ? void 0 : func.option} ${t('byte')})`;
1254
+ return t('removeResponseHeader', { size: func === null || func === void 0 ? void 0 : func.option });
1212
1255
  case 'removeWrapChar':
1213
- return `${t('trimTrailingNewline')} ${func === null || func === void 0 ? void 0 : func.option}`;
1256
+ return t('trimTrailingNewline', { str: func === null || func === void 0 ? void 0 : func.option });
1214
1257
  case 'parseXmlToJson':
1215
1258
  return t('convertXmlToJson');
1216
1259
  }
@@ -1221,13 +1264,13 @@ const getSocketRequestStr = (end_func) => {
1221
1264
  case 'none':
1222
1265
  return t('completeOnReceive');
1223
1266
  case 'endedChar':
1224
- return `${t('specialCharText')} ${end_func === null || end_func === void 0 ? void 0 : end_func.option}`;
1267
+ return t('specialCharText', { str: end_func === null || end_func === void 0 ? void 0 : end_func.option });
1225
1268
  case 'endedHexChar':
1226
- return `${t('specialCharBinary')} ${end_func === null || end_func === void 0 ? void 0 : end_func.option}`;
1269
+ return t('specialCharBinary', { str: end_func === null || end_func === void 0 ? void 0 : end_func.option });
1227
1270
  case 'endedHeaderByteLength':
1228
- return `${t('headerBodyFormat')} ${end_func === null || end_func === void 0 ? void 0 : end_func.option}`;
1271
+ return t('headerBodyFormat', { size: end_func === null || end_func === void 0 ? void 0 : end_func.option });
1229
1272
  case 'endedContentByteLength':
1230
- return `${t('fixedLength')} ${end_func === null || end_func === void 0 ? void 0 : end_func.option}`;
1273
+ return t('fixedLength', { size: end_func === null || end_func === void 0 ? void 0 : end_func.option });
1231
1274
  }
1232
1275
  return '';
1233
1276
  };
@@ -1505,7 +1548,6 @@ const getSubstring = (str, length) => {
1505
1548
  return str;
1506
1549
  };
1507
1550
 
1508
- // @ts-nocheck
1509
1551
  class ApipostToSwagger {
1510
1552
  constructor() {
1511
1553
  Object.defineProperty(this, "apiToSwaggerOrigin", {
@@ -1658,7 +1700,7 @@ class ApipostToSwagger {
1658
1700
  }
1659
1701
  array2NamePathObj(idName = "id", pidName = "pid", modelsObj) {
1660
1702
  var _a, _b, _c, _d, _e;
1661
- const items = this.apiToSwaggerOrigin.apis;
1703
+ const items = lodash.cloneDeep(this.apiToSwaggerOrigin.apis);
1662
1704
  try {
1663
1705
  const paths = {};
1664
1706
  const folderObj = {};
@@ -1799,65 +1841,37 @@ class ApipostToSwagger {
1799
1841
  }
1800
1842
  }
1801
1843
  apiToswagger(apipostObj, version, language) {
1802
- // 初始化语言包
1803
- I18nInit(language || 'en');
1804
- this.apiToSwaggerOrigin = apipostObj;
1805
- this.apiToSwaggerVersion = version;
1806
- this.apiToSwaggerResult = {};
1807
- if (`${version}` === "metersphere") {
1808
- this.apiToSwaggerVersion = "3.0";
1809
- }
1810
- try {
1811
- // 处理项目信息
1812
- this.handleProject();
1813
- // 处理数据模型
1814
- const schemaMap = this.handleModels();
1815
- // // 处理apis
1816
- this.handleApis(schemaMap);
1817
- // 处理环境信息
1818
- this.handleEnvs();
1844
+ return __awaiter(this, void 0, void 0, function* () {
1845
+ // 初始化语言包
1846
+ yield I18nInit(language || 'en');
1847
+ this.apiToSwaggerOrigin = apipostObj;
1848
+ this.apiToSwaggerVersion = version;
1849
+ this.apiToSwaggerResult = {};
1819
1850
  if (`${version}` === "metersphere") {
1820
- this.formatData();
1851
+ this.apiToSwaggerVersion = "3.0";
1821
1852
  }
1822
- return throwResult$1("success", "", this.apiToSwaggerResult);
1823
- }
1824
- catch (error) {
1825
- console.log(JSON.stringify(error.message), "error");
1826
- return throwResult$1("error", String(error), this.apiToSwaggerResult);
1827
- }
1853
+ try {
1854
+ // 处理项目信息
1855
+ this.handleProject();
1856
+ // 处理数据模型
1857
+ const schemaMap = this.handleModels();
1858
+ // // 处理apis
1859
+ this.handleApis(schemaMap);
1860
+ // 处理环境信息
1861
+ this.handleEnvs();
1862
+ if (`${version}` === "metersphere") {
1863
+ this.formatData();
1864
+ }
1865
+ return throwResult$1("success", "", this.apiToSwaggerResult);
1866
+ }
1867
+ catch (error) {
1868
+ console.log(JSON.stringify(error.message), "error");
1869
+ return throwResult$1("error", String(error), this.apiToSwaggerResult);
1870
+ }
1871
+ });
1828
1872
  }
1829
1873
  }
1830
1874
 
1831
- /******************************************************************************
1832
- Copyright (c) Microsoft Corporation.
1833
-
1834
- Permission to use, copy, modify, and/or distribute this software for any
1835
- purpose with or without fee is hereby granted.
1836
-
1837
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1838
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1839
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1840
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1841
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1842
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1843
- PERFORMANCE OF THIS SOFTWARE.
1844
- ***************************************************************************** */
1845
-
1846
- function __awaiter(thisArg, _arguments, P, generator) {
1847
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1848
- return new (P || (P = Promise))(function (resolve, reject) {
1849
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
1850
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
1851
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
1852
- step((generator = generator.apply(thisArg, _arguments || [])).next());
1853
- });
1854
- }
1855
-
1856
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
1857
- var e = new Error(message);
1858
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
1859
- };
1860
-
1861
1875
  const getApipostMode = (mode) => {
1862
1876
  let apipostMode = 'none';
1863
1877
  if (mode == 'multipart/form-data') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "echoapi-converter",
3
- "version": "0.0.54",
3
+ "version": "0.0.56",
4
4
  "description": "echoapi to swagger",
5
5
  "main": "dist/index.js",
6
6
  "files": [