@orval/core 6.28.2 → 6.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +47 -16
- package/dist/index.js +56 -45
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ type NormalizedOutputOptions = {
|
|
|
48
48
|
allParamsOptional: boolean;
|
|
49
49
|
urlEncodeParameters: boolean;
|
|
50
50
|
unionAddMissingProperties: boolean;
|
|
51
|
+
optionsParamRequired: boolean;
|
|
51
52
|
};
|
|
52
53
|
type NormalizedParamsSerializerOptions = {
|
|
53
54
|
qs?: Record<string, any>;
|
|
@@ -98,6 +99,7 @@ type NormalizedOverrideOutput = {
|
|
|
98
99
|
useBigInt?: boolean;
|
|
99
100
|
useNamedParameters?: boolean;
|
|
100
101
|
useNativeEnums?: boolean;
|
|
102
|
+
suppressReadonlyModifier?: boolean;
|
|
101
103
|
};
|
|
102
104
|
type NormalizedMutator = {
|
|
103
105
|
path: string;
|
|
@@ -155,6 +157,7 @@ type OutputOptions = {
|
|
|
155
157
|
allParamsOptional?: boolean;
|
|
156
158
|
urlEncodeParameters?: boolean;
|
|
157
159
|
unionAddMissingProperties?: boolean;
|
|
160
|
+
optionsParamRequired?: boolean;
|
|
158
161
|
};
|
|
159
162
|
type SwaggerParserOptions = Omit<SwaggerParser.Options, 'validate'> & {
|
|
160
163
|
validate?: boolean;
|
|
@@ -166,7 +169,7 @@ type InputOptions = {
|
|
|
166
169
|
converterOptions?: swagger2openapi.Options;
|
|
167
170
|
parserOptions?: SwaggerParserOptions;
|
|
168
171
|
filters?: {
|
|
169
|
-
tags?: string[];
|
|
172
|
+
tags?: (string | RegExp)[];
|
|
170
173
|
};
|
|
171
174
|
};
|
|
172
175
|
declare const OutputClient: {
|
|
@@ -196,7 +199,7 @@ type GlobalMockOptions = {
|
|
|
196
199
|
type: OutputMockType;
|
|
197
200
|
useExamples?: boolean;
|
|
198
201
|
generateEachHttpStatus?: boolean;
|
|
199
|
-
delay?: number | (() => number);
|
|
202
|
+
delay?: false | number | (() => number);
|
|
200
203
|
delayFunctionLazyExecute?: boolean;
|
|
201
204
|
baseUrl?: string;
|
|
202
205
|
locale?: keyof typeof allLocales;
|
|
@@ -286,6 +289,7 @@ type OverrideOutput = {
|
|
|
286
289
|
useBigInt?: boolean;
|
|
287
290
|
useNamedParameters?: boolean;
|
|
288
291
|
useNativeEnums?: boolean;
|
|
292
|
+
suppressReadonlyModifier?: boolean;
|
|
289
293
|
};
|
|
290
294
|
type OverrideOutputContentType = {
|
|
291
295
|
include?: string[];
|
|
@@ -293,6 +297,7 @@ type OverrideOutputContentType = {
|
|
|
293
297
|
};
|
|
294
298
|
type NormalizedHonoOptions = {
|
|
295
299
|
handlers?: string;
|
|
300
|
+
validator: boolean | 'hono';
|
|
296
301
|
};
|
|
297
302
|
type ZodOptions = {
|
|
298
303
|
strict?: {
|
|
@@ -303,13 +308,21 @@ type ZodOptions = {
|
|
|
303
308
|
response?: boolean;
|
|
304
309
|
};
|
|
305
310
|
coerce?: {
|
|
306
|
-
param?: boolean;
|
|
307
|
-
query?: boolean;
|
|
308
|
-
header?: boolean;
|
|
309
|
-
body?: boolean;
|
|
310
|
-
response?: boolean;
|
|
311
|
+
param?: boolean | ZodCoerceType[];
|
|
312
|
+
query?: boolean | ZodCoerceType[];
|
|
313
|
+
header?: boolean | ZodCoerceType[];
|
|
314
|
+
body?: boolean | ZodCoerceType[];
|
|
315
|
+
response?: boolean | ZodCoerceType[];
|
|
316
|
+
};
|
|
317
|
+
preprocess?: {
|
|
318
|
+
param?: Mutator;
|
|
319
|
+
query?: Mutator;
|
|
320
|
+
header?: Mutator;
|
|
321
|
+
body?: Mutator;
|
|
322
|
+
response?: Mutator;
|
|
311
323
|
};
|
|
312
324
|
};
|
|
325
|
+
type ZodCoerceType = 'string' | 'number' | 'boolean' | 'bigint' | 'date';
|
|
313
326
|
type NormalizedZodOptions = {
|
|
314
327
|
strict: {
|
|
315
328
|
param: boolean;
|
|
@@ -319,15 +332,23 @@ type NormalizedZodOptions = {
|
|
|
319
332
|
response: boolean;
|
|
320
333
|
};
|
|
321
334
|
coerce: {
|
|
322
|
-
param: boolean;
|
|
323
|
-
query: boolean;
|
|
324
|
-
header: boolean;
|
|
325
|
-
body: boolean;
|
|
326
|
-
response: boolean;
|
|
335
|
+
param: boolean | ZodCoerceType[];
|
|
336
|
+
query: boolean | ZodCoerceType[];
|
|
337
|
+
header: boolean | ZodCoerceType[];
|
|
338
|
+
body: boolean | ZodCoerceType[];
|
|
339
|
+
response: boolean | ZodCoerceType[];
|
|
340
|
+
};
|
|
341
|
+
preprocess: {
|
|
342
|
+
param?: NormalizedMutator;
|
|
343
|
+
query?: NormalizedMutator;
|
|
344
|
+
header?: NormalizedMutator;
|
|
345
|
+
body?: NormalizedMutator;
|
|
346
|
+
response?: NormalizedMutator;
|
|
327
347
|
};
|
|
328
348
|
};
|
|
329
349
|
type HonoOptions = {
|
|
330
350
|
handlers?: string;
|
|
351
|
+
validator?: boolean | 'hono';
|
|
331
352
|
};
|
|
332
353
|
type NormalizedQueryOptions = {
|
|
333
354
|
useQuery?: boolean;
|
|
@@ -342,6 +363,8 @@ type NormalizedQueryOptions = {
|
|
|
342
363
|
queryOptions?: NormalizedMutator;
|
|
343
364
|
mutationOptions?: NormalizedMutator;
|
|
344
365
|
shouldExportMutatorHooks?: boolean;
|
|
366
|
+
shouldExportHttpClient?: boolean;
|
|
367
|
+
shouldExportQueryKey?: boolean;
|
|
345
368
|
signal?: boolean;
|
|
346
369
|
version?: 3 | 4 | 5;
|
|
347
370
|
};
|
|
@@ -358,6 +381,8 @@ type QueryOptions = {
|
|
|
358
381
|
queryOptions?: Mutator;
|
|
359
382
|
mutationOptions?: Mutator;
|
|
360
383
|
shouldExportMutatorHooks?: boolean;
|
|
384
|
+
shouldExportHttpClient?: boolean;
|
|
385
|
+
shouldExportQueryKey?: boolean;
|
|
361
386
|
signal?: boolean;
|
|
362
387
|
version?: 3 | 4 | 5;
|
|
363
388
|
};
|
|
@@ -607,10 +632,16 @@ type ClientFooterBuilder = (params: {
|
|
|
607
632
|
}) => string;
|
|
608
633
|
type ClientTitleBuilder = (title: string) => string;
|
|
609
634
|
type ClientDependenciesBuilder = (hasGlobalMutator: boolean, hasParamsSerializerOptions: boolean, packageJson?: PackageJson) => GeneratorDependency[];
|
|
610
|
-
type
|
|
611
|
-
|
|
612
|
-
|
|
635
|
+
type ClientMockGeneratorImplementation = {
|
|
636
|
+
function: string;
|
|
637
|
+
handlerName: string;
|
|
638
|
+
handler: string;
|
|
639
|
+
};
|
|
640
|
+
type ClientMockGeneratorBuilder = {
|
|
641
|
+
imports: GeneratorImport[];
|
|
642
|
+
implementation: ClientMockGeneratorImplementation;
|
|
613
643
|
};
|
|
644
|
+
type ClientMockBuilder = (verbOptions: GeneratorVerbOptions, generatorOptions: GeneratorOptions) => ClientMockGeneratorBuilder;
|
|
614
645
|
interface ClientGeneratorsBuilder {
|
|
615
646
|
client: ClientBuilder;
|
|
616
647
|
header?: ClientHeaderBuilder;
|
|
@@ -1348,4 +1379,4 @@ declare const generateTarget: (builder: WriteSpecsBuilder, options: NormalizedOu
|
|
|
1348
1379
|
|
|
1349
1380
|
declare const generateTargetForTags: (builder: WriteSpecsBuilder, options: NormalizedOutputOptions) => Record<string, GeneratorTarget>;
|
|
1350
1381
|
|
|
1351
|
-
export { type AngularOptions, BODY_TYPE_NAME, type ClientBuilder, type ClientDependenciesBuilder, type ClientExtraFilesBuilder, type ClientFileBuilder, type ClientFooterBuilder, type ClientGeneratorsBuilder, type ClientHeaderBuilder, type ClientMockBuilder, type ClientTitleBuilder, type Config, type ConfigExternal, type ConfigFn, type ContextSpecs, type GenerateMockImports, type GeneratorApiBuilder, type GeneratorApiOperations, type GeneratorApiResponse, type GeneratorClient, type GeneratorClientExtra, type GeneratorClientFooter, type GeneratorClientHeader, type GeneratorClientImports, type GeneratorClientTitle, type GeneratorClients, type GeneratorDependency, type GeneratorImport, type GeneratorMutator, type GeneratorMutatorParsingInfo, type GeneratorOperation, type GeneratorOperations, type GeneratorOptions, type GeneratorSchema, type GeneratorTarget, type GeneratorTargetFull, type GeneratorVerbOptions, type GeneratorVerbsOptions, type GetterBody, type GetterParam, type GetterParameters, type GetterParams, type GetterProp, GetterPropType, type GetterProps, type GetterQueryParam, type GetterResponse, type GlobalMockOptions, type GlobalOptions, type HonoOptions, type Hook, type HookCommand, type HookFunction, type HookOption, type HooksOptions, type ImportOpenApi, type InputOptions, type InputTransformerFn, type LogLevel, LogLevels, type LogOptions, type LogType, type Logger, type LoggerOptions, type MockData, type MockDataArray, type MockDataArrayFn, type MockDataObject, type MockDataObjectFn, type MockOptions, type MockProperties, type MockPropertiesObject, type MockPropertiesObjectFn, type Mutator, type MutatorObject, type NormalizedConfig, type NormalizedHonoOptions, type NormalizedHookCommand, type NormalizedHookOptions, type NormalizedInputOptions, type NormalizedMutator, type NormalizedOperationOptions, type NormalizedOptions, type NormalizedOutputOptions, type NormalizedOverrideOutput, type NormalizedParamsSerializerOptions, type NormalizedQueryOptions, type NormalizedZodOptions, type OperationOptions, type Options, type OptionsExport, type OptionsFn, OutputClient, type OutputClientFunc, OutputMockType, OutputMode, type OutputOptions, type OverrideInput, type OverrideMockOptions, type OverrideOutput, type OverrideOutputContentType, type PackageJson, type ParamsSerializerOptions, type QueryOptions, RefComponentSuffix, type RefInfo, type ResReqTypesValue, type ResolverValue, type ScalarValue, SchemaType, type SwaggerParserOptions, type SwrOptions, type TsConfigTarget, type Tsconfig, URL_REGEX, VERBS_WITH_BODY, Verbs, type WriteModeProps, type WriteSpecsBuilder, type ZodOptions, _filteredVerbs, addDependency, asyncReduce, camel, combineSchemas, compareVersions, count, createDebugger, createLogger, createSuccessMessage, dynamicImport, escape, generalJSTypes, generalJSTypesWithArray, generateAxiosOptions, generateBodyMutatorConfig, generateBodyOptions, generateComponentDefinition, generateDependencyImports, generateFormDataAndUrlEncodedFunction, generateImports, generateModelInline, generateModelsInline, generateMutator, generateMutatorConfig, generateMutatorImports, generateMutatorRequestOptions, generateOptions, generateParameterDefinition, generateQueryParamsAxiosConfig, generateSchemasDefinition, generateTarget, generateTargetForTags, generateVerbImports, generateVerbsOptions, getArray, getBody, getEnum, getEnumImplementation, getExtension, getFileInfo, getKey, getMockFileExtensionByTypeName, getNumberWord, getObject, getOperationId, getOrvalGeneratedTypes, getParameters, getParams, getParamsInPath, getProps, getQueryParams, getRefInfo, getResReqTypes, getResponse, getRoute, getRouteAsArray, getScalar, ibmOpenapiValidator, ibmOpenapiValidatorErrors, ibmOpenapiValidatorWarnings, isBoolean, isDirectory, isFunction, isModule, isNull, isNumber, isNumeric, isObject, isReference, isRootKey, isSchema, isString, isSyntheticDefaultImportsAllow, isUndefined, isUrl, isVerb, jsDoc, jsStringEscape, kebab, loadFile, log, logError, mergeDeep, mismatchArgsMessage, openApiConverter, pascal, removeFiles, resolveDiscriminators, resolveExampleRefs, resolveObject, resolveRef, resolveValue, sanitize, snake, sortByPriority, startMessage, stringify, toObjectString, path as upath, upper, writeModelInline, writeModelsInline, writeSchema, writeSchemas, writeSingleMode, writeSplitMode, writeSplitTagsMode, writeTagsMode };
|
|
1382
|
+
export { type AngularOptions, BODY_TYPE_NAME, type ClientBuilder, type ClientDependenciesBuilder, type ClientExtraFilesBuilder, type ClientFileBuilder, type ClientFooterBuilder, type ClientGeneratorsBuilder, type ClientHeaderBuilder, type ClientMockBuilder, type ClientMockGeneratorBuilder, type ClientMockGeneratorImplementation, type ClientTitleBuilder, type Config, type ConfigExternal, type ConfigFn, type ContextSpecs, type GenerateMockImports, type GeneratorApiBuilder, type GeneratorApiOperations, type GeneratorApiResponse, type GeneratorClient, type GeneratorClientExtra, type GeneratorClientFooter, type GeneratorClientHeader, type GeneratorClientImports, type GeneratorClientTitle, type GeneratorClients, type GeneratorDependency, type GeneratorImport, type GeneratorMutator, type GeneratorMutatorParsingInfo, type GeneratorOperation, type GeneratorOperations, type GeneratorOptions, type GeneratorSchema, type GeneratorTarget, type GeneratorTargetFull, type GeneratorVerbOptions, type GeneratorVerbsOptions, type GetterBody, type GetterParam, type GetterParameters, type GetterParams, type GetterProp, GetterPropType, type GetterProps, type GetterQueryParam, type GetterResponse, type GlobalMockOptions, type GlobalOptions, type HonoOptions, type Hook, type HookCommand, type HookFunction, type HookOption, type HooksOptions, type ImportOpenApi, type InputOptions, type InputTransformerFn, type LogLevel, LogLevels, type LogOptions, type LogType, type Logger, type LoggerOptions, type MockData, type MockDataArray, type MockDataArrayFn, type MockDataObject, type MockDataObjectFn, type MockOptions, type MockProperties, type MockPropertiesObject, type MockPropertiesObjectFn, type Mutator, type MutatorObject, type NormalizedConfig, type NormalizedHonoOptions, type NormalizedHookCommand, type NormalizedHookOptions, type NormalizedInputOptions, type NormalizedMutator, type NormalizedOperationOptions, type NormalizedOptions, type NormalizedOutputOptions, type NormalizedOverrideOutput, type NormalizedParamsSerializerOptions, type NormalizedQueryOptions, type NormalizedZodOptions, type OperationOptions, type Options, type OptionsExport, type OptionsFn, OutputClient, type OutputClientFunc, OutputMockType, OutputMode, type OutputOptions, type OverrideInput, type OverrideMockOptions, type OverrideOutput, type OverrideOutputContentType, type PackageJson, type ParamsSerializerOptions, type QueryOptions, RefComponentSuffix, type RefInfo, type ResReqTypesValue, type ResolverValue, type ScalarValue, SchemaType, type SwaggerParserOptions, type SwrOptions, type TsConfigTarget, type Tsconfig, URL_REGEX, VERBS_WITH_BODY, Verbs, type WriteModeProps, type WriteSpecsBuilder, type ZodCoerceType, type ZodOptions, _filteredVerbs, addDependency, asyncReduce, camel, combineSchemas, compareVersions, count, createDebugger, createLogger, createSuccessMessage, dynamicImport, escape, generalJSTypes, generalJSTypesWithArray, generateAxiosOptions, generateBodyMutatorConfig, generateBodyOptions, generateComponentDefinition, generateDependencyImports, generateFormDataAndUrlEncodedFunction, generateImports, generateModelInline, generateModelsInline, generateMutator, generateMutatorConfig, generateMutatorImports, generateMutatorRequestOptions, generateOptions, generateParameterDefinition, generateQueryParamsAxiosConfig, generateSchemasDefinition, generateTarget, generateTargetForTags, generateVerbImports, generateVerbsOptions, getArray, getBody, getEnum, getEnumImplementation, getExtension, getFileInfo, getKey, getMockFileExtensionByTypeName, getNumberWord, getObject, getOperationId, getOrvalGeneratedTypes, getParameters, getParams, getParamsInPath, getProps, getQueryParams, getRefInfo, getResReqTypes, getResponse, getRoute, getRouteAsArray, getScalar, ibmOpenapiValidator, ibmOpenapiValidatorErrors, ibmOpenapiValidatorWarnings, isBoolean, isDirectory, isFunction, isModule, isNull, isNumber, isNumeric, isObject, isReference, isRootKey, isSchema, isString, isSyntheticDefaultImportsAllow, isUndefined, isUrl, isVerb, jsDoc, jsStringEscape, kebab, loadFile, log, logError, mergeDeep, mismatchArgsMessage, openApiConverter, pascal, removeFiles, resolveDiscriminators, resolveExampleRefs, resolveObject, resolveRef, resolveValue, sanitize, snake, sortByPriority, startMessage, stringify, toObjectString, path as upath, upper, writeModelInline, writeModelsInline, writeSchema, writeSchemas, writeSingleMode, writeSplitMode, writeSplitTagsMode, writeTagsMode };
|
package/dist/index.js
CHANGED
|
@@ -15487,13 +15487,13 @@ function destroyStream(stream, err) {
|
|
|
15487
15487
|
stream.end();
|
|
15488
15488
|
}
|
|
15489
15489
|
}
|
|
15490
|
-
var import_stream, import_http,
|
|
15490
|
+
var import_stream, import_http, import_url2, import_whatwg_url, import_https, import_zlib, Readable, BUFFER, TYPE, Blob, convert, INTERNALS, PassThrough, invalidTokenRegex, invalidHeaderCharRegex, MAP, Headers, INTERNAL, HeadersIteratorPrototype, INTERNALS$1, STATUS_CODES, Response, INTERNALS$2, URL2, parse_url, format_url, streamDestructionSupported, Request, URL$1, PassThrough$1, isDomainOrSubdomain, isSameProtocol, lib_default;
|
|
15491
15491
|
var init_lib = __esm({
|
|
15492
15492
|
"../../node_modules/node-fetch/lib/index.mjs"() {
|
|
15493
15493
|
"use strict";
|
|
15494
15494
|
import_stream = __toESM(require("stream"), 1);
|
|
15495
15495
|
import_http = __toESM(require("http"), 1);
|
|
15496
|
-
|
|
15496
|
+
import_url2 = __toESM(require("url"), 1);
|
|
15497
15497
|
import_whatwg_url = __toESM(require_public_api(), 1);
|
|
15498
15498
|
import_https = __toESM(require("https"), 1);
|
|
15499
15499
|
import_zlib = __toESM(require("zlib"), 1);
|
|
@@ -16011,9 +16011,9 @@ var init_lib = __esm({
|
|
|
16011
16011
|
configurable: true
|
|
16012
16012
|
});
|
|
16013
16013
|
INTERNALS$2 = Symbol("Request internals");
|
|
16014
|
-
URL2 =
|
|
16015
|
-
parse_url =
|
|
16016
|
-
format_url =
|
|
16014
|
+
URL2 = import_url2.default.URL || import_whatwg_url.default.URL;
|
|
16015
|
+
parse_url = import_url2.default.parse;
|
|
16016
|
+
format_url = import_url2.default.format;
|
|
16017
16017
|
streamDestructionSupported = "destroy" in import_stream.default.Readable.prototype;
|
|
16018
16018
|
Request = class _Request {
|
|
16019
16019
|
constructor(input) {
|
|
@@ -16106,7 +16106,7 @@ var init_lib = __esm({
|
|
|
16106
16106
|
AbortError.prototype = Object.create(Error.prototype);
|
|
16107
16107
|
AbortError.prototype.constructor = AbortError;
|
|
16108
16108
|
AbortError.prototype.name = "AbortError";
|
|
16109
|
-
URL$1 =
|
|
16109
|
+
URL$1 = import_url2.default.URL || import_whatwg_url.default.URL;
|
|
16110
16110
|
PassThrough$1 = import_stream.default.PassThrough;
|
|
16111
16111
|
isDomainOrSubdomain = function isDomainOrSubdomain2(destination, original) {
|
|
16112
16112
|
const orig = new URL$1(original).hostname;
|
|
@@ -40735,6 +40735,7 @@ ${tryOneLine ? " " : ""} *`;
|
|
|
40735
40735
|
}
|
|
40736
40736
|
|
|
40737
40737
|
// src/utils/dynamic-import.ts
|
|
40738
|
+
var import_url = require("url");
|
|
40738
40739
|
var dynamicImport = async (toImport, from = process.cwd(), takeDefault = true) => {
|
|
40739
40740
|
if (!toImport) {
|
|
40740
40741
|
return toImport;
|
|
@@ -40742,7 +40743,8 @@ var dynamicImport = async (toImport, from = process.cwd(), takeDefault = true) =
|
|
|
40742
40743
|
try {
|
|
40743
40744
|
if (isString2(toImport)) {
|
|
40744
40745
|
const path2 = resolve2(from, toImport);
|
|
40745
|
-
const
|
|
40746
|
+
const fileUrl = (0, import_url.pathToFileURL)(path2);
|
|
40747
|
+
const data = await import(fileUrl.href);
|
|
40746
40748
|
if (takeDefault && (isObject(data) || isModule(data)) && data.default) {
|
|
40747
40749
|
return data.default;
|
|
40748
40750
|
}
|
|
@@ -41379,7 +41381,7 @@ var getArray = ({
|
|
|
41379
41381
|
context
|
|
41380
41382
|
});
|
|
41381
41383
|
return {
|
|
41382
|
-
value: `${schema.readOnly === true ? "readonly " : ""}${resolvedObject.value.includes("|") ? `(${resolvedObject.value})[]` : `${resolvedObject.value}[]`}`,
|
|
41384
|
+
value: `${schema.readOnly === true && !context.output.override.suppressReadonlyModifier ? "readonly " : ""}${resolvedObject.value.includes("|") ? `(${resolvedObject.value})[]` : `${resolvedObject.value}[]`}`,
|
|
41383
41385
|
imports: resolvedObject.imports,
|
|
41384
41386
|
schemas: resolvedObject.schemas,
|
|
41385
41387
|
isEnum: false,
|
|
@@ -41810,7 +41812,7 @@ var getObject = ({
|
|
|
41810
41812
|
acc.hasReadonlyProps ||= isReadOnly || false;
|
|
41811
41813
|
acc.imports.push(...resolvedValue.imports);
|
|
41812
41814
|
acc.value += `
|
|
41813
|
-
${doc ? `${doc} ` : ""}${isReadOnly ? "readonly " : ""}${getKey(key)}${isRequired ? "" : "?"}: ${resolvedValue.value};`;
|
|
41815
|
+
${doc ? `${doc} ` : ""}${isReadOnly && !context.output.override.suppressReadonlyModifier ? "readonly " : ""}${getKey(key)}${isRequired ? "" : "?"}: ${resolvedValue.value};`;
|
|
41814
41816
|
acc.schemas.push(...resolvedValue.schemas);
|
|
41815
41817
|
if (arr.length - 1 === index3) {
|
|
41816
41818
|
if (item.additionalProperties) {
|
|
@@ -42125,19 +42127,29 @@ var combineSchemas = ({
|
|
|
42125
42127
|
context
|
|
42126
42128
|
});
|
|
42127
42129
|
if (isAllEnums && name && items.length > 1) {
|
|
42128
|
-
const newEnum =
|
|
42129
|
-
|
|
42130
|
-
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
42130
|
+
const newEnum = `// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
42131
42131
|
export const ${pascal(
|
|
42132
42132
|
name
|
|
42133
|
-
)} = ${getCombineEnumValue(resolvedData)}
|
|
42133
|
+
)} = ${getCombineEnumValue(resolvedData)};
|
|
42134
|
+
`;
|
|
42134
42135
|
return {
|
|
42135
|
-
value: `typeof ${pascal(name)}[keyof typeof ${pascal(name)}] ${nullable}
|
|
42136
|
-
imports:
|
|
42137
|
-
|
|
42138
|
-
|
|
42139
|
-
|
|
42140
|
-
|
|
42136
|
+
value: `typeof ${pascal(name)}[keyof typeof ${pascal(name)}] ${nullable}`,
|
|
42137
|
+
imports: [
|
|
42138
|
+
{
|
|
42139
|
+
name: pascal(name)
|
|
42140
|
+
}
|
|
42141
|
+
],
|
|
42142
|
+
schemas: [
|
|
42143
|
+
...resolvedData.schemas,
|
|
42144
|
+
{
|
|
42145
|
+
imports: resolvedData.imports.map((toImport) => ({
|
|
42146
|
+
...toImport,
|
|
42147
|
+
values: true
|
|
42148
|
+
})),
|
|
42149
|
+
model: newEnum,
|
|
42150
|
+
name: pascal(name)
|
|
42151
|
+
}
|
|
42152
|
+
],
|
|
42141
42153
|
isEnum: false,
|
|
42142
42154
|
type: "object",
|
|
42143
42155
|
isRef: false,
|
|
@@ -43743,32 +43755,31 @@ ${exports2}`;
|
|
|
43743
43755
|
|
|
43744
43756
|
// src/writers/types.ts
|
|
43745
43757
|
var getOrvalGeneratedTypes = () => `
|
|
43746
|
-
|
|
43747
|
-
type
|
|
43748
|
-
|
|
43749
|
-
|
|
43750
|
-
|
|
43751
|
-
|
|
43752
|
-
|
|
43753
|
-
|
|
43754
|
-
|
|
43755
|
-
: T
|
|
43756
|
-
|
|
43757
|
-
|
|
43758
|
-
|
|
43759
|
-
|
|
43760
|
-
|
|
43761
|
-
|
|
43762
|
-
?
|
|
43763
|
-
|
|
43764
|
-
|
|
43765
|
-
|
|
43766
|
-
|
|
43767
|
-
: T extends
|
|
43768
|
-
|
|
43769
|
-
|
|
43770
|
-
|
|
43771
|
-
: T;
|
|
43758
|
+
// https://stackoverflow.com/questions/49579094/typescript-conditional-types-filter-out-readonly-properties-pick-only-requir/49579497#49579497
|
|
43759
|
+
type IfEquals<X, Y, A = X, B = never> = (<T>() => T extends X ? 1 : 2) extends <
|
|
43760
|
+
T,
|
|
43761
|
+
>() => T extends Y ? 1 : 2
|
|
43762
|
+
? A
|
|
43763
|
+
: B;
|
|
43764
|
+
|
|
43765
|
+
type WritableKeys<T> = {
|
|
43766
|
+
[P in keyof T]-?: IfEquals<
|
|
43767
|
+
{ [Q in P]: T[P] },
|
|
43768
|
+
{ -readonly [Q in P]: T[P] },
|
|
43769
|
+
P
|
|
43770
|
+
>;
|
|
43771
|
+
}[keyof T];
|
|
43772
|
+
|
|
43773
|
+
type UnionToIntersection<U> =
|
|
43774
|
+
(U extends any ? (k: U)=>void : never) extends ((k: infer I)=>void) ? I : never;
|
|
43775
|
+
type DistributeReadOnlyOverUnions<T> = T extends any ? NonReadonly<T> : never;
|
|
43776
|
+
|
|
43777
|
+
type Writable<T> = Pick<T, WritableKeys<T>>;
|
|
43778
|
+
type NonReadonly<T> = [T] extends [UnionToIntersection<T>] ? {
|
|
43779
|
+
[P in keyof Writable<T>]: T[P] extends object
|
|
43780
|
+
? NonReadonly<NonNullable<T[P]>>
|
|
43781
|
+
: T[P];
|
|
43782
|
+
} : DistributeReadOnlyOverUnions<T>;
|
|
43772
43783
|
`;
|
|
43773
43784
|
|
|
43774
43785
|
// src/writers/single-mode.ts
|