@orval/angular 8.5.3 → 8.6.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/README.md +92 -13
- package/dist/index.d.mts +375 -5
- package/dist/index.mjs +1096 -108
- package/dist/index.mjs.map +1 -1
- package/package.json +19 -9
package/README.md
CHANGED
|
@@ -1,29 +1,108 @@
|
|
|
1
|
+
# `@orval/angular`
|
|
2
|
+
|
|
1
3
|
[](https://badge.fury.io/js/orval)
|
|
2
4
|
[](https://opensource.org/licenses/MIT)
|
|
3
5
|
[](https://github.com/orval-labs/orval/actions/workflows/tests.yaml)
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
Angular generator support for [Orval](https://orval.dev).
|
|
10
|
+
|
|
11
|
+
This package powers Orval's Angular output and is responsible for generating:
|
|
12
|
+
|
|
13
|
+
- injectable Angular `HttpClient` service classes
|
|
14
|
+
- signal-first Angular `httpResource` helpers
|
|
15
|
+
- mixed `both` mode output with service classes plus sibling `*.resource.ts`
|
|
16
|
+
files
|
|
17
|
+
- Angular-specific response typing, request options, runtime validation, and
|
|
18
|
+
helper utilities
|
|
19
|
+
|
|
20
|
+
In most application projects you configure Angular output through the main
|
|
21
|
+
`orval` package. This package exists so the Angular generator can be versioned,
|
|
22
|
+
tested, and consumed as a standalone builder inside the Orval monorepo.
|
|
23
|
+
|
|
24
|
+
Visit [orval.dev](https://orval.dev) for guides, API docs, and examples.
|
|
25
|
+
|
|
26
|
+
## What it generates
|
|
27
|
+
|
|
28
|
+
`@orval/angular` supports three Angular retrieval modes through
|
|
29
|
+
`override.angular.retrievalClient` (or the legacy `override.angular.client`
|
|
30
|
+
alias):
|
|
31
|
+
|
|
32
|
+
| Mode | Generated output | Best for |
|
|
33
|
+
| -------------- | -------------------------------------------------------------- | ----------------------------------------------------------- |
|
|
34
|
+
| `httpClient` | Retrievals stay on injectable Angular service classes | Conventional service-based Angular APIs |
|
|
35
|
+
| `httpResource` | Signal-first resource helpers for retrieval-style operations | Angular apps using signals for read flows |
|
|
36
|
+
| `both` | Service classes plus sibling `*.resource.ts` retrieval helpers | Projects that want signal-first reads and imperative writes |
|
|
37
|
+
|
|
38
|
+
Mutation-style operations continue to use generated `HttpClient` service
|
|
39
|
+
methods by default unless a per-operation override changes classification.
|
|
40
|
+
|
|
41
|
+
If `override.angular.retrievalClient` is omitted, Angular generation defaults to
|
|
42
|
+
`httpClient` mode.
|
|
43
|
+
|
|
44
|
+
## Example configuration
|
|
11
45
|
|
|
12
|
-
|
|
46
|
+
```ts
|
|
47
|
+
import { defineConfig } from 'orval';
|
|
13
48
|
|
|
14
|
-
|
|
49
|
+
export default defineConfig({
|
|
50
|
+
petstore: {
|
|
51
|
+
input: {
|
|
52
|
+
target: './petstore.yaml',
|
|
53
|
+
},
|
|
54
|
+
output: {
|
|
55
|
+
client: 'angular',
|
|
56
|
+
target: 'src/api/petstore.ts',
|
|
57
|
+
schemas: 'src/api/model',
|
|
58
|
+
mode: 'tags-split',
|
|
59
|
+
override: {
|
|
60
|
+
angular: {
|
|
61
|
+
retrievalClient: 'httpResource',
|
|
62
|
+
runtimeValidation: true,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
```
|
|
15
69
|
|
|
16
|
-
|
|
70
|
+
For end-user docs and richer examples, see:
|
|
17
71
|
|
|
18
|
-
|
|
72
|
+
- [Angular guide](https://orval.dev/guides/angular)
|
|
73
|
+
- [Angular sample app](https://github.com/orval-labs/orval/tree/master/samples/angular-app)
|
|
19
74
|
|
|
20
|
-
|
|
75
|
+
## Angular-specific features
|
|
21
76
|
|
|
77
|
+
This package includes support for:
|
|
78
|
+
|
|
79
|
+
- `HttpClient` observe overload generation
|
|
80
|
+
- signal-based parameter generation for `httpResource`
|
|
81
|
+
- multi-content-type response branching via generated `Accept` helpers
|
|
82
|
+
- Zod-backed runtime validation for Angular output
|
|
83
|
+
- resource option helpers such as `defaultValue`, `debugName`, `injector`, and
|
|
84
|
+
`equal`
|
|
85
|
+
- generated `ClientResult` / `ResourceResult` aliases
|
|
86
|
+
- `ResourceState<T>` and `toResourceState()` helpers for resource integration
|
|
87
|
+
|
|
88
|
+
## Development
|
|
89
|
+
|
|
90
|
+
Useful package-local scripts:
|
|
91
|
+
|
|
92
|
+
- `pnpm --filter @orval/angular build`
|
|
93
|
+
- `pnpm --filter @orval/angular test`
|
|
94
|
+
- `pnpm --filter @orval/angular lint`
|
|
95
|
+
- `pnpm --filter @orval/angular typecheck`
|
|
96
|
+
|
|
97
|
+
## More samples
|
|
98
|
+
|
|
99
|
+
You can explore additional Orval samples here:
|
|
100
|
+
|
|
101
|
+
- [angular app](https://github.com/orval-labs/orval/tree/master/samples/angular-app)
|
|
22
102
|
- [react app](https://github.com/orval-labs/orval/tree/master/samples/react-app)
|
|
23
103
|
- [react query](https://github.com/orval-labs/orval/tree/master/samples/react-query)
|
|
104
|
+
- [react app with swr](https://github.com/orval-labs/orval/tree/master/samples/react-app-with-swr)
|
|
24
105
|
- [svelte query](https://github.com/orval-labs/orval/tree/master/samples/svelte-query)
|
|
25
106
|
- [vue query](https://github.com/orval-labs/orval/tree/master/samples/vue-query)
|
|
26
|
-
- [react app with swr](https://github.com/orval-labs/orval/tree/master/samples/react-app-with-swr)
|
|
27
|
-
- [angular app](https://github.com/orval-labs/orval/tree/master/samples/angular-app)
|
|
28
107
|
- [hono](https://github.com/orval-labs/orval/tree/master/samples/hono)
|
|
29
108
|
- [next app with fetch](https://github.com/orval-labs/orval/tree/master/samples/next-app-with-fetch)
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,382 @@
|
|
|
1
|
-
import { ClientBuilder, ClientDependenciesBuilder, ClientFooterBuilder, ClientGeneratorsBuilder, ClientHeaderBuilder,
|
|
1
|
+
import { AngularOptions, ClientBuilder, ClientDependenciesBuilder, ClientExtraFilesBuilder, ClientFooterBuilder, ClientGeneratorsBuilder, ClientHeaderBuilder, ContextSpec, GeneratorVerbOptions, NormalizedOutputOptions, ResReqTypesValue, Verbs } from "@orval/core";
|
|
2
2
|
|
|
3
|
-
//#region src/
|
|
3
|
+
//#region src/constants.d.ts
|
|
4
|
+
declare const ANGULAR_HTTP_CLIENT_DEPENDENCIES: readonly [{
|
|
5
|
+
readonly exports: readonly [{
|
|
6
|
+
readonly name: "HttpClient";
|
|
7
|
+
readonly values: true;
|
|
8
|
+
}, {
|
|
9
|
+
readonly name: "HttpHeaders";
|
|
10
|
+
readonly values: true;
|
|
11
|
+
}, {
|
|
12
|
+
readonly name: "HttpParams";
|
|
13
|
+
}, {
|
|
14
|
+
readonly name: "HttpContext";
|
|
15
|
+
}, {
|
|
16
|
+
readonly name: "HttpResponse";
|
|
17
|
+
readonly alias: "AngularHttpResponse";
|
|
18
|
+
readonly values: true;
|
|
19
|
+
}, {
|
|
20
|
+
readonly name: "HttpEvent";
|
|
21
|
+
}];
|
|
22
|
+
readonly dependency: "@angular/common/http";
|
|
23
|
+
}, {
|
|
24
|
+
readonly exports: readonly [{
|
|
25
|
+
readonly name: "Injectable";
|
|
26
|
+
readonly values: true;
|
|
27
|
+
}, {
|
|
28
|
+
readonly name: "inject";
|
|
29
|
+
readonly values: true;
|
|
30
|
+
}];
|
|
31
|
+
readonly dependency: "@angular/core";
|
|
32
|
+
}, {
|
|
33
|
+
readonly exports: readonly [{
|
|
34
|
+
readonly name: "Observable";
|
|
35
|
+
readonly values: true;
|
|
36
|
+
}];
|
|
37
|
+
readonly dependency: "rxjs";
|
|
38
|
+
}];
|
|
39
|
+
declare const ANGULAR_HTTP_RESOURCE_DEPENDENCIES: readonly [{
|
|
40
|
+
readonly exports: readonly [{
|
|
41
|
+
readonly name: "httpResource";
|
|
42
|
+
readonly values: true;
|
|
43
|
+
}, {
|
|
44
|
+
readonly name: "HttpResourceOptions";
|
|
45
|
+
}, {
|
|
46
|
+
readonly name: "HttpResourceRef";
|
|
47
|
+
}, {
|
|
48
|
+
readonly name: "HttpResourceRequest";
|
|
49
|
+
}, {
|
|
50
|
+
readonly name: "HttpHeaders";
|
|
51
|
+
readonly values: true;
|
|
52
|
+
}, {
|
|
53
|
+
readonly name: "HttpParams";
|
|
54
|
+
}, {
|
|
55
|
+
readonly name: "HttpContext";
|
|
56
|
+
}];
|
|
57
|
+
readonly dependency: "@angular/common/http";
|
|
58
|
+
}, {
|
|
59
|
+
readonly exports: readonly [{
|
|
60
|
+
readonly name: "Signal";
|
|
61
|
+
}, {
|
|
62
|
+
readonly name: "ResourceStatus";
|
|
63
|
+
}];
|
|
64
|
+
readonly dependency: "@angular/core";
|
|
65
|
+
}];
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/utils.d.ts
|
|
68
|
+
type ClientOverride = 'httpClient' | 'httpResource' | 'both';
|
|
69
|
+
declare const PRIMITIVE_TYPE_VALUES: readonly ["string", "number", "boolean", "void", "unknown"];
|
|
70
|
+
type PrimitiveType = (typeof PRIMITIVE_TYPE_VALUES)[number];
|
|
71
|
+
declare const PRIMITIVE_TYPES: Set<"string" | "number" | "boolean" | "void" | "unknown">;
|
|
72
|
+
declare const isPrimitiveType: (t: string | undefined) => t is PrimitiveType;
|
|
73
|
+
declare const isZodSchemaOutput: (output: NormalizedOutputOptions) => boolean;
|
|
74
|
+
declare const isDefined: <T>(v: T | null | undefined) => v is T;
|
|
75
|
+
declare const generateAngularTitle: (title: string) => string;
|
|
76
|
+
/**
|
|
77
|
+
* Builds the opening of an @Injectable Angular service class.
|
|
78
|
+
* Shared between httpClient-only mode and the mutation section of httpResource mode.
|
|
79
|
+
*/
|
|
80
|
+
declare const buildServiceClassOpen: ({
|
|
81
|
+
title,
|
|
82
|
+
isRequestOptions,
|
|
83
|
+
isMutator,
|
|
84
|
+
isGlobalMutator,
|
|
85
|
+
provideIn,
|
|
86
|
+
hasQueryParams
|
|
87
|
+
}: {
|
|
88
|
+
title: string;
|
|
89
|
+
isRequestOptions: boolean;
|
|
90
|
+
isMutator: boolean;
|
|
91
|
+
isGlobalMutator: boolean;
|
|
92
|
+
provideIn: string | boolean | undefined;
|
|
93
|
+
hasQueryParams: boolean;
|
|
94
|
+
}) => string;
|
|
95
|
+
/**
|
|
96
|
+
* Registry that maps operationName → full route (with baseUrl).
|
|
97
|
+
*
|
|
98
|
+
* Populated during client builder calls (which receive the full route via
|
|
99
|
+
* GeneratorOptions.route) and read during header/footer builder calls
|
|
100
|
+
* (which only receive verbOptions without routes).
|
|
101
|
+
*
|
|
102
|
+
* This avoids monkey-patching verbOptions with a non-standard `fullRoute` property.
|
|
103
|
+
*/
|
|
104
|
+
declare const createRouteRegistry: () => {
|
|
105
|
+
reset(): void;
|
|
106
|
+
set(operationName: string, route: string): void;
|
|
107
|
+
get(operationName: string, fallback: string): string;
|
|
108
|
+
};
|
|
109
|
+
declare const createReturnTypesRegistry: () => {
|
|
110
|
+
reset(): void;
|
|
111
|
+
set(operationName: string, typeDefinition: string): void;
|
|
112
|
+
getFooter(operationNames: string[]): string;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Determines whether an operation should be generated as an `httpResource()`
|
|
116
|
+
* (retrieval) or as an `HttpClient` method in a service class (mutation).
|
|
117
|
+
*
|
|
118
|
+
* Resolution order:
|
|
119
|
+
* 1. **Per-operation override** — `override.operations.<operationId>.angular.client`
|
|
120
|
+
* in the orval config. `httpResource` forces retrieval, `httpClient` forces mutation.
|
|
121
|
+
* 2. **HTTP verb** — absent a per-operation override, `GET` is treated as a retrieval.
|
|
122
|
+
* 3. **Name heuristic** — For `POST`, if the operationName starts with a
|
|
123
|
+
* retrieval-like prefix (search, list, find, query, get, fetch, lookup)
|
|
124
|
+
* it is treated as a retrieval. This handles common patterns like
|
|
125
|
+
* `POST /search` or `POST /graphql` with query-style operation names.
|
|
126
|
+
*
|
|
127
|
+
* If the heuristic misclassifies an operation, users can override it
|
|
128
|
+
* per-operation in their orval config:
|
|
129
|
+
*
|
|
130
|
+
* ```ts
|
|
131
|
+
* override: {
|
|
132
|
+
* operations: {
|
|
133
|
+
* myPostSearch: { angular: { retrievalClient: 'httpResource' } },
|
|
134
|
+
* getOrCreateUser: { angular: { retrievalClient: 'httpClient' } },
|
|
135
|
+
* }
|
|
136
|
+
* }
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
declare function isRetrievalVerb(verb: Verbs, operationName?: string, clientOverride?: ClientOverride): boolean;
|
|
140
|
+
declare function isMutationVerb(verb: Verbs, operationName?: string, clientOverride?: ClientOverride): boolean;
|
|
141
|
+
declare function getDefaultSuccessType(successTypes: ResReqTypesValue[], fallback: string): {
|
|
142
|
+
contentType: string;
|
|
143
|
+
value: string;
|
|
144
|
+
};
|
|
145
|
+
//#endregion
|
|
146
|
+
//#region src/http-client.d.ts
|
|
147
|
+
/**
|
|
148
|
+
* Narrowed context for `generateHttpClientImplementation`.
|
|
149
|
+
*
|
|
150
|
+
* The implementation only reads `context.output`, so callers don't need
|
|
151
|
+
* to supply a full `ContextSpec` (which also requires `target`, `workspace`,
|
|
152
|
+
* `spec`, etc.).
|
|
153
|
+
*
|
|
154
|
+
* @remarks
|
|
155
|
+
* This keeps the call sites lightweight when `http-resource.ts` delegates
|
|
156
|
+
* mutation generation back to the shared `HttpClient` implementation builder.
|
|
157
|
+
*/
|
|
158
|
+
interface HttpClientGeneratorContext {
|
|
159
|
+
route: string;
|
|
160
|
+
context: Pick<ContextSpec, 'output'>;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Returns the dependency list required by the Angular `HttpClient` generator.
|
|
164
|
+
*
|
|
165
|
+
* These imports are consumed by Orval's generic dependency-import emitter when
|
|
166
|
+
* composing the generated Angular client file.
|
|
167
|
+
*
|
|
168
|
+
* @returns The Angular `HttpClient` dependency descriptors used during import generation.
|
|
169
|
+
*/
|
|
4
170
|
declare const getAngularDependencies: ClientDependenciesBuilder;
|
|
5
|
-
|
|
171
|
+
/**
|
|
172
|
+
* Builds the generated TypeScript helper name used for multi-content-type
|
|
173
|
+
* `Accept` header unions.
|
|
174
|
+
*
|
|
175
|
+
* Example: `listPets` -> `ListPetsAccept`.
|
|
176
|
+
*
|
|
177
|
+
* @returns A PascalCase helper type/const name for the operation's `Accept` values.
|
|
178
|
+
*/
|
|
179
|
+
declare const getAcceptHelperName: (operationName: string) => string;
|
|
180
|
+
/**
|
|
181
|
+
* Collects the distinct successful response content types for a single
|
|
182
|
+
* operation.
|
|
183
|
+
*
|
|
184
|
+
* The Angular generators use this to decide whether they need `Accept`
|
|
185
|
+
* overloads or content-type-specific branching logic.
|
|
186
|
+
*
|
|
187
|
+
* @returns A de-duplicated list of response content types, excluding empty entries.
|
|
188
|
+
*/
|
|
189
|
+
declare const getUniqueContentTypes: (successTypes: GeneratorVerbOptions["response"]["types"]["success"]) => string[];
|
|
190
|
+
/**
|
|
191
|
+
* Builds the shared `Accept` helper declarations for all operations in the
|
|
192
|
+
* current Angular generation scope.
|
|
193
|
+
*
|
|
194
|
+
* @remarks
|
|
195
|
+
* Helpers are emitted only for operations with more than one successful
|
|
196
|
+
* response content type.
|
|
197
|
+
*
|
|
198
|
+
* @returns Concatenated type/const declarations or an empty string when no helpers are needed.
|
|
199
|
+
*/
|
|
200
|
+
declare const buildAcceptHelpers: (verbOptions: readonly GeneratorVerbOptions[], output: ContextSpec["output"]) => string;
|
|
201
|
+
/**
|
|
202
|
+
* Generates the static header section for Angular `HttpClient` output.
|
|
203
|
+
*
|
|
204
|
+
* Depending on the current generation options this may include:
|
|
205
|
+
* - reusable request option helper types
|
|
206
|
+
* - filtered query-param helper utilities
|
|
207
|
+
* - mutator support types
|
|
208
|
+
* - `Accept` helper unions/constants for multi-content-type operations
|
|
209
|
+
* - the `@Injectable()` service class shell
|
|
210
|
+
*
|
|
211
|
+
* @returns A string containing the prelude and service class opening for the generated file.
|
|
212
|
+
*/
|
|
6
213
|
declare const generateAngularHeader: ClientHeaderBuilder;
|
|
214
|
+
/**
|
|
215
|
+
* Generates the closing section for Angular `HttpClient` output.
|
|
216
|
+
*
|
|
217
|
+
* @remarks
|
|
218
|
+
* Besides closing the generated service class, this appends any collected
|
|
219
|
+
* `ClientResult` aliases registered while individual operations were emitted.
|
|
220
|
+
*
|
|
221
|
+
* @returns The footer text for the generated Angular client file.
|
|
222
|
+
*/
|
|
7
223
|
declare const generateAngularFooter: ClientFooterBuilder;
|
|
224
|
+
/**
|
|
225
|
+
* Generates the Angular `HttpClient` method implementation for a single
|
|
226
|
+
* OpenAPI operation.
|
|
227
|
+
*
|
|
228
|
+
* This function is responsible for:
|
|
229
|
+
* - method signatures and overloads
|
|
230
|
+
* - observe-mode branching
|
|
231
|
+
* - multi-content-type `Accept` handling
|
|
232
|
+
* - mutator integration
|
|
233
|
+
* - runtime Zod validation hooks for Angular output
|
|
234
|
+
* - registering the operation's `ClientResult` alias for footer emission
|
|
235
|
+
*
|
|
236
|
+
* @remarks
|
|
237
|
+
* This is the central implementation builder shared by the dedicated
|
|
238
|
+
* `httpClient` mode and the mutation side of Angular `both` / `httpResource`
|
|
239
|
+
* generation.
|
|
240
|
+
*
|
|
241
|
+
* @returns The complete TypeScript method declaration and implementation for the operation.
|
|
242
|
+
*/
|
|
243
|
+
declare const generateHttpClientImplementation: ({
|
|
244
|
+
headers,
|
|
245
|
+
queryParams,
|
|
246
|
+
operationName,
|
|
247
|
+
response,
|
|
248
|
+
mutator,
|
|
249
|
+
body,
|
|
250
|
+
props,
|
|
251
|
+
verb,
|
|
252
|
+
override,
|
|
253
|
+
formData,
|
|
254
|
+
formUrlEncoded,
|
|
255
|
+
paramsSerializer
|
|
256
|
+
}: GeneratorVerbOptions, {
|
|
257
|
+
route,
|
|
258
|
+
context
|
|
259
|
+
}: HttpClientGeneratorContext) => string;
|
|
260
|
+
/**
|
|
261
|
+
* Orval client builder entry point for Angular `HttpClient` output.
|
|
262
|
+
*
|
|
263
|
+
* It normalizes imports needed for runtime validation, delegates the actual
|
|
264
|
+
* method implementation to `generateHttpClientImplementation`, and returns the
|
|
265
|
+
* generated code plus imports for the current operation.
|
|
266
|
+
*
|
|
267
|
+
* @returns The generated implementation fragment and imports for one operation.
|
|
268
|
+
*/
|
|
8
269
|
declare const generateAngular: ClientBuilder;
|
|
9
|
-
|
|
270
|
+
/**
|
|
271
|
+
* Returns the footer aliases collected for the provided operation names.
|
|
272
|
+
*
|
|
273
|
+
* The Angular generators use these aliases to expose stable `ClientResult`
|
|
274
|
+
* helper types such as `ListPetsClientResult`.
|
|
275
|
+
*
|
|
276
|
+
* @returns Concatenated `ClientResult` aliases for the requested operation names.
|
|
277
|
+
*/
|
|
278
|
+
declare const getHttpClientReturnTypes: (operationNames: string[]) => string;
|
|
279
|
+
/**
|
|
280
|
+
* Clears the module-level return type registry used during Angular client
|
|
281
|
+
* generation.
|
|
282
|
+
*
|
|
283
|
+
* This must be called at the start of each generation pass to avoid leaking
|
|
284
|
+
* aliases across files or tags.
|
|
285
|
+
*
|
|
286
|
+
* @returns Nothing.
|
|
287
|
+
*/
|
|
288
|
+
declare const resetHttpClientReturnTypes: () => void;
|
|
289
|
+
//#endregion
|
|
290
|
+
//#region src/http-resource.d.ts
|
|
291
|
+
/** @internal Exported for testing only */
|
|
292
|
+
declare const routeRegistry: {
|
|
293
|
+
reset(): void;
|
|
294
|
+
set(operationName: string, route: string): void;
|
|
295
|
+
get(operationName: string, fallback: string): string;
|
|
296
|
+
};
|
|
297
|
+
/**
|
|
298
|
+
* Returns the merged dependency list required when Angular `httpResource`
|
|
299
|
+
* output coexists with Angular `HttpClient` service generation.
|
|
300
|
+
*
|
|
301
|
+
* This is used for pure `httpResource` mode as well as mixed generation paths
|
|
302
|
+
* that still need Angular common HTTP symbols and service helpers.
|
|
303
|
+
*
|
|
304
|
+
* @returns The de-duplicated dependency descriptors for Angular resource generation.
|
|
305
|
+
*/
|
|
306
|
+
declare const getAngularHttpResourceDependencies: ClientDependenciesBuilder;
|
|
307
|
+
/**
|
|
308
|
+
* Returns only the dependencies required by standalone generated resource
|
|
309
|
+
* files, such as the sibling `*.resource.ts` output used in `both` mode.
|
|
310
|
+
*
|
|
311
|
+
* @returns The dependency descriptors required by resource-only files.
|
|
312
|
+
*/
|
|
313
|
+
declare const getAngularHttpResourceOnlyDependencies: ClientDependenciesBuilder;
|
|
314
|
+
/**
|
|
315
|
+
* Generates the header section for Angular `httpResource` output.
|
|
316
|
+
*
|
|
317
|
+
* @remarks
|
|
318
|
+
* Resource functions are emitted in the header phase because their final shape
|
|
319
|
+
* depends on the full set of operations in scope, including generated `Accept`
|
|
320
|
+
* helpers and any shared mutation service methods.
|
|
321
|
+
*
|
|
322
|
+
* @returns The generated header, resource helpers, optional mutation service class, and resource result aliases.
|
|
323
|
+
*/
|
|
324
|
+
declare const generateHttpResourceHeader: ClientHeaderBuilder;
|
|
325
|
+
/**
|
|
326
|
+
* Generates the footer for Angular `httpResource` output.
|
|
327
|
+
*
|
|
328
|
+
* The footer appends any registered `ClientResult` aliases coming from shared
|
|
329
|
+
* `HttpClient` mutation methods and the resource-state helper utilities emitted
|
|
330
|
+
* for generated Angular resources.
|
|
331
|
+
*
|
|
332
|
+
* @returns The footer text for the generated Angular resource file.
|
|
333
|
+
*/
|
|
334
|
+
declare const generateHttpResourceFooter: ClientFooterBuilder;
|
|
335
|
+
/**
|
|
336
|
+
* Per-operation builder used during Angular `httpResource` generation.
|
|
337
|
+
*
|
|
338
|
+
* Unlike the `HttpClient` builder, the actual implementation body is emitted in
|
|
339
|
+
* the header phase after all operations are known. This function mainly records
|
|
340
|
+
* the resolved route and returns the imports required by the current operation.
|
|
341
|
+
*
|
|
342
|
+
* @returns An empty implementation plus the imports required by the operation.
|
|
343
|
+
*/
|
|
344
|
+
declare const generateHttpResourceClient: ClientBuilder;
|
|
345
|
+
/**
|
|
346
|
+
* Generates the extra sibling resource file used by Angular `both` mode.
|
|
347
|
+
*
|
|
348
|
+
* @remarks
|
|
349
|
+
* The main generated file keeps the `HttpClient` service class while retrieval
|
|
350
|
+
* resources are emitted into `*.resource.ts` so consumers can opt into both
|
|
351
|
+
* access patterns without mixing the generated surfaces.
|
|
352
|
+
*
|
|
353
|
+
* @returns A single extra file descriptor representing the generated resource file.
|
|
354
|
+
*/
|
|
355
|
+
declare const generateHttpResourceExtraFiles: ClientExtraFilesBuilder;
|
|
356
|
+
//#endregion
|
|
357
|
+
//#region src/types.d.ts
|
|
358
|
+
/**
|
|
359
|
+
* Code template for the `HttpClientOptions` interface emitted into generated files.
|
|
360
|
+
*
|
|
361
|
+
* This is NOT an import of Angular's type — Angular's HttpClient methods accept
|
|
362
|
+
* inline option objects, not a single unified interface. Orval generates this
|
|
363
|
+
* convenience wrapper so users have a single referenceable type.
|
|
364
|
+
*
|
|
365
|
+
* Properties sourced from Angular HttpClient public API (angular/angular
|
|
366
|
+
* packages/common/http/src/client.ts).
|
|
367
|
+
*/
|
|
368
|
+
declare const HTTP_CLIENT_OPTIONS_TEMPLATE = "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 readonly timeout?: number;\n}";
|
|
369
|
+
/**
|
|
370
|
+
* Code templates for reusable observe option helpers emitted into generated files.
|
|
371
|
+
*/
|
|
372
|
+
declare const HTTP_CLIENT_OBSERVE_OPTIONS_TEMPLATE = "type HttpClientBodyOptions = HttpClientOptions & {\n readonly observe?: 'body';\n};\n\ntype HttpClientEventOptions = HttpClientOptions & {\n readonly observe: 'events';\n};\n\ntype HttpClientResponseOptions = HttpClientOptions & {\n readonly observe: 'response';\n};\n\ntype HttpClientObserveOptions = HttpClientOptions & {\n readonly observe?: 'body' | 'events' | 'response';\n};";
|
|
373
|
+
/**
|
|
374
|
+
* Code template for the `ThirdParameter` utility type used with custom mutators.
|
|
375
|
+
*/
|
|
376
|
+
declare const THIRD_PARAMETER_TEMPLATE = "// eslint-disable-next-line\n type ThirdParameter<T extends (...args: never[]) => unknown> = T extends (\n config: unknown,\n httpClient: unknown,\n args: infer P,\n) => unknown\n ? P\n : never;";
|
|
377
|
+
//#endregion
|
|
378
|
+
//#region src/index.d.ts
|
|
379
|
+
declare const builder: () => (options?: AngularOptions) => ClientGeneratorsBuilder;
|
|
10
380
|
//#endregion
|
|
11
|
-
export { builder, builder as default, generateAngular, generateAngularFooter, generateAngularHeader, generateAngularTitle, getAngularDependencies };
|
|
381
|
+
export { ANGULAR_HTTP_CLIENT_DEPENDENCIES, ANGULAR_HTTP_RESOURCE_DEPENDENCIES, ClientOverride, HTTP_CLIENT_OBSERVE_OPTIONS_TEMPLATE, HTTP_CLIENT_OPTIONS_TEMPLATE, HttpClientGeneratorContext, PRIMITIVE_TYPES, PrimitiveType, THIRD_PARAMETER_TEMPLATE, buildAcceptHelpers, buildServiceClassOpen, builder, builder as default, createReturnTypesRegistry, createRouteRegistry, generateAngular, generateAngularFooter, generateAngularHeader, generateAngularTitle, generateHttpClientImplementation, generateHttpResourceClient, generateHttpResourceExtraFiles, generateHttpResourceFooter, generateHttpResourceHeader, getAcceptHelperName, getAngularDependencies, getAngularHttpResourceDependencies, getAngularHttpResourceOnlyDependencies, getDefaultSuccessType, getHttpClientReturnTypes, getUniqueContentTypes, isDefined, isMutationVerb, isPrimitiveType, isRetrievalVerb, isZodSchemaOutput, resetHttpClientReturnTypes, routeRegistry };
|
|
12
382
|
//# sourceMappingURL=index.d.mts.map
|