@povio/openapi-codegen-cli 3.0.0-rc.2 → 3.0.0-rc.3
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/{config-C1ME3Ay4.d.mts → config-1XCOTZ4a.d.mts} +1 -1
- package/dist/{generate.runner-BsNMtOTd.mjs → generate.runner-CioDqx6u.mjs} +1 -1
- package/dist/{generateCodeFromOpenAPIDoc-CbBWYEZG.mjs → generateCodeFromOpenAPIDoc-D-UDIQX5.mjs} +30 -7
- package/dist/generator.d.mts +1 -1
- package/dist/generator.mjs +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/{options-BPAjzilp.d.mts → options-saKmD8s1.d.mts} +10 -1
- package/dist/sh.mjs +3 -3
- package/dist/vite.d.mts +2 -2
- package/dist/vite.mjs +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as Profiler, h as deepMerge, i as writeGenerateFileData, p as DEFAULT_GENERATE_OPTIONS, r as removeStaleGeneratedFiles, t as generateCodeFromOpenAPIDoc } from "./generateCodeFromOpenAPIDoc-
|
|
1
|
+
import { S as Profiler, h as deepMerge, i as writeGenerateFileData, p as DEFAULT_GENERATE_OPTIONS, r as removeStaleGeneratedFiles, t as generateCodeFromOpenAPIDoc } from "./generateCodeFromOpenAPIDoc-D-UDIQX5.mjs";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import SwaggerParser from "@apidevtools/swagger-parser";
|
|
4
4
|
|
package/dist/{generateCodeFromOpenAPIDoc-CbBWYEZG.mjs → generateCodeFromOpenAPIDoc-D-UDIQX5.mjs}
RENAMED
|
@@ -1717,12 +1717,26 @@ function getAclImports({ tag, endpoints, options }) {
|
|
|
1717
1717
|
options
|
|
1718
1718
|
});
|
|
1719
1719
|
}
|
|
1720
|
+
function normalizeOutputPath(output) {
|
|
1721
|
+
return output.replace(/\\/g, "/").replace(/\/$/, "");
|
|
1722
|
+
}
|
|
1723
|
+
function outputMatchesTsPath(options) {
|
|
1724
|
+
const normalizedOutput = normalizeOutputPath(options.output);
|
|
1725
|
+
if (options.tsPath.startsWith("@/")) {
|
|
1726
|
+
const physicalPath = `src/${options.tsPath.slice(2)}`;
|
|
1727
|
+
return normalizedOutput === physicalPath || normalizedOutput.endsWith(`/${physicalPath}`);
|
|
1728
|
+
}
|
|
1729
|
+
return normalizedOutput === options.tsPath;
|
|
1730
|
+
}
|
|
1731
|
+
function shouldUseRelativeImports(options) {
|
|
1732
|
+
return options.importPath === "ts" && options.tsPath === "@/data" && !outputMatchesTsPath(options);
|
|
1733
|
+
}
|
|
1720
1734
|
function getImportPath(options, fromRoot = false) {
|
|
1721
|
-
|
|
1722
|
-
if (options.importPath === "
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
return `${
|
|
1735
|
+
if (options.importPath === "relative") return `${fromRoot ? "./" : "../"}`.replace(/\/\//g, "/");
|
|
1736
|
+
if (options.importPath === "absolute") return `${options.output}/`.replace(/\/\//g, "/");
|
|
1737
|
+
if (new RegExp(`${TEMPLATE_DATA_FILE_PATH}`, "g").test(options.output)) return `${options.output.replace(new RegExp(`.*${TEMPLATE_DATA_FILE_PATH}`, "g"), options.tsPath)}/`.replace(/\/\//g, "/");
|
|
1738
|
+
if (shouldUseRelativeImports(options)) return `${fromRoot ? "./" : "../"}`.replace(/\/\//g, "/");
|
|
1739
|
+
return `${options.tsPath}/`.replace(/\/\//g, "/");
|
|
1726
1740
|
}
|
|
1727
1741
|
function getImports({ type = GenerateType.Models, tag: currentTag, entities, getTag, getEntityName, options }) {
|
|
1728
1742
|
const imports = /* @__PURE__ */ new Map();
|
|
@@ -2207,9 +2221,16 @@ function getEndpointBody({ resolver, operation, operationName, isUniqueOperation
|
|
|
2207
2221
|
};
|
|
2208
2222
|
}
|
|
2209
2223
|
|
|
2224
|
+
//#endregion
|
|
2225
|
+
//#region src/generators/utils/query-filter-component-names.utils.ts
|
|
2226
|
+
function resolveQueryFilterComponentName(operationId, queryFilterComponentNames) {
|
|
2227
|
+
if (!operationId || !queryFilterComponentNames) return;
|
|
2228
|
+
return queryFilterComponentNames[operationId];
|
|
2229
|
+
}
|
|
2230
|
+
|
|
2210
2231
|
//#endregion
|
|
2211
2232
|
//#region src/generators/core/endpoints/getEndpointParameter.ts
|
|
2212
|
-
function getEndpointParameter({ resolver, param, operationName, isUniqueOperationName, tag }) {
|
|
2233
|
+
function getEndpointParameter({ resolver, param, operationName, operationId, isUniqueOperationName, tag }) {
|
|
2213
2234
|
const paramObj = resolver.resolveObject(param);
|
|
2214
2235
|
if (!ALLOWED_PATH_IN.includes(paramObj.in)) return;
|
|
2215
2236
|
let schema = {};
|
|
@@ -2222,7 +2243,8 @@ function getEndpointParameter({ resolver, param, operationName, isUniqueOperatio
|
|
|
2222
2243
|
schema = mediaTypeObject?.schema ?? mediaTypeObject;
|
|
2223
2244
|
} else if (paramObj.schema) schema = paramObj.schema;
|
|
2224
2245
|
if (resolver.options.withDescription && schema) schema.description = (paramObj.description ?? "").trim();
|
|
2225
|
-
const
|
|
2246
|
+
const zodSchemaOperationName = getZodSchemaOperationName(operationName, isUniqueOperationName, tag);
|
|
2247
|
+
const fallbackName = (paramObj.name === resolver.options.filterParamName && !isReferenceObject(schema) && resolver.options.queryFilterComponentNames ? resolveQueryFilterComponentName(operationId, resolver.options.queryFilterComponentNames) : void 0) ?? getParamZodSchemaName(zodSchemaOperationName, paramObj.name);
|
|
2226
2248
|
let parameterSortingEnumSchemaName = void 0;
|
|
2227
2249
|
if (isSortingParameterObject(paramObj)) {
|
|
2228
2250
|
const enumZodSchemaName = getEnumZodSchemaName(fallbackName, resolver.options.enumSuffix, resolver.options.schemaSuffix);
|
|
@@ -2321,6 +2343,7 @@ function getEndpointsFromOpenAPIDoc(resolver) {
|
|
|
2321
2343
|
resolver,
|
|
2322
2344
|
param,
|
|
2323
2345
|
operationName,
|
|
2346
|
+
operationId: operation.operationId,
|
|
2324
2347
|
isUniqueOperationName,
|
|
2325
2348
|
tag
|
|
2326
2349
|
});
|
package/dist/generator.d.mts
CHANGED
package/dist/generator.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as getNamespaceName, a as getDataFromOpenAPIDoc, b as isParamMediaTypeAllowed, c as getSchemaTsMetaType, d as getTagImportPath, f as getQueryName, g as invalidVariableNameCharactersToCamel, l as getTsTypeBase, o as isMutation, p as DEFAULT_GENERATE_OPTIONS, s as isQuery, t as generateCodeFromOpenAPIDoc, v as GenerateType, x as formatTag, y as isMediaTypeAllowed } from "./generateCodeFromOpenAPIDoc-
|
|
1
|
+
import { _ as getNamespaceName, a as getDataFromOpenAPIDoc, b as isParamMediaTypeAllowed, c as getSchemaTsMetaType, d as getTagImportPath, f as getQueryName, g as invalidVariableNameCharactersToCamel, l as getTsTypeBase, o as isMutation, p as DEFAULT_GENERATE_OPTIONS, s as isQuery, t as generateCodeFromOpenAPIDoc, v as GenerateType, x as formatTag, y as isMediaTypeAllowed } from "./generateCodeFromOpenAPIDoc-D-UDIQX5.mjs";
|
|
2
2
|
import SwaggerParser from "@apidevtools/swagger-parser";
|
|
3
3
|
|
|
4
4
|
//#region src/generators/core/getMetadataFromOpenAPIDoc.ts
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as GeneralErrorCodes, i as ErrorHandlerOptions, n as ErrorEntry, o as SharedErrorHandler, r as ErrorHandler, t as ApplicationException } from "./error-handling-CvW_FecB.mjs";
|
|
2
|
-
import "./options-
|
|
3
|
-
import { t as OpenAPICodegenConfig } from "./config-
|
|
2
|
+
import "./options-saKmD8s1.mjs";
|
|
3
|
+
import { t as OpenAPICodegenConfig } from "./config-1XCOTZ4a.mjs";
|
|
4
4
|
import { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse, AxiosResponseHeaders, CreateAxiosDefaults } from "axios";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
import "i18next";
|
|
@@ -72,6 +72,13 @@ interface BuilderConfigsGenerateOptions {
|
|
|
72
72
|
dynamicInputsImportPath: string;
|
|
73
73
|
dynamicColumnsImportPath: string;
|
|
74
74
|
}
|
|
75
|
+
interface QueryFilterComponentNameOptions {
|
|
76
|
+
/**
|
|
77
|
+
* Optional map of OpenAPI operationId to stable filter schema names.
|
|
78
|
+
* Used for inline `filter` query objects when migrating away from named filter DTO refs.
|
|
79
|
+
*/
|
|
80
|
+
queryFilterComponentNames?: Record<string, string>;
|
|
81
|
+
}
|
|
75
82
|
interface GenerateConfig {
|
|
76
83
|
outputFileNameSuffix: string;
|
|
77
84
|
namespaceSuffix: string;
|
|
@@ -82,6 +89,8 @@ interface BaseGenerateOptions {
|
|
|
82
89
|
clearOutput?: boolean;
|
|
83
90
|
incremental?: boolean;
|
|
84
91
|
splitByTags: boolean;
|
|
92
|
+
/** When true, non-default tags emit proxy models that re-export from CommonModels. */
|
|
93
|
+
modelsInCommon?: boolean;
|
|
85
94
|
defaultTag: string;
|
|
86
95
|
includeTags: string[];
|
|
87
96
|
excludeTags: string[];
|
|
@@ -95,6 +104,6 @@ interface BaseGenerateOptions {
|
|
|
95
104
|
modelsOnly?: boolean;
|
|
96
105
|
standalone?: boolean;
|
|
97
106
|
}
|
|
98
|
-
interface GenerateOptions extends BaseGenerateOptions, ZodGenerateOptions, EndpointsGenerateOptions, QueriesGenerateOptions, InfiniteQueriesGenerateOptions, ACLGenerateOptions, BuilderConfigsGenerateOptions {}
|
|
107
|
+
interface GenerateOptions extends BaseGenerateOptions, ZodGenerateOptions, EndpointsGenerateOptions, QueriesGenerateOptions, InfiniteQueriesGenerateOptions, ACLGenerateOptions, BuilderConfigsGenerateOptions, QueryFilterComponentNameOptions {}
|
|
99
108
|
//#endregion
|
|
100
109
|
export { GenerateFileData as n, GenerateFileFormatter as r, GenerateOptions as t };
|
package/dist/sh.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { C as VALIDATION_ERROR_TYPE_TITLE, S as Profiler, a as getDataFromOpenAPIDoc, m as groupByType, n as getOutputFileName, u as getTagFileName, v as GenerateType } from "./generateCodeFromOpenAPIDoc-
|
|
3
|
-
import { n as resolveConfig, t as runGenerate } from "./generate.runner-
|
|
2
|
+
import { C as VALIDATION_ERROR_TYPE_TITLE, S as Profiler, a as getDataFromOpenAPIDoc, m as groupByType, n as getOutputFileName, u as getTagFileName, v as GenerateType } from "./generateCodeFromOpenAPIDoc-D-UDIQX5.mjs";
|
|
3
|
+
import { n as resolveConfig, t as runGenerate } from "./generate.runner-CioDqx6u.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 "3.0.0-rc.
|
|
42
|
+
return "3.0.0-rc.3";
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
//#endregion
|
package/dist/vite.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as GenerateFileFormatter } from "./options-
|
|
2
|
-
import { t as OpenAPICodegenConfig } from "./config-
|
|
1
|
+
import { r as GenerateFileFormatter } from "./options-saKmD8s1.mjs";
|
|
2
|
+
import { t as OpenAPICodegenConfig } from "./config-1XCOTZ4a.mjs";
|
|
3
3
|
import { Plugin } from "vite";
|
|
4
4
|
|
|
5
5
|
//#region src/vite/openapi-codegen.plugin.d.ts
|
package/dist/vite.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as Profiler } from "./generateCodeFromOpenAPIDoc-
|
|
2
|
-
import { t as runGenerate } from "./generate.runner-
|
|
1
|
+
import { S as Profiler } from "./generateCodeFromOpenAPIDoc-D-UDIQX5.mjs";
|
|
2
|
+
import { t as runGenerate } from "./generate.runner-CioDqx6u.mjs";
|
|
3
3
|
import path from "path";
|
|
4
4
|
|
|
5
5
|
//#region src/vite/openapi-codegen.plugin.ts
|