@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.
- package/CHANGELOG.md +15 -0
- package/dist/cli.cjs +111 -150
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +111 -150
- package/dist/cli.js.map +1 -1
- package/dist/compiler/tasks/download/index.d.ts.map +1 -1
- package/dist/compiler/tasks/setup/index.d.ts.map +1 -1
- package/dist/index.cjs +109 -150
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +109 -150
- package/dist/index.js.map +1 -1
- package/dist/models/api-document_v3_1.d.ts +0 -1
- package/dist/models/api-document_v3_1.d.ts.map +1 -1
- package/dist/models/artifact.d.ts +0 -2
- package/dist/models/artifact.d.ts.map +1 -1
- package/dist/plugins/generate-micro-function/generators/micro_function/micro-function.generator.d.ts.map +1 -1
- package/dist/plugins/generate-nestjs-module/generators/nestjs-module.generator.d.ts.map +1 -1
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/initialize/initialize.plugin.d.ts.map +1 -1
- package/dist/plugins/overwrite-operation-id/index.d.ts +2 -0
- package/dist/plugins/overwrite-operation-id/index.d.ts.map +1 -0
- package/dist/plugins/overwrite-operation-id/overwrite-operation-id.plugin.d.ts +20 -0
- package/dist/plugins/overwrite-operation-id/overwrite-operation-id.plugin.d.ts.map +1 -0
- package/dist/plugins/overwrite-query-options/index.d.ts +2 -0
- package/dist/plugins/overwrite-query-options/index.d.ts.map +1 -0
- package/dist/plugins/overwrite-query-options/overwrite-query-options.plugin.d.ts +18 -0
- package/dist/plugins/overwrite-query-options/overwrite-query-options.plugin.d.ts.map +1 -0
- package/dist/plugins/prettier/index.d.ts +1 -5
- package/dist/plugins/prettier/index.d.ts.map +1 -1
- package/dist/plugins/prettier/prettier.plugin.d.ts +6 -0
- package/dist/plugins/prettier/prettier.plugin.d.ts.map +1 -0
- package/dist/plugins/shaking/shaking.plugin.d.ts.map +1 -1
- package/dist/plugins.cjs +172 -93
- package/dist/plugins.cjs.map +1 -1
- package/dist/plugins.js +170 -93
- package/dist/plugins.js.map +1 -1
- package/dist/transformers/api-document/nestjs-client.renderer.d.ts +0 -3
- package/dist/transformers/api-document/nestjs-client.renderer.d.ts.map +1 -1
- package/dist/transformers/operation-definition/declaration.renderer.d.ts.map +1 -1
- package/dist/transformers/operation-definition/micro-function.renderer.d.ts +1 -1
- package/dist/transformers/operation-definition/micro-function.renderer.d.ts.map +1 -1
- package/dist/transformers/operation-definition/nestjs-method.renderer.d.ts +1 -1
- package/dist/transformers/operation-definition/nestjs-method.renderer.d.ts.map +1 -1
- package/dist/transformers/operation-definition/{typescript-helper.d.ts → typescript-snippet.d.ts} +1 -4
- package/dist/transformers/operation-definition/typescript-snippet.d.ts.map +1 -0
- package/dist/types/index.d.ts +0 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/runtime-config.d.ts +1 -17
- package/dist/types/runtime-config.d.ts.map +1 -1
- package/dist/utils/openapi-utils/index.d.ts +4 -2
- package/dist/utils/openapi-utils/index.d.ts.map +1 -1
- package/dist/utils/openapi-utils/map-operation.d.ts +4 -0
- package/dist/utils/openapi-utils/map-operation.d.ts.map +1 -0
- package/dist/utils/openapi-utils/map-parameter.d.ts +4 -0
- package/dist/utils/openapi-utils/map-parameter.d.ts.map +1 -0
- package/package.json +3 -3
- package/dist/transformers/operation-definition/typescript-helper.d.ts.map +0 -1
- package/dist/types/operation-id-factory.d.ts +0 -10
- package/dist/types/operation-id-factory.d.ts.map +0 -1
- package/dist/types/qs.d.ts +0 -9
- package/dist/types/qs.d.ts.map +0 -1
- package/dist/utils/openapi-utils/update-operation-id.d.ts +0 -5
- package/dist/utils/openapi-utils/update-operation-id.d.ts.map +0 -1
|
@@ -11,7 +11,6 @@ export declare class ApiDocumentV3_1 {
|
|
|
11
11
|
isEmpty(): boolean;
|
|
12
12
|
dereference($ref: string): SchemaDefinition | undefined;
|
|
13
13
|
isRefDefined($ref: string): boolean;
|
|
14
|
-
sharking(filter: (operationDefinition: OperationDefinition) => boolean): ApiDocumentV3_1;
|
|
15
14
|
static unknown(): ApiDocumentV3_1;
|
|
16
15
|
}
|
|
17
16
|
//# sourceMappingURL=api-document_v3_1.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-document_v3_1.d.ts","sourceRoot":"","sources":["../../src/models/api-document_v3_1.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAEzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"api-document_v3_1.d.ts","sourceRoot":"","sources":["../../src/models/api-document_v3_1.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAEzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAIzD,qBAAa,eAAe;IAC1B,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAA;IACjC,QAAQ,CAAC,aAAa,EAAE,WAAW,CAAC,QAAQ,CAAA;gBAEhC,aAAa,EAAE,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,gBAAgB;IAKzE,IAAI,OAAO,IAAI,gBAAgB,EAAE,CAUhC;IAED,IAAI,UAAU,IAAI,mBAAmB,EAAE,CAatC;IAED,OAAO,IAAI,OAAO;IAIlB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS;IAQvD,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IASnC,MAAM,CAAC,OAAO,IAAI,eAAe;CAGlC"}
|
|
@@ -2,7 +2,6 @@ import { Anchor } from './anchor.js';
|
|
|
2
2
|
export declare class Artifact {
|
|
3
3
|
id: string;
|
|
4
4
|
filepath: string;
|
|
5
|
-
warns: string[];
|
|
6
5
|
content: string;
|
|
7
6
|
extensionName: any;
|
|
8
7
|
anchor: Anchor;
|
|
@@ -13,7 +12,6 @@ export declare class Artifact {
|
|
|
13
12
|
extensionName?: string;
|
|
14
13
|
});
|
|
15
14
|
get dirname(): string;
|
|
16
|
-
addWarn(message: string): void;
|
|
17
15
|
renderer(): string;
|
|
18
16
|
}
|
|
19
17
|
//# sourceMappingURL=artifact.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifact.d.ts","sourceRoot":"","sources":["../../src/models/artifact.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"artifact.d.ts","sourceRoot":"","sources":["../../src/models/artifact.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAWpC,qBAAa,QAAQ;IACnB,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,aAAa,MAAA;IACb,MAAM,SAAmB;gBAEb,OAAO,EAAE;QACnB,EAAE,EAAE,MAAM,CAAA;QACV,QAAQ,EAAE,MAAM,CAAA;QAChB,OAAO,EAAE,MAAM,CAAA;QACf,aAAa,CAAC,EAAE,MAAM,CAAA;KACvB;IAOD,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,QAAQ,IAAI,MAAM;CAGnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"micro-function.generator.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/generate-micro-function/generators/micro_function/micro-function.generator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,EAAE,SAAS,EAAiB,MAAM,kBAAkB,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAInF,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAKtD,eAAO,MAAM,wBAAwB,2BAA2B,CAAA;AAEhE,qBAAa,sBAAuB,YAAW,SAAS;IAChD,OAAO,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IA+CzE,OAAO,CAAC,mCAAmC;
|
|
1
|
+
{"version":3,"file":"micro-function.generator.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/generate-micro-function/generators/micro_function/micro-function.generator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,EAAE,SAAS,EAAiB,MAAM,kBAAkB,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAInF,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAKtD,eAAO,MAAM,wBAAwB,2BAA2B,CAAA;AAEhE,qBAAa,sBAAuB,YAAW,SAAS;IAChD,OAAO,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IA+CzE,OAAO,CAAC,mCAAmC;IAgC3C,OAAO,CAAC,0BAA0B;IAclC,MAAM,CAAC,sCAAsC,CAAC,mBAAmB,EAAE,mBAAmB,EAAE,eAAe,EAAE,eAAe,GAAG,MAAM;IAYjI,MAAM,CAAC,gCAAgC,CAAC,mBAAmB,EAAE,mBAAmB,GAAG,MAAM;IAIzF,MAAM,CAAC,6BAA6B,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,GAAG,MAAM;IASlH,MAAM,CAAC,uBAAuB,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,MAAM;CAG3E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nestjs-module.generator.d.ts","sourceRoot":"","sources":["../../../../src/plugins/generate-nestjs-module/generators/nestjs-module.generator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE7D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,SAAS,EAAiB,MAAM,kBAAkB,CAAA;AAO3D,qBAAa,qBAAsB,YAAW,SAAS;IACrD,OAAO,CAAC,4BAA4B;IAuBpC,OAAO,CAAC,4BAA4B;
|
|
1
|
+
{"version":3,"file":"nestjs-module.generator.d.ts","sourceRoot":"","sources":["../../../../src/plugins/generate-nestjs-module/generators/nestjs-module.generator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE7D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,SAAS,EAAiB,MAAM,kBAAkB,CAAA;AAO3D,qBAAa,qBAAsB,YAAW,SAAS;IACrD,OAAO,CAAC,4BAA4B;IAuBpC,OAAO,CAAC,4BAA4B;IAuB9B,OAAO,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAwBzE,MAAM,CAAC,+BAA+B,CAAC,QAAQ,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,GAAG,MAAM;IAY3G,MAAM,CAAC,yBAAyB,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM;IAInE,MAAM,CAAC,+BAA+B,CAAC,QAAQ,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,GAAG,MAAM;IAY3G,MAAM,CAAC,yBAAyB,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM;CAGpE"}
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -10,4 +10,6 @@ export * from './download-local-file/index.js';
|
|
|
10
10
|
export * from './shaking/index.js';
|
|
11
11
|
export * from './terminal-select/index.js';
|
|
12
12
|
export * from './initialize/index.js';
|
|
13
|
+
export * from './overwrite-operation-id/index.js';
|
|
14
|
+
export * from './overwrite-query-options/index.js';
|
|
13
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,0BAA0B,CAAA;AACxC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,oCAAoC,CAAA;AAClD,cAAc,mCAAmC,CAAA;AACjD,cAAc,8BAA8B,CAAA;AAC5C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,oBAAoB,CAAA;AAClC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,uBAAuB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,0BAA0B,CAAA;AACxC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,oCAAoC,CAAA;AAClD,cAAc,mCAAmC,CAAA;AACjD,cAAc,8BAA8B,CAAA;AAC5C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,oBAAoB,CAAA;AAClC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,uBAAuB,CAAA;AACrC,cAAc,mCAAmC,CAAA;AACjD,cAAc,oCAAoC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.plugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/initialize/initialize.plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAK1C,OAAO,EAAwB,2BAA2B,EAAE,MAAM,6BAA6B,CAAA;AAK/F,UAAU,uBAAuB;IAC/B,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,WAAW,CAAC,EAAE,OAAO,GAAG,2BAA2B,CAAA;IAEnD,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CACpB;AAED,qBAAa,gBAAiB,YAAW,MAAM;IACjC,OAAO,CAAC,OAAO;gBAAP,OAAO,EAAE,uBAAuB;IAGpD,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"initialize.plugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/initialize/initialize.plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAK1C,OAAO,EAAwB,2BAA2B,EAAE,MAAM,6BAA6B,CAAA;AAK/F,UAAU,uBAAuB;IAC/B,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,WAAW,CAAC,EAAE,OAAO,GAAG,2BAA2B,CAAA;IAEnD,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CACpB;AAED,qBAAa,gBAAiB,YAAW,MAAM;IACjC,OAAO,CAAC,OAAO;gBAAP,OAAO,EAAE,uBAAuB;IAGpD,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;CA4DhC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/overwrite-operation-id/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { OpenAPIV3_1 } from '@scalar/openapi-types';
|
|
2
|
+
import { Compiler } from '../../compiler/index.js';
|
|
3
|
+
import { ModuleDefinition } from '../../models/module-definition.js';
|
|
4
|
+
import { Plugin } from '../../types/plugin.js';
|
|
5
|
+
/**
|
|
6
|
+
* A factory function that generates an operationId for a given operation.
|
|
7
|
+
* If undefined is returned, the operationId will not be modified.
|
|
8
|
+
*/
|
|
9
|
+
export type OperationIdFactory = (context: {
|
|
10
|
+
module: ModuleDefinition;
|
|
11
|
+
method: string;
|
|
12
|
+
pathname: string;
|
|
13
|
+
operation: OpenAPIV3_1.OperationObject;
|
|
14
|
+
}) => string | undefined;
|
|
15
|
+
export declare class OverwriteOperationIdPlugin implements Plugin {
|
|
16
|
+
private readonly factory;
|
|
17
|
+
constructor(factory: OperationIdFactory);
|
|
18
|
+
apply(compiler: Compiler): void;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=overwrite-operation-id.plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overwrite-operation-id.plugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/overwrite-operation-id/overwrite-operation-id.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAG9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAI1C;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE;IACzC,MAAM,EAAE,gBAAgB,CAAA;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,WAAW,CAAC,eAAe,CAAA;CACvC,KAAK,MAAM,GAAG,SAAS,CAAA;AAGxB,qBAAa,0BAA2B,YAAW,MAAM;IAC3C,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,kBAAkB;IAExD,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;CA0BhC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/overwrite-query-options/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { OpenAPIV3_1 } from '@scalar/openapi-types';
|
|
2
|
+
import { KeqQueryOptions } from 'keq';
|
|
3
|
+
import { Compiler } from '../../compiler/index.js';
|
|
4
|
+
import { ModuleDefinition } from '../../models/index.js';
|
|
5
|
+
import { Plugin } from '../../types/plugin.js';
|
|
6
|
+
export type OverwriteQueryOptionsFactory = ((options: {
|
|
7
|
+
module: ModuleDefinition;
|
|
8
|
+
method: string;
|
|
9
|
+
pathname: string;
|
|
10
|
+
operation: OpenAPIV3_1.OperationObject;
|
|
11
|
+
parameter: OpenAPIV3_1.ParameterObject;
|
|
12
|
+
}) => KeqQueryOptions | undefined) | KeqQueryOptions;
|
|
13
|
+
export declare class OverwriteQueryOptionsPlugin implements Plugin {
|
|
14
|
+
private readonly factory;
|
|
15
|
+
constructor(factory: OverwriteQueryOptionsFactory);
|
|
16
|
+
apply(compiler: Compiler): void;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=overwrite-query-options.plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overwrite-query-options.plugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/overwrite-query-options/overwrite-query-options.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,KAAK,CAAA;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAG9C,OAAO,EAAmB,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAI1C,MAAM,MAAM,4BAA4B,GAAG,CACzC,CAAC,OAAO,EAAE;IACR,MAAM,EAAE,gBAAgB,CAAA;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,WAAW,CAAC,eAAe,CAAA;IACtC,SAAS,EAAE,WAAW,CAAC,eAAe,CAAA;CACvC,KAAK,eAAe,GAAG,SAAS,CAClC,GAAG,eAAe,CAAA;AAInB,qBAAa,2BAA4B,YAAW,MAAM;IAC5C,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,4BAA4B;IAElE,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;CA+ChC"}
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { Plugin } from '../../types/plugin.js';
|
|
3
|
-
export declare class PrettierPlugin implements Plugin {
|
|
4
|
-
apply(compiler: Compiler): void;
|
|
5
|
-
}
|
|
1
|
+
export * from './prettier.plugin.js';
|
|
6
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/prettier/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/prettier/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prettier.plugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/prettier/prettier.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAO1C,qBAAa,cAAe,YAAW,MAAM;IAC3C,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;CAWhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shaking.plugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/shaking/shaking.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAyC,MAAM,mBAAmB,CAAA;AAK1F,qBAAa,aAAc,YAAW,MAAM;IAC1C,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAY/B,OAAO,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,eAAe,GAAG,eAAe;
|
|
1
|
+
{"version":3,"file":"shaking.plugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/shaking/shaking.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAyC,MAAM,mBAAmB,CAAA;AAK1F,qBAAa,aAAc,YAAW,MAAM;IAC1C,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAY/B,OAAO,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,eAAe,GAAG,eAAe;CA+BxE"}
|
package/dist/plugins.cjs
CHANGED
|
@@ -46,6 +46,8 @@ __export(plugins_exports, {
|
|
|
46
46
|
NestjsModuleGenerator: () => NestjsModuleGenerator,
|
|
47
47
|
OPERATION_GENERATOR: () => OPERATION_GENERATOR,
|
|
48
48
|
OperationDeclarationGenerator: () => OperationDeclarationGenerator,
|
|
49
|
+
OverwriteOperationIdPlugin: () => OverwriteOperationIdPlugin,
|
|
50
|
+
OverwriteQueryOptionsPlugin: () => OverwriteQueryOptionsPlugin,
|
|
49
51
|
PrettierPlugin: () => PrettierPlugin,
|
|
50
52
|
RequestGenerator: () => RequestGenerator,
|
|
51
53
|
SCHEMA_GENERATOR: () => SCHEMA_GENERATOR,
|
|
@@ -84,7 +86,7 @@ var EslintPlugin = class _EslintPlugin {
|
|
|
84
86
|
}
|
|
85
87
|
};
|
|
86
88
|
|
|
87
|
-
// src/plugins/prettier/
|
|
89
|
+
// src/plugins/prettier/prettier.plugin.ts
|
|
88
90
|
var import_child_process = require("child_process");
|
|
89
91
|
var import_util = require("util");
|
|
90
92
|
var execAsync = (0, import_util.promisify)(import_child_process.exec);
|
|
@@ -145,12 +147,6 @@ var changeCase6 = __toESM(require("change-case"), 1);
|
|
|
145
147
|
// src/models/artifact.ts
|
|
146
148
|
var path = __toESM(require("path"), 1);
|
|
147
149
|
|
|
148
|
-
// src/models/utils/to-comment.ts
|
|
149
|
-
function toComment(msg) {
|
|
150
|
-
if (!msg) return "";
|
|
151
|
-
return msg.split("\n").map((str) => `// ${str}`).join("\n");
|
|
152
|
-
}
|
|
153
|
-
|
|
154
150
|
// src/models/anchor.ts
|
|
155
151
|
var AnchorBlock = class {
|
|
156
152
|
constructor(artifact) {
|
|
@@ -229,7 +225,6 @@ var HeaderComment = [
|
|
|
229
225
|
var Artifact = class {
|
|
230
226
|
id;
|
|
231
227
|
filepath;
|
|
232
|
-
warns = [];
|
|
233
228
|
content;
|
|
234
229
|
extensionName;
|
|
235
230
|
anchor = new Anchor(this);
|
|
@@ -242,20 +237,8 @@ var Artifact = class {
|
|
|
242
237
|
get dirname() {
|
|
243
238
|
return path.dirname(this.filepath);
|
|
244
239
|
}
|
|
245
|
-
addWarn(message) {
|
|
246
|
-
this.warns.push(message);
|
|
247
|
-
}
|
|
248
240
|
renderer() {
|
|
249
|
-
|
|
250
|
-
if (this.warns.length) {
|
|
251
|
-
$warns = toComment([
|
|
252
|
-
"!!! Here is some Problems !!!",
|
|
253
|
-
"",
|
|
254
|
-
this.warns
|
|
255
|
-
].join("\n"));
|
|
256
|
-
$warns += "\n\n";
|
|
257
|
-
}
|
|
258
|
-
return `${HeaderComment}${$warns}${this.content}`;
|
|
241
|
+
return `${HeaderComment}${this.content}`;
|
|
259
242
|
}
|
|
260
243
|
};
|
|
261
244
|
|
|
@@ -465,7 +448,6 @@ var logger = {
|
|
|
465
448
|
};
|
|
466
449
|
|
|
467
450
|
// src/models/api-document_v3_1.ts
|
|
468
|
-
var import_openapi_shaking = require("@opendoc/openapi-shaking");
|
|
469
451
|
var ApiDocumentV3_1 = class _ApiDocumentV3_1 {
|
|
470
452
|
module;
|
|
471
453
|
specification;
|
|
@@ -508,31 +490,6 @@ var ApiDocumentV3_1 = class _ApiDocumentV3_1 {
|
|
|
508
490
|
}
|
|
509
491
|
return false;
|
|
510
492
|
}
|
|
511
|
-
sharking(filter) {
|
|
512
|
-
const isAccepted = (pathname, method, operation) => {
|
|
513
|
-
if (!SupportedMethods.includes(method)) return false;
|
|
514
|
-
const operationDefinition = new OperationDefinition({
|
|
515
|
-
method,
|
|
516
|
-
pathname,
|
|
517
|
-
operation,
|
|
518
|
-
module: this.module,
|
|
519
|
-
document: this
|
|
520
|
-
});
|
|
521
|
-
return filter(operationDefinition);
|
|
522
|
-
};
|
|
523
|
-
const sharkedSwagger = (0, import_openapi_shaking.openapiShakingSync)(
|
|
524
|
-
this.specification,
|
|
525
|
-
isAccepted,
|
|
526
|
-
{ tolerant: true }
|
|
527
|
-
);
|
|
528
|
-
return new _ApiDocumentV3_1(
|
|
529
|
-
sharkedSwagger,
|
|
530
|
-
new ModuleDefinition(
|
|
531
|
-
this.module.name,
|
|
532
|
-
`file://${this.module.name}.v3_1.sharked.json`
|
|
533
|
-
)
|
|
534
|
-
);
|
|
535
|
-
}
|
|
536
493
|
static unknown() {
|
|
537
494
|
return new _ApiDocumentV3_1({}, ModuleDefinition.unknown());
|
|
538
495
|
}
|
|
@@ -897,25 +854,6 @@ function dereferenceOperation(swagger) {
|
|
|
897
854
|
return removeUndefinedRef(shadow);
|
|
898
855
|
}
|
|
899
856
|
|
|
900
|
-
// src/utils/openapi-utils/update-operation-id.ts
|
|
901
|
-
var R11 = __toESM(require("ramda"), 1);
|
|
902
|
-
function updateOperationId(swagger, fn) {
|
|
903
|
-
const shadow = R11.clone(swagger);
|
|
904
|
-
for (const [pathname, pathItem] of Object.entries(shadow.paths || {})) {
|
|
905
|
-
for (const m in pathItem) {
|
|
906
|
-
const method = m.toLowerCase();
|
|
907
|
-
if (!SupportedMethods.includes(method)) continue;
|
|
908
|
-
if (typeof pathItem[m] !== "object" || Array.isArray(pathItem[m]) || pathItem[m] === null) continue;
|
|
909
|
-
const operation = pathItem[m];
|
|
910
|
-
const operationId = fn(method, pathname, operation);
|
|
911
|
-
if (typeof operationId === "string" && operationId.length > 0) {
|
|
912
|
-
operation.operationId = operationId;
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
|
-
return shadow;
|
|
917
|
-
}
|
|
918
|
-
|
|
919
857
|
// src/utils/openapi-utils/dereference-deep.ts
|
|
920
858
|
function dereferenceDeep($ref, swagger) {
|
|
921
859
|
const stack = [$ref];
|
|
@@ -943,6 +881,31 @@ function To3_1(openapi) {
|
|
|
943
881
|
return specification;
|
|
944
882
|
}
|
|
945
883
|
|
|
884
|
+
// src/utils/openapi-utils/map-operation.ts
|
|
885
|
+
var R11 = __toESM(require("ramda"), 1);
|
|
886
|
+
function mapOperation(specification, mapper) {
|
|
887
|
+
const shadow = R11.clone(specification);
|
|
888
|
+
for (const [pathname, pathItem] of Object.entries(shadow.paths || {})) {
|
|
889
|
+
for (const m in pathItem) {
|
|
890
|
+
const method = m.toLowerCase();
|
|
891
|
+
if (!SupportedMethods.includes(method)) continue;
|
|
892
|
+
if (typeof pathItem[m] !== "object" || Array.isArray(pathItem[m]) || pathItem[m] === null) continue;
|
|
893
|
+
const operation = pathItem[m];
|
|
894
|
+
pathItem[m] = mapper(method, pathname, operation);
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
return shadow;
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
// src/utils/openapi-utils/map-parameter.ts
|
|
901
|
+
function mapParameter(specification, mapper) {
|
|
902
|
+
return mapOperation(specification, (method, pathname, operation) => {
|
|
903
|
+
if (!operation.parameters) return operation;
|
|
904
|
+
operation.parameters = operation.parameters.map((parameter) => mapper(method, pathname, operation, parameter));
|
|
905
|
+
return operation;
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
|
|
946
909
|
// src/utils/openapi-utils/index.ts
|
|
947
910
|
var OpenapiUtils = class {
|
|
948
911
|
static isRefDefined = isRefDefined;
|
|
@@ -950,7 +913,9 @@ var OpenapiUtils = class {
|
|
|
950
913
|
static dereferenceDeep = dereferenceDeep;
|
|
951
914
|
static removeUndefinedRef = removeUndefinedRef;
|
|
952
915
|
static dereferenceOperation = dereferenceOperation;
|
|
953
|
-
static
|
|
916
|
+
static mapOperation = mapOperation;
|
|
917
|
+
static mapParameter = mapParameter;
|
|
918
|
+
// static updateOperationId = updateOperationId
|
|
954
919
|
static to3_1 = To3_1;
|
|
955
920
|
};
|
|
956
921
|
|
|
@@ -969,7 +934,12 @@ var DeclarationRenderer2 = class {
|
|
|
969
934
|
}
|
|
970
935
|
const $responses = Object.entries(operation.responses).map(([statusCode, response]) => {
|
|
971
936
|
if (!JsonSchemaUtils.isRef(response)) {
|
|
972
|
-
const $value = Object.
|
|
937
|
+
const $value = Object.entries(response.content || {}).map(([mediaType, mediaTypeObject]) => [mediaType, mediaTypeObject.schema]).map(([mediaType, schema]) => {
|
|
938
|
+
if (mediaType.includes("text/event-stream")) return "ReadableStream<ServerSentEvent>";
|
|
939
|
+
if (mediaType.includes("multipart/form-data")) return "FormData";
|
|
940
|
+
if (!schema) return "unknown";
|
|
941
|
+
return JsonSchemaTransformer.toDeclaration(schema, options);
|
|
942
|
+
}).join(" | ");
|
|
973
943
|
return indent(2, `${statusCode}: ${$value || "void"}`);
|
|
974
944
|
}
|
|
975
945
|
}).join("\n");
|
|
@@ -1051,7 +1021,7 @@ var DeclarationRenderer2 = class {
|
|
|
1051
1021
|
return `import type { ${schemaName} as ${alias(schemaName)} } from "${filepath}"`;
|
|
1052
1022
|
}).map((str) => str.replace(/ from "(\.\.?\/.+?)(\.ts|\.mts|\.cts|\.js|\.cjs|\.mjs)?"/, this.options.esm ? ' from "$1.js"' : ' from "$1"'));
|
|
1053
1023
|
return [
|
|
1054
|
-
'import type { KeqOperation, KeqPathParameterInit, KeqQueryInit } from "keq"',
|
|
1024
|
+
'import type { KeqOperation, KeqPathParameterInit, KeqQueryInit, ServerSentEvent } from "keq"',
|
|
1055
1025
|
...$schemaDefinitions
|
|
1056
1026
|
].join("\n");
|
|
1057
1027
|
}
|
|
@@ -1130,8 +1100,21 @@ ${msg}`);
|
|
|
1130
1100
|
}
|
|
1131
1101
|
};
|
|
1132
1102
|
|
|
1133
|
-
// src/transformers/operation-definition/typescript-
|
|
1103
|
+
// src/transformers/operation-definition/typescript-snippet.ts
|
|
1134
1104
|
var R13 = __toESM(require("ramda"), 1);
|
|
1105
|
+
|
|
1106
|
+
// src/constants/qs-array-format.ts
|
|
1107
|
+
var QsArrayFormat = /* @__PURE__ */ ((QsArrayFormat2) => {
|
|
1108
|
+
QsArrayFormat2["brackets"] = "brackets";
|
|
1109
|
+
QsArrayFormat2["indices"] = "indices";
|
|
1110
|
+
QsArrayFormat2["repeat"] = "repeat";
|
|
1111
|
+
QsArrayFormat2["comma"] = "comma";
|
|
1112
|
+
QsArrayFormat2["space"] = "space";
|
|
1113
|
+
QsArrayFormat2["pipe"] = "pipe";
|
|
1114
|
+
return QsArrayFormat2;
|
|
1115
|
+
})(QsArrayFormat || {});
|
|
1116
|
+
|
|
1117
|
+
// src/transformers/operation-definition/typescript-snippet.ts
|
|
1135
1118
|
var OperationDefinitionSnippet = class {
|
|
1136
1119
|
constructor(operationDefinition, options) {
|
|
1137
1120
|
this.operationDefinition = operationDefinition;
|
|
@@ -1140,27 +1123,42 @@ var OperationDefinitionSnippet = class {
|
|
|
1140
1123
|
}
|
|
1141
1124
|
typeName;
|
|
1142
1125
|
getQsParameters(parameter) {
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
return this.options.qs;
|
|
1147
|
-
}
|
|
1126
|
+
let arrayFormat;
|
|
1127
|
+
let allowDots;
|
|
1128
|
+
let indices;
|
|
1148
1129
|
const style = parameter.style || "form";
|
|
1149
1130
|
const explode = parameter.explode ?? true;
|
|
1150
|
-
if (
|
|
1151
|
-
|
|
1152
|
-
} else if (explode) {
|
|
1153
|
-
return { arrayFormat: "repeat" };
|
|
1131
|
+
if ("x-qs-array-format" in parameter) {
|
|
1132
|
+
arrayFormat = parameter["x-qs-array-format"];
|
|
1154
1133
|
} else {
|
|
1155
|
-
if (style === "
|
|
1156
|
-
|
|
1157
|
-
} else if (
|
|
1158
|
-
|
|
1159
|
-
} else
|
|
1160
|
-
|
|
1134
|
+
if (style === "deepObject") {
|
|
1135
|
+
arrayFormat = "brackets" /* brackets */;
|
|
1136
|
+
} else if (explode) {
|
|
1137
|
+
arrayFormat = "repeat" /* repeat */;
|
|
1138
|
+
} else {
|
|
1139
|
+
if (style === "form") {
|
|
1140
|
+
arrayFormat = "comma" /* comma */;
|
|
1141
|
+
} else if (style === "spaceDelimited") {
|
|
1142
|
+
arrayFormat = "space" /* space */;
|
|
1143
|
+
} else if (style === "pipeDelimited") {
|
|
1144
|
+
arrayFormat = "pipe" /* pipe */;
|
|
1145
|
+
}
|
|
1161
1146
|
}
|
|
1162
1147
|
}
|
|
1163
|
-
|
|
1148
|
+
if ("x-qs-allow-dots" in parameter) {
|
|
1149
|
+
allowDots = Boolean(parameter["x-qs-allow-dots"]);
|
|
1150
|
+
}
|
|
1151
|
+
if ("x-qs-indices" in parameter) {
|
|
1152
|
+
indices = Boolean(parameter["x-qs-indices"]);
|
|
1153
|
+
}
|
|
1154
|
+
if (arrayFormat || allowDots !== void 0 || indices !== void 0) {
|
|
1155
|
+
return {
|
|
1156
|
+
...arrayFormat ? { arrayFormat } : {},
|
|
1157
|
+
...allowDots !== void 0 ? { allowDots } : {},
|
|
1158
|
+
...indices !== void 0 ? { indices } : {}
|
|
1159
|
+
};
|
|
1160
|
+
}
|
|
1161
|
+
return void 0;
|
|
1164
1162
|
}
|
|
1165
1163
|
// render: "if (args && 'Authorization' in args) req.header('Authorization', args['Authorization'])"
|
|
1166
1164
|
renderRequestHeaders() {
|
|
@@ -1476,8 +1474,7 @@ var NestjsClientRenderer = class {
|
|
|
1476
1474
|
const moduleName = changeCase2.pascalCase(this.document.module.name);
|
|
1477
1475
|
const $dependencies = this.renderDependencies();
|
|
1478
1476
|
const $operations = this.document.operations.map((operation) => OperationDefinitionTransformer.toNestjsMethod(operation, {
|
|
1479
|
-
esm: this.options.esm
|
|
1480
|
-
qs: this.options.qs
|
|
1477
|
+
esm: this.options.esm
|
|
1481
1478
|
})).join("\n\n");
|
|
1482
1479
|
return [
|
|
1483
1480
|
"/* @anchor:file:start */",
|
|
@@ -1864,7 +1861,6 @@ var MicroFunctionGenerator = class _MicroFunctionGenerator {
|
|
|
1864
1861
|
id: _MicroFunctionGenerator.getOperationDefinitionArtifactId(operationDefinition),
|
|
1865
1862
|
filepath,
|
|
1866
1863
|
content: OperationDefinitionTransformer.toMicroFunction(operationDefinition, {
|
|
1867
|
-
qs: rc.qs,
|
|
1868
1864
|
esm: rc.esm,
|
|
1869
1865
|
getOperationDefinitionDeclarationFilepath(operationDefinition2) {
|
|
1870
1866
|
const relativePath = path7.relative(
|
|
@@ -2026,7 +2022,6 @@ var NestjsModuleGenerator = class _NestjsModuleGenerator {
|
|
|
2026
2022
|
filepath,
|
|
2027
2023
|
content: ApiDocumentTransformer.toNestjsClient(document, {
|
|
2028
2024
|
esm: rc.esm,
|
|
2029
|
-
qs: rc.qs,
|
|
2030
2025
|
getOperationDefinitionDeclarationFilepath(operationDefinition) {
|
|
2031
2026
|
const relativePath = path8.relative(
|
|
2032
2027
|
dirpath,
|
|
@@ -2176,7 +2171,7 @@ var DownloadLocalFilePlugin = class _DownloadLocalFilePlugin {
|
|
|
2176
2171
|
};
|
|
2177
2172
|
|
|
2178
2173
|
// src/plugins/shaking/shaking.plugin.ts
|
|
2179
|
-
var
|
|
2174
|
+
var import_openapi_shaking = require("@opendoc/openapi-shaking");
|
|
2180
2175
|
var ShakingPlugin = class _ShakingPlugin {
|
|
2181
2176
|
apply(compiler) {
|
|
2182
2177
|
compiler.hooks.beforeCompile.tap(_ShakingPlugin.name, (task) => {
|
|
@@ -2186,6 +2181,7 @@ var ShakingPlugin = class _ShakingPlugin {
|
|
|
2186
2181
|
});
|
|
2187
2182
|
}
|
|
2188
2183
|
shaking(compiler, document) {
|
|
2184
|
+
const rc = compiler.context.rc;
|
|
2189
2185
|
const matcher = compiler.context.matcher;
|
|
2190
2186
|
const isAccepted = (pathname, method, operation) => {
|
|
2191
2187
|
if (!SupportedMethods.includes(method)) return false;
|
|
@@ -2197,10 +2193,10 @@ var ShakingPlugin = class _ShakingPlugin {
|
|
|
2197
2193
|
document
|
|
2198
2194
|
}));
|
|
2199
2195
|
};
|
|
2200
|
-
const sharkedSwagger = (0,
|
|
2196
|
+
const sharkedSwagger = (0, import_openapi_shaking.openapiShakingSync)(
|
|
2201
2197
|
document.specification,
|
|
2202
2198
|
isAccepted,
|
|
2203
|
-
{ tolerant:
|
|
2199
|
+
{ tolerant: rc.tolerant }
|
|
2204
2200
|
);
|
|
2205
2201
|
return new ApiDocumentV3_1(
|
|
2206
2202
|
sharkedSwagger,
|
|
@@ -2294,6 +2290,11 @@ var InitializePlugin = class _InitializePlugin {
|
|
|
2294
2290
|
} else if (rc.mode === "nestjs-module") {
|
|
2295
2291
|
new GenerateNestjsModulePlugin().apply(compiler);
|
|
2296
2292
|
}
|
|
2293
|
+
if (rc.plugins && rc.plugins.length) {
|
|
2294
|
+
for (const plugin of rc.plugins) {
|
|
2295
|
+
plugin.apply(compiler);
|
|
2296
|
+
}
|
|
2297
|
+
}
|
|
2297
2298
|
});
|
|
2298
2299
|
if (this.options.includes && this.options.includes.length) {
|
|
2299
2300
|
const modulesIncludes = this.options.includes;
|
|
@@ -2318,6 +2319,82 @@ var InitializePlugin = class _InitializePlugin {
|
|
|
2318
2319
|
}
|
|
2319
2320
|
}
|
|
2320
2321
|
};
|
|
2322
|
+
|
|
2323
|
+
// src/plugins/overwrite-operation-id/overwrite-operation-id.plugin.ts
|
|
2324
|
+
var OverwriteOperationIdPlugin = class _OverwriteOperationIdPlugin {
|
|
2325
|
+
constructor(factory) {
|
|
2326
|
+
this.factory = factory;
|
|
2327
|
+
}
|
|
2328
|
+
apply(compiler) {
|
|
2329
|
+
compiler.hooks.afterDownload.tap(_OverwriteOperationIdPlugin.name, () => {
|
|
2330
|
+
const documents = compiler.context.documents;
|
|
2331
|
+
const factory = this.factory;
|
|
2332
|
+
compiler.context.documents = documents.map((document) => {
|
|
2333
|
+
const spec = OpenapiUtils.mapOperation(
|
|
2334
|
+
document.specification,
|
|
2335
|
+
(method, pathname, operation) => {
|
|
2336
|
+
const operationId = factory({ method, pathname, operation, module: document.module });
|
|
2337
|
+
if (typeof operationId === "string") {
|
|
2338
|
+
if (operationId.length === 0) {
|
|
2339
|
+
throw new Exception(document.module, `The generated operationId for [${method.toUpperCase()} ${pathname}] is an empty string.`);
|
|
2340
|
+
}
|
|
2341
|
+
operation.operationId = operationId;
|
|
2342
|
+
return operation;
|
|
2343
|
+
}
|
|
2344
|
+
return operation;
|
|
2345
|
+
}
|
|
2346
|
+
);
|
|
2347
|
+
return new ApiDocumentV3_1(spec, document.module);
|
|
2348
|
+
});
|
|
2349
|
+
});
|
|
2350
|
+
}
|
|
2351
|
+
};
|
|
2352
|
+
|
|
2353
|
+
// src/plugins/overwrite-query-options/overwrite-query-options.plugin.ts
|
|
2354
|
+
var QsArrayFormatUnion = Object.values(QsArrayFormat);
|
|
2355
|
+
var OverwriteQueryOptionsPlugin = class _OverwriteQueryOptionsPlugin {
|
|
2356
|
+
constructor(factory) {
|
|
2357
|
+
this.factory = factory;
|
|
2358
|
+
}
|
|
2359
|
+
apply(compiler) {
|
|
2360
|
+
compiler.hooks.afterDownload.tap(_OverwriteQueryOptionsPlugin.name, (task) => {
|
|
2361
|
+
const documents = compiler.context.documents;
|
|
2362
|
+
const factory = this.factory;
|
|
2363
|
+
compiler.context.documents = documents.map((document) => {
|
|
2364
|
+
const specification = OpenapiUtils.mapParameter(
|
|
2365
|
+
document.specification,
|
|
2366
|
+
(method, pathname, operation, parameter) => {
|
|
2367
|
+
const qsOptions = typeof factory === "function" ? factory({ parameter, operation, pathname, method, module: document.module }) : factory;
|
|
2368
|
+
if (!qsOptions) return parameter;
|
|
2369
|
+
if (qsOptions.arrayFormat) {
|
|
2370
|
+
if (!QsArrayFormatUnion.includes(qsOptions.arrayFormat)) {
|
|
2371
|
+
throw new Exception(document.module, `The 'arrayFormat' value '${qsOptions.arrayFormat}' for the query parameter '${parameter.name}' in [${method.toUpperCase()} ${pathname}] is invalid.`);
|
|
2372
|
+
}
|
|
2373
|
+
parameter["x-qs-array-format"] = qsOptions.arrayFormat;
|
|
2374
|
+
}
|
|
2375
|
+
if (qsOptions.allowDots !== void 0) {
|
|
2376
|
+
if (typeof qsOptions.allowDots !== "boolean") {
|
|
2377
|
+
throw new Exception(document.module, `The 'allowDots' value for the query parameter '${parameter.name}' in [${method.toUpperCase()} ${pathname}] must be a boolean.`);
|
|
2378
|
+
}
|
|
2379
|
+
parameter["x-qs-allow-dots"] = Boolean(qsOptions.allowDots);
|
|
2380
|
+
}
|
|
2381
|
+
if (qsOptions.indices !== void 0) {
|
|
2382
|
+
if (typeof qsOptions.indices !== "boolean") {
|
|
2383
|
+
throw new Exception(document.module, `The 'indices' value for the query parameter '${parameter.name}' in [${method.toUpperCase()} ${pathname}] must be a boolean.`);
|
|
2384
|
+
}
|
|
2385
|
+
parameter["x-qs-indices"] = Boolean(qsOptions.indices);
|
|
2386
|
+
}
|
|
2387
|
+
return parameter;
|
|
2388
|
+
}
|
|
2389
|
+
);
|
|
2390
|
+
return new ApiDocumentV3_1(
|
|
2391
|
+
specification,
|
|
2392
|
+
document.module
|
|
2393
|
+
);
|
|
2394
|
+
});
|
|
2395
|
+
});
|
|
2396
|
+
}
|
|
2397
|
+
};
|
|
2321
2398
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2322
2399
|
0 && (module.exports = {
|
|
2323
2400
|
BodyFallbackPlugin,
|
|
@@ -2336,6 +2413,8 @@ var InitializePlugin = class _InitializePlugin {
|
|
|
2336
2413
|
NestjsModuleGenerator,
|
|
2337
2414
|
OPERATION_GENERATOR,
|
|
2338
2415
|
OperationDeclarationGenerator,
|
|
2416
|
+
OverwriteOperationIdPlugin,
|
|
2417
|
+
OverwriteQueryOptionsPlugin,
|
|
2339
2418
|
PrettierPlugin,
|
|
2340
2419
|
RequestGenerator,
|
|
2341
2420
|
SCHEMA_GENERATOR,
|