@povio/openapi-codegen-cli 3.1.0 → 3.2.0-rc.2
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 +21 -14
- package/dist/acl.d.mts +6 -20
- package/dist/acl.mjs +3 -8
- package/dist/{auth.context-Bu5KW2sI.mjs → auth.context-YFWzkwoN.mjs} +3 -5
- package/dist/{config-BU7wVf7U.d.mts → config-DFpV8mjG.d.mts} +1 -2
- package/dist/{error-handling-D-mHJ60d.d.mts → error-handling-CNOHs4Fc.d.mts} +1 -4
- package/dist/{error-handling-DSI86D3u.mjs → error-handling-DDIXMA-R.mjs} +1 -7
- package/dist/generate.runner-BGhsnDm8.mjs +1674 -0
- package/dist/generate.utils-C29zzyBl.cjs +2281 -0
- package/dist/{generateCodeFromOpenAPIDoc-CbQ9gQss.mjs → generateCodeFromOpenAPIDoc-B0Cmn2dx.cjs} +1261 -2336
- package/dist/generateCodeFromOpenAPIDoc-CLQbTTwF.mjs +2004 -0
- package/dist/generator.d.mts +3 -10
- package/dist/generator.mjs +8 -9
- package/dist/getDataFromOpenAPIDoc-fPRPa4_t.mjs +1988 -0
- package/dist/index.d.mts +9 -48
- package/dist/index.mjs +4 -11
- package/dist/metro.cjs +114 -4923
- package/dist/metro.d.mts +3 -4
- package/dist/metro.mjs +4 -9
- 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-BqOhUduF.mjs → openapi-codegen.runner-BtaqQSH2.mjs} +3 -5
- package/dist/{openapi-source.runner-wLs5vqw6.mjs → openapi-source.runner-BZ6ZLgRO.mjs} +19 -10
- package/dist/{openapi-source.runner-BSIrB6ny.d.mts → openapi-source.runner-zPcbJwpP.d.mts} +2 -8
- package/dist/{options-CE4Koxof.d.mts → options-DtAnhCLZ.d.mts} +3 -1
- package/dist/sh.d.mts +1 -1
- package/dist/sh.mjs +25 -71
- package/dist/tiny.d.mts +1 -3
- package/dist/tiny.mjs +2 -3
- package/dist/vite.d.mts +3 -4
- package/dist/vite.mjs +6 -10
- package/dist/zod.d.mts +2 -7
- package/dist/zod.mjs +2 -4
- package/package.json +28 -26
- package/dist/generate.runner-DnUDkoAZ.mjs +0 -90
package/dist/metro.d.mts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
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-DtAnhCLZ.mjs";
|
|
2
|
+
import { t as OpenAPICodegenConfig } from "./config-DFpV8mjG.mjs";
|
|
3
|
+
import { d as GenerateOpenApiFile, m as GenerateOpenApiSpec, n as TinyOpenApiSpecModuleConfig } from "./openapi-source.runner-zPcbJwpP.mjs";
|
|
4
4
|
import { IncomingMessage, ServerResponse } from "http";
|
|
5
|
-
|
|
6
5
|
//#region src/metro/openapi-codegen.plugin.d.ts
|
|
7
6
|
type OpenApiCodegenMetroConfig = OpenAPICodegenConfig & {
|
|
8
7
|
formatGeneratedFile?: GenerateFileFormatter;
|
package/dist/metro.mjs
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import "./
|
|
3
|
-
import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-BqOhUduF.mjs";
|
|
4
|
-
import { i as normalizeWatchFolders, r as isTinyOpenApiFakeMode, t as createTinyOpenApiSourceRunner } from "./openapi-source.runner-wLs5vqw6.mjs";
|
|
1
|
+
import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-BtaqQSH2.mjs";
|
|
2
|
+
import { i as normalizeWatchFolders, r as isTinyOpenApiFakeMode, t as createTinyOpenApiSourceRunner } from "./openapi-source.runner-BZ6ZLgRO.mjs";
|
|
5
3
|
import fs from "fs";
|
|
6
4
|
import path from "path";
|
|
7
|
-
|
|
8
5
|
//#region src/metro/openapi-codegen.plugin.ts
|
|
9
6
|
function withOpenApiCodegen(metroConfig, codegenConfig, options = {}) {
|
|
10
7
|
if (isPromiseLike$1(metroConfig)) return metroConfig.then((resolvedConfig) => withResolvedOpenApiCodegen(resolvedConfig, codegenConfig, options));
|
|
@@ -84,10 +81,9 @@ function reportGenerateError$1(error) {
|
|
|
84
81
|
function reportWatcherError$1(error) {
|
|
85
82
|
console.error("[openapi-codegen] Failed to watch OpenAPI input from Metro config.", error);
|
|
86
83
|
}
|
|
87
|
-
|
|
88
84
|
//#endregion
|
|
89
85
|
//#region src/metro/tiny-openapi-codegen.plugin.ts
|
|
90
|
-
const watchedEvents = new Set(["change", "rename"]);
|
|
86
|
+
const watchedEvents = /* @__PURE__ */ new Set(["change", "rename"]);
|
|
91
87
|
function tinyOpenApiCodegenMetro(metroConfig, codegenConfig, options) {
|
|
92
88
|
if (isPromiseLike(metroConfig)) return metroConfig.then((resolvedConfig) => withResolvedTinyOpenApiCodegen(resolvedConfig, codegenConfig, options));
|
|
93
89
|
return withResolvedTinyOpenApiCodegen(metroConfig, codegenConfig, options);
|
|
@@ -213,6 +209,5 @@ function notifyMetroReload(server) {
|
|
|
213
209
|
function isRecord(value) {
|
|
214
210
|
return typeof value === "object" && value !== null;
|
|
215
211
|
}
|
|
216
|
-
|
|
217
212
|
//#endregion
|
|
218
|
-
export { tinyOpenApiCodegenMetro, withOpenApiCodegen };
|
|
213
|
+
export { tinyOpenApiCodegenMetro, withOpenApiCodegen };
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as runGenerate } from "./generate.runner-DnUDkoAZ.mjs";
|
|
1
|
+
import { Wn as Profiler, n as runGenerate } from "./generate.runner-BGhsnDm8.mjs";
|
|
3
2
|
import path from "path";
|
|
4
|
-
|
|
5
3
|
//#region src/plugins/openapi-codegen.runner.ts
|
|
6
4
|
function createOpenApiCodegenRunner(config, options = {}) {
|
|
7
5
|
let queue = Promise.resolve();
|
|
@@ -14,6 +12,7 @@ function createOpenApiCodegenRunner(config, options = {}) {
|
|
|
14
12
|
formatGeneratedFile,
|
|
15
13
|
profiler
|
|
16
14
|
});
|
|
15
|
+
for (const line of profiler.formatLines()) console.info(`[openapi-codegen] ${line}`);
|
|
17
16
|
options.onGenerated?.();
|
|
18
17
|
});
|
|
19
18
|
queue = run.then(() => void 0, () => void 0);
|
|
@@ -38,6 +37,5 @@ function getLocalInputPath(input, root) {
|
|
|
38
37
|
function isLocalOpenApiInput(input) {
|
|
39
38
|
return typeof input === "string" && !/^https?:\/\//i.test(input);
|
|
40
39
|
}
|
|
41
|
-
|
|
42
40
|
//#endregion
|
|
43
|
-
export { createOpenApiCodegenRunner as t };
|
|
41
|
+
export { createOpenApiCodegenRunner as t };
|
|
@@ -2,7 +2,6 @@ import fs from "fs";
|
|
|
2
2
|
import path, { join } from "path";
|
|
3
3
|
import { pathToFileURL } from "url";
|
|
4
4
|
import { access, readdir } from "fs/promises";
|
|
5
|
-
|
|
6
5
|
//#region src/tiny/openapi.ts
|
|
7
6
|
async function importRuntimeModule(specifier) {
|
|
8
7
|
return new Function("specifier", "return import(specifier)")(specifier);
|
|
@@ -20,7 +19,7 @@ const PAGINATION_PROPERTY_NAMES = [
|
|
|
20
19
|
"limit",
|
|
21
20
|
"totalItems"
|
|
22
21
|
];
|
|
23
|
-
const OPENAPI_31_ONLY_KEYS = new Set([
|
|
22
|
+
const OPENAPI_31_ONLY_KEYS = /* @__PURE__ */ new Set([
|
|
24
23
|
"$schema",
|
|
25
24
|
"$id",
|
|
26
25
|
"$vocabulary",
|
|
@@ -586,13 +585,18 @@ function toOpenAPI30Document(spec) {
|
|
|
586
585
|
return converted;
|
|
587
586
|
}
|
|
588
587
|
async function generateORPCOpenAPISpec(options) {
|
|
589
|
-
const
|
|
590
|
-
const
|
|
591
|
-
const
|
|
592
|
-
const
|
|
588
|
+
const profile = process.env.TINY_OPENAPI_PROFILE === "1";
|
|
589
|
+
const started = performance.now();
|
|
590
|
+
const runtimePromise = Promise.all([importRuntimeModule("@orpc/openapi"), importRuntimeModule("@orpc/zod/zod4")]);
|
|
591
|
+
const modelSchemasPromise = collectModelSchemaExports({
|
|
593
592
|
apiRoot: options.apiRoot,
|
|
594
593
|
dbTablesRoot: options.dbTablesRoot
|
|
595
594
|
});
|
|
595
|
+
const [[{ OpenAPIGenerator }, { ZodToJsonSchemaConverter }], modelSchemas] = await Promise.all([runtimePromise, modelSchemasPromise]);
|
|
596
|
+
const generator = new OpenAPIGenerator({ schemaConverters: [new ZodToJsonSchemaConverter()] });
|
|
597
|
+
const afterRuntime = performance.now();
|
|
598
|
+
const explicitSchemaName = options.getOpenApiSchemaName ?? getOpenApiSchemaName;
|
|
599
|
+
const afterModels = performance.now();
|
|
596
600
|
const getSchemaName = createModelSchemaNameGetter(modelSchemas, explicitSchemaName);
|
|
597
601
|
const operationMeta = collectOperationMeta(options.contract);
|
|
598
602
|
const extraSchemas = collectExtraSchemas(options.apiModules);
|
|
@@ -608,6 +612,7 @@ async function generateORPCOpenAPISpec(options) {
|
|
|
608
612
|
...extraSchemas,
|
|
609
613
|
...reachableModelSchemas
|
|
610
614
|
};
|
|
615
|
+
const afterCollection = performance.now();
|
|
611
616
|
const spec = await generator.generate(options.contract, {
|
|
612
617
|
info: options.info ?? {
|
|
613
618
|
title: "Tiny Template Fake API",
|
|
@@ -621,6 +626,7 @@ async function generateORPCOpenAPISpec(options) {
|
|
|
621
626
|
...Object.keys(commonSchemas).length > 0 ? { commonSchemas } : {}
|
|
622
627
|
});
|
|
623
628
|
const jsonSpec = spec;
|
|
629
|
+
const afterGeneration = performance.now();
|
|
624
630
|
const sortableSchemaNames = options.realBackendSortableSchemaNames instanceof Map ? options.realBackendSortableSchemaNames : new Map(Object.entries(options.realBackendSortableSchemaNames ?? {}));
|
|
625
631
|
applyOperationMeta(jsonSpec, operationMeta, options.apiModules);
|
|
626
632
|
applyEnumExtensions(spec);
|
|
@@ -643,9 +649,13 @@ async function generateORPCOpenAPISpec(options) {
|
|
|
643
649
|
}
|
|
644
650
|
applyRobodevModuleExtensions(jsonSpec, robodevModuleExtensions, options.apiModules);
|
|
645
651
|
applyRobodevUserRolesExtension(jsonSpec, userRoles);
|
|
646
|
-
|
|
652
|
+
const output = toOpenAPI30Document(jsonSpec);
|
|
653
|
+
if (profile) {
|
|
654
|
+
const finished = performance.now();
|
|
655
|
+
console.error(`tiny openapi profile runtime=${(afterRuntime - started).toFixed(1)}ms models=${(afterModels - afterRuntime).toFixed(1)}ms collection=${(afterCollection - afterModels).toFixed(1)}ms orpc=${(afterGeneration - afterCollection).toFixed(1)}ms post=${(finished - afterGeneration).toFixed(1)}ms total=${(finished - started).toFixed(1)}ms`);
|
|
656
|
+
}
|
|
657
|
+
return output;
|
|
647
658
|
}
|
|
648
|
-
|
|
649
659
|
//#endregion
|
|
650
660
|
//#region src/tiny/openapi-source.runner.ts
|
|
651
661
|
function createTinyOpenApiSourceRunner(config) {
|
|
@@ -700,6 +710,5 @@ async function loadOpenApiSpecGenerator(config) {
|
|
|
700
710
|
if (typeof generateOpenApiSpec !== "function") throw new Error(`Tiny OpenAPI spec module "${moduleConfig.path}" does not export function "${exportName}".`);
|
|
701
711
|
return generateOpenApiSpec;
|
|
702
712
|
}
|
|
703
|
-
|
|
704
713
|
//#endregion
|
|
705
|
-
export { namedControllerActionInputDtoSchema as $, generateORPCOpenAPISpec as A, getOperationController as B, collectReachableModelSchemas as C, defineOpenApiSchemas as D, createModelSchemaNameGetter as E, getModuleOpenApiController as F, isContractProcedure as G, getProcedureInputSchemaRole as H, getModuleOpenApiTag as I, isObject as J, isNullSchema as K, getObjectPropertySchema as L, getComponentSchemas as M, getContractProcedureData as N, findComponentEnumNames as O, getDerivedOperationId as P, modelSchemaNameEntries as Q, getOpenApiSchemaName as R, collectOperationTags as S, compactTagName as T, getRobodevModuleRoles as U, getPaginatedItemSchema as V, getStringEnumValues as W, isZodSchema as X, isProcedureMeta as Y, modelSchemaExportName as Z, collectDbTableModelSchemaExports as _, visitZodSchema as _t, addContractSchema as a, operationKey as at, collectModuleModelSchemaExports as b, applyPaginatedItemSchemas as c, routeHasPathParameters as ct, applyRobodevUserRolesExtension as d, sharedSchemaExportName as dt, namedControllerActionSchema as et, asStringArray as f, stripNoContentResponseBodies as ft, collectDbTableModelSchemaExport as g, toPascalCase as gt, collectContractSchemas as h, toOpenAPIAclRule as ht, normalizeWatchFolders as i, namedOpenApiSchema as it, generateOpenApiFile as j, findEnumNames as k, applyParameterExtensions as l, schemaComponentRef as lt, collectContractSchemaRoots as m, toOpenAPI30Schema as mt, getLocalInputPath as n, namedOpenApiRequestSchema as nt, applyEnumExtensions as o, procedureSchemaName as ot, collectApiModelSchemaExports as p, toOpenAPI30Document as pt, isNullableOnlySchema as q, isTinyOpenApiFakeMode as r, namedOpenApiResponseSchema as rt, applyOperationMeta as s, resolveOpenApiOutputPath as st, createTinyOpenApiSourceRunner as t, namedOpenApiOutputSchema as tt, applyRobodevModuleExtensions as u, schemaExportName as ut, collectExtraSchemas as v, collectSchemaRegistryRoots as w, collectOperationMeta as x, collectModelSchemaExports as y, getOperationAction as z };
|
|
714
|
+
export { namedControllerActionInputDtoSchema as $, generateORPCOpenAPISpec as A, getOperationController as B, collectReachableModelSchemas as C, defineOpenApiSchemas as D, createModelSchemaNameGetter as E, getModuleOpenApiController as F, isContractProcedure as G, getProcedureInputSchemaRole as H, getModuleOpenApiTag as I, isObject as J, isNullSchema as K, getObjectPropertySchema as L, getComponentSchemas as M, getContractProcedureData as N, findComponentEnumNames as O, getDerivedOperationId as P, modelSchemaNameEntries as Q, getOpenApiSchemaName as R, collectOperationTags as S, compactTagName as T, getRobodevModuleRoles as U, getPaginatedItemSchema as V, getStringEnumValues as W, isZodSchema as X, isProcedureMeta as Y, modelSchemaExportName as Z, collectDbTableModelSchemaExports as _, visitZodSchema as _t, addContractSchema as a, operationKey as at, collectModuleModelSchemaExports as b, applyPaginatedItemSchemas as c, routeHasPathParameters as ct, applyRobodevUserRolesExtension as d, sharedSchemaExportName as dt, namedControllerActionSchema as et, asStringArray as f, stripNoContentResponseBodies as ft, collectDbTableModelSchemaExport as g, toPascalCase as gt, collectContractSchemas as h, toOpenAPIAclRule as ht, normalizeWatchFolders as i, namedOpenApiSchema as it, generateOpenApiFile as j, findEnumNames as k, applyParameterExtensions as l, schemaComponentRef as lt, collectContractSchemaRoots as m, toOpenAPI30Schema as mt, getLocalInputPath as n, namedOpenApiRequestSchema as nt, applyEnumExtensions as o, procedureSchemaName as ot, collectApiModelSchemaExports as p, toOpenAPI30Document as pt, isNullableOnlySchema as q, isTinyOpenApiFakeMode as r, namedOpenApiResponseSchema as rt, applyOperationMeta as s, resolveOpenApiOutputPath as st, createTinyOpenApiSourceRunner as t, namedOpenApiOutputSchema as tt, applyRobodevModuleExtensions as u, schemaExportName as ut, collectExtraSchemas as v, collectSchemaRegistryRoots as w, collectOperationMeta as x, collectModelSchemaExports as y, getOperationAction as z };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { t as OpenAPICodegenConfig } from "./config-
|
|
2
|
-
|
|
1
|
+
import { t as OpenAPICodegenConfig } from "./config-DFpV8mjG.mjs";
|
|
3
2
|
//#region src/tiny/openapi.d.ts
|
|
4
3
|
interface GenerateOpenApiFileOptions {
|
|
5
4
|
argv?: readonly string[];
|
|
@@ -79,12 +78,7 @@ interface OrpcContractProcedureData {
|
|
|
79
78
|
successStatus?: number;
|
|
80
79
|
};
|
|
81
80
|
}
|
|
82
|
-
declare function resolveOpenApiOutputPath({
|
|
83
|
-
argv,
|
|
84
|
-
cwd,
|
|
85
|
-
defaultOutput,
|
|
86
|
-
env
|
|
87
|
-
}: GenerateOpenApiFileOptions): string;
|
|
81
|
+
declare function resolveOpenApiOutputPath({ argv, cwd, defaultOutput, env }: GenerateOpenApiFileOptions): string;
|
|
88
82
|
declare function generateOpenApiFile(options: GenerateTinyOpenApiFileOptions): Promise<GenerateOpenApiFileResult>;
|
|
89
83
|
declare function defineOpenApiSchemas<const TSchemas extends OpenApiSchemaRegistry>(schemas: TSchemas): TSchemas;
|
|
90
84
|
declare function collectExtraSchemas<TModules extends Record<string, {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { OpenAPIV3 } from "openapi-types";
|
|
2
|
-
|
|
3
2
|
//#region src/generators/types/generate.d.ts
|
|
4
3
|
declare enum GenerateType {
|
|
5
4
|
Models = "models",
|
|
@@ -28,6 +27,7 @@ interface ZodGenerateOptions {
|
|
|
28
27
|
}
|
|
29
28
|
interface EndpointsGenerateOptions {
|
|
30
29
|
restClientImportPath: string;
|
|
30
|
+
zodImportPath: string;
|
|
31
31
|
errorHandlingImportPath?: string;
|
|
32
32
|
withDeprecatedEndpoints?: boolean;
|
|
33
33
|
removeOperationPrefixEndingWith?: string;
|
|
@@ -37,6 +37,7 @@ interface EndpointsGenerateOptions {
|
|
|
37
37
|
}
|
|
38
38
|
interface QueriesGenerateOptions {
|
|
39
39
|
queryTypesImportPath: string;
|
|
40
|
+
mutationEffectsImportPath: string;
|
|
40
41
|
axiosRequestConfig?: boolean;
|
|
41
42
|
mutationEffects?: boolean;
|
|
42
43
|
mutationDefaultOnError?: boolean;
|
|
@@ -64,6 +65,7 @@ interface ACLGenerateOptions {
|
|
|
64
65
|
checkAcl?: boolean;
|
|
65
66
|
abilityContextGenericAppAbilities: boolean;
|
|
66
67
|
abilityContextImportPath?: string;
|
|
68
|
+
aclCheckImportPath: string;
|
|
67
69
|
}
|
|
68
70
|
interface BuilderConfigsGenerateOptions {
|
|
69
71
|
builderConfigs?: boolean;
|
package/dist/sh.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {}
|
package/dist/sh.mjs
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { createRequire } from "node:module";
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import { i as VALIDATION_ERROR_TYPE_TITLE, n as groupByType, t as getDataFromOpenAPIDoc } from "./getDataFromOpenAPIDoc-fPRPa4_t.mjs";
|
|
3
|
+
import { D as getTagFileName, Wn as Profiler, a as resolveConfig, n as runGenerate, o as getOutputFileName, t as getOpenApiDoc } from "./generate.runner-BGhsnDm8.mjs";
|
|
5
4
|
import yargs from "yargs";
|
|
6
5
|
import { hideBin } from "yargs/helpers";
|
|
7
6
|
import { styleText } from "node:util";
|
|
8
|
-
import fs
|
|
7
|
+
import fs from "fs";
|
|
9
8
|
import "reflect-metadata";
|
|
10
9
|
import path from "path";
|
|
11
|
-
import SwaggerParser from "@apidevtools/swagger-parser";
|
|
12
10
|
import { exec } from "child_process";
|
|
13
|
-
|
|
14
|
-
//#region \0rolldown/runtime.js
|
|
15
|
-
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
16
|
-
|
|
17
|
-
//#endregion
|
|
18
11
|
//#region src/helpers/cli.helper.ts
|
|
19
12
|
function log(message) {
|
|
20
13
|
console.log(message);
|
|
@@ -32,16 +25,14 @@ function logError(error, message) {
|
|
|
32
25
|
function logBanner(message) {
|
|
33
26
|
console.log(styleText("bgYellow", `==== ${message} ====`));
|
|
34
27
|
}
|
|
35
|
-
|
|
36
28
|
//#endregion
|
|
37
29
|
//#region src/helpers/version.helper.ts
|
|
38
30
|
/**
|
|
39
31
|
* Fetch the version from package.json
|
|
40
32
|
*/
|
|
41
33
|
function getVersion() {
|
|
42
|
-
return "3.
|
|
34
|
+
return "3.2.0-rc.2";
|
|
43
35
|
}
|
|
44
|
-
|
|
45
36
|
//#endregion
|
|
46
37
|
//#region src/helpers/yargs.helper.ts
|
|
47
38
|
const optionsKey = Symbol("options_key");
|
|
@@ -83,7 +74,6 @@ async function loadYargsConfig(cls, _argv) {
|
|
|
83
74
|
for (const [name, o] of Object.entries(getYargsOption(cls))) argv[name] = _argv[name] ?? o.default;
|
|
84
75
|
return argv;
|
|
85
76
|
}
|
|
86
|
-
|
|
87
77
|
//#endregion
|
|
88
78
|
//#region src/generators/checkOpenAPIDoc.ts
|
|
89
79
|
function checkOpenAPIDoc(openApiDoc, options) {
|
|
@@ -101,9 +91,9 @@ function checkOpenAPIDoc(openApiDoc, options) {
|
|
|
101
91
|
}
|
|
102
92
|
function getOutputFileNames(tag, options) {
|
|
103
93
|
return [
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
94
|
+
"models",
|
|
95
|
+
"endpoints",
|
|
96
|
+
"queries"
|
|
107
97
|
].map((type) => getOutputFileName({
|
|
108
98
|
output: options.output,
|
|
109
99
|
fileName: getTagFileName({
|
|
@@ -113,7 +103,6 @@ function getOutputFileNames(tag, options) {
|
|
|
113
103
|
})
|
|
114
104
|
}));
|
|
115
105
|
}
|
|
116
|
-
|
|
117
106
|
//#endregion
|
|
118
107
|
//#region src/helpers/config.helper.ts
|
|
119
108
|
const CONFIG_FILE_NAMES = ["openapi-codegen.config.mjs", "openapi-codegen.config.ts"];
|
|
@@ -136,87 +125,50 @@ async function loadConfigFromPath(filePath) {
|
|
|
136
125
|
const ext = path.extname(absolutePath).toLowerCase();
|
|
137
126
|
if (ext === ".mjs") return loadMjsConfig(absolutePath);
|
|
138
127
|
if (ext !== ".ts") throw new Error(`Only ESM (.mjs) and TypeScript (.ts) configuration files are supported. Found: ${ext}`);
|
|
139
|
-
return
|
|
128
|
+
return loadModuleConfig(absolutePath, "TypeScript");
|
|
140
129
|
}
|
|
141
130
|
async function loadMjsConfig(filePath) {
|
|
131
|
+
return loadModuleConfig(filePath, "ESM");
|
|
132
|
+
}
|
|
133
|
+
async function loadModuleConfig(filePath, format) {
|
|
142
134
|
const imported = await import(`${pathToFileURL(filePath).href}?t=${Date.now()}`);
|
|
143
|
-
if (!imported.default) throw new Error(
|
|
135
|
+
if (!imported.default) throw new Error(`${format} config must have a default export: ${filePath}`);
|
|
144
136
|
return imported.default;
|
|
145
137
|
}
|
|
146
|
-
let importFresh;
|
|
147
|
-
const loadJsSync = function loadJsSync(filepath) {
|
|
148
|
-
if (importFresh === void 0) importFresh = __require("import-fresh");
|
|
149
|
-
return importFresh(filepath);
|
|
150
|
-
};
|
|
151
|
-
let typescript;
|
|
152
|
-
async function loadTsConfig(filePath) {
|
|
153
|
-
if (typescript === void 0) typescript = __require("typescript");
|
|
154
|
-
const transpiledFilepath = `${filePath.slice(0, -2)}cjs`;
|
|
155
|
-
try {
|
|
156
|
-
const tsConfig = resolveTsConfig(path.dirname(filePath)) ?? {};
|
|
157
|
-
tsConfig.compilerOptions = Object.assign({}, tsConfig.compilerOptions, {
|
|
158
|
-
module: typescript.ModuleKind.NodeNext,
|
|
159
|
-
moduleResolution: typescript.ModuleResolutionKind.NodeNext,
|
|
160
|
-
target: typescript.ScriptTarget.ES2022,
|
|
161
|
-
noEmit: false
|
|
162
|
-
});
|
|
163
|
-
const fileContent = fs.readFileSync(filePath, "utf-8");
|
|
164
|
-
const transpiledFileContent = typescript.transpileModule(fileContent, tsConfig).outputText;
|
|
165
|
-
writeFileSync(transpiledFilepath, transpiledFileContent);
|
|
166
|
-
return loadJsSync(transpiledFilepath).default;
|
|
167
|
-
} catch (error) {
|
|
168
|
-
error.message = `TypeScript Error in ${filePath}:\n${error.message}`;
|
|
169
|
-
throw error;
|
|
170
|
-
} finally {
|
|
171
|
-
if (existsSync(transpiledFilepath)) rmSync(transpiledFilepath);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
function resolveTsConfig(directory) {
|
|
175
|
-
const filePath = typescript.findConfigFile(directory, (fileName) => {
|
|
176
|
-
return typescript.sys.fileExists(fileName);
|
|
177
|
-
});
|
|
178
|
-
if (filePath === void 0) return;
|
|
179
|
-
const { config, error } = typescript.readConfigFile(filePath, (path) => typescript.sys.readFile(path));
|
|
180
|
-
if (error) throw new Error(`Error in ${filePath}: ${error.messageText.toString()}`);
|
|
181
|
-
return config;
|
|
182
|
-
}
|
|
183
138
|
function pathToFileURL(filePath) {
|
|
184
139
|
const normalizedPath = path.resolve(filePath).replace(/\\/g, "/");
|
|
185
140
|
return { href: normalizedPath.startsWith("/") ? `file://${normalizedPath}` : `file:///${normalizedPath}` };
|
|
186
141
|
}
|
|
187
|
-
|
|
188
142
|
//#endregion
|
|
189
143
|
//#region src/commands/check.ts
|
|
190
144
|
async function check({ verbose, config: configParam, includeTags: _includeTagsParam, excludeTags: _excludeTagsParam, ...params }) {
|
|
191
145
|
const start = Date.now();
|
|
192
146
|
if (verbose) logInfo("Resolving config...");
|
|
147
|
+
const fileConfig = await loadConfig(configParam);
|
|
193
148
|
const config = resolveConfig({
|
|
194
|
-
fileConfig
|
|
149
|
+
fileConfig,
|
|
195
150
|
params
|
|
196
151
|
});
|
|
197
152
|
if (verbose) logInfo("Parsing OpenAPI spec...");
|
|
198
|
-
const openApiDoc = await
|
|
153
|
+
const openApiDoc = await getOpenApiDoc(config.input);
|
|
199
154
|
if (verbose) logInfo("Running check...");
|
|
200
155
|
const errorMessages = checkOpenAPIDoc(openApiDoc, config);
|
|
201
156
|
if (errorMessages.length === 0) logSuccess(`Time: ${Date.now() - start}ms`);
|
|
202
157
|
else throw new Error(`Found ${errorMessages.length} issues. Time: ${Date.now() - start}ms`);
|
|
203
158
|
}
|
|
204
|
-
|
|
205
159
|
//#endregion
|
|
206
|
-
//#region \0@oxc-project+runtime@0.
|
|
160
|
+
//#region \0@oxc-project+runtime@0.142.0/helpers/esm/decorateMetadata.js
|
|
207
161
|
function __decorateMetadata(k, v) {
|
|
208
162
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
209
163
|
}
|
|
210
|
-
|
|
211
164
|
//#endregion
|
|
212
|
-
//#region \0@oxc-project+runtime@0.
|
|
165
|
+
//#region \0@oxc-project+runtime@0.142.0/helpers/esm/decorate.js
|
|
213
166
|
function __decorate(decorators, target, key, desc) {
|
|
214
167
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
215
168
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
216
169
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
217
170
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
218
171
|
}
|
|
219
|
-
|
|
220
172
|
//#endregion
|
|
221
173
|
//#region src/commands/check.command.ts
|
|
222
174
|
var CheckOptions = class {
|
|
@@ -259,7 +211,6 @@ const command$1 = {
|
|
|
259
211
|
return check(argv);
|
|
260
212
|
}
|
|
261
213
|
};
|
|
262
|
-
|
|
263
214
|
//#endregion
|
|
264
215
|
//#region src/commands/generate.ts
|
|
265
216
|
async function generate({ prettier, verbose, config: configParam, ...params }) {
|
|
@@ -293,7 +244,6 @@ function execPrettier({ output, verbose }) {
|
|
|
293
244
|
else logSuccess("Prettier finished.");
|
|
294
245
|
});
|
|
295
246
|
}
|
|
296
|
-
|
|
297
247
|
//#endregion
|
|
298
248
|
//#region src/commands/generate.command.ts
|
|
299
249
|
var GenerateOptions = class {
|
|
@@ -313,6 +263,9 @@ var GenerateOptions = class {
|
|
|
313
263
|
importPath;
|
|
314
264
|
extractEnums;
|
|
315
265
|
modelsInCommon;
|
|
266
|
+
zodImportPath;
|
|
267
|
+
mutationEffectsImportPath;
|
|
268
|
+
aclCheckImportPath;
|
|
316
269
|
removeOperationPrefixEndingWith;
|
|
317
270
|
acl;
|
|
318
271
|
checkAcl;
|
|
@@ -369,6 +322,9 @@ __decorate([YargOption({
|
|
|
369
322
|
envAlias: "modelsInCommon",
|
|
370
323
|
type: "boolean"
|
|
371
324
|
}), __decorateMetadata("design:type", Boolean)], GenerateOptions.prototype, "modelsInCommon", void 0);
|
|
325
|
+
__decorate([YargOption({ envAlias: "zodImportPath" }), __decorateMetadata("design:type", String)], GenerateOptions.prototype, "zodImportPath", void 0);
|
|
326
|
+
__decorate([YargOption({ envAlias: "mutationEffectsImportPath" }), __decorateMetadata("design:type", String)], GenerateOptions.prototype, "mutationEffectsImportPath", void 0);
|
|
327
|
+
__decorate([YargOption({ envAlias: "aclCheckImportPath" }), __decorateMetadata("design:type", String)], GenerateOptions.prototype, "aclCheckImportPath", void 0);
|
|
372
328
|
__decorate([YargOption({ envAlias: "removeOperationPrefixEndingWith" }), __decorateMetadata("design:type", String)], GenerateOptions.prototype, "removeOperationPrefixEndingWith", void 0);
|
|
373
329
|
__decorate([YargOption({
|
|
374
330
|
envAlias: "acl",
|
|
@@ -441,7 +397,6 @@ const command = {
|
|
|
441
397
|
return generate(argv);
|
|
442
398
|
}
|
|
443
399
|
};
|
|
444
|
-
|
|
445
400
|
//#endregion
|
|
446
401
|
//#region src/sh.ts
|
|
447
402
|
yargs(hideBin(process.argv)).version(getVersion() || "unknown").scriptName("openapi-codegen").command(command).command(command$1).help().demandCommand(1).strictCommands(true).showHelpOnFail(true).fail((msg, err) => {
|
|
@@ -450,6 +405,5 @@ yargs(hideBin(process.argv)).version(getVersion() || "unknown").scriptName("open
|
|
|
450
405
|
logInfo("Use '--help' for more info");
|
|
451
406
|
process.exit(1);
|
|
452
407
|
}).parse();
|
|
453
|
-
|
|
454
408
|
//#endregion
|
|
455
|
-
export {
|
|
409
|
+
export {};
|
package/dist/tiny.d.mts
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import "./config-BU7wVf7U.mjs";
|
|
3
|
-
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-BSIrB6ny.mjs";
|
|
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-zPcbJwpP.mjs";
|
|
4
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/tiny.mjs
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { $ as namedControllerActionInputDtoSchema, A as generateORPCOpenAPISpec, B as getOperationController, C as collectReachableModelSchemas, D as defineOpenApiSchemas, E as createModelSchemaNameGetter, F as getModuleOpenApiController, G as isContractProcedure, H as getProcedureInputSchemaRole, I as getModuleOpenApiTag, J as isObject, K as isNullSchema, L as getObjectPropertySchema, M as getComponentSchemas, N as getContractProcedureData, O as findComponentEnumNames, P as getDerivedOperationId, Q as modelSchemaNameEntries, R as getOpenApiSchemaName, S as collectOperationTags, T as compactTagName, U as getRobodevModuleRoles, V as getPaginatedItemSchema, W as getStringEnumValues, X as isZodSchema, Y as isProcedureMeta, Z as modelSchemaExportName, _ as collectDbTableModelSchemaExports, _t as visitZodSchema, a as addContractSchema, at as operationKey, b as collectModuleModelSchemaExports, c as applyPaginatedItemSchemas, ct as routeHasPathParameters, d as applyRobodevUserRolesExtension, dt as sharedSchemaExportName, et as namedControllerActionSchema, f as asStringArray, ft as stripNoContentResponseBodies, g as collectDbTableModelSchemaExport, gt as toPascalCase, h as collectContractSchemas, ht as toOpenAPIAclRule, i as normalizeWatchFolders, it as namedOpenApiSchema, j as generateOpenApiFile, k as findEnumNames, l as applyParameterExtensions, lt as schemaComponentRef, m as collectContractSchemaRoots, mt as toOpenAPI30Schema, n as getLocalInputPath, nt as namedOpenApiRequestSchema, o as applyEnumExtensions, ot as procedureSchemaName, p as collectApiModelSchemaExports, pt as toOpenAPI30Document, q as isNullableOnlySchema, r as isTinyOpenApiFakeMode, rt as namedOpenApiResponseSchema, s as applyOperationMeta, st as resolveOpenApiOutputPath, t as createTinyOpenApiSourceRunner, tt as namedOpenApiOutputSchema, u as applyRobodevModuleExtensions, ut as schemaExportName, v as collectExtraSchemas, w as collectSchemaRegistryRoots, x as collectOperationMeta, y as collectModelSchemaExports, z as getOperationAction } from "./openapi-source.runner-
|
|
2
|
-
|
|
3
|
-
export { 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 };
|
|
1
|
+
import { $ as namedControllerActionInputDtoSchema, A as generateORPCOpenAPISpec, B as getOperationController, C as collectReachableModelSchemas, D as defineOpenApiSchemas, E as createModelSchemaNameGetter, F as getModuleOpenApiController, G as isContractProcedure, H as getProcedureInputSchemaRole, I as getModuleOpenApiTag, J as isObject, K as isNullSchema, L as getObjectPropertySchema, M as getComponentSchemas, N as getContractProcedureData, O as findComponentEnumNames, P as getDerivedOperationId, Q as modelSchemaNameEntries, R as getOpenApiSchemaName, S as collectOperationTags, T as compactTagName, U as getRobodevModuleRoles, V as getPaginatedItemSchema, W as getStringEnumValues, X as isZodSchema, Y as isProcedureMeta, Z as modelSchemaExportName, _ as collectDbTableModelSchemaExports, _t as visitZodSchema, a as addContractSchema, at as operationKey, b as collectModuleModelSchemaExports, c as applyPaginatedItemSchemas, ct as routeHasPathParameters, d as applyRobodevUserRolesExtension, dt as sharedSchemaExportName, et as namedControllerActionSchema, f as asStringArray, ft as stripNoContentResponseBodies, g as collectDbTableModelSchemaExport, gt as toPascalCase, h as collectContractSchemas, ht as toOpenAPIAclRule, i as normalizeWatchFolders, it as namedOpenApiSchema, j as generateOpenApiFile, k as findEnumNames, l as applyParameterExtensions, lt as schemaComponentRef, m as collectContractSchemaRoots, mt as toOpenAPI30Schema, n as getLocalInputPath, nt as namedOpenApiRequestSchema, o as applyEnumExtensions, ot as procedureSchemaName, p as collectApiModelSchemaExports, pt as toOpenAPI30Document, q as isNullableOnlySchema, r as isTinyOpenApiFakeMode, rt as namedOpenApiResponseSchema, s as applyOperationMeta, st as resolveOpenApiOutputPath, t as createTinyOpenApiSourceRunner, tt as namedOpenApiOutputSchema, u as applyRobodevModuleExtensions, ut as schemaExportName, v as collectExtraSchemas, w as collectSchemaRegistryRoots, x as collectOperationMeta, y as collectModelSchemaExports, z as getOperationAction } from "./openapi-source.runner-BZ6ZLgRO.mjs";
|
|
2
|
+
export { 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,8 +1,7 @@
|
|
|
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-DtAnhCLZ.mjs";
|
|
2
|
+
import { t as OpenAPICodegenConfig } from "./config-DFpV8mjG.mjs";
|
|
3
|
+
import { d as GenerateOpenApiFile, m as GenerateOpenApiSpec, n as TinyOpenApiSpecModuleConfig } from "./openapi-source.runner-zPcbJwpP.mjs";
|
|
4
4
|
import { Plugin, PluginOption } from "vite";
|
|
5
|
-
|
|
6
5
|
//#region src/plugins/openapi-codegen.runner.d.ts
|
|
7
6
|
type OpenApiCodegenPluginConfig = OpenAPICodegenConfig & {
|
|
8
7
|
formatGeneratedFile?: GenerateFileFormatter;
|
package/dist/vite.mjs
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import "./
|
|
3
|
-
import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-BqOhUduF.mjs";
|
|
4
|
-
import { i as normalizeWatchFolders, r as isTinyOpenApiFakeMode, t as createTinyOpenApiSourceRunner } from "./openapi-source.runner-wLs5vqw6.mjs";
|
|
1
|
+
import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-BtaqQSH2.mjs";
|
|
2
|
+
import { i as normalizeWatchFolders, r as isTinyOpenApiFakeMode, t as createTinyOpenApiSourceRunner } from "./openapi-source.runner-BZ6ZLgRO.mjs";
|
|
5
3
|
import path from "path";
|
|
6
|
-
|
|
7
4
|
//#region src/vite/openapi-codegen.plugin.ts
|
|
8
5
|
function openApiCodegen(config) {
|
|
9
6
|
let resolvedViteConfig;
|
|
@@ -37,10 +34,9 @@ function openApiCodegen(config) {
|
|
|
37
34
|
}
|
|
38
35
|
};
|
|
39
36
|
}
|
|
40
|
-
|
|
41
37
|
//#endregion
|
|
42
38
|
//#region src/vite/tiny-openapi-codegen.plugin.ts
|
|
43
|
-
const watchedEvents = new Set([
|
|
39
|
+
const watchedEvents = /* @__PURE__ */ new Set([
|
|
44
40
|
"add",
|
|
45
41
|
"change",
|
|
46
42
|
"unlink"
|
|
@@ -79,7 +75,8 @@ function tinyOpenApiCodegenPlugin(codegenConfig, options) {
|
|
|
79
75
|
}, debounceMs);
|
|
80
76
|
};
|
|
81
77
|
const setupWatcher = (server) => {
|
|
82
|
-
const
|
|
78
|
+
const root = resolvedConfig?.root ?? server.config.root;
|
|
79
|
+
const watchFolders = normalizeWatchFolders(root, options.watchFolders);
|
|
83
80
|
server.watcher.add(watchFolders);
|
|
84
81
|
server.watcher.on("all", (event, changedPath) => {
|
|
85
82
|
if (watchedEvents.has(event) && isPathInWatchFolders(changedPath, watchFolders)) scheduleGenerate(server);
|
|
@@ -111,6 +108,5 @@ function isPathInWatchFolders(changedPath, watchFolders) {
|
|
|
111
108
|
return relativePath === "" || !relativePath.startsWith("..") && !path.isAbsolute(relativePath);
|
|
112
109
|
});
|
|
113
110
|
}
|
|
114
|
-
|
|
115
111
|
//#endregion
|
|
116
|
-
export { openApiCodegen, tinyOpenApiCodegen };
|
|
112
|
+
export { openApiCodegen, tinyOpenApiCodegen };
|
package/dist/zod.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { a as ErrorHandler } from "./error-handling-
|
|
1
|
+
import { a as ErrorHandler } from "./error-handling-CNOHs4Fc.mjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
|
|
4
3
|
//#region src/zod.d.ts
|
|
5
4
|
declare namespace ZodExtended {
|
|
6
5
|
interface ParseOptions {
|
|
@@ -8,11 +7,7 @@ declare namespace ZodExtended {
|
|
|
8
7
|
name?: string;
|
|
9
8
|
errorHandler?: ErrorHandler<never>;
|
|
10
9
|
}
|
|
11
|
-
export function parse<ZOutput, ZInput>(schema: z.ZodType<ZOutput, ZInput>, data: unknown, {
|
|
12
|
-
type,
|
|
13
|
-
name,
|
|
14
|
-
errorHandler
|
|
15
|
-
}?: ParseOptions): ZOutput;
|
|
10
|
+
export function parse<ZOutput, ZInput>(schema: z.ZodType<ZOutput, ZInput>, data: unknown, { type, name, errorHandler }?: ParseOptions): ZOutput;
|
|
16
11
|
export const sortExp: (enumSchema: z.ZodEnum) => z.ZodString;
|
|
17
12
|
export {};
|
|
18
13
|
}
|
package/dist/zod.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { i as SharedErrorHandler } from "./error-handling-
|
|
1
|
+
import { i as SharedErrorHandler } from "./error-handling-DDIXMA-R.mjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
|
|
4
3
|
//#region src/zod.ts
|
|
5
4
|
let ZodExtended;
|
|
6
5
|
(function(_ZodExtended) {
|
|
@@ -28,6 +27,5 @@ let ZodExtended;
|
|
|
28
27
|
});
|
|
29
28
|
});
|
|
30
29
|
})(ZodExtended || (ZodExtended = {}));
|
|
31
|
-
|
|
32
30
|
//#endregion
|
|
33
|
-
export { ZodExtended };
|
|
31
|
+
export { ZodExtended };
|