@abapify/adt-schemas 0.4.34 → 0.4.38
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 +16 -343
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,362 +1,35 @@
|
|
|
1
1
|
# @abapify/adt-schemas
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/@abapify/adt-schemas)
|
|
4
|
+
[](https://github.com/abapify/adt-cli/blob/main/LICENSE)
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
ADT XML schemas generated from SAP XSD definitions.
|
|
6
7
|
|
|
7
|
-
##
|
|
8
|
-
|
|
9
|
-
This package provides TypeScript schemas for SAP ADT (ABAP Development Tools) REST APIs, auto-generated from SAP's official XSD schema definitions using [@abapify/ts-xsd](../ts-xsd/README.md).
|
|
10
|
-
|
|
11
|
-
### Key Features
|
|
12
|
-
|
|
13
|
-
- **204+ TypeScript interfaces** - Pre-generated, no runtime inference overhead
|
|
14
|
-
- **Shared types across schemas** - `AdtObject`, `LinkType`, etc. are defined once
|
|
15
|
-
- **Optimal bundling** - Tree-shakeable, import only what you need
|
|
16
|
-
- **Full type safety** - Compile-time validation of XML parsing/building
|
|
17
|
-
- **speci integration** - Works directly with REST contract definitions
|
|
18
|
-
|
|
19
|
-
### Architecture Highlights
|
|
20
|
-
|
|
21
|
-
```
|
|
22
|
-
XSD Files (SAP Official)
|
|
23
|
-
↓ ts-xsd codegen
|
|
24
|
-
Schema Literals (as const)
|
|
25
|
-
↓ interface generator
|
|
26
|
-
TypeScript Interfaces (204 types)
|
|
27
|
-
↓ typed() wrapper
|
|
28
|
-
Typed Schemas (parse/build)
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
**Single source of truth**: All type definitions flow from XSD → TypeScript, eliminating manual type maintenance.
|
|
32
|
-
|
|
33
|
-
## Installation
|
|
8
|
+
## Install
|
|
34
9
|
|
|
35
10
|
```bash
|
|
36
11
|
npm install @abapify/adt-schemas
|
|
37
|
-
# or
|
|
38
|
-
bun add @abapify/adt-schemas
|
|
39
12
|
```
|
|
40
13
|
|
|
41
|
-
##
|
|
42
|
-
|
|
43
|
-
### Parse ADT XML
|
|
44
|
-
|
|
45
|
-
```typescript
|
|
46
|
-
import { classes, type AbapClass } from '@abapify/adt-schemas';
|
|
47
|
-
|
|
48
|
-
// Parse XML to typed object
|
|
49
|
-
const xml = await fetch('/sap/bc/adt/oo/classes/zcl_my_class').then((r) =>
|
|
50
|
-
r.text(),
|
|
51
|
-
);
|
|
52
|
-
const data = classes.parse(xml);
|
|
14
|
+
## Usage
|
|
53
15
|
|
|
54
|
-
|
|
55
|
-
console.log(data.name); // string
|
|
56
|
-
console.log(data.category); // 'generalObjectType' | 'exceptionClass' | ...
|
|
57
|
-
console.log(data.include?.[0]); // AbapClassInclude | undefined
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### Build ADT XML
|
|
61
|
-
|
|
62
|
-
```typescript
|
|
16
|
+
```ts
|
|
63
17
|
import { classes } from '@abapify/adt-schemas';
|
|
64
18
|
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
type: 'CLAS/OC',
|
|
68
|
-
category: 'generalObjectType',
|
|
69
|
-
final: false,
|
|
70
|
-
abstract: false,
|
|
71
|
-
});
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### Use with speci Contracts
|
|
75
|
-
|
|
76
|
-
```typescript
|
|
77
|
-
import { classes, configurations } from '@abapify/adt-schemas';
|
|
78
|
-
import { http } from 'speci/rest';
|
|
79
|
-
|
|
80
|
-
const adtContracts = {
|
|
81
|
-
getClass: (name: string) =>
|
|
82
|
-
http.get(`/sap/bc/adt/oo/classes/${name}`, {
|
|
83
|
-
responses: { 200: classes },
|
|
84
|
-
}),
|
|
85
|
-
|
|
86
|
-
getConfigurations: () =>
|
|
87
|
-
http.get(
|
|
88
|
-
'/sap/bc/adt/cts/transportrequests/searchconfiguration/configurations',
|
|
89
|
-
{
|
|
90
|
-
responses: { 200: configurations },
|
|
91
|
-
},
|
|
92
|
-
),
|
|
93
|
-
};
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
## Available Schemas
|
|
97
|
-
|
|
98
|
-
### Core Schemas
|
|
99
|
-
|
|
100
|
-
| Schema | Type | Description |
|
|
101
|
-
| ------------ | ------------------ | ------------------------------------ |
|
|
102
|
-
| `adtcore` | `AdtObject` | Core ADT object types |
|
|
103
|
-
| `atom` | `LinkType` | Atom feed format (links, categories) |
|
|
104
|
-
| `abapsource` | `AbapSourceObject` | ABAP source code structures |
|
|
105
|
-
| `abapoo` | `AbapOoObject` | ABAP OO base types |
|
|
106
|
-
|
|
107
|
-
### Repository Objects
|
|
108
|
-
|
|
109
|
-
| Schema | Type | Description |
|
|
110
|
-
| ------------ | --------------- | ------------------------- |
|
|
111
|
-
| `classes` | `AbapClass` | ABAP class metadata |
|
|
112
|
-
| `interfaces` | `AbapInterface` | ABAP interface metadata |
|
|
113
|
-
| `packagesV1` | `Package` | Package/devclass metadata |
|
|
114
|
-
|
|
115
|
-
### Transport Management
|
|
116
|
-
|
|
117
|
-
| Schema | Type | Description |
|
|
118
|
-
| -------------------------- | ---------------- | ---------------------------------- |
|
|
119
|
-
| `transportfind` | `Abap` | Transport search (ABAP XML format) |
|
|
120
|
-
| `transportmanagmentCreate` | `RootType` | Transport creation |
|
|
121
|
-
| `configurations` | `Configurations` | Search configurations |
|
|
122
|
-
| `configuration` | `Configuration` | Single configuration |
|
|
123
|
-
|
|
124
|
-
### ATC (ABAP Test Cockpit)
|
|
125
|
-
|
|
126
|
-
| Schema | Type | Description |
|
|
127
|
-
| ------------- | ------------------ | ------------------- |
|
|
128
|
-
| `atc` | `AtcWorklist` | ATC main schema |
|
|
129
|
-
| `atcworklist` | `AtcWorklist` | ATC worklist |
|
|
130
|
-
| `atcresult` | `AtcWorklist` | ATC results |
|
|
131
|
-
| `checklist` | `CheckMessageList` | Check message lists |
|
|
132
|
-
| `quickfixes` | `AtcQuickfixes` | ATC quickfixes |
|
|
133
|
-
|
|
134
|
-
### Debugging & Tracing
|
|
135
|
-
|
|
136
|
-
| Schema | Type | Description |
|
|
137
|
-
| ---------- | ------------- | -------------------- |
|
|
138
|
-
| `logpoint` | `AdtLogpoint` | Logpoint definitions |
|
|
139
|
-
| `traces` | `Traces` | Trace data |
|
|
140
|
-
|
|
141
|
-
### Templates
|
|
142
|
-
|
|
143
|
-
| Schema | Type | Description |
|
|
144
|
-
| ---------------------- | ------------------- | ----------------------- |
|
|
145
|
-
| `templatelink` | `LinkType` | Template links |
|
|
146
|
-
| `templatelinkExtended` | `TemplateLinksType` | Extended template links |
|
|
147
|
-
|
|
148
|
-
## Type System
|
|
149
|
-
|
|
150
|
-
### Pre-generated Interfaces
|
|
151
|
-
|
|
152
|
-
All types are pre-generated as TypeScript interfaces, avoiding runtime inference overhead:
|
|
153
|
-
|
|
154
|
-
```typescript
|
|
155
|
-
// Import types directly
|
|
156
|
-
import type {
|
|
157
|
-
AbapClass,
|
|
158
|
-
AbapInterface,
|
|
159
|
-
AdtObject,
|
|
160
|
-
AdtObjectReference,
|
|
161
|
-
LinkType,
|
|
162
|
-
} from '@abapify/adt-schemas';
|
|
163
|
-
|
|
164
|
-
// Use in your code
|
|
165
|
-
function processClass(cls: AbapClass) {
|
|
166
|
-
console.log(cls.name);
|
|
167
|
-
console.log(cls.superClassRef?.name);
|
|
168
|
-
cls.include?.forEach((inc) => console.log(inc.includeType));
|
|
169
|
-
}
|
|
19
|
+
const data = classes.parse(xml); // fully typed
|
|
20
|
+
const out = classes.build(data);
|
|
170
21
|
```
|
|
171
22
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
Types are shared across schemas - `AdtObject` is defined once and reused:
|
|
175
|
-
|
|
176
|
-
```typescript
|
|
177
|
-
// All these extend AdtObject
|
|
178
|
-
interface AbapSourceObject extends AdtObject { ... }
|
|
179
|
-
interface AbapOoObject extends AbapSourceMainObject { ... }
|
|
180
|
-
interface AbapClass extends AbapOoObject { ... }
|
|
181
|
-
interface AbapInterface extends AbapOoObject { ... }
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
### Type Hierarchy
|
|
185
|
-
|
|
186
|
-
```
|
|
187
|
-
AdtObject
|
|
188
|
-
├── AdtMainObject
|
|
189
|
-
│ └── AbapSourceMainObject
|
|
190
|
-
│ └── AbapOoObject
|
|
191
|
-
│ ├── AbapClass
|
|
192
|
-
│ └── AbapInterface
|
|
193
|
-
└── AbapSourceObject
|
|
194
|
-
└── AbapClassInclude
|
|
195
|
-
```
|
|
23
|
+
## Features
|
|
196
24
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
```typescript
|
|
202
|
-
// Generated schema literal (classes.ts)
|
|
203
|
-
export default {
|
|
204
|
-
$xmlns: {
|
|
205
|
-
adtcore: "http://www.sap.com/adt/core",
|
|
206
|
-
abapoo: "http://www.sap.com/adt/oo",
|
|
207
|
-
class: "http://www.sap.com/adt/oo/classes",
|
|
208
|
-
},
|
|
209
|
-
$imports: [adtcore, abapoo, abapsource], // Linked schemas
|
|
210
|
-
targetNamespace: "http://www.sap.com/adt/oo/classes",
|
|
211
|
-
element: [
|
|
212
|
-
{ name: "abapClass", type: "class:AbapClass" },
|
|
213
|
-
],
|
|
214
|
-
complexType: [
|
|
215
|
-
{
|
|
216
|
-
name: "AbapClass",
|
|
217
|
-
complexContent: {
|
|
218
|
-
extension: {
|
|
219
|
-
base: "abapoo:AbapOoObject", // Type inheritance
|
|
220
|
-
sequence: { element: [...] },
|
|
221
|
-
attribute: [...],
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
],
|
|
226
|
-
} as const;
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
### Cross-Schema Type Resolution
|
|
230
|
-
|
|
231
|
-
The `$imports` array enables cross-schema type resolution:
|
|
232
|
-
|
|
233
|
-
```typescript
|
|
234
|
-
// classes schema imports adtcore, abapoo, abapsource
|
|
235
|
-
// Type "adtcore:AdtObjectReference" resolves to AdtObjectReference interface
|
|
236
|
-
// Type "abapoo:AbapOoObject" resolves to AbapOoObject interface
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
## Architecture
|
|
240
|
-
|
|
241
|
-
```
|
|
242
|
-
@abapify/adt-schemas
|
|
243
|
-
├── src/
|
|
244
|
-
│ ├── index.ts # Main exports
|
|
245
|
-
│ ├── speci.ts # typed() wrapper factory
|
|
246
|
-
│ └── schemas/
|
|
247
|
-
│ ├── index.ts # Re-exports from generated
|
|
248
|
-
│ └── generated/
|
|
249
|
-
│ ├── index.ts # Typed schema exports
|
|
250
|
-
│ ├── schemas/
|
|
251
|
-
│ │ ├── sap/ # SAP official schemas (23 files)
|
|
252
|
-
│ │ └── custom/ # Custom schemas (9 files)
|
|
253
|
-
│ └── types/
|
|
254
|
-
│ └── index.ts # 204 TypeScript interfaces
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
### Generation Pipeline
|
|
258
|
-
|
|
259
|
-
```
|
|
260
|
-
1. Download XSD → .xsd/model/*.xsd
|
|
261
|
-
2. Parse XSD → Schema objects (ts-xsd)
|
|
262
|
-
3. Generate Literal → schemas/sap/*.ts (as const)
|
|
263
|
-
4. Generate Types → types/index.ts (interfaces)
|
|
264
|
-
5. Wrap with typed()→ index.ts (parse/build methods)
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
## Custom Schemas (ABAP XML Format)
|
|
268
|
-
|
|
269
|
-
Some SAP endpoints return ABAP XML format (`asx:abap` envelope) without official XSD. Create manual schemas in `src/schemas/generated/schemas/custom/`:
|
|
270
|
-
|
|
271
|
-
```typescript
|
|
272
|
-
// schemas/custom/transportfind.ts
|
|
273
|
-
export default {
|
|
274
|
-
$xmlns: { asx: 'http://www.sap.com/abapxml' },
|
|
275
|
-
targetNamespace: 'http://www.sap.com/abapxml',
|
|
276
|
-
element: [{ name: 'abap', type: 'Abap' }],
|
|
277
|
-
complexType: [
|
|
278
|
-
{
|
|
279
|
-
name: 'Abap',
|
|
280
|
-
sequence: {
|
|
281
|
-
element: [{ name: 'values', type: 'Values' }],
|
|
282
|
-
},
|
|
283
|
-
attribute: [{ name: 'version', type: 'xs:string' }],
|
|
284
|
-
},
|
|
285
|
-
],
|
|
286
|
-
// ... more types
|
|
287
|
-
} as const; // CRITICAL: 'as const' required!
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
### Key Points
|
|
291
|
-
|
|
292
|
-
1. **`as const`** - Required for type inference
|
|
293
|
-
2. **Element names without prefix** - Use `'abap'`, not `'asx:abap'`
|
|
294
|
-
3. **Add to typed index** - Register in `generated/index.ts`
|
|
295
|
-
|
|
296
|
-
## Development
|
|
297
|
-
|
|
298
|
-
### Regenerate Schemas
|
|
299
|
-
|
|
300
|
-
```bash
|
|
301
|
-
# Full regeneration pipeline
|
|
302
|
-
npx nx run adt-schemas:generate
|
|
303
|
-
|
|
304
|
-
# Individual steps
|
|
305
|
-
npx nx run adt-schemas:download # Download XSD files
|
|
306
|
-
npx nx run adt-schemas:codegen # Generate schema literals
|
|
307
|
-
npx nx run adt-schemas:types # Generate TypeScript interfaces
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
### Add New Schema
|
|
311
|
-
|
|
312
|
-
1. Add XSD to `.xsd/model/sap/` or create custom schema
|
|
313
|
-
2. Update generation config
|
|
314
|
-
3. Run `npx nx run adt-schemas:generate`
|
|
315
|
-
4. Add typed wrapper in `generated/index.ts`
|
|
316
|
-
5. **Add test scenario** (mandatory)
|
|
317
|
-
|
|
318
|
-
### Testing
|
|
319
|
-
|
|
320
|
-
```bash
|
|
321
|
-
# Run all tests
|
|
322
|
-
npx nx test adt-schemas
|
|
323
|
-
|
|
324
|
-
# Run specific test
|
|
325
|
-
npx vitest run tests/scenarios.test.ts
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
Every schema **must** have a test scenario with real SAP XML fixtures.
|
|
329
|
-
|
|
330
|
-
## speci Integration
|
|
331
|
-
|
|
332
|
-
Schemas implement the `Serializable` interface for seamless speci integration:
|
|
333
|
-
|
|
334
|
-
```typescript
|
|
335
|
-
interface Serializable<T> {
|
|
336
|
-
parse(raw: string): T;
|
|
337
|
-
build?(data: T): string;
|
|
338
|
-
}
|
|
339
|
-
```
|
|
340
|
-
|
|
341
|
-
This enables automatic type inference in REST contracts:
|
|
342
|
-
|
|
343
|
-
```typescript
|
|
344
|
-
import { classes } from '@abapify/adt-schemas';
|
|
345
|
-
|
|
346
|
-
const contract = http.get('/sap/bc/adt/oo/classes/zcl_test', {
|
|
347
|
-
responses: { 200: classes },
|
|
348
|
-
});
|
|
349
|
-
|
|
350
|
-
// Response type is automatically inferred as AbapClass
|
|
351
|
-
const response = await client.execute(contract);
|
|
352
|
-
console.log(response.data.name); // TypeScript knows this is string
|
|
353
|
-
```
|
|
25
|
+
- Typed parse / build for ADT XML, generated from SAP XSDs
|
|
26
|
+
- 200+ schemas: objects, transports, ATC, AUnit, discovery, …
|
|
27
|
+
- Powered by `@abapify/ts-xsd`
|
|
354
28
|
|
|
355
|
-
##
|
|
29
|
+
## Documentation
|
|
356
30
|
|
|
357
|
-
|
|
358
|
-
- **[speci](../speci)** - REST contract library
|
|
31
|
+
**[adt-cli.netlify.app/sdk/packages/adt-schemas](https://adt-cli.netlify.app/sdk/packages/adt-schemas)**
|
|
359
32
|
|
|
360
|
-
|
|
33
|
+
---
|
|
361
34
|
|
|
362
|
-
|
|
35
|
+
Part of [**abapify**](https://github.com/abapify/adt-cli) — open, typed tooling for SAP ABAP Development Tools (ADT): CLI, MCP server, and SDK.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abapify/adt-schemas",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.38",
|
|
4
4
|
"description": "ADT XML schemas generated from SAP XSD definitions",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
"./package.json": "./package.json"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@abapify/ts-xsd": "0.4.
|
|
16
|
+
"@abapify/ts-xsd": "0.4.38",
|
|
17
17
|
"zod": "^4.6.7"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@abapify/adt-fixtures": "0.4.
|
|
20
|
+
"@abapify/adt-fixtures": "0.4.38"
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
23
|
"dist"
|