@povio/openapi-codegen-cli 4.0.0-rc.3 → 4.0.0-rc.5
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 +38 -11
- package/dist/{config-CiLFKLAY.d.mts → config-D8ANLlqk.d.mts} +1 -1
- package/dist/config.d.mts +2 -2
- package/dist/{generate.runner-Sh0Ps6AW.mjs → generate.runner-LDL6Lbgl.mjs} +8 -110
- package/dist/{generate.utils-BJxdEik8.cjs → generate.utils-BFeGvk98.cjs} +4 -269
- package/dist/{generateCodeFromOpenAPIDoc-B8FAsxWE.mjs → generateCodeFromOpenAPIDoc-B7VWwIbb.mjs} +198 -502
- package/dist/{generateCodeFromOpenAPIDoc-Bbi8fYi2.cjs → generateCodeFromOpenAPIDoc-CpAdx6I3.cjs} +241 -528
- package/dist/generator.d.mts +1 -1
- package/dist/generator.mjs +3 -3
- package/dist/{getDataFromOpenAPIDoc-CXYNMMMt.mjs → getDataFromOpenAPIDoc-C0iehdg8.mjs} +19 -2
- package/dist/index.d.mts +4 -4
- package/dist/metro.cjs +4 -3
- package/dist/metro.d.mts +3 -3
- package/dist/metro.mjs +1 -1
- package/dist/openapi-codegen-native-darwin-arm64.node +0 -0
- package/dist/openapi-codegen-native-linux-x64.node +0 -0
- package/dist/openapi-codegen-native-win32-x64.node +0 -0
- package/dist/{openapi-codegen.runner-bJTFHTdn.mjs → openapi-codegen.runner-CmW9oZdT.mjs} +1 -1
- package/dist/{openapi-source.runner-DIOvAX_R.d.mts → openapi-source.runner-DES1kzvS.d.mts} +1 -1
- package/dist/{options-X0zju7gw.d.mts → options-B7-eMFcv.d.mts} +4 -10
- package/dist/query.d.mts +3 -3
- package/dist/queryConfig.context-DwVQWbtL.d.mts +71 -0
- package/dist/sh.mjs +8 -8
- package/dist/tiny.d.mts +1 -1
- package/dist/{useMutationEffects-CJJuL9Ak.d.mts → useMutationEffects-I4y5WUkj.d.mts} +1 -1
- package/dist/vite.d.mts +3 -3
- package/dist/vite.mjs +1 -1
- package/package.json +4 -4
- package/dist/queryConfig.context-DjhzewdL.d.mts +0 -56
package/README.md
CHANGED
|
@@ -36,6 +36,31 @@ export default {
|
|
|
36
36
|
};
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
+
## Lazy schemas
|
|
40
|
+
|
|
41
|
+
With `tsNamespaces` enabled, every schema of a models namespace is built the moment the module is imported, even when the importer only needs one of them. Set `lazySchemas: true` (or pass `--lazySchemas`) to build each schema on first access instead:
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
// Generated with lazySchemas: true
|
|
45
|
+
const once = <T>(create: () => T) => {
|
|
46
|
+
let value: T | undefined;
|
|
47
|
+
return () => (value ??= create());
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const PetSchema = once(() => z.object({ id: z.int(), category: CategorySchema() }));
|
|
51
|
+
|
|
52
|
+
export const PetModels = {
|
|
53
|
+
get PetSchema() {
|
|
54
|
+
return PetSchema();
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
export declare namespace PetModels {
|
|
58
|
+
export type Pet = z.infer<typeof PetModels.PetSchema>;
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`PetModels.PetSchema` stays a regular Zod schema (`.extend`, `.shape`, `.pick` all work and return the same instance on every access), `PetModels.Pet` keeps resolving as a type, and `modelsInCommon` proxies forward to the shared namespace lazily as well. The option requires `tsNamespaces` and is honored by both the TypeScript and native generators. It helps cold starts of apps that import large model modules but render only a slice of them.
|
|
63
|
+
|
|
39
64
|
## Configuration Files
|
|
40
65
|
|
|
41
66
|
The CLI supports TypeScript configuration files to simplify command execution and provide consistent settings with full type safety. Configuration files are automatically discovered in your project root.
|
|
@@ -100,6 +125,7 @@ bunx openapi-codegen generate --config my-config.ts
|
|
|
100
125
|
--tsPath (Requires `--importPath` to be 'ts') Typescript import path (default: '@/data')
|
|
101
126
|
--removeOperationPrefixEndingWith Remove operation name prefixes that end with the specified string (default: 'Controller_')
|
|
102
127
|
--compileSchemas Eagerly compile non-recursive Zod schemas (default: false)
|
|
128
|
+
--lazySchemas Build namespace model schemas on first access instead of at import; requires `--tsNamespaces` (default: false)
|
|
103
129
|
--extractEnums Extract enums into separate Zod schemas (default: true)
|
|
104
130
|
--modelsInCommon Keep all schema declarations in defaultTag models and emit per-module proxy exports (default: false)
|
|
105
131
|
--replaceOptionalWithNullish Replace `.optional()` chains with `.nullish()` in generated Zod schemas (default: false)
|
|
@@ -122,7 +148,6 @@ bunx openapi-codegen generate --config my-config.ts
|
|
|
122
148
|
--acl Generate ACL related files (default: true)
|
|
123
149
|
--checkAcl Add ACL check to queries (default: true)
|
|
124
150
|
|
|
125
|
-
--builderConfigs Generate configs for builders (default: false)
|
|
126
151
|
|
|
127
152
|
--baseUrl (Requires `--restClientImportPath` to NOT be set) Base URL for the generated REST client; falls back to the OpenAPI spec if not provided
|
|
128
153
|
```
|
|
@@ -343,6 +368,8 @@ const config: OpenAPICodegenConfig = {
|
|
|
343
368
|
// modelsOnly: true,
|
|
344
369
|
// 4) Keep all model declarations in common.models and generate per-module model proxies
|
|
345
370
|
// modelsInCommon: true,
|
|
371
|
+
// 5) Build each namespace schema on first access instead of at import (requires tsNamespaces)
|
|
372
|
+
// lazySchemas: true,
|
|
346
373
|
};
|
|
347
374
|
```
|
|
348
375
|
|
|
@@ -593,17 +620,17 @@ export class JSONDto {
|
|
|
593
620
|
|
|
594
621
|
Use package subpaths for runtime imports. Pure `import type` imports may use the package root.
|
|
595
622
|
|
|
596
|
-
| Runtime exports
|
|
597
|
-
|
|
|
598
|
-
| `AuthContext`, `AuthGuard`
|
|
599
|
-
| `AbilityContext`, `useAclCheck`, `Can`, `createAclGuard`
|
|
600
|
-
| `ErrorHandler`, `SharedErrorHandler`, `ApplicationException`, `DomainErrorRegistry`
|
|
601
|
-
| `useMutationEffects`, `OpenApiQueryConfig`
|
|
623
|
+
| Runtime exports | Subpath |
|
|
624
|
+
| -------------------------------------------------------------------------------------------- | --------- |
|
|
625
|
+
| `AuthContext`, `AuthGuard` | `/auth` |
|
|
626
|
+
| `AbilityContext`, `useAclCheck`, `Can`, `createAclGuard` | `/acl` |
|
|
627
|
+
| `ErrorHandler`, `SharedErrorHandler`, `ApplicationException`, `DomainErrorRegistry` | `/errors` |
|
|
628
|
+
| `useMutationEffects`, `OpenApiQueryConfig` | `/query` |
|
|
602
629
|
| `OpenApiRouter`, `OpenApiWorkspaceContext`, `useWorkspaceContext`, translation configuration | `/config` |
|
|
603
|
-
| `ZodExtended`
|
|
604
|
-
| `HttpError`, transport types
|
|
605
|
-
| `NativeRestClient`
|
|
606
|
-
| `RestClient`, `RestInterceptor` (Axios transport)
|
|
630
|
+
| `ZodExtended` | `/zod` |
|
|
631
|
+
| `HttpError`, transport types | `/rest` |
|
|
632
|
+
| `NativeRestClient` | `/native` |
|
|
633
|
+
| `RestClient`, `RestInterceptor` (Axios transport) | `/axios` |
|
|
607
634
|
|
|
608
635
|
For example: `import { AuthContext, AuthGuard } from "@povio/openapi-codegen-cli/auth"`.
|
|
609
636
|
Custom application helpers should import error helpers from `/errors`, `AbilityContext` from `/acl`, and mutation effects from `/query`.
|
package/dist/config.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { i as resources, n as configureTranslations, r as ns, t as TranslateFunction } from "./i18n-B_brQh4X.mjs";
|
|
2
2
|
import { n as useWorkspaceContext, r as OpenApiRouter, t as OpenApiWorkspaceContext } from "./workspace.context-isVY9ves.mjs";
|
|
3
|
-
import { a as
|
|
4
|
-
export { type InvalidationMap, type InvalidationMapFunc, type MergedMutationVariables, type MutationEffectsOf, type MutationEffectsTypes, OpenApiQueryConfig, OpenApiRouter, OpenApiWorkspaceContext, type QueryModule, type TranslateFunction, configureTranslations, ns, resources, useWorkspaceContext };
|
|
3
|
+
import { a as MergedMutationVariables, c as OpenApiQueryConfig, i as MergedMutationValues, l as QueryModule, n as InvalidationMapFunc, o as MutationEffectsOf, r as MergedMutationData, s as MutationEffectsTypes, t as InvalidationMap, u as RegisteredQueryModule } from "./queryConfig.context-DwVQWbtL.mjs";
|
|
4
|
+
export { type InvalidationMap, type InvalidationMapFunc, type MergedMutationData, type MergedMutationValues, type MergedMutationVariables, type MutationEffectsOf, type MutationEffectsTypes, OpenApiQueryConfig, OpenApiRouter, OpenApiWorkspaceContext, type QueryModule, type RegisteredQueryModule, type TranslateFunction, configureTranslations, ns, resources, useWorkspaceContext };
|
|
@@ -394,10 +394,6 @@ const ERROR_HANDLERS = {
|
|
|
394
394
|
SharedErrorHandler: "SharedErrorHandler"
|
|
395
395
|
};
|
|
396
396
|
ERROR_HANDLERS.ErrorHandler, ERROR_HANDLERS.SharedErrorHandler;
|
|
397
|
-
const BUILDERS_UTILS = {
|
|
398
|
-
dynamicInputs: "dynamicInputs",
|
|
399
|
-
dynamicColumns: "dynamicColumns"
|
|
400
|
-
};
|
|
401
397
|
const QUERY_MODULE_ENUM = "QueryModule";
|
|
402
398
|
const QUERY_MODULES_FILE = {
|
|
403
399
|
fileName: "queryModules",
|
|
@@ -437,21 +433,6 @@ function getResponseZodSchemaName({ statusCode, operationName, isUniqueOperation
|
|
|
437
433
|
const isValidPropertyName = (str) => /^(?:[a-zA-Z_$][a-zA-Z0-9_$]*|[0-9]+)$/.test(str);
|
|
438
434
|
const invalidVariableNameCharactersToCamel = (str) => str.replace(/^[^a-zA-Z_$]*/g, "").replace(/[^a-zA-Z0-9_$]+(\w)?/g, (_, char) => char?.toUpperCase() ?? "");
|
|
439
435
|
//#endregion
|
|
440
|
-
//#region src/generators/utils/endpoint.utils.ts
|
|
441
|
-
const isGetEndpoint = (endpoint) => endpoint.method === OpenAPIV3.HttpMethods.GET;
|
|
442
|
-
const isPaginatedGetEndpoint = (endpoint, options) => isGetEndpoint(endpoint) && Object.values(options.infiniteQueryParamNames).every((infiniteQueryParam) => endpoint.parameters.some((param) => param.name === infiniteQueryParam && param.type === "Query"));
|
|
443
|
-
const isReadAllEndpoint = (endpoint, options) => endpoint.method === OpenAPIV3.HttpMethods.GET && !isPathSegmentParam(endpoint.pathSegments.at(-1)) && isPaginatedGetEndpoint(endpoint, options);
|
|
444
|
-
const isReadEndpoint = (endpoint, readAllEndpoint) => endpoint.method === OpenAPIV3.HttpMethods.GET && hasMatchingPathWithTrailingParam(endpoint, readAllEndpoint);
|
|
445
|
-
const isCreateEndpoint = (endpoint, readAllEndpoint) => endpoint.method === OpenAPIV3.HttpMethods.POST && hasMatchingPathWithoutTrailingParam(endpoint, readAllEndpoint);
|
|
446
|
-
const isUpdateEndpoint = (endpoint, readAllEndpoint) => [OpenAPIV3.HttpMethods.PUT, OpenAPIV3.HttpMethods.PATCH].includes(endpoint.method) && hasMatchingPathWithTrailingParam(endpoint, readAllEndpoint);
|
|
447
|
-
const isDeleteEndpoint = (endpoint, readAllEndpoint) => endpoint.method === OpenAPIV3.HttpMethods.DELETE && hasMatchingPathWithTrailingParam(endpoint, readAllEndpoint);
|
|
448
|
-
const isBulkDeleteEndpoint = (endpoint, readAllEndpoint) => endpoint.method === OpenAPIV3.HttpMethods.DELETE && hasMatchingPathWithoutTrailingParam(endpoint, readAllEndpoint);
|
|
449
|
-
const getPathSegments = (path) => path.split("/").filter(Boolean);
|
|
450
|
-
const isPathSegmentParam = (pathSegment) => pathSegment?.startsWith(":");
|
|
451
|
-
const hasMatchingPath = (endpoint, readAllEndpoint) => readAllEndpoint.pathSegments.every((segment, index) => isPathSegmentParam(segment) && isPathSegmentParam(endpoint.pathSegments[index]) || segment === endpoint.pathSegments[index]);
|
|
452
|
-
const hasMatchingPathWithoutTrailingParam = (endpoint, readAllEndpoint) => endpoint.pathSegments.length === readAllEndpoint.pathSegments.length && hasMatchingPath(endpoint, readAllEndpoint);
|
|
453
|
-
const hasMatchingPathWithTrailingParam = (endpoint, readAllEndpoint) => endpoint.pathSegments.length - 1 === readAllEndpoint.pathSegments.length && isPathSegmentParam(endpoint.pathSegments.at(-1)) && hasMatchingPath(endpoint, readAllEndpoint);
|
|
454
|
-
//#endregion
|
|
455
436
|
//#region src/generators/const/options.const.ts
|
|
456
437
|
const DEFAULT_GENERATE_OPTIONS = {
|
|
457
438
|
input: "http://localhost:4000/docs-json/",
|
|
@@ -484,16 +465,13 @@ const DEFAULT_GENERATE_OPTIONS = {
|
|
|
484
465
|
["acl"]: {
|
|
485
466
|
outputFileNameSuffix: "acl",
|
|
486
467
|
namespaceSuffix: "Acl"
|
|
487
|
-
},
|
|
488
|
-
["configs"]: {
|
|
489
|
-
outputFileNameSuffix: "configs",
|
|
490
|
-
namespaceSuffix: "Configs"
|
|
491
468
|
}
|
|
492
469
|
},
|
|
493
470
|
baseUrl: "",
|
|
494
471
|
modelsOnly: false,
|
|
495
472
|
standalone: false,
|
|
496
473
|
compileSchemas: false,
|
|
474
|
+
lazySchemas: false,
|
|
497
475
|
schemaSuffix: SCHEMA_SUFFIX,
|
|
498
476
|
enumSuffix: ENUM_SUFFIX,
|
|
499
477
|
modelsInCommon: false,
|
|
@@ -528,12 +506,7 @@ const DEFAULT_GENERATE_OPTIONS = {
|
|
|
528
506
|
checkAcl: true,
|
|
529
507
|
abilityContextGenericAppAbilities: false,
|
|
530
508
|
abilityContextImportPath: "",
|
|
531
|
-
aclCheckImportPath: "@povio/openapi-codegen-cli/acl"
|
|
532
|
-
builderConfigs: false,
|
|
533
|
-
filterParamName: "filter",
|
|
534
|
-
dataResponseParamNames: ["data", "items"],
|
|
535
|
-
dynamicInputsImportPath: "@povio/ui",
|
|
536
|
-
dynamicColumnsImportPath: "@povio/ui"
|
|
509
|
+
aclCheckImportPath: "@povio/openapi-codegen-cli/acl"
|
|
537
510
|
};
|
|
538
511
|
//#endregion
|
|
539
512
|
//#region src/generators/utils/array.utils.ts
|
|
@@ -790,49 +763,6 @@ function renderAclCheckCall(resolver, endpoint, replacements, indent = "") {
|
|
|
790
763
|
return `${indent}checkAcl(${getImportedAbilityFunctionName(endpoint, resolver.options)}(${args}));`;
|
|
791
764
|
}
|
|
792
765
|
//#endregion
|
|
793
|
-
//#region src/generators/utils/generate/generate.query.utils.ts
|
|
794
|
-
const operationNameByEndpoint = /* @__PURE__ */ new WeakMap();
|
|
795
|
-
const capitalizedOperationNameByEndpoint = /* @__PURE__ */ new WeakMap();
|
|
796
|
-
function getOperationName(endpoint) {
|
|
797
|
-
let name = operationNameByEndpoint.get(endpoint);
|
|
798
|
-
if (name === void 0) {
|
|
799
|
-
name = snakeToCamel(endpoint.operationName);
|
|
800
|
-
operationNameByEndpoint.set(endpoint, name);
|
|
801
|
-
}
|
|
802
|
-
return name;
|
|
803
|
-
}
|
|
804
|
-
function getCapitalizedOperationName(endpoint) {
|
|
805
|
-
let name = capitalizedOperationNameByEndpoint.get(endpoint);
|
|
806
|
-
if (name === void 0) {
|
|
807
|
-
name = capitalize(getOperationName(endpoint));
|
|
808
|
-
capitalizedOperationNameByEndpoint.set(endpoint, name);
|
|
809
|
-
}
|
|
810
|
-
return name;
|
|
811
|
-
}
|
|
812
|
-
const getQueryName = (endpoint, mutation) => {
|
|
813
|
-
const addMutationSuffix = isQuery(endpoint) && isMutation(endpoint) && mutation;
|
|
814
|
-
return `use${getCapitalizedOperationName(endpoint)}${addMutationSuffix ? "Mutation" : ""}`;
|
|
815
|
-
};
|
|
816
|
-
const getInfiniteQueryName = (endpoint) => `use${getCapitalizedOperationName(endpoint)}Infinite`;
|
|
817
|
-
const getQueryOptionsName = (endpoint) => `${getOperationName(endpoint)}QueryOptions`;
|
|
818
|
-
const getInfiniteQueryOptionsName = (endpoint) => `${getOperationName(endpoint)}InfiniteQueryOptions`;
|
|
819
|
-
const getPrefetchQueryName = (endpoint) => `prefetch${getCapitalizedOperationName(endpoint)}`;
|
|
820
|
-
const getPrefetchInfiniteQueryName = (endpoint) => `prefetch${getCapitalizedOperationName(endpoint)}Infinite`;
|
|
821
|
-
const getImportedQueryName = (endpoint, options) => {
|
|
822
|
-
return `${options.tsNamespaces ? `${getNamespaceName({
|
|
823
|
-
type: "queries",
|
|
824
|
-
tag: getEndpointTag(endpoint, options),
|
|
825
|
-
options
|
|
826
|
-
})}.` : ""}${getQueryName(endpoint)}`;
|
|
827
|
-
};
|
|
828
|
-
const getImportedInfiniteQueryName = (endpoint, options) => {
|
|
829
|
-
return `${options.tsNamespaces ? `${getNamespaceName({
|
|
830
|
-
type: "queries",
|
|
831
|
-
tag: getEndpointTag(endpoint, options),
|
|
832
|
-
options
|
|
833
|
-
})}.` : ""}${getInfiniteQueryName(endpoint)}`;
|
|
834
|
-
};
|
|
835
|
-
//#endregion
|
|
836
766
|
//#region src/generators/utils/generate/generate.imports.utils.ts
|
|
837
767
|
function getModelsImports({ resolver, tag, zodSchemas = [], zodSchemasAsTypes = [] }) {
|
|
838
768
|
const type = "models";
|
|
@@ -868,26 +798,6 @@ function getEndpointsImports({ tag, endpoints, options }) {
|
|
|
868
798
|
options
|
|
869
799
|
});
|
|
870
800
|
}
|
|
871
|
-
function getQueriesImports({ tag, endpoints, options }) {
|
|
872
|
-
return getImports({
|
|
873
|
-
type: "queries",
|
|
874
|
-
tag,
|
|
875
|
-
entities: endpoints,
|
|
876
|
-
getTag: (endpoint) => getEndpointTag(endpoint, options),
|
|
877
|
-
getEntityName: getQueryName,
|
|
878
|
-
options
|
|
879
|
-
});
|
|
880
|
-
}
|
|
881
|
-
function getInfiniteQueriesImports({ tag, endpoints, options }) {
|
|
882
|
-
return getImports({
|
|
883
|
-
type: "queries",
|
|
884
|
-
tag,
|
|
885
|
-
entities: endpoints,
|
|
886
|
-
getTag: (endpoint) => getEndpointTag(endpoint, options),
|
|
887
|
-
getEntityName: getInfiniteQueryName,
|
|
888
|
-
options
|
|
889
|
-
});
|
|
890
|
-
}
|
|
891
801
|
function getAclImports({ tag, endpoints, options }) {
|
|
892
802
|
return getImports({
|
|
893
803
|
type: "acl",
|
|
@@ -1250,9 +1160,8 @@ function createEndpointConfig(endpoint) {
|
|
|
1250
1160
|
};
|
|
1251
1161
|
}
|
|
1252
1162
|
/** Renders the body of a media-upload mutationFn: call the endpoint (without the file arg) to
|
|
1253
|
-
* get upload instructions, then upload the file itself to the returned URL.
|
|
1254
|
-
*
|
|
1255
|
-
* both mutation paths stay in sync. Lines are relative to the caller's own indent. */
|
|
1163
|
+
* get upload instructions, then upload the file itself to the returned URL. Lines are relative
|
|
1164
|
+
* to the caller's own indent. */
|
|
1256
1165
|
function renderMediaUploadMutationBody({ resolver, endpointFunction, resolvedEndpointArgs }) {
|
|
1257
1166
|
return [
|
|
1258
1167
|
`const uploadInstructions = await ${endpointFunction}(${resolvedEndpointArgs}${resolver.options.axiosRequestConfig ? `${resolvedEndpointArgs ? ", " : ""}${AXIOS_REQUEST_CONFIG_NAME}` : ""});`,
|
|
@@ -1283,18 +1192,6 @@ function renderMediaUploadMutationBody({ resolver, endpointFunction, resolvedEnd
|
|
|
1283
1192
|
];
|
|
1284
1193
|
}
|
|
1285
1194
|
//#endregion
|
|
1286
|
-
//#region src/generators/utils/query.utils.ts
|
|
1287
|
-
const isQuery = (endpoint) => isGetEndpoint(endpoint);
|
|
1288
|
-
const isMutation = (endpoint) => !isGetEndpoint(endpoint) || !!endpoint.mediaDownload;
|
|
1289
|
-
const isInfiniteQuery = (endpoint, options) => isPaginatedGetEndpoint(endpoint, options);
|
|
1290
|
-
const getDestructuredVariables = (resolver, endpoint, updateQueryEndpoints) => {
|
|
1291
|
-
const requiredUpdateQueryParams = updateQueryEndpoints.reduce((acc, updateEndpoint) => [...acc, ...mapEndpointParamsToFunctionParams(resolver, updateEndpoint, { includeOnlyRequiredParams: true }).map((param) => param.name)], []);
|
|
1292
|
-
return mapEndpointParamsToFunctionParams(resolver, endpoint, {
|
|
1293
|
-
includeOnlyRequiredParams: true,
|
|
1294
|
-
excludeBodyParam: true
|
|
1295
|
-
}).filter((param) => requiredUpdateQueryParams.includes(param.name)).map((param) => param.name);
|
|
1296
|
-
};
|
|
1297
|
-
//#endregion
|
|
1298
1195
|
//#region src/generators/utils/object.utils.ts
|
|
1299
1196
|
/** Pick given properties in object */
|
|
1300
1197
|
function pick(obj, paths) {
|
|
@@ -1449,6 +1346,7 @@ function resolveConfig({ fileConfig = {}, params: { includeTags, excludeTags, in
|
|
|
1449
1346
|
workspaceContext: workspaceContext?.split(",")
|
|
1450
1347
|
});
|
|
1451
1348
|
if (resolvedConfig.modelsInCommon && resolvedConfig.modelsInModules) throw new Error("modelsInCommon and modelsInModules cannot both be enabled");
|
|
1349
|
+
if (resolvedConfig.lazySchemas && !resolvedConfig.tsNamespaces) throw new Error("lazySchemas requires tsNamespaces");
|
|
1452
1350
|
resolvedConfig.checkAcl = resolvedConfig.acl && resolvedConfig.checkAcl;
|
|
1453
1351
|
resolvedConfig.workspaceContext = Array.from(new Set((resolvedConfig.workspaceContext ?? []).map((value) => value.trim()).filter(Boolean)));
|
|
1454
1352
|
return resolvedConfig;
|
|
@@ -1532,7 +1430,7 @@ function generateFilesFromNativeOpenAPI(source, yaml, options) {
|
|
|
1532
1430
|
return files;
|
|
1533
1431
|
}
|
|
1534
1432
|
function supportsCompleteNativeRender(options) {
|
|
1535
|
-
return options.splitByTags && !options.inlineEndpoints &&
|
|
1433
|
+
return options.splitByTags && !options.inlineEndpoints && (options.workspaceContext?.length ?? 0) === 0;
|
|
1536
1434
|
}
|
|
1537
1435
|
function taggedFile(options, tag, type, content) {
|
|
1538
1436
|
return outputFile(options, getTagFileName({
|
|
@@ -1576,7 +1474,7 @@ async function runGenerate({ fileConfig, params, formatGeneratedFile, profiler =
|
|
|
1576
1474
|
const nativeFiles = generateFilesFromNativeOpenAPI(nativeInput.source, nativeInput.yaml, config);
|
|
1577
1475
|
if (nativeFiles) return nativeFiles;
|
|
1578
1476
|
}
|
|
1579
|
-
const { generateCodeFromOpenAPIDoc } = await import("./generateCodeFromOpenAPIDoc-
|
|
1477
|
+
const { generateCodeFromOpenAPIDoc } = await import("./generateCodeFromOpenAPIDoc-B7VWwIbb.mjs").then((n) => n.n);
|
|
1580
1478
|
return generateCodeFromOpenAPIDoc(openApiDoc, config, profiler, {
|
|
1581
1479
|
source: nativeInput.source,
|
|
1582
1480
|
yaml: nativeInput.yaml
|
|
@@ -1664,4 +1562,4 @@ function getGenerateStats(filesData, config) {
|
|
|
1664
1562
|
};
|
|
1665
1563
|
}
|
|
1666
1564
|
//#endregion
|
|
1667
|
-
export {
|
|
1565
|
+
export { getParamZodSchemaName as $, AXIOS_DEFAULT_IMPORT_NAME as $t, getAbilityConditionType as A, pathParamToVariableName as At, getImportedZodSchemaInferedTypeName as B, ALLOWED_PATH_IN as Bt, getTagFileName as C, isErrorStatus as Ct, getImportPath as D, isPathExcluded as Dt, getEndpointsImports as E, isParamMediaTypeAllowed as Et, getAbilitySubjectTypes as F, inferRequiredSchema as Ft, getZodSchemaType as G, ENUM_SCHEMA as Gt, getZodSchemaDescription as H, BLOB_SCHEMA as Ht, getAclData as I, isArraySchemaObject as It, getUniqueArray as J, STRING_SCHEMA as Jt, getSchemaDescriptions as K, INT_SCHEMA as Kt, getAppAbilitiesType as L, isReferenceObject as Lt, getAbilityDescription as M, replaceHyphenatedPath as Mt, getAbilityFunctionName as N, unwrapQuotesIfNeeded as Nt, getModelsImports as O, isPrimitiveType as Ot, getAbilitySubject as P, wrapWithQuotesIfNeeded as Pt, getEnumZodSchemaName as Q, ZOD_IMPORT as Qt, hasAbilityConditions as R, isSchemaObject as Rt, getQueryTypesImportPath as S, getSchemaRef as St, getAclImports as T, isMediaTypeAllowed as Tt, getZodSchemaInferedTypeName as U, DATETIME_SCHEMA as Ut, getImportedZodSchemaName as V, ANY_SCHEMA as Vt, getZodSchemaPropertyDescriptions as W, EMAIL_SCHEMA as Wt, invalidVariableNameCharactersToCamel as X, UUID_SCHEMA as Xt, DEFAULT_GENERATE_OPTIONS as Y, URL_SCHEMA as Yt, getBodyZodSchemaName as Z, VOID_SCHEMA as Zt, getSchemaTsMetaType as _, Profiler as _n, getNamespaceName as _t, resolveConfig as a, NATIVE_RESPONSE_TYPE as an, APP_REST_CLIENT_FILE as at, getFileNameWithExtension as b, getParameterEnumNames as bt, getEndpointBody as c, getEndpointTag as cn, MUTATION_EFFECTS as ct, getEndpointPath as d, shouldInlineEndpointsForTag as dn, QUERY_OPTIONS_TYPES as dt, AXIOS_IMPORT as en, getResponseZodSchemaName as et, getImportedEndpointName as f, capitalize as fn, ZOD_EXTENDED as ft, requiresBody as g, snakeToCamel as gn, REST_PACKAGE_IMPORT_PATH as gt, renderMediaUploadMutationBody as h, removeWord as hn, NATIVE_PACKAGE_IMPORT_PATH as ht, shouldUseNativeCodegen as i, JSON_APPLICATION_FORMAT as in, isNamedZodSchema as it, getAbilityConditionsTypes as j, pathToVariableName as jt, getAbilityAction as k, isSortingParameterObject as kt, getEndpointConfig as l, getOperationTag as ln, QUERY_MODULES_FILE as lt, mapEndpointParamsToFunctionParams as m, getMostCommonAdjacentCombinationSplit as mn, CONFIG_PACKAGE_IMPORT_PATH as mt, runGenerate as n, AXIOS_REQUEST_CONFIG_TYPE as nn, getZodSchemaOperationName as nt, getOutputFileName as o, getRequestConfigTypeName as on, APP_REST_CLIENT_NAME as ot, hasEndpointConfig as p, decapitalize as pn, AXIOS_PACKAGE_IMPORT_PATH as pt, iterateSchema as q, NUMBER_SCHEMA as qt, compileNativeData as r, BODY_PARAMETER_NAME as rn, isEnumZodSchema as rt, pick as s, formatTag as sn, DOMAIN_ERRORS_FILE as st, getOpenApiDoc as t, AXIOS_REQUEST_CONFIG_NAME as tn, getZodSchemaName as tt, getEndpointName as u, isTagIncluded as un, QUERY_MODULE_ENUM as ut, getTsTypeBase as v, autocorrectRef as vt, getTagImportPath as w, isMainResponseStatus as wt, getQueryModulesImportPath as x, getSchemaNameByRef as xt, getAppRestClientImportPath as y, escapeControlCharacters as yt, renderAclCheckCall as z, ALLOWED_METHODS as zt };
|