@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.mjs
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
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";
|
|
2
|
+
|
|
3
|
+
//#region src/oas/iterate.ts
|
|
4
|
+
/**
|
|
5
|
+
* Depth-first walk over every distinct schema reachable from a normalized
|
|
6
|
+
* spec. Ordering is deterministic: components.schemas (by insertion order),
|
|
7
|
+
* then operations in spec order, with each operation yielding
|
|
8
|
+
* `parameters → requestBody → responses`. Inside each schema we descend into
|
|
9
|
+
* `properties`, `items`, `additionalProperties`, `allOf`/`anyOf`/`oneOf`, and
|
|
10
|
+
* `not`.
|
|
11
|
+
*/
|
|
12
|
+
function walkSchemas(spec, cb) {
|
|
13
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
14
|
+
const visit = (schema, path) => {
|
|
15
|
+
if (!isRecord(schema)) return;
|
|
16
|
+
if (seen.has(schema)) return;
|
|
17
|
+
seen.add(schema);
|
|
18
|
+
cb({
|
|
19
|
+
path,
|
|
20
|
+
schema
|
|
21
|
+
});
|
|
22
|
+
if (isRecord(schema.properties)) for (const [name, sub] of Object.entries(schema.properties)) visit(sub, [
|
|
23
|
+
...path,
|
|
24
|
+
"properties",
|
|
25
|
+
name
|
|
26
|
+
]);
|
|
27
|
+
if (schema.items !== void 0) visit(schema.items, [...path, "items"]);
|
|
28
|
+
if (schema.additionalProperties !== void 0 && schema.additionalProperties !== true && schema.additionalProperties !== false) visit(schema.additionalProperties, [...path, "additionalProperties"]);
|
|
29
|
+
for (const combinator of [
|
|
30
|
+
"allOf",
|
|
31
|
+
"anyOf",
|
|
32
|
+
"oneOf"
|
|
33
|
+
]) {
|
|
34
|
+
const arr = schema[combinator];
|
|
35
|
+
if (Array.isArray(arr)) arr.forEach((sub, idx) => {
|
|
36
|
+
visit(sub, [
|
|
37
|
+
...path,
|
|
38
|
+
combinator,
|
|
39
|
+
String(idx)
|
|
40
|
+
]);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
if (schema.not !== void 0) visit(schema.not, [...path, "not"]);
|
|
44
|
+
};
|
|
45
|
+
for (const [name, schema] of Object.entries(spec.schemas)) visit(schema, [
|
|
46
|
+
"components",
|
|
47
|
+
"schemas",
|
|
48
|
+
name
|
|
49
|
+
]);
|
|
50
|
+
for (const op of spec.operations) {
|
|
51
|
+
const base = ["operations", operationKey(op)];
|
|
52
|
+
for (const p of op.parameters) visit(p.schema, [
|
|
53
|
+
...base,
|
|
54
|
+
"parameters",
|
|
55
|
+
`${p.in}:${p.name}`
|
|
56
|
+
]);
|
|
57
|
+
if (op.requestBody !== void 0) for (const [mt, mtObj] of Object.entries(op.requestBody.content)) visit(mtObj.schema, [
|
|
58
|
+
...base,
|
|
59
|
+
"requestBody",
|
|
60
|
+
mt
|
|
61
|
+
]);
|
|
62
|
+
for (const resp of op.responses) {
|
|
63
|
+
for (const [mt, mtObj] of Object.entries(resp.content)) visit(mtObj.schema, [
|
|
64
|
+
...base,
|
|
65
|
+
"responses",
|
|
66
|
+
resp.statusCode,
|
|
67
|
+
mt
|
|
68
|
+
]);
|
|
69
|
+
for (const [hn, h] of Object.entries(resp.headers)) visit(h.schema, [
|
|
70
|
+
...base,
|
|
71
|
+
"responses",
|
|
72
|
+
resp.statusCode,
|
|
73
|
+
"headers",
|
|
74
|
+
hn
|
|
75
|
+
]);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/** Stable key used to identify an operation, e.g. `GET /pet/{petId}`. */
|
|
80
|
+
function operationKey(op) {
|
|
81
|
+
return `${op.method.toUpperCase()} ${op.path}`;
|
|
82
|
+
}
|
|
83
|
+
function isRecord(x) {
|
|
84
|
+
return typeof x === "object" && x !== null && !Array.isArray(x);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/profiles/errors.ts
|
|
89
|
+
var WhitelistViolationError = class extends Error {
|
|
90
|
+
className;
|
|
91
|
+
profileId;
|
|
92
|
+
constructor(className, profileId) {
|
|
93
|
+
super(`Class '${className}' is not in the allow-list for target profile '${profileId}'.`);
|
|
94
|
+
this.name = "WhitelistViolationError";
|
|
95
|
+
this.className = className;
|
|
96
|
+
this.profileId = profileId;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region src/profiles/cloud.ts
|
|
102
|
+
const s4CloudProfile = {
|
|
103
|
+
id: "s4-cloud",
|
|
104
|
+
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).",
|
|
105
|
+
http: {
|
|
106
|
+
kind: "if_web_http_client",
|
|
107
|
+
factoryClass: "cl_web_http_client_manager",
|
|
108
|
+
destinationProviderClass: "cl_http_destination_provider"
|
|
109
|
+
},
|
|
110
|
+
json: {
|
|
111
|
+
kind: "ui2_cl_json",
|
|
112
|
+
helperClass: "/ui2/cl_json"
|
|
113
|
+
},
|
|
114
|
+
allowedClasses: /* @__PURE__ */ new Set([
|
|
115
|
+
"cl_web_http_client_manager",
|
|
116
|
+
"cl_http_destination_provider",
|
|
117
|
+
"if_web_http_client",
|
|
118
|
+
"if_web_http_request",
|
|
119
|
+
"if_web_http_response",
|
|
120
|
+
"cl_web_http_utility",
|
|
121
|
+
"cl_system_uuid",
|
|
122
|
+
"cl_abap_char_utilities",
|
|
123
|
+
"cl_abap_conv_codepage",
|
|
124
|
+
"cl_abap_codepage",
|
|
125
|
+
"cl_abap_conv_out_ce",
|
|
126
|
+
"cl_abap_conv_in_ce",
|
|
127
|
+
"cl_abap_typedescr",
|
|
128
|
+
"/ui2/cl_json"
|
|
129
|
+
])
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region src/profiles/onprem-classic.ts
|
|
134
|
+
const onPremClassicProfile = {
|
|
135
|
+
id: "on-prem-classic",
|
|
136
|
+
description: "TODO: Classic on-prem NetWeaver — uses if_http_client via cl_http_client and /ui2/cl_json for JSON.",
|
|
137
|
+
http: {
|
|
138
|
+
kind: "if_http_client",
|
|
139
|
+
factoryClass: "cl_http_client"
|
|
140
|
+
},
|
|
141
|
+
json: {
|
|
142
|
+
kind: "ui2_cl_json",
|
|
143
|
+
helperClass: "/ui2/cl_json"
|
|
144
|
+
},
|
|
145
|
+
allowedClasses: /* @__PURE__ */ new Set([
|
|
146
|
+
"cl_http_client",
|
|
147
|
+
"if_http_client",
|
|
148
|
+
"cl_http_utility",
|
|
149
|
+
"cl_system_uuid",
|
|
150
|
+
"/ui2/cl_json"
|
|
151
|
+
])
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
//#endregion
|
|
155
|
+
//#region src/profiles/onprem-modern.ts
|
|
156
|
+
const s4OnPremModernProfile = {
|
|
157
|
+
id: "s4-onprem-modern",
|
|
158
|
+
description: "TODO: S/4HANA on-prem modern — uses if_web_http_client with destination provider, plus /ui2/cl_json for JSON.",
|
|
159
|
+
http: {
|
|
160
|
+
kind: "if_web_http_client",
|
|
161
|
+
factoryClass: "cl_web_http_client_manager",
|
|
162
|
+
destinationProviderClass: "cl_http_destination_provider"
|
|
163
|
+
},
|
|
164
|
+
json: {
|
|
165
|
+
kind: "ui2_cl_json",
|
|
166
|
+
helperClass: "/ui2/cl_json"
|
|
167
|
+
},
|
|
168
|
+
allowedClasses: /* @__PURE__ */ new Set([
|
|
169
|
+
"cl_web_http_client_manager",
|
|
170
|
+
"cl_http_destination_provider",
|
|
171
|
+
"if_web_http_client",
|
|
172
|
+
"if_web_http_request",
|
|
173
|
+
"if_web_http_response",
|
|
174
|
+
"cl_http_utility",
|
|
175
|
+
"cl_system_uuid",
|
|
176
|
+
"/ui2/cl_json"
|
|
177
|
+
])
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
//#endregion
|
|
181
|
+
//#region src/profiles/registry.ts
|
|
182
|
+
const PROFILES = {
|
|
183
|
+
"on-prem-classic": onPremClassicProfile,
|
|
184
|
+
"s4-onprem-modern": s4OnPremModernProfile,
|
|
185
|
+
"s4-cloud": s4CloudProfile
|
|
186
|
+
};
|
|
187
|
+
const ALL_PROFILES = [
|
|
188
|
+
"on-prem-classic",
|
|
189
|
+
"s4-onprem-modern",
|
|
190
|
+
"s4-cloud"
|
|
191
|
+
];
|
|
192
|
+
function getProfile(id) {
|
|
193
|
+
const profile = PROFILES[id];
|
|
194
|
+
if (!profile) throw new Error(`Unknown target profile: ${String(id)}`);
|
|
195
|
+
return profile;
|
|
196
|
+
}
|
|
197
|
+
function normalizeAllowed(set) {
|
|
198
|
+
const out = /* @__PURE__ */ new Set();
|
|
199
|
+
for (const item of set) out.add(item.toLowerCase());
|
|
200
|
+
return out;
|
|
201
|
+
}
|
|
202
|
+
function assertClassAllowed(profile, className) {
|
|
203
|
+
if (!normalizeAllowed(profile.allowedClasses).has(className.toLowerCase())) throw new WhitelistViolationError(className, profile.id);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region src/types/emit.ts
|
|
208
|
+
/** Emit all TypeDef nodes for the given plan, in topological order. */
|
|
209
|
+
function emitTypeSection(plan, _profile) {
|
|
210
|
+
const out = [];
|
|
211
|
+
for (const entry of plan.entries) {
|
|
212
|
+
const { typeDef } = mapSchemaToTypeDef(entry, plan);
|
|
213
|
+
out.push(typeDef);
|
|
214
|
+
}
|
|
215
|
+
return out;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
//#endregion
|
|
219
|
+
//#region src/index.ts
|
|
220
|
+
const OPENAI_CODEGEN_VERSION = "0.2.0";
|
|
221
|
+
|
|
222
|
+
//#endregion
|
|
223
|
+
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
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +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,CA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AAM,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"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//#region src/emit/naming.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Central name derivation for the v2 openai-codegen emitter pipeline.
|
|
4
|
+
*
|
|
5
|
+
* Each OpenAPI spec emits four global ABAP artifacts:
|
|
6
|
+
* 1. Types interface (ZIF_<BASE>_TYPES)
|
|
7
|
+
* 2. Operations interface (ZIF_<BASE>)
|
|
8
|
+
* 3. Exception class (ZCX_<BASE>_ERROR)
|
|
9
|
+
* 4. Implementation class (ZCL_<BASE>)
|
|
10
|
+
*
|
|
11
|
+
* Plus a handful of local helper classes bundled inside the implementation
|
|
12
|
+
* class (lcl_http, lcl_response, json, lcl_json_parser).
|
|
13
|
+
*
|
|
14
|
+
* All names are overridable individually; the simplest path is to provide a
|
|
15
|
+
* single `base` name from which the four global names are derived.
|
|
16
|
+
*/
|
|
17
|
+
interface NamesConfig {
|
|
18
|
+
/** Logical base name — defaults become ZCL_<upper>, ZIF_<upper>, etc. */
|
|
19
|
+
base?: string;
|
|
20
|
+
/** Override each individually (takes precedence over base-derived). */
|
|
21
|
+
typesInterface?: string;
|
|
22
|
+
operationsInterface?: string;
|
|
23
|
+
implementationClass?: string;
|
|
24
|
+
exceptionClass?: string;
|
|
25
|
+
/** Local class names bundled inside zcl_<name>. */
|
|
26
|
+
localHttpClass?: string;
|
|
27
|
+
localResponseClass?: string;
|
|
28
|
+
localJsonClass?: string;
|
|
29
|
+
localJsonParserClass?: string;
|
|
30
|
+
}
|
|
31
|
+
interface ResolvedNames {
|
|
32
|
+
typesInterface: string;
|
|
33
|
+
operationsInterface: string;
|
|
34
|
+
implementationClass: string;
|
|
35
|
+
exceptionClass: string;
|
|
36
|
+
localHttpClass: string;
|
|
37
|
+
localResponseClass: string;
|
|
38
|
+
localJsonClass: string;
|
|
39
|
+
localJsonParserClass: string;
|
|
40
|
+
}
|
|
41
|
+
declare class NamesConfigError extends Error {
|
|
42
|
+
constructor(message: string);
|
|
43
|
+
}
|
|
44
|
+
declare function resolveNames(config?: NamesConfig): ResolvedNames;
|
|
45
|
+
//#endregion
|
|
46
|
+
export { resolveNames as i, NamesConfigError as n, ResolvedNames as r, NamesConfig as t };
|
|
47
|
+
//# sourceMappingURL=naming-9hJCZKjv.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.4.6",
|
|
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.
|
|
19
|
+
"@abapify/abap-ast": "0.4.6",
|
|
20
20
|
"@apidevtools/swagger-parser": "^10.1.0",
|
|
21
21
|
"commander": "^11.1.0",
|
|
22
22
|
"fast-xml-parser": "^5.5.0",
|
|
@@ -37,7 +37,8 @@
|
|
|
37
37
|
"author": "abapify",
|
|
38
38
|
"license": "MIT",
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@abaplint/core": "^2.118.12"
|
|
40
|
+
"@abaplint/core": "^2.118.12",
|
|
41
|
+
"@abapify/aclass": "0.4.6"
|
|
41
42
|
},
|
|
42
43
|
"repository": {
|
|
43
44
|
"type": "git",
|