openapi-ts-request 1.10.0 → 1.10.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/README.md CHANGED
@@ -186,7 +186,6 @@ $ openapi --help
186
186
  -o, --output <string> output directory
187
187
  -cfn, --configFileName <string> config file name
188
188
  -cfp, --configFilePath <string> config file path
189
- -u, --uniqueKey <string> unique key
190
189
  --requestLibPath <string> custom request lib path, for example: "@/request", "node-fetch" (default: "axios")
191
190
  -f, --full <boolean> full replacement (default: true)
192
191
  --enableLogging <boolean> open the log (default: false)
package/dist/bin/cli.js CHANGED
@@ -9,14 +9,12 @@ const log_1 = require("../log");
9
9
  const readConfig_1 = require("../readConfig");
10
10
  commander_1.program
11
11
  .option('-cfn, --configFileName <string>', 'config file name')
12
- .option('-cfp, --configFilePath <string>', 'config file path')
13
- .option('-u, --uniqueKey <string>', 'unique key');
12
+ .option('-cfp, --configFilePath <string>', 'config file path');
14
13
  commander_1.program.parse();
15
14
  const options = commander_1.program.opts();
16
15
  /**
17
16
  * 1. 执行 cli 命令读取配置文件,已经使用 openapi.ts 替代了 cli.ts,后期会废弃 cli.ts
18
- * 2. 如果配置文件中有 uniqueKey,则根据 uniqueKey 生成 service
19
- * 3. 如果配置文件中没有 uniqueKey,且有多个 service,则交互式选择要生成的 service
17
+ * 2. 如果配置文件有多个 service,则交互式选择要生成的 service
20
18
  */
21
19
  function run() {
22
20
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
@@ -33,11 +31,8 @@ function run() {
33
31
  : [config];
34
32
  /** 是否交互式 */
35
33
  let isInteractive = false;
36
- if (options.uniqueKey) {
37
- configs = configs.filter((config) => config.uniqueKey === options.uniqueKey);
38
- }
39
- else if (configs.length > 1) {
40
- // 如果没有指定 uniqueKey,并且有多个配置,则交互式选择
34
+ if (configs.length > 1) {
35
+ // 有多个配置,则交互式选择
41
36
  isInteractive = true;
42
37
  console.log(''); // 添加一个空行
43
38
  (0, prompts_1.intro)('🎉 欢迎使用 openapi-ts-request 生成器');
@@ -63,7 +58,8 @@ function run() {
63
58
  const result = results[i];
64
59
  if (result.status === 'rejected') {
65
60
  const cnf = configs[i];
66
- errorMsg += `${cnf.uniqueKey}${cnf.uniqueKey && ':'}${result.reason}\n`;
61
+ const label = cnf.describe || cnf.schemaPath;
62
+ errorMsg += `${label}${label && ':'}${result.reason}\n`;
67
63
  }
68
64
  }
69
65
  if (errorMsg) {
@@ -18,7 +18,6 @@ const params = commander_1.program
18
18
  .option('-o, --output <string>', 'output directory')
19
19
  .option('-cfn, --configFileName <string>', 'config file name')
20
20
  .option('-cfp, --configFilePath <string>', 'config file path')
21
- .option('-u, --uniqueKey <string>', 'unique key')
22
21
  .option('--requestLibPath <string>', 'custom request lib path, for example: "@/request", "node-fetch" (default: "axios")')
23
22
  .option('-f, --full <boolean>', 'full replacement', true)
24
23
  .option('--enableLogging <boolean>', 'open the log', false)
@@ -102,11 +101,8 @@ function run() {
102
101
  let configs = Array.isArray(cnf) ? cnf : [cnf];
103
102
  /** 是否交互式 */
104
103
  let isInteractive = false;
105
- if (params.uniqueKey) {
106
- configs = configs.filter((config) => config.uniqueKey === params.uniqueKey);
107
- }
108
- else if (configs.length > 1) {
109
- // 如果没有指定 uniqueKey,并且有多个配置,则交互式选择
104
+ if (configs.length > 1) {
105
+ // 有多个配置,则交互式选择
110
106
  isInteractive = true;
111
107
  console.log(''); // 添加一个空行
112
108
  (0, prompts_1.intro)('🎉 欢迎使用 openapi-ts-request 生成器');
@@ -132,7 +128,8 @@ function run() {
132
128
  const result = results[i];
133
129
  if (result.status === 'rejected') {
134
130
  const cnf = configs[i];
135
- errorMsg += `${cnf.uniqueKey}${cnf.uniqueKey && ':'}${result.reason}\n`;
131
+ const label = cnf.describe || cnf.schemaPath;
132
+ errorMsg += `${label}${label && ':'}${result.reason}\n`;
136
133
  }
137
134
  }
138
135
  if (errorMsg) {
package/dist/index.d.ts CHANGED
@@ -143,10 +143,6 @@ export type GenerateServiceProps = {
143
143
  * 请求超时时间
144
144
  */
145
145
  timeout?: number;
146
- /**
147
- * 多网关唯一标识
148
- */
149
- uniqueKey?: string;
150
146
  /**
151
147
  * 自定义二进制媒体类型列表
152
148
  * 默认包含: ['application/octet-stream', 'application/pdf', 'image/*', 'video/*', 'audio/*']
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openapi-ts-request",
3
- "version": "1.10.0",
3
+ "version": "1.10.1",
4
4
  "description": "Swagger2/OpenAPI3/Apifox to TypeScript/JavaScript, request client(support any client), request mock service, enum and enum translation, react-query/vue-query, type field label, JSON Schemas",
5
5
  "engines": {
6
6
  "node": ">=18.0.0",