@orval/angular 8.3.0 → 8.4.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.mjs +184 -57
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -3
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { generateFormDataAndUrlEncodedFunction, generateMutatorConfig, generateMutatorRequestOptions, generateOptions, generateVerbImports, getDefaultContentType, isBoolean, pascal, sanitize, toObjectString } from "@orval/core";
|
|
1
|
+
import { generateFormDataAndUrlEncodedFunction, generateMutatorConfig, generateMutatorRequestOptions, generateOptions, generateVerbImports, getAngularFilteredParamsCallExpression, getAngularFilteredParamsHelperBody, getDefaultContentType, isBoolean, pascal, sanitize, toObjectString } from "@orval/core";
|
|
2
2
|
|
|
3
3
|
//#region src/index.ts
|
|
4
4
|
const ANGULAR_DEPENDENCIES = [
|
|
@@ -8,7 +8,10 @@ const ANGULAR_DEPENDENCIES = [
|
|
|
8
8
|
name: "HttpClient",
|
|
9
9
|
values: true
|
|
10
10
|
},
|
|
11
|
-
{
|
|
11
|
+
{
|
|
12
|
+
name: "HttpHeaders",
|
|
13
|
+
values: true
|
|
14
|
+
},
|
|
12
15
|
{ name: "HttpParams" },
|
|
13
16
|
{ name: "HttpContext" },
|
|
14
17
|
{
|
|
@@ -35,37 +38,46 @@ const ANGULAR_DEPENDENCIES = [
|
|
|
35
38
|
values: true
|
|
36
39
|
}],
|
|
37
40
|
dependency: "rxjs"
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
exports: [{ name: "DeepNonNullable" }],
|
|
41
|
-
dependency: "@orval/core"
|
|
42
41
|
}
|
|
43
42
|
];
|
|
44
|
-
const
|
|
45
|
-
|
|
43
|
+
const PRIMITIVE_RESPONSE_TYPES = [
|
|
44
|
+
"string",
|
|
45
|
+
"number",
|
|
46
|
+
"boolean",
|
|
47
|
+
"void",
|
|
48
|
+
"unknown"
|
|
49
|
+
];
|
|
50
|
+
const isPrimitiveResponseType = (typeName) => typeName != void 0 && PRIMITIVE_RESPONSE_TYPES.includes(typeName);
|
|
51
|
+
const hasSchemaImport = (imports, typeName) => typeName != void 0 && imports.some((imp) => imp.name === typeName);
|
|
52
|
+
const getSchemaValueRef = (typeName) => typeName === "Error" ? "ErrorSchema" : typeName;
|
|
53
|
+
const getAngularDependencies = () => [...ANGULAR_DEPENDENCIES];
|
|
46
54
|
const generateAngularTitle = (title) => {
|
|
47
55
|
return `${pascal(sanitize(title))}Service`;
|
|
48
56
|
};
|
|
49
|
-
const
|
|
57
|
+
const createAngularHeader = () => ({ title, isRequestOptions, isMutator, isGlobalMutator, provideIn, verbOptions, tag }) => {
|
|
58
|
+
const hasQueryParams = (tag ? Object.values(verbOptions).filter((v) => v.tags.includes(tag)) : Object.values(verbOptions)).some((v) => v.queryParams);
|
|
59
|
+
return `
|
|
50
60
|
${isRequestOptions && !isGlobalMutator ? `interface HttpClientOptions {
|
|
51
|
-
headers?: HttpHeaders | Record<string, string | string[]>;
|
|
52
|
-
context?: HttpContext;
|
|
53
|
-
params?:
|
|
61
|
+
readonly headers?: HttpHeaders | Record<string, string | string[]>;
|
|
62
|
+
readonly context?: HttpContext;
|
|
63
|
+
readonly params?:
|
|
54
64
|
| HttpParams
|
|
55
|
-
|
|
56
|
-
reportProgress?: boolean;
|
|
57
|
-
withCredentials?: boolean;
|
|
58
|
-
credentials?: RequestCredentials;
|
|
59
|
-
keepalive?: boolean;
|
|
60
|
-
priority?: RequestPriority;
|
|
61
|
-
cache?: RequestCache;
|
|
62
|
-
mode?: RequestMode;
|
|
63
|
-
redirect?: RequestRedirect;
|
|
64
|
-
referrer?: string;
|
|
65
|
-
integrity?: string;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
65
|
+
| Record<string, string | number | boolean | Array<string | number | boolean>>;
|
|
66
|
+
readonly reportProgress?: boolean;
|
|
67
|
+
readonly withCredentials?: boolean;
|
|
68
|
+
readonly credentials?: RequestCredentials;
|
|
69
|
+
readonly keepalive?: boolean;
|
|
70
|
+
readonly priority?: RequestPriority;
|
|
71
|
+
readonly cache?: RequestCache;
|
|
72
|
+
readonly mode?: RequestMode;
|
|
73
|
+
readonly redirect?: RequestRedirect;
|
|
74
|
+
readonly referrer?: string;
|
|
75
|
+
readonly integrity?: string;
|
|
76
|
+
readonly referrerPolicy?: ReferrerPolicy;
|
|
77
|
+
readonly transferCache?: {includeHeaders?: string[]} | boolean;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
${hasQueryParams ? getAngularFilteredParamsHelperBody() : ""}` : ""}
|
|
69
81
|
|
|
70
82
|
${isRequestOptions && isMutator ? `// eslint-disable-next-line
|
|
71
83
|
type ThirdParameter<T extends (...args: any) => any> = T extends (
|
|
@@ -80,12 +92,16 @@ ${isRequestOptions && isMutator ? `// eslint-disable-next-line
|
|
|
80
92
|
export class ${title} {
|
|
81
93
|
private readonly http = inject(HttpClient);
|
|
82
94
|
`;
|
|
83
|
-
|
|
84
|
-
|
|
95
|
+
};
|
|
96
|
+
const generateAngularHeader = (params) => createAngularHeader()(params);
|
|
97
|
+
const standaloneFooterReturnTypesToWrite = /* @__PURE__ */ new Map();
|
|
98
|
+
const createAngularFooter = (returnTypesToWrite) => ({ operationNames }) => {
|
|
99
|
+
let footer = "}\n\n";
|
|
85
100
|
for (const operationName of operationNames) if (returnTypesToWrite.has(operationName)) footer += returnTypesToWrite.get(operationName) + "\n";
|
|
86
101
|
return footer;
|
|
87
102
|
};
|
|
88
|
-
const
|
|
103
|
+
const generateAngularFooter = (params) => createAngularFooter(standaloneFooterReturnTypesToWrite)(params);
|
|
104
|
+
const generateImplementation = (returnTypesToWrite, { headers, queryParams, operationName, response, mutator, body, props, verb, override, formData, formUrlEncoded, paramsSerializer }, { route, context }) => {
|
|
89
105
|
const isRequestOptions = override.requestOptions !== false;
|
|
90
106
|
const isFormData = !override.formData.disabled;
|
|
91
107
|
const isFormUrlEncoded = override.formUrlEncoded !== false;
|
|
@@ -98,6 +114,12 @@ const generateImplementation = ({ headers, queryParams, operationName, response,
|
|
|
98
114
|
isFormUrlEncoded
|
|
99
115
|
});
|
|
100
116
|
const dataType = response.definition.success || "unknown";
|
|
117
|
+
const isPrimitiveType = isPrimitiveResponseType(dataType);
|
|
118
|
+
const hasSchema = hasSchemaImport(response.imports, dataType);
|
|
119
|
+
const isZodOutput = typeof context.output.schemas === "object" && context.output.schemas.type === "zod";
|
|
120
|
+
const shouldValidateResponse = override.angular.runtimeValidation && isZodOutput && !isPrimitiveType && hasSchema;
|
|
121
|
+
const schemaValueRef = shouldValidateResponse ? getSchemaValueRef(dataType) : dataType;
|
|
122
|
+
const validationPipe = shouldValidateResponse ? `.pipe(map(data => ${schemaValueRef}.parse(data) as TData))` : "";
|
|
101
123
|
returnTypesToWrite.set(operationName, `export type ${pascal(operationName)}ClientResult = NonNullable<${dataType}>`);
|
|
102
124
|
if (mutator) {
|
|
103
125
|
const mutatorConfig = generateMutatorConfig({
|
|
@@ -110,7 +132,8 @@ const generateImplementation = ({ headers, queryParams, operationName, response,
|
|
|
110
132
|
isFormData,
|
|
111
133
|
isFormUrlEncoded,
|
|
112
134
|
hasSignal: false,
|
|
113
|
-
isExactOptionalPropertyTypes
|
|
135
|
+
isExactOptionalPropertyTypes,
|
|
136
|
+
isAngular: true
|
|
114
137
|
});
|
|
115
138
|
const requestOptions = isRequestOptions ? generateMutatorRequestOptions(override.requestOptions, mutator.hasThirdArg) : "";
|
|
116
139
|
return ` ${operationName}<TData = ${dataType}>(\n ${mutator.bodyTypeName && body.definition ? toObjectString(props, "implementation").replace(new RegExp(String.raw`(\w*):\s?${body.definition}`), `$1: ${mutator.bodyTypeName}<${body.definition}>`) : toObjectString(props, "implementation")}\n ${isRequestOptions && mutator.hasThirdArg ? `options?: ThirdParameter<typeof ${mutator.name}>` : ""}) {${bodyForm}
|
|
@@ -121,7 +144,7 @@ const generateImplementation = ({ headers, queryParams, operationName, response,
|
|
|
121
144
|
}
|
|
122
145
|
`;
|
|
123
146
|
}
|
|
124
|
-
const
|
|
147
|
+
const optionsBase = {
|
|
125
148
|
route,
|
|
126
149
|
body,
|
|
127
150
|
headers,
|
|
@@ -136,13 +159,54 @@ const generateImplementation = ({ headers, queryParams, operationName, response,
|
|
|
136
159
|
isAngular: true,
|
|
137
160
|
isExactOptionalPropertyTypes,
|
|
138
161
|
hasSignal: false
|
|
139
|
-
}
|
|
162
|
+
};
|
|
140
163
|
const propsDefinition = toObjectString(props, "definition");
|
|
141
164
|
const successTypes = response.types.success;
|
|
142
165
|
const uniqueContentTypes = [...new Set(successTypes.map((t) => t.contentType).filter(Boolean))];
|
|
143
166
|
const hasMultipleContentTypes = uniqueContentTypes.length > 1;
|
|
144
|
-
const
|
|
145
|
-
const
|
|
167
|
+
const needsObserveBranching = isRequestOptions && !hasMultipleContentTypes;
|
|
168
|
+
const angularParamsRef = needsObserveBranching && queryParams ? "filteredParams" : void 0;
|
|
169
|
+
let paramsDeclaration = "";
|
|
170
|
+
if (angularParamsRef && queryParams) {
|
|
171
|
+
const callExpr = getAngularFilteredParamsCallExpression("{...params, ...options?.params}", queryParams.requiredNullableKeys ?? []);
|
|
172
|
+
paramsDeclaration = paramsSerializer ? `const ${angularParamsRef} = ${paramsSerializer.name}(${callExpr});\n\n ` : `const ${angularParamsRef} = ${callExpr};\n\n `;
|
|
173
|
+
}
|
|
174
|
+
const optionsInput = {
|
|
175
|
+
...optionsBase,
|
|
176
|
+
...angularParamsRef ? { angularParamsRef } : {}
|
|
177
|
+
};
|
|
178
|
+
const options = generateOptions(optionsInput);
|
|
179
|
+
const defaultContentType = hasMultipleContentTypes ? uniqueContentTypes.includes("text/plain") ? "text/plain" : getDefaultContentType(uniqueContentTypes) : uniqueContentTypes[0] ?? "application/json";
|
|
180
|
+
const getContentTypeReturnType = (contentType, value) => {
|
|
181
|
+
if (!contentType) return value;
|
|
182
|
+
if (contentType.includes("json") || contentType.includes("+json")) return value;
|
|
183
|
+
if (contentType.startsWith("text/") || contentType.includes("xml")) return "string";
|
|
184
|
+
return "Blob";
|
|
185
|
+
};
|
|
186
|
+
const jsonSuccessValues = [...new Set(successTypes.filter(({ contentType }) => !!contentType && (contentType.includes("json") || contentType.includes("+json"))).map(({ value }) => value))];
|
|
187
|
+
const jsonReturnType = jsonSuccessValues.length > 0 ? jsonSuccessValues.join(" | ") : "unknown";
|
|
188
|
+
let jsonValidationPipe = shouldValidateResponse ? `.pipe(map(data => ${schemaValueRef}.parse(data)))` : "";
|
|
189
|
+
if (hasMultipleContentTypes && !shouldValidateResponse && override.angular.runtimeValidation && isZodOutput && jsonSuccessValues.length === 1) {
|
|
190
|
+
const jsonType = jsonSuccessValues[0];
|
|
191
|
+
const jsonIsPrimitive = isPrimitiveResponseType(jsonType);
|
|
192
|
+
const jsonHasSchema = hasSchemaImport(response.imports, jsonType);
|
|
193
|
+
if (!jsonIsPrimitive && jsonHasSchema) jsonValidationPipe = `.pipe(map(data => ${getSchemaValueRef(jsonType)}.parse(data)))`;
|
|
194
|
+
}
|
|
195
|
+
const multiImplementationReturnType = `Observable<${jsonReturnType} | string | Blob>`;
|
|
196
|
+
const observeOptions = needsObserveBranching ? {
|
|
197
|
+
body: generateOptions({
|
|
198
|
+
...optionsInput,
|
|
199
|
+
angularObserve: "body"
|
|
200
|
+
}),
|
|
201
|
+
events: generateOptions({
|
|
202
|
+
...optionsInput,
|
|
203
|
+
angularObserve: "events"
|
|
204
|
+
}),
|
|
205
|
+
response: generateOptions({
|
|
206
|
+
...optionsInput,
|
|
207
|
+
angularObserve: "response"
|
|
208
|
+
})
|
|
209
|
+
} : void 0;
|
|
146
210
|
const isModelType = dataType !== "Blob" && dataType !== "string";
|
|
147
211
|
let functionName = operationName;
|
|
148
212
|
if (isModelType && !hasMultipleContentTypes) functionName += `<TData = ${dataType}>`;
|
|
@@ -151,23 +215,26 @@ const generateImplementation = ({ headers, queryParams, operationName, response,
|
|
|
151
215
|
const requiredProps = props.filter((p) => p.required && !p.default);
|
|
152
216
|
const optionalProps = props.filter((p) => !p.required || p.default);
|
|
153
217
|
contentTypeOverloads = successTypes.filter((t) => t.contentType).map(({ contentType, value }) => {
|
|
218
|
+
const returnType = getContentTypeReturnType(contentType, value);
|
|
154
219
|
return `${operationName}(${[
|
|
155
220
|
requiredProps.map((p) => p.definition).join(",\n "),
|
|
156
221
|
`accept: '${contentType}'`,
|
|
157
222
|
optionalProps.map((p) => p.definition).join(",\n ")
|
|
158
|
-
].filter(Boolean).join(",\n ")}, options?: HttpClientOptions): Observable<${
|
|
223
|
+
].filter(Boolean).join(",\n ")}, options?: HttpClientOptions): Observable<${returnType}>;`;
|
|
159
224
|
}).join("\n ");
|
|
160
225
|
const allParams = [
|
|
161
226
|
requiredProps.map((p) => p.definition).join(",\n "),
|
|
162
227
|
"accept?: string",
|
|
163
228
|
optionalProps.map((p) => p.definition).join(",\n ")
|
|
164
229
|
].filter(Boolean).join(",\n ");
|
|
165
|
-
contentTypeOverloads += `\n ${operationName}(${allParams}, options?: HttpClientOptions):
|
|
230
|
+
contentTypeOverloads += `\n ${operationName}(${allParams}, options?: HttpClientOptions): ${multiImplementationReturnType};`;
|
|
166
231
|
}
|
|
167
232
|
const observeOverloads = isRequestOptions && !hasMultipleContentTypes ? `${functionName}(${propsDefinition} options?: HttpClientOptions & { observe?: 'body' }): Observable<${isModelType ? "TData" : dataType}>;
|
|
168
233
|
${functionName}(${propsDefinition} options?: HttpClientOptions & { observe: 'events' }): Observable<HttpEvent<${isModelType ? "TData" : dataType}>>;
|
|
169
234
|
${functionName}(${propsDefinition} options?: HttpClientOptions & { observe: 'response' }): Observable<AngularHttpResponse<${isModelType ? "TData" : dataType}>>;` : "";
|
|
170
235
|
const overloads = contentTypeOverloads || observeOverloads;
|
|
236
|
+
const observableDataType = isModelType ? "TData" : dataType;
|
|
237
|
+
const singleImplementationReturnType = isRequestOptions ? `Observable<${observableDataType} | HttpEvent<${observableDataType}> | AngularHttpResponse<${observableDataType}>>` : `Observable<${observableDataType}>`;
|
|
171
238
|
if (hasMultipleContentTypes) {
|
|
172
239
|
const requiredProps = props.filter((p) => p.required && !p.default);
|
|
173
240
|
const optionalProps = props.filter((p) => !p.required || p.default);
|
|
@@ -181,51 +248,111 @@ const generateImplementation = ({ headers, queryParams, operationName, response,
|
|
|
181
248
|
optionalPart
|
|
182
249
|
].filter(Boolean).join(",\n ")},
|
|
183
250
|
${isRequestOptions ? "options?: HttpClientOptions" : ""}
|
|
184
|
-
):
|
|
251
|
+
): ${multiImplementationReturnType} {${bodyForm}
|
|
252
|
+
const headers = options?.headers instanceof HttpHeaders
|
|
253
|
+
? options.headers.set('Accept', accept)
|
|
254
|
+
: { ...(options?.headers ?? {}), Accept: accept };
|
|
255
|
+
|
|
185
256
|
if (accept.includes('json') || accept.includes('+json')) {
|
|
186
|
-
return this.http.${verb}
|
|
257
|
+
return this.http.${verb}<${jsonReturnType}>(\`${route}\`, {
|
|
187
258
|
...options,
|
|
188
259
|
responseType: 'json',
|
|
189
|
-
headers
|
|
190
|
-
});
|
|
260
|
+
headers,
|
|
261
|
+
})${jsonValidationPipe};
|
|
191
262
|
} else if (accept.startsWith('text/') || accept.includes('xml')) {
|
|
192
263
|
return this.http.${verb}(\`${route}\`, {
|
|
193
264
|
...options,
|
|
194
265
|
responseType: 'text',
|
|
195
|
-
headers
|
|
196
|
-
}) as
|
|
266
|
+
headers,
|
|
267
|
+
}) as Observable<string>;
|
|
197
268
|
} else {
|
|
198
269
|
return this.http.${verb}(\`${route}\`, {
|
|
199
270
|
...options,
|
|
200
271
|
responseType: 'blob',
|
|
201
|
-
headers
|
|
202
|
-
}) as
|
|
272
|
+
headers,
|
|
273
|
+
}) as Observable<Blob>;
|
|
203
274
|
}
|
|
204
275
|
}
|
|
205
276
|
`;
|
|
206
277
|
}
|
|
278
|
+
const observeImplementation = isRequestOptions ? `${paramsDeclaration}if (options?.observe === 'events') {
|
|
279
|
+
return this.http.${verb}${isModelType ? "<TData>" : ""}(${observeOptions?.events ?? options});
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
if (options?.observe === 'response') {
|
|
283
|
+
return this.http.${verb}${isModelType ? "<TData>" : ""}(${observeOptions?.response ?? options});
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
return this.http.${verb}${isModelType ? "<TData>" : ""}(${observeOptions?.body ?? options})${validationPipe};` : `return this.http.${verb}${isModelType ? "<TData>" : ""}(${options})${validationPipe};`;
|
|
207
287
|
return ` ${overloads}
|
|
208
288
|
${functionName}(
|
|
209
|
-
${toObjectString(props, "implementation")} ${isRequestOptions ? `options?: HttpClientOptions & { observe?:
|
|
210
|
-
|
|
289
|
+
${toObjectString(props, "implementation")} ${isRequestOptions ? `options?: HttpClientOptions & { observe?: 'body' | 'events' | 'response' }` : ""}): ${singleImplementationReturnType} {${bodyForm}
|
|
290
|
+
${observeImplementation}
|
|
211
291
|
}
|
|
212
292
|
`;
|
|
213
293
|
};
|
|
214
|
-
const
|
|
215
|
-
const
|
|
294
|
+
const createAngularClient = (returnTypesToWrite) => (verbOptions, options, _outputClient, _output) => {
|
|
295
|
+
const isZodOutput = typeof options.context.output.schemas === "object" && options.context.output.schemas.type === "zod";
|
|
296
|
+
const responseType = verbOptions.response.definition.success;
|
|
297
|
+
const isPrimitiveResponse = isPrimitiveResponseType(responseType);
|
|
298
|
+
const shouldUseRuntimeValidation = verbOptions.override.angular.runtimeValidation && isZodOutput;
|
|
299
|
+
const normalizedVerbOptions = (() => {
|
|
300
|
+
if (!shouldUseRuntimeValidation) return verbOptions;
|
|
301
|
+
let result = verbOptions;
|
|
302
|
+
if (!isPrimitiveResponse && hasSchemaImport(result.response.imports, responseType)) result = {
|
|
303
|
+
...result,
|
|
304
|
+
response: {
|
|
305
|
+
...result.response,
|
|
306
|
+
imports: result.response.imports.map((imp) => imp.name === responseType ? {
|
|
307
|
+
...imp,
|
|
308
|
+
values: true
|
|
309
|
+
} : imp)
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
const successTypes = result.response.types.success;
|
|
313
|
+
if ([...new Set(successTypes.map((t) => t.contentType).filter(Boolean))].length > 1) {
|
|
314
|
+
const jsonSchemaNames = [...new Set(successTypes.filter(({ contentType }) => !!contentType && (contentType.includes("json") || contentType.includes("+json"))).map(({ value }) => value))];
|
|
315
|
+
if (jsonSchemaNames.length === 1) {
|
|
316
|
+
const jsonType = jsonSchemaNames[0];
|
|
317
|
+
if (!isPrimitiveResponseType(jsonType) && hasSchemaImport(result.response.imports, jsonType)) result = {
|
|
318
|
+
...result,
|
|
319
|
+
response: {
|
|
320
|
+
...result.response,
|
|
321
|
+
imports: result.response.imports.map((imp) => imp.name === jsonType ? {
|
|
322
|
+
...imp,
|
|
323
|
+
values: true
|
|
324
|
+
} : imp)
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
return result;
|
|
330
|
+
})();
|
|
331
|
+
const implementation = generateImplementation(returnTypesToWrite, normalizedVerbOptions, options);
|
|
332
|
+
return {
|
|
333
|
+
implementation,
|
|
334
|
+
imports: [...generateVerbImports(normalizedVerbOptions), ...implementation.includes(".pipe(map(") ? [{
|
|
335
|
+
name: "map",
|
|
336
|
+
values: true,
|
|
337
|
+
importPath: "rxjs"
|
|
338
|
+
}] : []]
|
|
339
|
+
};
|
|
340
|
+
};
|
|
341
|
+
const standaloneReturnTypesToWrite = /* @__PURE__ */ new Map();
|
|
342
|
+
const generateAngular = (verbOptions, options, outputClient, output) => createAngularClient(standaloneReturnTypesToWrite)(verbOptions, options, outputClient, output);
|
|
343
|
+
const createAngularClientBuilder = () => {
|
|
344
|
+
const returnTypesToWrite = /* @__PURE__ */ new Map();
|
|
216
345
|
return {
|
|
217
|
-
|
|
218
|
-
|
|
346
|
+
client: createAngularClient(returnTypesToWrite),
|
|
347
|
+
header: createAngularHeader(),
|
|
348
|
+
dependencies: getAngularDependencies,
|
|
349
|
+
footer: createAngularFooter(returnTypesToWrite),
|
|
350
|
+
title: generateAngularTitle
|
|
219
351
|
};
|
|
220
352
|
};
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
header: generateAngularHeader,
|
|
224
|
-
dependencies: getAngularDependencies,
|
|
225
|
-
footer: generateAngularFooter,
|
|
226
|
-
title: generateAngularTitle
|
|
353
|
+
const builder = () => {
|
|
354
|
+
return () => createAngularClientBuilder();
|
|
227
355
|
};
|
|
228
|
-
const builder = () => () => angularClientBuilder;
|
|
229
356
|
var src_default = builder;
|
|
230
357
|
|
|
231
358
|
//#endregion
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["ANGULAR_DEPENDENCIES: GeneratorDependency[]","getAngularDependencies: ClientDependenciesBuilder","generateAngularTitle: ClientTitleBuilder","generateAngularHeader: ClientHeaderBuilder","generateAngularFooter: ClientFooterBuilder","generateAngular: ClientBuilder","angularClientBuilder: ClientGeneratorsBuilder"],"sources":["../src/index.ts"],"sourcesContent":["import {\n type ClientBuilder,\n type ClientDependenciesBuilder,\n type ClientFooterBuilder,\n type ClientGeneratorsBuilder,\n type ClientHeaderBuilder,\n type ClientTitleBuilder,\n generateFormDataAndUrlEncodedFunction,\n generateMutatorConfig,\n generateMutatorRequestOptions,\n generateOptions,\n generateVerbImports,\n type GeneratorDependency,\n type GeneratorOptions,\n type GeneratorVerbOptions,\n getDefaultContentType,\n isBoolean,\n pascal,\n sanitize,\n toObjectString,\n} from '@orval/core';\n\nconst ANGULAR_DEPENDENCIES: GeneratorDependency[] = [\n {\n exports: [\n { name: 'HttpClient', values: true },\n { name: 'HttpHeaders' },\n { name: 'HttpParams' },\n { name: 'HttpContext' },\n { name: 'HttpResponse', alias: 'AngularHttpResponse' }, // alias to prevent naming conflict with msw\n { name: 'HttpEvent' },\n ],\n dependency: '@angular/common/http',\n },\n {\n exports: [\n { name: 'Injectable', values: true },\n { name: 'inject', values: true },\n ],\n dependency: '@angular/core',\n },\n {\n exports: [{ name: 'Observable', values: true }],\n dependency: 'rxjs',\n },\n {\n exports: [{ name: 'DeepNonNullable' }],\n dependency: '@orval/core',\n },\n];\n\nconst returnTypesToWrite = new Map<string, string>();\n\nexport const getAngularDependencies: ClientDependenciesBuilder = () =>\n ANGULAR_DEPENDENCIES;\n\nexport const generateAngularTitle: ClientTitleBuilder = (title) => {\n const sanTitle = sanitize(title);\n return `${pascal(sanTitle)}Service`;\n};\n\nexport const generateAngularHeader: ClientHeaderBuilder = ({\n title,\n isRequestOptions,\n isMutator,\n isGlobalMutator,\n provideIn,\n}) => `\n${\n isRequestOptions && !isGlobalMutator\n ? `interface HttpClientOptions {\n headers?: HttpHeaders | Record<string, string | string[]>;\n context?: HttpContext;\n params?:\n | HttpParams\n | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;\n reportProgress?: boolean;\n withCredentials?: boolean;\n credentials?: RequestCredentials;\n keepalive?: boolean;\n priority?: RequestPriority;\n cache?: RequestCache;\n mode?: RequestMode;\n redirect?: RequestRedirect;\n referrer?: string;\n integrity?: string;\n transferCache?: {includeHeaders?: string[]} | boolean;\n timeout?: number;\n}`\n : ''\n}\n\n${\n isRequestOptions && isMutator\n ? `// eslint-disable-next-line\n type ThirdParameter<T extends (...args: any) => any> = T extends (\n config: any,\n httpClient: any,\n args: infer P,\n) => any\n ? P\n : never;`\n : ''\n}\n\n@Injectable(${\n provideIn\n ? `{ providedIn: '${isBoolean(provideIn) ? 'root' : provideIn}' }`\n : ''\n})\nexport class ${title} {\n private readonly http = inject(HttpClient);\n`;\n\nexport const generateAngularFooter: ClientFooterBuilder = ({\n operationNames,\n}) => {\n let footer = '};\\n\\n';\n\n for (const operationName of operationNames) {\n if (returnTypesToWrite.has(operationName)) {\n // Map.has ensures Map.get will not return undefined, but TS still complains\n // bug https://github.com/microsoft/TypeScript/issues/13086\n // eslint-disable-next-line @typescript-eslint/restrict-plus-operands\n footer += returnTypesToWrite.get(operationName) + '\\n';\n }\n }\n\n return footer;\n};\n\nconst generateImplementation = (\n {\n headers,\n queryParams,\n operationName,\n response,\n mutator,\n body,\n props,\n verb,\n override,\n formData,\n formUrlEncoded,\n paramsSerializer,\n }: GeneratorVerbOptions,\n { route, context }: GeneratorOptions,\n) => {\n const isRequestOptions = override.requestOptions !== false;\n const isFormData = !override.formData.disabled;\n const isFormUrlEncoded = override.formUrlEncoded !== false;\n const isExactOptionalPropertyTypes =\n !!context.output.tsconfig?.compilerOptions?.exactOptionalPropertyTypes;\n const bodyForm = generateFormDataAndUrlEncodedFunction({\n formData,\n formUrlEncoded,\n body,\n isFormData,\n isFormUrlEncoded,\n });\n\n const dataType = response.definition.success || 'unknown';\n\n returnTypesToWrite.set(\n operationName,\n `export type ${pascal(\n operationName,\n )}ClientResult = NonNullable<${dataType}>`,\n );\n\n if (mutator) {\n const mutatorConfig = generateMutatorConfig({\n route,\n body,\n headers,\n queryParams,\n response,\n verb,\n isFormData,\n isFormUrlEncoded,\n hasSignal: false,\n isExactOptionalPropertyTypes,\n });\n\n const requestOptions = isRequestOptions\n ? generateMutatorRequestOptions(\n override.requestOptions,\n mutator.hasThirdArg,\n )\n : '';\n\n const propsImplementation =\n mutator.bodyTypeName && body.definition\n ? toObjectString(props, 'implementation').replace(\n new RegExp(String.raw`(\\w*):\\s?${body.definition}`),\n `$1: ${mutator.bodyTypeName}<${body.definition}>`,\n )\n : toObjectString(props, 'implementation');\n\n return ` ${operationName}<TData = ${dataType}>(\\n ${propsImplementation}\\n ${\n isRequestOptions && mutator.hasThirdArg\n ? `options?: ThirdParameter<typeof ${mutator.name}>`\n : ''\n }) {${bodyForm}\n return ${mutator.name}<TData>(\n ${mutatorConfig},\n this.http,\n ${requestOptions});\n }\n `;\n }\n\n const options = generateOptions({\n route,\n body,\n headers,\n queryParams,\n response,\n verb,\n requestOptions: override.requestOptions,\n isFormData,\n isFormUrlEncoded,\n paramsSerializer,\n paramsSerializerOptions: override.paramsSerializerOptions,\n isAngular: true,\n isExactOptionalPropertyTypes,\n hasSignal: false,\n });\n\n const propsDefinition = toObjectString(props, 'definition');\n\n // Check for multiple content types in success responses\n const successTypes = response.types.success;\n const uniqueContentTypes = [\n ...new Set(successTypes.map((t) => t.contentType).filter(Boolean)),\n ];\n const hasMultipleContentTypes = uniqueContentTypes.length > 1;\n\n // For multiple content types, determine the default\n const defaultContentType = hasMultipleContentTypes\n ? getDefaultContentType(uniqueContentTypes)\n : (uniqueContentTypes[0] ?? 'application/json');\n const defaultType = hasMultipleContentTypes\n ? successTypes.find((t) => t.contentType === defaultContentType)\n : undefined;\n const defaultReturnType = defaultType?.value ?? dataType;\n\n const isModelType = dataType !== 'Blob' && dataType !== 'string';\n let functionName = operationName;\n if (isModelType && !hasMultipleContentTypes) {\n functionName += `<TData = ${dataType}>`;\n }\n\n let contentTypeOverloads = '';\n if (hasMultipleContentTypes && isRequestOptions) {\n const requiredProps = props.filter((p) => p.required && !p.default);\n const optionalProps = props.filter((p) => !p.required || p.default);\n\n contentTypeOverloads = successTypes\n .filter((t) => t.contentType)\n .map(({ contentType, value }) => {\n const requiredPart = requiredProps\n .map((p) => p.definition)\n .join(',\\n ');\n const acceptPart = `accept: '${contentType}'`;\n const optionalPart = optionalProps\n .map((p) => p.definition)\n .join(',\\n ');\n\n const allParams = [requiredPart, acceptPart, optionalPart]\n .filter(Boolean)\n .join(',\\n ');\n return `${operationName}(${allParams}, options?: HttpClientOptions): Observable<${value}>;`;\n })\n .join('\\n ');\n\n const requiredPart = requiredProps.map((p) => p.definition).join(',\\n ');\n const optionalPart = optionalProps.map((p) => p.definition).join(',\\n ');\n const allParams = [requiredPart, 'accept?: string', optionalPart]\n .filter(Boolean)\n .join(',\\n ');\n contentTypeOverloads += `\\n ${operationName}(${allParams}, options?: HttpClientOptions): Observable<${defaultReturnType}>;`;\n }\n\n const observeOverloads =\n isRequestOptions && !hasMultipleContentTypes\n ? `${functionName}(${propsDefinition} options?: HttpClientOptions & { observe?: 'body' }): Observable<${isModelType ? 'TData' : dataType}>;\n ${functionName}(${propsDefinition} options?: HttpClientOptions & { observe: 'events' }): Observable<HttpEvent<${isModelType ? 'TData' : dataType}>>;\n ${functionName}(${propsDefinition} options?: HttpClientOptions & { observe: 'response' }): Observable<AngularHttpResponse<${isModelType ? 'TData' : dataType}>>;`\n : '';\n\n const overloads = contentTypeOverloads || observeOverloads;\n\n if (hasMultipleContentTypes) {\n const requiredProps = props.filter((p) => p.required && !p.default);\n const optionalProps = props.filter((p) => !p.required || p.default);\n\n const requiredPart = requiredProps\n .map((p) => p.implementation)\n .join(',\\n ');\n const optionalPart = optionalProps\n .map((p) => p.implementation)\n .join(',\\n ');\n const allParams = [\n requiredPart,\n `accept: string = '${defaultContentType}'`,\n optionalPart,\n ]\n .filter(Boolean)\n .join(',\\n ');\n\n return ` ${overloads}\n ${operationName}(\n ${allParams},\n ${isRequestOptions ? 'options?: HttpClientOptions' : ''}\n ): Observable<any> {${bodyForm}\n if (accept.includes('json') || accept.includes('+json')) {\n return this.http.${verb}<any>(\\`${route}\\`, {\n ...options,\n responseType: 'json',\n headers: { Accept: accept, ...options?.headers },\n });\n } else if (accept.startsWith('text/') || accept.includes('xml')) {\n return this.http.${verb}(\\`${route}\\`, {\n ...options,\n responseType: 'text',\n headers: { Accept: accept, ...options?.headers },\n }) as any;\n } else {\n return this.http.${verb}(\\`${route}\\`, {\n ...options,\n responseType: 'blob',\n headers: { Accept: accept, ...options?.headers },\n }) as any;\n }\n }\n`;\n }\n\n return ` ${overloads}\n ${functionName}(\n ${toObjectString(props, 'implementation')} ${\n isRequestOptions ? `options?: HttpClientOptions & { observe?: any }` : ''\n }): Observable<any> {${bodyForm}\n return this.http.${verb}${isModelType ? '<TData>' : ''}(${options});\n }\n`;\n};\n\nexport const generateAngular: ClientBuilder = (verbOptions, options) => {\n const imports = generateVerbImports(verbOptions);\n const implementation = generateImplementation(verbOptions, options);\n\n return { implementation, imports };\n};\n\nconst angularClientBuilder: ClientGeneratorsBuilder = {\n client: generateAngular,\n header: generateAngularHeader,\n dependencies: getAngularDependencies,\n footer: generateAngularFooter,\n title: generateAngularTitle,\n};\n\nexport const builder = () => () => angularClientBuilder;\n\nexport default builder;\n"],"mappings":";;;AAsBA,MAAMA,uBAA8C;CAClD;EACE,SAAS;GACP;IAAE,MAAM;IAAc,QAAQ;IAAM;GACpC,EAAE,MAAM,eAAe;GACvB,EAAE,MAAM,cAAc;GACtB,EAAE,MAAM,eAAe;GACvB;IAAE,MAAM;IAAgB,OAAO;IAAuB;GACtD,EAAE,MAAM,aAAa;GACtB;EACD,YAAY;EACb;CACD;EACE,SAAS,CACP;GAAE,MAAM;GAAc,QAAQ;GAAM,EACpC;GAAE,MAAM;GAAU,QAAQ;GAAM,CACjC;EACD,YAAY;EACb;CACD;EACE,SAAS,CAAC;GAAE,MAAM;GAAc,QAAQ;GAAM,CAAC;EAC/C,YAAY;EACb;CACD;EACE,SAAS,CAAC,EAAE,MAAM,mBAAmB,CAAC;EACtC,YAAY;EACb;CACF;AAED,MAAM,qCAAqB,IAAI,KAAqB;AAEpD,MAAaC,+BACX;AAEF,MAAaC,wBAA4C,UAAU;AAEjE,QAAO,GAAG,OADO,SAAS,MAAM,CACN,CAAC;;AAG7B,MAAaC,yBAA8C,EACzD,OACA,kBACA,WACA,iBACA,gBACI;EAEJ,oBAAoB,CAAC,kBACjB;;;;;;;;;;;;;;;;;;KAmBA,GACL;;EAGC,oBAAoB,YAChB;;;;;;;cAQA,GACL;;cAGC,YACI,kBAAkB,UAAU,UAAU,GAAG,SAAS,UAAU,OAC5D,GACL;eACc,MAAM;;;AAIrB,MAAaC,yBAA8C,EACzD,qBACI;CACJ,IAAI,SAAS;AAEb,MAAK,MAAM,iBAAiB,eAC1B,KAAI,mBAAmB,IAAI,cAAc,CAIvC,WAAU,mBAAmB,IAAI,cAAc,GAAG;AAItD,QAAO;;AAGT,MAAM,0BACJ,EACE,SACA,aACA,eACA,UACA,SACA,MACA,OACA,MACA,UACA,UACA,gBACA,oBAEF,EAAE,OAAO,cACN;CACH,MAAM,mBAAmB,S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EAC3B,MAAM,gBAAgB,MAAM,QAAQ,MAAM,EAAE,YAAY,CAAC,EAAE,QAAQ;EACnE,MAAM,gBAAgB,MAAM,QAAQ,MAAM,CAAC,EAAE,YAAY,EAAE,QAAQ;EAEnE,MAAM,eAAe,cAClB,KAAK,MAAM,EAAE,eAAe,CAC5B,KAAK,UAAU;EAClB,MAAM,eAAe,cAClB,KAAK,MAAM,EAAE,eAAe,CAC5B,KAAK,UAAU;AASlB,SAAO,IAAI,UAAU;IACrB,cAAc;MATI;GAChB;GACA,qBAAqB,mBAAmB;GACxC;GACD,CACE,OAAO,QAAQ,CACf,KAAK,UAAU,CAIN;MACV,mBAAmB,gCAAgC,GAAG;wBACpC,SAAS;;yBAER,KAAK,UAAU,MAAM;;;;;;yBAMrB,KAAK,KAAK,MAAM;;;;;;yBAMhB,KAAK,KAAK,MAAM;;;;;;;;;AAUvC,QAAO,IAAI,UAAU;IACnB,aAAa;MACX,eAAe,OAAO,iBAAiB,CAAC,GACxC,mBAAmB,oDAAoD,GACxE,sBAAsB,SAAS;uBACb,OAAO,cAAc,YAAY,GAAG,GAAG,QAAQ;;;;AAKtE,MAAaC,mBAAkC,aAAa,YAAY;CACtE,MAAM,UAAU,oBAAoB,YAAY;AAGhD,QAAO;EAAE,gBAFc,uBAAuB,aAAa,QAAQ;EAE1C;EAAS;;AAGpC,MAAMC,uBAAgD;CACpD,QAAQ;CACR,QAAQ;CACR,cAAc;CACd,QAAQ;CACR,OAAO;CACR;AAED,MAAa,sBAAsB;AAEnC,kBAAe"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["getAngularDependencies: ClientDependenciesBuilder","generateAngularTitle: ClientTitleBuilder","generateAngularHeader: ClientHeaderBuilder","generateAngularFooter: ClientFooterBuilder","generateAngular: ClientBuilder","builder: () => () => ClientGeneratorsBuilder"],"sources":["../src/index.ts"],"sourcesContent":["import {\n type ClientBuilder,\n type ClientDependenciesBuilder,\n type ClientFooterBuilder,\n type ClientGeneratorsBuilder,\n type ClientHeaderBuilder,\n type ClientTitleBuilder,\n generateFormDataAndUrlEncodedFunction,\n generateMutatorConfig,\n generateMutatorRequestOptions,\n generateOptions,\n generateVerbImports,\n type GeneratorDependency,\n type GeneratorOptions,\n type GeneratorVerbOptions,\n getAngularFilteredParamsCallExpression,\n getAngularFilteredParamsHelperBody,\n getDefaultContentType,\n isBoolean,\n pascal,\n sanitize,\n toObjectString,\n} from '@orval/core';\n\nconst ANGULAR_DEPENDENCIES = [\n {\n exports: [\n { name: 'HttpClient', values: true },\n { name: 'HttpHeaders', values: true },\n { name: 'HttpParams' },\n { name: 'HttpContext' },\n { name: 'HttpResponse', alias: 'AngularHttpResponse' }, // alias to prevent naming conflict with msw\n { name: 'HttpEvent' },\n ],\n dependency: '@angular/common/http',\n },\n {\n exports: [\n { name: 'Injectable', values: true },\n { name: 'inject', values: true },\n ],\n dependency: '@angular/core',\n },\n {\n exports: [{ name: 'Observable', values: true }],\n dependency: 'rxjs',\n },\n] as const satisfies readonly GeneratorDependency[];\n\nconst PRIMITIVE_RESPONSE_TYPES = [\n 'string',\n 'number',\n 'boolean',\n 'void',\n 'unknown',\n] as const;\n\nconst isPrimitiveResponseType = (typeName: string | undefined): boolean =>\n typeName != undefined &&\n (PRIMITIVE_RESPONSE_TYPES as readonly string[]).includes(typeName);\n\nconst hasSchemaImport = (\n imports: readonly { name: string }[],\n typeName: string | undefined,\n): boolean =>\n typeName != undefined && imports.some((imp) => imp.name === typeName);\n\nconst getSchemaValueRef = (typeName: string): string =>\n typeName === 'Error' ? 'ErrorSchema' : typeName;\n\ntype ReturnTypesToWrite = Map<string, string>;\n\nexport const getAngularDependencies: ClientDependenciesBuilder = () => [\n ...ANGULAR_DEPENDENCIES,\n];\n\nexport const generateAngularTitle: ClientTitleBuilder = (title) => {\n const sanTitle = sanitize(title);\n return `${pascal(sanTitle)}Service`;\n};\n\nconst createAngularHeader =\n (): ClientHeaderBuilder =>\n ({\n title,\n isRequestOptions,\n isMutator,\n isGlobalMutator,\n provideIn,\n verbOptions,\n tag,\n }) => {\n const relevantVerbs = tag\n ? Object.values(verbOptions).filter((v) => v.tags.includes(tag as string))\n : Object.values(verbOptions);\n const hasQueryParams = relevantVerbs.some((v) => v.queryParams);\n return `\n${\n isRequestOptions && !isGlobalMutator\n ? `interface HttpClientOptions {\n readonly headers?: HttpHeaders | Record<string, string | string[]>;\n readonly context?: HttpContext;\n readonly params?:\n | HttpParams\n | Record<string, string | number | boolean | Array<string | number | boolean>>;\n readonly reportProgress?: boolean;\n readonly withCredentials?: boolean;\n readonly credentials?: RequestCredentials;\n readonly keepalive?: boolean;\n readonly priority?: RequestPriority;\n readonly cache?: RequestCache;\n readonly mode?: RequestMode;\n readonly redirect?: RequestRedirect;\n readonly referrer?: string;\n readonly integrity?: string;\n readonly referrerPolicy?: ReferrerPolicy;\n readonly transferCache?: {includeHeaders?: string[]} | boolean;\n}\n\n${hasQueryParams ? getAngularFilteredParamsHelperBody() : ''}`\n : ''\n}\n\n${\n isRequestOptions && isMutator\n ? `// eslint-disable-next-line\n type ThirdParameter<T extends (...args: any) => any> = T extends (\n config: any,\n httpClient: any,\n args: infer P,\n) => any\n ? P\n : never;`\n : ''\n}\n\n@Injectable(${provideIn ? `{ providedIn: '${isBoolean(provideIn) ? 'root' : provideIn}' }` : ''})\nexport class ${title} {\n private readonly http = inject(HttpClient);\n`;\n };\n\nexport const generateAngularHeader: ClientHeaderBuilder = (params) =>\n createAngularHeader()(params);\n\nconst standaloneFooterReturnTypesToWrite = new Map<string, string>();\n\nconst createAngularFooter =\n (returnTypesToWrite: ReturnTypesToWrite): ClientFooterBuilder =>\n ({ operationNames }) => {\n let footer = '}\\n\\n';\n\n for (const operationName of operationNames) {\n if (returnTypesToWrite.has(operationName)) {\n // Map.has ensures Map.get will not return undefined, but TS still complains\n // bug https://github.com/microsoft/TypeScript/issues/13086\n // eslint-disable-next-line @typescript-eslint/restrict-plus-operands\n footer += returnTypesToWrite.get(operationName) + '\\n';\n }\n }\n\n return footer;\n };\n\nexport const generateAngularFooter: ClientFooterBuilder = (params) =>\n createAngularFooter(standaloneFooterReturnTypesToWrite)(params);\n\nconst generateImplementation = (\n returnTypesToWrite: ReturnTypesToWrite,\n {\n headers,\n queryParams,\n operationName,\n response,\n mutator,\n body,\n props,\n verb,\n override,\n formData,\n formUrlEncoded,\n paramsSerializer,\n }: GeneratorVerbOptions,\n { route, context }: GeneratorOptions,\n) => {\n const isRequestOptions = override.requestOptions !== false;\n const isFormData = !override.formData.disabled;\n const isFormUrlEncoded = override.formUrlEncoded !== false;\n const isExactOptionalPropertyTypes =\n !!context.output.tsconfig?.compilerOptions?.exactOptionalPropertyTypes;\n const bodyForm = generateFormDataAndUrlEncodedFunction({\n formData,\n formUrlEncoded,\n body,\n isFormData,\n isFormUrlEncoded,\n });\n\n const dataType = response.definition.success || 'unknown';\n\n // Detect if Zod runtime validation should be applied\n const isPrimitiveType = isPrimitiveResponseType(dataType);\n const hasSchema = hasSchemaImport(response.imports, dataType);\n const isZodOutput =\n typeof context.output.schemas === 'object' &&\n context.output.schemas.type === 'zod';\n const shouldValidateResponse =\n override.angular.runtimeValidation &&\n isZodOutput &&\n !isPrimitiveType &&\n hasSchema;\n const schemaValueRef = shouldValidateResponse\n ? getSchemaValueRef(dataType)\n : dataType;\n // The observe-mode branches use <TData> generics, so cast the parse\n // result to keep TypeScript happy. The multi-content-type branch uses\n // concrete types and does not need the cast (see jsonValidationPipe).\n const validationPipe = shouldValidateResponse\n ? `.pipe(map(data => ${schemaValueRef}.parse(data) as TData))`\n : '';\n\n returnTypesToWrite.set(\n operationName,\n `export type ${pascal(\n operationName,\n )}ClientResult = NonNullable<${dataType}>`,\n );\n\n if (mutator) {\n const mutatorConfig = generateMutatorConfig({\n route,\n body,\n headers,\n queryParams,\n response,\n verb,\n isFormData,\n isFormUrlEncoded,\n hasSignal: false,\n isExactOptionalPropertyTypes,\n isAngular: true,\n });\n\n const requestOptions = isRequestOptions\n ? generateMutatorRequestOptions(\n override.requestOptions,\n mutator.hasThirdArg,\n )\n : '';\n\n const propsImplementation =\n mutator.bodyTypeName && body.definition\n ? toObjectString(props, 'implementation').replace(\n new RegExp(String.raw`(\\w*):\\s?${body.definition}`),\n `$1: ${mutator.bodyTypeName}<${body.definition}>`,\n )\n : toObjectString(props, 'implementation');\n\n return ` ${operationName}<TData = ${dataType}>(\\n ${propsImplementation}\\n ${\n isRequestOptions && mutator.hasThirdArg\n ? `options?: ThirdParameter<typeof ${mutator.name}>`\n : ''\n }) {${bodyForm}\n return ${mutator.name}<TData>(\n ${mutatorConfig},\n this.http,\n ${requestOptions});\n }\n `;\n }\n\n const optionsBase = {\n route,\n body,\n headers,\n queryParams,\n response,\n verb,\n requestOptions: override.requestOptions,\n isFormData,\n isFormUrlEncoded,\n paramsSerializer,\n paramsSerializerOptions: override.paramsSerializerOptions,\n isAngular: true,\n isExactOptionalPropertyTypes,\n hasSignal: false,\n } as const;\n\n const propsDefinition = toObjectString(props, 'definition');\n\n // Check for multiple content types in success responses\n const successTypes = response.types.success;\n const uniqueContentTypes = [\n ...new Set(successTypes.map((t) => t.contentType).filter(Boolean)),\n ];\n const hasMultipleContentTypes = uniqueContentTypes.length > 1;\n\n // When observe branching is active AND there are query params, extract\n // the params computation to a local const to avoid duplicating it in\n // every observe branch.\n const needsObserveBranching = isRequestOptions && !hasMultipleContentTypes;\n const angularParamsRef =\n needsObserveBranching && queryParams ? 'filteredParams' : undefined;\n\n let paramsDeclaration = '';\n if (angularParamsRef && queryParams) {\n const callExpr = getAngularFilteredParamsCallExpression(\n '{...params, ...options?.params}',\n queryParams.requiredNullableKeys ?? [],\n );\n paramsDeclaration = paramsSerializer\n ? `const ${angularParamsRef} = ${paramsSerializer.name}(${callExpr});\\n\\n `\n : `const ${angularParamsRef} = ${callExpr};\\n\\n `;\n }\n\n const optionsInput = {\n ...optionsBase,\n ...(angularParamsRef ? { angularParamsRef } : {}),\n } as const;\n\n const options = generateOptions(optionsInput);\n\n // For multiple content types, determine the default\n const defaultContentType = hasMultipleContentTypes\n ? uniqueContentTypes.includes('text/plain')\n ? 'text/plain'\n : getDefaultContentType(uniqueContentTypes)\n : (uniqueContentTypes[0] ?? 'application/json');\n const getContentTypeReturnType = (\n contentType: string | undefined,\n value: string,\n ): string => {\n if (!contentType) {\n return value;\n }\n\n if (contentType.includes('json') || contentType.includes('+json')) {\n return value;\n }\n\n if (contentType.startsWith('text/') || contentType.includes('xml')) {\n return 'string';\n }\n\n return 'Blob';\n };\n\n const jsonSuccessValues = [\n ...new Set(\n successTypes\n .filter(\n ({ contentType }) =>\n !!contentType &&\n (contentType.includes('json') || contentType.includes('+json')),\n )\n .map(({ value }) => value),\n ),\n ];\n\n const jsonReturnType =\n jsonSuccessValues.length > 0 ? jsonSuccessValues.join(' | ') : 'unknown';\n\n // For multi-content-type operations the overall dataType may be primitive\n // (e.g., 'string' when text/plain is the first content type) but the JSON\n // branch still needs validation against its own schema. Multi-content-type\n // branches use concrete return types (not <TData>), so no generic cast.\n let jsonValidationPipe = shouldValidateResponse\n ? `.pipe(map(data => ${schemaValueRef}.parse(data)))`\n : '';\n if (\n hasMultipleContentTypes &&\n !shouldValidateResponse &&\n override.angular.runtimeValidation &&\n isZodOutput &&\n jsonSuccessValues.length === 1\n ) {\n const jsonType = jsonSuccessValues[0];\n const jsonIsPrimitive = isPrimitiveResponseType(jsonType);\n const jsonHasSchema = hasSchemaImport(response.imports, jsonType);\n if (!jsonIsPrimitive && jsonHasSchema) {\n const jsonSchemaRef = getSchemaValueRef(jsonType);\n jsonValidationPipe = `.pipe(map(data => ${jsonSchemaRef}.parse(data)))`;\n }\n }\n\n const multiImplementationReturnType = `Observable<${jsonReturnType} | string | Blob>`;\n\n const observeOptions = needsObserveBranching\n ? {\n body: generateOptions({ ...optionsInput, angularObserve: 'body' }),\n events: generateOptions({ ...optionsInput, angularObserve: 'events' }),\n response: generateOptions({\n ...optionsInput,\n angularObserve: 'response',\n }),\n }\n : undefined;\n\n const isModelType = dataType !== 'Blob' && dataType !== 'string';\n let functionName = operationName;\n if (isModelType && !hasMultipleContentTypes) {\n functionName += `<TData = ${dataType}>`;\n }\n\n let contentTypeOverloads = '';\n if (hasMultipleContentTypes && isRequestOptions) {\n const requiredProps = props.filter((p) => p.required && !p.default);\n const optionalProps = props.filter((p) => !p.required || p.default);\n\n contentTypeOverloads = successTypes\n .filter((t) => t.contentType)\n .map(({ contentType, value }) => {\n const returnType = getContentTypeReturnType(contentType, value);\n const requiredPart = requiredProps\n .map((p) => p.definition)\n .join(',\\n ');\n const acceptPart = `accept: '${contentType}'`;\n const optionalPart = optionalProps\n .map((p) => p.definition)\n .join(',\\n ');\n\n const allParams = [requiredPart, acceptPart, optionalPart]\n .filter(Boolean)\n .join(',\\n ');\n return `${operationName}(${allParams}, options?: HttpClientOptions): Observable<${returnType}>;`;\n })\n .join('\\n ');\n\n const requiredPart = requiredProps.map((p) => p.definition).join(',\\n ');\n const optionalPart = optionalProps.map((p) => p.definition).join(',\\n ');\n const allParams = [requiredPart, 'accept?: string', optionalPart]\n .filter(Boolean)\n .join(',\\n ');\n contentTypeOverloads += `\\n ${operationName}(${allParams}, options?: HttpClientOptions): ${multiImplementationReturnType};`;\n }\n\n const observeOverloads =\n isRequestOptions && !hasMultipleContentTypes\n ? `${functionName}(${propsDefinition} options?: HttpClientOptions & { observe?: 'body' }): Observable<${isModelType ? 'TData' : dataType}>;\n ${functionName}(${propsDefinition} options?: HttpClientOptions & { observe: 'events' }): Observable<HttpEvent<${isModelType ? 'TData' : dataType}>>;\n ${functionName}(${propsDefinition} options?: HttpClientOptions & { observe: 'response' }): Observable<AngularHttpResponse<${isModelType ? 'TData' : dataType}>>;`\n : '';\n\n const overloads = contentTypeOverloads || observeOverloads;\n\n const observableDataType = isModelType ? 'TData' : dataType;\n const singleImplementationReturnType = isRequestOptions\n ? `Observable<${observableDataType} | HttpEvent<${observableDataType}> | AngularHttpResponse<${observableDataType}>>`\n : `Observable<${observableDataType}>`;\n\n if (hasMultipleContentTypes) {\n const requiredProps = props.filter((p) => p.required && !p.default);\n const optionalProps = props.filter((p) => !p.required || p.default);\n\n const requiredPart = requiredProps\n .map((p) => p.implementation)\n .join(',\\n ');\n const optionalPart = optionalProps\n .map((p) => p.implementation)\n .join(',\\n ');\n const allParams = [\n requiredPart,\n `accept: string = '${defaultContentType}'`,\n optionalPart,\n ]\n .filter(Boolean)\n .join(',\\n ');\n\n return ` ${overloads}\n ${operationName}(\n ${allParams},\n ${isRequestOptions ? 'options?: HttpClientOptions' : ''}\n ): ${multiImplementationReturnType} {${bodyForm}\n const headers = options?.headers instanceof HttpHeaders\n ? options.headers.set('Accept', accept)\n : { ...(options?.headers ?? {}), Accept: accept };\n\n if (accept.includes('json') || accept.includes('+json')) {\n return this.http.${verb}<${jsonReturnType}>(\\`${route}\\`, {\n ...options,\n responseType: 'json',\n headers,\n })${jsonValidationPipe};\n } else if (accept.startsWith('text/') || accept.includes('xml')) {\n return this.http.${verb}(\\`${route}\\`, {\n ...options,\n responseType: 'text',\n headers,\n }) as Observable<string>;\n } else {\n return this.http.${verb}(\\`${route}\\`, {\n ...options,\n responseType: 'blob',\n headers,\n }) as Observable<Blob>;\n }\n }\n`;\n }\n\n const observeImplementation = isRequestOptions\n ? `${paramsDeclaration}if (options?.observe === 'events') {\n return this.http.${verb}${isModelType ? '<TData>' : ''}(${\n observeOptions?.events ?? options\n });\n }\n\n if (options?.observe === 'response') {\n return this.http.${verb}${isModelType ? '<TData>' : ''}(${\n observeOptions?.response ?? options\n });\n }\n\n return this.http.${verb}${isModelType ? '<TData>' : ''}(${\n observeOptions?.body ?? options\n })${validationPipe};`\n : `return this.http.${verb}${isModelType ? '<TData>' : ''}(${options})${validationPipe};`;\n\n return ` ${overloads}\n ${functionName}(\n ${toObjectString(props, 'implementation')} ${\n isRequestOptions\n ? `options?: HttpClientOptions & { observe?: 'body' | 'events' | 'response' }`\n : ''\n }): ${singleImplementationReturnType} {${bodyForm}\n ${observeImplementation}\n }\n`;\n};\n\nconst createAngularClient =\n (returnTypesToWrite: ReturnTypesToWrite): ClientBuilder =>\n (verbOptions, options, _outputClient, _output) => {\n // Keep signature aligned with ClientBuilder without tripping TS noUnusedParameters\n void _outputClient;\n void _output;\n\n // Detect if Zod runtime validation should be applied\n const isZodOutput =\n typeof options.context.output.schemas === 'object' &&\n options.context.output.schemas.type === 'zod';\n const responseType = verbOptions.response.definition.success;\n const isPrimitiveResponse = isPrimitiveResponseType(responseType);\n const shouldUseRuntimeValidation =\n verbOptions.override.angular.runtimeValidation && isZodOutput;\n\n // Promote schema import from type-only to value import when runtime\n // validation is active, so the generated code can call Schema.parse()\n const normalizedVerbOptions = (() => {\n if (!shouldUseRuntimeValidation) return verbOptions;\n\n let result = verbOptions;\n\n // Promote the primary response schema\n if (\n !isPrimitiveResponse &&\n hasSchemaImport(result.response.imports, responseType)\n ) {\n result = {\n ...result,\n response: {\n ...result.response,\n imports: result.response.imports.map((imp) =>\n imp.name === responseType ? { ...imp, values: true } : imp,\n ),\n },\n };\n }\n\n // For multi-content-type operations, also promote the JSON-specific\n // schema even when the primary content type is non-JSON (e.g.,\n // showPetById where text/plain is the default but application/json\n // returns Pet which needs .parse()).\n const successTypes = result.response.types.success;\n const uniqueContentTypes = [\n ...new Set(successTypes.map((t) => t.contentType).filter(Boolean)),\n ];\n if (uniqueContentTypes.length > 1) {\n const jsonSchemaNames = [\n ...new Set(\n successTypes\n .filter(\n ({ contentType }) =>\n !!contentType &&\n (contentType.includes('json') ||\n contentType.includes('+json')),\n )\n .map(({ value }) => value),\n ),\n ];\n if (jsonSchemaNames.length === 1) {\n const jsonType = jsonSchemaNames[0];\n const jsonIsPrimitive = isPrimitiveResponseType(jsonType);\n if (\n !jsonIsPrimitive &&\n hasSchemaImport(result.response.imports, jsonType)\n ) {\n result = {\n ...result,\n response: {\n ...result.response,\n imports: result.response.imports.map((imp) =>\n imp.name === jsonType ? { ...imp, values: true } : imp,\n ),\n },\n };\n }\n }\n }\n\n return result;\n })();\n\n const implementation = generateImplementation(\n returnTypesToWrite,\n normalizedVerbOptions,\n options,\n );\n\n const imports = [\n ...generateVerbImports(normalizedVerbOptions),\n ...(implementation.includes('.pipe(map(')\n ? [{ name: 'map', values: true, importPath: 'rxjs' }]\n : []),\n ];\n\n return { implementation, imports };\n };\n\nconst standaloneReturnTypesToWrite = new Map<string, string>();\n\nexport const generateAngular: ClientBuilder = (\n verbOptions,\n options,\n outputClient,\n output,\n) =>\n createAngularClient(standaloneReturnTypesToWrite)(\n verbOptions,\n options,\n outputClient,\n output,\n );\n\nconst createAngularClientBuilder = (): ClientGeneratorsBuilder => {\n const returnTypesToWrite = new Map<string, string>();\n\n return {\n client: createAngularClient(returnTypesToWrite),\n header: createAngularHeader(),\n dependencies: getAngularDependencies,\n footer: createAngularFooter(returnTypesToWrite),\n title: generateAngularTitle,\n };\n};\n\nexport const builder: () => () => ClientGeneratorsBuilder = () => {\n return () => createAngularClientBuilder();\n};\n\nexport default builder;\n"],"mappings":";;;AAwBA,MAAM,uBAAuB;CAC3B;EACE,SAAS;GACP;IAAE,MAAM;IAAc,QAAQ;IAAM;GACpC;IAAE,MAAM;IAAe,QAAQ;IAAM;GACrC,EAAE,MAAM,cAAc;GACtB,EAAE,MAAM,eAAe;GACvB;IAAE,MAAM;IAAgB,OAAO;IAAuB;GACtD,EAAE,MAAM,aAAa;GACtB;EACD,YAAY;EACb;CACD;EACE,SAAS,CACP;GAAE,MAAM;GAAc,QAAQ;GAAM,EACpC;GAAE,MAAM;GAAU,QAAQ;GAAM,CACjC;EACD,YAAY;EACb;CACD;EACE,SAAS,CAAC;GAAE,MAAM;GAAc,QAAQ;GAAM,CAAC;EAC/C,YAAY;EACb;CACF;AAED,MAAM,2BAA2B;CAC/B;CACA;CACA;CACA;CACA;CACD;AAED,MAAM,2BAA2B,aAC/B,YAAY,UACX,yBAA+C,SAAS,SAAS;AAEpE,MAAM,mBACJ,SACA,aAEA,YAAY,UAAa,QAAQ,MAAM,QAAQ,IAAI,SAAS,SAAS;A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ACR,GAAG,OAAO;MACV,SAAS,OAAO,SAAS,QAAQ,KAAK,QACpC,IAAI,SAAS,WAAW;OAAE,GAAG;OAAK,QAAQ;OAAM,GAAG,IACpD;MACF;KACF;;;AAKP,SAAO;KACL;CAEJ,MAAM,iBAAiB,uBACrB,oBACA,uBACA,QACD;AASD,QAAO;EAAE;EAAgB,SAPT,CACd,GAAG,oBAAoB,sBAAsB,EAC7C,GAAI,eAAe,SAAS,aAAa,GACrC,CAAC;GAAE,MAAM;GAAO,QAAQ;GAAM,YAAY;GAAQ,CAAC,GACnD,EAAE,CACP;EAEiC;;AAGtC,MAAM,+CAA+B,IAAI,KAAqB;AAE9D,MAAaC,mBACX,aACA,SACA,cACA,WAEA,oBAAoB,6BAA6B,CAC/C,aACA,SACA,cACA,OACD;AAEH,MAAM,mCAA4D;CAChE,MAAM,qCAAqB,IAAI,KAAqB;AAEpD,QAAO;EACL,QAAQ,oBAAoB,mBAAmB;EAC/C,QAAQ,qBAAqB;EAC7B,cAAc;EACd,QAAQ,oBAAoB,mBAAmB;EAC/C,OAAO;EACR;;AAGH,MAAaC,gBAAqD;AAChE,cAAa,4BAA4B;;AAG3C,kBAAe"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orval/angular",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.4.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -16,17 +16,19 @@
|
|
|
16
16
|
"build": "tsdown --config-loader unrun",
|
|
17
17
|
"dev": "tsdown --config-loader unrun --watch src",
|
|
18
18
|
"lint": "eslint .",
|
|
19
|
+
"test": "vitest",
|
|
19
20
|
"clean": "rimraf .turbo dist",
|
|
20
21
|
"nuke": "rimraf .turbo dist node_modules"
|
|
21
22
|
},
|
|
22
23
|
"dependencies": {
|
|
23
|
-
"@orval/core": "8.
|
|
24
|
+
"@orval/core": "8.4.1"
|
|
24
25
|
},
|
|
25
26
|
"devDependencies": {
|
|
26
27
|
"eslint": "9.39.2",
|
|
27
28
|
"rimraf": "6.1.2",
|
|
28
29
|
"tsdown": "0.18.2",
|
|
29
|
-
"typescript": "5.9.3"
|
|
30
|
+
"typescript": "5.9.3",
|
|
31
|
+
"vitest": "4.0.16"
|
|
30
32
|
},
|
|
31
33
|
"main": "./dist/index.mjs",
|
|
32
34
|
"module": "./dist/index.mjs",
|