@mcp-abap-adt/core 8.1.1 → 8.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/handlers/common/high/objectVersionTools.d.ts +48 -0
- package/dist/handlers/common/high/objectVersionTools.d.ts.map +1 -0
- package/dist/handlers/common/high/objectVersionTools.js +256 -0
- package/dist/handlers/common/high/objectVersionTools.js.map +1 -0
- package/dist/handlers/common/readonly/handleGetObjectVersionSource.d.ts +41 -0
- package/dist/handlers/common/readonly/handleGetObjectVersionSource.d.ts.map +1 -0
- package/dist/handlers/common/readonly/handleGetObjectVersionSource.js +71 -0
- package/dist/handlers/common/readonly/handleGetObjectVersionSource.js.map +1 -0
- package/dist/handlers/common/readonly/handleGetObjectVersions.d.ts +46 -0
- package/dist/handlers/common/readonly/handleGetObjectVersions.d.ts.map +1 -0
- package/dist/handlers/common/readonly/handleGetObjectVersions.js +84 -0
- package/dist/handlers/common/readonly/handleGetObjectVersions.js.map +1 -0
- package/dist/handlers/common/readonly/resolveVersionedObject.d.ts +27 -0
- package/dist/handlers/common/readonly/resolveVersionedObject.d.ts.map +1 -0
- package/dist/handlers/common/readonly/resolveVersionedObject.js +92 -0
- package/dist/handlers/common/readonly/resolveVersionedObject.js.map +1 -0
- package/dist/lib/handlers/groups/HighLevelHandlersGroup.d.ts.map +1 -1
- package/dist/lib/handlers/groups/HighLevelHandlersGroup.js +8 -0
- package/dist/lib/handlers/groups/HighLevelHandlersGroup.js.map +1 -1
- package/dist/lib/handlers/groups/ReadOnlyHandlersGroup.d.ts.map +1 -1
- package/dist/lib/handlers/groups/ReadOnlyHandlersGroup.js +10 -0
- package/dist/lib/handlers/groups/ReadOnlyHandlersGroup.js.map +1 -1
- package/docs/user-guide/AVAILABLE_TOOLS.md +361 -4
- package/docs/user-guide/AVAILABLE_TOOLS_COMPACT.md +1 -1
- package/docs/user-guide/AVAILABLE_TOOLS_HIGH.md +328 -2
- package/docs/user-guide/AVAILABLE_TOOLS_LEGACY.md +241 -4
- package/docs/user-guide/AVAILABLE_TOOLS_LOW.md +1 -1
- package/docs/user-guide/AVAILABLE_TOOLS_READONLY.md +33 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [8.3.0] - 2026-06-29
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- **Per-object high-level version tools (#30).** Added `Get<Object>Versions` and `Get<Object>VersionSource` for the 13 versioned object types (class, program, interface, function_group, function_module, table, structure, ddl, domain, data_element, package, behavior_definition, metadata_extension) to the **HighLevel** group — e.g. `GetProgramVersions`/`GetProgramVersionSource`, `GetClassVersions`/`GetClassVersionSource`. These mirror the per-object `Get<Object>` read tools (the way `GetProgram` coexists with the read-only `ReadProgram`), so development clients that run with the ReadOnly analytics group disabled still get object version history. Each tool's `available_in` matches its `Get<Object>` counterpart (e.g. `GetProgramVersions` is onprem/legacy only). The generic `GetObjectVersions`/`GetObjectVersionSource` in the ReadOnly group are unchanged.
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- **Migrated to `@mcp-abap-adt/adt-clients@^7.1.0`** (from `^7.0.1`). 7.1.0 makes where-used result parsing namespace-prefix agnostic (`usagereferences:` vs `usageReferences:`), further hardening append detection in `GetStructuresList` (#128) on systems that emit the other prefix; it also adds per-group subpath exports (`/core`, `/runtime`, …) — not yet adopted here. Non-breaking; no tool contract changed.
|
|
12
|
+
|
|
13
|
+
## [8.2.0] - 2026-06-28
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
- **Object history tools (#30).** Two read-only tools backed by `@mcp-abap-adt/adt-clients` 7.0.0's version-history API: `GetObjectVersions` (lists an object's SAP version history — `versionId`, `author`, `updatedAt`, `title`, and an opaque `contentUri` per entry) and `GetObjectVersionSource` (fetches the source of a specific version by its `contentUri`). Both dispatch by `object_type` across the same 13 object types as the generic object tools (class, program, interface, function_group, function_module, table, structure, ddl, domain, data_element, package, behavior_definition, metadata_extension); object types without a version endpoint return a clear `UNSUPPORTED_OPERATION` error rather than raw HTTP.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
- **Migrated to `@mcp-abap-adt/adt-clients@^7.0.1` and `@mcp-abap-adt/interfaces@^9.0.0`** (from `^6.1.0` / `^7.2.0`). 7.0.1 also makes where-used resilient on S/4 systems whose `/usageReferences/scope` sub-resource returns 404 — the library now falls back to an unscoped search with client-side type narrowing, hardening the append detection in `GetStructuresList` (#128) at the library level. No mcp-abap-adt tool contract changed by the migration.
|
|
20
|
+
|
|
5
21
|
## [8.1.1] - 2026-06-27
|
|
6
22
|
|
|
7
23
|
### Fixed
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-object HIGH-LEVEL version-history tools (#30).
|
|
3
|
+
*
|
|
4
|
+
* For each versioned object_type this factory builds a pair of tools that
|
|
5
|
+
* mirror the existing high-level Get<X> accessor (e.g. GetClass → GetClassVersions
|
|
6
|
+
* / GetClassVersionSource), so development (HighLevel) clients can read version
|
|
7
|
+
* history without enabling the generic ReadOnly group.
|
|
8
|
+
*
|
|
9
|
+
* Get<Display>Versions — version history of that object.
|
|
10
|
+
* Get<Display>VersionSource — source of one version, by its opaque content_uri.
|
|
11
|
+
*
|
|
12
|
+
* Both delegate to the SAME resolveVersionedObject dispatch + IAdtObject methods
|
|
13
|
+
* (getVersions / getVersionSource) used by the generic ReadOnly handlers, so the
|
|
14
|
+
* wire behaviour is identical. The generic GetObjectVersions/GetObjectVersionSource
|
|
15
|
+
* (ReadOnly group) stay; these are HighLevel-only per-type equivalents.
|
|
16
|
+
*/
|
|
17
|
+
import type { HandlerContext, SapEnvironment, ToolDefinition } from '../../../lib/handlers/interfaces';
|
|
18
|
+
/** Handler signature before context injection (the group wraps with withContext). */
|
|
19
|
+
type RawHandler = (context: HandlerContext, args: any) => Promise<any>;
|
|
20
|
+
export interface ObjectVersionToolEntry {
|
|
21
|
+
toolDefinition: ToolDefinition;
|
|
22
|
+
handler: RawHandler;
|
|
23
|
+
}
|
|
24
|
+
interface VersionedTypeRow {
|
|
25
|
+
/** object_type key for resolveVersionedObject (same set as VERSIONED_OBJECT_TYPES). */
|
|
26
|
+
object_type: string;
|
|
27
|
+
/** PascalCase display matching the existing high-level Get<Display> tool. */
|
|
28
|
+
display: string;
|
|
29
|
+
/** The natural name input param (e.g. class_name) — required on the Versions tool. */
|
|
30
|
+
nameParam: string;
|
|
31
|
+
/** Human label used in descriptions (e.g. "ABAP class", "CDS view"). */
|
|
32
|
+
label: string;
|
|
33
|
+
/** Environments — MUST match this type's existing high-level Get<X> TOOL_DEFINITION. */
|
|
34
|
+
available_in?: readonly SapEnvironment[];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* One row per versioned object_type. `available_in` is copied from each type's
|
|
38
|
+
* existing high-level Get<X> handler (src/handlers/<type>/high/handleGet<X>.ts).
|
|
39
|
+
*/
|
|
40
|
+
export declare const VERSIONED_TYPES: VersionedTypeRow[];
|
|
41
|
+
/**
|
|
42
|
+
* Build all 26 high-level per-object version tools (13 types ×
|
|
43
|
+
* {Versions, VersionSource}). The handlers take (context, args); the registering
|
|
44
|
+
* group wraps each with withContext.
|
|
45
|
+
*/
|
|
46
|
+
export declare function buildObjectVersionTools(): ObjectVersionToolEntry[];
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=objectVersionTools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objectVersionTools.d.ts","sourceRoot":"","sources":["../../../../src/handlers/common/high/objectVersionTools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,cAAc,EACf,MAAM,kCAAkC,CAAC;AAQ1C,qFAAqF;AACrF,KAAK,UAAU,GAAG,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AAEvE,MAAM,WAAW,sBAAsB;IACrC,cAAc,EAAE,cAAc,CAAC;IAC/B,OAAO,EAAE,UAAU,CAAC;CACrB;AAED,UAAU,gBAAgB;IACxB,uFAAuF;IACvF,WAAW,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAC;IAChB,sFAAsF;IACtF,SAAS,EAAE,MAAM,CAAC;IAClB,wEAAwE;IACxE,KAAK,EAAE,MAAM,CAAC;IACd,wFAAwF;IACxF,YAAY,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;CAC1C;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,gBAAgB,EA4F7C,CAAC;AA+JF;;;;GAIG;AACH,wBAAgB,uBAAuB,IAAI,sBAAsB,EAAE,CAOlE"}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Per-object HIGH-LEVEL version-history tools (#30).
|
|
4
|
+
*
|
|
5
|
+
* For each versioned object_type this factory builds a pair of tools that
|
|
6
|
+
* mirror the existing high-level Get<X> accessor (e.g. GetClass → GetClassVersions
|
|
7
|
+
* / GetClassVersionSource), so development (HighLevel) clients can read version
|
|
8
|
+
* history without enabling the generic ReadOnly group.
|
|
9
|
+
*
|
|
10
|
+
* Get<Display>Versions — version history of that object.
|
|
11
|
+
* Get<Display>VersionSource — source of one version, by its opaque content_uri.
|
|
12
|
+
*
|
|
13
|
+
* Both delegate to the SAME resolveVersionedObject dispatch + IAdtObject methods
|
|
14
|
+
* (getVersions / getVersionSource) used by the generic ReadOnly handlers, so the
|
|
15
|
+
* wire behaviour is identical. The generic GetObjectVersions/GetObjectVersionSource
|
|
16
|
+
* (ReadOnly group) stay; these are HighLevel-only per-type equivalents.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.VERSIONED_TYPES = void 0;
|
|
20
|
+
exports.buildObjectVersionTools = buildObjectVersionTools;
|
|
21
|
+
const interfaces_1 = require("@mcp-abap-adt/interfaces");
|
|
22
|
+
const clients_1 = require("../../../lib/clients");
|
|
23
|
+
const utils_1 = require("../../../lib/utils");
|
|
24
|
+
const resolveVersionedObject_1 = require("../readonly/resolveVersionedObject");
|
|
25
|
+
/**
|
|
26
|
+
* One row per versioned object_type. `available_in` is copied from each type's
|
|
27
|
+
* existing high-level Get<X> handler (src/handlers/<type>/high/handleGet<X>.ts).
|
|
28
|
+
*/
|
|
29
|
+
exports.VERSIONED_TYPES = [
|
|
30
|
+
{
|
|
31
|
+
object_type: 'class',
|
|
32
|
+
display: 'Class',
|
|
33
|
+
nameParam: 'class_name',
|
|
34
|
+
label: 'ABAP class',
|
|
35
|
+
available_in: ['onprem', 'cloud', 'legacy'],
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
object_type: 'program',
|
|
39
|
+
display: 'Program',
|
|
40
|
+
nameParam: 'program_name',
|
|
41
|
+
label: 'ABAP program',
|
|
42
|
+
available_in: ['onprem', 'legacy'],
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
object_type: 'interface',
|
|
46
|
+
display: 'Interface',
|
|
47
|
+
nameParam: 'interface_name',
|
|
48
|
+
label: 'ABAP interface',
|
|
49
|
+
available_in: ['onprem', 'cloud', 'legacy'],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
object_type: 'function_group',
|
|
53
|
+
display: 'FunctionGroup',
|
|
54
|
+
nameParam: 'function_group_name',
|
|
55
|
+
label: 'ABAP function group',
|
|
56
|
+
available_in: ['onprem', 'cloud', 'legacy'],
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
object_type: 'function_module',
|
|
60
|
+
display: 'FunctionModule',
|
|
61
|
+
nameParam: 'function_module_name',
|
|
62
|
+
label: 'ABAP function module',
|
|
63
|
+
available_in: ['onprem', 'cloud', 'legacy'],
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
object_type: 'table',
|
|
67
|
+
display: 'Table',
|
|
68
|
+
nameParam: 'table_name',
|
|
69
|
+
label: 'ABAP table',
|
|
70
|
+
available_in: ['onprem', 'cloud'],
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
object_type: 'structure',
|
|
74
|
+
display: 'Structure',
|
|
75
|
+
nameParam: 'structure_name',
|
|
76
|
+
label: 'ABAP structure',
|
|
77
|
+
available_in: ['onprem', 'cloud'],
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
object_type: 'ddl',
|
|
81
|
+
display: 'Ddl',
|
|
82
|
+
nameParam: 'ddl_name',
|
|
83
|
+
label: 'CDS view (DDL source)',
|
|
84
|
+
available_in: ['onprem', 'cloud', 'legacy'],
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
object_type: 'domain',
|
|
88
|
+
display: 'Domain',
|
|
89
|
+
nameParam: 'domain_name',
|
|
90
|
+
label: 'ABAP domain',
|
|
91
|
+
available_in: ['onprem', 'cloud'],
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
object_type: 'data_element',
|
|
95
|
+
display: 'DataElement',
|
|
96
|
+
nameParam: 'data_element_name',
|
|
97
|
+
label: 'ABAP data element',
|
|
98
|
+
available_in: ['onprem', 'cloud'],
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
object_type: 'package',
|
|
102
|
+
display: 'Package',
|
|
103
|
+
nameParam: 'package_name',
|
|
104
|
+
label: 'ABAP package',
|
|
105
|
+
available_in: ['onprem', 'cloud', 'legacy'],
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
object_type: 'behavior_definition',
|
|
109
|
+
display: 'BehaviorDefinition',
|
|
110
|
+
nameParam: 'behavior_definition_name',
|
|
111
|
+
label: 'RAP behavior definition',
|
|
112
|
+
available_in: ['onprem', 'cloud'],
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
object_type: 'metadata_extension',
|
|
116
|
+
display: 'MetadataExtension',
|
|
117
|
+
nameParam: 'metadata_extension_name',
|
|
118
|
+
label: 'CDS metadata extension',
|
|
119
|
+
available_in: ['onprem', 'cloud'],
|
|
120
|
+
},
|
|
121
|
+
];
|
|
122
|
+
function buildVersionsTool(row) {
|
|
123
|
+
const isFm = row.object_type === 'function_module';
|
|
124
|
+
const properties = {
|
|
125
|
+
[row.nameParam]: {
|
|
126
|
+
type: 'string',
|
|
127
|
+
description: `${row.label} name.`,
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
const required = [row.nameParam];
|
|
131
|
+
if (isFm) {
|
|
132
|
+
properties.function_group_name = {
|
|
133
|
+
type: 'string',
|
|
134
|
+
description: 'Owning function group name (required).',
|
|
135
|
+
};
|
|
136
|
+
required.push('function_group_name');
|
|
137
|
+
}
|
|
138
|
+
const toolDefinition = {
|
|
139
|
+
name: `Get${row.display}Versions`,
|
|
140
|
+
...(row.available_in ? { available_in: row.available_in } : {}),
|
|
141
|
+
description: `[read-only] List the SAP version history of a ${row.label}. Returns each version with its versionId, author, updatedAt, title and an opaque content_uri to fetch that version's source via Get${row.display}VersionSource.`,
|
|
142
|
+
inputSchema: {
|
|
143
|
+
type: 'object',
|
|
144
|
+
properties,
|
|
145
|
+
required,
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
const handler = async (context, args) => {
|
|
149
|
+
const { connection, logger } = context;
|
|
150
|
+
try {
|
|
151
|
+
const name = args?.[row.nameParam];
|
|
152
|
+
if (!name) {
|
|
153
|
+
return (0, utils_1.return_error)(new Error(`${row.nameParam} is required`));
|
|
154
|
+
}
|
|
155
|
+
const functionGroupName = isFm ? args?.function_group_name : undefined;
|
|
156
|
+
if (isFm && !functionGroupName) {
|
|
157
|
+
return (0, utils_1.return_error)(new Error('function_group_name is required'));
|
|
158
|
+
}
|
|
159
|
+
const client = (0, clients_1.createAdtClient)(connection, logger);
|
|
160
|
+
let resolved;
|
|
161
|
+
try {
|
|
162
|
+
resolved = (0, resolveVersionedObject_1.resolveVersionedObject)(client, row.object_type, String(name), functionGroupName ? String(functionGroupName) : undefined);
|
|
163
|
+
}
|
|
164
|
+
catch (e) {
|
|
165
|
+
return (0, utils_1.return_error)(e instanceof Error ? e : new Error(String(e)));
|
|
166
|
+
}
|
|
167
|
+
if (!resolved) {
|
|
168
|
+
return (0, utils_1.return_error)(new Error(`Unsupported object_type: ${row.object_type}`));
|
|
169
|
+
}
|
|
170
|
+
try {
|
|
171
|
+
const versions = await resolved.obj.getVersions(resolved.config);
|
|
172
|
+
return (0, utils_1.return_response)({
|
|
173
|
+
data: JSON.stringify({
|
|
174
|
+
success: true,
|
|
175
|
+
object_type: row.object_type,
|
|
176
|
+
object_name: String(name).toUpperCase(),
|
|
177
|
+
versions,
|
|
178
|
+
}, null, 2),
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
catch (error) {
|
|
182
|
+
if (error?.code === interfaces_1.AdtObjectErrorCodes.UNSUPPORTED_OPERATION) {
|
|
183
|
+
return (0, utils_1.return_error)(new Error(`Version history is not supported for object_type '${row.object_type}' (${String(name).toUpperCase()}).`));
|
|
184
|
+
}
|
|
185
|
+
return (0, utils_1.return_error)(error instanceof Error ? error : new Error(String(error)));
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
return (0, utils_1.return_error)(error);
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
return { toolDefinition, handler };
|
|
193
|
+
}
|
|
194
|
+
function buildVersionSourceTool(row) {
|
|
195
|
+
const toolDefinition = {
|
|
196
|
+
name: `Get${row.display}VersionSource`,
|
|
197
|
+
...(row.available_in ? { available_in: row.available_in } : {}),
|
|
198
|
+
description: `[read-only] Fetch the source of a specific ${row.label} version by its content_uri (taken from a Get${row.display}Versions entry).`,
|
|
199
|
+
inputSchema: {
|
|
200
|
+
type: 'object',
|
|
201
|
+
properties: {
|
|
202
|
+
content_uri: {
|
|
203
|
+
type: 'string',
|
|
204
|
+
description: `Opaque content_uri taken from a Get${row.display}Versions entry.`,
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
required: ['content_uri'],
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
const handler = async (context, args) => {
|
|
211
|
+
const { connection, logger } = context;
|
|
212
|
+
try {
|
|
213
|
+
const content_uri = args?.content_uri;
|
|
214
|
+
if (!content_uri) {
|
|
215
|
+
return (0, utils_1.return_error)(new Error('content_uri is required'));
|
|
216
|
+
}
|
|
217
|
+
const client = (0, clients_1.createAdtClient)(connection, logger);
|
|
218
|
+
// content_uri carries the full object identity; a placeholder name is only
|
|
219
|
+
// needed to obtain the right IAdtObject instance.
|
|
220
|
+
const resolved = (0, resolveVersionedObject_1.resolveVersionedObject)(client, row.object_type, 'X', 'X');
|
|
221
|
+
if (!resolved) {
|
|
222
|
+
return (0, utils_1.return_error)(new Error(`Unsupported object_type: ${row.object_type}`));
|
|
223
|
+
}
|
|
224
|
+
try {
|
|
225
|
+
const source = await resolved.obj.getVersionSource(String(content_uri));
|
|
226
|
+
return (0, utils_1.return_response)({
|
|
227
|
+
data: JSON.stringify({ success: true, content_uri, source }, null, 2),
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
catch (error) {
|
|
231
|
+
if (error?.code === interfaces_1.AdtObjectErrorCodes.UNSUPPORTED_OPERATION) {
|
|
232
|
+
return (0, utils_1.return_error)(new Error(`Version source is not supported for object_type '${row.object_type}'.`));
|
|
233
|
+
}
|
|
234
|
+
return (0, utils_1.return_error)(error instanceof Error ? error : new Error(String(error)));
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
catch (error) {
|
|
238
|
+
return (0, utils_1.return_error)(error);
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
return { toolDefinition, handler };
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Build all 26 high-level per-object version tools (13 types ×
|
|
245
|
+
* {Versions, VersionSource}). The handlers take (context, args); the registering
|
|
246
|
+
* group wraps each with withContext.
|
|
247
|
+
*/
|
|
248
|
+
function buildObjectVersionTools() {
|
|
249
|
+
const entries = [];
|
|
250
|
+
for (const row of exports.VERSIONED_TYPES) {
|
|
251
|
+
entries.push(buildVersionsTool(row));
|
|
252
|
+
entries.push(buildVersionSourceTool(row));
|
|
253
|
+
}
|
|
254
|
+
return entries;
|
|
255
|
+
}
|
|
256
|
+
//# sourceMappingURL=objectVersionTools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objectVersionTools.js","sourceRoot":"","sources":["../../../../src/handlers/common/high/objectVersionTools.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAySH,0DAOC;AA9SD,yDAA+D;AAC/D,kDAAuD;AAMvD,8CAI4B;AAC5B,+EAA4E;AAuB5E;;;GAGG;AACU,QAAA,eAAe,GAAuB;IACjD;QACE,WAAW,EAAE,OAAO;QACpB,OAAO,EAAE,OAAO;QAChB,SAAS,EAAE,YAAY;QACvB,KAAK,EAAE,YAAY;QACnB,YAAY,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC;KAC5C;IACD;QACE,WAAW,EAAE,SAAS;QACtB,OAAO,EAAE,SAAS;QAClB,SAAS,EAAE,cAAc;QACzB,KAAK,EAAE,cAAc;QACrB,YAAY,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;KACnC;IACD;QACE,WAAW,EAAE,WAAW;QACxB,OAAO,EAAE,WAAW;QACpB,SAAS,EAAE,gBAAgB;QAC3B,KAAK,EAAE,gBAAgB;QACvB,YAAY,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC;KAC5C;IACD;QACE,WAAW,EAAE,gBAAgB;QAC7B,OAAO,EAAE,eAAe;QACxB,SAAS,EAAE,qBAAqB;QAChC,KAAK,EAAE,qBAAqB;QAC5B,YAAY,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,QA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C,CAAC;YACtB,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,IAAI,KAAK,EAAE,IAAI,KAAK,gCAAmB,CAAC,qBAAqB,EAAE,CAAC;oBAC9D,OAAO,IAAA,oBAAY,EACjB,IAAI,KAAK,CACP,oDAAoD,GAAG,CAAC,WAAW,IAAI,CACxE,CACF,CAAC;gBACJ,CAAC;gBACD,OAAO,IAAA,oBAAY,EACjB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAC1D,CAAC;YACJ,CAAC;QACH,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,IAAA,oBAAY,EAAC,KAAK,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,CAAC;AACrC,CAAC;AAED;;;;GAIG;AACH,SAAgB,uBAAuB;IACrC,MAAM,OAAO,GAA6B,EAAE,CAAC;IAC7C,KAAK,MAAM,GAAG,IAAI,uBAAe,EAAE,CAAC;QAClC,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC;QACrC,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GetObjectVersionSource Handler - read-only fetch of one version's source.
|
|
3
|
+
*
|
|
4
|
+
* Takes an opaque content_uri from a GetObjectVersions entry plus the
|
|
5
|
+
* object_type (needed to obtain an IAdtObject instance) and calls
|
|
6
|
+
* getVersionSource(content_uri). Closes #30.
|
|
7
|
+
*/
|
|
8
|
+
import type { HandlerContext } from '../../../lib/handlers/interfaces';
|
|
9
|
+
export declare const TOOL_DEFINITION: {
|
|
10
|
+
readonly name: "GetObjectVersionSource";
|
|
11
|
+
readonly available_in: readonly ["onprem", "cloud", "legacy"];
|
|
12
|
+
readonly description: "[read-only] Fetch the source code of a specific object version. Pass the opaque content_uri from a GetObjectVersions entry.";
|
|
13
|
+
readonly inputSchema: {
|
|
14
|
+
readonly type: "object";
|
|
15
|
+
readonly properties: {
|
|
16
|
+
readonly object_type: {
|
|
17
|
+
readonly type: "string";
|
|
18
|
+
readonly description: "Object type (same value used in GetObjectVersions).";
|
|
19
|
+
readonly enum: readonly ["class", "program", "interface", "function_group", "function_module", "table", "structure", "ddl", "domain", "data_element", "package", "behavior_definition", "metadata_extension"];
|
|
20
|
+
};
|
|
21
|
+
readonly content_uri: {
|
|
22
|
+
readonly type: "string";
|
|
23
|
+
readonly description: "Opaque content_uri taken from a GetObjectVersions version entry.";
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
readonly required: readonly ["object_type", "content_uri"];
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
interface GetObjectVersionSourceArgs {
|
|
30
|
+
object_type: string;
|
|
31
|
+
content_uri: string;
|
|
32
|
+
}
|
|
33
|
+
export declare function handleGetObjectVersionSource(context: HandlerContext, args: GetObjectVersionSourceArgs): Promise<{
|
|
34
|
+
isError: boolean;
|
|
35
|
+
content: {
|
|
36
|
+
type: string;
|
|
37
|
+
text: any;
|
|
38
|
+
}[];
|
|
39
|
+
}>;
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=handleGetObjectVersionSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleGetObjectVersionSource.d.ts","sourceRoot":"","sources":["../../../../src/handlers/common/readonly/handleGetObjectVersionSource.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAWvE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;CAqBlB,CAAC;AAEX,UAAU,0BAA0B;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAsB,4BAA4B,CAChD,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,0BAA0B;;;;;;GAkDjC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* GetObjectVersionSource Handler - read-only fetch of one version's source.
|
|
4
|
+
*
|
|
5
|
+
* Takes an opaque content_uri from a GetObjectVersions entry plus the
|
|
6
|
+
* object_type (needed to obtain an IAdtObject instance) and calls
|
|
7
|
+
* getVersionSource(content_uri). Closes #30.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.TOOL_DEFINITION = void 0;
|
|
11
|
+
exports.handleGetObjectVersionSource = handleGetObjectVersionSource;
|
|
12
|
+
const interfaces_1 = require("@mcp-abap-adt/interfaces");
|
|
13
|
+
const clients_1 = require("../../../lib/clients");
|
|
14
|
+
const utils_1 = require("../../../lib/utils");
|
|
15
|
+
const resolveVersionedObject_1 = require("./resolveVersionedObject");
|
|
16
|
+
exports.TOOL_DEFINITION = {
|
|
17
|
+
name: 'GetObjectVersionSource',
|
|
18
|
+
available_in: ['onprem', 'cloud', 'legacy'],
|
|
19
|
+
description: '[read-only] Fetch the source code of a specific object version. Pass the opaque content_uri from a GetObjectVersions entry.',
|
|
20
|
+
inputSchema: {
|
|
21
|
+
type: 'object',
|
|
22
|
+
properties: {
|
|
23
|
+
object_type: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
description: 'Object type (same value used in GetObjectVersions).',
|
|
26
|
+
enum: [...resolveVersionedObject_1.VERSIONED_OBJECT_TYPES],
|
|
27
|
+
},
|
|
28
|
+
content_uri: {
|
|
29
|
+
type: 'string',
|
|
30
|
+
description: 'Opaque content_uri taken from a GetObjectVersions version entry.',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
required: ['object_type', 'content_uri'],
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
async function handleGetObjectVersionSource(context, args) {
|
|
37
|
+
const { connection, logger } = context;
|
|
38
|
+
try {
|
|
39
|
+
const { content_uri } = args;
|
|
40
|
+
const object_type = (args.object_type || '').toLowerCase();
|
|
41
|
+
if (!object_type || !content_uri) {
|
|
42
|
+
return (0, utils_1.return_error)(new Error('object_type and content_uri are required'));
|
|
43
|
+
}
|
|
44
|
+
if (!resolveVersionedObject_1.VERSIONED_OBJECT_TYPES.includes(object_type)) {
|
|
45
|
+
return (0, utils_1.return_error)(new Error(`Invalid object_type. Must be one of: ${resolveVersionedObject_1.VERSIONED_OBJECT_TYPES.join(', ')}`));
|
|
46
|
+
}
|
|
47
|
+
const client = (0, clients_1.createAdtClient)(connection, logger);
|
|
48
|
+
// content_uri carries the full object identity; a placeholder name is only
|
|
49
|
+
// needed to obtain the right IAdtObject instance.
|
|
50
|
+
const resolved = (0, resolveVersionedObject_1.resolveVersionedObject)(client, object_type, 'X', 'X');
|
|
51
|
+
if (!resolved) {
|
|
52
|
+
return (0, utils_1.return_error)(new Error(`Unsupported object_type: ${args.object_type}`));
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
const source = await resolved.obj.getVersionSource(content_uri);
|
|
56
|
+
return (0, utils_1.return_response)({
|
|
57
|
+
data: JSON.stringify({ success: true, content_uri, source }, null, 2),
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
if (error?.code === interfaces_1.AdtObjectErrorCodes.UNSUPPORTED_OPERATION) {
|
|
62
|
+
return (0, utils_1.return_error)(new Error(`Version source is not supported for object_type '${object_type}'.`));
|
|
63
|
+
}
|
|
64
|
+
return (0, utils_1.return_error)(error instanceof Error ? error : new Error(String(error)));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
return (0, utils_1.return_error)(error);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=handleGetObjectVersionSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleGetObjectVersionSource.js","sourceRoot":"","sources":["../../../../src/handlers/common/readonly/handleGetObjectVersionSource.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AA2CH,oEAoDC;AA7FD,yDAA+D;AAC/D,kDAAuD;AAEvD,8CAI4B;AAC5B,qEAGkC;AAErB,QAAA,eAAe,GAAG;IAC7B,IAAI,EAAE,wBAAwB;IAC9B,YAAY,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAU;IACpD,WAAW,EACT,6HAA6H;IAC/H,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,qDAAqD;gBAClE,IAAI,EAAE,CAAC,GAAG,+CAAsB,CAAC;aAClC;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,kEAAkE;aACrE;SACF;QACD,QAAQ,EAAE,CAAC,aAAa,EAAE,aAAa,CAAC;KACzC;CACO,CAAC;AAOJ,KAAK,UAAU,4BAA4B,CAChD,OAAuB,EACvB,IAAgC;IAEhC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IACvC,IAAI,CAAC;QACH,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;QAC7B,MAAM,WAAW,GAAG,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;QAE3D,IAAI,CAAC,WAAW,IAAI,CAAC,WAAW,EAAE,CAAC;YACjC,OAAO,IAAA,oBAAY,EACjB,IAAI,KAAK,CAAC,0CAA0C,CAAC,CACtD,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,+CAAsB,CAAC,QAAQ,CAAC,WAAkB,CAAC,EAAE,CAAC;YACzD,OAAO,IAAA,o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C"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GetObjectVersions Handler - read-only version history of an ABAP object.
|
|
3
|
+
*
|
|
4
|
+
* Dispatches on object_type to the matching adt-clients IAdtObject and calls
|
|
5
|
+
* getVersions(config). Returns the IObjectVersion[] (each entry carries its
|
|
6
|
+
* opaque contentUri, to be passed to GetObjectVersionSource). Closes #30.
|
|
7
|
+
*/
|
|
8
|
+
import type { HandlerContext } from '../../../lib/handlers/interfaces';
|
|
9
|
+
export declare const TOOL_DEFINITION: {
|
|
10
|
+
readonly name: "GetObjectVersions";
|
|
11
|
+
readonly available_in: readonly ["onprem", "cloud", "legacy"];
|
|
12
|
+
readonly description: "[read-only] List the version history of an ABAP object. Returns each version with its versionId, author, updatedAt, title and an opaque content_uri to fetch that version source via GetObjectVersionSource.";
|
|
13
|
+
readonly inputSchema: {
|
|
14
|
+
readonly type: "object";
|
|
15
|
+
readonly properties: {
|
|
16
|
+
readonly object_type: {
|
|
17
|
+
readonly type: "string";
|
|
18
|
+
readonly description: "Object type.";
|
|
19
|
+
readonly enum: readonly ["class", "program", "interface", "function_group", "function_module", "table", "structure", "ddl", "domain", "data_element", "package", "behavior_definition", "metadata_extension"];
|
|
20
|
+
};
|
|
21
|
+
readonly object_name: {
|
|
22
|
+
readonly type: "string";
|
|
23
|
+
readonly description: "Object name (e.g., ZCL_MY_CLASS, ZIF_MY_INTERFACE, Z_MY_TABLE).";
|
|
24
|
+
};
|
|
25
|
+
readonly function_group_name: {
|
|
26
|
+
readonly type: "string";
|
|
27
|
+
readonly description: "Owning function group name. Required when object_type is function_module.";
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
readonly required: readonly ["object_type", "object_name"];
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
interface GetObjectVersionsArgs {
|
|
34
|
+
object_type: string;
|
|
35
|
+
object_name: string;
|
|
36
|
+
function_group_name?: string;
|
|
37
|
+
}
|
|
38
|
+
export declare function handleGetObjectVersions(context: HandlerContext, args: GetObjectVersionsArgs): Promise<{
|
|
39
|
+
isError: boolean;
|
|
40
|
+
content: {
|
|
41
|
+
type: string;
|
|
42
|
+
text: any;
|
|
43
|
+
}[];
|
|
44
|
+
}>;
|
|
45
|
+
export {};
|
|
46
|
+
//# sourceMappingURL=handleGetObjectVersions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleGetObjectVersions.d.ts","sourceRoot":"","sources":["../../../../src/handlers/common/readonly/handleGetObjectVersions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAWvE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;CA0BlB,CAAC;AAEX,UAAU,qBAAqB;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,qBAAqB;;;;;;GAmE5B"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* GetObjectVersions Handler - read-only version history of an ABAP object.
|
|
4
|
+
*
|
|
5
|
+
* Dispatches on object_type to the matching adt-clients IAdtObject and calls
|
|
6
|
+
* getVersions(config). Returns the IObjectVersion[] (each entry carries its
|
|
7
|
+
* opaque contentUri, to be passed to GetObjectVersionSource). Closes #30.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.TOOL_DEFINITION = void 0;
|
|
11
|
+
exports.handleGetObjectVersions = handleGetObjectVersions;
|
|
12
|
+
const interfaces_1 = require("@mcp-abap-adt/interfaces");
|
|
13
|
+
const clients_1 = require("../../../lib/clients");
|
|
14
|
+
const utils_1 = require("../../../lib/utils");
|
|
15
|
+
const resolveVersionedObject_1 = require("./resolveVersionedObject");
|
|
16
|
+
exports.TOOL_DEFINITION = {
|
|
17
|
+
name: 'GetObjectVersions',
|
|
18
|
+
available_in: ['onprem', 'cloud', 'legacy'],
|
|
19
|
+
description: '[read-only] List the version history of an ABAP object. Returns each version with its versionId, author, updatedAt, title and an opaque content_uri to fetch that version source via GetObjectVersionSource.',
|
|
20
|
+
inputSchema: {
|
|
21
|
+
type: 'object',
|
|
22
|
+
properties: {
|
|
23
|
+
object_type: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
description: 'Object type.',
|
|
26
|
+
enum: [...resolveVersionedObject_1.VERSIONED_OBJECT_TYPES],
|
|
27
|
+
},
|
|
28
|
+
object_name: {
|
|
29
|
+
type: 'string',
|
|
30
|
+
description: 'Object name (e.g., ZCL_MY_CLASS, ZIF_MY_INTERFACE, Z_MY_TABLE).',
|
|
31
|
+
},
|
|
32
|
+
function_group_name: {
|
|
33
|
+
type: 'string',
|
|
34
|
+
description: 'Owning function group name. Required when object_type is function_module.',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
required: ['object_type', 'object_name'],
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
async function handleGetObjectVersions(context, args) {
|
|
41
|
+
const { connection, logger } = context;
|
|
42
|
+
try {
|
|
43
|
+
const { object_name, function_group_name } = args;
|
|
44
|
+
const object_type = (args.object_type || '').toLowerCase();
|
|
45
|
+
if (!object_type || !object_name) {
|
|
46
|
+
return (0, utils_1.return_error)(new Error('object_type and object_name are required'));
|
|
47
|
+
}
|
|
48
|
+
if (!resolveVersionedObject_1.VERSIONED_OBJECT_TYPES.includes(object_type)) {
|
|
49
|
+
return (0, utils_1.return_error)(new Error(`Invalid object_type. Must be one of: ${resolveVersionedObject_1.VERSIONED_OBJECT_TYPES.join(', ')}`));
|
|
50
|
+
}
|
|
51
|
+
const client = (0, clients_1.createAdtClient)(connection, logger);
|
|
52
|
+
let resolved;
|
|
53
|
+
try {
|
|
54
|
+
resolved = (0, resolveVersionedObject_1.resolveVersionedObject)(client, object_type, object_name, function_group_name);
|
|
55
|
+
}
|
|
56
|
+
catch (e) {
|
|
57
|
+
return (0, utils_1.return_error)(e instanceof Error ? e : new Error(String(e)));
|
|
58
|
+
}
|
|
59
|
+
if (!resolved) {
|
|
60
|
+
return (0, utils_1.return_error)(new Error(`Unsupported object_type: ${args.object_type}`));
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
const versions = await resolved.obj.getVersions(resolved.config);
|
|
64
|
+
return (0, utils_1.return_response)({
|
|
65
|
+
data: JSON.stringify({
|
|
66
|
+
success: true,
|
|
67
|
+
object_type,
|
|
68
|
+
object_name: object_name.toUpperCase(),
|
|
69
|
+
versions,
|
|
70
|
+
}, null, 2),
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
if (error?.code === interfaces_1.AdtObjectErrorCodes.UNSUPPORTED_OPERATION) {
|
|
75
|
+
return (0, utils_1.return_error)(new Error(`Version history is not supported for object_type '${object_type}' (${object_name}).`));
|
|
76
|
+
}
|
|
77
|
+
return (0, utils_1.return_error)(error instanceof Error ? error : new Error(String(error)));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
return (0, utils_1.return_error)(error);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=handleGetObjectVersions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleGetObjectVersions.js","sourceRoot":"","sources":["../../../../src/handlers/common/readonly/handleGetObjectVersions.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAiDH,0DAqEC;AApHD,yDAA+D;AAC/D,kDAAuD;AAEvD,8CAI4B;AAC5B,qEAGkC;AAErB,QAAA,eAAe,GAAG;IAC7B,IAAI,EAAE,mBAAmB;IACzB,YAAY,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAA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@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared object_type → IAdtObject resolver for the read-only version-history
|
|
3
|
+
* handlers (GetObjectVersions / GetObjectVersionSource).
|
|
4
|
+
*
|
|
5
|
+
* Mirrors the switch in handleLockObject EXACTLY: the SAME object_type values,
|
|
6
|
+
* the SAME client.getX() accessors, and the SAME config name keys. Instead of
|
|
7
|
+
* calling .lock(...), callers use the returned IAdtObject to call
|
|
8
|
+
* .getVersions(config) / .getVersionSource(contentUri).
|
|
9
|
+
*/
|
|
10
|
+
import type { AdtClient } from '@mcp-abap-adt/adt-clients';
|
|
11
|
+
import type { IAdtObject } from '@mcp-abap-adt/interfaces';
|
|
12
|
+
/** object_type values supported for version history (same set as LockObject). */
|
|
13
|
+
export declare const VERSIONED_OBJECT_TYPES: readonly ["class", "program", "interface", "function_group", "function_module", "table", "structure", "ddl", "domain", "data_element", "package", "behavior_definition", "metadata_extension"];
|
|
14
|
+
export interface ResolvedVersionedObject {
|
|
15
|
+
/** The IAdtObject instance to call getVersions/getVersionSource on. */
|
|
16
|
+
obj: IAdtObject<any, any>;
|
|
17
|
+
/** Identity config to pass to getVersions(config). */
|
|
18
|
+
config: Record<string, unknown>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Resolve an object_type + name into an IAdtObject instance and its identity
|
|
22
|
+
* config. Returns null for an unknown object_type (caller emits the error).
|
|
23
|
+
*
|
|
24
|
+
* @throws Error for a malformed function_module identity (missing group name).
|
|
25
|
+
*/
|
|
26
|
+
export declare function resolveVersionedObject(client: AdtClient, objectType: string, objectName: string, functionGroupName?: string): ResolvedVersionedObject | null;
|
|
27
|
+
//# sourceMappingURL=resolveVersionedObject.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveVersionedObject.d.ts","sourceRoot":"","sources":["../../../../src/handlers/common/readonly/resolveVersionedObject.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3D,iFAAiF;AACjF,eAAO,MAAM,sBAAsB,gMAczB,CAAC;AAEX,MAAM,WAAW,uBAAuB;IACtC,uEAAuE;IACvE,GAAG,EAAE,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC1B,sDAAsD;IACtD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,SAAS,EACjB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,iBAAiB,CAAC,EAAE,MAAM,GACzB,uBAAuB,GAAG,IAAI,CAyDhC"}
|