@povio/openapi-codegen-cli 3.2.0-rc.9 → 3.3.0-rc.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 +2 -51
- package/dist/acl.d.mts +19 -6
- package/dist/acl.mjs +7 -7
- package/dist/{auth.context-COWO6ssl.mjs → auth.context-BAz8frX9.mjs} +18 -1
- package/dist/{config-DgrOddSC.d.mts → config-BQqze8rU.d.mts} +2 -1
- package/dist/{error-handling-BeydPL7s.mjs → error-handling-CsnufAil.mjs} +45 -21
- package/dist/{error-handling-LPEPQV1V.d.mts → error-handling-D6ZYITQ3.d.mts} +42 -3
- package/dist/generate.runner-BeCGJ1ar.mjs +87 -0
- package/dist/{generateCodeFromOpenAPIDoc-iEa8YAUQ.cjs → generateCodeFromOpenAPIDoc-KQT4kYxY.mjs} +2340 -1393
- package/dist/generator.d.mts +10 -3
- package/dist/generator.mjs +4 -7
- package/dist/index.d.mts +198 -12
- package/dist/index.mjs +256 -12
- package/dist/metro.cjs +4861 -112
- package/dist/metro.d.mts +4 -3
- package/dist/metro.mjs +3 -3
- package/dist/{openapi-codegen.runner-6Yth6QZC.mjs → openapi-codegen.runner-nPBssrBL.mjs} +2 -3
- package/dist/{openapi-source.runner-BZ6ZLgRO.mjs → openapi-source.runner-8kCe-g9S.mjs} +6 -18
- package/dist/{openapi-source.runner-ykstqlPC.d.mts → openapi-source.runner-B6KKrXw7.d.mts} +8 -2
- package/dist/{options-KPf-Fti5.d.mts → options-DdQJ9BSc.d.mts} +1 -6
- package/dist/sh.d.mts +1 -1
- package/dist/sh.mjs +53 -37
- package/dist/tiny.d.mts +1 -1
- package/dist/tiny.mjs +1 -1
- package/dist/vite.d.mts +4 -3
- package/dist/vite.mjs +4 -5
- package/dist/zod.d.mts +7 -2
- package/dist/zod.mjs +1 -1
- package/package.json +22 -69
- package/dist/AuthGuard-GbtTDXs0.d.mts +0 -32
- package/dist/AuthGuard-qpAtHaBz.mjs +0 -24
- package/dist/auth.d.mts +0 -2
- package/dist/auth.mjs +0 -3
- package/dist/axios.d.mts +0 -2
- package/dist/axios.mjs +0 -2
- package/dist/config.d.mts +0 -4
- package/dist/config.mjs +0 -5
- package/dist/errors.d.mts +0 -3
- package/dist/errors.mjs +0 -2
- package/dist/generate.runner-D8AYuEFm.mjs +0 -184
- package/dist/generate.utils-CT-LA-gX.cjs +0 -2267
- package/dist/generateCodeFromOpenAPIDoc--ufinTug.mjs +0 -2061
- package/dist/getDataFromOpenAPIDoc-D8w0QElH.mjs +0 -2011
- package/dist/i18n-B_brQh4X.d.mts +0 -38
- package/dist/i18n-D-FesqFb.mjs +0 -36
- package/dist/native-bindings-BTQGSGhU.mjs +0 -1480
- package/dist/native-rest-interceptor-CAWR8H5Y.mjs +0 -208
- package/dist/native-rest-interceptor-Cz6saoq5.d.mts +0 -46
- package/dist/native.d.mts +0 -3
- package/dist/native.mjs +0 -3
- 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/query.d.mts +0 -3
- package/dist/query.mjs +0 -3
- package/dist/queryConfig.context-CRJOgf19.d.mts +0 -22
- package/dist/queryConfig.context-CldQ5YL9.mjs +0 -34
- package/dist/rest-client-CQyFvqYC.d.mts +0 -55
- package/dist/rest-interceptor-D5NCNTm1.mjs +0 -115
- package/dist/rest-transport.types-DM5-qyOJ.d.mts +0 -66
- package/dist/rest-transport.types-DxitRtsB.mjs +0 -11
- package/dist/rest.d.mts +0 -2
- package/dist/rest.mjs +0 -2
- package/dist/rest.utils-rezWAIYL.d.mts +0 -10
- package/dist/router.context-EPlMBk3G.mjs +0 -21
- package/dist/useMutationEffects-DIdL8tlx.d.mts +0 -29
- package/dist/useMutationEffects-PB1fvKWM.mjs +0 -68
- package/dist/workspace.context-XWvQ_7Hg.mjs +0 -26
- package/dist/workspace.context-isVY9ves.d.mts +0 -23
package/dist/metro.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
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-DdQJ9BSc.mjs";
|
|
2
|
+
import { t as OpenAPICodegenConfig } from "./config-BQqze8rU.mjs";
|
|
3
|
+
import { d as GenerateOpenApiFile, m as GenerateOpenApiSpec, n as TinyOpenApiSpecModuleConfig } from "./openapi-source.runner-B6KKrXw7.mjs";
|
|
4
4
|
import { IncomingMessage, ServerResponse } from "http";
|
|
5
|
+
|
|
5
6
|
//#region src/metro/openapi-codegen.plugin.d.ts
|
|
6
7
|
type OpenApiCodegenMetroConfig = OpenAPICodegenConfig & {
|
|
7
8
|
formatGeneratedFile?: GenerateFileFormatter;
|
package/dist/metro.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-
|
|
2
|
-
import { i as normalizeWatchFolders, r as isTinyOpenApiFakeMode, t as createTinyOpenApiSourceRunner } from "./openapi-source.runner-
|
|
1
|
+
import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-nPBssrBL.mjs";
|
|
2
|
+
import { i as normalizeWatchFolders, r as isTinyOpenApiFakeMode, t as createTinyOpenApiSourceRunner } from "./openapi-source.runner-8kCe-g9S.mjs";
|
|
3
3
|
import fs from "fs";
|
|
4
4
|
import path from "path";
|
|
5
5
|
//#region src/metro/openapi-codegen.plugin.ts
|
|
@@ -83,7 +83,7 @@ function reportWatcherError$1(error) {
|
|
|
83
83
|
}
|
|
84
84
|
//#endregion
|
|
85
85
|
//#region src/metro/tiny-openapi-codegen.plugin.ts
|
|
86
|
-
const watchedEvents =
|
|
86
|
+
const watchedEvents = new Set(["change", "rename"]);
|
|
87
87
|
function tinyOpenApiCodegenMetro(metroConfig, codegenConfig, options) {
|
|
88
88
|
if (isPromiseLike(metroConfig)) return metroConfig.then((resolvedConfig) => withResolvedTinyOpenApiCodegen(resolvedConfig, codegenConfig, options));
|
|
89
89
|
return withResolvedTinyOpenApiCodegen(metroConfig, codegenConfig, options);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { x as Profiler } from "./generateCodeFromOpenAPIDoc-KQT4kYxY.mjs";
|
|
2
|
+
import { t as runGenerate } from "./generate.runner-BeCGJ1ar.mjs";
|
|
3
3
|
import path from "path";
|
|
4
4
|
//#region src/plugins/openapi-codegen.runner.ts
|
|
5
5
|
function createOpenApiCodegenRunner(config, options = {}) {
|
|
@@ -13,7 +13,6 @@ function createOpenApiCodegenRunner(config, options = {}) {
|
|
|
13
13
|
formatGeneratedFile,
|
|
14
14
|
profiler
|
|
15
15
|
});
|
|
16
|
-
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);
|
|
@@ -19,7 +19,7 @@ const PAGINATION_PROPERTY_NAMES = [
|
|
|
19
19
|
"limit",
|
|
20
20
|
"totalItems"
|
|
21
21
|
];
|
|
22
|
-
const OPENAPI_31_ONLY_KEYS =
|
|
22
|
+
const OPENAPI_31_ONLY_KEYS = new Set([
|
|
23
23
|
"$schema",
|
|
24
24
|
"$id",
|
|
25
25
|
"$vocabulary",
|
|
@@ -585,18 +585,13 @@ function toOpenAPI30Document(spec) {
|
|
|
585
585
|
return converted;
|
|
586
586
|
}
|
|
587
587
|
async function generateORPCOpenAPISpec(options) {
|
|
588
|
-
const
|
|
589
|
-
const
|
|
590
|
-
const
|
|
591
|
-
const
|
|
588
|
+
const [{ OpenAPIGenerator }, { ZodToJsonSchemaConverter }] = await Promise.all([importRuntimeModule("@orpc/openapi"), importRuntimeModule("@orpc/zod/zod4")]);
|
|
589
|
+
const generator = new OpenAPIGenerator({ schemaConverters: [new ZodToJsonSchemaConverter()] });
|
|
590
|
+
const explicitSchemaName = options.getOpenApiSchemaName ?? getOpenApiSchemaName;
|
|
591
|
+
const modelSchemas = await collectModelSchemaExports({
|
|
592
592
|
apiRoot: options.apiRoot,
|
|
593
593
|
dbTablesRoot: options.dbTablesRoot
|
|
594
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();
|
|
600
595
|
const getSchemaName = createModelSchemaNameGetter(modelSchemas, explicitSchemaName);
|
|
601
596
|
const operationMeta = collectOperationMeta(options.contract);
|
|
602
597
|
const extraSchemas = collectExtraSchemas(options.apiModules);
|
|
@@ -612,7 +607,6 @@ async function generateORPCOpenAPISpec(options) {
|
|
|
612
607
|
...extraSchemas,
|
|
613
608
|
...reachableModelSchemas
|
|
614
609
|
};
|
|
615
|
-
const afterCollection = performance.now();
|
|
616
610
|
const spec = await generator.generate(options.contract, {
|
|
617
611
|
info: options.info ?? {
|
|
618
612
|
title: "Tiny Template Fake API",
|
|
@@ -626,7 +620,6 @@ async function generateORPCOpenAPISpec(options) {
|
|
|
626
620
|
...Object.keys(commonSchemas).length > 0 ? { commonSchemas } : {}
|
|
627
621
|
});
|
|
628
622
|
const jsonSpec = spec;
|
|
629
|
-
const afterGeneration = performance.now();
|
|
630
623
|
const sortableSchemaNames = options.realBackendSortableSchemaNames instanceof Map ? options.realBackendSortableSchemaNames : new Map(Object.entries(options.realBackendSortableSchemaNames ?? {}));
|
|
631
624
|
applyOperationMeta(jsonSpec, operationMeta, options.apiModules);
|
|
632
625
|
applyEnumExtensions(spec);
|
|
@@ -649,12 +642,7 @@ async function generateORPCOpenAPISpec(options) {
|
|
|
649
642
|
}
|
|
650
643
|
applyRobodevModuleExtensions(jsonSpec, robodevModuleExtensions, options.apiModules);
|
|
651
644
|
applyRobodevUserRolesExtension(jsonSpec, userRoles);
|
|
652
|
-
|
|
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;
|
|
645
|
+
return toOpenAPI30Document(jsonSpec);
|
|
658
646
|
}
|
|
659
647
|
//#endregion
|
|
660
648
|
//#region src/tiny/openapi-source.runner.ts
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { t as OpenAPICodegenConfig } from "./config-
|
|
1
|
+
import { t as OpenAPICodegenConfig } from "./config-BQqze8rU.mjs";
|
|
2
|
+
|
|
2
3
|
//#region src/tiny/openapi.d.ts
|
|
3
4
|
interface GenerateOpenApiFileOptions {
|
|
4
5
|
argv?: readonly string[];
|
|
@@ -78,7 +79,12 @@ interface OrpcContractProcedureData {
|
|
|
78
79
|
successStatus?: number;
|
|
79
80
|
};
|
|
80
81
|
}
|
|
81
|
-
declare function resolveOpenApiOutputPath({
|
|
82
|
+
declare function resolveOpenApiOutputPath({
|
|
83
|
+
argv,
|
|
84
|
+
cwd,
|
|
85
|
+
defaultOutput,
|
|
86
|
+
env
|
|
87
|
+
}: GenerateOpenApiFileOptions): string;
|
|
82
88
|
declare function generateOpenApiFile(options: GenerateTinyOpenApiFileOptions): Promise<GenerateOpenApiFileResult>;
|
|
83
89
|
declare function defineOpenApiSchemas<const TSchemas extends OpenApiSchemaRegistry>(schemas: TSchemas): TSchemas;
|
|
84
90
|
declare function collectExtraSchemas<TModules extends Record<string, {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OpenAPIV3 } from "openapi-types";
|
|
2
|
+
|
|
2
3
|
//#region src/generators/types/generate.d.ts
|
|
3
4
|
declare enum GenerateType {
|
|
4
5
|
Models = "models",
|
|
@@ -18,7 +19,6 @@ interface ZodGenerateOptions {
|
|
|
18
19
|
schemaSuffix: string;
|
|
19
20
|
enumSuffix: string;
|
|
20
21
|
modelsInCommon?: boolean;
|
|
21
|
-
modelsInModules?: boolean;
|
|
22
22
|
withImplicitRequiredProps?: boolean;
|
|
23
23
|
withDefaultValues?: boolean;
|
|
24
24
|
withDescription?: boolean;
|
|
@@ -27,9 +27,7 @@ interface ZodGenerateOptions {
|
|
|
27
27
|
replaceOptionalWithNullish?: boolean;
|
|
28
28
|
}
|
|
29
29
|
interface EndpointsGenerateOptions {
|
|
30
|
-
restClient: "axios" | "native";
|
|
31
30
|
restClientImportPath: string;
|
|
32
|
-
zodImportPath: string;
|
|
33
31
|
errorHandlingImportPath?: string;
|
|
34
32
|
withDeprecatedEndpoints?: boolean;
|
|
35
33
|
removeOperationPrefixEndingWith?: string;
|
|
@@ -39,7 +37,6 @@ interface EndpointsGenerateOptions {
|
|
|
39
37
|
}
|
|
40
38
|
interface QueriesGenerateOptions {
|
|
41
39
|
queryTypesImportPath: string;
|
|
42
|
-
mutationEffectsImportPath: string;
|
|
43
40
|
axiosRequestConfig?: boolean;
|
|
44
41
|
mutationEffects?: boolean;
|
|
45
42
|
mutationDefaultOnError?: boolean;
|
|
@@ -67,7 +64,6 @@ interface ACLGenerateOptions {
|
|
|
67
64
|
checkAcl?: boolean;
|
|
68
65
|
abilityContextGenericAppAbilities: boolean;
|
|
69
66
|
abilityContextImportPath?: string;
|
|
70
|
-
aclCheckImportPath: string;
|
|
71
67
|
}
|
|
72
68
|
interface BuilderConfigsGenerateOptions {
|
|
73
69
|
builderConfigs?: boolean;
|
|
@@ -92,7 +88,6 @@ interface BaseGenerateOptions {
|
|
|
92
88
|
excludePathRegex: string;
|
|
93
89
|
excludeRedundantZodSchemas: boolean;
|
|
94
90
|
tsNamespaces: boolean;
|
|
95
|
-
treeShakeableNamespaces?: boolean;
|
|
96
91
|
tsPath: string;
|
|
97
92
|
importPath: "ts" | "relative" | "absolute";
|
|
98
93
|
configs: Record<GenerateType, GenerateConfig>;
|
package/dist/sh.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {}
|
|
1
|
+
export { };
|
package/dist/sh.mjs
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { S as VALIDATION_ERROR_TYPE_TITLE, a as getDataFromOpenAPIDoc, m as groupByType, n as getOutputFileName, u as getTagFileName, x as Profiler } from "./generateCodeFromOpenAPIDoc-KQT4kYxY.mjs";
|
|
3
|
+
import { n as resolveConfig, t as runGenerate } from "./generate.runner-BeCGJ1ar.mjs";
|
|
4
|
+
import { createRequire } from "node:module";
|
|
5
5
|
import yargs from "yargs";
|
|
6
6
|
import { hideBin } from "yargs/helpers";
|
|
7
7
|
import { styleText } from "node:util";
|
|
8
|
-
import fs from "fs";
|
|
8
|
+
import fs, { existsSync, rmSync, writeFileSync } from "fs";
|
|
9
9
|
import "reflect-metadata";
|
|
10
10
|
import path from "path";
|
|
11
|
+
import SwaggerParser from "@apidevtools/swagger-parser";
|
|
11
12
|
import { exec } from "child_process";
|
|
13
|
+
//#region \0rolldown/runtime.js
|
|
14
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
15
|
+
//#endregion
|
|
12
16
|
//#region src/helpers/cli.helper.ts
|
|
13
17
|
function log(message) {
|
|
14
18
|
console.log(message);
|
|
@@ -32,7 +36,7 @@ function logBanner(message) {
|
|
|
32
36
|
* Fetch the version from package.json
|
|
33
37
|
*/
|
|
34
38
|
function getVersion() {
|
|
35
|
-
return "3.
|
|
39
|
+
return "3.3.0-rc.1";
|
|
36
40
|
}
|
|
37
41
|
//#endregion
|
|
38
42
|
//#region src/helpers/yargs.helper.ts
|
|
@@ -126,16 +130,50 @@ async function loadConfigFromPath(filePath) {
|
|
|
126
130
|
const ext = path.extname(absolutePath).toLowerCase();
|
|
127
131
|
if (ext === ".mjs") return loadMjsConfig(absolutePath);
|
|
128
132
|
if (ext !== ".ts") throw new Error(`Only ESM (.mjs) and TypeScript (.ts) configuration files are supported. Found: ${ext}`);
|
|
129
|
-
return
|
|
133
|
+
return loadTsConfig(absolutePath);
|
|
130
134
|
}
|
|
131
135
|
async function loadMjsConfig(filePath) {
|
|
132
|
-
return loadModuleConfig(filePath, "ESM");
|
|
133
|
-
}
|
|
134
|
-
async function loadModuleConfig(filePath, format) {
|
|
135
136
|
const imported = await import(`${pathToFileURL(filePath).href}?t=${Date.now()}`);
|
|
136
|
-
if (!imported.default) throw new Error(
|
|
137
|
+
if (!imported.default) throw new Error(`ESM config must have a default export: ${filePath}`);
|
|
137
138
|
return imported.default;
|
|
138
139
|
}
|
|
140
|
+
let importFresh;
|
|
141
|
+
const loadJsSync = function loadJsSync(filepath) {
|
|
142
|
+
if (importFresh === void 0) importFresh = __require("import-fresh");
|
|
143
|
+
return importFresh(filepath);
|
|
144
|
+
};
|
|
145
|
+
let typescript;
|
|
146
|
+
async function loadTsConfig(filePath) {
|
|
147
|
+
if (typescript === void 0) typescript = __require("typescript");
|
|
148
|
+
const transpiledFilepath = `${filePath.slice(0, -2)}cjs`;
|
|
149
|
+
try {
|
|
150
|
+
const tsConfig = resolveTsConfig(path.dirname(filePath)) ?? {};
|
|
151
|
+
tsConfig.compilerOptions = Object.assign({}, tsConfig.compilerOptions, {
|
|
152
|
+
module: typescript.ModuleKind.NodeNext,
|
|
153
|
+
moduleResolution: typescript.ModuleResolutionKind.NodeNext,
|
|
154
|
+
target: typescript.ScriptTarget.ES2022,
|
|
155
|
+
noEmit: false
|
|
156
|
+
});
|
|
157
|
+
const fileContent = fs.readFileSync(filePath, "utf-8");
|
|
158
|
+
const transpiledFileContent = typescript.transpileModule(fileContent, tsConfig).outputText;
|
|
159
|
+
writeFileSync(transpiledFilepath, transpiledFileContent);
|
|
160
|
+
return loadJsSync(transpiledFilepath).default;
|
|
161
|
+
} catch (error) {
|
|
162
|
+
error.message = `TypeScript Error in ${filePath}:\n${error.message}`;
|
|
163
|
+
throw error;
|
|
164
|
+
} finally {
|
|
165
|
+
if (existsSync(transpiledFilepath)) rmSync(transpiledFilepath);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
function resolveTsConfig(directory) {
|
|
169
|
+
const filePath = typescript.findConfigFile(directory, (fileName) => {
|
|
170
|
+
return typescript.sys.fileExists(fileName);
|
|
171
|
+
});
|
|
172
|
+
if (filePath === void 0) return;
|
|
173
|
+
const { config, error } = typescript.readConfigFile(filePath, (path) => typescript.sys.readFile(path));
|
|
174
|
+
if (error) throw new Error(`Error in ${filePath}: ${error.messageText.toString()}`);
|
|
175
|
+
return config;
|
|
176
|
+
}
|
|
139
177
|
function pathToFileURL(filePath) {
|
|
140
178
|
const normalizedPath = path.resolve(filePath).replace(/\\/g, "/");
|
|
141
179
|
return { href: normalizedPath.startsWith("/") ? `file://${normalizedPath}` : `file:///${normalizedPath}` };
|
|
@@ -145,25 +183,24 @@ function pathToFileURL(filePath) {
|
|
|
145
183
|
async function check({ verbose, config: configParam, includeTags: _includeTagsParam, excludeTags: _excludeTagsParam, ...params }) {
|
|
146
184
|
const start = Date.now();
|
|
147
185
|
if (verbose) logInfo("Resolving config...");
|
|
148
|
-
const fileConfig = await loadConfig(configParam);
|
|
149
186
|
const config = resolveConfig({
|
|
150
|
-
fileConfig,
|
|
187
|
+
fileConfig: await loadConfig(configParam),
|
|
151
188
|
params
|
|
152
189
|
});
|
|
153
190
|
if (verbose) logInfo("Parsing OpenAPI spec...");
|
|
154
|
-
const openApiDoc = await
|
|
191
|
+
const openApiDoc = await SwaggerParser.bundle(config.input);
|
|
155
192
|
if (verbose) logInfo("Running check...");
|
|
156
193
|
const errorMessages = checkOpenAPIDoc(openApiDoc, config);
|
|
157
194
|
if (errorMessages.length === 0) logSuccess(`Time: ${Date.now() - start}ms`);
|
|
158
195
|
else throw new Error(`Found ${errorMessages.length} issues. Time: ${Date.now() - start}ms`);
|
|
159
196
|
}
|
|
160
197
|
//#endregion
|
|
161
|
-
//#region \0@oxc-project+runtime@0.
|
|
198
|
+
//#region \0@oxc-project+runtime@0.127.0/helpers/decorateMetadata.js
|
|
162
199
|
function __decorateMetadata(k, v) {
|
|
163
200
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
164
201
|
}
|
|
165
202
|
//#endregion
|
|
166
|
-
//#region \0@oxc-project+runtime@0.
|
|
203
|
+
//#region \0@oxc-project+runtime@0.127.0/helpers/decorate.js
|
|
167
204
|
function __decorate(decorators, target, key, desc) {
|
|
168
205
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
169
206
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -254,7 +291,6 @@ var GenerateOptions = class {
|
|
|
254
291
|
clearOutput;
|
|
255
292
|
incremental;
|
|
256
293
|
tsNamespaces;
|
|
257
|
-
treeShakeableNamespaces;
|
|
258
294
|
tsPath;
|
|
259
295
|
splitByTags;
|
|
260
296
|
defaultTag;
|
|
@@ -265,11 +301,6 @@ var GenerateOptions = class {
|
|
|
265
301
|
importPath;
|
|
266
302
|
extractEnums;
|
|
267
303
|
modelsInCommon;
|
|
268
|
-
modelsInModules;
|
|
269
|
-
zodImportPath;
|
|
270
|
-
restClient;
|
|
271
|
-
mutationEffectsImportPath;
|
|
272
|
-
aclCheckImportPath;
|
|
273
304
|
removeOperationPrefixEndingWith;
|
|
274
305
|
acl;
|
|
275
306
|
checkAcl;
|
|
@@ -304,10 +335,6 @@ __decorate([YargOption({
|
|
|
304
335
|
envAlias: "tsNamespaces",
|
|
305
336
|
type: "boolean"
|
|
306
337
|
}), __decorateMetadata("design:type", Boolean)], GenerateOptions.prototype, "tsNamespaces", void 0);
|
|
307
|
-
__decorate([YargOption({
|
|
308
|
-
envAlias: "treeShakeableNamespaces",
|
|
309
|
-
type: "boolean"
|
|
310
|
-
}), __decorateMetadata("design:type", Boolean)], GenerateOptions.prototype, "treeShakeableNamespaces", void 0);
|
|
311
338
|
__decorate([YargOption({ envAlias: "tsPath" }), __decorateMetadata("design:type", String)], GenerateOptions.prototype, "tsPath", void 0);
|
|
312
339
|
__decorate([YargOption({
|
|
313
340
|
envAlias: "splitByTags",
|
|
@@ -330,17 +357,6 @@ __decorate([YargOption({
|
|
|
330
357
|
envAlias: "modelsInCommon",
|
|
331
358
|
type: "boolean"
|
|
332
359
|
}), __decorateMetadata("design:type", Boolean)], GenerateOptions.prototype, "modelsInCommon", void 0);
|
|
333
|
-
__decorate([YargOption({
|
|
334
|
-
envAlias: "modelsInModules",
|
|
335
|
-
type: "boolean"
|
|
336
|
-
}), __decorateMetadata("design:type", Boolean)], GenerateOptions.prototype, "modelsInModules", void 0);
|
|
337
|
-
__decorate([YargOption({ envAlias: "zodImportPath" }), __decorateMetadata("design:type", String)], GenerateOptions.prototype, "zodImportPath", void 0);
|
|
338
|
-
__decorate([YargOption({
|
|
339
|
-
envAlias: "restClient",
|
|
340
|
-
choices: ["axios", "native"]
|
|
341
|
-
}), __decorateMetadata("design:type", String)], GenerateOptions.prototype, "restClient", void 0);
|
|
342
|
-
__decorate([YargOption({ envAlias: "mutationEffectsImportPath" }), __decorateMetadata("design:type", String)], GenerateOptions.prototype, "mutationEffectsImportPath", void 0);
|
|
343
|
-
__decorate([YargOption({ envAlias: "aclCheckImportPath" }), __decorateMetadata("design:type", String)], GenerateOptions.prototype, "aclCheckImportPath", void 0);
|
|
344
360
|
__decorate([YargOption({ envAlias: "removeOperationPrefixEndingWith" }), __decorateMetadata("design:type", String)], GenerateOptions.prototype, "removeOperationPrefixEndingWith", void 0);
|
|
345
361
|
__decorate([YargOption({
|
|
346
362
|
envAlias: "acl",
|
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-B6KKrXw7.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/tiny.mjs
CHANGED
|
@@ -1,2 +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-
|
|
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-8kCe-g9S.mjs";
|
|
2
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,7 +1,8 @@
|
|
|
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-DdQJ9BSc.mjs";
|
|
2
|
+
import { t as OpenAPICodegenConfig } from "./config-BQqze8rU.mjs";
|
|
3
|
+
import { d as GenerateOpenApiFile, m as GenerateOpenApiSpec, n as TinyOpenApiSpecModuleConfig } from "./openapi-source.runner-B6KKrXw7.mjs";
|
|
4
4
|
import { Plugin, PluginOption } from "vite";
|
|
5
|
+
|
|
5
6
|
//#region src/plugins/openapi-codegen.runner.d.ts
|
|
6
7
|
type OpenApiCodegenPluginConfig = OpenAPICodegenConfig & {
|
|
7
8
|
formatGeneratedFile?: GenerateFileFormatter;
|
package/dist/vite.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-
|
|
2
|
-
import { i as normalizeWatchFolders, r as isTinyOpenApiFakeMode, t as createTinyOpenApiSourceRunner } from "./openapi-source.runner-
|
|
1
|
+
import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-nPBssrBL.mjs";
|
|
2
|
+
import { i as normalizeWatchFolders, r as isTinyOpenApiFakeMode, t as createTinyOpenApiSourceRunner } from "./openapi-source.runner-8kCe-g9S.mjs";
|
|
3
3
|
import path from "path";
|
|
4
4
|
//#region src/vite/openapi-codegen.plugin.ts
|
|
5
5
|
function openApiCodegen(config) {
|
|
@@ -36,7 +36,7 @@ function openApiCodegen(config) {
|
|
|
36
36
|
}
|
|
37
37
|
//#endregion
|
|
38
38
|
//#region src/vite/tiny-openapi-codegen.plugin.ts
|
|
39
|
-
const watchedEvents =
|
|
39
|
+
const watchedEvents = new Set([
|
|
40
40
|
"add",
|
|
41
41
|
"change",
|
|
42
42
|
"unlink"
|
|
@@ -75,8 +75,7 @@ function tinyOpenApiCodegenPlugin(codegenConfig, options) {
|
|
|
75
75
|
}, debounceMs);
|
|
76
76
|
};
|
|
77
77
|
const setupWatcher = (server) => {
|
|
78
|
-
const
|
|
79
|
-
const watchFolders = normalizeWatchFolders(root, options.watchFolders);
|
|
78
|
+
const watchFolders = normalizeWatchFolders(resolvedConfig?.root ?? server.config.root, options.watchFolders);
|
|
80
79
|
server.watcher.add(watchFolders);
|
|
81
80
|
server.watcher.on("all", (event, changedPath) => {
|
|
82
81
|
if (watchedEvents.has(event) && isPathInWatchFolders(changedPath, watchFolders)) scheduleGenerate(server);
|
package/dist/zod.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { a as ErrorHandler } from "./error-handling-
|
|
1
|
+
import { a as ErrorHandler } from "./error-handling-D6ZYITQ3.mjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
+
|
|
3
4
|
//#region src/zod.d.ts
|
|
4
5
|
declare namespace ZodExtended {
|
|
5
6
|
interface ParseOptions {
|
|
@@ -7,7 +8,11 @@ declare namespace ZodExtended {
|
|
|
7
8
|
name?: string;
|
|
8
9
|
errorHandler?: ErrorHandler<never>;
|
|
9
10
|
}
|
|
10
|
-
export function parse<ZOutput, ZInput>(schema: z.ZodType<ZOutput, ZInput>, data: unknown, {
|
|
11
|
+
export function parse<ZOutput, ZInput>(schema: z.ZodType<ZOutput, ZInput>, data: unknown, {
|
|
12
|
+
type,
|
|
13
|
+
name,
|
|
14
|
+
errorHandler
|
|
15
|
+
}?: ParseOptions): ZOutput;
|
|
11
16
|
export const sortExp: (enumSchema: z.ZodEnum) => z.ZodString;
|
|
12
17
|
export {};
|
|
13
18
|
}
|
package/dist/zod.mjs
CHANGED
package/package.json
CHANGED
|
@@ -23,9 +23,7 @@
|
|
|
23
23
|
"src/assets/**"
|
|
24
24
|
],
|
|
25
25
|
"type": "module",
|
|
26
|
-
"sideEffects": false,
|
|
27
26
|
"main": "./dist/index.mjs",
|
|
28
|
-
"module": "./dist/index.mjs",
|
|
29
27
|
"types": "./dist/index.d.mts",
|
|
30
28
|
"exports": {
|
|
31
29
|
".": {
|
|
@@ -56,46 +54,14 @@
|
|
|
56
54
|
"./zod": {
|
|
57
55
|
"types": "./dist/zod.d.mts",
|
|
58
56
|
"import": "./dist/zod.mjs"
|
|
59
|
-
},
|
|
60
|
-
"./native": {
|
|
61
|
-
"types": "./dist/native.d.mts",
|
|
62
|
-
"import": "./dist/native.mjs"
|
|
63
|
-
},
|
|
64
|
-
"./rest": {
|
|
65
|
-
"types": "./dist/rest.d.mts",
|
|
66
|
-
"import": "./dist/rest.mjs"
|
|
67
|
-
},
|
|
68
|
-
"./axios": {
|
|
69
|
-
"types": "./dist/axios.d.mts",
|
|
70
|
-
"import": "./dist/axios.mjs"
|
|
71
|
-
},
|
|
72
|
-
"./errors": {
|
|
73
|
-
"types": "./dist/errors.d.mts",
|
|
74
|
-
"import": "./dist/errors.mjs"
|
|
75
|
-
},
|
|
76
|
-
"./query": {
|
|
77
|
-
"types": "./dist/query.d.mts",
|
|
78
|
-
"import": "./dist/query.mjs"
|
|
79
|
-
},
|
|
80
|
-
"./config": {
|
|
81
|
-
"types": "./dist/config.d.mts",
|
|
82
|
-
"import": "./dist/config.mjs"
|
|
83
|
-
},
|
|
84
|
-
"./auth": {
|
|
85
|
-
"types": "./dist/auth.d.mts",
|
|
86
|
-
"import": "./dist/auth.mjs"
|
|
87
57
|
}
|
|
88
58
|
},
|
|
89
59
|
"scripts": {
|
|
90
|
-
"start": "
|
|
91
|
-
"test": "
|
|
92
|
-
"test:ts": "OPENAPI_CODEGEN_NATIVE=0 vitest run",
|
|
93
|
-
"test:native": "OPENAPI_CODEGEN_NATIVE=1 OPENAPI_CODEGEN_REQUIRE_FULL_NATIVE=1 vitest run",
|
|
60
|
+
"start": "node --import tsx ./src/sh.ts",
|
|
61
|
+
"test": "vitest run",
|
|
94
62
|
"test:watch": "vitest",
|
|
95
|
-
"build": "tsdown
|
|
96
|
-
"
|
|
97
|
-
"build:native": "bun ./scripts/build-native.mjs",
|
|
98
|
-
"start:dist": "bun ./dist/sh.mjs",
|
|
63
|
+
"build": "tsdown",
|
|
64
|
+
"start:dist": "node ./dist/sh.mjs",
|
|
99
65
|
"gen:base": "rm -rf ./test/generated/base && mkdir -p ./test/generated/base && bun run start generate --config ./test/config.mjs --output ./test/generated/base --no-prettier",
|
|
100
66
|
"gen:next": "rm -rf ./test/generated/next && mkdir -p ./test/generated/next && bun run start generate --config ./test/config.mjs --output ./test/generated/next --no-prettier",
|
|
101
67
|
"test:generated-eq": "vitest run ./src/generators/generated-output-eq.test.ts",
|
|
@@ -106,47 +72,46 @@
|
|
|
106
72
|
"format": "oxfmt",
|
|
107
73
|
"format:check": "oxfmt --check",
|
|
108
74
|
"check": "bun run typecheck && bun run lint && bun run test",
|
|
109
|
-
"push": "
|
|
75
|
+
"push": "node ./scripts/publish.mjs",
|
|
110
76
|
"dev:generate": "rm -rf ./output && bun run start generate --config ./test/config.mjs",
|
|
111
77
|
"dev:check": "bun run start check --config ./test/config.mjs",
|
|
112
|
-
"snapshot:openapi-localhost": "
|
|
113
|
-
"bench:vite-codegen": "
|
|
114
|
-
"verify:tree-shaking": "bun run build:ts && bun ./scripts/verify-tree-shaking.mjs"
|
|
78
|
+
"snapshot:openapi-localhost": "node ./scripts/snapshot-openapi-localhost.mjs",
|
|
79
|
+
"bench:vite-codegen": "node ./scripts/benchmark-vite-codegen.mjs"
|
|
115
80
|
},
|
|
116
81
|
"dependencies": {
|
|
82
|
+
"@apidevtools/swagger-parser": "^10.1.0",
|
|
117
83
|
"@orpc/contract": "^1.14.3",
|
|
118
84
|
"@orpc/openapi": "^1.14.3",
|
|
119
85
|
"@orpc/zod": "^1.14.3",
|
|
86
|
+
"import-fresh": "^3.3.1",
|
|
120
87
|
"openapi-types": "^12.1.3",
|
|
121
88
|
"prompt-sync": "^4.2.0",
|
|
122
89
|
"reflect-metadata": "^0.2.2",
|
|
123
|
-
"
|
|
90
|
+
"ts-pattern": "^5.9.0",
|
|
91
|
+
"typescript": "^5.9.3",
|
|
124
92
|
"yargs": "^18.0.0"
|
|
125
93
|
},
|
|
126
94
|
"devDependencies": {
|
|
127
|
-
"@casl/ability": "6.8.0",
|
|
128
|
-
"@casl/react": "5.0.1",
|
|
95
|
+
"@casl/ability": "^6.8.0",
|
|
96
|
+
"@casl/react": "^5.0.1",
|
|
129
97
|
"@tanstack/react-query": "~5.90.21",
|
|
130
|
-
"@types/bun": "1.3.14",
|
|
131
98
|
"@types/node": "^25.3.0",
|
|
132
99
|
"@types/prompt-sync": "^4.2.3",
|
|
133
100
|
"@types/react": "^19.2.14",
|
|
134
101
|
"@types/yargs": "^17.0.35",
|
|
135
102
|
"@vitejs/plugin-react": "^5.1.4",
|
|
136
|
-
"axios": "^1.13.1",
|
|
137
|
-
"i18next": "^25.8.11",
|
|
138
103
|
"oxfmt": "^0.34.0",
|
|
139
|
-
"oxlint": "1.50.0",
|
|
104
|
+
"oxlint": "^1.50.0",
|
|
140
105
|
"oxlint-tsgolint": "^0.15.0",
|
|
141
106
|
"react": "^19.2.4",
|
|
142
|
-
"tsdown": "^0.
|
|
107
|
+
"tsdown": "^0.21.0-beta.1",
|
|
143
108
|
"tsx": "^4.21.0",
|
|
144
109
|
"type-fest": "^5.4.4",
|
|
145
|
-
"typescript": "^7.0.2",
|
|
146
110
|
"vite": "npm:rolldown-vite@^7.3.1",
|
|
147
111
|
"vite-plugin-dts": "^4.5.4",
|
|
148
112
|
"vitest": "4.0.18",
|
|
149
|
-
"
|
|
113
|
+
"yargs": "^17.7.2",
|
|
114
|
+
"zod": "^4.5.0"
|
|
150
115
|
},
|
|
151
116
|
"peerDependencies": {
|
|
152
117
|
"@casl/ability": "^6.7.3",
|
|
@@ -156,7 +121,7 @@
|
|
|
156
121
|
"i18next": "^25.8.11",
|
|
157
122
|
"react": "^19.1.0",
|
|
158
123
|
"vite": "^6.0.0 || ^7.0.0 || ^8.0.0",
|
|
159
|
-
"zod": "^4.
|
|
124
|
+
"zod": "^4.5.0"
|
|
160
125
|
},
|
|
161
126
|
"peerDependenciesMeta": {
|
|
162
127
|
"@casl/ability": {
|
|
@@ -165,26 +130,14 @@
|
|
|
165
130
|
"@casl/react": {
|
|
166
131
|
"optional": true
|
|
167
132
|
},
|
|
168
|
-
"@tanstack/react-query": {
|
|
169
|
-
"optional": true
|
|
170
|
-
},
|
|
171
|
-
"axios": {
|
|
172
|
-
"optional": true
|
|
173
|
-
},
|
|
174
|
-
"i18next": {
|
|
175
|
-
"optional": true
|
|
176
|
-
},
|
|
177
|
-
"react": {
|
|
178
|
-
"optional": true
|
|
179
|
-
},
|
|
180
133
|
"vite": {
|
|
181
134
|
"optional": true
|
|
182
135
|
}
|
|
183
136
|
},
|
|
184
137
|
"engines": {
|
|
185
|
-
"bun": ">= 1.
|
|
186
|
-
"node": ">=
|
|
138
|
+
"bun": ">= 1.4",
|
|
139
|
+
"node": ">= 14"
|
|
187
140
|
},
|
|
188
|
-
"packageManager": "bun@1.
|
|
189
|
-
"version": "3.
|
|
141
|
+
"packageManager": "bun@1.4.0",
|
|
142
|
+
"version": "3.3.0-rc.1"
|
|
190
143
|
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren, ReactNode } from "react";
|
|
2
|
-
//#region src/lib/auth/auth.context.d.ts
|
|
3
|
-
declare namespace AuthContext {
|
|
4
|
-
export interface Routes {
|
|
5
|
-
authenticated?: string;
|
|
6
|
-
unauthenticated?: string;
|
|
7
|
-
}
|
|
8
|
-
interface Type<TUser = unknown> {
|
|
9
|
-
isAuthenticated: boolean;
|
|
10
|
-
isInitializing: boolean;
|
|
11
|
-
logout: () => void;
|
|
12
|
-
updateTokens?: (accessToken: string | null, refreshToken?: string | null) => void;
|
|
13
|
-
accessToken?: string | null;
|
|
14
|
-
user?: TUser | null;
|
|
15
|
-
userPromise?: () => Promise<TUser | null>;
|
|
16
|
-
routes?: Routes;
|
|
17
|
-
loadingState?: ReactNode;
|
|
18
|
-
}
|
|
19
|
-
type ProviderProps<TUser = unknown> = Type<TUser>;
|
|
20
|
-
export const Provider: <TUser>({ isAuthenticated, isInitializing, logout, updateTokens, accessToken, user, userPromise, routes, loadingState, children }: PropsWithChildren<ProviderProps<TUser>>) => import("react").JSX.Element;
|
|
21
|
-
export const useAuth: <TUser>() => Type<TUser>;
|
|
22
|
-
export {};
|
|
23
|
-
}
|
|
24
|
-
//#endregion
|
|
25
|
-
//#region src/lib/auth/AuthGuard.d.ts
|
|
26
|
-
interface AuthGuardProps {
|
|
27
|
-
type: "public-only" | "private";
|
|
28
|
-
redirectTo?: string;
|
|
29
|
-
}
|
|
30
|
-
declare const AuthGuard: ({ type, redirectTo, children }: PropsWithChildren<AuthGuardProps>) => import("react").ReactNode;
|
|
31
|
-
//#endregion
|
|
32
|
-
export { AuthGuardProps as n, AuthContext as r, AuthGuard as t };
|