@keq-request/cli 5.0.0-alpha.23 → 5.0.0-alpha.24

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.
Files changed (64) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cli.cjs +111 -150
  3. package/dist/cli.cjs.map +1 -1
  4. package/dist/cli.js +111 -150
  5. package/dist/cli.js.map +1 -1
  6. package/dist/compiler/tasks/download/index.d.ts.map +1 -1
  7. package/dist/compiler/tasks/setup/index.d.ts.map +1 -1
  8. package/dist/index.cjs +109 -150
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.js +109 -150
  11. package/dist/index.js.map +1 -1
  12. package/dist/models/api-document_v3_1.d.ts +0 -1
  13. package/dist/models/api-document_v3_1.d.ts.map +1 -1
  14. package/dist/models/artifact.d.ts +0 -2
  15. package/dist/models/artifact.d.ts.map +1 -1
  16. package/dist/plugins/generate-micro-function/generators/micro_function/micro-function.generator.d.ts.map +1 -1
  17. package/dist/plugins/generate-nestjs-module/generators/nestjs-module.generator.d.ts.map +1 -1
  18. package/dist/plugins/index.d.ts +2 -0
  19. package/dist/plugins/index.d.ts.map +1 -1
  20. package/dist/plugins/initialize/initialize.plugin.d.ts.map +1 -1
  21. package/dist/plugins/overwrite-operation-id/index.d.ts +2 -0
  22. package/dist/plugins/overwrite-operation-id/index.d.ts.map +1 -0
  23. package/dist/plugins/overwrite-operation-id/overwrite-operation-id.plugin.d.ts +20 -0
  24. package/dist/plugins/overwrite-operation-id/overwrite-operation-id.plugin.d.ts.map +1 -0
  25. package/dist/plugins/overwrite-query-options/index.d.ts +2 -0
  26. package/dist/plugins/overwrite-query-options/index.d.ts.map +1 -0
  27. package/dist/plugins/overwrite-query-options/overwrite-query-options.plugin.d.ts +18 -0
  28. package/dist/plugins/overwrite-query-options/overwrite-query-options.plugin.d.ts.map +1 -0
  29. package/dist/plugins/prettier/index.d.ts +1 -5
  30. package/dist/plugins/prettier/index.d.ts.map +1 -1
  31. package/dist/plugins/prettier/prettier.plugin.d.ts +6 -0
  32. package/dist/plugins/prettier/prettier.plugin.d.ts.map +1 -0
  33. package/dist/plugins/shaking/shaking.plugin.d.ts.map +1 -1
  34. package/dist/plugins.cjs +172 -93
  35. package/dist/plugins.cjs.map +1 -1
  36. package/dist/plugins.js +170 -93
  37. package/dist/plugins.js.map +1 -1
  38. package/dist/transformers/api-document/nestjs-client.renderer.d.ts +0 -3
  39. package/dist/transformers/api-document/nestjs-client.renderer.d.ts.map +1 -1
  40. package/dist/transformers/operation-definition/declaration.renderer.d.ts.map +1 -1
  41. package/dist/transformers/operation-definition/micro-function.renderer.d.ts +1 -1
  42. package/dist/transformers/operation-definition/micro-function.renderer.d.ts.map +1 -1
  43. package/dist/transformers/operation-definition/nestjs-method.renderer.d.ts +1 -1
  44. package/dist/transformers/operation-definition/nestjs-method.renderer.d.ts.map +1 -1
  45. package/dist/transformers/operation-definition/{typescript-helper.d.ts → typescript-snippet.d.ts} +1 -4
  46. package/dist/transformers/operation-definition/typescript-snippet.d.ts.map +1 -0
  47. package/dist/types/index.d.ts +0 -2
  48. package/dist/types/index.d.ts.map +1 -1
  49. package/dist/types/runtime-config.d.ts +1 -17
  50. package/dist/types/runtime-config.d.ts.map +1 -1
  51. package/dist/utils/openapi-utils/index.d.ts +4 -2
  52. package/dist/utils/openapi-utils/index.d.ts.map +1 -1
  53. package/dist/utils/openapi-utils/map-operation.d.ts +4 -0
  54. package/dist/utils/openapi-utils/map-operation.d.ts.map +1 -0
  55. package/dist/utils/openapi-utils/map-parameter.d.ts +4 -0
  56. package/dist/utils/openapi-utils/map-parameter.d.ts.map +1 -0
  57. package/package.json +3 -3
  58. package/dist/transformers/operation-definition/typescript-helper.d.ts.map +0 -1
  59. package/dist/types/operation-id-factory.d.ts +0 -10
  60. package/dist/types/operation-id-factory.d.ts.map +0 -1
  61. package/dist/types/qs.d.ts +0 -9
  62. package/dist/types/qs.d.ts.map +0 -1
  63. package/dist/utils/openapi-utils/update-operation-id.d.ts +0 -5
  64. package/dist/utils/openapi-utils/update-operation-id.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/compiler/tasks/download/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgB,MAAM,QAAQ,CAAA;AAGhD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAKrD,UAAU,mBAAmB;IAC3B,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B;AA2ED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,eAAe,GAAG,SAAS,CAAC,eAAe,CAAC,CAkBlI"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/compiler/tasks/download/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgB,MAAM,QAAQ,CAAA;AAGhD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAKrD,UAAU,mBAAmB;IAC3B,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B;AAmED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,eAAe,GAAG,SAAS,CAAC,eAAe,CAAC,CAkBlI"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/compiler/tasks/setup/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAClC,OAAO,EAAiB,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAG5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAGtD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB,MAAM,CAAC,EAAE,KAAK,GAAG;QACf,KAAK,EAAE,iBAAiB,EAAE,CAAA;KAC3B,CAAA;CACF;AA8ED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,gBAAgB,GAAG,eAAe,GAAG,SAAS,CAAC,eAAe,CAAC,CAkB3H"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/compiler/tasks/setup/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAClC,OAAO,EAAiB,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAG5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAGtD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB,MAAM,CAAC,EAAE,KAAK,GAAG;QACf,KAAK,EAAE,iBAAiB,EAAE,CAAA;KAC3B,CAAA;CACF;AAqED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,gBAAgB,GAAG,eAAe,GAAG,SAAS,CAAC,eAAe,CAAC,CAkB3H"}
