@povio/openapi-codegen-cli 2.0.8-rc.8 → 2.0.8-rc.9
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as writeGenerateFileData, n as DEFAULT_GENERATE_OPTIONS, o as deepMerge, t as generateCodeFromOpenAPIDoc, x as Profiler } from "./generateCodeFromOpenAPIDoc-BOjk_Ey8.mjs";
|
|
2
2
|
import fs from "fs";
|
|
3
3
|
import path from "path";
|
|
4
4
|
import SwaggerParser from "@apidevtools/swagger-parser";
|
package/dist/{generateCodeFromOpenAPIDoc-B5lnFNGB.mjs → generateCodeFromOpenAPIDoc-BOjk_Ey8.mjs}
RENAMED
|
@@ -606,79 +606,6 @@ const CASL_ABILITY_IMPORT = {
|
|
|
606
606
|
from: "@casl/ability"
|
|
607
607
|
};
|
|
608
608
|
|
|
609
|
-
//#endregion
|
|
610
|
-
//#region src/generators/const/options.const.ts
|
|
611
|
-
const DEFAULT_GENERATE_OPTIONS = {
|
|
612
|
-
input: "http://localhost:4000/docs-json/",
|
|
613
|
-
output: "output",
|
|
614
|
-
incremental: true,
|
|
615
|
-
splitByTags: true,
|
|
616
|
-
defaultTag: "Common",
|
|
617
|
-
excludeTags: [],
|
|
618
|
-
excludePathRegex: "",
|
|
619
|
-
excludeRedundantZodSchemas: true,
|
|
620
|
-
tsNamespaces: true,
|
|
621
|
-
tsPath: "@/data",
|
|
622
|
-
importPath: "ts",
|
|
623
|
-
configs: {
|
|
624
|
-
[GenerateType.Models]: {
|
|
625
|
-
outputFileNameSuffix: "models",
|
|
626
|
-
namespaceSuffix: "Models"
|
|
627
|
-
},
|
|
628
|
-
[GenerateType.Endpoints]: {
|
|
629
|
-
outputFileNameSuffix: "api",
|
|
630
|
-
namespaceSuffix: "Api"
|
|
631
|
-
},
|
|
632
|
-
[GenerateType.Queries]: {
|
|
633
|
-
outputFileNameSuffix: "queries",
|
|
634
|
-
namespaceSuffix: "Queries"
|
|
635
|
-
},
|
|
636
|
-
[GenerateType.Acl]: {
|
|
637
|
-
outputFileNameSuffix: "acl",
|
|
638
|
-
namespaceSuffix: "Acl"
|
|
639
|
-
},
|
|
640
|
-
[GenerateType.Configs]: {
|
|
641
|
-
outputFileNameSuffix: "configs",
|
|
642
|
-
namespaceSuffix: "Configs"
|
|
643
|
-
}
|
|
644
|
-
},
|
|
645
|
-
baseUrl: "",
|
|
646
|
-
modelsOnly: false,
|
|
647
|
-
standalone: false,
|
|
648
|
-
schemaSuffix: SCHEMA_SUFFIX,
|
|
649
|
-
enumSuffix: ENUM_SUFFIX,
|
|
650
|
-
modelsInCommon: false,
|
|
651
|
-
withDefaultValues: true,
|
|
652
|
-
extractEnums: true,
|
|
653
|
-
replaceOptionalWithNullish: false,
|
|
654
|
-
restClientImportPath: "",
|
|
655
|
-
errorHandlingImportPath: "",
|
|
656
|
-
removeOperationPrefixEndingWith: "Controller_",
|
|
657
|
-
parseRequestParams: true,
|
|
658
|
-
inlineEndpoints: false,
|
|
659
|
-
inlineEndpointsExcludeModules: [],
|
|
660
|
-
queryTypesImportPath: PACKAGE_IMPORT_PATH,
|
|
661
|
-
axiosRequestConfig: false,
|
|
662
|
-
mutationEffects: true,
|
|
663
|
-
workspaceContext: false,
|
|
664
|
-
infiniteQueries: false,
|
|
665
|
-
infiniteQueryParamNames: { page: "page" },
|
|
666
|
-
infiniteQueryResponseParamNames: {
|
|
667
|
-
page: "page",
|
|
668
|
-
totalItems: "totalItems",
|
|
669
|
-
limit: "limit"
|
|
670
|
-
},
|
|
671
|
-
acl: true,
|
|
672
|
-
checkAcl: true,
|
|
673
|
-
abilityContextGenericAppAbilities: false,
|
|
674
|
-
abilityContextImportPath: "",
|
|
675
|
-
builderConfigs: false,
|
|
676
|
-
filterParamName: "filter",
|
|
677
|
-
dataResponseParamNames: ["data", "items"],
|
|
678
|
-
dynamicInputsImportPath: "@povio/ui",
|
|
679
|
-
dynamicColumnsImportPath: "@povio/ui"
|
|
680
|
-
};
|
|
681
|
-
|
|
682
609
|
//#endregion
|
|
683
610
|
//#region src/generators/utils/array.utils.ts
|
|
684
611
|
const getUniqueArray = (...arrs) => [...new Set(arrs.flat())];
|
|
@@ -1060,7 +987,7 @@ function getTagFileName(...args) {
|
|
|
1060
987
|
return `${getTagFileNameWithoutExtension(...args)}.ts`;
|
|
1061
988
|
}
|
|
1062
989
|
function getAppRestClientImportPath(options) {
|
|
1063
|
-
if (options.restClientImportPath
|
|
990
|
+
if (!options.restClientImportPath) return `${getImportPath(options)}${APP_REST_CLIENT_FILE.fileName}`;
|
|
1064
991
|
return options.restClientImportPath;
|
|
1065
992
|
}
|
|
1066
993
|
function getQueryModulesImportPath(options) {
|
|
@@ -3080,6 +3007,79 @@ function writeGenerateFileData(filesData) {
|
|
|
3080
3007
|
filesData.forEach(writeFileSync$1);
|
|
3081
3008
|
}
|
|
3082
3009
|
|
|
3010
|
+
//#endregion
|
|
3011
|
+
//#region src/generators/const/options.const.ts
|
|
3012
|
+
const DEFAULT_GENERATE_OPTIONS = {
|
|
3013
|
+
input: "http://localhost:4000/docs-json/",
|
|
3014
|
+
output: "output",
|
|
3015
|
+
incremental: true,
|
|
3016
|
+
splitByTags: true,
|
|
3017
|
+
defaultTag: "Common",
|
|
3018
|
+
excludeTags: [],
|
|
3019
|
+
excludePathRegex: "",
|
|
3020
|
+
excludeRedundantZodSchemas: true,
|
|
3021
|
+
tsNamespaces: true,
|
|
3022
|
+
tsPath: "@/data",
|
|
3023
|
+
importPath: "ts",
|
|
3024
|
+
configs: {
|
|
3025
|
+
[GenerateType.Models]: {
|
|
3026
|
+
outputFileNameSuffix: "models",
|
|
3027
|
+
namespaceSuffix: "Models"
|
|
3028
|
+
},
|
|
3029
|
+
[GenerateType.Endpoints]: {
|
|
3030
|
+
outputFileNameSuffix: "api",
|
|
3031
|
+
namespaceSuffix: "Api"
|
|
3032
|
+
},
|
|
3033
|
+
[GenerateType.Queries]: {
|
|
3034
|
+
outputFileNameSuffix: "queries",
|
|
3035
|
+
namespaceSuffix: "Queries"
|
|
3036
|
+
},
|
|
3037
|
+
[GenerateType.Acl]: {
|
|
3038
|
+
outputFileNameSuffix: "acl",
|
|
3039
|
+
namespaceSuffix: "Acl"
|
|
3040
|
+
},
|
|
3041
|
+
[GenerateType.Configs]: {
|
|
3042
|
+
outputFileNameSuffix: "configs",
|
|
3043
|
+
namespaceSuffix: "Configs"
|
|
3044
|
+
}
|
|
3045
|
+
},
|
|
3046
|
+
baseUrl: "",
|
|
3047
|
+
modelsOnly: false,
|
|
3048
|
+
standalone: false,
|
|
3049
|
+
schemaSuffix: SCHEMA_SUFFIX,
|
|
3050
|
+
enumSuffix: ENUM_SUFFIX,
|
|
3051
|
+
modelsInCommon: false,
|
|
3052
|
+
withDefaultValues: true,
|
|
3053
|
+
extractEnums: true,
|
|
3054
|
+
replaceOptionalWithNullish: false,
|
|
3055
|
+
restClientImportPath: "",
|
|
3056
|
+
errorHandlingImportPath: "",
|
|
3057
|
+
removeOperationPrefixEndingWith: "Controller_",
|
|
3058
|
+
parseRequestParams: true,
|
|
3059
|
+
inlineEndpoints: false,
|
|
3060
|
+
inlineEndpointsExcludeModules: [],
|
|
3061
|
+
queryTypesImportPath: PACKAGE_IMPORT_PATH,
|
|
3062
|
+
axiosRequestConfig: false,
|
|
3063
|
+
mutationEffects: true,
|
|
3064
|
+
workspaceContext: false,
|
|
3065
|
+
infiniteQueries: false,
|
|
3066
|
+
infiniteQueryParamNames: { page: "page" },
|
|
3067
|
+
infiniteQueryResponseParamNames: {
|
|
3068
|
+
page: "page",
|
|
3069
|
+
totalItems: "totalItems",
|
|
3070
|
+
limit: "limit"
|
|
3071
|
+
},
|
|
3072
|
+
acl: true,
|
|
3073
|
+
checkAcl: true,
|
|
3074
|
+
abilityContextGenericAppAbilities: false,
|
|
3075
|
+
abilityContextImportPath: "",
|
|
3076
|
+
builderConfigs: false,
|
|
3077
|
+
filterParamName: "filter",
|
|
3078
|
+
dataResponseParamNames: ["data", "items"],
|
|
3079
|
+
dynamicInputsImportPath: "@povio/ui",
|
|
3080
|
+
dynamicColumnsImportPath: "@povio/ui"
|
|
3081
|
+
};
|
|
3082
|
+
|
|
3083
3083
|
//#endregion
|
|
3084
3084
|
//#region src/generators/generate/generateAcl.ts
|
|
3085
3085
|
function generateAcl({ resolver, data, tag }) {
|
|
@@ -4269,9 +4269,9 @@ function renderInfiniteQuery({ resolver, endpoint, inlineEndpoints }) {
|
|
|
4269
4269
|
//#endregion
|
|
4270
4270
|
//#region src/generators/generate/generateAclCheck.ts
|
|
4271
4271
|
function generateAclCheck(resolver) {
|
|
4272
|
-
const abilityContextImportPath = resolver.options.abilityContextImportPath
|
|
4272
|
+
const abilityContextImportPath = resolver.options.abilityContextImportPath || ABILITY_CONTEXT_IMPORT.from;
|
|
4273
4273
|
const appAbilitiesImportPath = getAppAbilitiesImportPath(resolver.options);
|
|
4274
|
-
const errorHandlingImportPath = resolver.options.errorHandlingImportPath
|
|
4274
|
+
const errorHandlingImportPath = resolver.options.errorHandlingImportPath || ERROR_HANDLING_IMPORT.from;
|
|
4275
4275
|
const genericAppAbilities = resolver.options.abilityContextGenericAppAbilities ? `<${ACL_APP_ABILITIES}>` : "";
|
|
4276
4276
|
return `import { ${CASL_ABILITY_BINDING.abilityTuple} } from "@casl/ability";
|
|
4277
4277
|
import { type ${ERROR_HANDLERS.ErrorHandler}, ${ERROR_HANDLERS.SharedErrorHandler} } from "${errorHandlingImportPath}";
|
|
@@ -4338,7 +4338,7 @@ function generateQueryModules({ resolver, data }) {
|
|
|
4338
4338
|
function generateZodExtended(resolver) {
|
|
4339
4339
|
const errorHandlingImport = {
|
|
4340
4340
|
...ERROR_HANDLING_IMPORT,
|
|
4341
|
-
from: resolver.options.errorHandlingImportPath
|
|
4341
|
+
from: resolver.options.errorHandlingImportPath || ERROR_HANDLING_IMPORT.from
|
|
4342
4342
|
};
|
|
4343
4343
|
return `${renderImport(ZOD_IMPORT)}
|
|
4344
4344
|
${renderImport(errorHandlingImport)}
|
|
@@ -4519,4 +4519,4 @@ function generateCodeFromOpenAPIDoc(openApiDoc, options, profiler) {
|
|
|
4519
4519
|
}
|
|
4520
4520
|
|
|
4521
4521
|
//#endregion
|
|
4522
|
-
export { VALIDATION_ERROR_TYPE_TITLE as S, isMediaTypeAllowed as _,
|
|
4522
|
+
export { VALIDATION_ERROR_TYPE_TITLE as S, isMediaTypeAllowed as _, getDataFromOpenAPIDoc as a, formatTag as b, isQuery as c, getTagFileName as d, getTagImportPath as f, groupByType as g, GenerateType as h, writeGenerateFileData as i, getSchemaTsMetaType as l, getNamespaceName as m, DEFAULT_GENERATE_OPTIONS as n, deepMerge as o, getQueryName as p, getOutputFileName as r, isMutation as s, generateCodeFromOpenAPIDoc as t, getTsTypeBase as u, isParamMediaTypeAllowed as v, Profiler as x, invalidVariableNameCharactersToCamel as y };
|
package/dist/generator.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as isMediaTypeAllowed,
|
|
1
|
+
import { _ as isMediaTypeAllowed, a as getDataFromOpenAPIDoc, b as formatTag, c as isQuery, f as getTagImportPath, h as GenerateType, l as getSchemaTsMetaType, m as getNamespaceName, n as DEFAULT_GENERATE_OPTIONS, p as getQueryName, s as isMutation, t as generateCodeFromOpenAPIDoc, u as getTsTypeBase, v as isParamMediaTypeAllowed, y as invalidVariableNameCharactersToCamel } from "./generateCodeFromOpenAPIDoc-BOjk_Ey8.mjs";
|
|
2
2
|
import SwaggerParser from "@apidevtools/swagger-parser";
|
|
3
3
|
|
|
4
4
|
//#region src/generators/core/getMetadataFromOpenAPIDoc.ts
|
package/dist/sh.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { S as VALIDATION_ERROR_TYPE_TITLE,
|
|
3
|
-
import { n as resolveConfig, t as runGenerate } from "./generate.runner-
|
|
2
|
+
import { S as VALIDATION_ERROR_TYPE_TITLE, a as getDataFromOpenAPIDoc, d as getTagFileName, g as groupByType, h as GenerateType, r as getOutputFileName, x as Profiler } from "./generateCodeFromOpenAPIDoc-BOjk_Ey8.mjs";
|
|
3
|
+
import { n as resolveConfig, t as runGenerate } from "./generate.runner-CSqX4Uw7.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import yargs from "yargs";
|
|
6
6
|
import { hideBin } from "yargs/helpers";
|
|
@@ -39,7 +39,7 @@ function logBanner(message) {
|
|
|
39
39
|
* Fetch the version from package.json
|
|
40
40
|
*/
|
|
41
41
|
function getVersion() {
|
|
42
|
-
return "2.0.8-rc.
|
|
42
|
+
return "2.0.8-rc.9";
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
//#endregion
|
package/dist/vite.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { x as Profiler } from "./generateCodeFromOpenAPIDoc-
|
|
2
|
-
import { t as runGenerate } from "./generate.runner-
|
|
1
|
+
import { x as Profiler } from "./generateCodeFromOpenAPIDoc-BOjk_Ey8.mjs";
|
|
2
|
+
import { t as runGenerate } from "./generate.runner-CSqX4Uw7.mjs";
|
|
3
3
|
import path from "path";
|
|
4
4
|
|
|
5
5
|
//#region src/vite/openapi-codegen.plugin.ts
|