@abapify/openai-codegen 0.4.17 → 0.4.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,6 +1,5 @@
1
- import { i as resolveNames, n as NamesConfigError, r as ResolvedNames, t as NamesConfig } from "./naming-9hJCZKjv.mjs";
1
+ import { i as resolveNames, n as NamesConfigError, r as ResolvedNames, t as NamesConfig } from "./naming-D7P_Kp_Q.mjs";
2
2
  import { BuiltinTypeName, ClassDef, Comment, InterfaceDef, Statement, TypeDef, TypeRef } from "@abapify/abap-ast";
3
- //#region src/oas/types.d.ts
4
3
  /**
5
4
  * Narrowed OpenAPI 3.1-compatible types used by the code generator.
6
5
  *
@@ -131,8 +130,6 @@ interface NormalizedSpec {
131
130
  schemas: Record<string, JsonSchema>;
132
131
  securitySchemes: Record<string, SecurityScheme>;
133
132
  }
134
- //#endregion
135
- //#region src/oas/load.d.ts
136
133
  /**
137
134
  * Load and normalize an OpenAPI 3.x spec from a file path, URL, or in-memory
138
135
  * object. YAML files (`.yaml` / `.yml`) are read manually with the `yaml`
@@ -146,8 +143,6 @@ declare function loadSpec(input: string | URL | object): Promise<NormalizedSpec>
146
143
  * directly.
147
144
  */
148
145
  declare function normalizeSpec(dereferenced: unknown, namedSchemas?: Record<string, JsonSchema>): NormalizedSpec;