package/dist/index.cjs CHANGED
@@ -49,29 +49,8 @@ function defineKeqConfig(config) {
49
49
  return config;
50
50
  }
51
51
 
52
- // src/types/qs.ts
53
- var import_typebox = require("@sinclair/typebox");
54
-
55
- // src/constants/qs-array-format.ts
56
- var QsArrayFormat = /* @__PURE__ */ ((QsArrayFormat2) => {
57
- QsArrayFormat2["brackets"] = "brackets";
58
- QsArrayFormat2["indices"] = "indices";
59
- QsArrayFormat2["repeat"] = "repeat";
60
- QsArrayFormat2["comma"] = "comma";
61
- QsArrayFormat2["space"] = "space";
62
- QsArrayFormat2["pipe"] = "pipe";
63
- return QsArrayFormat2;
64
- })(QsArrayFormat || {});
65
-
66
- // src/types/qs.ts
67
- var Qs = import_typebox.Type.Object({
68
- indices: import_typebox.Type.Optional(import_typebox.Type.Boolean()),
69
- arrayFormat: import_typebox.Type.Optional(import_typebox.Type.Enum(QsArrayFormat)),
70
- allowDots: import_typebox.Type.Optional(import_typebox.Type.Boolean())
71
- });
72
-
73
52
  // src/types/runtime-config.ts
74
- var import_typebox2 = require("@sinclair/typebox");
53
+ var import_typebox = require("@sinclair/typebox");
75
54
 
