@povio/openapi-codegen-cli 3.3.0 → 3.3.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 +7 -0
- package/dist/acl.d.mts +9 -9
- package/dist/acl.mjs +10 -7
- package/dist/{config-FD2Y872S.d.mts → config-BYiBd1QI.d.mts} +1 -1
- package/dist/{generate.runner-CLK1FoLT.mjs → generate.runner-CxlaA4c5.mjs} +2 -1
- package/dist/{generate.utils-BSDYGp-0.cjs → generate.utils-SfgYwPe7.cjs} +1 -0
- package/dist/{generateCodeFromOpenAPIDoc-CDyGSv2w.mjs → generateCodeFromOpenAPIDoc-CmN4bFjv.mjs} +22 -18
- package/dist/{generateCodeFromOpenAPIDoc-BypeVKIE.cjs → generateCodeFromOpenAPIDoc-Dv-hqKhh.cjs} +21 -17
- package/dist/generator.d.mts +1 -1
- package/dist/generator.mjs +3 -3
- package/dist/{getDataFromOpenAPIDoc-DYiCTWno.mjs → getDataFromOpenAPIDoc-DzeHecv2.mjs} +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/metro.cjs +2 -2
- package/dist/metro.d.mts +3 -3
- package/dist/metro.mjs +1 -1
- package/dist/openapi-codegen-native-darwin-arm64.node +0 -0
- package/dist/openapi-codegen-native-linux-x64.node +0 -0
- package/dist/openapi-codegen-native-win32-x64.node +0 -0
- package/dist/{openapi-codegen.runner-DUqQD2B5.mjs → openapi-codegen.runner-DDd4AXRT.mjs} +1 -1
- package/dist/{openapi-source.runner-Bje-tMOV.d.mts → openapi-source.runner-lmK-P6HE.d.mts} +1 -1
- package/dist/{options-rz2bcsaN.d.mts → options-DH-fAG0w.d.mts} +2 -0
- package/dist/sh.mjs +8 -3
- package/dist/tiny.d.mts +1 -1
- package/dist/vite.d.mts +3 -3
- package/dist/vite.mjs +1 -1
- package/package.json +7 -5
package/README.md
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
Axios is required when using the Axios transport (the default) or the `/axios` entry point. Projects using the native transport can omit Axios: generate with `--restClient native` and import `NativeRestClient` from `@povio/openapi-codegen-cli/native`. The root exports remain available for compatibility and support tree-shaking in consumer bundles. For direct runtime imports without bundling, use `/native` and `/errors` to avoid loading the Axios client. The `/axios` entry point is also available for Axios-specific imports. CLI-only usage and the `/generator`, `/tiny`, `/vite`, and `/metro` entry points do not require Axios.
|
|
10
10
|
|
|
11
|
+
ACL features require `@casl/ability@^7.1.1` and `@casl/react@^7.1.0`. When migrating to CASL 7, regenerate the client so `AppAbility` uses `Ability` instead of `PureAbility`, and update any handwritten CASL types. The runtime continues to use `createMongoAbility` for condition matching. CASL 7 treats empty conditions (`{}`) as matching everything. The `Can` helper keeps its `use` tuple and `(isAllowed, ability)` render callback.
|
|
12
|
+
|
|
11
13
|
Use this tool to generate code (Zod schemas, TypeScript types, API definitions, and React queries) from an OpenAPI v3 specification. API definitions use a REST client wrapper with either Axios or the native transport. React queries are generated in alignment with our code standards, without the need for explicit types.
|
|
12
14
|
|
|
13
15
|
The tool partially leverages code from [openapi-zod-client](https://github.com/astahmer/openapi-zod-client) repository.
|
|
@@ -36,6 +38,10 @@ export default {
|
|
|
36
38
|
};
|
|
37
39
|
```
|
|
38
40
|
|
|
41
|
+
## JSDoc generation
|
|
42
|
+
|
|
43
|
+
JSDoc comments are omitted by default while schemas, inferred types, and runtime behavior are preserved. Set `generateJsDoc: true` in your generator configuration or pass `--generateJsDoc` to include comments. This applies to both TypeScript and native generation. Combine with `modelsOnly: true` if you only want model files.
|
|
44
|
+
|
|
39
45
|
## Lazy schemas
|
|
40
46
|
|
|
41
47
|
With `tsNamespaces` enabled, every schema of a models namespace is built the moment the module is imported, even when the importer only needs one of them. Set `lazySchemas: true` (or pass `--lazySchemas`) to build each schema on first access instead:
|
|
@@ -125,6 +131,7 @@ bunx openapi-codegen generate --config my-config.ts
|
|
|
125
131
|
--tsPath (Requires `--importPath` to be 'ts') Typescript import path (default: '@/data')
|
|
126
132
|
--removeOperationPrefixEndingWith Remove operation name prefixes that end with the specified string (default: 'Controller_')
|
|
127
133
|
--compileSchemas Eagerly compile non-recursive Zod schemas (default: false)
|
|
134
|
+
--generateJsDoc Emit JSDoc comments (default: false; enable with --generateJsDoc)
|
|
128
135
|
--lazySchemas Build namespace model schemas on first access instead of at import; requires `--tsNamespaces` (default: false)
|
|
129
136
|
--extractEnums Extract enums into separate Zod schemas (default: true)
|
|
130
137
|
--modelsInCommon Keep all schema declarations in defaultTag models and emit per-module proxy exports (default: false)
|
package/dist/acl.d.mts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { a as ErrorHandler } from "./error-handling-LPEPQV1V.mjs";
|
|
2
|
-
import { PropsWithChildren } from "react";
|
|
3
|
-
import {
|
|
2
|
+
import { PropsWithChildren, ReactNode } from "react";
|
|
3
|
+
import { Ability, AbilityTuple, RawRuleOf, Subject } from "@casl/ability";
|
|
4
4
|
import { PackRule } from "@casl/ability/extra";
|
|
5
|
-
import {
|
|
5
|
+
import { CanProps } from "@casl/react";
|
|
6
6
|
//#region src/lib/acl/appAbility.types.d.ts
|
|
7
7
|
type AppAbilities = AbilityTuple<string, Subject>;
|
|
8
|
-
type AppAbility =
|
|
8
|
+
type AppAbility = Ability<AppAbilities>;
|
|
9
9
|
//#endregion
|
|
10
10
|
//#region src/lib/acl/ability.context.d.ts
|
|
11
11
|
declare namespace AbilityContext {
|
|
@@ -16,7 +16,7 @@ declare namespace AbilityContext {
|
|
|
16
16
|
} | null;
|
|
17
17
|
}
|
|
18
18
|
export const Provider: ({ children }: PropsWithChildren<ProviderProps>) => import("react").JSX.Element;
|
|
19
|
-
export const useAbility: <TAppAbilities extends AppAbilities = AppAbilities>() =>
|
|
19
|
+
export const useAbility: <TAppAbilities extends AppAbilities = AppAbilities>() => Ability<TAppAbilities>;
|
|
20
20
|
export {};
|
|
21
21
|
}
|
|
22
22
|
//#endregion
|
|
@@ -28,11 +28,11 @@ interface AclGuardProps<TAppAbilities extends AppAbilities = AppAbilities> {
|
|
|
28
28
|
declare const createAclGuard: <TAppAbilities extends AppAbilities = AppAbilities>() => ({ canUse, redirectTo, children }: PropsWithChildren<AclGuardProps<TAppAbilities>>) => import("react").ReactNode;
|
|
29
29
|
//#endregion
|
|
30
30
|
//#region src/lib/acl/Can.d.ts
|
|
31
|
-
type
|
|
32
|
-
type CanProps<TAppAbilities extends AppAbilities = AppAbilities> = {
|
|
31
|
+
type CanProps$1<TAppAbilities extends AppAbilities = AppAbilities> = {
|
|
33
32
|
use: TAppAbilities;
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
children: ReactNode | ((isAllowed: boolean, ability: AppAbility) => ReactNode);
|
|
34
|
+
} & Omit<CanProps<AppAbility>, "do" | "I" | "on" | "a" | "an" | "this" | "children">;
|
|
35
|
+
declare const Can: <TAppAbilities extends AppAbilities = AppAbilities>({ use, children, ...props }: CanProps$1<TAppAbilities>) => import("react").JSX.Element;
|
|
36
36
|
//#endregion
|
|
37
37
|
//#region src/lib/acl/useAclCheck.d.ts
|
|
38
38
|
interface UseAclCheckProps {
|
package/dist/acl.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { createContext, useCallback, useMemo } from "react";
|
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import { AbilityBuilder, createMongoAbility } from "@casl/ability";
|
|
7
7
|
import { unpackRules } from "@casl/ability/extra";
|
|
8
|
-
import {
|
|
8
|
+
import { AbilityProvider, Can as Can$1, useAbility } from "@casl/react";
|
|
9
9
|
//#region src/lib/acl/ability.context.tsx
|
|
10
10
|
let AbilityContext;
|
|
11
11
|
(function(_AbilityContext) {
|
|
@@ -27,11 +27,14 @@ let AbilityContext;
|
|
|
27
27
|
}, [user]);
|
|
28
28
|
return /* @__PURE__ */ jsx(Context.Provider, {
|
|
29
29
|
value: ability,
|
|
30
|
-
children
|
|
30
|
+
children: /* @__PURE__ */ jsx(AbilityProvider, {
|
|
31
|
+
value: ability,
|
|
32
|
+
children
|
|
33
|
+
})
|
|
31
34
|
});
|
|
32
35
|
};
|
|
33
36
|
_AbilityContext.useAbility = () => {
|
|
34
|
-
return useAbility(
|
|
37
|
+
return useAbility();
|
|
35
38
|
};
|
|
36
39
|
})(AbilityContext || (AbilityContext = {}));
|
|
37
40
|
//#endregion
|
|
@@ -47,13 +50,13 @@ const createAclGuard = () => ({ canUse, redirectTo = "/", children }) => {
|
|
|
47
50
|
};
|
|
48
51
|
//#endregion
|
|
49
52
|
//#region src/lib/acl/Can.tsx
|
|
50
|
-
const
|
|
51
|
-
const Can = ({ use, ...props }) => {
|
|
53
|
+
const Can = ({ use, children, ...props }) => {
|
|
52
54
|
const [action, subject] = use;
|
|
53
|
-
return /* @__PURE__ */ jsx(
|
|
55
|
+
return /* @__PURE__ */ jsx(Can$1, {
|
|
54
56
|
...props,
|
|
55
57
|
do: action,
|
|
56
|
-
on: subject
|
|
58
|
+
on: subject,
|
|
59
|
+
children: typeof children === "function" ? ({ isAllowed, ability }) => props.passThrough || isAllowed ? children(isAllowed, ability) : null : children
|
|
57
60
|
});
|
|
58
61
|
};
|
|
59
62
|
//#endregion
|
|
@@ -495,6 +495,7 @@ const DEFAULT_GENERATE_OPTIONS = {
|
|
|
495
495
|
standalone: false,
|
|
496
496
|
compileSchemas: false,
|
|
497
497
|
lazySchemas: false,
|
|
498
|
+
generateJsDoc: false,
|
|
498
499
|
schemaSuffix: SCHEMA_SUFFIX,
|
|
499
500
|
enumSuffix: ENUM_SUFFIX,
|
|
500
501
|
modelsInCommon: false,
|
|
@@ -1578,7 +1579,7 @@ async function runGenerate({ fileConfig, params, formatGeneratedFile, profiler =
|
|
|
1578
1579
|
const nativeFiles = generateFilesFromNativeOpenAPI(nativeInput.source, nativeInput.yaml, config);
|
|
1579
1580
|
if (nativeFiles) return nativeFiles;
|
|
1580
1581
|
}
|
|
1581
|
-
const { generateCodeFromOpenAPIDoc } = await import("./generateCodeFromOpenAPIDoc-
|
|
1582
|
+
const { generateCodeFromOpenAPIDoc } = await import("./generateCodeFromOpenAPIDoc-CmN4bFjv.mjs").then((n) => n.n);
|
|
1582
1583
|
return generateCodeFromOpenAPIDoc(openApiDoc, config, profiler, {
|
|
1583
1584
|
source: nativeInput.source,
|
|
1584
1585
|
yaml: nativeInput.yaml
|
package/dist/{generateCodeFromOpenAPIDoc-CDyGSv2w.mjs → generateCodeFromOpenAPIDoc-CmN4bFjv.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as getZodSchemaRefs, t as getDataFromOpenAPIDoc } from "./getDataFromOpenAPIDoc-
|
|
2
|
-
import { $ as getImportedAbilityFunctionName, A as getEndpointsImports, An as NATIVE_RESPONSE_TYPE, At as APP_REST_CLIENT_NAME, B as getPrefetchInfiniteQueryName, Bt as NATIVE_PACKAGE_IMPORT_PATH, C as getAppRestClientImportPath, Cn as ZOD_IMPORT, D as getTagFileName, Dn as AXIOS_REQUEST_CONFIG_TYPE, Dt as isEnumZodSchema, E as getQueryTypesImportPath, En as AXIOS_REQUEST_CONFIG_NAME, F as mergeImports, Ft as QUERY_MODULE_ENUM, G as getAbilityConditionType, H as getQueryName, Ht as getNamespaceName, I as getImportedInfiniteQueryName, In as shouldInlineEndpointsForTag, It as QUERY_OPTIONS_TYPES, J as getAbilityFunctionName, K as getAbilityConditionsTypes, L as getImportedQueryName, Ln as camelToSpaceSeparated, Lt as ZOD_EXTENDED, M as getInfiniteQueriesImports, Mt as DOMAIN_ERRORS_FILE, N as getModelsImports, Nn as getEndpointTag, Nt as MUTATION_EFFECTS, O as getTagImportPath, Ot as isNamedZodSchema, P as getQueriesImports, Pt as QUERY_MODULES_FILE, Q as getAppAbilitiesType, R as getInfiniteQueryName, Rn as capitalize, Rt as AXIOS_PACKAGE_IMPORT_PATH, T as getQueryModulesImportPath, Tn as AXIOS_IMPORT, U as getQueryOptionsName, V as getPrefetchQueryName, Vn as kebabToCamel, Vt as REST_PACKAGE_IMPORT_PATH, W as getAbilityAction, Wn as Profiler, X as getAbilitySubjectTypes, Y as getAbilitySubject, Z as getAclData, Zt as isParamMediaTypeAllowed, _ as hasEndpointConfig, _t as isReadAllEndpoint, an as wrapWithQuotesIfNeeded, at as getZodSchemaInferedTypeName, b as requiresBody, bt as invalidVariableNameCharactersToCamel, c as getDestructuredVariables, cn as isReferenceObject, ct as getSchemaDescriptions, d as isQuery, dt as DEFAULT_GENERATE_OPTIONS, et as hasAbilityConditions, f as getEndpointBody, fn as ANY_SCHEMA, ft as getPathSegments, g as getImportedEndpointName, gt as isPathSegmentParam, h as getEndpointPath, ht as isDeleteEndpoint, i as shouldUseNativeCodegen, it as getZodSchemaDescription, j as getImportPath, jn as getRequestConfigTypeName, jt as BUILDERS_UTILS, k as getAclImports, kn as JSON_APPLICATION_FORMAT, kt as APP_REST_CLIENT_FILE, l as isInfiniteQuery, ln as isSchemaObject, m as getEndpointName, mt as isCreateEndpoint, nt as getImportedZodSchemaInferedTypeName, o as getOutputFileName, ot as getZodSchemaPropertyDescriptions, p as getEndpointConfig, pt as isBulkDeleteEndpoint, q as getAbilityDescription, r as compileNativeData, rt as getImportedZodSchemaName, st as getZodSchemaType, tt as renderAclCheckCall, u as isMutation, ut as getUniqueArray, v as mapEndpointParamsToFunctionParams, vt as isReadEndpoint, w as getFileNameWithExtension, wn as AXIOS_DEFAULT_IMPORT_NAME, y as renderMediaUploadMutationBody, yt as isUpdateEndpoint, z as getInfiniteQueryOptionsName, zt as CONFIG_PACKAGE_IMPORT_PATH } from "./generate.runner-
|
|
1
|
+
import { r as getZodSchemaRefs, t as getDataFromOpenAPIDoc } from "./getDataFromOpenAPIDoc-DzeHecv2.mjs";
|
|
2
|
+
import { $ as getImportedAbilityFunctionName, A as getEndpointsImports, An as NATIVE_RESPONSE_TYPE, At as APP_REST_CLIENT_NAME, B as getPrefetchInfiniteQueryName, Bt as NATIVE_PACKAGE_IMPORT_PATH, C as getAppRestClientImportPath, Cn as ZOD_IMPORT, D as getTagFileName, Dn as AXIOS_REQUEST_CONFIG_TYPE, Dt as isEnumZodSchema, E as getQueryTypesImportPath, En as AXIOS_REQUEST_CONFIG_NAME, F as mergeImports, Ft as QUERY_MODULE_ENUM, G as getAbilityConditionType, H as getQueryName, Ht as getNamespaceName, I as getImportedInfiniteQueryName, In as shouldInlineEndpointsForTag, It as QUERY_OPTIONS_TYPES, J as getAbilityFunctionName, K as getAbilityConditionsTypes, L as getImportedQueryName, Ln as camelToSpaceSeparated, Lt as ZOD_EXTENDED, M as getInfiniteQueriesImports, Mt as DOMAIN_ERRORS_FILE, N as getModelsImports, Nn as getEndpointTag, Nt as MUTATION_EFFECTS, O as getTagImportPath, Ot as isNamedZodSchema, P as getQueriesImports, Pt as QUERY_MODULES_FILE, Q as getAppAbilitiesType, R as getInfiniteQueryName, Rn as capitalize, Rt as AXIOS_PACKAGE_IMPORT_PATH, T as getQueryModulesImportPath, Tn as AXIOS_IMPORT, U as getQueryOptionsName, V as getPrefetchQueryName, Vn as kebabToCamel, Vt as REST_PACKAGE_IMPORT_PATH, W as getAbilityAction, Wn as Profiler, X as getAbilitySubjectTypes, Y as getAbilitySubject, Z as getAclData, Zt as isParamMediaTypeAllowed, _ as hasEndpointConfig, _t as isReadAllEndpoint, an as wrapWithQuotesIfNeeded, at as getZodSchemaInferedTypeName, b as requiresBody, bt as invalidVariableNameCharactersToCamel, c as getDestructuredVariables, cn as isReferenceObject, ct as getSchemaDescriptions, d as isQuery, dt as DEFAULT_GENERATE_OPTIONS, et as hasAbilityConditions, f as getEndpointBody, fn as ANY_SCHEMA, ft as getPathSegments, g as getImportedEndpointName, gt as isPathSegmentParam, h as getEndpointPath, ht as isDeleteEndpoint, i as shouldUseNativeCodegen, it as getZodSchemaDescription, j as getImportPath, jn as getRequestConfigTypeName, jt as BUILDERS_UTILS, k as getAclImports, kn as JSON_APPLICATION_FORMAT, kt as APP_REST_CLIENT_FILE, l as isInfiniteQuery, ln as isSchemaObject, m as getEndpointName, mt as isCreateEndpoint, nt as getImportedZodSchemaInferedTypeName, o as getOutputFileName, ot as getZodSchemaPropertyDescriptions, p as getEndpointConfig, pt as isBulkDeleteEndpoint, q as getAbilityDescription, r as compileNativeData, rt as getImportedZodSchemaName, st as getZodSchemaType, tt as renderAclCheckCall, u as isMutation, ut as getUniqueArray, v as mapEndpointParamsToFunctionParams, vt as isReadEndpoint, w as getFileNameWithExtension, wn as AXIOS_DEFAULT_IMPORT_NAME, y as renderMediaUploadMutationBody, yt as isUpdateEndpoint, z as getInfiniteQueryOptionsName, zt as CONFIG_PACKAGE_IMPORT_PATH } from "./generate.runner-CxlaA4c5.mjs";
|
|
3
3
|
import "node:module";
|
|
4
4
|
//#region \0rolldown/runtime.js
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
@@ -22,7 +22,7 @@ const ACL_APP_ABILITIES = "AppAbilities";
|
|
|
22
22
|
const ACL_CHECK_HOOK = "useAclCheck";
|
|
23
23
|
const CASL_ABILITY_BINDING = {
|
|
24
24
|
abilityTuple: "AbilityTuple",
|
|
25
|
-
|
|
25
|
+
ability: "Ability",
|
|
26
26
|
forcedSubject: "ForcedSubject",
|
|
27
27
|
subjectType: "Subject",
|
|
28
28
|
subject: "subject"
|
|
@@ -30,7 +30,7 @@ const CASL_ABILITY_BINDING = {
|
|
|
30
30
|
const CASL_ABILITY_IMPORT = {
|
|
31
31
|
bindings: [
|
|
32
32
|
CASL_ABILITY_BINDING.abilityTuple,
|
|
33
|
-
CASL_ABILITY_BINDING.
|
|
33
|
+
CASL_ABILITY_BINDING.ability,
|
|
34
34
|
CASL_ABILITY_BINDING.forcedSubject,
|
|
35
35
|
CASL_ABILITY_BINDING.subjectType,
|
|
36
36
|
CASL_ABILITY_BINDING.subject
|
|
@@ -89,7 +89,7 @@ function generateAppAcl({ resolver, data }) {
|
|
|
89
89
|
const caslAbilityTupleImport = {
|
|
90
90
|
bindings: [],
|
|
91
91
|
typeBindings: [
|
|
92
|
-
CASL_ABILITY_BINDING.
|
|
92
|
+
CASL_ABILITY_BINDING.ability,
|
|
93
93
|
CASL_ABILITY_BINDING.abilityTuple,
|
|
94
94
|
...!appAbilitiesType ? [CASL_ABILITY_BINDING.subjectType] : [],
|
|
95
95
|
...hasAdditionalAbilityImports ? [CASL_ABILITY_BINDING.forcedSubject] : []
|
|
@@ -106,7 +106,7 @@ function generateAppAcl({ resolver, data }) {
|
|
|
106
106
|
for (const [action, subjects] of Object.entries(appAbilitiesType)) lines.push(`| ${CASL_ABILITY_BINDING.abilityTuple}<"${action}", ${subjects.join(" | ")}>`);
|
|
107
107
|
} else lines.push(`export type ${ACL_APP_ABILITIES} = ${CASL_ABILITY_BINDING.abilityTuple}<string, ${CASL_ABILITY_BINDING.subjectType}>;`);
|
|
108
108
|
lines.push("");
|
|
109
|
-
lines.push(`export type AppAbility =
|
|
109
|
+
lines.push(`export type AppAbility = ${CASL_ABILITY_BINDING.ability}<${ACL_APP_ABILITIES}>;`);
|
|
110
110
|
return lines.join("\n");
|
|
111
111
|
}
|
|
112
112
|
function renderImport$4(importData) {
|
|
@@ -154,12 +154,14 @@ function renderAbilityFunction({ resolver, endpoint }) {
|
|
|
154
154
|
const hasConditions = hasAbilityConditions(endpoint);
|
|
155
155
|
const lines = [];
|
|
156
156
|
const abilityQuery = endpoint.method === "get" ? endpoint.mediaDownload ? `\`${getQueryName(endpoint)}\` query or \`${getQueryName(endpoint, true)}\` mutation` : `\`${getQueryName(endpoint)}\` query` : `\`${getQueryName(endpoint)}\` mutation`;
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
157
|
+
if (resolver.options.generateJsDoc === true) {
|
|
158
|
+
lines.push("/**");
|
|
159
|
+
lines.push(` * Use for ${abilityQuery} ability. ${hasConditions ? "For global ability, omit the object parameter." : ""}${getAbilityDescription(endpoint) ? "" : ""}`);
|
|
160
|
+
if (getAbilityDescription(endpoint)) lines.push(` * @description ${getAbilityDescription(endpoint)}`);
|
|
161
|
+
if (hasConditions) for (const propertyType of abilityConditionsTypes) lines.push(` * @param { ${renderConditionType(resolver, endpoint, propertyType)} } object.${propertyType.name} ${propertyType.name} from ${propertyType.info}`);
|
|
162
|
+
lines.push(` * @returns { AbilityTuple } An ability tuple indicating the user's ability to use ${abilityQuery}`);
|
|
163
|
+
lines.push(" */");
|
|
164
|
+
}
|
|
163
165
|
lines.push(`export const ${getAbilityFunctionName(endpoint)} = (`);
|
|
164
166
|
if (hasConditions) lines.push(` object?: { ${abilityConditionsTypes.map((propertyType) => `${propertyType.name}${propertyType.required ? "" : "?"}: ${renderConditionType(resolver, endpoint, propertyType)}, `).join("")} } `);
|
|
165
167
|
lines.push(") => [");
|
|
@@ -925,7 +927,7 @@ function generateModels({ resolver, data, tag }) {
|
|
|
925
927
|
options: resolver.options
|
|
926
928
|
})} {`);
|
|
927
929
|
for (const [name, zodSchema] of Object.entries(zodSchemasData)) {
|
|
928
|
-
lines.push(renderModelJsDocs({
|
|
930
|
+
if (resolver.options.generateJsDoc === true) lines.push(renderModelJsDocs({
|
|
929
931
|
name,
|
|
930
932
|
zodSchema,
|
|
931
933
|
tag,
|
|
@@ -958,7 +960,7 @@ function renderLazyModels({ resolver, tag, zodSchemasData, lines }) {
|
|
|
958
960
|
const typeAnnotation = zodSchema.isCircular ? `: () => z.ZodObject<z.ZodRawShape> & z.ZodType<${namespace}.${inferredTypeName}>` : "";
|
|
959
961
|
const schemaCode = resolver.options.compileSchemas && !zodSchema.isCircular ? `z.compile(${zodSchema.code})` : zodSchema.code;
|
|
960
962
|
lines.push(`const ${name}${typeAnnotation} = once(() => ${callLazySchemaReferences(schemaCode, schemaNames)});`);
|
|
961
|
-
members.push(...indent(renderModelJsDocs({
|
|
963
|
+
if (resolver.options.generateJsDoc === true) members.push(...indent(renderModelJsDocs({
|
|
962
964
|
name,
|
|
963
965
|
zodSchema,
|
|
964
966
|
tag,
|
|
@@ -1108,6 +1110,7 @@ function renderImport$1(importData) {
|
|
|
1108
1110
|
return `import${importData.typeOnly ? " type" : ""} ${names} from "${importData.from}";`;
|
|
1109
1111
|
}
|
|
1110
1112
|
function renderModelJsDocs({ name, zodSchema, tag, resolver }) {
|
|
1113
|
+
if (resolver.options.generateJsDoc !== true) return "";
|
|
1111
1114
|
const lines = [
|
|
1112
1115
|
`/** `,
|
|
1113
1116
|
` * ${name} `,
|
|
@@ -1451,6 +1454,7 @@ function addAsteriskAfterNewLine(str) {
|
|
|
1451
1454
|
return str.replace(/\n/g, "\n *");
|
|
1452
1455
|
}
|
|
1453
1456
|
function renderQueryJsDocs({ resolver, endpoint, mode, tag }) {
|
|
1457
|
+
if (resolver.options.generateJsDoc !== true) return "";
|
|
1454
1458
|
const lines = ["/** "];
|
|
1455
1459
|
if (mode === "infiniteQuery") lines.push(` * Infinite query \`${getInfiniteQueryName(endpoint)}${endpoint.summary ? "" : ""}`);
|
|
1456
1460
|
else if (mode === "query") lines.push(` * Query \`${getQueryName(endpoint)}\`${endpoint.summary && endpoint.mediaDownload ? " - recommended when file should be cached" : ""}`);
|
|
@@ -1642,7 +1646,7 @@ function renderQuery({ resolver, endpoint, inlineEndpoints }) {
|
|
|
1642
1646
|
const requestConfig = `{ ${hasAxiosRequestConfig ? `...${AXIOS_REQUEST_CONFIG_NAME}, ` : ""}allowInvalidResponseData: queryConfig.allowInvalidResponseData }`;
|
|
1643
1647
|
const queryOptionsArgs = `${resolvedEndpointArgs ? `{ ${resolvedEndpointArgs} }, ` : ""}${requestConfig}`;
|
|
1644
1648
|
const lines = [];
|
|
1645
|
-
lines.push(renderQueryJsDocs({
|
|
1649
|
+
if (resolver.options.generateJsDoc === true) lines.push(renderQueryJsDocs({
|
|
1646
1650
|
resolver,
|
|
1647
1651
|
endpoint,
|
|
1648
1652
|
mode: "query",
|
|
@@ -1712,7 +1716,7 @@ function renderMutation({ resolver, endpoint, inlineEndpoints, precomputed }) {
|
|
|
1712
1716
|
const pathParamFirstArg = isScoped ? `{ ${scopePathParams.map((p) => p.name).join(", ")} }: { ${scopePathParams.map((p) => `${p.name}: ${p.type}`).join("; ")} }, ` : "";
|
|
1713
1717
|
const mutationOptionsTypeArg = isScoped ? nonPathMutationVariablesType ? `, { ${nonPathMutationVariablesType} }` : "" : `, { ${mutationVariablesType} }`;
|
|
1714
1718
|
const lines = [];
|
|
1715
|
-
lines.push(renderQueryJsDocs({
|
|
1719
|
+
if (resolver.options.generateJsDoc === true) lines.push(renderQueryJsDocs({
|
|
1716
1720
|
resolver,
|
|
1717
1721
|
endpoint,
|
|
1718
1722
|
mode: "mutation",
|
|
@@ -1831,7 +1835,7 @@ function renderInfiniteQuery({ resolver, endpoint, inlineEndpoints }) {
|
|
|
1831
1835
|
const queryOptionsArgs = `${resolvedEndpointArgsWithoutPage ? `{ ${resolvedEndpointArgsWithoutPage} }, ` : ""}${requestConfig}`;
|
|
1832
1836
|
const hasQueryFnOverride = hasAclCheck;
|
|
1833
1837
|
const lines = [];
|
|
1834
|
-
lines.push(renderQueryJsDocs({
|
|
1838
|
+
if (resolver.options.generateJsDoc === true) lines.push(renderQueryJsDocs({
|
|
1835
1839
|
resolver,
|
|
1836
1840
|
endpoint,
|
|
1837
1841
|
mode: "infiniteQuery",
|
|
@@ -1903,7 +1907,7 @@ function generateDomainErrors({ resolver, data }) {
|
|
|
1903
1907
|
const sb = String(b.code);
|
|
1904
1908
|
return sa < sb ? -1 : sa > sb ? 1 : 0;
|
|
1905
1909
|
}).map(({ code, name, description }) => {
|
|
1906
|
-
const comment = description ? ` /** ${description} */\n ` : " ";
|
|
1910
|
+
const comment = resolver.options.generateJsDoc === true && description ? ` /** ${description} */\n ` : " ";
|
|
1907
1911
|
const key = name ?? (typeof code === "string" ? code : `ERROR_${code}`);
|
|
1908
1912
|
if (!VALID_IDENTIFIER.test(key)) throw new Error(`Domain error code "${code}" produces an invalid identifier "${key}". Use the 'name' field on @ApiDomainErrorResponse to provide a valid identifier.`);
|
|
1909
1913
|
return `${comment}${key}: ${typeof code === "string" ? `"${code}"` : String(code)}`;
|
package/dist/{generateCodeFromOpenAPIDoc-BypeVKIE.cjs → generateCodeFromOpenAPIDoc-Dv-hqKhh.cjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_generate_utils = require("./generate.utils-
|
|
1
|
+
const require_generate_utils = require("./generate.utils-SfgYwPe7.cjs");
|
|
2
2
|
//#region src/generators/const/acl.const.ts
|
|
3
3
|
const ACL_APP_ABILITY_FILE = {
|
|
4
4
|
fileName: "acl/app.ability",
|
|
@@ -8,7 +8,7 @@ const ACL_APP_ABILITIES = "AppAbilities";
|
|
|
8
8
|
const ACL_CHECK_HOOK = "useAclCheck";
|
|
9
9
|
const CASL_ABILITY_BINDING = {
|
|
10
10
|
abilityTuple: "AbilityTuple",
|
|
11
|
-
|
|
11
|
+
ability: "Ability",
|
|
12
12
|
forcedSubject: "ForcedSubject",
|
|
13
13
|
subjectType: "Subject",
|
|
14
14
|
subject: "subject"
|
|
@@ -16,7 +16,7 @@ const CASL_ABILITY_BINDING = {
|
|
|
16
16
|
const CASL_ABILITY_IMPORT = {
|
|
17
17
|
bindings: [
|
|
18
18
|
CASL_ABILITY_BINDING.abilityTuple,
|
|
19
|
-
CASL_ABILITY_BINDING.
|
|
19
|
+
CASL_ABILITY_BINDING.ability,
|
|
20
20
|
CASL_ABILITY_BINDING.forcedSubject,
|
|
21
21
|
CASL_ABILITY_BINDING.subjectType,
|
|
22
22
|
CASL_ABILITY_BINDING.subject
|
|
@@ -2072,7 +2072,7 @@ function generateAppAcl({ resolver, data }) {
|
|
|
2072
2072
|
const caslAbilityTupleImport = {
|
|
2073
2073
|
bindings: [],
|
|
2074
2074
|
typeBindings: [
|
|
2075
|
-
CASL_ABILITY_BINDING.
|
|
2075
|
+
CASL_ABILITY_BINDING.ability,
|
|
2076
2076
|
CASL_ABILITY_BINDING.abilityTuple,
|
|
2077
2077
|
...!appAbilitiesType ? [CASL_ABILITY_BINDING.subjectType] : [],
|
|
2078
2078
|
...hasAdditionalAbilityImports ? [CASL_ABILITY_BINDING.forcedSubject] : []
|
|
@@ -2089,7 +2089,7 @@ function generateAppAcl({ resolver, data }) {
|
|
|
2089
2089
|
for (const [action, subjects] of Object.entries(appAbilitiesType)) lines.push(`| ${CASL_ABILITY_BINDING.abilityTuple}<"${action}", ${subjects.join(" | ")}>`);
|
|
2090
2090
|
} else lines.push(`export type ${ACL_APP_ABILITIES} = ${CASL_ABILITY_BINDING.abilityTuple}<string, ${CASL_ABILITY_BINDING.subjectType}>;`);
|
|
2091
2091
|
lines.push("");
|
|
2092
|
-
lines.push(`export type AppAbility =
|
|
2092
|
+
lines.push(`export type AppAbility = ${CASL_ABILITY_BINDING.ability}<${ACL_APP_ABILITIES}>;`);
|
|
2093
2093
|
return lines.join("\n");
|
|
2094
2094
|
}
|
|
2095
2095
|
function renderImport$4(importData) {
|
|
@@ -2137,12 +2137,14 @@ function renderAbilityFunction({ resolver, endpoint }) {
|
|
|
2137
2137
|
const hasConditions = require_generate_utils.hasAbilityConditions(endpoint);
|
|
2138
2138
|
const lines = [];
|
|
2139
2139
|
const abilityQuery = endpoint.method === "get" ? endpoint.mediaDownload ? `\`${require_generate_utils.getQueryName(endpoint)}\` query or \`${require_generate_utils.getQueryName(endpoint, true)}\` mutation` : `\`${require_generate_utils.getQueryName(endpoint)}\` query` : `\`${require_generate_utils.getQueryName(endpoint)}\` mutation`;
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2140
|
+
if (resolver.options.generateJsDoc === true) {
|
|
2141
|
+
lines.push("/**");
|
|
2142
|
+
lines.push(` * Use for ${abilityQuery} ability. ${hasConditions ? "For global ability, omit the object parameter." : ""}${require_generate_utils.getAbilityDescription(endpoint) ? "" : ""}`);
|
|
2143
|
+
if (require_generate_utils.getAbilityDescription(endpoint)) lines.push(` * @description ${require_generate_utils.getAbilityDescription(endpoint)}`);
|
|
2144
|
+
if (hasConditions) for (const propertyType of abilityConditionsTypes) lines.push(` * @param { ${renderConditionType(resolver, endpoint, propertyType)} } object.${propertyType.name} ${propertyType.name} from ${propertyType.info}`);
|
|
2145
|
+
lines.push(` * @returns { AbilityTuple } An ability tuple indicating the user's ability to use ${abilityQuery}`);
|
|
2146
|
+
lines.push(" */");
|
|
2147
|
+
}
|
|
2146
2148
|
lines.push(`export const ${require_generate_utils.getAbilityFunctionName(endpoint)} = (`);
|
|
2147
2149
|
if (hasConditions) lines.push(` object?: { ${abilityConditionsTypes.map((propertyType) => `${propertyType.name}${propertyType.required ? "" : "?"}: ${renderConditionType(resolver, endpoint, propertyType)}, `).join("")} } `);
|
|
2148
2150
|
lines.push(") => [");
|
|
@@ -2908,7 +2910,7 @@ function generateModels({ resolver, data, tag }) {
|
|
|
2908
2910
|
options: resolver.options
|
|
2909
2911
|
})} {`);
|
|
2910
2912
|
for (const [name, zodSchema] of Object.entries(zodSchemasData)) {
|
|
2911
|
-
lines.push(renderModelJsDocs({
|
|
2913
|
+
if (resolver.options.generateJsDoc === true) lines.push(renderModelJsDocs({
|
|
2912
2914
|
name,
|
|
2913
2915
|
zodSchema,
|
|
2914
2916
|
tag,
|
|
@@ -2941,7 +2943,7 @@ function renderLazyModels({ resolver, tag, zodSchemasData, lines }) {
|
|
|
2941
2943
|
const typeAnnotation = zodSchema.isCircular ? `: () => z.ZodObject<z.ZodRawShape> & z.ZodType<${namespace}.${inferredTypeName}>` : "";
|
|
2942
2944
|
const schemaCode = resolver.options.compileSchemas && !zodSchema.isCircular ? `z.compile(${zodSchema.code})` : zodSchema.code;
|
|
2943
2945
|
lines.push(`const ${name}${typeAnnotation} = once(() => ${callLazySchemaReferences(schemaCode, schemaNames)});`);
|
|
2944
|
-
members.push(...indent(renderModelJsDocs({
|
|
2946
|
+
if (resolver.options.generateJsDoc === true) members.push(...indent(renderModelJsDocs({
|
|
2945
2947
|
name,
|
|
2946
2948
|
zodSchema,
|
|
2947
2949
|
tag,
|
|
@@ -3091,6 +3093,7 @@ function renderImport$1(importData) {
|
|
|
3091
3093
|
return `import${importData.typeOnly ? " type" : ""} ${names} from "${importData.from}";`;
|
|
3092
3094
|
}
|
|
3093
3095
|
function renderModelJsDocs({ name, zodSchema, tag, resolver }) {
|
|
3096
|
+
if (resolver.options.generateJsDoc !== true) return "";
|
|
3094
3097
|
const lines = [
|
|
3095
3098
|
`/** `,
|
|
3096
3099
|
` * ${name} `,
|
|
@@ -3434,6 +3437,7 @@ function addAsteriskAfterNewLine(str) {
|
|
|
3434
3437
|
return str.replace(/\n/g, "\n *");
|
|
3435
3438
|
}
|
|
3436
3439
|
function renderQueryJsDocs({ resolver, endpoint, mode, tag }) {
|
|
3440
|
+
if (resolver.options.generateJsDoc !== true) return "";
|
|
3437
3441
|
const lines = ["/** "];
|
|
3438
3442
|
if (mode === "infiniteQuery") lines.push(` * Infinite query \`${require_generate_utils.getInfiniteQueryName(endpoint)}${endpoint.summary ? "" : ""}`);
|
|
3439
3443
|
else if (mode === "query") lines.push(` * Query \`${require_generate_utils.getQueryName(endpoint)}\`${endpoint.summary && endpoint.mediaDownload ? " - recommended when file should be cached" : ""}`);
|
|
@@ -3625,7 +3629,7 @@ function renderQuery({ resolver, endpoint, inlineEndpoints }) {
|
|
|
3625
3629
|
const requestConfig = `{ ${hasAxiosRequestConfig ? `...${require_generate_utils.AXIOS_REQUEST_CONFIG_NAME}, ` : ""}allowInvalidResponseData: queryConfig.allowInvalidResponseData }`;
|
|
3626
3630
|
const queryOptionsArgs = `${resolvedEndpointArgs ? `{ ${resolvedEndpointArgs} }, ` : ""}${requestConfig}`;
|
|
3627
3631
|
const lines = [];
|
|
3628
|
-
lines.push(renderQueryJsDocs({
|
|
3632
|
+
if (resolver.options.generateJsDoc === true) lines.push(renderQueryJsDocs({
|
|
3629
3633
|
resolver,
|
|
3630
3634
|
endpoint,
|
|
3631
3635
|
mode: "query",
|
|
@@ -3695,7 +3699,7 @@ function renderMutation({ resolver, endpoint, inlineEndpoints, precomputed }) {
|
|
|
3695
3699
|
const pathParamFirstArg = isScoped ? `{ ${scopePathParams.map((p) => p.name).join(", ")} }: { ${scopePathParams.map((p) => `${p.name}: ${p.type}`).join("; ")} }, ` : "";
|
|
3696
3700
|
const mutationOptionsTypeArg = isScoped ? nonPathMutationVariablesType ? `, { ${nonPathMutationVariablesType} }` : "" : `, { ${mutationVariablesType} }`;
|
|
3697
3701
|
const lines = [];
|
|
3698
|
-
lines.push(renderQueryJsDocs({
|
|
3702
|
+
if (resolver.options.generateJsDoc === true) lines.push(renderQueryJsDocs({
|
|
3699
3703
|
resolver,
|
|
3700
3704
|
endpoint,
|
|
3701
3705
|
mode: "mutation",
|
|
@@ -3814,7 +3818,7 @@ function renderInfiniteQuery({ resolver, endpoint, inlineEndpoints }) {
|
|
|
3814
3818
|
const queryOptionsArgs = `${resolvedEndpointArgsWithoutPage ? `{ ${resolvedEndpointArgsWithoutPage} }, ` : ""}${requestConfig}`;
|
|
3815
3819
|
const hasQueryFnOverride = hasAclCheck;
|
|
3816
3820
|
const lines = [];
|
|
3817
|
-
lines.push(renderQueryJsDocs({
|
|
3821
|
+
if (resolver.options.generateJsDoc === true) lines.push(renderQueryJsDocs({
|
|
3818
3822
|
resolver,
|
|
3819
3823
|
endpoint,
|
|
3820
3824
|
mode: "infiniteQuery",
|
|
@@ -3886,7 +3890,7 @@ function generateDomainErrors({ resolver, data }) {
|
|
|
3886
3890
|
const sb = String(b.code);
|
|
3887
3891
|
return sa < sb ? -1 : sa > sb ? 1 : 0;
|
|
3888
3892
|
}).map(({ code, name, description }) => {
|
|
3889
|
-
const comment = description ? ` /** ${description} */\n ` : " ";
|
|
3893
|
+
const comment = resolver.options.generateJsDoc === true && description ? ` /** ${description} */\n ` : " ";
|
|
3890
3894
|
const key = name ?? (typeof code === "string" ? code : `ERROR_${code}`);
|
|
3891
3895
|
if (!VALID_IDENTIFIER.test(key)) throw new Error(`Domain error code "${code}" produces an invalid identifier "${key}". Use the 'name' field on @ApiDomainErrorResponse to provide a valid identifier.`);
|
|
3892
3896
|
return `${comment}${key}: ${typeof code === "string" ? `"${code}"` : String(code)}`;
|
package/dist/generator.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as GenerateFileData, t as GenerateOptions } from "./options-
|
|
1
|
+
import { n as GenerateFileData, t as GenerateOptions } from "./options-DH-fAG0w.mjs";
|
|
2
2
|
import { OpenAPIV3 } from "openapi-types";
|
|
3
3
|
//#region src/generators/types/metadata.d.ts
|
|
4
4
|
interface GenerateParams {
|
package/dist/generator.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as generateCodeFromOpenAPIDoc } from "./generateCodeFromOpenAPIDoc-
|
|
2
|
-
import { t as getDataFromOpenAPIDoc } from "./getDataFromOpenAPIDoc-
|
|
3
|
-
import { H as getQueryName, Ht as getNamespaceName, Mn as formatTag, O as getTagImportPath, S as getTsTypeBase, Xt as isMediaTypeAllowed, Zt as isParamMediaTypeAllowed, bt as invalidVariableNameCharactersToCamel, d as isQuery, dt as DEFAULT_GENERATE_OPTIONS, t as getOpenApiDoc, u as isMutation, x as getSchemaTsMetaType } from "./generate.runner-
|
|
1
|
+
import { t as generateCodeFromOpenAPIDoc } from "./generateCodeFromOpenAPIDoc-CmN4bFjv.mjs";
|
|
2
|
+
import { t as getDataFromOpenAPIDoc } from "./getDataFromOpenAPIDoc-DzeHecv2.mjs";
|
|
3
|
+
import { H as getQueryName, Ht as getNamespaceName, Mn as formatTag, O as getTagImportPath, S as getTsTypeBase, Xt as isMediaTypeAllowed, Zt as isParamMediaTypeAllowed, bt as invalidVariableNameCharactersToCamel, d as isQuery, dt as DEFAULT_GENERATE_OPTIONS, t as getOpenApiDoc, u as isMutation, x as getSchemaTsMetaType } from "./generate.runner-CxlaA4c5.mjs";
|
|
4
4
|
//#region src/generators/core/getMetadataFromOpenAPIDoc.ts
|
|
5
5
|
async function getMetadataFromOpenAPIDoc(openApiDoc, options) {
|
|
6
6
|
const { resolver, data } = await getDataFromOpenAPIDoc(openApiDoc, options);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $t as isPrimitiveType, Bn as getMostCommonAdjacentCombinationSplit, Ct as getParamZodSchemaName, Et as getZodSchemaOperationName, Fn as isTagIncluded, Gt as getParameterEnumNames, Hn as removeWord, Ht as getNamespaceName, Jt as isErrorStatus, Kt as getSchemaNameByRef, Mn as formatTag, Nn as getEndpointTag, On as BODY_PARAMETER_NAME, Ot as isNamedZodSchema, Pn as getOperationTag, Qt as isPathExcluded, Rn as capitalize, Sn as VOID_SCHEMA, St as getEnumZodSchemaName, Tt as getZodSchemaName, Un as snakeToCamel, Ut as autocorrectRef, Wn as Profiler, Wt as escapeControlCharacters, Xt as isMediaTypeAllowed, Yt as isMainResponseStatus, Zt as isParamMediaTypeAllowed, _n as INT_SCHEMA, an as wrapWithQuotesIfNeeded, bn as URL_SCHEMA, bt as invalidVariableNameCharactersToCamel, cn as isReferenceObject, d as isQuery, dn as ALLOWED_PATH_IN, en as isSortingParameterObject, fn as ANY_SCHEMA, gn as ENUM_SCHEMA, hn as EMAIL_SCHEMA, in as unwrapQuotesIfNeeded, kn as JSON_APPLICATION_FORMAT, ln as isSchemaObject, lt as iterateSchema, mn as DATETIME_SCHEMA, nn as pathToVariableName, on as inferRequiredSchema, pn as BLOB_SCHEMA, qt as getSchemaRef, rn as replaceHyphenatedPath, s as pick, sn as isArraySchemaObject, tn as pathParamToVariableName, un as ALLOWED_METHODS, ut as getUniqueArray, vn as NUMBER_SCHEMA, wt as getResponseZodSchemaName, xn as UUID_SCHEMA, xt as getBodyZodSchemaName, yn as STRING_SCHEMA, zn as decapitalize } from "./generate.runner-
|
|
1
|
+
import { $t as isPrimitiveType, Bn as getMostCommonAdjacentCombinationSplit, Ct as getParamZodSchemaName, Et as getZodSchemaOperationName, Fn as isTagIncluded, Gt as getParameterEnumNames, Hn as removeWord, Ht as getNamespaceName, Jt as isErrorStatus, Kt as getSchemaNameByRef, Mn as formatTag, Nn as getEndpointTag, On as BODY_PARAMETER_NAME, Ot as isNamedZodSchema, Pn as getOperationTag, Qt as isPathExcluded, Rn as capitalize, Sn as VOID_SCHEMA, St as getEnumZodSchemaName, Tt as getZodSchemaName, Un as snakeToCamel, Ut as autocorrectRef, Wn as Profiler, Wt as escapeControlCharacters, Xt as isMediaTypeAllowed, Yt as isMainResponseStatus, Zt as isParamMediaTypeAllowed, _n as INT_SCHEMA, an as wrapWithQuotesIfNeeded, bn as URL_SCHEMA, bt as invalidVariableNameCharactersToCamel, cn as isReferenceObject, d as isQuery, dn as ALLOWED_PATH_IN, en as isSortingParameterObject, fn as ANY_SCHEMA, gn as ENUM_SCHEMA, hn as EMAIL_SCHEMA, in as unwrapQuotesIfNeeded, kn as JSON_APPLICATION_FORMAT, ln as isSchemaObject, lt as iterateSchema, mn as DATETIME_SCHEMA, nn as pathToVariableName, on as inferRequiredSchema, pn as BLOB_SCHEMA, qt as getSchemaRef, rn as replaceHyphenatedPath, s as pick, sn as isArraySchemaObject, tn as pathParamToVariableName, un as ALLOWED_METHODS, ut as getUniqueArray, vn as NUMBER_SCHEMA, wt as getResponseZodSchemaName, xn as UUID_SCHEMA, xt as getBodyZodSchemaName, yn as STRING_SCHEMA, zn as decapitalize } from "./generate.runner-CxlaA4c5.mjs";
|
|
2
2
|
//#region src/generators/const/validation.const.ts
|
|
3
3
|
const HTTP_STATUS_CODES = {
|
|
4
4
|
"100": "Continue",
|
package/dist/index.d.mts
CHANGED
|
@@ -5,7 +5,7 @@ import { a as RestClient, i as Response, n as RequestConfig, o as RestIntercepto
|
|
|
5
5
|
import { n as useWorkspaceContext, r as OpenApiRouter, t as OpenApiWorkspaceContext } from "./workspace.context-isVY9ves.mjs";
|
|
6
6
|
import { i as QueryModule, n as InvalidationMapFunc, r as OpenApiQueryConfig, t as InvalidationMap } from "./queryConfig.context-CRJOgf19.mjs";
|
|
7
7
|
import { t as RestUtils } from "./rest.utils-DpiFIdhF.mjs";
|
|
8
|
-
import { t as OpenAPICodegenConfig } from "./config-
|
|
8
|
+
import { t as OpenAPICodegenConfig } from "./config-BYiBd1QI.mjs";
|
|
9
9
|
import { d as TransportResponse, l as TransportRequest, n as HttpError, p as UploadProgress, u as TransportRequestConfig } from "./rest-transport.types-DM5-qyOJ.mjs";
|
|
10
10
|
import { n as NativeRestInterceptor, r as NativeRestClient, t as NativeInterceptor } from "./native-rest-interceptor-PgziZt1f.mjs";
|
|
11
11
|
import { a as AppQueryOptions, i as AppMutationOptions, n as useMutationEffects, r as AppInfiniteQueryOptions, t as MutationEffectsOptions } from "./useMutationEffects-DIdL8tlx.mjs";
|
package/dist/metro.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_generate_utils = require("./generate.utils-
|
|
2
|
+
const require_generate_utils = require("./generate.utils-SfgYwPe7.cjs");
|
|
3
3
|
let fs = require("fs");
|
|
4
4
|
fs = require_generate_utils.__toESM(fs, 1);
|
|
5
5
|
let path = require("path");
|
|
@@ -103,7 +103,7 @@ async function runGenerate({ fileConfig, params, formatGeneratedFile, profiler =
|
|
|
103
103
|
const nativeFiles = generateFilesFromNativeOpenAPI(nativeInput.source, nativeInput.yaml, config);
|
|
104
104
|
if (nativeFiles) return nativeFiles;
|
|
105
105
|
}
|
|
106
|
-
const { generateCodeFromOpenAPIDoc } = await Promise.resolve().then(() => require("./generateCodeFromOpenAPIDoc-
|
|
106
|
+
const { generateCodeFromOpenAPIDoc } = await Promise.resolve().then(() => require("./generateCodeFromOpenAPIDoc-Dv-hqKhh.cjs"));
|
|
107
107
|
return generateCodeFromOpenAPIDoc(openApiDoc, config, profiler, {
|
|
108
108
|
source: nativeInput.source,
|
|
109
109
|
yaml: nativeInput.yaml
|
package/dist/metro.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as GenerateFileFormatter } from "./options-
|
|
2
|
-
import { t as OpenAPICodegenConfig } from "./config-
|
|
3
|
-
import { d as GenerateOpenApiFile, m as GenerateOpenApiSpec, n as TinyOpenApiSpecModuleConfig } from "./openapi-source.runner-
|
|
1
|
+
import { r as GenerateFileFormatter } from "./options-DH-fAG0w.mjs";
|
|
2
|
+
import { t as OpenAPICodegenConfig } from "./config-BYiBd1QI.mjs";
|
|
3
|
+
import { d as GenerateOpenApiFile, m as GenerateOpenApiSpec, n as TinyOpenApiSpecModuleConfig } from "./openapi-source.runner-lmK-P6HE.mjs";
|
|
4
4
|
import { IncomingMessage, ServerResponse } from "http";
|
|
5
5
|
//#region src/metro/openapi-codegen.plugin.d.ts
|
|
6
6
|
type OpenApiCodegenMetroConfig = OpenAPICodegenConfig & {
|
package/dist/metro.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-
|
|
1
|
+
import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-DDd4AXRT.mjs";
|
|
2
2
|
import { i as normalizeWatchFolders, r as isTinyOpenApiFakeMode, t as createTinyOpenApiSourceRunner } from "./openapi-source.runner-DPUNTduQ.mjs";
|
|
3
3
|
import fs from "fs";
|
|
4
4
|
import path from "path";
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Wn as Profiler, n as runGenerate } from "./generate.runner-
|
|
1
|
+
import { Wn as Profiler, n as runGenerate } from "./generate.runner-CxlaA4c5.mjs";
|
|
2
2
|
import path from "path";
|
|
3
3
|
//#region src/plugins/openapi-codegen.runner.ts
|
|
4
4
|
function createOpenApiCodegenRunner(config, options = {}) {
|
|
@@ -19,6 +19,8 @@ interface ZodGenerateOptions {
|
|
|
19
19
|
compileSchemas?: boolean;
|
|
20
20
|
/** Build namespace model schemas on first access instead of at import. Requires tsNamespaces. */
|
|
21
21
|
lazySchemas?: boolean;
|
|
22
|
+
/** Emit JSDoc comments in generated code. Defaults to false. */
|
|
23
|
+
generateJsDoc?: boolean;
|
|
22
24
|
schemaSuffix: string;
|
|
23
25
|
enumSuffix: string;
|
|
24
26
|
modelsInCommon?: boolean;
|
package/dist/sh.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import { i as VALIDATION_ERROR_TYPE_TITLE, n as groupByType, t as getDataFromOpenAPIDoc } from "./getDataFromOpenAPIDoc-
|
|
3
|
-
import { D as getTagFileName, Wn as Profiler, a as resolveConfig, n as runGenerate, o as getOutputFileName, t as getOpenApiDoc } from "./generate.runner-
|
|
2
|
+
import { i as VALIDATION_ERROR_TYPE_TITLE, n as groupByType, t as getDataFromOpenAPIDoc } from "./getDataFromOpenAPIDoc-DzeHecv2.mjs";
|
|
3
|
+
import { D as getTagFileName, Wn as Profiler, a as resolveConfig, n as runGenerate, o as getOutputFileName, t as getOpenApiDoc } from "./generate.runner-CxlaA4c5.mjs";
|
|
4
4
|
import yargs from "yargs";
|
|
5
5
|
import { hideBin } from "yargs/helpers";
|
|
6
6
|
import { styleText } from "node:util";
|
|
@@ -31,7 +31,7 @@ function logBanner(message) {
|
|
|
31
31
|
* Fetch the version from package.json
|
|
32
32
|
*/
|
|
33
33
|
function getVersion() {
|
|
34
|
-
return "3.3.
|
|
34
|
+
return "3.3.1";
|
|
35
35
|
}
|
|
36
36
|
//#endregion
|
|
37
37
|
//#region src/helpers/yargs.helper.ts
|
|
@@ -266,6 +266,7 @@ var GenerateOptions = class {
|
|
|
266
266
|
importPath;
|
|
267
267
|
compileSchemas;
|
|
268
268
|
lazySchemas;
|
|
269
|
+
generateJsDoc;
|
|
269
270
|
extractEnums;
|
|
270
271
|
modelsInCommon;
|
|
271
272
|
modelsInModules;
|
|
@@ -333,6 +334,10 @@ __decorate([YargOption({
|
|
|
333
334
|
envAlias: "lazySchemas",
|
|
334
335
|
type: "boolean"
|
|
335
336
|
}), __decorateMetadata("design:type", Boolean)], GenerateOptions.prototype, "lazySchemas", void 0);
|
|
337
|
+
__decorate([YargOption({
|
|
338
|
+
envAlias: "generateJsDoc",
|
|
339
|
+
type: "boolean"
|
|
340
|
+
}), __decorateMetadata("design:type", Boolean)], GenerateOptions.prototype, "generateJsDoc", void 0);
|
|
336
341
|
__decorate([YargOption({
|
|
337
342
|
envAlias: "extractEnums",
|
|
338
343
|
type: "boolean"
|
package/dist/tiny.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as getModuleOpenApiTag, A as collectApiModelSchemaExports, At as toOpenAPI30Document, B as collectReachableModelSchemas, C as applyEnumExtensions, Ct as procedureSchemaName, D as applyRobodevModuleExtensions, Dt as schemaExportName, E as applyParameterExtensions, Et as schemaComponentRef, F as collectExtraSchemas, G as findComponentEnumNames, H as compactTagName, I as collectModelSchemaExports, J as generateOpenApiFile, K as findEnumNames, L as collectModuleModelSchemaExports, M as collectContractSchemas, Mt as toOpenAPIAclRule, N as collectDbTableModelSchemaExport, Nt as toPascalCase, O as applyRobodevUserRolesExtension, Ot as sharedSchemaExportName, P as collectDbTableModelSchemaExports, Pt as visitZodSchema, Q as getModuleOpenApiController, R as collectOperationMeta, S as addContractSchema, St as operationKey, T as applyPaginatedItemSchemas, Tt as routeHasPathParameters, U as createModelSchemaNameGetter, V as collectSchemaRegistryRoots, W as defineOpenApiSchemas, X as getContractProcedureData, Y as getComponentSchemas, Z as getDerivedOperationId, _ as OpenApiSchemaRegistry, _t as namedControllerActionSchema, a as isTinyOpenApiFakeMode, at as getProcedureInputSchemaRole, b as TinyOpenApiUserRole, bt as namedOpenApiResponseSchema, c as AnyContractRouter, ct as isContractProcedure, d as GenerateOpenApiFile, dt as isObject, et as getObjectPropertySchema, f as GenerateOpenApiFileOptions, ft as isProcedureMeta, g as JsonObject, gt as namedControllerActionInputDtoSchema, h as GenerateTinyOpenApiFileOptions, ht as modelSchemaNameEntries, i as getLocalInputPath, it as getPaginatedItemSchema, j as collectContractSchemaRoots, jt as toOpenAPI30Schema, k as asStringArray, kt as stripNoContentResponseBodies, l as AnySchema, lt as isNullSchema, m as GenerateOpenApiSpec, mt as modelSchemaExportName, nt as getOperationAction, o as normalizeWatchFolders, ot as getRobodevModuleRoles, p as GenerateOpenApiFileResult, pt as isZodSchema, q as generateORPCOpenAPISpec, r as createTinyOpenApiSourceRunner, rt as getOperationController, s as AclRule, st as getStringEnumValues, t as TinyOpenApiSourceRunnerConfig, tt as getOpenApiSchemaName, u as GenerateORPCOpenAPISpecOptions, ut as isNullableOnlySchema, v as ProcedureMeta, vt as namedOpenApiOutputSchema, w as applyOperationMeta, wt as resolveOpenApiOutputPath, x as ZodSchema, xt as namedOpenApiSchema, y as TinyOpenApiModule, yt as namedOpenApiRequestSchema, z as collectOperationTags } from "./openapi-source.runner-
|
|
1
|
+
import { $ as getModuleOpenApiTag, A as collectApiModelSchemaExports, At as toOpenAPI30Document, B as collectReachableModelSchemas, C as applyEnumExtensions, Ct as procedureSchemaName, D as applyRobodevModuleExtensions, Dt as schemaExportName, E as applyParameterExtensions, Et as schemaComponentRef, F as collectExtraSchemas, G as findComponentEnumNames, H as compactTagName, I as collectModelSchemaExports, J as generateOpenApiFile, K as findEnumNames, L as collectModuleModelSchemaExports, M as collectContractSchemas, Mt as toOpenAPIAclRule, N as collectDbTableModelSchemaExport, Nt as toPascalCase, O as applyRobodevUserRolesExtension, Ot as sharedSchemaExportName, P as collectDbTableModelSchemaExports, Pt as visitZodSchema, Q as getModuleOpenApiController, R as collectOperationMeta, S as addContractSchema, St as operationKey, T as applyPaginatedItemSchemas, Tt as routeHasPathParameters, U as createModelSchemaNameGetter, V as collectSchemaRegistryRoots, W as defineOpenApiSchemas, X as getContractProcedureData, Y as getComponentSchemas, Z as getDerivedOperationId, _ as OpenApiSchemaRegistry, _t as namedControllerActionSchema, a as isTinyOpenApiFakeMode, at as getProcedureInputSchemaRole, b as TinyOpenApiUserRole, bt as namedOpenApiResponseSchema, c as AnyContractRouter, ct as isContractProcedure, d as GenerateOpenApiFile, dt as isObject, et as getObjectPropertySchema, f as GenerateOpenApiFileOptions, ft as isProcedureMeta, g as JsonObject, gt as namedControllerActionInputDtoSchema, h as GenerateTinyOpenApiFileOptions, ht as modelSchemaNameEntries, i as getLocalInputPath, it as getPaginatedItemSchema, j as collectContractSchemaRoots, jt as toOpenAPI30Schema, k as asStringArray, kt as stripNoContentResponseBodies, l as AnySchema, lt as isNullSchema, m as GenerateOpenApiSpec, mt as modelSchemaExportName, nt as getOperationAction, o as normalizeWatchFolders, ot as getRobodevModuleRoles, p as GenerateOpenApiFileResult, pt as isZodSchema, q as generateORPCOpenAPISpec, r as createTinyOpenApiSourceRunner, rt as getOperationController, s as AclRule, st as getStringEnumValues, t as TinyOpenApiSourceRunnerConfig, tt as getOpenApiSchemaName, u as GenerateORPCOpenAPISpecOptions, ut as isNullableOnlySchema, v as ProcedureMeta, vt as namedOpenApiOutputSchema, w as applyOperationMeta, wt as resolveOpenApiOutputPath, x as ZodSchema, xt as namedOpenApiSchema, y as TinyOpenApiModule, yt as namedOpenApiRequestSchema, z as collectOperationTags } from "./openapi-source.runner-lmK-P6HE.mjs";
|
|
2
2
|
export { AclRule, AnyContractRouter, AnySchema, GenerateORPCOpenAPISpecOptions, GenerateOpenApiFile, GenerateOpenApiFileOptions, GenerateOpenApiFileResult, GenerateOpenApiSpec, GenerateTinyOpenApiFileOptions, JsonObject, OpenApiSchemaRegistry, ProcedureMeta, TinyOpenApiModule, type TinyOpenApiSourceRunnerConfig, TinyOpenApiUserRole, ZodSchema, addContractSchema, applyEnumExtensions, applyOperationMeta, applyPaginatedItemSchemas, applyParameterExtensions, applyRobodevModuleExtensions, applyRobodevUserRolesExtension, asStringArray, collectApiModelSchemaExports, collectContractSchemaRoots, collectContractSchemas, collectDbTableModelSchemaExport, collectDbTableModelSchemaExports, collectExtraSchemas, collectModelSchemaExports, collectModuleModelSchemaExports, collectOperationMeta, collectOperationTags, collectReachableModelSchemas, collectSchemaRegistryRoots, compactTagName, createModelSchemaNameGetter, createTinyOpenApiSourceRunner, defineOpenApiSchemas, findComponentEnumNames, findEnumNames, generateORPCOpenAPISpec, generateOpenApiFile, getComponentSchemas, getContractProcedureData, getDerivedOperationId, getModuleOpenApiController, getModuleOpenApiTag, getObjectPropertySchema, getOpenApiSchemaName, getOperationAction, getOperationController, getPaginatedItemSchema, getProcedureInputSchemaRole, getRobodevModuleRoles, getStringEnumValues, getLocalInputPath as getTinyOpenApiLocalInputPath, isContractProcedure, isNullSchema, isNullableOnlySchema, isObject, isProcedureMeta, isTinyOpenApiFakeMode, isZodSchema, modelSchemaExportName, modelSchemaNameEntries, namedControllerActionInputDtoSchema, namedControllerActionSchema, namedOpenApiOutputSchema, namedOpenApiRequestSchema, namedOpenApiResponseSchema, namedOpenApiSchema, normalizeWatchFolders as normalizeTinyOpenApiWatchFolders, operationKey, procedureSchemaName, resolveOpenApiOutputPath, routeHasPathParameters, schemaComponentRef, schemaExportName, sharedSchemaExportName, stripNoContentResponseBodies, toOpenAPI30Document, toOpenAPI30Schema, toOpenAPIAclRule, toPascalCase, visitZodSchema };
|
package/dist/vite.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as GenerateFileFormatter } from "./options-
|
|
2
|
-
import { t as OpenAPICodegenConfig } from "./config-
|
|
3
|
-
import { d as GenerateOpenApiFile, m as GenerateOpenApiSpec, n as TinyOpenApiSpecModuleConfig } from "./openapi-source.runner-
|
|
1
|
+
import { r as GenerateFileFormatter } from "./options-DH-fAG0w.mjs";
|
|
2
|
+
import { t as OpenAPICodegenConfig } from "./config-BYiBd1QI.mjs";
|
|
3
|
+
import { d as GenerateOpenApiFile, m as GenerateOpenApiSpec, n as TinyOpenApiSpecModuleConfig } from "./openapi-source.runner-lmK-P6HE.mjs";
|
|
4
4
|
import { Plugin, PluginOption } from "vite";
|
|
5
5
|
//#region src/plugins/openapi-codegen.runner.d.ts
|
|
6
6
|
type OpenApiCodegenPluginConfig = OpenAPICodegenConfig & {
|
package/dist/vite.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-
|
|
1
|
+
import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-DDd4AXRT.mjs";
|
|
2
2
|
import { i as normalizeWatchFolders, r as isTinyOpenApiFakeMode, t as createTinyOpenApiSourceRunner } from "./openapi-source.runner-DPUNTduQ.mjs";
|
|
3
3
|
import path from "path";
|
|
4
4
|
//#region src/vite/openapi-codegen.plugin.ts
|
package/package.json
CHANGED
|
@@ -125,13 +125,14 @@
|
|
|
125
125
|
"yargs": "^18.0.0"
|
|
126
126
|
},
|
|
127
127
|
"devDependencies": {
|
|
128
|
-
"@casl/ability": "
|
|
129
|
-
"@casl/react": "
|
|
128
|
+
"@casl/ability": "7.1.1",
|
|
129
|
+
"@casl/react": "7.1.0",
|
|
130
130
|
"@tanstack/react-query": "~5.90.21",
|
|
131
131
|
"@types/bun": "1.4.1",
|
|
132
132
|
"@types/node": "^25.3.0",
|
|
133
133
|
"@types/prompt-sync": "^4.2.3",
|
|
134
134
|
"@types/react": "^19.2.14",
|
|
135
|
+
"@types/react-test-renderer": "^19.1.0",
|
|
135
136
|
"@types/yargs": "^17.0.35",
|
|
136
137
|
"@vitejs/plugin-react": "^5.1.4",
|
|
137
138
|
"axios": "^1.13.1",
|
|
@@ -140,6 +141,7 @@
|
|
|
140
141
|
"oxlint": "1.50.0",
|
|
141
142
|
"oxlint-tsgolint": "^0.15.0",
|
|
142
143
|
"react": "^19.2.4",
|
|
144
|
+
"react-test-renderer": "19.2.4",
|
|
143
145
|
"tsdown": "^0.22.14",
|
|
144
146
|
"tsx": "^4.21.0",
|
|
145
147
|
"type-fest": "^5.4.4",
|
|
@@ -150,8 +152,8 @@
|
|
|
150
152
|
"zod": "^4.5.0"
|
|
151
153
|
},
|
|
152
154
|
"peerDependencies": {
|
|
153
|
-
"@casl/ability": "^
|
|
154
|
-
"@casl/react": "^
|
|
155
|
+
"@casl/ability": "^7.1.1",
|
|
156
|
+
"@casl/react": "^7.1.0",
|
|
155
157
|
"@tanstack/react-query": "^5.90.21",
|
|
156
158
|
"axios": "^1.13.1",
|
|
157
159
|
"i18next": "^25.8.11",
|
|
@@ -187,5 +189,5 @@
|
|
|
187
189
|
"node": ">= 18"
|
|
188
190
|
},
|
|
189
191
|
"packageManager": "bun@1.4.1",
|
|
190
|
-
"version": "3.3.
|
|
192
|
+
"version": "3.3.1"
|
|
191
193
|
}
|