@abapify/openai-codegen 0.3.6 → 0.4.6
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/cli.d.mts +44 -0
- package/dist/cli.d.mts.map +1 -0
- package/dist/cli.mjs +116 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/generate-BobARM00.mjs +2957 -0
- package/dist/generate-BobARM00.mjs.map +1 -0
- package/dist/index.d.mts +496 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +224 -0
- package/dist/index.mjs.map +1 -0
- package/dist/naming-9hJCZKjv.d.mts +47 -0
- package/dist/naming-9hJCZKjv.d.mts.map +1 -0
- package/package.json +4 -3
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,496 @@
|
|
|
1
|
+
import { i as resolveNames, n as NamesConfigError, r as ResolvedNames, t as NamesConfig } from "./naming-9hJCZKjv.mjs";
|
|
2
|
+
import { BuiltinTypeName, ClassDef, Comment, InterfaceDef, Statement, TypeDef, TypeRef } from "@abapify/abap-ast";
|
|
3
|
+
//#region src/oas/types.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Narrowed OpenAPI 3.1-compatible types used by the code generator.
|
|
6
|
+
*
|
|
7
|
+
* These are deliberately decoupled from `openapi-types` to keep the surface
|
|
8
|
+
* small, stable, and friendly to ABAP emitters. `JsonSchema` is kept as an
|
|
9
|
+
* open record for now — later waves will refine it into a discriminated union
|
|
10
|
+
* when we need richer structural reasoning.
|
|
11
|
+
*/
|
|
12
|
+
type JsonSchema = Record<string, unknown>;
|
|
13
|
+
interface JsonSchemaRef {
|
|
14
|
+
$ref: string;
|
|
15
|
+
}
|
|
16
|
+
declare function isRef(x: unknown): x is JsonSchemaRef;
|
|
17
|
+
type HttpMethod = 'get' | 'post' | 'put' | 'patch' | 'delete' | 'head' | 'options' | 'trace';
|
|
18
|
+
type ParameterLocation = 'path' | 'query' | 'header' | 'cookie';
|
|
19
|
+
interface SpecInfo {
|
|
20
|
+
title: string;
|
|
21
|
+
version: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
termsOfService?: string;
|
|
24
|
+
contact?: {
|
|
25
|
+
name?: string;
|
|
26
|
+
url?: string;
|
|
27
|
+
email?: string;
|
|
28
|
+
};
|
|
29
|
+
license?: {
|
|
30
|
+
name: string;
|
|
31
|
+
url?: string;
|
|
32
|
+
identifier?: string;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
interface NormalizedServerVariable {
|
|
36
|
+
default: string;
|
|
37
|
+
enum?: string[];
|
|
38
|
+
description?: string;
|
|
39
|
+
}
|
|
40
|
+
interface NormalizedServer {
|
|
41
|
+
url: string;
|
|
42
|
+
description?: string;
|
|
43
|
+
variables: Record<string, NormalizedServerVariable>;
|
|
44
|
+
}
|
|
45
|
+
interface NormalizedParameter {
|
|
46
|
+
name: string;
|
|
47
|
+
in: ParameterLocation;
|
|
48
|
+
required: boolean;
|
|
49
|
+
schema: JsonSchema;
|
|
50
|
+
style?: string;
|
|
51
|
+
explode?: boolean;
|
|
52
|
+
description?: string;
|
|
53
|
+
deprecated: boolean;
|
|
54
|
+
}
|
|
55
|
+
interface NormalizedMediaType {
|
|
56
|
+
schema: JsonSchema;
|
|
57
|
+
}
|
|
58
|
+
interface NormalizedRequestBody {
|
|
59
|
+
required: boolean;
|
|
60
|
+
description?: string;
|
|
61
|
+
content: Record<string, NormalizedMediaType>;
|
|
62
|
+
}
|
|
63
|
+
interface NormalizedHeader {
|
|
64
|
+
schema: JsonSchema;
|
|
65
|
+
description?: string;
|
|
66
|
+
required?: boolean;
|
|
67
|
+
deprecated?: boolean;
|
|
68
|
+
}
|
|
69
|
+
interface NormalizedResponse {
|
|
70
|
+
statusCode: string;
|
|
71
|
+
isSuccess: boolean;
|
|
72
|
+
isError: boolean;
|
|
73
|
+
description?: string;
|
|
74
|
+
content: Record<string, NormalizedMediaType>;
|
|
75
|
+
headers: Record<string, NormalizedHeader>;
|
|
76
|
+
}
|
|
77
|
+
interface NormalizedOperation {
|
|
78
|
+
operationId: string;
|
|
79
|
+
method: HttpMethod;
|
|
80
|
+
path: string;
|
|
81
|
+
tags: string[];
|
|
82
|
+
summary?: string;
|
|
83
|
+
description?: string;
|
|
84
|
+
deprecated: boolean;
|
|
85
|
+
parameters: NormalizedParameter[];
|
|
86
|
+
requestBody?: NormalizedRequestBody;
|
|
87
|
+
responses: NormalizedResponse[];
|
|
88
|
+
security: SecurityRequirement[];
|
|
89
|
+
}
|
|
90
|
+
interface SecuritySchemeApiKey {
|
|
91
|
+
type: 'apiKey';
|
|
92
|
+
name: string;
|
|
93
|
+
in: 'header' | 'query' | 'cookie';
|
|
94
|
+
description?: string;
|
|
95
|
+
}
|
|
96
|
+
interface SecuritySchemeHttp {
|
|
97
|
+
type: 'http';
|
|
98
|
+
scheme: 'bearer' | 'basic' | string;
|
|
99
|
+
bearerFormat?: string;
|
|
100
|
+
description?: string;
|
|
101
|
+
}
|
|
102
|
+
interface OAuthFlow {
|
|
103
|
+
authorizationUrl?: string;
|
|
104
|
+
tokenUrl?: string;
|
|
105
|
+
refreshUrl?: string;
|
|
106
|
+
scopes: Record<string, string>;
|
|
107
|
+
}
|
|
108
|
+
interface SecuritySchemeOAuth2 {
|
|
109
|
+
type: 'oauth2';
|
|
110
|
+
flows: {
|
|
111
|
+
implicit?: OAuthFlow;
|
|
112
|
+
password?: OAuthFlow;
|
|
113
|
+
clientCredentials?: OAuthFlow;
|
|
114
|
+
authorizationCode?: OAuthFlow;
|
|
115
|
+
};
|
|
116
|
+
description?: string;
|
|
117
|
+
}
|
|
118
|
+
interface SecuritySchemeOpenIdConnect {
|
|
119
|
+
type: 'openIdConnect';
|
|
120
|
+
openIdConnectUrl: string;
|
|
121
|
+
description?: string;
|
|
122
|
+
}
|
|
123
|
+
type SecurityScheme = SecuritySchemeApiKey | SecuritySchemeHttp | SecuritySchemeOAuth2 | SecuritySchemeOpenIdConnect;
|
|
124
|
+
/** Map of scheme-name → required scopes. */
|
|
125
|
+
type SecurityRequirement = Record<string, string[]>;
|
|
126
|
+
interface NormalizedSpec {
|
|
127
|
+
openapiVersion: string;
|
|
128
|
+
info: SpecInfo;
|
|
129
|
+
servers: NormalizedServer[];
|
|
130
|
+
operations: NormalizedOperation[];
|
|
131
|
+
schemas: Record<string, JsonSchema>;
|
|
132
|
+
securitySchemes: Record<string, SecurityScheme>;
|
|
133
|
+
}
|
|
134
|
+
//#endregion
|
|
135
|
+
//#region src/oas/load.d.ts
|
|
136
|
+
/**
|
|
137
|
+
* Load and normalize an OpenAPI 3.x spec from a file path, URL, or in-memory
|
|
138
|
+
* object. YAML files (`.yaml` / `.yml`) are read manually with the `yaml`
|
|
139
|
+
* library first so we always hand SwaggerParser a parsed object — this keeps
|
|
140
|
+
* our behaviour identical for local files and in-memory inputs.
|
|
141
|
+
*/
|
|
142
|
+
declare function loadSpec(input: string | URL | object): Promise<NormalizedSpec>;
|
|
143
|
+
/**
|
|
144
|
+
* Normalize a (presumed-dereferenced) OpenAPI document into our internal
|
|
145
|
+
* shape. Callers who already have a dereferenced spec may invoke this
|
|
146
|
+
* directly.
|
|
147
|
+
*/
|
|
148
|
+
declare function normalizeSpec(dereferenced: unknown, namedSchemas?: Record<string, JsonSchema>): NormalizedSpec;
|
|
149
|
+
//#endregion
|
|
150
|
+
//#region src/oas/iterate.d.ts
|
|
151
|
+
interface SchemaVisit {
|
|
152
|
+
path: string[];
|
|
153
|
+
schema: JsonSchema;
|
|
154
|
+
}
|
|
155
|
+
type SchemaVisitor = (visit: SchemaVisit) => void;
|
|
156
|
+
/**
|
|
157
|
+
* Depth-first walk over every distinct schema reachable from a normalized
|
|
158
|
+
* spec. Ordering is deterministic: components.schemas (by insertion order),
|
|
159
|
+
* then operations in spec order, with each operation yielding
|
|
160
|
+
* `parameters → requestBody → responses`. Inside each schema we descend into
|
|
161
|
+
* `properties`, `items`, `additionalProperties`, `allOf`/`anyOf`/`oneOf`, and
|
|
162
|
+
* `not`.
|
|
163
|
+
*/
|
|
164
|
+
declare function walkSchemas(spec: NormalizedSpec, cb: SchemaVisitor): void;
|
|
165
|
+
/** Stable key used to identify an operation, e.g. `GET /pet/{petId}`. */
|
|
166
|
+
declare function operationKey(op: NormalizedOperation): string;
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region src/profiles/types.d.ts
|
|
169
|
+
type TargetProfileId = 'on-prem-classic' | 's4-onprem-modern' | 's4-cloud';
|
|
170
|
+
interface HttpClientStrategy {
|
|
171
|
+
kind: 'if_http_client' | 'if_web_http_client';
|
|
172
|
+
factoryClass: string;
|
|
173
|
+
destinationProviderClass?: string;
|
|
174
|
+
}
|
|
175
|
+
interface JsonStrategy {
|
|
176
|
+
kind: 'ui2_cl_json' | 'inline';
|
|
177
|
+
helperClass?: string;
|
|
178
|
+
}
|
|
179
|
+
interface TargetProfile {
|
|
180
|
+
id: TargetProfileId;
|
|
181
|
+
description: string;
|
|
182
|
+
http: HttpClientStrategy;
|
|
183
|
+
json: JsonStrategy;
|
|
184
|
+
/** Whitelist of system classes/interfaces the emitter may reference.
|
|
185
|
+
* Uppercase, no leading 'if_'/'cl_' stripping. Tested case-insensitively. */
|
|
186
|
+
allowedClasses: ReadonlySet<string>;
|
|
187
|
+
}
|
|
188
|
+
//#endregion
|
|
189
|
+
//#region src/profiles/errors.d.ts
|
|
190
|
+
declare class WhitelistViolationError extends Error {
|
|
191
|
+
readonly className: string;
|
|
192
|
+
readonly profileId: string;
|
|
193
|
+
constructor(className: string, profileId: string);
|
|
194
|
+
}
|
|
195
|
+
//#endregion
|
|
196
|
+
//#region src/profiles/cloud.d.ts
|
|
197
|
+
declare const s4CloudProfile: TargetProfile;
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region src/profiles/onprem-classic.d.ts
|
|
200
|
+
declare const onPremClassicProfile: TargetProfile;
|
|
201
|
+
//#endregion
|
|
202
|
+
//#region src/profiles/onprem-modern.d.ts
|
|
203
|
+
declare const s4OnPremModernProfile: TargetProfile;
|
|
204
|
+
//#endregion
|
|
205
|
+
//#region src/profiles/registry.d.ts
|
|
206
|
+
declare const ALL_PROFILES: ReadonlyArray<TargetProfileId>;
|
|
207
|
+
declare function getProfile(id: TargetProfileId): TargetProfile;
|
|
208
|
+
declare function assertClassAllowed(profile: TargetProfile, className: string): void;
|
|
209
|
+
//#endregion
|
|
210
|
+
//#region src/types/naming.d.ts
|
|
211
|
+
type IdentKind = 'type' | 'method' | 'param' | 'class';
|
|
212
|
+
interface SanitizeOpts {
|
|
213
|
+
prefix?: string;
|
|
214
|
+
maxLen?: number;
|
|
215
|
+
}
|
|
216
|
+
/** Sanitize a raw identifier into an ABAP-safe name. */
|
|
217
|
+
declare function sanitizeIdent(raw: string, kind: IdentKind, opts?: SanitizeOpts): string;
|
|
218
|
+
type NameAllocator = (raw: string, kind: IdentKind, opts?: SanitizeOpts) => string;
|
|
219
|
+
/** Create a collision-resolving allocator bound to a mutable name set. */
|
|
220
|
+
declare function makeNameAllocator(usedNames: Set<string>): NameAllocator;
|
|
221
|
+
//#endregion
|
|
222
|
+
//#region src/types/plan.d.ts
|
|
223
|
+
interface TypePlanEntry {
|
|
224
|
+
/** Stable logical id, e.g. "components.schemas.Pet" or "components.schemas.Pet.properties.x". */
|
|
225
|
+
readonly id: string;
|
|
226
|
+
/** ABAP type name (ty_foo). */
|
|
227
|
+
readonly abapName: string;
|
|
228
|
+
/** Original JSON schema object. */
|
|
229
|
+
readonly schema: JsonSchema;
|
|
230
|
+
/** Logical ids of other plan entries this one depends on. */
|
|
231
|
+
readonly dependencies: readonly string[];
|
|
232
|
+
/** Where the entry comes from. */
|
|
233
|
+
readonly source: 'component' | 'inline' | 'auxiliary';
|
|
234
|
+
/** True when the entry participates in a self-reference (directly or indirectly via itself). */
|
|
235
|
+
readonly selfReferential?: boolean;
|
|
236
|
+
}
|
|
237
|
+
interface TypePlan {
|
|
238
|
+
readonly entries: readonly TypePlanEntry[];
|
|
239
|
+
readonly byId: ReadonlyMap<string, TypePlanEntry>;
|
|
240
|
+
}
|
|
241
|
+
interface PlanTypesOptions {
|
|
242
|
+
/** ABAP prefix applied to every emitted type name, e.g. "zps3_" → ty names become ty_zps3_pet. We use it as-is, joined with snake name. */
|
|
243
|
+
typePrefix: string;
|
|
244
|
+
}
|
|
245
|
+
/** Plan the ABAP type universe for a normalized spec. */
|
|
246
|
+
declare function planTypes(spec: NormalizedSpec, opts: PlanTypesOptions): TypePlan;
|
|
247
|
+
//#endregion
|
|
248
|
+
//#region src/types/map.d.ts
|
|
249
|
+
/** Map a JSON Schema primitive (type+format) to an ABAP builtin type name. */
|
|
250
|
+
declare function mapPrimitive(schema: JsonSchema): BuiltinTypeName;
|
|
251
|
+
/** Resolve a schema to an ABAP TypeRef. */
|
|
252
|
+
declare function mapSchemaToTypeRef(schema: JsonSchema, plan: TypePlan, ctx?: {
|
|
253
|
+
entryId?: string;
|
|
254
|
+
}): TypeRef;
|
|
255
|
+
/** Build a TypeDef node for a single plan entry. */
|
|
256
|
+
declare function mapSchemaToTypeDef(entry: TypePlanEntry, plan: TypePlan): {
|
|
257
|
+
typeDef: TypeDef;
|
|
258
|
+
leadingComment?: Comment;
|
|
259
|
+
};
|
|
260
|
+
//#endregion
|
|
261
|
+
//#region src/types/emit.d.ts
|
|
262
|
+
/** Emit all TypeDef nodes for the given plan, in topological order. */
|
|
263
|
+
declare function emitTypeSection(plan: TypePlan, _profile: TargetProfile): TypeDef[];
|
|
264
|
+
//#endregion
|
|
265
|
+
//#region src/types/errors.d.ts
|
|
266
|
+
declare class CyclicTypeError extends Error {
|
|
267
|
+
constructor(message: string);
|
|
268
|
+
}
|
|
269
|
+
declare class CollisionError extends Error {
|
|
270
|
+
constructor(message: string);
|
|
271
|
+
}
|
|
272
|
+
declare class UnsupportedSchemaError extends Error {
|
|
273
|
+
constructor(message: string);
|
|
274
|
+
}
|
|
275
|
+
//#endregion
|
|
276
|
+
//#region src/emit/types-interface.d.ts
|
|
277
|
+
interface EmitTypesInterfaceOptions {
|
|
278
|
+
/** UPPERCASE ABAP global interface name, e.g. 'ZIF_PETSTORE_TYPES'. */
|
|
279
|
+
readonly name: string;
|
|
280
|
+
/**
|
|
281
|
+
* When true, nullable fields (`nullable: true` or `type: [..., "null"]`)
|
|
282
|
+
* receive a sibling `<field>_is_null TYPE abap_bool` flag. Default false.
|
|
283
|
+
*/
|
|
284
|
+
readonly emitNullFlags?: boolean;
|
|
285
|
+
/** Optional ABAPDoc header lines for the interface itself. */
|
|
286
|
+
readonly interfaceAbapDoc?: readonly string[];
|
|
287
|
+
}
|
|
288
|
+
interface EmitTypesInterfaceResult {
|
|
289
|
+
readonly interface: InterfaceDef;
|
|
290
|
+
readonly typeDefs: readonly TypeDef[];
|
|
291
|
+
}
|
|
292
|
+
/** Raised when polymorphism variants disagree on the type of a named field. */
|
|
293
|
+
declare class PolymorphismConflictError extends Error {
|
|
294
|
+
constructor(message: string);
|
|
295
|
+
}
|
|
296
|
+
declare function emitTypesInterface(spec: NormalizedSpec, plan: TypePlan, opts: EmitTypesInterfaceOptions): EmitTypesInterfaceResult;
|
|
297
|
+
//#endregion
|
|
298
|
+
//#region src/emit/operations-interface.d.ts
|
|
299
|
+
interface EmitOperationsInterfaceOptions {
|
|
300
|
+
/** Global interface name, e.g. 'ZIF_PETSTORE'. */
|
|
301
|
+
readonly name: string;
|
|
302
|
+
/** Name of the sibling types interface, e.g. 'ZIF_PETSTORE_TYPES'. */
|
|
303
|
+
readonly typesInterfaceName: string;
|
|
304
|
+
/** Name of the generated exception class, e.g. 'ZCX_PETSTORE_ERROR'. */
|
|
305
|
+
readonly exceptionClassName: string;
|
|
306
|
+
/** Optional ABAPDoc to attach to the interface itself. */
|
|
307
|
+
readonly interfaceAbapDoc?: readonly string[];
|
|
308
|
+
}
|
|
309
|
+
interface OperationParamMapping {
|
|
310
|
+
readonly name: string;
|
|
311
|
+
readonly openapiName: string;
|
|
312
|
+
readonly location: 'path' | 'query' | 'header';
|
|
313
|
+
readonly required: boolean;
|
|
314
|
+
readonly typeRefSource: string;
|
|
315
|
+
/** True when the ABAP type is a STANDARD TABLE (array) alias. */
|
|
316
|
+
readonly isTable: boolean;
|
|
317
|
+
}
|
|
318
|
+
interface OperationMapping {
|
|
319
|
+
readonly operationId: string;
|
|
320
|
+
readonly methodName: string;
|
|
321
|
+
readonly method: string;
|
|
322
|
+
readonly path: string;
|
|
323
|
+
readonly params: readonly OperationParamMapping[];
|
|
324
|
+
readonly hasBody: boolean;
|
|
325
|
+
readonly successStatus: number | 'default';
|
|
326
|
+
readonly successIsEmptyBody: boolean;
|
|
327
|
+
readonly errorResponses: Readonly<Record<string, {
|
|
328
|
+
description?: string;
|
|
329
|
+
}>>;
|
|
330
|
+
readonly returningName: string;
|
|
331
|
+
}
|
|
332
|
+
interface EmitOperationsInterfaceResult {
|
|
333
|
+
readonly interface: InterfaceDef;
|
|
334
|
+
readonly operations: readonly OperationMapping[];
|
|
335
|
+
}
|
|
336
|
+
declare function emitOperationsInterface(spec: NormalizedSpec, _plan: TypePlan, opts: EmitOperationsInterfaceOptions): EmitOperationsInterfaceResult;
|
|
337
|
+
//#endregion
|
|
338
|
+
//#region src/emit/exception-class.d.ts
|
|
339
|
+
interface EmitExceptionClassOptions {
|
|
340
|
+
/** Global ABAP class name, e.g. `ZCX_PETSTORE_ERROR`. */
|
|
341
|
+
readonly name: string;
|
|
342
|
+
/** Optional class-level ABAPDoc lines. */
|
|
343
|
+
readonly interfaceAbapDoc?: readonly string[];
|
|
344
|
+
}
|
|
345
|
+
interface EmitExceptionClassResult {
|
|
346
|
+
readonly class: ClassDef;
|
|
347
|
+
}
|
|
348
|
+
declare function emitExceptionClass(opts: EmitExceptionClassOptions): EmitExceptionClassResult;
|
|
349
|
+
//#endregion
|
|
350
|
+
//#region src/emit/local-classes.d.ts
|
|
351
|
+
interface LocalClassesBundle {
|
|
352
|
+
/** Content for <cls>.clas.locals_def.abap. */
|
|
353
|
+
localsDef: string;
|
|
354
|
+
/** Content for <cls>.clas.locals_imp.abap. */
|
|
355
|
+
localsImp: string;
|
|
356
|
+
}
|
|
357
|
+
declare function emitLocalClasses(names: ResolvedNames): LocalClassesBundle;
|
|
358
|
+
//#endregion
|
|
359
|
+
//#region src/emit/response-mapper.d.ts
|
|
360
|
+
type SuccessBodyKind = {
|
|
361
|
+
kind: 'json';
|
|
362
|
+
returningName: string;
|
|
363
|
+
} | {
|
|
364
|
+
kind: 'empty';
|
|
365
|
+
returningName: string;
|
|
366
|
+
} | {
|
|
367
|
+
kind: 'binary';
|
|
368
|
+
returningName: string;
|
|
369
|
+
};
|
|
370
|
+
interface ResponseMapperOptions {
|
|
371
|
+
/** Fully-qualified ABAP exception class name. */
|
|
372
|
+
exceptionClassName: string;
|
|
373
|
+
/** Local class name used for JSON parsing (usually `json`). */
|
|
374
|
+
localJsonClassName: string;
|
|
375
|
+
/** Name of the local variable holding the fetch result. Default `response`. */
|
|
376
|
+
responseVarName?: string;
|
|
377
|
+
/** Determines how the 2xx / success branch is emitted. */
|
|
378
|
+
successBody: SuccessBodyKind;
|
|
379
|
+
}
|
|
380
|
+
interface ResponseMapperResult {
|
|
381
|
+
/** AST statement ready to append to a method body (wraps the CASE source). */
|
|
382
|
+
statement: Statement;
|
|
383
|
+
/** Raw ABAP source, formatted for insertion into a METHOD body. */
|
|
384
|
+
source: string;
|
|
385
|
+
}
|
|
386
|
+
declare function mapResponseHandling(operation: NormalizedOperation, opts: ResponseMapperOptions): ResponseMapperResult;
|
|
387
|
+
//#endregion
|
|
388
|
+
//#region src/format/types.d.ts
|
|
389
|
+
/**
|
|
390
|
+
* Shared types for format plugins (abapGit / gCTS).
|
|
391
|
+
*
|
|
392
|
+
* A {@link ClassArtifact} is the abstract, format-agnostic description of a
|
|
393
|
+
* generated ABAP class. Format writers consume it and produce the on-disk
|
|
394
|
+
* layout expected by the respective import flow.
|
|
395
|
+
*/
|
|
396
|
+
type OutputFormat = 'abapgit' | 'gcts';
|
|
397
|
+
interface ClassArtifact {
|
|
398
|
+
/** Uppercase class name, e.g. 'ZCL_PETSTORE3_CLIENT'. */
|
|
399
|
+
className: string;
|
|
400
|
+
/** The printed ABAP source (main class include). */
|
|
401
|
+
mainSource: string;
|
|
402
|
+
/** Optional test-class source. If present, must be written alongside. */
|
|
403
|
+
testSource?: string;
|
|
404
|
+
/** Optional local include (types) source. */
|
|
405
|
+
localsDefSource?: string;
|
|
406
|
+
/** Optional local include (implementation) source — for helper classes emitted alongside the main class. */
|
|
407
|
+
localsImpSource?: string;
|
|
408
|
+
/** Optional description used in the .clas.xml metadata (DESCRIPT). */
|
|
409
|
+
description?: string;
|
|
410
|
+
/** ADT language key, default 'E'. */
|
|
411
|
+
language?: string;
|
|
412
|
+
}
|
|
413
|
+
interface InterfaceArtifact {
|
|
414
|
+
/** UPPERCASE ABAP interface name, e.g. 'ZIF_PETSTORE_TYPES'. */
|
|
415
|
+
name: string;
|
|
416
|
+
/** The printed ABAP interface source. */
|
|
417
|
+
source: string;
|
|
418
|
+
/** Optional description used in the .intf.xml DESCRIPT. */
|
|
419
|
+
description?: string;
|
|
420
|
+
/** ADT language key, default 'E'. */
|
|
421
|
+
language?: string;
|
|
422
|
+
}
|
|
423
|
+
type ArtifactKind = 'class' | 'interface';
|
|
424
|
+
interface WriteResult {
|
|
425
|
+
/** Relative paths written, sorted, forward-slash normalised. */
|
|
426
|
+
files: readonly string[];
|
|
427
|
+
}
|
|
428
|
+
//#endregion
|
|
429
|
+
//#region src/format/abapgit.d.ts
|
|
430
|
+
declare function writeAbapgitLayout(artifact: ClassArtifact, outDir: string): Promise<WriteResult>;
|
|
431
|
+
declare function writeAbapgitInterface(artifact: InterfaceArtifact, outDir: string): Promise<WriteResult>;
|
|
432
|
+
//#endregion
|
|
433
|
+
//#region src/format/gcts.d.ts
|
|
434
|
+
declare function writeGctsLayout(artifact: ClassArtifact, outDir: string): Promise<WriteResult>;
|
|
435
|
+
declare function writeGctsInterface(artifact: InterfaceArtifact, outDir: string): Promise<WriteResult>;
|
|
436
|
+
//#endregion
|
|
437
|
+
//#region src/format/index.d.ts
|
|
438
|
+
declare function writeLayout(artifact: ClassArtifact | InterfaceArtifact, format: OutputFormat, outDir: string): Promise<WriteResult>;
|
|
439
|
+
interface ClientBundle {
|
|
440
|
+
types: InterfaceArtifact;
|
|
441
|
+
operations: InterfaceArtifact;
|
|
442
|
+
exception: ClassArtifact;
|
|
443
|
+
implementation: ClassArtifact;
|
|
444
|
+
}
|
|
445
|
+
declare function writeClientBundle(artifacts: ClientBundle, format: OutputFormat, outDir: string): Promise<WriteResult>;
|
|
446
|
+
//#endregion
|
|
447
|
+
//#region src/generate.d.ts
|
|
448
|
+
type GenerateTarget = 's4-cloud' | 's4-onprem-modern' | 'on-prem-classic';
|
|
449
|
+
interface GenerateOptions {
|
|
450
|
+
/** Path to the OpenAPI spec file, a URL, or a pre-parsed spec object. */
|
|
451
|
+
input: string | URL | object;
|
|
452
|
+
/** Output directory. Created if missing. */
|
|
453
|
+
outDir: string;
|
|
454
|
+
/** Output format (`abapgit` or `gcts`). */
|
|
455
|
+
format: 'abapgit' | 'gcts';
|
|
456
|
+
/** Target profile. Only `s4-cloud` is supported in v1. */
|
|
457
|
+
target?: GenerateTarget;
|
|
458
|
+
/**
|
|
459
|
+
* Naming configuration. Exactly one of `names.base` or the individual
|
|
460
|
+
* overrides must resolve all four global names.
|
|
461
|
+
*/
|
|
462
|
+
names: NamesConfig;
|
|
463
|
+
/**
|
|
464
|
+
* Default server path written into the implementation-class constructor
|
|
465
|
+
* DEFAULT clause. When omitted, derived from `spec.servers[0].url`
|
|
466
|
+
* (path component) with a final fallback of `'/'`.
|
|
467
|
+
*/
|
|
468
|
+
defaultServer?: string;
|
|
469
|
+
/**
|
|
470
|
+
* Class-level description embedded in `.clas.xml` / `.intf.xml` metadata.
|
|
471
|
+
* Defaults to each artifact's own name.
|
|
472
|
+
*/
|
|
473
|
+
description?: string;
|
|
474
|
+
/**
|
|
475
|
+
* When true, nullable fields receive a sibling `<field>_is_null` flag in
|
|
476
|
+
* the types interface. Default false.
|
|
477
|
+
*/
|
|
478
|
+
emitNullFlags?: boolean;
|
|
479
|
+
}
|
|
480
|
+
interface GenerateResult {
|
|
481
|
+
/** All written files, relative to `outDir`, sorted. */
|
|
482
|
+
files: readonly string[];
|
|
483
|
+
/** Resolved ABAP global / local names used by the pipeline. */
|
|
484
|
+
resolvedNames: ResolvedNames;
|
|
485
|
+
/** Number of type plan entries emitted into the types interface. */
|
|
486
|
+
typeCount: number;
|
|
487
|
+
/** Number of operations emitted into the operations interface. */
|
|
488
|
+
operationCount: number;
|
|
489
|
+
}
|
|
490
|
+
declare function generate(options: GenerateOptions): Promise<GenerateResult>;
|
|
491
|
+
//#endregion
|
|
492
|
+
//#region src/index.d.ts
|
|
493
|
+
declare const OPENAI_CODEGEN_VERSION = "0.2.0";
|
|
494
|
+
//#endregion
|
|
495
|
+
export { ALL_PROFILES, type ArtifactKind, type ClassArtifact, ClientBundle, CollisionError, CyclicTypeError, EmitExceptionClassOptions, EmitExceptionClassResult, EmitOperationsInterfaceOptions, EmitOperationsInterfaceResult, EmitTypesInterfaceOptions, EmitTypesInterfaceResult, type GenerateOptions, type GenerateResult, type GenerateTarget, type HttpClientStrategy, HttpMethod, type IdentKind, type InterfaceArtifact, JsonSchema, JsonSchemaRef, type JsonStrategy, LocalClassesBundle, type NameAllocator, NamesConfig, NamesConfigError, NormalizedHeader, NormalizedMediaType, NormalizedOperation, NormalizedParameter, NormalizedRequestBody, NormalizedResponse, NormalizedServer, NormalizedServerVariable, NormalizedSpec, OAuthFlow, OPENAI_CODEGEN_VERSION, OperationMapping, OperationParamMapping, type OutputFormat, ParameterLocation, type PlanTypesOptions, PolymorphismConflictError, ResolvedNames, ResponseMapperOptions, ResponseMapperResult, type SanitizeOpts, type SchemaVisit, type SchemaVisitor, SecurityRequirement, SecurityScheme, SecuritySchemeApiKey, SecuritySchemeHttp, SecuritySchemeOAuth2, SecuritySchemeOpenIdConnect, SpecInfo, SuccessBodyKind, type TargetProfile, type TargetProfileId, type TypePlan, type TypePlanEntry, UnsupportedSchemaError, WhitelistViolationError, type WriteResult, assertClassAllowed, emitExceptionClass, emitLocalClasses, emitOperationsInterface, emitTypeSection, emitTypesInterface, generate, getProfile, isRef, loadSpec, makeNameAllocator, mapPrimitive, mapResponseHandling, mapSchemaToTypeDef, mapSchemaToTypeRef, normalizeSpec, onPremClassicProfile, operationKey, planTypes, resolveNames, s4CloudProfile, s4OnPremModernProfile, sanitizeIdent, walkSchemas, writeAbapgitInterface, writeAbapgitLayout, writeClientBundle, writeGctsInterface, writeGctsLayout, writeLayout };
|
|
496
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/oas/types.ts","../src/oas/load.ts","../src/oas/iterate.ts","../src/profiles/types.ts","../src/profiles/errors.ts","../src/profiles/cloud.ts","../src/profiles/onprem-classic.ts","../src/profiles/onprem-modern.ts","../src/profiles/registry.ts","../src/types/naming.ts","../src/types/plan.ts","../src/types/map.ts","../src/types/emit.ts","../src/types/errors.ts","../src/emit/types-interface.ts","../src/emit/operations-interface.ts","../src/emit/exception-class.ts","../src/emit/local-classes.ts","../src/emit/response-mapper.ts","../src/format/types.ts","../src/format/abapgit.ts","../src/format/gcts.ts","../src/format/index.ts","../src/generate.ts","../src/index.ts"],"mappings":";;;;;;;;;;;KASY,aAAa;UAER;EACf;;iBAGc,MAAM,aAAa,KAAK;KAQ5B;KAUA;UAEK;EACf;EACA;EACA;EACA;EACA;IAAY;IAAe;IAAc;;EACzC;IAAY;IAAc;IAAc;;;UAGzB;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA,WAAW,eAAe;;UAGX;EACf;EACA,IAAI;EACJ;EACA,QAAQ;EACR;EACA;EACA;EACA;;UAGe;EACf,QAAQ;;UAGO;EACf;EACA;EACA,SAAS,eAAe;;UAGT;EACf,QAAQ;EACR;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA,SAAS,eAAe;EACxB,SAAS,eAAe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