76
55
  // src/constants/file-naming-style.ts
77
56
  var FileNamingStyle = /* @__PURE__ */ ((FileNamingStyle2) => {
@@ -90,12 +69,12 @@ var FileNamingStyle = /* @__PURE__ */ ((FileNamingStyle2) => {
90
69
  })(FileNamingStyle || {});
91
70
 
92
71
  // src/types/runtime-config.ts
93
- var RuntimeConfig = import_typebox2.Type.Object({
94
- mode: import_typebox2.Type.Optional(
95
- import_typebox2.Type.Union([
96
- import_typebox2.Type.Literal("micro-function"),
97
- import_typebox2.Type.Literal("nestjs-module"),
98
- import_typebox2.Type.Literal("none")
72
+ var RuntimeConfig = import_typebox.Type.Object({
73
+ mode: import_typebox.Type.Optional(
74
+ import_typebox.Type.Union([
75
+ import_typebox.Type.Literal("micro-function"),
76
+ import_typebox.Type.Literal("nestjs-module"),
77
+ import_typebox.Type.Literal("none")
99
78
  ], { default: "micro-function" })
100
79
  ),
101
80
  /**
@@ -104,29 +83,35 @@ var RuntimeConfig = import_typebox2.Type.Object({
104
83
  * If not specified, the module system will be inferred from the nearest package.json "type" field
105
84
  * or defaults to "cjs" if no package.json is found.
106
85
  */
107
- esm: import_typebox2.Type.Optional(import_typebox2.Type.Boolean({ default: false })),
86
+ esm: import_typebox.Type.Optional(import_typebox.Type.Boolean({ default: false })),
108
87
  /**
109
88
  * Output directory for generated files
110
89
  */
111
- outdir: import_typebox2.Type.String({ default: `${process.cwd()}/api` }),
90
+ outdir: import_typebox.Type.String({ default: `${process.cwd()}/api` }),
112
91
  /**
113
92
  * File naming style for generated files
114
93
  */
115
- fileNamingStyle: import_typebox2.Type.Enum(FileNamingStyle, { default: "snakeCase" /* snakeCase */ }),
116
- modules: import_typebox2.Type.Record(import_typebox2.Type.String(), import_typebox2.Type.String()),
117
- operationIdFactory: import_typebox2.Type.Optional(import_typebox2.Type.Function([import_typebox2.Type.Any()], import_typebox2.Type.String())),
118
- qs: import_typebox2.Type.Optional(import_typebox2.Type.Union([
119
- Qs,
120
- import_typebox2.Type.Function([import_typebox2.Type.Any()], Qs)
121
- ])),
122
- debug: import_typebox2.Type.Optional(import_typebox2.Type.Boolean({ default: false })),
94
+ fileNamingStyle: import_typebox.Type.Enum(FileNamingStyle, { default: "snakeCase" /* snakeCase */ }),
95
+ modules: import_typebox.Type.Record(import_typebox.Type.String(), import_typebox.Type.String()),
96
+ debug: import_typebox.Type.Optional(import_typebox.Type.Boolean({ default: false })),
123
97
  /**
124
98
  * Whether to tolerate wrong openapi/swagger structure
125
99
  */
126
- tolerant: import_typebox2.Type.Optional(import_typebox2.Type.Boolean({ default: false })),
127
- plugins: import_typebox2.Type.Optional(import_typebox2.Type.Array(import_typebox2.Type.Any(), { default: [] }))
100
+ tolerant: import_typebox.Type.Optional(import_typebox.Type.Boolean({ default: false })),
101
+ plugins: import_typebox.Type.Optional(import_typebox.Type.Array(import_typebox.Type.Any(), { default: [] }))
128
102
  });
129
103
 
104
+ // src/constants/qs-array-format.ts
105
+ var QsArrayFormat = /* @__PURE__ */ ((QsArrayFormat2) => {
106
+ QsArrayFormat2["brackets"] = "brackets";
107
+ QsArrayFormat2["indices"] = "indices";
108
+ QsArrayFormat2["repeat"] = "repeat";
109
+ QsArrayFormat2["comma"] = "comma";
110
+ QsArrayFormat2["space"] = "space";
111
+ QsArrayFormat2["pipe"] = "pipe";
112
+ return QsArrayFormat2;
113
+ })(QsArrayFormat || {});
114
+
130
115
  // src/constants/supported-methods.ts
131
116
  var SupportedMethods = [
132
117
  "get",
@@ -314,20 +299,13 @@ function main(compiler, options) {
314
299
  await import_fs_extra2.default.ensureDir(".keq");
315
300
  rc.debug = true;
316
301
  }
317
- if (options?.tolerant) {
318
- rc.tolerant = true;
319
- }
302
+ rc.tolerant = Boolean(rc.tolerant);
320
303
  const packageJsonInfo = findNearestPackageJson();
321
304
  if (packageJsonInfo) {
322
305
  const moduleSystem = getProjectModuleSystem(packageJsonInfo);
323
306
  rc.esm = moduleSystem === "esm";
324
307
  }
325
308
  context.rc = rc;
326
- if (rc.plugins && rc.plugins.length) {
327
- for (const plugin of rc.plugins) {
328
- plugin.apply(compiler);
329
- }
330
- }
331
309
  let matcher = new IgnoreMatcher([]);
332
310
  if (result.filepath) {
333
311
  const ignoreFilepath = import_path.default.resolve(import_path.default.dirname(result.filepath), ".keqignore");
@@ -376,12 +354,6 @@ var import_openapi_parser2 = require("@scalar/openapi-parser");
376
354
  // src/models/artifact.ts
377
355
  var path3 = __toESM(require("path"), 1);
378
356
 
379
- // src/models/utils/to-comment.ts
380
- function toComment(msg) {
381
- if (!msg) return "";
382
- return msg.split("\n").map((str) => `// ${str}`).join("\n");
383
- }
384
-
385
357
  // src/models/anchor.ts
386
358
  var AnchorBlock = class {
387
359
  constructor(artifact) {
@@ -460,7 +432,6 @@ var HeaderComment = [
460
432
  var Artifact = class {
461
433
  id;
462
434
  filepath;
463
- warns = [];
464
435
  content;
465
436
  extensionName;
466
437
  anchor = new Anchor(this);
@@ -473,20 +444,8 @@ var Artifact = class {
473
444
  get dirname() {
474
445
  return path3.dirname(this.filepath);
475
446
  }
476
- addWarn(message) {
477
- this.warns.push(message);
478
- }
479
447
  renderer() {
480
- let $warns = "";
481
- if (this.warns.length) {
482
- $warns = toComment([
483
- "!!! Here is some Problems !!!",
484
- "",
485
- this.warns
486
- ].join("\n"));
487
- $warns += "\n\n";
488
- }
489
- return `${HeaderComment}${$warns}${this.content}`;
448
+ return `${HeaderComment}${this.content}`;
490
449
  }
491
450
  };
492
451
 
@@ -685,7 +644,6 @@ var logger = {
685
644
  };
686
645
 
687
646
  // src/models/api-document_v3_1.ts
688
- var import_openapi_shaking = require("@opendoc/openapi-shaking");
689
647
  var ApiDocumentV3_1 = class _ApiDocumentV3_1 {
690
648
  module;
691
649
  specification;
@@ -728,31 +686,6 @@ var ApiDocumentV3_1 = class _ApiDocumentV3_1 {
728
686
  }
729
687
  return false;
730
688
  }
731
- sharking(filter2) {
732
- const isAccepted = (pathname, method, operation) => {
733
- if (!SupportedMethods.includes(method)) return false;
734
- const operationDefinition = new OperationDefinition({
735
- method,
736
- pathname,
737
- operation,
738
- module: this.module,
739
- document: this
740
- });
741
- return filter2(operationDefinition);
742
- };
743
- const sharkedSwagger = (0, import_openapi_shaking.openapiShakingSync)(
744
- this.specification,
745
- isAccepted,
746
- { tolerant: true }
747
- );
748
- return new _ApiDocumentV3_1(
749
- sharkedSwagger,
750
- new ModuleDefinition(
751
- this.module.name,
752
- `file://${this.module.name}.v3_1.sharked.json`
753
- )
754
- );
755
- }
756
689
  static unknown() {
757
690
  return new _ApiDocumentV3_1({}, ModuleDefinition.unknown());
758
691
  }
@@ -890,25 +823,6 @@ function dereferenceOperation(swagger) {
890
823
  return removeUndefinedRef(shadow);
891
824
  }
892
825
 
893
- // src/utils/openapi-utils/update-operation-id.ts
894
- var R9 = __toESM(require("ramda"), 1);
895
- function updateOperationId(swagger, fn) {
896
- const shadow = R9.clone(swagger);
897
- for (const [pathname, pathItem] of Object.entries(shadow.paths || {})) {
898
- for (const m in pathItem) {
899
- const method = m.toLowerCase();
900
- if (!SupportedMethods.includes(method)) continue;
901
- if (typeof pathItem[m] !== "object" || Array.isArray(pathItem[m]) || pathItem[m] === null) continue;
902
- const operation = pathItem[m];
903
- const operationId = fn(method, pathname, operation);
904
- if (typeof operationId === "string" && operationId.length > 0) {
905
- operation.operationId = operationId;
906
- }
907
- }
908
- }
909
- return shadow;
910
- }
911
-
912
826
  // src/utils/json-schema-utils/is-array.ts
913
827
  function isArray(schema) {
914
828
  return schema.type === "array";
@@ -964,6 +878,31 @@ function To3_1(openapi) {
964
878
  return specification;
965
879
  }
966
880
 
881
+ // src/utils/openapi-utils/map-operation.ts
882
+ var R9 = __toESM(require("ramda"), 1);
883
+ function mapOperation(specification, mapper) {
884
+ const shadow = R9.clone(specification);
885
+ for (const [pathname, pathItem] of Object.entries(shadow.paths || {})) {
886
+ for (const m in pathItem) {
887
+ const method = m.toLowerCase();
888
+ if (!SupportedMethods.includes(method)) continue;
889
+ if (typeof pathItem[m] !== "object" || Array.isArray(pathItem[m]) || pathItem[m] === null) continue;
890
+ const operation = pathItem[m];
891
+ pathItem[m] = mapper(method, pathname, operation);
892
+ }
893
+ }
894
+ return shadow;
895
+ }
896
+
897
+ // src/utils/openapi-utils/map-parameter.ts
898
+ function mapParameter(specification, mapper) {
899
+ return mapOperation(specification, (method, pathname, operation) => {
900
+ if (!operation.parameters) return operation;
901
+ operation.parameters = operation.parameters.map((parameter) => mapper(method, pathname, operation, parameter));
902
+ return operation;
903
+ });
904
+ }
905
+
967
906
  // src/utils/openapi-utils/index.ts
968
907
  var OpenapiUtils = class {
969
908
  static isRefDefined = isRefDefined;
@@ -971,7 +910,9 @@ var OpenapiUtils = class {
971
910
  static dereferenceDeep = dereferenceDeep;
972
911
  static removeUndefinedRef = removeUndefinedRef;
973
912
  static dereferenceOperation = dereferenceOperation;
974
- static updateOperationId = updateOperationId;
913
+ static mapOperation = mapOperation;
914
+ static mapParameter = mapParameter;
915
+ // static updateOperationId = updateOperationId
975
916
  static to3_1 = To3_1;
976
917
  };
977
918
 
@@ -998,7 +939,7 @@ function main2(compiler, options) {
998
939
  if (!content) {
999
940
  throw new Exception(moduleDefinition, `Cannot download document from ${moduleDefinition.address}`);
1000
941
  }
1001
- let spec = JSON.parse(content);
942
+ const spec = JSON.parse(content);
1002
943
  const { valid, errors } = await (0, import_openapi_parser2.validate)(spec);
1003
944
  if (!valid) {
1004
945
  const message = `${moduleDefinition.name} module openapi/swagger file does not conform to the openapi specifications or have grammatical errors, which may cause unexpected errors:
@@ -1006,14 +947,6 @@ ${errors?.map((e) => ` - ${e.message}`).join("\n")}`;
1006
947
  task2.output = message;
1007
948
  }
1008
949
  OpenapiUtils.dereferenceOperation(spec);
1009
- const rc2 = context.rc;
1010
- if (rc2?.operationIdFactory) {
1011
- const operationIdFactory = rc2.operationIdFactory;
1012
- spec = OpenapiUtils.updateOperationId(
1013
- spec,
1014
- (method, pathname, operation) => operationIdFactory({ method, pathname, operation, module: moduleDefinition })
1015
- );
1016
- }
1017
950
  const document = new ApiDocumentV3_1(
1018
951
  spec,
1019
952
  moduleDefinition
@@ -1257,7 +1190,7 @@ function perfectErrorMessage() {
1257
1190
  // src/plugins/eslint/index.ts
1258
1191
  var import_eslint = require("eslint");
1259
1192
 
1260
- // src/plugins/prettier/index.ts
1193
+ // src/plugins/prettier/prettier.plugin.ts
1261
1194
  var import_child_process = require("child_process");
1262
1195
  var import_util = require("util");
1263
1196
  var execAsync = (0, import_util.promisify)(import_child_process.exec);
@@ -1539,7 +1472,12 @@ var DeclarationRenderer2 = class {
1539
1472
  }
1540
1473
  const $responses = Object.entries(operation.responses).map(([statusCode, response]) => {
1541
1474
  if (!JsonSchemaUtils.isRef(response)) {
1542
- const $value = Object.values(response.content || {}).map((mediaTypeObject) => mediaTypeObject.schema).filter((schema) => !!schema).map((schema) => JsonSchemaTransformer.toDeclaration(schema, options)).join(" | ");
1475
+ const $value = Object.entries(response.content || {}).map(([mediaType, mediaTypeObject]) => [mediaType, mediaTypeObject.schema]).map(([mediaType, schema]) => {
1476
+ if (mediaType.includes("text/event-stream")) return "ReadableStream<ServerSentEvent>";
1477
+ if (mediaType.includes("multipart/form-data")) return "FormData";
1478
+ if (!schema) return "unknown";
1479
+ return JsonSchemaTransformer.toDeclaration(schema, options);
1480
+ }).join(" | ");
1543
1481
  return indent(2, `${statusCode}: ${$value || "void"}`);
1544
1482
  }
1545
1483
  }).join("\n");
@@ -1621,7 +1559,7 @@ var DeclarationRenderer2 = class {
1621
1559
  return `import type { ${schemaName} as ${alias(schemaName)} } from "${filepath}"`;
1622
1560
  }).map((str) => str.replace(/ from "(\.\.?\/.+?)(\.ts|\.mts|\.cts|\.js|\.cjs|\.mjs)?"/, this.options.esm ? ' from "$1.js"' : ' from "$1"'));
1623
1561
  return [
1624
- 'import type { KeqOperation, KeqPathParameterInit, KeqQueryInit } from "keq"',
1562
+ 'import type { KeqOperation, KeqPathParameterInit, KeqQueryInit, ServerSentEvent } from "keq"',
1625
1563
  ...$schemaDefinitions
1626
1564
  ].join("\n");
1627
1565
  }
@@ -1687,7 +1625,7 @@ var DeclarationRenderer2 = class {
1687
1625
  // src/transformers/operation-definition/micro-function.renderer.ts
1688
1626
  var R17 = __toESM(require("ramda"), 1);
1689
1627
 
1690
- // src/transformers/operation-definition/typescript-helper.ts
1628
+ // src/transformers/operation-definition/typescript-snippet.ts
1691
1629
  var R16 = __toESM(require("ramda"), 1);
1692
1630
  var OperationDefinitionSnippet = class {
1693
1631
  constructor(operationDefinition, options) {
@@ -1697,27 +1635,42 @@ var OperationDefinitionSnippet = class {
1697
1635
  }
1698
1636
  typeName;
1699
1637
  getQsParameters(parameter) {
1700
- if (typeof this.options.qs === "function") {
1701
- return this.options.qs(parameter);
1702
- } else if (typeof this.options.qs === "object") {
1703
- return this.options.qs;
1704
- }
1638
+ let arrayFormat;
1639
+ let allowDots;
1640
+ let indices;
1705
1641
  const style = parameter.style || "form";
1706
1642
  const explode = parameter.explode ?? true;
1707
- if (style === "deepObject") {
1708
- return { arrayFormat: "brackets" };
1709
- } else if (explode) {
1710
- return { arrayFormat: "repeat" };
1643
+ if ("x-qs-array-format" in parameter) {
1644
+ arrayFormat = parameter["x-qs-array-format"];
1711
1645
  } else {
1712
- if (style === "form") {
1713
- return { arrayFormat: "comma" };
1714
- } else if (style === "spaceDelimited") {
1715
- return { arrayFormat: "space" };
1716
- } else if (style === "pipeDelimited") {
1717
- return { arrayFormat: "pipe" };
1646
+ if (style === "deepObject") {
1647
+ arrayFormat = "brackets" /* brackets */;
1648
+ } else if (explode) {
1649
+ arrayFormat = "repeat" /* repeat */;
1650
+ } else {
1651
+ if (style === "form") {
1652
+ arrayFormat = "comma" /* comma */;
1653
+ } else if (style === "spaceDelimited") {
1654
+ arrayFormat = "space" /* space */;
1655
+ } else if (style === "pipeDelimited") {
1656
+ arrayFormat = "pipe" /* pipe */;
1657
+ }
1718
1658
  }
1719
1659
  }
1720
- return {};
1660
+ if ("x-qs-allow-dots" in parameter) {
1661
+ allowDots = Boolean(parameter["x-qs-allow-dots"]);
1662
+ }
1663
+ if ("x-qs-indices" in parameter) {
1664
+ indices = Boolean(parameter["x-qs-indices"]);
1665
+ }
1666
+ if (arrayFormat || allowDots !== void 0 || indices !== void 0) {
1667
+ return {
1668
+ ...arrayFormat ? { arrayFormat } : {},
1669
+ ...allowDots !== void 0 ? { allowDots } : {},
1670
+ ...indices !== void 0 ? { indices } : {}
1671
+ };
1672
+ }
1673
+ return void 0;
1721
1674
  }
1722
1675
  // render: "if (args && 'Authorization' in args) req.header('Authorization', args['Authorization'])"
1723
1676
  renderRequestHeaders() {
@@ -2033,8 +1986,7 @@ var NestjsClientRenderer = class {
2033
1986
  const moduleName = changeCase2.pascalCase(this.document.module.name);
2034
1987
  const $dependencies = this.renderDependencies();
2035
1988
  const $operations = this.document.operations.map((operation) => OperationDefinitionTransformer.toNestjsMethod(operation, {
2036
- esm: this.options.esm,
2037
- qs: this.options.qs
1989
+ esm: this.options.esm
2038
1990
  })).join("\n\n");
2039
1991
  return [
2040
1992
  "/* @anchor:file:start */",
@@ -2421,7 +2373,6 @@ var MicroFunctionGenerator = class _MicroFunctionGenerator {
2421
2373
  id: _MicroFunctionGenerator.getOperationDefinitionArtifactId(operationDefinition),
2422
2374
  filepath,
2423
2375
  content: OperationDefinitionTransformer.toMicroFunction(operationDefinition, {
2424
- qs: rc.qs,
2425
2376
  esm: rc.esm,
2426
2377
  getOperationDefinitionDeclarationFilepath(operationDefinition2) {
2427
2378
  const relativePath = path10.relative(
@@ -2546,7 +2497,6 @@ var NestjsModuleGenerator = class _NestjsModuleGenerator {
2546
2497
  filepath,
2547
2498
  content: ApiDocumentTransformer.toNestjsClient(document, {
2548
2499
  esm: rc.esm,
2549
- qs: rc.qs,
2550
2500
  getOperationDefinitionDeclarationFilepath(operationDefinition) {
2551
2501
  const relativePath = path11.relative(
2552
2502
  dirpath,
@@ -2683,7 +2633,7 @@ var DownloadLocalFilePlugin = class _DownloadLocalFilePlugin {
2683
2633
  };
2684
2634
 
2685
2635
  // src/plugins/shaking/shaking.plugin.ts
2686
- var import_openapi_shaking2 = require("@opendoc/openapi-shaking");
2636
+ var import_openapi_shaking = require("@opendoc/openapi-shaking");
2687
2637
  var ShakingPlugin = class _ShakingPlugin {
2688
2638
  apply(compiler) {
2689
2639
  compiler.hooks.beforeCompile.tap(_ShakingPlugin.name, (task) => {
@@ -2693,6 +2643,7 @@ var ShakingPlugin = class _ShakingPlugin {
2693
2643
  });
2694
2644
  }
2695
2645
  shaking(compiler, document) {
2646
+ const rc = compiler.context.rc;
2696
2647
  const matcher = compiler.context.matcher;
2697
2648
  const isAccepted = (pathname, method, operation) => {
2698
2649
  if (!SupportedMethods.includes(method)) return false;
@@ -2704,10 +2655,10 @@ var ShakingPlugin = class _ShakingPlugin {
2704
2655
  document
2705
2656
  }));
2706
2657
  };
2707
- const sharkedSwagger = (0, import_openapi_shaking2.openapiShakingSync)(
2658
+ const sharkedSwagger = (0, import_openapi_shaking.openapiShakingSync)(
2708
2659
  document.specification,
2709
2660
  isAccepted,
2710
- { tolerant: true }
2661
+ { tolerant: rc.tolerant }
2711
2662
  );
2712
2663
  return new ApiDocumentV3_1(
2713
2664
  sharkedSwagger,
@@ -2801,6 +2752,11 @@ var InitializePlugin = class _InitializePlugin {
2801
2752
  } else if (rc.mode === "nestjs-module") {
2802
2753
  new GenerateNestjsModulePlugin().apply(compiler);
2803
2754
  }
2755
+ if (rc.plugins && rc.plugins.length) {
2756
+ for (const plugin of rc.plugins) {
2757
+ plugin.apply(compiler);
2758
+ }
2759
+ }
2804
2760
  });
2805
2761
  if (this.options.includes && this.options.includes.length) {
2806
2762
  const modulesIncludes = this.options.includes;
@@ -2826,6 +2782,9 @@ var InitializePlugin = class _InitializePlugin {
2826
2782
  }
2827
2783
  };
2828
2784
 
2785
+ // src/plugins/overwrite-query-options/overwrite-query-options.plugin.ts
2786
+ var QsArrayFormatUnion = Object.values(QsArrayFormat);
2787
+
2829
2788
  // src/compiler/compiler.ts
2830
2789
  var Compiler = class {
2831
2790
  constructor(options) {