149
- //#endregion
150
- //#region src/oas/iterate.d.ts
151
146
  interface SchemaVisit {
152
147
  path: string[];
153
148
  schema: JsonSchema;
@@ -164,8 +159,6 @@ type SchemaVisitor = (visit: SchemaVisit) => void;
164
159
  declare function walkSchemas(spec: NormalizedSpec, cb: SchemaVisitor): void;
165
160
  /** Stable key used to identify an operation, e.g. `GET /pet/{petId}`. */
166
161
  declare function operationKey(op: NormalizedOperation): string;
167
- //#endregion
168
- //#region src/profiles/types.d.ts
169
162
  type TargetProfileId = 'on-prem-classic' | 's4-onprem-modern' | 's4-cloud';
170
163
  interface HttpClientStrategy {
171
164
  kind: 'if_http_client' | 'if_web_http_client';
@@ -185,29 +178,17 @@ interface TargetProfile {
185
178
  * Uppercase, no leading 'if_'/'cl_' stripping. Tested case-insensitively. */
186
179
  allowedClasses: ReadonlySet<string>;
187
180
  }
188
- //#endregion
189
- //#region src/profiles/errors.d.ts
190
181
  declare class WhitelistViolationError extends Error {
191
182
  readonly className: string;
192
183
  readonly profileId: string;
193
184
  constructor(className: string, profileId: string);
194
185
  }
195
- //#endregion
196
- //#region src/profiles/cloud.d.ts
197
186
  declare const s4CloudProfile: TargetProfile;
198
- //#endregion
199
- //#region src/profiles/onprem-classic.d.ts
200
187
  declare const onPremClassicProfile: TargetProfile;
201
- //#endregion
202
- //#region src/profiles/onprem-modern.d.ts
203
188
  declare const s4OnPremModernProfile: TargetProfile;
204
- //#endregion
205
- //#region src/profiles/registry.d.ts
206
189
  declare const ALL_PROFILES: ReadonlyArray<TargetProfileId>;
207
190
  declare function getProfile(id: TargetProfileId): TargetProfile;
208
191
  declare function assertClassAllowed(profile: TargetProfile, className: string): void;
209
- //#endregion
210
- //#region src/types/naming.d.ts
211
192
  type IdentKind = 'type' | 'method' | 'param' | 'class';
212
193
  interface SanitizeOpts {
213
194
  prefix?: string;
@@ -218,8 +199,6 @@ declare function sanitizeIdent(raw: string, kind: IdentKind, opts?: SanitizeOpts
218
199
  type NameAllocator = (raw: string, kind: IdentKind, opts?: SanitizeOpts) => string;
219
200
  /** Create a collision-resolving allocator bound to a mutable name set. */
220
201
  declare function makeNameAllocator(usedNames: Set<string>): NameAllocator;
221
- //#endregion
222
- //#region src/types/plan.d.ts
223
202
  interface TypePlanEntry {
224
203
  /** Stable logical id, e.g. "components.schemas.Pet" or "components.schemas.Pet.properties.x". */
225
204
  readonly id: string;
@@ -244,8 +223,6 @@ interface PlanTypesOptions {
244
223
  }
245
224
  /** Plan the ABAP type universe for a normalized spec. */
246
225
  declare function planTypes(spec: NormalizedSpec, opts: PlanTypesOptions): TypePlan;
247
- //#endregion
248
- //#region src/types/map.d.ts
249
226
  /** Map a JSON Schema primitive (type+format) to an ABAP builtin type name. */
250
227
  declare function mapPrimitive(schema: JsonSchema): BuiltinTypeName;
251
228
  /** Resolve a schema to an ABAP TypeRef. */
@@ -257,12 +234,8 @@ declare function mapSchemaToTypeDef(entry: TypePlanEntry, plan: TypePlan): {
257
234
  typeDef: TypeDef;
258
235
  leadingComment?: Comment;
259
236
  };
260
- //#endregion
261
- //#region src/types/emit.d.ts
262
237
  /** Emit all TypeDef nodes for the given plan, in topological order. */
263
238
  declare function emitTypeSection(plan: TypePlan, _profile: TargetProfile): TypeDef[];
264
- //#endregion
265
- //#region src/types/errors.d.ts
266
239
  declare class CyclicTypeError extends Error {
267
240
  constructor(message: string);
268
241
  }
@@ -272,8 +245,6 @@ declare class CollisionError extends Error {
272
245
  declare class UnsupportedSchemaError extends Error {
273
246
  constructor(message: string);
274
247
  }
275
- //#endregion
276
- //#region src/emit/types-interface.d.ts
277
248
  interface EmitTypesInterfaceOptions {
278
249
  /** UPPERCASE ABAP global interface name, e.g. 'ZIF_PETSTORE_TYPES'. */
279
250
  readonly name: string;
@@ -294,8 +265,6 @@ declare class PolymorphismConflictError extends Error {
294
265
  constructor(message: string);
295
266
  }
296
267
  declare function emitTypesInterface(spec: NormalizedSpec, plan: TypePlan, opts: EmitTypesInterfaceOptions): EmitTypesInterfaceResult;
297
- //#endregion
298
- //#region src/emit/operations-interface.d.ts
299
268
  interface EmitOperationsInterfaceOptions {
300
269
  /** Global interface name, e.g. 'ZIF_PETSTORE'. */
301
270
  readonly name: string;
@@ -334,8 +303,6 @@ interface EmitOperationsInterfaceResult {
334
303
  readonly operations: readonly OperationMapping[];
335
304
  }
336
305
  declare function emitOperationsInterface(spec: NormalizedSpec, _plan: TypePlan, opts: EmitOperationsInterfaceOptions): EmitOperationsInterfaceResult;
337
- //#endregion
338
- //#region src/emit/exception-class.d.ts
339
306
  interface EmitExceptionClassOptions {
340
307
  /** Global ABAP class name, e.g. `ZCX_PETSTORE_ERROR`. */
341
308
  readonly name: string;
@@ -346,8 +313,6 @@ interface EmitExceptionClassResult {
346
313
  readonly class: ClassDef;
347
314
  }
348
315
  declare function emitExceptionClass(opts: EmitExceptionClassOptions): EmitExceptionClassResult;
349
- //#endregion
350
- //#region src/emit/local-classes.d.ts
351
316
  interface LocalClassesBundle {
352
317
  /** Content for <cls>.clas.locals_def.abap. */
353
318
  localsDef: string;
@@ -355,8 +320,6 @@ interface LocalClassesBundle {
355
320
  localsImp: string;
356
321
  }
357
322
  declare function emitLocalClasses(names: ResolvedNames): LocalClassesBundle;
358
- //#endregion
359
- //#region src/emit/response-mapper.d.ts
360
323
  type SuccessBodyKind = {
361
324
  kind: 'json';
362
325
  returningName: string;
@@ -384,8 +347,6 @@ interface ResponseMapperResult {
384
347
  source: string;
385
348
  }
386
349
  declare function mapResponseHandling(operation: NormalizedOperation, opts: ResponseMapperOptions): ResponseMapperResult;
387
- //#endregion
388
- //#region src/format/types.d.ts
389
350
  /**
390
351
  * Shared types for format plugins (abapGit / gCTS).
391
352
  *
@@ -425,16 +386,10 @@ interface WriteResult {
425
386
  /** Relative paths written, sorted, forward-slash normalised. */
426
387
  files: readonly string[];
427
388
  }
428
- //#endregion
429
- //#region src/format/abapgit.d.ts
430
389
  declare function writeAbapgitLayout(artifact: ClassArtifact, outDir: string): Promise<WriteResult>;
431
390
  declare function writeAbapgitInterface(artifact: InterfaceArtifact, outDir: string): Promise<WriteResult>;
432
- //#endregion
433
- //#region src/format/gcts.d.ts
434
391
  declare function writeGctsLayout(artifact: ClassArtifact, outDir: string): Promise<WriteResult>;
435
392
  declare function writeGctsInterface(artifact: InterfaceArtifact, outDir: string): Promise<WriteResult>;
436
- //#endregion
437
- //#region src/format/index.d.ts
438
393
  declare function writeLayout(artifact: ClassArtifact | InterfaceArtifact, format: OutputFormat, outDir: string): Promise<WriteResult>;
439
394
  interface ClientBundle {
440
395
  types: InterfaceArtifact;
@@ -443,8 +398,6 @@ interface ClientBundle {
443
398
  implementation: ClassArtifact;
444
399
  }
445
400
  declare function writeClientBundle(artifacts: ClientBundle, format: OutputFormat, outDir: string): Promise<WriteResult>;
446
- //#endregion
447
- //#region src/generate.d.ts
448
401
  type GenerateTarget = 's4-cloud' | 's4-onprem-modern' | 'on-prem-classic';
449
402
  interface GenerateOptions {
450
403
  /** Path to the OpenAPI spec file, a URL, or a pre-parsed spec object. */
@@ -488,9 +441,6 @@ interface GenerateResult {
488
441
  operationCount: number;
489
442
  }
490
443
  declare function generate(options: GenerateOptions): Promise<GenerateResult>;
491
- //#endregion
492
- //#region src/index.d.ts
493
444
  declare const OPENAI_CODEGEN_VERSION = "0.2.0";
494
- //#endregion
495
445
  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
446
  //# sourceMappingURL=index.d.mts.map
@@ -1 +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;;UAGT;EACf;EACA,QAAQ;EACR;EACA;EACA;EACA;EACA;EACA,YAAY;EACZ,cAAc;EACd,WAAW;EACX,UAAU;;UAGK;EACf;EACA;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ACX,QAAQ,cACR,iBACC,QAAQ;;;KClDC;UAKK;;EAEf,gBAAgB;;EAEhB;;EAEA;;EAEA,SAAS;;;;;EAKT,OAAO;;;;;;EAMP;;;;;EAKA;;;;;EAKA;;UAGe;;EAEf;;EAEA,eAAe;;EAEf;;EAEA;;iBA6BoB,SACpB,SAAS,kBACR,QAAQ;;;cCzGE"}
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;;UAGT;EACf;EACA,QAAQ;EACR;EACA;EACA;EACA;EACA;EACA,YAAY;EACZ,cAAc;EACd,WAAW;EACX,UAAU;;UAGK;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA,QAA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EAKA;;;;;EAKA;;UAGe;;EAEf;;EAEA,eAAe;;EAEf;;EAEA;;iBA6BoB,SACpB,SAAS,kBACR,QAAQ;cCzGE"}
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { C as makeNameAllocator, D as isRef, E as normalizeSpec, S as UnsupportedSchemaError, T as loadSpec, _ as mapSchemaToTypeDef, a as writeGctsLayout, b as CollisionError, c as mapResponseHandling, d as emitOperationsInterface, f as PolymorphismConflictError, g as mapPrimitive, h as resolveNames, i as writeGctsInterface, l as emitLocalClasses, m as NamesConfigError, n as writeClientBundle, o as writeAbapgitInterface, p as emitTypesInterface, r as writeLayout, s as writeAbapgitLayout, t as generate, u as emitExceptionClass, v as mapSchemaToTypeRef, w as sanitizeIdent, x as CyclicTypeError, y as planTypes } from "./generate-BobARM00.mjs";
1
+ import { C as makeNameAllocator, D as isRef, E as normalizeSpec, S as UnsupportedSchemaError, T as loadSpec, _ as mapSchemaToTypeDef, a as writeGctsLayout, b as CollisionError, c as mapResponseHandling, d as emitOperationsInterface, f as PolymorphismConflictError, g as mapPrimitive, h as resolveNames, i as writeGctsInterface, l as emitLocalClasses, m as NamesConfigError, n as writeClientBundle, o as writeAbapgitInterface, p as emitTypesInterface, r as writeLayout, s as writeAbapgitLayout, t as generate, u as emitExceptionClass, v as mapSchemaToTypeRef, w as sanitizeIdent, x as CyclicTypeError, y as planTypes } from "./generate-DgXsowgP.mjs";
2
2
 
3
- //#region src/oas/iterate.ts
3
+ // src/oas/iterate.ts
4
4
  /**
5
5
  * Depth-first walk over every distinct schema reachable from a normalized
6
6
  * spec. Ordering is deterministic: components.schemas (by insertion order),
@@ -84,8 +84,7 @@ function isRecord(x) {
84
84
  return typeof x === "object" && x !== null && !Array.isArray(x);
85
85
  }
86
86
 
87
- //#endregion
88
- //#region src/profiles/errors.ts
87
+ // src/profiles/errors.ts
89
88
  var WhitelistViolationError = class extends Error {
90
89
  className;
91
90
  profileId;
@@ -97,8 +96,7 @@ var WhitelistViolationError = class extends Error {
97
96
  }
98
97
  };
99
98
 
100
- //#endregion
101
- //#region src/profiles/cloud.ts
99
+ // src/profiles/cloud.ts
102
100
  const s4CloudProfile = {
103
101
  id: "s4-cloud",
104
102
  description: "SAP S/4HANA Cloud (Steampunk) — uses if_web_http_client with destination provider and /ui2/cl_json (released for ABAP for Cloud Development per SAP Note 2931335).",
@@ -129,8 +127,7 @@ const s4CloudProfile = {
129
127
  ])
130
128
  };
131
129
 
132
- //#endregion
133
- //#region src/profiles/onprem-classic.ts
130
+ // src/profiles/onprem-classic.ts
134
131
  const onPremClassicProfile = {
135
132
  id: "on-prem-classic",
136
133
  description: "TODO: Classic on-prem NetWeaver — uses if_http_client via cl_http_client and /ui2/cl_json for JSON.",
@@ -151,8 +148,7 @@ const onPremClassicProfile = {
151
148
  ])
152
149
  };
153
150
 
154
- //#endregion
155
- //#region src/profiles/onprem-modern.ts
151
+ // src/profiles/onprem-modern.ts
156
152
  const s4OnPremModernProfile = {
157
153
  id: "s4-onprem-modern",
158
154
  description: "TODO: S/4HANA on-prem modern — uses if_web_http_client with destination provider, plus /ui2/cl_json for JSON.",
@@ -177,8 +173,7 @@ const s4OnPremModernProfile = {
177
173
  ])
178
174
  };
179
175
 
180
- //#endregion
181
- //#region src/profiles/registry.ts
176
+ // src/profiles/registry.ts
182
177
  const PROFILES = {
183
178
  "on-prem-classic": onPremClassicProfile,
184
179
  "s4-onprem-modern": s4OnPremModernProfile,
@@ -203,8 +198,7 @@ function assertClassAllowed(profile, className) {
203
198
  if (!normalizeAllowed(profile.allowedClasses).has(className.toLowerCase())) throw new WhitelistViolationError(className, profile.id);
204
199
  }
205
200
 
206
- //#endregion
207
- //#region src/types/emit.ts
201
+ // src/types/emit.ts
208
202
  /** Emit all TypeDef nodes for the given plan, in topological order. */
209
203
  function emitTypeSection(plan, _profile) {
210
204
  const out = [];
@@ -215,10 +209,8 @@ function emitTypeSection(plan, _profile) {
215
209
  return out;
216
210
  }
217
211
 
218
- //#endregion
219
- //#region src/index.ts
212
+ // src/index.ts
220
213
  const OPENAI_CODEGEN_VERSION = "0.2.0";
221
214
 
222
- //#endregion
223
215
  export { ALL_PROFILES, CollisionError, CyclicTypeError, NamesConfigError, OPENAI_CODEGEN_VERSION, PolymorphismConflictError, UnsupportedSchemaError, WhitelistViolationError, 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 };
224
216
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/oas/iterate.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/emit.ts","../src/index.ts"],"sourcesContent":["import type {\n JsonSchema,\n NormalizedOperation,\n NormalizedSpec,\n} from './types.js';\n\nexport interface SchemaVisit {\n path: string[];\n schema: JsonSchema;\n}\n\nexport type SchemaVisitor = (visit: SchemaVisit) => void;\n\n/**\n * Depth-first walk over every distinct schema reachable from a normalized\n * spec. Ordering is deterministic: components.schemas (by insertion order),\n * then operations in spec order, with each operation yielding\n * `parameters → requestBody → responses`. Inside each schema we descend into\n * `properties`, `items`, `additionalProperties`, `allOf`/`anyOf`/`oneOf`, and\n * `not`.\n */\nexport function walkSchemas(spec: NormalizedSpec, cb: SchemaVisitor): void {\n const seen = new WeakSet<object>();\n\n const visit = (schema: unknown, path: string[]): void => {\n if (!isRecord(schema)) return;\n if (seen.has(schema)) return;\n seen.add(schema);\n cb({ path, schema });\n\n if (isRecord(schema.properties)) {\n for (const [name, sub] of Object.entries(schema.properties)) {\n visit(sub, [...path, 'properties', name]);\n }\n }\n if (schema.items !== undefined) {\n visit(schema.items, [...path, 'items']);\n }\n if (\n schema.additionalProperties !== undefined &&\n schema.additionalProperties !== true &&\n schema.additionalProperties !== false\n ) {\n visit(schema.additionalProperties, [...path, 'additionalProperties']);\n }\n for (const combinator of ['allOf', 'anyOf', 'oneOf'] as const) {\n const arr = schema[combinator];\n if (Array.isArray(arr)) {\n arr.forEach((sub, idx) => {\n visit(sub, [...path, combinator, String(idx)]);\n });\n }\n }\n if (schema.not !== undefined) {\n visit(schema.not, [...path, 'not']);\n }\n };\n\n for (const [name, schema] of Object.entries(spec.schemas)) {\n visit(schema, ['components', 'schemas', name]);\n }\n\n for (const op of spec.operations) {\n const base = ['operations', operationKey(op)];\n for (const p of op.parameters) {\n visit(p.schema, [...base, 'parameters', `${p.in}:${p.name}`]);\n }\n if (op.requestBody !== undefined) {\n for (const [mt, mtObj] of Object.entries(op.requestBody.content)) {\n visit(mtObj.schema, [...base, 'requestBody', mt]);\n }\n }\n for (const resp of op.responses) {\n for (const [mt, mtObj] of Object.entries(resp.content)) {\n visit(mtObj.schema, [...base, 'responses', resp.statusCode, mt]);\n }\n for (const [hn, h] of Object.entries(resp.headers)) {\n visit(h.schema, [...base, 'responses', resp.statusCode, 'headers', hn]);\n }\n }\n }\n}\n\n/** Stable key used to identify an operation, e.g. `GET /pet/{petId}`. */\nexport function operationKey(op: NormalizedOperation): string {\n return `${op.method.toUpperCase()} ${op.path}`;\n}\n\nfunction isRecord(x: unknown): x is Record<string, unknown> {\n return typeof x === 'object' && x !== null && !Array.isArray(x);\n}\n","export class WhitelistViolationError extends Error {\n readonly className: string;\n readonly profileId: string;\n\n constructor(className: string, profileId: string) {\n super(\n `Class '${className}' is not in the allow-list for target profile '${profileId}'.`,\n );\n this.name = 'WhitelistViolationError';\n this.className = className;\n this.profileId = profileId;\n }\n}\n","import type { TargetProfile } from './types';\n\nexport const s4CloudProfile: TargetProfile = {\n id: 's4-cloud',\n description:\n 'SAP S/4HANA Cloud (Steampunk) — uses if_web_http_client with destination provider and /ui2/cl_json (released for ABAP for Cloud Development per SAP Note 2931335).',\n http: {\n kind: 'if_web_http_client',\n factoryClass: 'cl_web_http_client_manager',\n destinationProviderClass: 'cl_http_destination_provider',\n },\n json: {\n kind: 'ui2_cl_json',\n helperClass: '/ui2/cl_json',\n },\n allowedClasses: new Set<string>([\n 'cl_web_http_client_manager',\n 'cl_http_destination_provider',\n 'if_web_http_client',\n 'if_web_http_request',\n 'if_web_http_response',\n 'cl_web_http_utility',\n 'cl_system_uuid',\n 'cl_abap_char_utilities',\n 'cl_abap_conv_codepage',\n 'cl_abap_codepage',\n 'cl_abap_conv_out_ce',\n 'cl_abap_conv_in_ce',\n 'cl_abap_typedescr',\n '/ui2/cl_json',\n ]),\n};\n","import type { TargetProfile } from './types';\n\n// TODO: flesh out on-prem classic emitter details (Wave ≥2).\nexport const onPremClassicProfile: TargetProfile = {\n id: 'on-prem-classic',\n description:\n 'TODO: Classic on-prem NetWeaver — uses if_http_client via cl_http_client and /ui2/cl_json for JSON.',\n http: {\n kind: 'if_http_client',\n factoryClass: 'cl_http_client',\n },\n json: {\n kind: 'ui2_cl_json',\n helperClass: '/ui2/cl_json',\n },\n allowedClasses: new Set<string>([\n 'cl_http_client',\n 'if_http_client',\n 'cl_http_utility',\n 'cl_system_uuid',\n '/ui2/cl_json',\n ]),\n};\n","import type { TargetProfile } from './types';\n\n// TODO: flesh out S/4 on-prem modern emitter details (Wave ≥2).\nexport const s4OnPremModernProfile: TargetProfile = {\n id: 's4-onprem-modern',\n description:\n 'TODO: S/4HANA on-prem modern — uses if_web_http_client with destination provider, plus /ui2/cl_json for JSON.',\n http: {\n kind: 'if_web_http_client',\n factoryClass: 'cl_web_http_client_manager',\n destinationProviderClass: 'cl_http_destination_provider',\n },\n json: {\n kind: 'ui2_cl_json',\n helperClass: '/ui2/cl_json',\n },\n allowedClasses: new Set<string>([\n 'cl_web_http_client_manager',\n 'cl_http_destination_provider',\n 'if_web_http_client',\n 'if_web_http_request',\n 'if_web_http_response',\n 'cl_http_utility',\n 'cl_system_uuid',\n '/ui2/cl_json',\n ]),\n};\n","import { s4CloudProfile } from './cloud';\nimport { onPremClassicProfile } from './onprem-classic';\nimport { s4OnPremModernProfile } from './onprem-modern';\nimport { WhitelistViolationError } from './errors';\nimport type { TargetProfile, TargetProfileId } from './types';\n\nconst PROFILES: Readonly<Record<TargetProfileId, TargetProfile>> = {\n 'on-prem-classic': onPremClassicProfile,\n 's4-onprem-modern': s4OnPremModernProfile,\n 's4-cloud': s4CloudProfile,\n};\n\nexport const ALL_PROFILES: ReadonlyArray<TargetProfileId> = [\n 'on-prem-classic',\n 's4-onprem-modern',\n 's4-cloud',\n];\n\nexport function getProfile(id: TargetProfileId): TargetProfile {\n const profile = PROFILES[id];\n if (!profile) {\n throw new Error(`Unknown target profile: ${String(id)}`);\n }\n return profile;\n}\n\nfunction normalizeAllowed(set: ReadonlySet<string>): Set<string> {\n const out = new Set<string>();\n for (const item of set) {\n out.add(item.toLowerCase());\n }\n return out;\n}\n\nexport function assertClassAllowed(\n profile: TargetProfile,\n className: string,\n): void {\n const normalized = normalizeAllowed(profile.allowedClasses);\n if (!normalized.has(className.toLowerCase())) {\n throw new WhitelistViolationError(className, profile.id);\n }\n}\n","import type { TypeDef } from '@abapify/abap-ast';\nimport type { TargetProfile } from '../profiles/index';\nimport type { TypePlan } from './plan';\nimport { mapSchemaToTypeDef } from './map';\n\n/** Emit all TypeDef nodes for the given plan, in topological order. */\nexport function emitTypeSection(\n plan: TypePlan,\n _profile: TargetProfile,\n): TypeDef[] {\n // Profile is accepted for forward-compat (e.g. per-profile type substitutions)\n // but currently does not alter emission. Silence unused-var lint.\n void _profile;\n const out: TypeDef[] = [];\n for (const entry of plan.entries) {\n const { typeDef } = mapSchemaToTypeDef(entry, plan);\n out.push(typeDef);\n }\n return out;\n}\n","export const OPENAI_CODEGEN_VERSION = '0.2.0';\n\nexport * from './oas/index';\nexport * from './profiles/index';\nexport * from './types/index';\nexport * from './emit/index';\nexport * from './format/index';\nexport { generate } from './generate';\nexport type {\n GenerateOptions,\n GenerateResult,\n GenerateTarget,\n} from './generate';\n"],"mappings":";;;;;;;;;;;AAqBA,SAAgB,YAAY,MAAsB,IAAyB;CACzE,MAAM,uBAAO,IAAI,QAAgB;CAEjC,MAAM,SAAS,QAAiB,SAAyB;EACvD,IAAI,CAAC,SAAS,MAAM,GAAG;EACvB,IAAI,KAAK,IAAI,MAAM,GAAG;EACtB,KAAK,IAAI,MAAM;EACf,GAAG;GAAE;GAAM;EAAO,CAAC;EAEnB,IAAI,SAAS,OAAO,UAAU,GAC5B,KAAK,MAAM,CAAC,MAAM,QAAQ,OAAO,QAAQ,OAAO,UAAU,GACxD,MAAM,KAAK;GAAC,GAAG;GAAM;GAAc;EAAI,CAAC;EAG5C,IAAI,OAAO,UAAU,QACnB,MAAM,OAAO,OAAO,CAAC,GAAG,MAAM,OAAO,CAAC;EAExC,IACE,OAAO,yBAAyB,UAChC,OAAO,yBAAyB,QAChC,OAAO,yBAAyB,OAEhC,MAAM,OAAO,sBAAsB,CAAC,GAAG,MAAM,sBAAsB,CAAC;EAEtE,KAAK,MAAM,cAAc;GAAC;GAAS;GAAS;EAAO,GAAY;GAC7D,MAAM,MAAM,OAAO;GACnB,IAAI,MAAM,QAAQ,GAAG,GACnB,IAAI,SAAS,KAAK,QAAQ;IACxB,MAAM,KAAK;KAAC,GAAG;KAAM;KAAY,OAAO,GAAG;IAAC,CAAC;GAC/C,CAAC;EAEL;EACA,IAAI,OAAO,QAAQ,QACjB,MAAM,OAAO,KAAK,CAAC,GAAG,MAAM,KAAK,CAAC;CAEtC;CAEA,KAAK,MAAM,CAAC,MAAM,WAAW,OAAO,QAAQ,KAAK,OAAO,GACtD,MAAM,QAAQ;EAAC;EAAc;EAAW;CAAI,CAAC;CAG/C,KAAK,MAAM,MAAM,KAAK,YAAY;EAChC,MAAM,OAAO,CAAC,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file":"index.mjs","names":[],"sources":["../src/oas/iterate.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/emit.ts","../src/index.ts"],"sourcesContent":["import type {\n JsonSchema,\n NormalizedOperation,\n NormalizedSpec,\n} from './types.js';\n\nexport interface SchemaVisit {\n path: string[];\n schema: JsonSchema;\n}\n\nexport type SchemaVisitor = (visit: SchemaVisit) => void;\n\n/**\n * Depth-first walk over every distinct schema reachable from a normalized\n * spec. Ordering is deterministic: components.schemas (by insertion order),\n * then operations in spec order, with each operation yielding\n * `parameters → requestBody → responses`. Inside each schema we descend into\n * `properties`, `items`, `additionalProperties`, `allOf`/`anyOf`/`oneOf`, and\n * `not`.\n */\nexport function walkSchemas(spec: NormalizedSpec, cb: SchemaVisitor): void {\n const seen = new WeakSet<object>();\n\n const visit = (schema: unknown, path: string[]): void => {\n if (!isRecord(schema)) return;\n if (seen.has(schema)) return;\n seen.add(schema);\n cb({ path, schema });\n\n if (isRecord(schema.properties)) {\n for (const [name, sub] of Object.entries(schema.properties)) {\n visit(sub, [...path, 'properties', name]);\n }\n }\n if (schema.items !== undefined) {\n visit(schema.items, [...path, 'items']);\n }\n if (\n schema.additionalProperties !== undefined &&\n schema.additionalProperties !== true &&\n schema.additionalProperties !== false\n ) {\n visit(schema.additionalProperties, [...path, 'additionalProperties']);\n }\n for (const combinator of ['allOf', 'anyOf', 'oneOf'] as const) {\n const arr = schema[combinator];\n if (Array.isArray(arr)) {\n arr.forEach((sub, idx) => {\n visit(sub, [...path, combinator, String(idx)]);\n });\n }\n }\n if (schema.not !== undefined) {\n visit(schema.not, [...path, 'not']);\n }\n };\n\n for (const [name, schema] of Object.entries(spec.schemas)) {\n visit(schema, ['components', 'schemas', name]);\n }\n\n for (const op of spec.operations) {\n const base = ['operations', operationKey(op)];\n for (const p of op.parameters) {\n visit(p.schema, [...base, 'parameters', `${p.in}:${p.name}`]);\n }\n if (op.requestBody !== undefined) {\n for (const [mt, mtObj] of Object.entries(op.requestBody.content)) {\n visit(mtObj.schema, [...base, 'requestBody', mt]);\n }\n }\n for (const resp of op.responses) {\n for (const [mt, mtObj] of Object.entries(resp.content)) {\n visit(mtObj.schema, [...base, 'responses', resp.statusCode, mt]);\n }\n for (const [hn, h] of Object.entries(resp.headers)) {\n visit(h.schema, [...base, 'responses', resp.statusCode, 'headers', hn]);\n }\n }\n }\n}\n\n/** Stable key used to identify an operation, e.g. `GET /pet/{petId}`. */\nexport function operationKey(op: NormalizedOperation): string {\n return `${op.method.toUpperCase()} ${op.path}`;\n}\n\nfunction isRecord(x: unknown): x is Record<string, unknown> {\n return typeof x === 'object' && x !== null && !Array.isArray(x);\n}\n","export class WhitelistViolationError extends Error {\n readonly className: string;\n readonly profileId: string;\n\n constructor(className: string, profileId: string) {\n super(\n `Class '${className}' is not in the allow-list for target profile '${profileId}'.`,\n );\n this.name = 'WhitelistViolationError';\n this.className = className;\n this.profileId = profileId;\n }\n}\n","import type { TargetProfile } from './types';\n\nexport const s4CloudProfile: TargetProfile = {\n id: 's4-cloud',\n description:\n 'SAP S/4HANA Cloud (Steampunk) — uses if_web_http_client with destination provider and /ui2/cl_json (released for ABAP for Cloud Development per SAP Note 2931335).',\n http: {\n kind: 'if_web_http_client',\n factoryClass: 'cl_web_http_client_manager',\n destinationProviderClass: 'cl_http_destination_provider',\n },\n json: {\n kind: 'ui2_cl_json',\n helperClass: '/ui2/cl_json',\n },\n allowedClasses: new Set<string>([\n 'cl_web_http_client_manager',\n 'cl_http_destination_provider',\n 'if_web_http_client',\n 'if_web_http_request',\n 'if_web_http_response',\n 'cl_web_http_utility',\n 'cl_system_uuid',\n 'cl_abap_char_utilities',\n 'cl_abap_conv_codepage',\n 'cl_abap_codepage',\n 'cl_abap_conv_out_ce',\n 'cl_abap_conv_in_ce',\n 'cl_abap_typedescr',\n '/ui2/cl_json',\n ]),\n};\n","import type { TargetProfile } from './types';\n\n// TODO: flesh out on-prem classic emitter details (Wave ≥2).\nexport const onPremClassicProfile: TargetProfile = {\n id: 'on-prem-classic',\n description:\n 'TODO: Classic on-prem NetWeaver — uses if_http_client via cl_http_client and /ui2/cl_json for JSON.',\n http: {\n kind: 'if_http_client',\n factoryClass: 'cl_http_client',\n },\n json: {\n kind: 'ui2_cl_json',\n helperClass: '/ui2/cl_json',\n },\n allowedClasses: new Set<string>([\n 'cl_http_client',\n 'if_http_client',\n 'cl_http_utility',\n 'cl_system_uuid',\n '/ui2/cl_json',\n ]),\n};\n","import type { TargetProfile } from './types';\n\n// TODO: flesh out S/4 on-prem modern emitter details (Wave ≥2).\nexport const s4OnPremModernProfile: TargetProfile = {\n id: 's4-onprem-modern',\n description:\n 'TODO: S/4HANA on-prem modern — uses if_web_http_client with destination provider, plus /ui2/cl_json for JSON.',\n http: {\n kind: 'if_web_http_client',\n factoryClass: 'cl_web_http_client_manager',\n destinationProviderClass: 'cl_http_destination_provider',\n },\n json: {\n kind: 'ui2_cl_json',\n helperClass: '/ui2/cl_json',\n },\n allowedClasses: new Set<string>([\n 'cl_web_http_client_manager',\n 'cl_http_destination_provider',\n 'if_web_http_client',\n 'if_web_http_request',\n 'if_web_http_response',\n 'cl_http_utility',\n 'cl_system_uuid',\n '/ui2/cl_json',\n ]),\n};\n","import { s4CloudProfile } from './cloud';\nimport { onPremClassicProfile } from './onprem-classic';\nimport { s4OnPremModernProfile } from './onprem-modern';\nimport { WhitelistViolationError } from './errors';\nimport type { TargetProfile, TargetProfileId } from './types';\n\nconst PROFILES: Readonly<Record<TargetProfileId, TargetProfile>> = {\n 'on-prem-classic': onPremClassicProfile,\n 's4-onprem-modern': s4OnPremModernProfile,\n 's4-cloud': s4CloudProfile,\n};\n\nexport const ALL_PROFILES: ReadonlyArray<TargetProfileId> = [\n 'on-prem-classic',\n 's4-onprem-modern',\n 's4-cloud',\n];\n\nexport function getProfile(id: TargetProfileId): TargetProfile {\n const profile = PROFILES[id];\n if (!profile) {\n throw new Error(`Unknown target profile: ${String(id)}`);\n }\n return profile;\n}\n\nfunction normalizeAllowed(set: ReadonlySet<string>): Set<string> {\n const out = new Set<string>();\n for (const item of set) {\n out.add(item.toLowerCase());\n }\n return out;\n}\n\nexport function assertClassAllowed(\n profile: TargetProfile,\n className: string,\n): void {\n const normalized = normalizeAllowed(profile.allowedClasses);\n if (!normalized.has(className.toLowerCase())) {\n throw new WhitelistViolationError(className, profile.id);\n }\n}\n","import type { TypeDef } from '@abapify/abap-ast';\nimport type { TargetProfile } from '../profiles/index';\nimport type { TypePlan } from './plan';\nimport { mapSchemaToTypeDef } from './map';\n\n/** Emit all TypeDef nodes for the given plan, in topological order. */\nexport function emitTypeSection(\n plan: TypePlan,\n _profile: TargetProfile,\n): TypeDef[] {\n // Profile is accepted for forward-compat (e.g. per-profile type substitutions)\n // but currently does not alter emission. Silence unused-var lint.\n void _profile;\n const out: TypeDef[] = [];\n for (const entry of plan.entries) {\n const { typeDef } = mapSchemaToTypeDef(entry, plan);\n out.push(typeDef);\n }\n return out;\n}\n","export const OPENAI_CODEGEN_VERSION = '0.2.0';\n\nexport * from './oas/index';\nexport * from './profiles/index';\nexport * from './types/index';\nexport * from './emit/index';\nexport * from './format/index';\nexport { generate } from './generate';\nexport type {\n GenerateOptions,\n GenerateResult,\n GenerateTarget,\n} from './generate';\n"],"mappings":";;;;;;;;;;;AAqBA,SAAgB,YAAY,MAAsB,IAAyB;CACzE,MAAM,uBAAO,IAAI,QAAgB;CAEjC,MAAM,SAAS,QAAiB,SAAyB;EACvD,IAAI,CAAC,SAAS,MAAM,GAAG;EACvB,IAAI,KAAK,IAAI,MAAM,GAAG;EACtB,KAAK,IAAI,MAAM;EACf,GAAG;GAAE;GAAM;EAAO,CAAC;EAEnB,IAAI,SAAS,OAAO,UAAU,GAC5B,KAAK,MAAM,CAAC,MAAM,QAAQ,OAAO,QAAQ,OAAO,UAAU,GACxD,MAAM,KAAK;GAAC,GAAG;GAAM;GAAc;EAAI,CAAC;EAG5C,IAA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A;CACA;AACF;AAEA,SAAgB,WAAW,IAAoC;CAC7D,MAAM,UAAU,SAAS;CACzB,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,2BAA2B,OAAO,EAAE,GAAG;CAEzD,OAAO;AACT;AAEA,SAAS,iBAAiB,KAAuC;CAC/D,MAAM,sBAAM,IAAI,IAAY;CAC5B,KAAK,MAAM,QAAQ,KACjB,IAAI,IAAI,KAAK,YAAY,CAAC;CAE5B,OAAO;AACT;AAEA,SAAgB,mBACd,SACA,WACM;CAEN,IAAI,CADe,iBAAiB,QAAQ,cAC9B,CAAC,CAAC,IAAI,UAAU,YAAY,CAAC,GACzC,MAAM,IAAI,wBAAwB,WAAW,QAAQ,EAAE;AAE3D;;;;ACpCA,SAAgB,gBACd,MACA,UACW;CAIX,MAAM,MAAiB,CAAC;CACxB,KAAK,MAAM,SAAS,KAAK,SAAS;EAChC,MAAM,EAAE,YAAY,mBAAmB,OAAO,IAAI;EAClD,IAAI,KAAK,OAAO;CAClB;CACA,OAAO;AACT;;;ACnBA,MAAa,yBAAyB"}
@@ -1,4 +1,3 @@
1
- //#region src/emit/naming.d.ts
2
1
  /**
3
2
  * Central name derivation for the v2 openai-codegen emitter pipeline.
4
3
  *
@@ -42,6 +41,5 @@ declare class NamesConfigError extends Error {
42
41
  constructor(message: string);
43
42
  }
44
43
  declare function resolveNames(config?: NamesConfig): ResolvedNames;
45
- //#endregion
46
44
  export { resolveNames as i, NamesConfigError as n, ResolvedNames as r, NamesConfig as t };
47
- //# sourceMappingURL=naming-9hJCZKjv.d.mts.map
45
+ //# sourceMappingURL=naming-D7P_Kp_Q.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"naming-D7P_Kp_Q.d.mts","names":[],"sources":["../src/emit/naming.ts"],"mappings":";;;;;;;;;;;;;;;UAgBiB;;EAEf;;EAEA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;cAGW,yBAAyB;EACxB,YAAA;;iBA8EE,aAAa,SAAS,cAAc"}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.4.17",
6
+ "version": "0.4.19",
7
7
  "description": "Deterministic OpenAPI → ABAP client code generator. Emits a single zero-dependency ABAP class per OpenAPI spec, targeting SAP Cloud / on-prem profiles, packaged as abapGit or gCTS.",
8
8
  "type": "module",
9
9
  "types": "./dist/index.d.mts",
@@ -16,7 +16,7 @@
16
16
  "./package.json": "./package.json"
17
17
  },
18
18
  "dependencies": {
19
- "@abapify/abap-ast": "0.4.17",
19
+ "@abapify/abap-ast": "0.4.19",
20
20
  "@apidevtools/swagger-parser": "^10.1.0",
21
21
  "commander": "^11.1.0",
22
22
  "fast-xml-parser": "^5.5.0",
@@ -38,7 +38,7 @@
38
38
  "license": "MIT",
39
39
  "devDependencies": {
40
40
  "@abaplint/core": "^2.118.12",
41
- "@abapify/aclass": "0.4.17"
41
+ "@abapify/aclass": "0.4.19"
42
42
  },
43
43
  "repository": {
44
44
  "type": "git",
@@ -1 +0,0 @@
1
- {"version":3,"file":"naming-9hJCZKjv.d.mts","names":[],"sources":["../src/emit/naming.ts"],"mappings":";;;;;;;;;;;;;;;;UAgBiB;;EAEf;;EAEA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;cAGW,yBAAyB;EACxB,YAAA;;iBA8EE,aAAa,SAAS,cAAc"}