@orval/core 6.21.0 → 6.22.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/dist/index.d.ts +21 -7
- package/dist/index.js +153 -62
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -42,6 +42,8 @@ type NormalizedOutputOptions = {
|
|
|
42
42
|
headers: boolean;
|
|
43
43
|
indexFiles: boolean;
|
|
44
44
|
baseUrl?: string;
|
|
45
|
+
allParamsOptional: boolean;
|
|
46
|
+
urlEncodeParameters: boolean;
|
|
45
47
|
};
|
|
46
48
|
type NormalizedParamsSerializerOptions = {
|
|
47
49
|
qs?: Record<string, any>;
|
|
@@ -144,6 +146,8 @@ type OutputOptions = {
|
|
|
144
146
|
headers?: boolean;
|
|
145
147
|
indexFiles?: boolean;
|
|
146
148
|
baseUrl?: string;
|
|
149
|
+
allParamsOptional?: boolean;
|
|
150
|
+
urlEncodeParameters?: boolean;
|
|
147
151
|
};
|
|
148
152
|
type SwaggerParserOptions = Omit<SwaggerParser.Options, 'validate'> & {
|
|
149
153
|
validate?: boolean;
|
|
@@ -165,6 +169,8 @@ declare const OutputClient: {
|
|
|
165
169
|
readonly REACT_QUERY: "react-query";
|
|
166
170
|
readonly SVELTE_QUERY: "svelte-query";
|
|
167
171
|
readonly VUE_QUERY: "vue-query";
|
|
172
|
+
readonly SWR: "swr";
|
|
173
|
+
readonly ZOD: "zod";
|
|
168
174
|
};
|
|
169
175
|
type OutputClient = typeof OutputClient[keyof typeof OutputClient];
|
|
170
176
|
declare const OutputMode: {
|
|
@@ -504,7 +510,7 @@ type GeneratorMutator = {
|
|
|
504
510
|
isHook: boolean;
|
|
505
511
|
bodyTypeName?: string;
|
|
506
512
|
};
|
|
507
|
-
type ClientBuilder = (verbOptions: GeneratorVerbOptions, options: GeneratorOptions, outputClient: OutputClient | OutputClientFunc) => GeneratorClient | Promise<GeneratorClient>;
|
|
513
|
+
type ClientBuilder = (verbOptions: GeneratorVerbOptions, options: GeneratorOptions, outputClient: OutputClient | OutputClientFunc, output?: NormalizedOutputOptions) => GeneratorClient | Promise<GeneratorClient>;
|
|
508
514
|
type ClientHeaderBuilder = (params: {
|
|
509
515
|
title: string;
|
|
510
516
|
isRequestOptions: boolean;
|
|
@@ -678,6 +684,7 @@ type GeneratorClientTitle = (data: {
|
|
|
678
684
|
outputClient?: OutputClient | OutputClientFunc;
|
|
679
685
|
title: string;
|
|
680
686
|
customTitleFunc?: (title: string) => string;
|
|
687
|
+
output: NormalizedOutputOptions;
|
|
681
688
|
}) => GeneratorClientExtra;
|
|
682
689
|
type GeneratorClientHeader = (data: {
|
|
683
690
|
outputClient?: OutputClient | OutputClientFunc;
|
|
@@ -687,6 +694,7 @@ type GeneratorClientHeader = (data: {
|
|
|
687
694
|
provideIn: boolean | 'root' | 'any';
|
|
688
695
|
hasAwaitedType: boolean;
|
|
689
696
|
titles: GeneratorClientExtra;
|
|
697
|
+
output: NormalizedOutputOptions;
|
|
690
698
|
}) => GeneratorClientExtra;
|
|
691
699
|
type GeneratorClientFooter = (data: {
|
|
692
700
|
outputClient: OutputClient | OutputClientFunc;
|
|
@@ -694,6 +702,7 @@ type GeneratorClientFooter = (data: {
|
|
|
694
702
|
hasMutator: boolean;
|
|
695
703
|
hasAwaitedType: boolean;
|
|
696
704
|
titles: GeneratorClientExtra;
|
|
705
|
+
output: NormalizedOutputOptions;
|
|
697
706
|
}) => GeneratorClientExtra;
|
|
698
707
|
type GeneratorClientImports = (data: {
|
|
699
708
|
client: OutputClient | OutputClientFunc;
|
|
@@ -708,6 +717,7 @@ type GeneratorClientImports = (data: {
|
|
|
708
717
|
hasGlobalMutator: boolean;
|
|
709
718
|
hasParamsSerializerOptions: boolean;
|
|
710
719
|
packageJson?: PackageJson;
|
|
720
|
+
output: NormalizedOutputOptions;
|
|
711
721
|
}) => string;
|
|
712
722
|
type GenerateMockImports = (data: {
|
|
713
723
|
implementation: string;
|
|
@@ -774,17 +784,18 @@ declare const generateMutator: ({ output, mutator, name, workspace, tsconfig, }:
|
|
|
774
784
|
}) => Promise<GeneratorMutator | undefined>;
|
|
775
785
|
|
|
776
786
|
declare const generateBodyOptions: (body: GetterBody, isFormData: boolean, isFormUrlEncoded: boolean) => string;
|
|
777
|
-
declare const generateAxiosOptions: ({ response, isExactOptionalPropertyTypes, queryParams, headers, requestOptions, hasSignal, paramsSerializer, paramsSerializerOptions, }: {
|
|
787
|
+
declare const generateAxiosOptions: ({ response, isExactOptionalPropertyTypes, queryParams, headers, requestOptions, hasSignal, isVue, paramsSerializer, paramsSerializerOptions, }: {
|
|
778
788
|
response: GetterResponse;
|
|
779
789
|
isExactOptionalPropertyTypes: boolean;
|
|
780
790
|
queryParams?: GeneratorSchema | undefined;
|
|
781
791
|
headers?: GeneratorSchema | undefined;
|
|
782
792
|
requestOptions?: boolean | object | undefined;
|
|
783
793
|
hasSignal: boolean;
|
|
794
|
+
isVue: boolean;
|
|
784
795
|
paramsSerializer?: GeneratorMutator | undefined;
|
|
785
796
|
paramsSerializerOptions?: ParamsSerializerOptions | undefined;
|
|
786
797
|
}) => string;
|
|
787
|
-
declare const generateOptions: ({ route, body, headers, queryParams, response, verb, requestOptions, isFormData, isFormUrlEncoded, isAngular, isExactOptionalPropertyTypes, hasSignal, paramsSerializer, paramsSerializerOptions, }: {
|
|
798
|
+
declare const generateOptions: ({ route, body, headers, queryParams, response, verb, requestOptions, isFormData, isFormUrlEncoded, isAngular, isExactOptionalPropertyTypes, hasSignal, isVue, paramsSerializer, paramsSerializerOptions, }: {
|
|
788
799
|
route: string;
|
|
789
800
|
body: GetterBody;
|
|
790
801
|
headers?: GetterQueryParam | undefined;
|
|
@@ -797,12 +808,13 @@ declare const generateOptions: ({ route, body, headers, queryParams, response, v
|
|
|
797
808
|
isAngular?: boolean | undefined;
|
|
798
809
|
isExactOptionalPropertyTypes: boolean;
|
|
799
810
|
hasSignal: boolean;
|
|
811
|
+
isVue?: boolean | undefined;
|
|
800
812
|
paramsSerializer?: GeneratorMutator | undefined;
|
|
801
813
|
paramsSerializerOptions?: ParamsSerializerOptions | undefined;
|
|
802
814
|
}) => string;
|
|
803
815
|
declare const generateBodyMutatorConfig: (body: GetterBody, isFormData: boolean, isFormUrlEncoded: boolean) => string;
|
|
804
|
-
declare const generateQueryParamsAxiosConfig: (response: GetterResponse, queryParams?: GetterQueryParam) => string;
|
|
805
|
-
declare const generateMutatorConfig: ({ route, body, headers, queryParams, response, verb, isFormData, isFormUrlEncoded, isBodyVerb, hasSignal, isExactOptionalPropertyTypes, }: {
|
|
816
|
+
declare const generateQueryParamsAxiosConfig: (response: GetterResponse, isVue: boolean, queryParams?: GetterQueryParam) => string;
|
|
817
|
+
declare const generateMutatorConfig: ({ route, body, headers, queryParams, response, verb, isFormData, isFormUrlEncoded, isBodyVerb, hasSignal, isExactOptionalPropertyTypes, isVue, }: {
|
|
806
818
|
route: string;
|
|
807
819
|
body: GetterBody;
|
|
808
820
|
headers?: GetterQueryParam | undefined;
|
|
@@ -814,6 +826,7 @@ declare const generateMutatorConfig: ({ route, body, headers, queryParams, respo
|
|
|
814
826
|
isBodyVerb: boolean;
|
|
815
827
|
hasSignal: boolean;
|
|
816
828
|
isExactOptionalPropertyTypes: boolean;
|
|
829
|
+
isVue?: boolean | undefined;
|
|
817
830
|
}) => string;
|
|
818
831
|
declare const generateMutatorRequestOptions: (requestOptions: boolean | object | undefined, hasSecondArgument: boolean) => string;
|
|
819
832
|
declare const generateFormDataAndUrlEncodedFunction: ({ body, formData, formUrlEncoded, isFormData, isFormUrlEncoded, }: {
|
|
@@ -906,7 +919,7 @@ declare const getParameters: ({ parameters, context, }: {
|
|
|
906
919
|
* @param path
|
|
907
920
|
*/
|
|
908
921
|
declare const getParamsInPath: (path: string) => string[];
|
|
909
|
-
declare const getParams: ({ route, pathParams, operationId, context, }: {
|
|
922
|
+
declare const getParams: ({ route, pathParams, operationId, context, output, }: {
|
|
910
923
|
route: string;
|
|
911
924
|
pathParams?: {
|
|
912
925
|
parameter: openapi3_ts.ParameterObject;
|
|
@@ -914,6 +927,7 @@ declare const getParams: ({ route, pathParams, operationId, context, }: {
|
|
|
914
927
|
}[] | undefined;
|
|
915
928
|
operationId: string;
|
|
916
929
|
context: ContextSpecs;
|
|
930
|
+
output: NormalizedOutputOptions;
|
|
917
931
|
}) => GetterParams;
|
|
918
932
|
|
|
919
933
|
declare const getProps: ({ body, queryParams, params, operationName, headers, context, }: {
|
|
@@ -1179,7 +1193,7 @@ declare const sanitize: (value: string, options?: {
|
|
|
1179
1193
|
}) => string;
|
|
1180
1194
|
declare const toObjectString: <T>(props: T[], path?: keyof T | undefined) => string;
|
|
1181
1195
|
declare const getNumberWord: (num: number) => string;
|
|
1182
|
-
declare const escape: (str: string, char?: string) => string;
|
|
1196
|
+
declare const escape: (str: string | null, char?: string) => string | undefined;
|
|
1183
1197
|
/**
|
|
1184
1198
|
* Escape all characters not included in SingleStringCharacters and
|
|
1185
1199
|
* DoubleStringCharacters on
|
package/dist/index.js
CHANGED
|
@@ -39864,7 +39864,9 @@ var OutputClient = {
|
|
|
39864
39864
|
AXIOS_FUNCTIONS: "axios-functions",
|
|
39865
39865
|
REACT_QUERY: "react-query",
|
|
39866
39866
|
SVELTE_QUERY: "svelte-query",
|
|
39867
|
-
VUE_QUERY: "vue-query"
|
|
39867
|
+
VUE_QUERY: "vue-query",
|
|
39868
|
+
SWR: "swr",
|
|
39869
|
+
ZOD: "zod"
|
|
39868
39870
|
};
|
|
39869
39871
|
var OutputMode = {
|
|
39870
39872
|
SINGLE: "single",
|
|
@@ -40879,7 +40881,7 @@ var getNumberWord = (num) => {
|
|
|
40879
40881
|
const arrayOfNumber = num.toString().split("");
|
|
40880
40882
|
return arrayOfNumber.reduce((acc, n3) => acc + NUMBERS[n3], "");
|
|
40881
40883
|
};
|
|
40882
|
-
var escape2 = (str, char = "'") => str
|
|
40884
|
+
var escape2 = (str, char = "'") => str?.replace(char, `\\${char}`);
|
|
40883
40885
|
var jsStringEscape = (input) => input.replace(/["'\\\n\r\u2028\u2029]/g, (character) => {
|
|
40884
40886
|
switch (character) {
|
|
40885
40887
|
case '"':
|
|
@@ -41192,7 +41194,7 @@ var resolveValue = ({
|
|
|
41192
41194
|
};
|
|
41193
41195
|
|
|
41194
41196
|
// src/resolvers/object.ts
|
|
41195
|
-
var
|
|
41197
|
+
var resolveObjectOriginal = ({
|
|
41196
41198
|
schema,
|
|
41197
41199
|
propName,
|
|
41198
41200
|
combined = false,
|
|
@@ -41251,6 +41253,31 @@ var resolveObject = ({
|
|
|
41251
41253
|
}
|
|
41252
41254
|
return resolvedValue;
|
|
41253
41255
|
};
|
|
41256
|
+
var resolveObjectCacheMap = /* @__PURE__ */ new Map();
|
|
41257
|
+
var resolveObject = ({
|
|
41258
|
+
schema,
|
|
41259
|
+
propName,
|
|
41260
|
+
combined = false,
|
|
41261
|
+
context
|
|
41262
|
+
}) => {
|
|
41263
|
+
const hashKey = JSON.stringify({
|
|
41264
|
+
schema,
|
|
41265
|
+
propName,
|
|
41266
|
+
combined,
|
|
41267
|
+
specKey: context.specKey
|
|
41268
|
+
});
|
|
41269
|
+
if (resolveObjectCacheMap.has(hashKey)) {
|
|
41270
|
+
return resolveObjectCacheMap.get(hashKey);
|
|
41271
|
+
}
|
|
41272
|
+
const result = resolveObjectOriginal({
|
|
41273
|
+
schema,
|
|
41274
|
+
propName,
|
|
41275
|
+
combined,
|
|
41276
|
+
context
|
|
41277
|
+
});
|
|
41278
|
+
resolveObjectCacheMap.set(hashKey, result);
|
|
41279
|
+
return result;
|
|
41280
|
+
};
|
|
41254
41281
|
|
|
41255
41282
|
// src/getters/array.ts
|
|
41256
41283
|
var getArray = ({
|
|
@@ -41447,49 +41474,37 @@ var getSchemaFormDataAndUrlEncoded = ({
|
|
|
41447
41474
|
!isRef && isReference(schemaObject) ? imports[0].name : name
|
|
41448
41475
|
);
|
|
41449
41476
|
const variableName = isUrlEncoded ? "formUrlEncoded" : "formData";
|
|
41450
|
-
|
|
41477
|
+
let form = isUrlEncoded ? `const ${variableName} = new URLSearchParams();
|
|
41451
41478
|
` : `const ${variableName} = new FormData();
|
|
41452
41479
|
`;
|
|
41453
|
-
if (schema.type === "object"
|
|
41454
|
-
|
|
41455
|
-
|
|
41456
|
-
|
|
41457
|
-
|
|
41458
|
-
const
|
|
41459
|
-
|
|
41460
|
-
|
|
41461
|
-
|
|
41462
|
-
|
|
41463
|
-
|
|
41464
|
-
|
|
41465
|
-
|
|
41466
|
-
|
|
41467
|
-
|
|
41468
|
-
|
|
41469
|
-
|
|
41470
|
-
|
|
41471
|
-
|
|
41472
|
-
|
|
41473
|
-
|
|
41474
|
-
|
|
41475
|
-
|
|
41476
|
-
|
|
41477
|
-
|
|
41478
|
-
|
|
41479
|
-
|
|
41480
|
-
|
|
41481
|
-
`;
|
|
41482
|
-
}
|
|
41483
|
-
if (isRequired) {
|
|
41484
|
-
return acc + formDataValue;
|
|
41485
|
-
}
|
|
41486
|
-
return acc + `if(${propName}${formatedKey} !== undefined) {
|
|
41487
|
-
${formDataValue} }
|
|
41488
|
-
`;
|
|
41489
|
-
},
|
|
41490
|
-
""
|
|
41491
|
-
);
|
|
41492
|
-
return `${form}${formDataValues}`;
|
|
41480
|
+
if (schema.type === "object") {
|
|
41481
|
+
if (schema.oneOf || schema.anyOf || schema.allOf) {
|
|
41482
|
+
const combinedSchemas = schema.oneOf || schema.anyOf || schema.allOf;
|
|
41483
|
+
const shouldCast = !!schema.oneOf || !!schema.anyOf;
|
|
41484
|
+
const combinedSchemasFormData = combinedSchemas.map((schema2) => {
|
|
41485
|
+
const { schema: combinedSchema, imports: imports2 } = resolveRef(
|
|
41486
|
+
schema2,
|
|
41487
|
+
context
|
|
41488
|
+
);
|
|
41489
|
+
return resolveSchemaPropertiesToFormData({
|
|
41490
|
+
schema: combinedSchema,
|
|
41491
|
+
variableName,
|
|
41492
|
+
propName: shouldCast ? `(${propName} as any)` : propName,
|
|
41493
|
+
context
|
|
41494
|
+
});
|
|
41495
|
+
}).filter((x3) => x3).join("\n");
|
|
41496
|
+
form += combinedSchemasFormData;
|
|
41497
|
+
}
|
|
41498
|
+
if (schema.properties) {
|
|
41499
|
+
const formDataValues = resolveSchemaPropertiesToFormData({
|
|
41500
|
+
schema,
|
|
41501
|
+
variableName,
|
|
41502
|
+
propName,
|
|
41503
|
+
context
|
|
41504
|
+
});
|
|
41505
|
+
form += formDataValues;
|
|
41506
|
+
}
|
|
41507
|
+
return form;
|
|
41493
41508
|
}
|
|
41494
41509
|
if (schema.type === "array") {
|
|
41495
41510
|
return `${form}${propName}.forEach(value => ${variableName}.append('data', value))
|
|
@@ -41502,6 +41517,53 @@ var getSchemaFormDataAndUrlEncoded = ({
|
|
|
41502
41517
|
return `${form}${variableName}.append('data', ${propName})
|
|
41503
41518
|
`;
|
|
41504
41519
|
};
|
|
41520
|
+
var resolveSchemaPropertiesToFormData = ({
|
|
41521
|
+
schema,
|
|
41522
|
+
variableName,
|
|
41523
|
+
propName,
|
|
41524
|
+
context
|
|
41525
|
+
}) => {
|
|
41526
|
+
const formDataValues = Object.entries(schema.properties ?? {}).reduce(
|
|
41527
|
+
(acc, [key, value]) => {
|
|
41528
|
+
const { schema: property } = resolveRef(value, context);
|
|
41529
|
+
let formDataValue = "";
|
|
41530
|
+
const formatedKey = !import_esutils3.keyword.isIdentifierNameES5(key) ? `['${key}']` : `.${key}`;
|
|
41531
|
+
const valueKey = `${propName}${formatedKey}`;
|
|
41532
|
+
if (property.type === "object") {
|
|
41533
|
+
formDataValue = `${variableName}.append('${key}', JSON.stringify(${valueKey}));
|
|
41534
|
+
`;
|
|
41535
|
+
} else if (property.type === "array") {
|
|
41536
|
+
formDataValue = `${valueKey}.forEach(value => ${variableName}.append('${key}', value));
|
|
41537
|
+
`;
|
|
41538
|
+
} else if (property.type === "number" || property.type === "integer" || property.type === "boolean") {
|
|
41539
|
+
formDataValue = `${variableName}.append('${key}', ${valueKey}.toString())
|
|
41540
|
+
`;
|
|
41541
|
+
} else {
|
|
41542
|
+
formDataValue = `${variableName}.append('${key}', ${valueKey})
|
|
41543
|
+
`;
|
|
41544
|
+
}
|
|
41545
|
+
const isRequired = schema.required?.includes(key);
|
|
41546
|
+
if (property.nullable) {
|
|
41547
|
+
if (isRequired) {
|
|
41548
|
+
return acc + `if(${valueKey} !== null) {
|
|
41549
|
+
${formDataValue} }
|
|
41550
|
+
`;
|
|
41551
|
+
}
|
|
41552
|
+
return acc + `if(${valueKey} !== undefined && ${valueKey} !== null) {
|
|
41553
|
+
${formDataValue} }
|
|
41554
|
+
`;
|
|
41555
|
+
}
|
|
41556
|
+
if (isRequired) {
|
|
41557
|
+
return acc + formDataValue;
|
|
41558
|
+
}
|
|
41559
|
+
return acc + `if(${valueKey} !== undefined) {
|
|
41560
|
+
${formDataValue} }
|
|
41561
|
+
`;
|
|
41562
|
+
},
|
|
41563
|
+
""
|
|
41564
|
+
);
|
|
41565
|
+
return formDataValues;
|
|
41566
|
+
};
|
|
41505
41567
|
|
|
41506
41568
|
// src/getters/body.ts
|
|
41507
41569
|
var getBody = ({
|
|
@@ -42063,7 +42125,8 @@ var getParams = ({
|
|
|
42063
42125
|
route,
|
|
42064
42126
|
pathParams = [],
|
|
42065
42127
|
operationId,
|
|
42066
|
-
context
|
|
42128
|
+
context,
|
|
42129
|
+
output
|
|
42067
42130
|
}) => {
|
|
42068
42131
|
const params = getParamsInPath(route);
|
|
42069
42132
|
return params.map((p2) => {
|
|
@@ -42104,8 +42167,12 @@ var getParams = ({
|
|
|
42104
42167
|
} : {}
|
|
42105
42168
|
}
|
|
42106
42169
|
});
|
|
42170
|
+
let paramType = resolvedValue.value;
|
|
42171
|
+
if (output.allParamsOptional) {
|
|
42172
|
+
paramType = `${paramType} | undefined | null`;
|
|
42173
|
+
}
|
|
42107
42174
|
const definition = `${name}${!required || resolvedValue.originalSchema.default ? "?" : ""}: ${resolvedValue.value}`;
|
|
42108
|
-
const implementation = `${name}${!required && !resolvedValue.originalSchema.default ? "?" : ""}${!resolvedValue.originalSchema.default ? `: ${
|
|
42175
|
+
const implementation = `${name}${!required && !resolvedValue.originalSchema.default ? "?" : ""}${!resolvedValue.originalSchema.default ? `: ${paramType}` : `: ${paramType} = ${stringify(resolvedValue.originalSchema.default)}`}`;
|
|
42109
42176
|
return {
|
|
42110
42177
|
name,
|
|
42111
42178
|
definition,
|
|
@@ -42160,7 +42227,7 @@ var getProps = ({
|
|
|
42160
42227
|
}`;
|
|
42161
42228
|
const isOptional = params.every((param) => param.default);
|
|
42162
42229
|
const implementation = `{ ${params.map(
|
|
42163
|
-
(property) => property.default ? property.
|
|
42230
|
+
(property) => property.default ? `${property.name} = ${property.default}` : property.name
|
|
42164
42231
|
).join(", ")} }: ${parameterTypeName}${isOptional ? " = {}" : ""}`;
|
|
42165
42232
|
const destructured = `{ ${params.map((property) => property.name).join(", ")} }`;
|
|
42166
42233
|
paramGetterProps = [
|
|
@@ -42862,6 +42929,7 @@ var generateAxiosOptions = ({
|
|
|
42862
42929
|
headers,
|
|
42863
42930
|
requestOptions,
|
|
42864
42931
|
hasSignal,
|
|
42932
|
+
isVue,
|
|
42865
42933
|
paramsSerializer,
|
|
42866
42934
|
paramsSerializerOptions
|
|
42867
42935
|
}) => {
|
|
@@ -42898,7 +42966,11 @@ var generateAxiosOptions = ({
|
|
|
42898
42966
|
if (isRequestOptions) {
|
|
42899
42967
|
value += "\n ...options,";
|
|
42900
42968
|
if (queryParams) {
|
|
42901
|
-
|
|
42969
|
+
if (isVue) {
|
|
42970
|
+
value += "\n params: {...unref(params), ...options?.params},";
|
|
42971
|
+
} else {
|
|
42972
|
+
value += "\n params: {...params, ...options?.params},";
|
|
42973
|
+
}
|
|
42902
42974
|
}
|
|
42903
42975
|
if (headers) {
|
|
42904
42976
|
value += "\n headers: {...headers, ...options?.headers},";
|
|
@@ -42930,6 +43002,7 @@ var generateOptions = ({
|
|
|
42930
43002
|
isAngular,
|
|
42931
43003
|
isExactOptionalPropertyTypes,
|
|
42932
43004
|
hasSignal,
|
|
43005
|
+
isVue,
|
|
42933
43006
|
paramsSerializer,
|
|
42934
43007
|
paramsSerializerOptions
|
|
42935
43008
|
}) => {
|
|
@@ -42942,6 +43015,7 @@ var generateOptions = ({
|
|
|
42942
43015
|
requestOptions,
|
|
42943
43016
|
isExactOptionalPropertyTypes,
|
|
42944
43017
|
hasSignal,
|
|
43018
|
+
isVue: isVue ?? false,
|
|
42945
43019
|
paramsSerializer,
|
|
42946
43020
|
paramsSerializerOptions
|
|
42947
43021
|
});
|
|
@@ -42973,13 +43047,17 @@ var generateBodyMutatorConfig = (body, isFormData, isFormUrlEncoded) => {
|
|
|
42973
43047
|
}
|
|
42974
43048
|
return "";
|
|
42975
43049
|
};
|
|
42976
|
-
var generateQueryParamsAxiosConfig = (response, queryParams) => {
|
|
43050
|
+
var generateQueryParamsAxiosConfig = (response, isVue, queryParams) => {
|
|
42977
43051
|
if (!queryParams && !response.isBlob) {
|
|
42978
43052
|
return "";
|
|
42979
43053
|
}
|
|
42980
43054
|
let value = "";
|
|
42981
43055
|
if (queryParams) {
|
|
42982
|
-
|
|
43056
|
+
if (isVue) {
|
|
43057
|
+
value += ",\n params: unref(params)";
|
|
43058
|
+
} else {
|
|
43059
|
+
value += ",\n params";
|
|
43060
|
+
}
|
|
42983
43061
|
}
|
|
42984
43062
|
if (response.isBlob) {
|
|
42985
43063
|
value += `,
|
|
@@ -42998,11 +43076,13 @@ var generateMutatorConfig = ({
|
|
|
42998
43076
|
isFormUrlEncoded,
|
|
42999
43077
|
isBodyVerb,
|
|
43000
43078
|
hasSignal,
|
|
43001
|
-
isExactOptionalPropertyTypes
|
|
43079
|
+
isExactOptionalPropertyTypes,
|
|
43080
|
+
isVue
|
|
43002
43081
|
}) => {
|
|
43003
43082
|
const bodyOptions = isBodyVerb ? generateBodyMutatorConfig(body, isFormData, isFormUrlEncoded) : "";
|
|
43004
43083
|
const queryParamsOptions = generateQueryParamsAxiosConfig(
|
|
43005
43084
|
response,
|
|
43085
|
+
isVue ?? false,
|
|
43006
43086
|
queryParams
|
|
43007
43087
|
);
|
|
43008
43088
|
const headerOptions = body.contentType ? `,
|
|
@@ -43283,7 +43363,8 @@ var generateVerbOptions = async ({
|
|
|
43283
43363
|
route,
|
|
43284
43364
|
pathParams: parameters.path,
|
|
43285
43365
|
operationId,
|
|
43286
|
-
context
|
|
43366
|
+
context,
|
|
43367
|
+
output
|
|
43287
43368
|
});
|
|
43288
43369
|
const props = getProps({
|
|
43289
43370
|
body,
|
|
@@ -43538,7 +43619,8 @@ var generateTarget = (builder, options) => {
|
|
|
43538
43619
|
const titles = builder.title({
|
|
43539
43620
|
outputClient: options.client,
|
|
43540
43621
|
title: pascal(builder.info.title),
|
|
43541
|
-
customTitleFunc: options.override.title
|
|
43622
|
+
customTitleFunc: options.override.title,
|
|
43623
|
+
output: options
|
|
43542
43624
|
});
|
|
43543
43625
|
const target = Object.values(builder.operations).reduce(
|
|
43544
43626
|
(acc, operation, index3, arr) => {
|
|
@@ -43575,7 +43657,8 @@ var generateTarget = (builder, options) => {
|
|
|
43575
43657
|
isGlobalMutator: !!options.override.mutator,
|
|
43576
43658
|
provideIn: options.override.angular.provideIn,
|
|
43577
43659
|
hasAwaitedType,
|
|
43578
|
-
titles
|
|
43660
|
+
titles,
|
|
43661
|
+
output: options
|
|
43579
43662
|
});
|
|
43580
43663
|
acc.implementation = header.implementation + acc.implementation;
|
|
43581
43664
|
acc.implementationMock.handler = header.implementationMock + acc.implementationMock.handler;
|
|
@@ -43584,7 +43667,8 @@ var generateTarget = (builder, options) => {
|
|
|
43584
43667
|
operationNames,
|
|
43585
43668
|
hasMutator: !!acc.mutators.length,
|
|
43586
43669
|
hasAwaitedType,
|
|
43587
|
-
titles
|
|
43670
|
+
titles,
|
|
43671
|
+
output: options
|
|
43588
43672
|
});
|
|
43589
43673
|
acc.implementation += footer.implementation;
|
|
43590
43674
|
acc.implementationMock.handler += footer.implementationMock;
|
|
@@ -43656,7 +43740,8 @@ var writeSingleMode = async ({
|
|
|
43656
43740
|
isAllowSyntheticDefaultImports,
|
|
43657
43741
|
hasGlobalMutator: !!output.override.mutator,
|
|
43658
43742
|
hasParamsSerializerOptions: !!output.override.paramsSerializerOptions,
|
|
43659
|
-
packageJson: output.packageJson
|
|
43743
|
+
packageJson: output.packageJson,
|
|
43744
|
+
output
|
|
43660
43745
|
});
|
|
43661
43746
|
if (output.mock) {
|
|
43662
43747
|
data += builder.importsMock({
|
|
@@ -43743,7 +43828,8 @@ var writeSplitMode = async ({
|
|
|
43743
43828
|
isAllowSyntheticDefaultImports,
|
|
43744
43829
|
hasGlobalMutator: !!output.override.mutator,
|
|
43745
43830
|
hasParamsSerializerOptions: !!output.override.paramsSerializerOptions,
|
|
43746
|
-
packageJson: output.packageJson
|
|
43831
|
+
packageJson: output.packageJson,
|
|
43832
|
+
output
|
|
43747
43833
|
});
|
|
43748
43834
|
mockData += builder.importsMock({
|
|
43749
43835
|
implementation: implementationMock,
|
|
@@ -43886,14 +43972,16 @@ var generateTargetForTags = (builder, options) => {
|
|
|
43886
43972
|
const titles = builder.title({
|
|
43887
43973
|
outputClient: options.client,
|
|
43888
43974
|
title: pascal(tag),
|
|
43889
|
-
customTitleFunc: options.override.title
|
|
43975
|
+
customTitleFunc: options.override.title,
|
|
43976
|
+
output: options
|
|
43890
43977
|
});
|
|
43891
43978
|
const footer = builder.footer({
|
|
43892
43979
|
outputClient: options?.client,
|
|
43893
43980
|
operationNames,
|
|
43894
43981
|
hasMutator: !!target.mutators?.length,
|
|
43895
43982
|
hasAwaitedType,
|
|
43896
|
-
titles
|
|
43983
|
+
titles,
|
|
43984
|
+
output: options
|
|
43897
43985
|
});
|
|
43898
43986
|
const header = builder.header({
|
|
43899
43987
|
outputClient: options.client,
|
|
@@ -43902,7 +43990,8 @@ var generateTargetForTags = (builder, options) => {
|
|
|
43902
43990
|
isGlobalMutator: !!options.override.mutator,
|
|
43903
43991
|
provideIn: options.override.angular.provideIn,
|
|
43904
43992
|
hasAwaitedType,
|
|
43905
|
-
titles
|
|
43993
|
+
titles,
|
|
43994
|
+
output: options
|
|
43906
43995
|
});
|
|
43907
43996
|
acc2[tag] = {
|
|
43908
43997
|
implementation: header.implementation + target.implementation + footer.implementation,
|
|
@@ -43976,7 +44065,8 @@ var writeSplitTagsMode = async ({
|
|
|
43976
44065
|
isAllowSyntheticDefaultImports,
|
|
43977
44066
|
hasGlobalMutator: !!output.override.mutator,
|
|
43978
44067
|
hasParamsSerializerOptions: !!output.override.paramsSerializerOptions,
|
|
43979
|
-
packageJson: output.packageJson
|
|
44068
|
+
packageJson: output.packageJson,
|
|
44069
|
+
output
|
|
43980
44070
|
});
|
|
43981
44071
|
mockData += builder.importsMock({
|
|
43982
44072
|
implementation: implementationMock,
|
|
@@ -44111,7 +44201,8 @@ var writeTagsMode = async ({
|
|
|
44111
44201
|
isAllowSyntheticDefaultImports,
|
|
44112
44202
|
hasGlobalMutator: !!output.override.mutator,
|
|
44113
44203
|
hasParamsSerializerOptions: !!output.override.paramsSerializerOptions,
|
|
44114
|
-
packageJson: output.packageJson
|
|
44204
|
+
packageJson: output.packageJson,
|
|
44205
|
+
output
|
|
44115
44206
|
});
|
|
44116
44207
|
if (output.mock) {
|
|
44117
44208
|
data += builder.importsMock({
|