@abapify/adt-contracts 0.3.6 → 0.4.1

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.
@@ -0,0 +1,2468 @@
1
+ import { acoverageResult, acoverageStatements, adtcore, atc, atcRun, atcworklist, atomFeed, aunitResult, aunitRun, badi, blueSource, checkrun, classes, configuration, configurations as configurations$1, dataelementWrapper, dclSource, ddlSource, discovery, domain, fmodules, groups as groups$1, http as http$2, includes, interfaces, packagesV1, programs, servicebinding, srvdSource, systeminformation, tabletype, transportUseraction, transportfind, transportmanagment, transportmanagmentCreate, transportmanagmentSingle } from "./schemas.mjs";
2
+ import { createClient, http, http as http$1 } from "@abapify/speci/rest";
3
+
4
+ //#region src/helpers/text-schema.ts
5
+ /**
6
+ * Serializable<string> for text/plain request/response bodies.
7
+ *
8
+ * `parse` coerces the raw response to string; `build` returns the string as-is.
9
+ * The `_infer` marker is the key piece — speci checks for it with `'_infer' in value`
10
+ * to decide whether the descriptor carries a body schema.
11
+ */
12
+ const textPlain = {
13
+ parse: (x) => String(x),
14
+ build: (x) => x,
15
+ _infer: void 0
16
+ };
17
+
18
+ //#endregion
19
+ //#region src/helpers/crud.ts
20
+ /**
21
+ * CRUD Contract Helper
22
+ *
23
+ * Generates full CRUD contracts for ADT repository objects following the
24
+ * standard SAP ADT URL template pattern:
25
+ *
26
+ * {basePath}/{object_name}{?corrNr,lockHandle,version,accessMode,_action}
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * import { crud } from '../helpers/crud';
31
+ * import { classes } from '../schemas';
32
+ *
33
+ * export const classesContract = crud({
34
+ * basePath: '/sap/bc/adt/oo/classes',
35
+ * schema: classes,
36
+ * contentType: 'application/vnd.sap.adt.oo.classes.v4+xml',
37
+ * });
38
+ *
39
+ * // Usage:
40
+ * // classesContract.get('zcl_my_class')
41
+ * // classesContract.post({ corrNr: 'DEVK900001' })
42
+ * // classesContract.put('zcl_my_class', { lockHandle: '...' })
43
+ * // classesContract.delete('zcl_my_class')
44
+ * ```
45
+ */
46
+ /**
47
+ * Create source operations for a given source type
48
+ */
49
+ function createSourceOperations(basePath, sourceType, nameTransform) {
50
+ return {
51
+ get: (name) => http.get(`${basePath}/${nameTransform(name)}/source/${sourceType}`, {
52
+ responses: { 200: void 0 },
53
+ headers: { Accept: "text/plain" }
54
+ }),
55
+ put: (name, options) => http.put(`${basePath}/${nameTransform(name)}/source/${sourceType}`, {
56
+ body: textPlain,
57
+ responses: { 200: void 0 },
58
+ headers: {
59
+ Accept: "text/plain",
60
+ "Content-Type": "text/plain"
61
+ },
62
+ query: {
63
+ ...options?.lockHandle ? { lockHandle: options.lockHandle } : {},
64
+ ...options?.corrNr ? { corrNr: options.corrNr } : {}
65
+ }
66
+ })
67
+ };
68
+ }
69
+ /**
70
+ * Create include operations for a given include type
71
+ */
72
+ function createIncludeOperations(basePath, includeType, nameTransform) {
73
+ return {
74
+ get: (name) => http.get(`${basePath}/${nameTransform(name)}/includes/${includeType}`, {
75
+ responses: { 200: void 0 },
76
+ headers: { Accept: "text/plain" }
77
+ }),
78
+ put: (name, options) => http.put(`${basePath}/${nameTransform(name)}/includes/${includeType}`, {
79
+ body: textPlain,
80
+ responses: { 200: void 0 },
81
+ headers: {
82
+ Accept: "text/plain",
83
+ "Content-Type": "text/plain"
84
+ },
85
+ query: {
86
+ ...options?.lockHandle ? { lockHandle: options.lockHandle } : {},
87
+ ...options?.corrNr ? { corrNr: options.corrNr } : {}
88
+ }
89
+ })
90
+ };
91
+ }
92
+ /**
93
+ * Create a full CRUD contract for an ADT repository object
94
+ *
95
+ * Follows the standard SAP ADT URL template pattern:
96
+ * {basePath}/{object_name}{?corrNr,lockHandle,version,accessMode,_action}
97
+ *
98
+ * @example Basic CRUD
99
+ * ```ts
100
+ * const packagesContract = crud({
101
+ * basePath: '/sap/bc/adt/packages',
102
+ * schema: packages,
103
+ * contentType: 'application/vnd.sap.adt.packages.v1+xml',
104
+ * });
105
+ * ```
106
+ *
107
+ * @example With source code support
108
+ * ```ts
109
+ * const interfacesContract = crud({
110
+ * basePath: '/sap/bc/adt/oo/interfaces',
111
+ * schema: interfaces,
112
+ * contentType: 'application/vnd.sap.adt.oo.interfaces.v5+xml',
113
+ * sources: ['main'],
114
+ * });
115
+ * // interfacesContract.source.main.get('zif_my_interface')
116
+ * ```
117
+ *
118
+ * @example With includes support (classes)
119
+ * ```ts
120
+ * const classesContract = crud({
121
+ * basePath: '/sap/bc/adt/oo/classes',
122
+ * schema: classes,
123
+ * contentType: 'application/vnd.sap.adt.oo.classes.v4+xml',
124
+ * sources: ['main'],
125
+ * includes: ['definitions', 'implementations', 'macros'],
126
+ * });
127
+ * // classesContract.source.main.get('zcl_my_class')
128
+ * // classesContract.includes.definitions.get('zcl_my_class')
129
+ * // classesContract.includes.get('zcl_my_class', 'implementations')
130
+ * ```
131
+ */
132
+ function crud(options) {
133
+ const { basePath, schema, contentType, accept = contentType, nameTransform = (n) => n.toLowerCase(), sources, includes } = options;
134
+ return {
135
+ bodySchema: schema,
136
+ get: (name, queryOptions) => http.get(`${basePath}/${nameTransform(name)}`, {
137
+ responses: { 200: schema },
138
+ headers: { Accept: accept },
139
+ query: queryOptions?.version ? { version: queryOptions.version } : void 0
140
+ }),
141
+ post: (queryOptions) => http.post(basePath, {
142
+ body: schema,
143
+ responses: { 200: schema },
144
+ headers: {
145
+ Accept: accept,
146
+ "Content-Type": contentType
147
+ },
148
+ query: queryOptions?.corrNr ? { corrNr: queryOptions.corrNr } : void 0
149
+ }),
150
+ put: (name, queryOptions) => http.put(`${basePath}/${nameTransform(name)}`, {
151
+ body: schema,
152
+ responses: { 200: schema },
153
+ headers: {
154
+ Accept: accept,
155
+ "Content-Type": contentType
156
+ },
157
+ query: {
158
+ ...queryOptions?.corrNr ? { corrNr: queryOptions.corrNr } : {},
159
+ ...queryOptions?.lockHandle ? { lockHandle: queryOptions.lockHandle } : {}
160
+ }
161
+ }),
162
+ delete: (name, queryOptions) => http.delete(`${basePath}/${nameTransform(name)}`, {
163
+ responses: { 204: void 0 },
164
+ query: {
165
+ ...queryOptions?.corrNr ? { corrNr: queryOptions.corrNr } : {},
166
+ ...queryOptions?.lockHandle ? { lockHandle: queryOptions.lockHandle } : {}
167
+ }
168
+ }),
169
+ lock: (name, lockOptions) => http.post(`${basePath}/${nameTransform(name)}`, {
170
+ responses: { 200: void 0 },
171
+ headers: {
172
+ "X-sap-adt-sessiontype": "stateful",
173
+ "x-sap-security-session": "use",
174
+ Accept: "application/*,application/vnd.sap.as+xml;charset=UTF-8;dataname=com.sap.adt.lock.result"
175
+ },
176
+ query: {
177
+ _action: "LOCK",
178
+ accessMode: lockOptions?.accessMode ?? "MODIFY",
179
+ ...lockOptions?.corrNr ? { corrNr: lockOptions.corrNr } : {}
180
+ }
181
+ }),
182
+ unlock: (name, unlockOptions) => http.post(`${basePath}/${nameTransform(name)}`, {
183
+ responses: { 200: void 0 },
184
+ headers: {
185
+ "X-sap-adt-sessiontype": "stateful",
186
+ "x-sap-security-session": "use"
187
+ },
188
+ query: {
189
+ _action: "UNLOCK",
190
+ accessMode: "MODIFY",
191
+ lockHandle: unlockOptions.lockHandle
192
+ }
193
+ }),
194
+ objectstructure: (name, structureOptions) => http.get(`${basePath}/${nameTransform(name)}/objectstructure`, {
195
+ responses: { 200: void 0 },
196
+ query: {
197
+ ...structureOptions?.version ? { version: structureOptions.version } : {},
198
+ ...structureOptions?.withShortDescriptions !== void 0 ? { withShortDescriptions: String(structureOptions.withShortDescriptions) } : {}
199
+ }
200
+ }),
201
+ ...sources ? { source: Object.fromEntries(sources.map((sourceType) => [sourceType, createSourceOperations(basePath, sourceType, nameTransform)])) } : {},
202
+ ...includes ? { includes: {
203
+ get: (name, includeType) => http.get(`${basePath}/${nameTransform(name)}/includes/${includeType}`, {
204
+ responses: { 200: void 0 },
205
+ headers: { Accept: "text/plain" }
206
+ }),
207
+ put: (name, includeType, options) => http.put(`${basePath}/${nameTransform(name)}/includes/${includeType}`, {
208
+ body: textPlain,
209
+ responses: { 200: void 0 },
210
+ headers: {
211
+ Accept: "text/plain",
212
+ "Content-Type": "text/plain"
213
+ },
214
+ query: {
215
+ ...options?.lockHandle ? { lockHandle: options.lockHandle } : {},
216
+ ...options?.corrNr ? { corrNr: options.corrNr } : {}
217
+ }
218
+ }),
219
+ ...Object.fromEntries(includes.map((includeType) => [includeType, createIncludeOperations(basePath, includeType, nameTransform)]))
220
+ } } : {}
221
+ };
222
+ }
223
+ /**
224
+ * Shorthand alias for crud()
225
+ *
226
+ * @example
227
+ * ```ts
228
+ * export const classesContract = repo('/sap/bc/adt/oo/classes', classes, 'application/vnd.sap.adt.oo.classes.v4+xml');
229
+ * ```
230
+ */
231
+ function repo(basePath, schema, contentType, nameTransform, accept) {
232
+ return crud({
233
+ basePath,
234
+ schema,
235
+ contentType,
236
+ accept,
237
+ nameTransform
238
+ });
239
+ }
240
+
241
+ //#endregion
242
+ //#region src/adt/cts/transportrequests/valuehelp/attribute.ts
243
+ /**
244
+ * /sap/bc/adt/cts/transportrequests/valuehelp/attribute
245
+ */
246
+ const attribute = { get: (params) => http.get("/sap/bc/adt/cts/transportrequests/valuehelp/attribute", {
247
+ query: params,
248
+ responses: { 200: void 0 },
249
+ headers: { Accept: "application/xml" }
250
+ }) };
251
+
252
+ //#endregion
253
+ //#region src/adt/cts/transportrequests/valuehelp/target.ts
254
+ /**
255
+ * /sap/bc/adt/cts/transportrequests/valuehelp/target
256
+ */
257
+ const target = { get: (params) => http.get("/sap/bc/adt/cts/transportrequests/valuehelp/target", {
258
+ query: params,
259
+ responses: { 200: void 0 },
260
+ headers: { Accept: "application/xml" }
261
+ }) };
262
+
263
+ //#endregion
264
+ //#region src/adt/cts/transportrequests/valuehelp/ctsproject.ts
265
+ /**
266
+ * /sap/bc/adt/cts/transportrequests/valuehelp/ctsproject
267
+ */
268
+ const ctsproject = { get: (params) => http.get("/sap/bc/adt/cts/transportrequests/valuehelp/ctsproject", {
269
+ query: params,
270
+ responses: { 200: void 0 },
271
+ headers: { Accept: "application/xml" }
272
+ }) };
273
+
274
+ //#endregion
275
+ //#region src/adt/cts/transportrequests/valuehelp/object.ts
276
+ /**
277
+ * /sap/bc/adt/cts/transportrequests/valuehelp/object
278
+ */
279
+ const object = { get: (field, params) => http.get(`/sap/bc/adt/cts/transportrequests/valuehelp/object/${field}`, {
280
+ query: params,
281
+ responses: { 200: void 0 },
282
+ headers: { Accept: "application/xml" }
283
+ }) };
284
+
285
+ //#endregion
286
+ //#region src/adt/cts/transportrequests/valuehelp/index.ts
287
+ /**
288
+ * /sap/bc/adt/cts/transportrequests/valuehelp
289
+ */
290
+ const valuehelp = {
291
+ attribute,
292
+ target,
293
+ ctsproject,
294
+ object
295
+ };
296
+
297
+ //#endregion
298
+ //#region src/adt/cts/transportrequests/reference.ts
299
+ /**
300
+ * /sap/bc/adt/cts/transportrequests/reference
301
+ * @source transportmanagementref.json
302
+ */
303
+ const reference = { get: () => http.get("/sap/bc/adt/cts/transportrequests/reference", {
304
+ responses: { 200: void 0 },
305
+ headers: { Accept: "application/xml" }
306
+ }) };
307
+
308
+ //#endregion
309
+ //#region src/adt/cts/transportrequests/searchconfiguration/configurations.ts
310
+ /**
311
+ * /sap/bc/adt/cts/transportrequests/searchconfiguration/configurations
312
+ * @schema configurations.xsd, configuration.xsd
313
+ */
314
+ const configurations = contract({
315
+ get: () => http$1.get("/sap/bc/adt/cts/transportrequests/searchconfiguration/configurations", {
316
+ responses: { 200: configurations$1 },
317
+ headers: { Accept: "application/vnd.sap.adt.configurations.v1+xml" }
318
+ }),
319
+ getById: (_configId) => http$1.get("/sap/bc/adt/cts/transportrequests/searchconfiguration/configurations/${configId}", {
320
+ responses: { 200: configuration },
321
+ headers: { Accept: "application/vnd.sap.adt.configuration.v1+xml" }
322
+ }),
323
+ put: (_configId) => http$1.put("/sap/bc/adt/cts/transportrequests/searchconfiguration/configurations/${configId}", {
324
+ responses: { 200: configuration },
325
+ headers: {
326
+ "Content-Type": "application/vnd.sap.adt.configuration.v1+xml",
327
+ Accept: "application/vnd.sap.adt.configuration.v1+xml"
328
+ },
329
+ body: configuration
330
+ })
331
+ });
332
+
333
+ //#endregion
334
+ //#region src/adt/cts/transportrequests/searchconfiguration/metadata.ts
335
+ /**
336
+ * /sap/bc/adt/cts/transportrequests/searchconfiguration/metadata
337
+ * @schema configuration.xsd
338
+ */
339
+ const metadata = contract({ get: () => http$1.get("/sap/bc/adt/cts/transportrequests/searchconfiguration/metadata", {
340
+ responses: { 200: configuration },
341
+ headers: { Accept: "application/vnd.sap.adt.configuration.metadata.v1+xml" }
342
+ }) });
343
+
344
+ //#endregion
345
+ //#region src/adt/cts/transportrequests/searchconfiguration/index.ts
346
+ /**
347
+ * /sap/bc/adt/cts/transportrequests/searchconfiguration
348
+ */
349
+ const searchconfiguration = {
350
+ configurations,
351
+ metadata
352
+ };
353
+
354
+ //#endregion
355
+ //#region src/adt/cts/transportrequests/useraction.ts
356
+ /**
357
+ * /sap/bc/adt/cts/transportrequests - user-action body endpoints
358
+ *
359
+ * SAP ADT uses POST with a `<tm:root tm:useraction="...">` XML body for
360
+ * release / changeowner / newrequest actions. This file exposes typed
361
+ * endpoints that wrap those three operations.
362
+ *
363
+ * release → POST /{trkorr}
364
+ * changeowner → POST /{trkorr} (requires tm:targetuser, optional tm:recursive)
365
+ * newrequest → POST / (creates a new transport request)
366
+ *
367
+ * All three share the same namespace and content-type but differ in
368
+ * request shape and URL, so we expose them as separate methods with
369
+ * strongly-typed options while sharing a single schema.
370
+ */
371
+ const CONTENT_TYPE = "application/vnd.sap.adt.transportorganizer.v1+xml";
372
+ const useraction = {
373
+ release: (trkorr) => http$1.post(`/sap/bc/adt/cts/transportrequests/${trkorr}`, {
374
+ body: transportUseraction,
375
+ responses: { 200: transportmanagmentSingle },
376
+ headers: {
377
+ Accept: CONTENT_TYPE,
378
+ "Content-Type": CONTENT_TYPE
379
+ }
380
+ }),
381
+ reassign: (trkorr, _options) => http$1.post(`/sap/bc/adt/cts/transportrequests/${trkorr}`, {
382
+ body: transportUseraction,
383
+ responses: { 200: transportmanagmentSingle },
384
+ headers: {
385
+ Accept: CONTENT_TYPE,
386
+ "Content-Type": CONTENT_TYPE
387
+ }
388
+ }),
389
+ create: (_options) => http$1.post("/sap/bc/adt/cts/transportrequests", {
390
+ body: transportUseraction,
391
+ responses: { 200: transportmanagmentSingle },
392
+ headers: {
393
+ Accept: CONTENT_TYPE,
394
+ "Content-Type": CONTENT_TYPE
395
+ }
396
+ })
397
+ };
398
+
399
+ //#endregion
400
+ //#region src/adt/cts/transportrequests/index.ts
401
+ /**
402
+ * /sap/bc/adt/cts/transportrequests
403
+ * @source transportmanagement.json
404
+ */
405
+ /** Re-export schema for consumers that need direct parsing */
406
+ const transportrequests = {
407
+ list: (params) => http$1.get("/sap/bc/adt/cts/transportrequests", {
408
+ query: params,
409
+ responses: { 200: transportmanagment },
410
+ headers: { Accept: "*/*" }
411
+ }),
412
+ get: (trkorr) => http$1.get(`/sap/bc/adt/cts/transportrequests/${trkorr}`, {
413
+ responses: { 200: transportmanagmentSingle },
414
+ headers: { Accept: "application/vnd.sap.adt.transportorganizer.v1+xml" }
415
+ }),
416
+ create: () => http$1.post("/sap/bc/adt/cts/transportrequests", {
417
+ body: transportmanagmentCreate,
418
+ responses: { 200: transportmanagmentSingle },
419
+ headers: {
420
+ Accept: "application/vnd.sap.adt.transportorganizer.v1+xml",
421
+ "Content-Type": "application/xml"
422
+ }
423
+ }),
424
+ post: (trkorr) => http$1.post(`/sap/bc/adt/cts/transportrequests/${trkorr}`, {
425
+ body: transportmanagment,
426
+ responses: { 200: transportmanagment },
427
+ headers: {
428
+ Accept: "application/vnd.sap.adt.transportorganizer.v1+xml",
429
+ "Content-Type": "application/xml"
430
+ }
431
+ }),
432
+ put: (trkorr) => http$1.put(`/sap/bc/adt/cts/transportrequests/${trkorr}`, {
433
+ body: transportmanagment,
434
+ responses: { 200: transportmanagment },
435
+ headers: {
436
+ Accept: "application/vnd.sap.adt.transportorganizer.v1+xml",
437
+ "Content-Type": "application/xml"
438
+ }
439
+ }),
440
+ delete: (trkorr) => http$1.delete(`/sap/bc/adt/cts/transportrequests/${trkorr}`, { responses: { 204: void 0 } }),
441
+ reference,
442
+ valuehelp,
443
+ searchconfiguration,
444
+ useraction
445
+ };
446
+
447
+ //#endregion
448
+ //#region src/adt/cts/transports.ts
449
+ /**
450
+ * /sap/bc/adt/cts/transports/**
451
+ * ADT CTS Transports Contract
452
+ *
453
+ * GET with _action=FIND - Search transports (undocumented but works)
454
+ *
455
+ * Uses manual ts-xsd schema from adt-schemas for proper XML parsing.
456
+ */
457
+ /**
458
+ * Transport function codes (TRFUNCTION field)
459
+ */
460
+ const TransportFunction = {
461
+ WORKBENCH: "K",
462
+ CUSTOMIZING: "W",
463
+ TRANSPORT_OF_COPIES: "T",
464
+ DEVELOPMENT_CORRECTION: "S",
465
+ REPAIR: "R",
466
+ UNCLASSIFIED: "X",
467
+ CUSTOMIZING_TASK: "Q",
468
+ ALL: "*"
469
+ };
470
+ /**
471
+ * Transport status codes (TRSTATUS field) - for response parsing
472
+ */
473
+ const TransportStatus = {
474
+ MODIFIABLE: "D",
475
+ RELEASE_STARTED: "O",
476
+ RELEASE_IN_PREPARATION: "P",
477
+ RELEASED: "R",
478
+ LOCKED: "L"
479
+ };
480
+ /**
481
+ * Normalize response to always return array of headers
482
+ * Works with the parsed transportfind schema response
483
+ */
484
+ function normalizeTransportFindResponse(response) {
485
+ const headers = response?.values?.DATA?.CTS_REQ_HEADER;
486
+ if (!headers) return [];
487
+ return Array.isArray(headers) ? headers : [headers];
488
+ }
489
+ const transports = { find: (params) => http.get("/sap/bc/adt/cts/transports", {
490
+ query: params,
491
+ responses: { 200: transportfind },
492
+ headers: { Accept: "*/*" }
493
+ }) };
494
+
495
+ //#endregion
496
+ //#region src/adt/cts/transportchecks.ts
497
+ /**
498
+ * /sap/bc/adt/cts/transportchecks
499
+ * @source transportchecks.json
500
+ */
501
+ const transportchecks = { get: () => http.get("/sap/bc/adt/cts/transportchecks", {
502
+ responses: { 200: void 0 },
503
+ headers: { Accept: "application/xml" }
504
+ }) };
505
+
506
+ //#endregion
507
+ //#region src/adt/cts/index.ts
508
+ /**
509
+ * ADT CTS (Change and Transport System) Contracts
510
+ *
511
+ * Structure mirrors URL tree:
512
+ * - /sap/bc/adt/cts/transportrequests → cts.transportrequests
513
+ * - /sap/bc/adt/cts/transports → cts.transports
514
+ * - /sap/bc/adt/cts/transportchecks → cts.transportchecks
515
+ *
516
+ * Based on collections in: e2e/adt-codegen/generated/collections/sap/bc/adt/cts/
517
+ */
518
+ const ctsContract = {
519
+ transportrequests,
520
+ transports,
521
+ transportchecks
522
+ };
523
+
524
+ //#endregion
525
+ //#region src/generated/adt/sap/bc/adt/atc/worklists.ts
526
+ /**
527
+ * ATC worklist
528
+ *
529
+ * Endpoint: /sap/bc/adt/atc/worklists
530
+ * Category: atcworklists
531
+ *
532
+ * @generated - DO NOT EDIT MANUALLY
533
+ */
534
+ const worklistsContract = contract({
535
+ get: (worklistId, params) => http$1.get(`/sap/bc/adt/atc/worklists/${worklistId}`, {
536
+ query: params,
537
+ responses: { 200: atcworklist },
538
+ headers: { Accept: "*/*" }
539
+ }),
540
+ objectset: (worklistId, objectSetName, params) => http$1.get(`/sap/bc/adt/atc/worklists/${worklistId}/${objectSetName}`, {
541
+ query: params,
542
+ responses: { 200: atcworklist },
543
+ headers: { Accept: "*/*" }
544
+ })
545
+ });
546
+
547
+ //#endregion
548
+ //#region src/generated/adt/sap/bc/adt/atc/results.ts
549
+ /**
550
+ * ATC results
551
+ *
552
+ * Endpoint: /sap/bc/adt/atc/results
553
+ * Category: atcresults
554
+ *
555
+ * @generated - DO NOT EDIT MANUALLY
556
+ */
557
+ const resultsContract = contract({
558
+ active: (params) => http$1.get("/sap/bc/adt/atc/results", {
559
+ query: params,
560
+ responses: { 200: atcworklist },
561
+ headers: { Accept: "application/xml" }
562
+ }),
563
+ activeforsysid: (params) => http$1.get("/sap/bc/adt/atc/results", {
564
+ query: params,
565
+ responses: { 200: atcworklist },
566
+ headers: { Accept: "application/xml" }
567
+ }),
568
+ user: (params) => http$1.get("/sap/bc/adt/atc/results", {
569
+ query: params,
570
+ responses: { 200: atcworklist },
571
+ headers: { Accept: "application/xml" }
572
+ }),
573
+ central: (params) => http$1.get("/sap/bc/adt/atc/results", {
574
+ query: params,
575
+ responses: { 200: atcworklist },
576
+ headers: { Accept: "application/xml" }
577
+ }),
578
+ centralforsysid: (params) => http$1.get("/sap/bc/adt/atc/results", {
579
+ query: params,
580
+ responses: { 200: atcworklist },
581
+ headers: { Accept: "application/xml" }
582
+ }),
583
+ displayid: (displayId, params) => http$1.get(`/sap/bc/adt/atc/results/${displayId}`, {
584
+ query: params,
585
+ responses: { 200: atcworklist },
586
+ headers: { Accept: "application/xml" }
587
+ })
588
+ });
589
+
590
+ //#endregion
591
+ //#region src/adt/atc/index.ts
592
+ /**
593
+ * ADT ATC (ABAP Test Cockpit) Contracts
594
+ *
595
+ * Combines generated contracts with manually-defined endpoints not in discovery.
596
+ *
597
+ * Structure mirrors URL tree:
598
+ * - /sap/bc/adt/atc/customizing → atc.customizing (manual - not in discovery)
599
+ * - /sap/bc/adt/atc/runs → atc.runs (manual - POST with body)
600
+ * - /sap/bc/adt/atc/results → atc.results (generated)
601
+ * - /sap/bc/adt/atc/worklists → atc.worklists (generated + manual create)
602
+ */
603
+ /**
604
+ * /sap/bc/adt/atc/customizing
605
+ * Get ATC customizing settings (check variants, exemption reasons, etc.)
606
+ *
607
+ * NOTE: Not in SAP discovery - manually defined
608
+ */
609
+ const customizing = contract({ get: () => http$1.get("/sap/bc/adt/atc/customizing", {
610
+ responses: { 200: atc },
611
+ headers: { Accept: "application/xml" }
612
+ }) });
613
+ /**
614
+ * /sap/bc/adt/atc/runs
615
+ *
616
+ * NOTE: POST endpoint with body - not in SAP discovery
617
+ * @source atcruns.json
618
+ */
619
+ const runs = contract({ post: (params) => http$1.post("/sap/bc/adt/atc/runs", {
620
+ query: params,
621
+ body: atcRun,
622
+ responses: { 200: atcworklist },
623
+ headers: {
624
+ Accept: "application/xml",
625
+ "Content-Type": "application/xml"
626
+ }
627
+ }) });
628
+ /**
629
+ * /sap/bc/adt/atc/worklists - Extended
630
+ *
631
+ * Adds POST (create) endpoint not in generated contract
632
+ */
633
+ const worklistsExtended = contract({ create: (params) => http$1.post("/sap/bc/adt/atc/worklists", {
634
+ query: params,
635
+ responses: { 200: atcworklist },
636
+ headers: { Accept: "*/*" }
637
+ }) });
638
+ /**
639
+ * Combined ATC contract
640
+ *
641
+ * Uses generated contracts where available, adds manual endpoints for:
642
+ * - customizing (not in discovery)
643
+ * - runs POST (not in discovery)
644
+ * - worklists.create (not in discovery)
645
+ */
646
+ const atcContract = {
647
+ customizing,
648
+ runs,
649
+ results: resultsContract,
650
+ worklists: {
651
+ ...worklistsContract,
652
+ ...worklistsExtended
653
+ }
654
+ };
655
+
656
+ //#endregion
657
+ //#region src/adt/aunit/coverage-link.ts
658
+ /**
659
+ * Coverage link helper for AUnit responses.
660
+ *
661
+ * When coverage is enabled on an ABAP Unit run, the aunit:runResult
662
+ * contains an atom:link with `rel` referring to the coverage measurement.
663
+ * Example:
664
+ *
665
+ * <atom:link href="/sap/bc/adt/runtime/traces/coverage/measurements/6D664D9B46CB1FE1859107ADE8729541"
666
+ * rel="http://www.sap.com/adt/relations/runtime/traces/coverage/measurements"/>
667
+ *
668
+ * The measurement ID is the hex segment after /measurements/.
669
+ */
670
+ const COVERAGE_MEASUREMENT_HREF_RE = /\/sap\/bc\/adt\/runtime\/traces\/coverage\/measurements\/([A-Fa-f0-9]+)/;
671
+ /**
672
+ * Walk the given node (and, shallowly, its top-level children) searching
673
+ * for an atom:link whose href points to a coverage measurement. Returns
674
+ * the measurement ID (hex string) if found, otherwise undefined.
675
+ */
676
+ function extractCoverageMeasurementId(result) {
677
+ if (!result || typeof result !== "object") return void 0;
678
+ const seen = /* @__PURE__ */ new Set();
679
+ const queue = [result];
680
+ while (queue.length > 0) {
681
+ const current = queue.shift();
682
+ if (!current || typeof current !== "object" || seen.has(current)) continue;
683
+ seen.add(current);
684
+ const obj = current;
685
+ const links = obj.link;
686
+ let linkList;
687
+ if (Array.isArray(links)) linkList = links;
688
+ else if (links && typeof links === "object") linkList = [links];
689
+ else linkList = [];
690
+ for (const link of linkList) {
691
+ const href = link && typeof link === "object" ? link.href ?? void 0 : void 0;
692
+ if (!href) continue;
693
+ const match = COVERAGE_MEASUREMENT_HREF_RE.exec(href);
694
+ if (match) return match[1];
695
+ }
696
+ for (const value of Object.values(obj)) if (Array.isArray(value)) for (const v of value) queue.push(v);
697
+ else if (value && typeof value === "object") queue.push(value);
698
+ }
699
+ }
700
+
701
+ //#endregion
702
+ //#region src/adt/aunit/index.ts
703
+ /**
704
+ * ADT AUnit (ABAP Unit) Contracts
705
+ *
706
+ * Manually-defined endpoints for ABAP Unit test runs.
707
+ *
708
+ * Structure mirrors URL tree:
709
+ * - /sap/bc/adt/abapunit/testruns → aunit.testruns (POST with body)
710
+ */
711
+ /**
712
+ * /sap/bc/adt/abapunit/testruns
713
+ *
714
+ * Run ABAP Unit tests on objects specified in the request body.
715
+ *
716
+ * NOTE: Not in SAP discovery - manually defined
717
+ */
718
+ const testruns = contract({ post: () => http$1.post("/sap/bc/adt/abapunit/testruns", {
719
+ body: aunitRun,
720
+ responses: { 200: aunitResult },
721
+ headers: {
722
+ Accept: "application/vnd.sap.adt.abapunit.testruns.result.v2+xml",
723
+ "Content-Type": "application/vnd.sap.adt.abapunit.testruns.config.v4+xml"
724
+ }
725
+ }) });
726
+ /**
727
+ * Combined AUnit contract
728
+ */
729
+ const aunitContract = { testruns };
730
+
731
+ //#endregion
732
+ //#region src/adt/oo/classes.ts
733
+ /**
734
+ * ADT OO Classes Contract
735
+ *
736
+ * Endpoint: /sap/bc/adt/oo/classes
737
+ * Full CRUD operations for ABAP classes including source code management.
738
+ *
739
+ * Uses the crud() helper with sources and includes options for complete
740
+ * class operations including metadata, source code, and class includes.
741
+ */
742
+ /**
743
+ * /sap/bc/adt/oo/classes
744
+ * Full CRUD operations for ABAP classes
745
+ *
746
+ * Includes:
747
+ * - Basic CRUD: get, post, put, delete
748
+ * - Lock/Unlock: lock, unlock
749
+ * - Object structure: objectstructure
750
+ * - Source code: source.main.get/put
751
+ * - Class includes: includes.{definitions,implementations,macros,testclasses,localtypes}.get/put
752
+ */
753
+ const classesContract = crud({
754
+ basePath: "/sap/bc/adt/oo/classes",
755
+ schema: classes,
756
+ contentType: "application/vnd.sap.adt.oo.classes.v4+xml",
757
+ accept: "application/vnd.sap.adt.oo.classes.v4+xml, application/vnd.sap.adt.oo.classes.v3+xml, application/vnd.sap.adt.oo.classes.v2+xml, application/vnd.sap.adt.oo.classes.v1+xml",
758
+ sources: ["main"],
759
+ includes: [
760
+ "definitions",
761
+ "implementations",
762
+ "macros",
763
+ "testclasses",
764
+ "localtypes"
765
+ ]
766
+ });
767
+
768
+ //#endregion
769
+ //#region src/adt/oo/interfaces.ts
770
+ /**
771
+ * ADT OO Interfaces Contract
772
+ *
773
+ * Endpoint: /sap/bc/adt/oo/interfaces
774
+ * Full CRUD operations for ABAP interfaces including source code management.
775
+ *
776
+ * Uses the crud() helper with sources option for complete
777
+ * interface operations including metadata and source code.
778
+ */
779
+ /**
780
+ * /sap/bc/adt/oo/interfaces
781
+ * Full CRUD operations for ABAP interfaces
782
+ *
783
+ * Includes:
784
+ * - Basic CRUD: get, post, put, delete
785
+ * - Lock/Unlock: lock, unlock
786
+ * - Object structure: objectstructure
787
+ * - Source code: source.main.get/put
788
+ */
789
+ const interfacesContract = crud({
790
+ basePath: "/sap/bc/adt/oo/interfaces",
791
+ schema: interfaces,
792
+ contentType: "application/vnd.sap.adt.oo.interfaces.v5+xml",
793
+ accept: "application/vnd.sap.adt.oo.interfaces.v5+xml, application/vnd.sap.adt.oo.interfaces.v4+xml, application/vnd.sap.adt.oo.interfaces.v3+xml, application/vnd.sap.adt.oo.interfaces.v2+xml, application/vnd.sap.adt.oo.interfaces+xml",
794
+ sources: ["main"]
795
+ });
796
+
797
+ //#endregion
798
+ //#region src/adt/oo/classrun.ts
799
+ /**
800
+ * ADT OO Classrun Contract
801
+ *
802
+ * Endpoint: /sap/bc/adt/oo/classrun
803
+ * Execute console application classes implementing IF_OO_ADT_CLASSRUN.
804
+ */
805
+ /**
806
+ * /sap/bc/adt/oo/classrun
807
+ * Execute console application classes (IF_OO_ADT_CLASSRUN)
808
+ */
809
+ const classrunContract = contract({ post: (classname, params) => http$1.post(`/sap/bc/adt/oo/classrun/${classname.toLowerCase()}`, {
810
+ query: params,
811
+ responses: { 200: void 0 },
812
+ headers: { Accept: "text/plain" }
813
+ }) });
814
+
815
+ //#endregion
816
+ //#region src/adt/oo/index.ts
817
+ const ooContract = {
818
+ classes: classesContract,
819
+ interfaces: interfacesContract,
820
+ classrun: classrunContract
821
+ };
822
+
823
+ //#endregion
824
+ //#region src/adt/discovery/index.ts
825
+ /**
826
+ * ADT Discovery Contract
827
+ *
828
+ * Endpoint: GET /sap/bc/adt/discovery
829
+ * Returns AtomPub service document describing available ADT services.
830
+ */
831
+ const discoveryContract = { getDiscovery: () => http$1.get("/sap/bc/adt/discovery", {
832
+ responses: { 200: discovery },
833
+ headers: { Accept: "application/atomsvc+xml" }
834
+ }) };
835
+
836
+ //#endregion
837
+ //#region src/adt/packages/index.ts
838
+ /**
839
+ * /sap/bc/adt/packages/**
840
+ * ADT Packages Contract
841
+ *
842
+ * Full CRUD operations for ABAP packages (DEVC).
843
+ *
844
+ * Uses the crud() helper with packagesV1 schema.
845
+ * Package names are case-sensitive (uppercase) — no lowercase transform.
846
+ *
847
+ * @example
848
+ * const pkg = await client.adt.packages.get('ZABAPGIT_EXAMPLES');
849
+ * console.log(pkg.package?.name, pkg.package?.attributes?.packageType);
850
+ *
851
+ * // Create a new package
852
+ * await client.adt.packages.post({ corrNr: 'DEVK900001' });
853
+ */
854
+ const packagesContract = crud({
855
+ basePath: "/sap/bc/adt/packages",
856
+ schema: packagesV1,
857
+ contentType: "application/vnd.sap.adt.packages.v2+xml",
858
+ accept: "application/vnd.sap.adt.packages.v2+xml, application/vnd.sap.adt.packages.v1+xml",
859
+ nameTransform: (n) => encodeURIComponent(n)
860
+ });
861
+
862
+ //#endregion
863
+ //#region src/adt/core/http/sessions.ts
864
+ /**
865
+ * SAP ADT Sessions Contract
866
+ *
867
+ * HTTP session management and CSRF token initialization.
868
+ * Path: /sap/bc/adt/core/http/sessions
869
+ */
870
+ const sessionsContract = { getSession: () => http$1.get("/sap/bc/adt/core/http/sessions", {
871
+ responses: { 200: http$2 },
872
+ headers: {
873
+ Accept: "application/vnd.sap.adt.core.http.session.v3+xml",
874
+ "x-csrf-token": "Fetch",
875
+ "X-sap-adt-sessiontype": "stateful",
876
+ "x-sap-security-session": "create"
877
+ }
878
+ }) };
879
+
880
+ //#endregion
881
+ //#region src/adt/core/http/systeminformation.ts
882
+ /**
883
+ * SAP ADT System Information Contract
884
+ *
885
+ * Returns system information including SAP release, client, user details.
886
+ * Path: /sap/bc/adt/core/http/systeminformation
887
+ */
888
+ const systeminformationContract = contract({ getSystemInfo: () => http$1.get("/sap/bc/adt/core/http/systeminformation", {
889
+ responses: { 200: systeminformation },
890
+ headers: { Accept: "application/vnd.sap.adt.core.http.systeminformation.v1+json" }
891
+ }) });
892
+
893
+ //#endregion
894
+ //#region src/adt/core/http/index.ts
895
+ const httpContract = {
896
+ sessions: sessionsContract,
897
+ systeminformation: systeminformationContract
898
+ };
899
+
900
+ //#endregion
901
+ //#region src/adt/core/index.ts
902
+ const coreContract = { http: httpContract };
903
+
904
+ //#endregion
905
+ //#region src/adt/repository/informationsystem/search.ts
906
+ /**
907
+ * ADT Repository Information System - Search Contract
908
+ *
909
+ * ABAP object search operations.
910
+ * Path: /sap/bc/adt/repository/informationsystem/search
911
+ */
912
+ const searchContract = { quickSearch: (options) => http$1.get("/sap/bc/adt/repository/informationsystem/search", {
913
+ query: {
914
+ operation: "quickSearch",
915
+ query: options.query,
916
+ maxResults: options.maxResults || 50,
917
+ ...options.packageName && { packageName: options.packageName },
918
+ ...options.objectType && { objectType: options.objectType }
919
+ },
920
+ responses: { 200: adtcore },
921
+ headers: { Accept: "application/xml" }
922
+ }) };
923
+
924
+ //#endregion
925
+ //#region src/adt/repository/informationsystem/usagereferences.ts
926
+ /**
927
+ * ADT Repository Information System – Usage References (Where-Used List)
928
+ *
929
+ * The SAP ADT "where-used" service is NOT a simple GET — it is a two-step
930
+ * POST flow discovered via sapcli (`sap/adt/whereused.py`) and confirmed
931
+ * against a real TRL ABAP trial system:
932
+ *
933
+ * 1. POST /sap/bc/adt/repository/informationsystem/usageReferences/scope
934
+ * + query: uri=<objectUri>&version=active
935
+ * + Content-Type: application/vnd.sap.adt.repository.usagereferences.scope.request.v1+xml
936
+ * + Accept: application/vnd.sap.adt.repository.usagereferences.scope.response.v1+xml
937
+ * + body: <usagereferences:usageScopeRequest>…</>
938
+ * → returns a <usagereferences:usageScopeResult> containing the
939
+ * backend-chosen object types, grade flags and an opaque `payload`
940
+ * blob (gzip-encoded) that must be echoed back in step 2.
941
+ *
942
+ * 2. POST /sap/bc/adt/repository/informationsystem/usageReferences
943
+ * + query: uri=<objectUri>&version=active
944
+ * + Content-Type: application/vnd.sap.adt.repository.usagereferences.request.v1+xml
945
+ * + Accept: application/vnd.sap.adt.repository.usagereferences.result.v1+xml
946
+ * + body: <usagereferences:usageReferenceRequest>
947
+ * <usagereferences:affectedObjects/>
948
+ * <usagereferences:scope>…copy from step 1 result…</>
949
+ * </>
950
+ * → returns a <usagereferences:usageReferenceResult> with all hits.
951
+ *
952
+ * Body/response are passed as plain-text XML because the usagereferences
953
+ * namespace is not yet represented as a typed `adt-schemas` XSD. Callers
954
+ * parse the response themselves (see `find-references` MCP tool).
955
+ */
956
+ /** Vendor MIME types — must match real SAP verbatim. */
957
+ const SCOPE_REQUEST_MIME = "application/vnd.sap.adt.repository.usagereferences.scope.request.v1+xml";
958
+ const SCOPE_RESPONSE_MIME = "application/vnd.sap.adt.repository.usagereferences.scope.response.v1+xml";
959
+ const SEARCH_REQUEST_MIME = "application/vnd.sap.adt.repository.usagereferences.request.v1+xml";
960
+ const SEARCH_RESPONSE_MIME = "application/vnd.sap.adt.repository.usagereferences.result.v1+xml";
961
+ const USAGEREFS_NAMESPACE = "http://www.sap.com/adt/ris/usageReferences";
962
+ /**
963
+ * Build the XML body for the step-1 scope request. sapcli always sends
964
+ * an empty `<affectedObjects/>`; the backend doesn't inspect its content
965
+ * and populates the result from the URI query parameter.
966
+ */
967
+ function buildUsageScopeRequestXml() {
968
+ return `<?xml version="1.0" encoding="UTF-8"?>
969
+ <usagereferences:usageScopeRequest xmlns:usagereferences="${USAGEREFS_NAMESPACE}">\n <usagereferences:affectedObjects/>
970
+ </usagereferences:usageScopeRequest>`;
971
+ }
972
+ /**
973
+ * Build the XML body for the step-2 search request by wrapping the raw
974
+ * step-1 scope-result XML as a `<usagereferences:scope>` element inside
975
+ * a `<usageReferenceRequest>`.
976
+ *
977
+ * We deliberately do string surgery instead of DOM manipulation because
978
+ * the `payload` element contains base64-gzip content we must not perturb.
979
+ */
980
+ function buildUsageReferenceRequestXml(scopeResultXml) {
981
+ let noProlog = scopeResultXml;
982
+ if (noProlog.startsWith("<?xml")) {
983
+ const prologEnd = noProlog.indexOf("?>");
984
+ if (prologEnd !== -1) noProlog = noProlog.slice(prologEnd + 2).replace(/^\s+/, "");
985
+ }
986
+ return `<?xml version="1.0" encoding="UTF-8"?>
987
+ <usagereferences:usageReferenceRequest xmlns:usagereferences="${USAGEREFS_NAMESPACE}">\n <usagereferences:affectedObjects/>
988
+ ${noProlog.replaceAll(/usagereferences:usageScopeResult/g, "usagereferences:scope")}\n</usagereferences:usageReferenceRequest>`;
989
+ }
990
+ /**
991
+ * Step 1: fetch the default scope for a given object URI.
992
+ *
993
+ * Typed body/response are plain XML strings — the contract provides
994
+ * URL/header/method shape, callers provide the marshalled body via
995
+ * {@link buildUsageScopeRequestXml}.
996
+ */
997
+ const scope = contract({ post: (params) => http$1.post("/sap/bc/adt/repository/informationsystem/usageReferences/scope", {
998
+ query: {
999
+ uri: params.uri,
1000
+ version: params.version ?? "active"
1001
+ },
1002
+ body: textPlain,
1003
+ responses: { 200: void 0 },
1004
+ headers: {
1005
+ Accept: SCOPE_RESPONSE_MIME,
1006
+ "Content-Type": SCOPE_REQUEST_MIME
1007
+ }
1008
+ }) });
1009
+ /**
1010
+ * Step 2: execute the where-used search using the scope blob from step 1.
1011
+ */
1012
+ const search = contract({ post: (params) => http$1.post("/sap/bc/adt/repository/informationsystem/usageReferences", {
1013
+ query: {
1014
+ uri: params.uri,
1015
+ version: params.version ?? "active"
1016
+ },
1017
+ body: textPlain,
1018
+ responses: { 200: void 0 },
1019
+ headers: {
1020
+ Accept: SEARCH_RESPONSE_MIME,
1021
+ "Content-Type": SEARCH_REQUEST_MIME
1022
+ }
1023
+ }) });
1024
+ const usageReferencesContract = {
1025
+ scope,
1026
+ search
1027
+ };
1028
+
1029
+ //#endregion
1030
+ //#region src/adt/repository/informationsystem/index.ts
1031
+ const informationsystemContract = {
1032
+ search: searchContract,
1033
+ usageReferences: usageReferencesContract
1034
+ };
1035
+
1036
+ //#endregion
1037
+ //#region src/adt/repository/objectstructure.ts
1038
+ /**
1039
+ * ADT Repository – generic Object Structure endpoint.
1040
+ *
1041
+ * Most typed object contracts (`programs`, `classes`, …) already expose
1042
+ * their own `.objectstructure()` method via the CRUD helper. This
1043
+ * contract handles the *generic* case used by the workbench outline
1044
+ * CLI / MCP surfaces: an arbitrary object URI whose type does not have
1045
+ * a dedicated typed contract (e.g. DOMA, DTEL, DEVC, BDEF, SRVD, …).
1046
+ *
1047
+ * ADT endpoint:
1048
+ * GET {objectUri}/objectstructure?version=<active|inactive>
1049
+ *
1050
+ * The response shape varies wildly between object types, so the
1051
+ * returned type is `unknown` — callers handle downstream. Keeping this
1052
+ * as a typed contract (instead of a raw `client.fetch()` call) ensures
1053
+ * the generic outline path still goes through the contract layer.
1054
+ */
1055
+ const objectstructureContract = contract({ get: (params) => http$1.get(`${params.objectUri}/objectstructure`, {
1056
+ query: { ...params.version ? { version: params.version } : {} },
1057
+ responses: { 200: void 0 },
1058
+ headers: { Accept: "application/json" }
1059
+ }) });
1060
+
1061
+ //#endregion
1062
+ //#region src/adt/repository/index.ts
1063
+ const repositoryContract = {
1064
+ informationsystem: informationsystemContract,
1065
+ objectstructure: objectstructureContract
1066
+ };
1067
+
1068
+ //#endregion
1069
+ //#region src/adt/programs/programs.ts
1070
+ /**
1071
+ * ADT Programs Contract
1072
+ *
1073
+ * Endpoint: /sap/bc/adt/programs/programs
1074
+ * Full CRUD operations for ABAP programs including source code management.
1075
+ */
1076
+ /**
1077
+ * /sap/bc/adt/programs/programs
1078
+ * Full CRUD operations for ABAP programs
1079
+ *
1080
+ * Includes:
1081
+ * - Basic CRUD: get, post, put, delete
1082
+ * - Lock/Unlock: lock, unlock
1083
+ * - Object structure: objectstructure
1084
+ * - Source code: source.main.get/put
1085
+ */
1086
+ const programsContract = crud({
1087
+ basePath: "/sap/bc/adt/programs/programs",
1088
+ schema: programs,
1089
+ contentType: "application/vnd.sap.adt.programs.programs.v2+xml",
1090
+ accept: "application/vnd.sap.adt.programs.programs.v2+xml, application/vnd.sap.adt.programs.programs.v1+xml",
1091
+ sources: ["main"]
1092
+ });
1093
+
1094
+ //#endregion
1095
+ //#region src/adt/programs/includes.ts
1096
+ /**
1097
+ * ADT Program Includes Contract
1098
+ *
1099
+ * Endpoint: /sap/bc/adt/programs/includes
1100
+ * Full CRUD operations for ABAP program includes (PROG/I) including source
1101
+ * code management.
1102
+ *
1103
+ * Mirrors the shape of `programs.ts` but targets the `/programs/includes`
1104
+ * URL space and the `include:abapInclude` XML payload.
1105
+ */
1106
+ /**
1107
+ * /sap/bc/adt/programs/includes
1108
+ * Full CRUD operations for ABAP program includes
1109
+ *
1110
+ * Includes:
1111
+ * - Basic CRUD: get, post, put, delete
1112
+ * - Lock/Unlock: lock, unlock
1113
+ * - Object structure: objectstructure
1114
+ * - Source code: source.main.get/put
1115
+ *
1116
+ * Content types follow the same "v2 preferred, v1 fallback" pattern SAP
1117
+ * uses for includes (observed from real responses; matches sapcli's
1118
+ * `sap.adt.programs.Include` OBJTYPE).
1119
+ */
1120
+ const includesContract = crud({
1121
+ basePath: "/sap/bc/adt/programs/includes",
1122
+ schema: includes,
1123
+ contentType: "application/vnd.sap.adt.programs.includes.v2+xml",
1124
+ accept: "application/vnd.sap.adt.programs.includes.v2+xml, application/vnd.sap.adt.programs.includes.v1+xml, application/vnd.sap.adt.programs.includes+xml",
1125
+ sources: ["main"]
1126
+ });
1127
+
1128
+ //#endregion
1129
+ //#region src/adt/programs/index.ts
1130
+ const programsModuleContract = {
1131
+ programs: programsContract,
1132
+ includes: includesContract
1133
+ };
1134
+
1135
+ //#endregion
1136
+ //#region src/adt/functions/groups.ts
1137
+ /**
1138
+ * ADT Functions Groups Contract
1139
+ *
1140
+ * Endpoint: /sap/bc/adt/functions/groups
1141
+ * Full CRUD operations for ABAP function groups including source code management.
1142
+ */
1143
+ /**
1144
+ * /sap/bc/adt/functions/groups
1145
+ * Full CRUD operations for ABAP function groups
1146
+ *
1147
+ * Includes:
1148
+ * - Basic CRUD: get, post, put, delete
1149
+ * - Lock/Unlock: lock, unlock
1150
+ * - Object structure: objectstructure
1151
+ * - Source code: source.main.get/put
1152
+ */
1153
+ const functionGroupsContract = crud({
1154
+ basePath: "/sap/bc/adt/functions/groups",
1155
+ schema: groups$1,
1156
+ contentType: "application/vnd.sap.adt.functions.groups.v3+xml",
1157
+ accept: "application/vnd.sap.adt.functions.groups.v3+xml, application/vnd.sap.adt.functions.groups.v2+xml, application/vnd.sap.adt.functions.groups.v1+xml",
1158
+ sources: ["main"]
1159
+ });
1160
+
1161
+ //#endregion
1162
+ //#region src/adt/functions/fmodules.ts
1163
+ /**
1164
+ * ADT Function Modules Contract
1165
+ *
1166
+ * Endpoint: /sap/bc/adt/functions/groups/{groupName}/fmodules/{fmName}
1167
+ * Sub-resource of function groups.
1168
+ *
1169
+ * Function modules are child objects of function groups. They have their own
1170
+ * lock lifecycle, source code, and metadata but are accessed through the
1171
+ * parent group's URL path.
1172
+ */
1173
+ const contentType$2 = "application/vnd.sap.adt.functions.fmodules.v3+xml";
1174
+ const accept$2 = "application/vnd.sap.adt.functions.fmodules.v3+xml, application/vnd.sap.adt.functions.fmodules.v2+xml, application/vnd.sap.adt.functions.fmodules.v1+xml";
1175
+ const basePath$4 = "/sap/bc/adt/functions/groups/${groupName}/fmodules";
1176
+ /**
1177
+ * /sap/bc/adt/functions/groups/{groupName}/fmodules
1178
+ * CRUD operations for function modules within a function group
1179
+ */
1180
+ const functionModulesContract = contract({
1181
+ get: (_groupName, _fmName) => http$1.get(basePath$4 + "/${fmName}", {
1182
+ responses: { 200: fmodules },
1183
+ headers: { Accept: accept$2 }
1184
+ }),
1185
+ post: (groupName, queryOptions) => http$1.post(basePath$4, {
1186
+ body: fmodules,
1187
+ responses: { 200: fmodules },
1188
+ headers: {
1189
+ Accept: accept$2,
1190
+ "Content-Type": contentType$2
1191
+ },
1192
+ query: queryOptions?.corrNr ? { corrNr: queryOptions.corrNr } : void 0
1193
+ }),
1194
+ put: (groupName, fmName, options) => http$1.put(basePath$4 + "/${fmName}", {
1195
+ body: fmodules,
1196
+ responses: { 200: fmodules },
1197
+ headers: {
1198
+ Accept: accept$2,
1199
+ "Content-Type": contentType$2
1200
+ },
1201
+ query: {
1202
+ ...options?.lockHandle ? { lockHandle: options.lockHandle } : {},
1203
+ ...options?.corrNr ? { corrNr: options.corrNr } : {}
1204
+ }
1205
+ }),
1206
+ delete: (groupName, fmName, options) => http$1.delete(basePath$4 + "/${fmName}", {
1207
+ responses: { 204: void 0 },
1208
+ query: {
1209
+ ...options?.lockHandle ? { lockHandle: options.lockHandle } : {},
1210
+ ...options?.corrNr ? { corrNr: options.corrNr } : {}
1211
+ }
1212
+ }),
1213
+ lock: (groupName, fmName, options) => http$1.post(basePath$4 + "/${fmName}", {
1214
+ responses: { 200: void 0 },
1215
+ headers: {
1216
+ "X-sap-adt-sessiontype": "stateful",
1217
+ "x-sap-security-session": "use",
1218
+ Accept: "application/*,application/vnd.sap.as+xml;charset=UTF-8;dataname=com.sap.adt.lock.result"
1219
+ },
1220
+ query: {
1221
+ _action: "LOCK",
1222
+ accessMode: options?.accessMode ?? "MODIFY",
1223
+ ...options?.corrNr ? { corrNr: options.corrNr } : {}
1224
+ }
1225
+ }),
1226
+ unlock: (groupName, fmName, options) => http$1.post(basePath$4 + "/${fmName}", {
1227
+ responses: { 200: void 0 },
1228
+ headers: {
1229
+ "X-sap-adt-sessiontype": "stateful",
1230
+ "x-sap-security-session": "use"
1231
+ },
1232
+ query: {
1233
+ _action: "UNLOCK",
1234
+ accessMode: "MODIFY",
1235
+ lockHandle: options.lockHandle
1236
+ }
1237
+ }),
1238
+ source: { main: {
1239
+ get: (_groupName, _fmName) => http$1.get(basePath$4 + "/${fmName}/source/main", {
1240
+ responses: { 200: void 0 },
1241
+ headers: { Accept: "text/plain" }
1242
+ }),
1243
+ put: (groupName, fmName, options) => http$1.put(basePath$4 + "/${fmName}/source/main", {
1244
+ body: textPlain,
1245
+ responses: { 200: void 0 },
1246
+ headers: {
1247
+ Accept: "text/plain",
1248
+ "Content-Type": "text/plain"
1249
+ },
1250
+ query: {
1251
+ ...options?.lockHandle ? { lockHandle: options.lockHandle } : {},
1252
+ ...options?.corrNr ? { corrNr: options.corrNr } : {}
1253
+ }
1254
+ })
1255
+ } }
1256
+ });
1257
+
1258
+ //#endregion
1259
+ //#region src/adt/functions/index.ts
1260
+ const functionsContract = { groups: {
1261
+ ...functionGroupsContract,
1262
+ fmodules: functionModulesContract
1263
+ } };
1264
+
1265
+ //#endregion
1266
+ //#region src/adt/ddic/domains.ts
1267
+ /**
1268
+ * DDIC Domain Contract
1269
+ *
1270
+ * ADT endpoint: /sap/bc/adt/ddic/domains
1271
+ * Content-Type: application/vnd.sap.adt.domains.v2+xml
1272
+ * Object type: DOMA/DD (domadd)
1273
+ */
1274
+ const domainsContract = crud({
1275
+ basePath: "/sap/bc/adt/ddic/domains",
1276
+ schema: domain,
1277
+ contentType: "application/vnd.sap.adt.domains.v2+xml",
1278
+ accept: "application/vnd.sap.adt.domains.v2+xml, application/vnd.sap.adt.domains.v1+xml"
1279
+ });
1280
+
1281
+ //#endregion
1282
+ //#region src/adt/ddic/dataelements.ts
1283
+ /**
1284
+ * DDIC Data Element Contract
1285
+ *
1286
+ * ADT endpoint: /sap/bc/adt/ddic/dataelements
1287
+ * Content-Type: application/vnd.sap.adt.dataelements.v2+xml
1288
+ * Object type: DTEL/DE (dtelde)
1289
+ */
1290
+ const dataelementsContract = crud({
1291
+ basePath: "/sap/bc/adt/ddic/dataelements",
1292
+ schema: dataelementWrapper,
1293
+ contentType: "application/vnd.sap.adt.dataelements.v2+xml",
1294
+ accept: "application/vnd.sap.adt.dataelements.v2+xml, application/vnd.sap.adt.dataelements.v1+xml"
1295
+ });
1296
+
1297
+ //#endregion
1298
+ //#region src/adt/ddic/structures.ts
1299
+ /**
1300
+ * DDIC Structure Contract
1301
+ *
1302
+ * ADT endpoint: /sap/bc/adt/ddic/structures
1303
+ * Content-Type: application/vnd.sap.adt.structures.v2+xml
1304
+ * Object type: TABL/DS (tablds)
1305
+ *
1306
+ * Uses the custom blueSource wrapper schema because SAP wraps
1307
+ * structure responses in a blue:blueSource root element
1308
+ * (namespace http://www.sap.com/wbobj/blue) extending AbapSourceMainObject.
1309
+ */
1310
+ const basePath$3 = "/sap/bc/adt/ddic/structures";
1311
+ const contentType$1 = "application/vnd.sap.adt.structures.v2+xml";
1312
+ const accept$1 = "application/vnd.sap.adt.structures.v2+xml, application/vnd.sap.adt.structures.v1+xml";
1313
+ const structuresContract = {
1314
+ ...crud({
1315
+ basePath: basePath$3,
1316
+ schema: blueSource,
1317
+ contentType: contentType$1,
1318
+ accept: accept$1,
1319
+ sources: ["main"]
1320
+ }),
1321
+ objectstructure: (name, options) => http.get(`${basePath$3}/${name.toLowerCase()}/objectstructure`, {
1322
+ responses: { 200: void 0 },
1323
+ query: options?.version ? { version: options.version } : void 0
1324
+ })
1325
+ };
1326
+
1327
+ //#endregion
1328
+ //#region src/adt/ddic/tables.ts
1329
+ /**
1330
+ * DDIC Database Table Contract
1331
+ *
1332
+ * ADT endpoint: /sap/bc/adt/ddic/tables
1333
+ * Content-Type: application/vnd.sap.adt.tables.v2+xml
1334
+ * Object type: TABL/DT (tabldt)
1335
+ *
1336
+ * Uses the custom blueSource wrapper schema because SAP wraps
1337
+ * TABL responses in a blue:blueSource root element
1338
+ * (namespace http://www.sap.com/wbobj/blue) extending AbapSourceMainObject.
1339
+ */
1340
+ const basePath$2 = "/sap/bc/adt/ddic/tables";
1341
+ const contentType = "application/vnd.sap.adt.tables.v2+xml";
1342
+ const accept = "application/vnd.sap.adt.blues.v1+xml, application/vnd.sap.adt.tables.v2+xml";
1343
+ const tablesContract = {
1344
+ ...crud({
1345
+ basePath: basePath$2,
1346
+ schema: blueSource,
1347
+ contentType,
1348
+ accept,
1349
+ sources: ["main"]
1350
+ }),
1351
+ objectstructure: (name, options) => http.get(`${basePath$2}/${name.toLowerCase()}/objectstructure`, {
1352
+ responses: { 200: void 0 },
1353
+ query: options?.version ? { version: options.version } : void 0
1354
+ })
1355
+ };
1356
+
1357
+ //#endregion
1358
+ //#region src/adt/ddic/tablesettings.ts
1359
+ /**
1360
+ * DDIC Database Table Settings Contract
1361
+ *
1362
+ * ADT endpoint: /sap/bc/adt/ddic/db/settings/{name}
1363
+ * Content-Type: application/vnd.sap.adt.table.settings.v2+xml
1364
+ *
1365
+ * Returns the technical DD09L settings for a database table as an XML
1366
+ * document. ADK currently consumes this as raw text, so the contract is
1367
+ * typed as a plain-text endpoint.
1368
+ */
1369
+ const basePath$1 = "/sap/bc/adt/ddic/db/settings";
1370
+ const tablesettingsContract = contract({ get: (name) => http$1.get(`${basePath$1}/${name.toLowerCase()}`, {
1371
+ responses: { 200: void 0 },
1372
+ headers: { Accept: "application/vnd.sap.adt.table.settings.v2+xml" }
1373
+ }) });
1374
+
1375
+ //#endregion
1376
+ //#region src/adt/ddic/tabletypes.ts
1377
+ /**
1378
+ * DDIC Table Type Contract
1379
+ *
1380
+ * ADT endpoint: /sap/bc/adt/ddic/tabletypes
1381
+ * Content-Type: application/vnd.sap.adt.tabletype.v1+xml
1382
+ * Object type: TTYP/TT
1383
+ */
1384
+ const tabletypesContract = crud({
1385
+ basePath: "/sap/bc/adt/ddic/tabletypes",
1386
+ schema: tabletype,
1387
+ contentType: "application/vnd.sap.adt.tabletype.v1+xml",
1388
+ accept: "application/vnd.sap.adt.tabletype.v1+xml"
1389
+ });
1390
+
1391
+ //#endregion
1392
+ //#region src/adt/ddic/ddl/sources.ts
1393
+ /**
1394
+ * ADT CDS DDL Source Contract
1395
+ *
1396
+ * Endpoint: /sap/bc/adt/ddic/ddl/sources
1397
+ * Content-Type: application/vnd.sap.adt.ddl.source.v2+xml
1398
+ * Object type: DDLS
1399
+ *
1400
+ * CDS Data Definition sources — the SAP endpoint for CDS views / data
1401
+ * definitions. The metadata document lives at `{basePath}/{name}` and
1402
+ * the source text at `{basePath}/{name}/source/main`.
1403
+ */
1404
+ const ddlSourcesContract = crud({
1405
+ basePath: "/sap/bc/adt/ddic/ddl/sources",
1406
+ schema: ddlSource,
1407
+ contentType: "application/vnd.sap.adt.ddl.source.v2+xml",
1408
+ accept: "application/vnd.sap.adt.ddl.source.v2+xml, application/vnd.sap.adt.ddl.source.v1+xml",
1409
+ sources: ["main"]
1410
+ });
1411
+
1412
+ //#endregion
1413
+ //#region src/adt/ddic/ddl/index.ts
1414
+ const ddlContract = { sources: ddlSourcesContract };
1415
+
1416
+ //#endregion
1417
+ //#region src/adt/ddic/dcl/sources.ts
1418
+ /**
1419
+ * ADT CDS DCL (Access Control) Source Contract
1420
+ *
1421
+ * Endpoint: /sap/bc/adt/acm/dcl/sources
1422
+ * (Note: the SAP endpoint for DCL sources lives under `acm/dcl`, not
1423
+ * `ddic/dcl`. The contract is exported under `ddic.dcl` for API
1424
+ * parity with the ADK and the sibling DDL contract.)
1425
+ * Content-Type: application/vnd.sap.adt.acm.dcl.source.v1+xml
1426
+ * Object type: DCLS
1427
+ */
1428
+ const dclSourcesContract = crud({
1429
+ basePath: "/sap/bc/adt/acm/dcl/sources",
1430
+ schema: dclSource,
1431
+ contentType: "application/vnd.sap.adt.acm.dcl.source.v1+xml",
1432
+ accept: "application/vnd.sap.adt.acm.dcl.source.v1+xml",
1433
+ sources: ["main"]
1434
+ });
1435
+
1436
+ //#endregion
1437
+ //#region src/adt/ddic/dcl/index.ts
1438
+ const dclContract = { sources: dclSourcesContract };
1439
+
1440
+ //#endregion
1441
+ //#region src/adt/ddic/srvd/sources.ts
1442
+ /**
1443
+ * ADT RAP Service Definition (SRVD) Source Contract
1444
+ *
1445
+ * Endpoint: /sap/bc/adt/ddic/srvd/sources
1446
+ * Content-Type: application/vnd.sap.adt.ddic.srvd.v1+xml
1447
+ * Object type: SRVD/SRV
1448
+ *
1449
+ * RAP Service Definition — CDS-like source that exposes CDS root
1450
+ * entities/behaviors via OData. Mirrors the DDL sources shape: metadata
1451
+ * document at `{basePath}/{name}`, source text (`.asrvd`) at
1452
+ * `{basePath}/{name}/source/main`.
1453
+ *
1454
+ * Reference: abapGit handler zcl_abapgit_object_srvd.
1455
+ */
1456
+ const srvdSourcesContract = crud({
1457
+ basePath: "/sap/bc/adt/ddic/srvd/sources",
1458
+ schema: srvdSource,
1459
+ contentType: "application/vnd.sap.adt.ddic.srvd.v1+xml",
1460
+ accept: "application/vnd.sap.adt.ddic.srvd.v1+xml",
1461
+ sources: ["main"]
1462
+ });
1463
+
1464
+ //#endregion
1465
+ //#region src/adt/ddic/srvd/index.ts
1466
+ const srvdContract = { sources: srvdSourcesContract };
1467
+
1468
+ //#endregion
1469
+ //#region src/adt/ddic/index.ts
1470
+ const ddicContract = {
1471
+ domains: domainsContract,
1472
+ dataelements: dataelementsContract,
1473
+ structures: structuresContract,
1474
+ tables: tablesContract,
1475
+ tablesettings: tablesettingsContract,
1476
+ tabletypes: tabletypesContract,
1477
+ ddl: ddlContract,
1478
+ dcl: dclContract,
1479
+ srvd: srvdContract
1480
+ };
1481
+
1482
+ //#endregion
1483
+ //#region src/adt/system/users.ts
1484
+ /**
1485
+ * ADT System Users Contract
1486
+ *
1487
+ * User lookup and search operations.
1488
+ * Path: /sap/bc/adt/system/users
1489
+ */
1490
+ const usersContract = {
1491
+ search: (options) => http$1.get("/sap/bc/adt/system/users", {
1492
+ query: {
1493
+ querystring: options.querystring,
1494
+ ...options.maxcount !== void 0 && { maxcount: options.maxcount }
1495
+ },
1496
+ responses: { 200: atomFeed },
1497
+ headers: { Accept: "application/atom+xml;type=feed" }
1498
+ }),
1499
+ get: (username) => http$1.get(`/sap/bc/adt/system/users/${encodeURIComponent(username)}`, {
1500
+ responses: { 200: atomFeed },
1501
+ headers: { Accept: "application/atom+xml;type=feed" }
1502
+ })
1503
+ };
1504
+
1505
+ //#endregion
1506
+ //#region src/adt/system/security/pses.ts
1507
+ /**
1508
+ * ADT System Security / STRUST Contracts
1509
+ *
1510
+ * Contract surface for SAP STRUST (SSL Personal Security Environment)
1511
+ * over the ADT REST API. Paths under `/sap/bc/adt/system/security/pses`.
1512
+ *
1513
+ * NOTE: sapcli (jfilak/sapcli) drives STRUST via RFC function modules
1514
+ * (`sap/rfc/strust.py`), not ADT. The paths below follow the
1515
+ * `/sap/bc/adt/system/...` convention used elsewhere in the SAP ADT
1516
+ * REST surface (see `system/users`). See the accompanying TODO-synthetic
1517
+ * fixtures in `@abapify/adt-fixtures` — replace with real captures when
1518
+ * available.
1519
+ */
1520
+ /**
1521
+ * Inferrable schema wrapper for a PEM (plain-text) request body.
1522
+ * Makes `uploadCertificate` accept a `pem: string` argument at the client
1523
+ * call-site — speci's `BuildParams` only appends a body parameter when
1524
+ * the body is marked Inferrable via the `_infer` tag.
1525
+ */
1526
+ const pemBody = { _infer: void 0 };
1527
+ const psesContract = {
1528
+ list: () => http$1.get("/sap/bc/adt/system/security/pses", {
1529
+ responses: { 200: atomFeed },
1530
+ headers: { Accept: "application/atom+xml;type=feed" }
1531
+ }),
1532
+ get: (context, applic) => http$1.get(`/sap/bc/adt/system/security/pses/${encodeURIComponent(context)}/${encodeURIComponent(applic)}`, {
1533
+ responses: { 200: atomFeed },
1534
+ headers: { Accept: "application/atom+xml;type=feed" }
1535
+ }),
1536
+ listCertificates: (context, applic) => http$1.get(`/sap/bc/adt/system/security/pses/${encodeURIComponent(context)}/${encodeURIComponent(applic)}/certificates`, {
1537
+ responses: { 200: atomFeed },
1538
+ headers: { Accept: "application/atom+xml;type=feed" }
1539
+ }),
1540
+ getCertificate: (context, applic, id) => http$1.get(`/sap/bc/adt/system/security/pses/${encodeURIComponent(context)}/${encodeURIComponent(applic)}/certificates/${encodeURIComponent(id)}`, {
1541
+ responses: { 200: void 0 },
1542
+ headers: { Accept: "application/x-pem-file" }
1543
+ }),
1544
+ uploadCertificate: (context, applic) => http$1.post(`/sap/bc/adt/system/security/pses/${encodeURIComponent(context)}/${encodeURIComponent(applic)}/certificates`, {
1545
+ body: pemBody,
1546
+ responses: { 200: atomFeed },
1547
+ headers: {
1548
+ Accept: "application/atom+xml;type=feed",
1549
+ "Content-Type": "application/x-pem-file"
1550
+ }
1551
+ }),
1552
+ deleteCertificate: (context, applic, id) => http$1.delete(`/sap/bc/adt/system/security/pses/${encodeURIComponent(context)}/${encodeURIComponent(applic)}/certificates/${encodeURIComponent(id)}`, { responses: { 204: void 0 } })
1553
+ };
1554
+
1555
+ //#endregion
1556
+ //#region src/adt/system/index.ts
1557
+ const systemContract = {
1558
+ users: usersContract,
1559
+ security: { pses: psesContract }
1560
+ };
1561
+
1562
+ //#endregion
1563
+ //#region src/adt/checkruns/index.ts
1564
+ /**
1565
+ * ADT Checkruns Contract
1566
+ *
1567
+ * Manually-defined endpoint for ABAP syntax check runs.
1568
+ *
1569
+ * Structure mirrors URL tree:
1570
+ * - /sap/bc/adt/checkruns → checkruns.checkObjects (POST with body)
1571
+ *
1572
+ * NOTE: Not in SAP discovery - manually defined
1573
+ */
1574
+ /**
1575
+ * /sap/bc/adt/checkruns
1576
+ *
1577
+ * Run a syntax/check-run on a list of ABAP objects.
1578
+ * Request body: checkObjectList (chkrun:CheckObjectList)
1579
+ * Response: checkRunReports (chkrun:CheckReportList)
1580
+ */
1581
+ const checkObjects = contract({ post: () => http$1.post("/sap/bc/adt/checkruns", {
1582
+ body: checkrun,
1583
+ responses: { 200: checkrun },
1584
+ headers: {
1585
+ Accept: "application/vnd.sap.adt.checkmessages+xml",
1586
+ "Content-Type": "application/vnd.sap.adt.checkobjects+xml"
1587
+ }
1588
+ }) });
1589
+ /**
1590
+ * Combined Checkruns contract
1591
+ */
1592
+ const checkrunsContract = { checkObjects };
1593
+
1594
+ //#endregion
1595
+ //#region src/adt/activation/index.ts
1596
+ /**
1597
+ * ADT Activation Contract
1598
+ *
1599
+ * Manually-defined endpoint for ABAP object activation.
1600
+ *
1601
+ * Structure mirrors URL tree:
1602
+ * - /sap/bc/adt/activation → activation.activate (POST with body)
1603
+ *
1604
+ * NOTE: Not in SAP discovery - manually defined
1605
+ */
1606
+ /**
1607
+ * /sap/bc/adt/activation
1608
+ *
1609
+ * Activate one or more ABAP objects.
1610
+ * Request body: adtcore:objectReferences (AdtcoreSchema variant)
1611
+ */
1612
+ const activate = contract({ post: (params) => http$1.post("/sap/bc/adt/activation", {
1613
+ query: params,
1614
+ body: adtcore,
1615
+ responses: { 200: adtcore },
1616
+ headers: {
1617
+ Accept: "application/xml",
1618
+ "Content-Type": "application/xml"
1619
+ }
1620
+ }) });
1621
+ /**
1622
+ * Combined Activation contract
1623
+ */
1624
+ const activationContract = { activate };
1625
+
1626
+ //#endregion
1627
+ //#region src/adt/datapreview/schema.ts
1628
+ /**
1629
+ * Hand-built Serializable schema for the data preview freestyle response.
1630
+ *
1631
+ * Shape mirrors the ts-xsd `TypedSchema` pattern so it plugs into speci's
1632
+ * `Inferrable`/`Serializable` type inference (`_infer`, `parse`, `build`).
1633
+ *
1634
+ * The adapter calls `schema.parse(raw)` / `schema.build(data)`, so we keep
1635
+ * both sides as plain JSON (de)serialisation.
1636
+ */
1637
+ const dataPreviewFreestyleResponseSchema = {
1638
+ _infer: void 0,
1639
+ parse: (raw) => {
1640
+ if (raw == null || raw === "") return {};
1641
+ return JSON.parse(raw);
1642
+ },
1643
+ build: (data) => JSON.stringify(data)
1644
+ };
1645
+ /**
1646
+ * Request-body schema: the endpoint accepts a raw SQL SELECT string as
1647
+ * `text/plain`. We still model it as a Serializable so speci correctly
1648
+ * infers the `string` body parameter at the client call site.
1649
+ */
1650
+ const dataPreviewFreestyleRequestSchema = {
1651
+ _infer: void 0,
1652
+ parse: (raw) => raw,
1653
+ build: (data) => data
1654
+ };
1655
+
1656
+ //#endregion
1657
+ //#region src/adt/datapreview/freestyle.ts
1658
+ /**
1659
+ * /sap/bc/adt/datapreview/freestyle
1660
+ *
1661
+ * Executes an ABAP Open SQL SELECT statement and returns the result set as
1662
+ * JSON. Mirrors sapcli's `datapreview osql` command and the adt CLI
1663
+ * `datapreview osql` command.
1664
+ *
1665
+ * POST /sap/bc/adt/datapreview/freestyle?rowCount=<n>&outputFormat=json[&noaging=true]
1666
+ * Content-Type: text/plain
1667
+ * Accept: application/json
1668
+ * Body: raw ABAP SQL SELECT statement
1669
+ */
1670
+ const freestyle = { post: (query) => http$1.post("/sap/bc/adt/datapreview/freestyle", {
1671
+ body: dataPreviewFreestyleRequestSchema,
1672
+ responses: { 200: dataPreviewFreestyleResponseSchema },
1673
+ headers: {
1674
+ Accept: "application/json",
1675
+ "Content-Type": "text/plain"
1676
+ },
1677
+ query: {
1678
+ outputFormat: query?.outputFormat ?? "json",
1679
+ ...query?.rowCount != null ? { rowCount: query.rowCount } : {},
1680
+ ...query?.noaging ? { noaging: true } : {}
1681
+ }
1682
+ }) };
1683
+
1684
+ //#endregion
1685
+ //#region src/adt/datapreview/index.ts
1686
+ /**
1687
+ * /sap/bc/adt/datapreview
1688
+ *
1689
+ * ADT Data Preview endpoints (ABAP SQL execution, value helps, etc.)
1690
+ */
1691
+ const datapreviewContract = { freestyle };
1692
+
1693
+ //#endregion
1694
+ //#region src/adt/runtime/traces/coverage/measurements.ts
1695
+ /**
1696
+ * /sap/bc/adt/runtime/traces/coverage/measurements/{id}
1697
+ *
1698
+ * POST returns the ABAP coverage tree (cov:result) for a previously
1699
+ * created measurement. Used as the second step of the aunit → coverage
1700
+ * flow: aunit run → atom:link to measurement → POST this endpoint.
1701
+ *
1702
+ * Content-Type: application/xml+scov
1703
+ * Accept: application/xml+scov
1704
+ */
1705
+ const SCOV_CONTENT_TYPE$1 = "application/xml+scov";
1706
+ const measurements = contract({ post: (identifier) => http$1.post(`/sap/bc/adt/runtime/traces/coverage/measurements/${identifier}`, {
1707
+ query: { withAdditionalTypeInfo: true },
1708
+ responses: { 200: acoverageResult },
1709
+ headers: {
1710
+ Accept: SCOV_CONTENT_TYPE$1,
1711
+ "Content-Type": SCOV_CONTENT_TYPE$1
1712
+ }
1713
+ }) });
1714
+
1715
+ //#endregion
1716
+ //#region src/adt/runtime/traces/coverage/statements.ts
1717
+ /**
1718
+ * /sap/bc/adt/runtime/traces/coverage/results/{id}/statements
1719
+ *
1720
+ * GET returns the cov:statementsBulkResponse with per-method statement
1721
+ * / branch / procedure coverage details.
1722
+ *
1723
+ * Content-Type: application/xml+scov
1724
+ */
1725
+ const SCOV_CONTENT_TYPE = "application/xml+scov";
1726
+ const statements = contract({ get: (identifier) => http$1.get(`/sap/bc/adt/runtime/traces/coverage/results/${identifier}/statements`, {
1727
+ responses: { 200: acoverageStatements },
1728
+ headers: { Accept: SCOV_CONTENT_TYPE }
1729
+ }) });
1730
+
1731
+ //#endregion
1732
+ //#region src/adt/runtime/traces/coverage/index.ts
1733
+ /**
1734
+ * /sap/bc/adt/runtime/traces/coverage
1735
+ *
1736
+ * ABAP Coverage endpoints. Used as a follow-up to ABAP Unit runs that
1737
+ * request coverage — the aunit runResult contains an atom:link pointing
1738
+ * to a measurement ID which is then POSTed here.
1739
+ */
1740
+ const coverageContract = {
1741
+ measurements,
1742
+ statements
1743
+ };
1744
+
1745
+ //#endregion
1746
+ //#region src/adt/runtime/schema.ts
1747
+ function parseJsonOrRaw$1(raw) {
1748
+ if (!raw) return {};
1749
+ const trimmed = raw.trim();
1750
+ if (trimmed.startsWith("{") || trimmed.startsWith("[")) return JSON.parse(trimmed);
1751
+ return { raw };
1752
+ }
1753
+ function buildJson(value) {
1754
+ return JSON.stringify(value);
1755
+ }
1756
+ const runtimeDumpListSchema = {
1757
+ _infer: void 0,
1758
+ parse: (raw) => parseJsonOrRaw$1(raw),
1759
+ build: (value) => buildJson(value)
1760
+ };
1761
+ const runtimeDumpDetailSchema = {
1762
+ _infer: void 0,
1763
+ parse: (raw) => parseJsonOrRaw$1(raw),
1764
+ build: (value) => buildJson(value)
1765
+ };
1766
+ const runtimeTraceListSchema = {
1767
+ _infer: void 0,
1768
+ parse: (raw) => parseJsonOrRaw$1(raw),
1769
+ build: (value) => buildJson(value)
1770
+ };
1771
+ const runtimeTraceDetailSchema = {
1772
+ _infer: void 0,
1773
+ parse: (raw) => parseJsonOrRaw$1(raw),
1774
+ build: (value) => buildJson(value)
1775
+ };
1776
+
1777
+ //#endregion
1778
+ //#region src/adt/runtime/traces/profile.ts
1779
+ /**
1780
+ * /sap/bc/adt/runtime/traces
1781
+ *
1782
+ * Runtime trace list and detail endpoints used by diagnostics tooling.
1783
+ */
1784
+ const profile = contract({
1785
+ list: () => http$1.get("/sap/bc/adt/runtime/traces", {
1786
+ responses: { 200: runtimeTraceListSchema },
1787
+ headers: { Accept: "application/json" }
1788
+ }),
1789
+ hitlist: (id) => http$1.get(`/sap/bc/adt/runtime/traces/${id}/hitlist`, {
1790
+ responses: { 200: runtimeTraceDetailSchema },
1791
+ headers: { Accept: "application/json" }
1792
+ }),
1793
+ dbAccesses: (id) => http$1.get(`/sap/bc/adt/runtime/traces/${id}/dbaccesses`, {
1794
+ responses: { 200: runtimeTraceDetailSchema },
1795
+ headers: { Accept: "application/json" }
1796
+ })
1797
+ });
1798
+
1799
+ //#endregion
1800
+ //#region src/adt/runtime/traces/index.ts
1801
+ /**
1802
+ * /sap/bc/adt/runtime/traces
1803
+ *
1804
+ * Runtime trace endpoints (currently only ABAP coverage).
1805
+ */
1806
+ const tracesContract = {
1807
+ coverage: coverageContract,
1808
+ profile
1809
+ };
1810
+
1811
+ //#endregion
1812
+ //#region src/adt/runtime/dumps.ts
1813
+ /**
1814
+ * /sap/bc/adt/runtime/dumps
1815
+ *
1816
+ * Short dump listing and details.
1817
+ */
1818
+ const dumps = contract({
1819
+ list: (query) => http$1.get("/sap/bc/adt/runtime/dumps", {
1820
+ responses: { 200: runtimeDumpListSchema },
1821
+ headers: { Accept: "application/json" },
1822
+ query: {
1823
+ ...query?.user ? { user: query.user } : {},
1824
+ ...query?.maxResults != null ? { maxResults: query.maxResults } : {}
1825
+ }
1826
+ }),
1827
+ get: (id) => http$1.get(`/sap/bc/adt/runtime/dumps/${id}`, {
1828
+ responses: { 200: runtimeDumpDetailSchema },
1829
+ headers: { Accept: "application/json" }
1830
+ })
1831
+ });
1832
+
1833
+ //#endregion
1834
+ //#region src/adt/runtime/index.ts
1835
+ /**
1836
+ * /sap/bc/adt/runtime
1837
+ *
1838
+ * ABAP runtime endpoints (traces, coverage, …).
1839
+ */
1840
+ const runtimeContract = {
1841
+ traces: tracesContract,
1842
+ dumps
1843
+ };
1844
+
1845
+ //#endregion
1846
+ //#region src/adt/gcts/schema.ts
1847
+ function jsonSchema$1() {
1848
+ return {
1849
+ _infer: void 0,
1850
+ parse: (raw) => {
1851
+ if (raw == null || raw === "") return {};
1852
+ return JSON.parse(raw);
1853
+ },
1854
+ build: (data) => JSON.stringify(data)
1855
+ };
1856
+ }
1857
+ const gctsRepositoriesSchema = jsonSchema$1();
1858
+ const gctsRepositorySchema = jsonSchema$1();
1859
+ const gctsCreateRepositoryBodySchema = jsonSchema$1();
1860
+ const gctsSetItemBodySchema = jsonSchema$1();
1861
+ const gctsBranchesSchema = jsonSchema$1();
1862
+ const gctsCreateBranchBodySchema = jsonSchema$1();
1863
+ const gctsCreateBranchResponseSchema = jsonSchema$1();
1864
+ const gctsSetConfigBodySchema = jsonSchema$1();
1865
+ const gctsConfigSchema = jsonSchema$1();
1866
+ const gctsLogSchema = jsonSchema$1();
1867
+ const gctsPullSchema = jsonSchema$1();
1868
+ const gctsObjectsSchema = jsonSchema$1();
1869
+ const gctsCommitBodySchema = jsonSchema$1();
1870
+ const gctsCommitResponseSchema = jsonSchema$1();
1871
+ const gctsGenericOkSchema = jsonSchema$1();
1872
+
1873
+ //#endregion
1874
+ //#region src/adt/gcts/repository.ts
1875
+ /**
1876
+ * /sap/bc/cts_abapvcs/repository/**
1877
+ *
1878
+ * gCTS repository endpoints. Shapes mirror sapcli's
1879
+ * `Repository` / `simple.fetch_repos` behaviour.
1880
+ */
1881
+ const BASE$3 = "/sap/bc/cts_abapvcs/repository";
1882
+ /** List all repositories (GET /repository). */
1883
+ const list$4 = () => http$1.get(BASE$3, {
1884
+ responses: { 200: gctsRepositoriesSchema },
1885
+ headers: { Accept: "application/json" }
1886
+ });
1887
+ /** Get a single repository (GET /repository/<rid>). */
1888
+ const get$4 = (rid) => http$1.get(`${BASE$3}/${rid}`, {
1889
+ responses: { 200: gctsRepositorySchema },
1890
+ headers: { Accept: "application/json" }
1891
+ });
1892
+ /** Create a new repository (POST /repository). */
1893
+ const create$1 = () => http$1.post(BASE$3, {
1894
+ body: gctsCreateRepositoryBodySchema,
1895
+ responses: {
1896
+ 201: gctsRepositorySchema,
1897
+ 200: gctsRepositorySchema
1898
+ },
1899
+ headers: {
1900
+ Accept: "application/json",
1901
+ "Content-Type": "application/json"
1902
+ }
1903
+ });
1904
+ /** Delete a repository (DELETE /repository/<rid>). */
1905
+ const del$2 = (rid) => http$1.delete(`${BASE$3}/${rid}`, {
1906
+ responses: {
1907
+ 200: gctsGenericOkSchema,
1908
+ 204: gctsGenericOkSchema
1909
+ },
1910
+ headers: { Accept: "application/json" }
1911
+ });
1912
+ /** Clone (POST /repository/<rid>/clone). */
1913
+ const clone = (rid) => http$1.post(`${BASE$3}/${rid}/clone`, {
1914
+ responses: { 200: gctsGenericOkSchema },
1915
+ headers: { Accept: "application/json" }
1916
+ });
1917
+ /** Pull (GET /repository/<rid>/pullByCommit). */
1918
+ const pull = (rid) => http$1.get(`${BASE$3}/${rid}/pullByCommit`, {
1919
+ responses: { 200: gctsPullSchema },
1920
+ headers: { Accept: "application/json" }
1921
+ });
1922
+ /** Push (GET /repository/<rid>/push) — gCTS uses GET, not POST. */
1923
+ const push = (rid) => http$1.get(`${BASE$3}/${rid}/push`, {
1924
+ responses: { 200: gctsGenericOkSchema },
1925
+ headers: { Accept: "application/json" }
1926
+ });
1927
+ /**
1928
+ * Checkout (GET /repository/<rid>/branches/<currentBranch>/switch?branch=X).
1929
+ * Caller must supply both the *current* branch (path) and the *target* branch
1930
+ * (query) — mirrors sapcli's `Repository.checkout`.
1931
+ */
1932
+ const checkout = (rid, currentBranch, targetBranch) => http$1.get(`${BASE$3}/${rid}/branches/${currentBranch}/switch`, {
1933
+ query: { branch: targetBranch },
1934
+ responses: { 200: gctsGenericOkSchema },
1935
+ headers: { Accept: "application/json" }
1936
+ });
1937
+ /** Commit history (GET /repository/<rid>/getCommit). */
1938
+ const log = (rid) => http$1.get(`${BASE$3}/${rid}/getCommit`, {
1939
+ responses: { 200: gctsLogSchema },
1940
+ headers: { Accept: "application/json" }
1941
+ });
1942
+ /** Object list (GET /repository/<rid>/getObjects). */
1943
+ const objects = (rid) => http$1.get(`${BASE$3}/${rid}/getObjects`, {
1944
+ responses: { 200: gctsObjectsSchema },
1945
+ headers: { Accept: "application/json" }
1946
+ });
1947
+ /**
1948
+ * Set a repository property (POST /repository/<rid>).
1949
+ * Body is `{ <property>: <value> }`, e.g. `{ role: 'TARGET' }` or
1950
+ * `{ url: 'https://…' }`.
1951
+ */
1952
+ const setItem = (rid) => http$1.post(`${BASE$3}/${rid}`, {
1953
+ body: gctsSetItemBodySchema,
1954
+ responses: { 200: gctsGenericOkSchema },
1955
+ headers: {
1956
+ Accept: "application/json",
1957
+ "Content-Type": "application/json"
1958
+ }
1959
+ });
1960
+ const repository = {
1961
+ list: list$4,
1962
+ get: get$4,
1963
+ create: create$1,
1964
+ delete: del$2,
1965
+ clone,
1966
+ pull,
1967
+ push,
1968
+ checkout,
1969
+ log,
1970
+ objects,
1971
+ setItem
1972
+ };
1973
+
1974
+ //#endregion
1975
+ //#region src/adt/gcts/branches.ts
1976
+ /**
1977
+ * /sap/bc/cts_abapvcs/repository/<rid>/branches
1978
+ *
1979
+ * Branch management endpoints.
1980
+ */
1981
+ const base$1 = (rid) => `/sap/bc/cts_abapvcs/repository/${rid}/branches`;
1982
+ const list$3 = (rid) => http$1.get(base$1(rid), {
1983
+ responses: { 200: gctsBranchesSchema },
1984
+ headers: { Accept: "application/json" }
1985
+ });
1986
+ const create = (rid) => http$1.post(base$1(rid), {
1987
+ body: gctsCreateBranchBodySchema,
1988
+ responses: { 200: gctsCreateBranchResponseSchema },
1989
+ headers: {
1990
+ Accept: "application/json",
1991
+ "Content-Type": "application/json"
1992
+ }
1993
+ });
1994
+ const del$1 = (rid, name) => http$1.delete(`${base$1(rid)}/${name}`, {
1995
+ responses: { 200: gctsGenericOkSchema },
1996
+ headers: { Accept: "application/json" }
1997
+ });
1998
+ /**
1999
+ * Switch branches (GET /repository/<rid>/branches/<current>/switch?branch=X).
2000
+ * Alias of `repository.checkout` — exposed here for discoverability when
2001
+ * working with the `branches` sub-surface.
2002
+ */
2003
+ const switchBranch = (rid, currentBranch, target) => http$1.get(`${base$1(rid)}/${currentBranch}/switch`, {
2004
+ query: { branch: target },
2005
+ responses: { 200: gctsGenericOkSchema },
2006
+ headers: { Accept: "application/json" }
2007
+ });
2008
+ const branches = {
2009
+ list: list$3,
2010
+ create,
2011
+ delete: del$1,
2012
+ switch: switchBranch
2013
+ };
2014
+
2015
+ //#endregion
2016
+ //#region src/adt/gcts/commits.ts
2017
+ /**
2018
+ * /sap/bc/cts_abapvcs/repository/<rid>/commit
2019
+ *
2020
+ * Commit endpoint. Shapes mirror sapcli's
2021
+ * `Repository.commit` / `commit_package` / `commit_transport`.
2022
+ */
2023
+ const commit = (rid) => http$1.post(`/sap/bc/cts_abapvcs/repository/${rid}/commit`, {
2024
+ body: gctsCommitBodySchema,
2025
+ responses: { 200: gctsCommitResponseSchema },
2026
+ headers: {
2027
+ Accept: "application/json",
2028
+ "Content-Type": "application/json"
2029
+ }
2030
+ });
2031
+ const commits = { commit };
2032
+
2033
+ //#endregion
2034
+ //#region src/adt/gcts/config.ts
2035
+ /**
2036
+ * /sap/bc/cts_abapvcs/repository/<rid>/config
2037
+ *
2038
+ * Repository configuration endpoints (key/value pairs).
2039
+ */
2040
+ const base = (rid) => `/sap/bc/cts_abapvcs/repository/${rid}/config`;
2041
+ /** GET single config value: /repository/<rid>/config/<key>. */
2042
+ const get$3 = (rid, key) => http$1.get(`${base(rid)}/${key}`, {
2043
+ responses: { 200: gctsConfigSchema },
2044
+ headers: { Accept: "application/json" }
2045
+ });
2046
+ /** POST /repository/<rid>/config — body `{ key, value }`. */
2047
+ const set = (rid) => http$1.post(base(rid), {
2048
+ body: gctsSetConfigBodySchema,
2049
+ responses: { 200: gctsGenericOkSchema },
2050
+ headers: {
2051
+ Accept: "application/json",
2052
+ "Content-Type": "application/json"
2053
+ }
2054
+ });
2055
+ /** DELETE /repository/<rid>/config/<key>. */
2056
+ const del = (rid, key) => http$1.delete(`${base(rid)}/${key}`, {
2057
+ responses: { 200: gctsGenericOkSchema },
2058
+ headers: { Accept: "application/json" }
2059
+ });
2060
+ const config = {
2061
+ get: get$3,
2062
+ set,
2063
+ delete: del
2064
+ };
2065
+
2066
+ //#endregion
2067
+ //#region src/adt/gcts/index.ts
2068
+ /**
2069
+ * /sap/bc/cts_abapvcs — gCTS (git-enabled CTS) contracts.
2070
+ *
2071
+ * Separate REST surface from /sap/bc/adt. Exposed as `client.adt.gcts.*`
2072
+ * for parity with sapcli's `sap gcts` CLI surface.
2073
+ */
2074
+ const gctsContract = {
2075
+ repository,
2076
+ branches,
2077
+ commits,
2078
+ config
2079
+ };
2080
+
2081
+ //#endregion
2082
+ //#region src/adt/bo/behaviordefinitions.ts
2083
+ /**
2084
+ * ADT Behavior Definition (BDEF) Contract
2085
+ *
2086
+ * Endpoint: /sap/bc/adt/bo/behaviordefinitions/{name}
2087
+ * /sap/bc/adt/bo/behaviordefinitions/{name}/source/main
2088
+ *
2089
+ * Object type: BDEF/BDO
2090
+ * Content-Type: application/vnd.sap.adt.blues.v1+xml
2091
+ *
2092
+ * SAP wraps BDEF metadata in the shared `blue:blueSource` wrapper
2093
+ * (namespace http://www.sap.com/wbobj/blue) that extends
2094
+ * abapsource:AbapSourceMainObject — the same envelope used by
2095
+ * DDIC TABL/Structure responses. The BDEF source (`.abdl`) is
2096
+ * served as text/plain via `source/main`.
2097
+ *
2098
+ * Reference: sapcli `sap/adt/objects.py` (class BehaviorDefinition).
2099
+ */
2100
+ /**
2101
+ * /sap/bc/adt/bo/behaviordefinitions
2102
+ * Full CRUD operations for ABAP Behavior Definitions (RAP).
2103
+ *
2104
+ * Includes:
2105
+ * - Basic CRUD: get, post, put, delete
2106
+ * - Lock/Unlock: lock, unlock
2107
+ * - Object structure: objectstructure
2108
+ * - Source code: source.main.get/put (text/plain .abdl)
2109
+ */
2110
+ const behaviordefinitionsContract = crud({
2111
+ basePath: "/sap/bc/adt/bo/behaviordefinitions",
2112
+ schema: blueSource,
2113
+ contentType: "application/vnd.sap.adt.blues.v1+xml",
2114
+ accept: "application/vnd.sap.adt.blues.v1+xml",
2115
+ sources: ["main"]
2116
+ });
2117
+
2118
+ //#endregion
2119
+ //#region src/adt/bo/index.ts
2120
+ const boContract = { behaviordefinitions: behaviordefinitionsContract };
2121
+
2122
+ //#endregion
2123
+ //#region src/adt/businessservices/bindings.ts
2124
+ /**
2125
+ * ADT RAP Service Binding (SRVB) Contract
2126
+ *
2127
+ * Endpoint: /sap/bc/adt/businessservices/bindings
2128
+ * Content-Type: application/vnd.sap.adt.businessservices.servicebinding.v1+xml
2129
+ * Object type: SRVB/SVB
2130
+ *
2131
+ * RAP Service Binding — binds a Service Definition (SRVD) to a runtime
2132
+ * protocol (OData V2/V4, INA, SQL). Unlike BDEF/SRVD, SRVB is **metadata
2133
+ * only** — there is no `.abdl`/`.asrvd`-style source text. The binding
2134
+ * XML carries the service + protocol references.
2135
+ *
2136
+ * Extra operations vs plain `crud()`:
2137
+ * - publish → POST {basePath}/{name}/publishedstates
2138
+ * - unpublish → DELETE {basePath}/{name}/publishedstates
2139
+ *
2140
+ * Reference: abapGit handler zcl_abapgit_object_srvb.
2141
+ */
2142
+ const basePath = "/sap/bc/adt/businessservices/bindings";
2143
+ const nameTransform = (n) => n.toLowerCase();
2144
+ const baseContract = crud({
2145
+ basePath,
2146
+ schema: servicebinding,
2147
+ contentType: "application/vnd.sap.adt.businessservices.servicebinding.v1+xml",
2148
+ accept: "application/vnd.sap.adt.businessservices.servicebinding.v1+xml"
2149
+ });
2150
+ /**
2151
+ * Publish/unpublish extension for SRVB.
2152
+ *
2153
+ * - publish: POST {basePath}/{name}/publishedstates
2154
+ * Activates the binding in the SAP Gateway.
2155
+ * - unpublish: DELETE {basePath}/{name}/publishedstates
2156
+ * Deactivates the binding.
2157
+ */
2158
+ const bindingsContract = {
2159
+ ...baseContract,
2160
+ publish: (name) => http.post(`${basePath}/${nameTransform(name)}/publishedstates`, {
2161
+ responses: { 200: void 0 },
2162
+ headers: {
2163
+ Accept: "application/json",
2164
+ "Content-Type": "application/json"
2165
+ }
2166
+ }),
2167
+ unpublish: (name) => http.delete(`${basePath}/${nameTransform(name)}/publishedstates`, {
2168
+ responses: { 204: void 0 },
2169
+ headers: { Accept: "application/json" }
2170
+ })
2171
+ };
2172
+
2173
+ //#endregion
2174
+ //#region src/adt/businessservices/index.ts
2175
+ const businessservicesContract = { bindings: bindingsContract };
2176
+
2177
+ //#endregion
2178
+ //#region src/adt/enhancements/enhoxhh.ts
2179
+ /**
2180
+ * ADT BAdI / Enhancement Implementation (ENHO) Contract
2181
+ *
2182
+ * Endpoints:
2183
+ * /sap/bc/adt/enhancements/enhoxhh/{name}
2184
+ * /sap/bc/adt/enhancements/enhoxhh/{name}/source/main
2185
+ *
2186
+ * Object type: ENHO/XHH (enhancement implementation, BAdI container)
2187
+ * Content-Type: application/vnd.sap.adt.enhancements.enhoxhh.v1+xml
2188
+ *
2189
+ * SAP wraps the enhancement implementation in an
2190
+ * `enh:enhancementImplementation` element extending
2191
+ * `adtcore:AdtMainObject`. The BAdI implementations themselves live
2192
+ * inside the text payload served via `source/main`.
2193
+ *
2194
+ * The full XSD at `packages/adt-schemas/.xsd/sap/enhancements.xsd`
2195
+ * models the heavyweight emf tree (sourceCodePlugin, BAdI entries,
2196
+ * etc.). For CLI / MCP use we only need the AdtMainObject envelope —
2197
+ * same pattern as bdef's `blueSource` wrapper.
2198
+ *
2199
+ * sapcli reference: `sap/cli/badi.py`. In sapcli, `sap badi` lists the
2200
+ * BAdIs carried by a given Enhancement Implementation name (`-i` flag).
2201
+ */
2202
+ /**
2203
+ * /sap/bc/adt/enhancements/enhoxhh
2204
+ *
2205
+ * CRUD + lock/unlock + source/main (`/source/main` text body).
2206
+ */
2207
+ const enhoxhhContract = crud({
2208
+ basePath: "/sap/bc/adt/enhancements/enhoxhh",
2209
+ schema: badi,
2210
+ contentType: "application/vnd.sap.adt.enhancements.enhoxhh.v1+xml",
2211
+ accept: "application/vnd.sap.adt.enhancements.enhoxhh.v1+xml",
2212
+ sources: ["main"]
2213
+ });
2214
+
2215
+ //#endregion
2216
+ //#region src/adt/enhancements/index.ts
2217
+ const enhancementsContract = { enhoxhh: enhoxhhContract };
2218
+
2219
+ //#endregion
2220
+ //#region src/adt/uifsa/schema.ts
2221
+ function jsonSchema() {
2222
+ return {
2223
+ _infer: void 0,
2224
+ parse: (raw) => {
2225
+ if (raw == null || raw === "") return {};
2226
+ return JSON.parse(raw);
2227
+ },
2228
+ build: (data) => JSON.stringify(data)
2229
+ };
2230
+ }
2231
+ const flpCatalogListSchema = jsonSchema();
2232
+ const flpCatalogSchema = jsonSchema();
2233
+ const flpGroupListSchema = jsonSchema();
2234
+ const flpGroupSchema = jsonSchema();
2235
+ const flpTileListSchema = jsonSchema();
2236
+ const flpTileSchema = jsonSchema();
2237
+ /** Extract `d.results` from an OData feed response. */
2238
+ function normalizeOdataFeed(response) {
2239
+ return response?.d?.results ?? [];
2240
+ }
2241
+ /** Extract `d` from an OData single-entity response. */
2242
+ function normalizeOdataEntity(response) {
2243
+ return response?.d;
2244
+ }
2245
+
2246
+ //#endregion
2247
+ //#region src/adt/uifsa/catalogs.ts
2248
+ /**
2249
+ * Fiori Launchpad catalogs — `/sap/opu/odata/UI2/PAGE_BUILDER_PERS/Catalogs`.
2250
+ *
2251
+ * Read-only in v1 (E14 scope). Create/delete are handled by
2252
+ * `sap/flp/service.py` in sapcli but are out of scope here.
2253
+ */
2254
+ const BASE$2 = "/sap/opu/odata/UI2/PAGE_BUILDER_PERS/Catalogs";
2255
+ /** Encode an OData entity key for use in the URL segment `Catalogs('<id>')`. */
2256
+ function encodeKey$2(id) {
2257
+ return `'${encodeURIComponent(id)}'`;
2258
+ }
2259
+ /** List all catalogs. */
2260
+ const list$2 = () => http$1.get(BASE$2, {
2261
+ query: { $format: "json" },
2262
+ responses: { 200: flpCatalogListSchema },
2263
+ headers: { Accept: "application/json" }
2264
+ });
2265
+ /** Get a single catalog by its ID (e.g. `X-SAP-UI2-CATALOGPAGE:SAP_A4C…`). */
2266
+ const get$2 = (id) => http$1.get(`${BASE$2}(${encodeKey$2(id)})`, {
2267
+ query: { $format: "json" },
2268
+ responses: { 200: flpCatalogSchema },
2269
+ headers: { Accept: "application/json" }
2270
+ });
2271
+ /** List tiles (chips) that belong to a specific catalog. */
2272
+ const tiles$1 = (id) => http$1.get(`${BASE$2}(${encodeKey$2(id)})/Chips`, {
2273
+ query: { $format: "json" },
2274
+ responses: { 200: flpTileListSchema },
2275
+ headers: { Accept: "application/json" }
2276
+ });
2277
+ const catalogs = {
2278
+ list: list$2,
2279
+ get: get$2,
2280
+ tiles: tiles$1
2281
+ };
2282
+
2283
+ //#endregion
2284
+ //#region src/adt/uifsa/groups.ts
2285
+ /**
2286
+ * Fiori Launchpad groups / pages — `/sap/opu/odata/UI2/PAGE_BUILDER_PERS/Pages`.
2287
+ *
2288
+ * Read-only in v1 (E14 scope).
2289
+ */
2290
+ const BASE$1 = "/sap/opu/odata/UI2/PAGE_BUILDER_PERS/Pages";
2291
+ function encodeKey$1(id) {
2292
+ return `'${encodeURIComponent(id)}'`;
2293
+ }
2294
+ /** List all pages / groups. */
2295
+ const list$1 = () => http$1.get(BASE$1, {
2296
+ query: { $format: "json" },
2297
+ responses: { 200: flpGroupListSchema },
2298
+ headers: { Accept: "application/json" }
2299
+ });
2300
+ /** Get a single page / group by ID (e.g. `/UI2/SAMPLE_PAGE`). */
2301
+ const get$1 = (id) => http$1.get(`${BASE$1}(${encodeKey$1(id)})`, {
2302
+ query: { $format: "json" },
2303
+ responses: { 200: flpGroupSchema },
2304
+ headers: { Accept: "application/json" }
2305
+ });
2306
+ const groups = {
2307
+ list: list$1,
2308
+ get: get$1
2309
+ };
2310
+
2311
+ //#endregion
2312
+ //#region src/adt/uifsa/tiles.ts
2313
+ /**
2314
+ * Fiori Launchpad tiles (CHIPs) — `/sap/opu/odata/UI2/PAGE_BUILDER_PERS/Chips`.
2315
+ *
2316
+ * A "tile" in FLP is actually a CHIP (Collaborative Human Interface Part)
2317
+ * instance attached to a catalog / page. The Page Builder OData service
2318
+ * exposes them through the `Chips` entity set.
2319
+ *
2320
+ * Read-only in v1 (E14 scope).
2321
+ */
2322
+ const BASE = "/sap/opu/odata/UI2/PAGE_BUILDER_PERS/Chips";
2323
+ function encodeKey(id) {
2324
+ return `'${encodeURIComponent(id)}'`;
2325
+ }
2326
+ /** List all tiles known to the system. */
2327
+ const list = () => http$1.get(BASE, {
2328
+ query: { $format: "json" },
2329
+ responses: { 200: flpTileListSchema },
2330
+ headers: { Accept: "application/json" }
2331
+ });
2332
+ /** Get a single tile by its CHIP ID (e.g. `X-SAP-UI2-CHIP:/UI2/STATIC_APPLAUNCHER`). */
2333
+ const get = (id) => http$1.get(`${BASE}(${encodeKey(id)})`, {
2334
+ query: { $format: "json" },
2335
+ responses: { 200: flpTileSchema },
2336
+ headers: { Accept: "application/json" }
2337
+ });
2338
+ const tiles = {
2339
+ list,
2340
+ get
2341
+ };
2342
+
2343
+ //#endregion
2344
+ //#region src/adt/uifsa/index.ts
2345
+ /**
2346
+ * FLP (Fiori Launchpad) contracts — `client.adt.flp.*`.
2347
+ *
2348
+ * NOTE: The directory is named `uifsa` to match the epic spec
2349
+ * (E14 pointed at `/sap/bc/adt/uifsa/`), but the actual endpoints
2350
+ * live on the Page Builder OData service (`/sap/opu/odata/UI2/
2351
+ * PAGE_BUILDER_PERS/`). The namespace on the client is `flp` —
2352
+ * matching sapcli's user-facing command name.
2353
+ */
2354
+ const flpContract = {
2355
+ catalogs,
2356
+ groups,
2357
+ tiles
2358
+ };
2359
+
2360
+ //#endregion
2361
+ //#region src/adt/codeassistance/schema.ts
2362
+ function parseJsonOrRaw(raw) {
2363
+ if (!raw) return {};
2364
+ const trimmed = raw.trim();
2365
+ if (trimmed.startsWith("{") || trimmed.startsWith("[")) return JSON.parse(trimmed);
2366
+ return { raw };
2367
+ }
2368
+ const completionResponseSchema = {
2369
+ _infer: void 0,
2370
+ parse: parseJsonOrRaw,
2371
+ build: (value) => JSON.stringify(value)
2372
+ };
2373
+ const completionRequestSchema = {
2374
+ _infer: void 0,
2375
+ parse: (raw) => {
2376
+ if (!raw) return {};
2377
+ const trimmed = raw.trim();
2378
+ if (trimmed.startsWith("{") || trimmed.startsWith("[")) return JSON.parse(trimmed);
2379
+ return { source: raw };
2380
+ },
2381
+ build: (value) => JSON.stringify(value)
2382
+ };
2383
+
2384
+ //#endregion
2385
+ //#region src/adt/codeassistance/completion.ts
2386
+ /**
2387
+ * /sap/bc/adt/codeassistance/completion
2388
+ */
2389
+ const completion = contract({ post: (query) => http$1.post("/sap/bc/adt/codeassistance/completion", {
2390
+ body: completionRequestSchema,
2391
+ responses: { 200: completionResponseSchema },
2392
+ headers: {
2393
+ Accept: "application/json",
2394
+ "Content-Type": "application/json"
2395
+ },
2396
+ query
2397
+ }) });
2398
+
2399
+ //#endregion
2400
+ //#region src/adt/codeassistance/index.ts
2401
+ const codeassistanceContract = { completion };
2402
+
2403
+ //#endregion
2404
+ //#region src/adt/index.ts
2405
+ /**
2406
+ * Complete ADT Contract
2407
+ */
2408
+ const adtContract = {
2409
+ cts: ctsContract,
2410
+ atc: atcContract,
2411
+ aunit: aunitContract,
2412
+ oo: ooContract,
2413
+ discovery: discoveryContract,
2414
+ packages: packagesContract,
2415
+ core: coreContract,
2416
+ repository: repositoryContract,
2417
+ programs: programsModuleContract,
2418
+ functions: functionsContract,
2419
+ ddic: ddicContract,
2420
+ system: systemContract,
2421
+ checkruns: checkrunsContract,
2422
+ activation: activationContract,
2423
+ datapreview: datapreviewContract,
2424
+ runtime: runtimeContract,
2425
+ gcts: gctsContract,
2426
+ bo: boContract,
2427
+ businessservices: businessservicesContract,
2428
+ enhancements: enhancementsContract,
2429
+ flp: flpContract,
2430
+ codeassistance: codeassistanceContract
2431
+ };
2432
+
2433
+ //#endregion
2434
+ //#region src/base.ts
2435
+ /**
2436
+ * Create a typed ADT REST client.
2437
+ *
2438
+ * Contract is already known - just pass adapter options.
2439
+ */
2440
+ function createAdtClient(options) {
2441
+ return createClient(adtContract, options);
2442
+ }
2443
+ /**
2444
+ * Identity function for contract definitions.
2445
+ *
2446
+ * Schemas from ./schemas are already speci-compatible,
2447
+ * so this is just a pass-through for type safety and documentation.
2448
+ *
2449
+ * @example
2450
+ * ```ts
2451
+ * import { configurations } from './schemas';
2452
+ * import { contract, http } from '../base';
2453
+ *
2454
+ * export const myContract = contract({
2455
+ * get: () => http.get('/endpoint', {
2456
+ * responses: { 200: configurations },
2457
+ * }),
2458
+ * });
2459
+ * // Type is automatically inferred from configurations.parse() return type
2460
+ * ```
2461
+ */
2462
+ function contract(definition) {
2463
+ return definition;
2464
+ }
2465
+
2466
+ //#endregion
2467
+ export { activationContract as $, normalizeTransportFindResponse as $t, gctsCreateBranchResponseSchema as A, USAGEREFS_NAMESPACE as At, runtimeContract as B, discoveryContract as Bt, behaviordefinitionsContract as C, repositoryContract as Ct, gctsCommitResponseSchema as D, SCOPE_RESPONSE_MIME as Dt, gctsCommitBodySchema as E, SCOPE_REQUEST_MIME as Et, gctsPullSchema as F, coreContract as Ft, runtimeDumpListSchema as G, aunitContract as Gt, tracesContract as H, classrunContract as Ht, gctsRepositoriesSchema as I, httpContract as It, coverageContract as J, resultsContract as Jt, runtimeTraceDetailSchema as K, extractCoverageMeasurementId as Kt, gctsRepositorySchema as L, systeminformationContract as Lt, gctsGenericOkSchema as M, buildUsageScopeRequestXml as Mt, gctsLogSchema as N, usageReferencesContract as Nt, gctsConfigSchema as O, SEARCH_REQUEST_MIME as Ot, gctsObjectsSchema as P, searchContract as Pt, freestyle as Q, TransportStatus as Qt, gctsSetConfigBodySchema as R, sessionsContract as Rt, boContract as S, programsContract as St, gctsBranchesSchema as T, informationsystemContract as Tt, profile as U, interfacesContract as Ut, dumps as V, ooContract as Vt, runtimeDumpDetailSchema as W, classesContract as Wt, measurements as X, ctsContract as Xt, statements as Y, worklistsContract as Yt, datapreviewContract as Z, TransportFunction as Zt, normalizeOdataFeed as _, functionsContract as _t, codeassistanceContract as a, srvdContract as at, businessservicesContract as b, programsModuleContract as bt, completionResponseSchema as c, dclSourcesContract as ct, flpCatalogSchema as d, tabletypesContract as dt, transports as en, checkrunsContract as et, flpGroupListSchema as f, tablesettingsContract as ft, normalizeOdataEntity as g, domainsContract as gt, flpTileSchema as h, dataelementsContract as ht, adtContract as i, ddicContract as it, gctsCreateRepositoryBodySchema as j, buildUsageReferenceRequestXml as jt, gctsCreateBranchBodySchema as k, SEARCH_RESPONSE_MIME as kt, flpContract as l, ddlContract as lt, flpTileListSchema as m, structuresContract as mt, createAdtClient as n, repo as nn, psesContract as nt, completion as o, srvdSourcesContract as ot, flpGroupSchema as p, tablesContract as pt, runtimeTraceListSchema as q, atcContract as qt, http$1 as r, usersContract as rt, completionRequestSchema as s, dclContract as st, contract as t, crud as tn, systemContract as tt, flpCatalogListSchema as u, ddlSourcesContract as ut, enhancementsContract as v, functionModulesContract as vt, gctsContract as w, objectstructureContract as wt, bindingsContract as x, includesContract as xt, enhoxhhContract as y, functionGroupsContract as yt, gctsSetItemBodySchema as z, packagesContract as zt };
2468
+ //# sourceMappingURL=base-BsgeOhzu.mjs.map