@mcp-abap-adt/core 2.5.1 → 2.5.2
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 +22 -0
- package/README.md +3 -0
- package/dist/handlers/bdef/handleCreateBehaviorDefinition.d.ts +50 -0
- package/dist/handlers/bdef/handleCreateBehaviorDefinition.d.ts.map +1 -0
- package/dist/handlers/bdef/handleCreateBehaviorDefinition.js +101 -0
- package/dist/handlers/bdef/handleGetBdef.d.ts +54 -0
- package/dist/handlers/bdef/handleGetBdef.d.ts.map +1 -0
- package/dist/handlers/bdef/handleGetBdef.js +89 -0
- package/dist/handlers/bdef/handleUpdateBehaviorDefinition.d.ts +37 -0
- package/dist/handlers/bdef/handleUpdateBehaviorDefinition.d.ts.map +1 -0
- package/dist/handlers/bdef/handleUpdateBehaviorDefinition.js +85 -0
- package/dist/handlers/behavior_definition/readonly/handleGetBdef.d.ts +54 -0
- package/dist/handlers/behavior_definition/readonly/handleGetBdef.d.ts.map +1 -0
- package/dist/handlers/behavior_definition/readonly/handleGetBdef.js +89 -0
- package/dist/handlers/class/handleCheckClass.d.ts +59 -0
- package/dist/handlers/class/handleCheckClass.d.ts.map +1 -0
- package/dist/handlers/class/handleCheckClass.js +138 -0
- package/dist/handlers/class/handleCreateClass.d.ts +80 -0
- package/dist/handlers/class/handleCreateClass.d.ts.map +1 -0
- package/dist/handlers/class/handleCreateClass.js +192 -0
- package/dist/handlers/class/handleGetClass.d.ts +16 -0
- package/dist/handlers/class/handleGetClass.d.ts.map +1 -0
- package/dist/handlers/class/handleGetClass.js +159 -0
- package/dist/handlers/class/handleUpdateClassSource.d.ts +44 -0
- package/dist/handlers/class/handleUpdateClassSource.d.ts.map +1 -0
- package/dist/handlers/class/handleUpdateClassSource.js +131 -0
- package/dist/handlers/class/handleValidateClass.d.ts +62 -0
- package/dist/handlers/class/handleValidateClass.d.ts.map +1 -0
- package/dist/handlers/class/handleValidateClass.js +136 -0
- package/dist/handlers/class/readonly/handleGetClass.d.ts +20 -0
- package/dist/handlers/class/readonly/handleGetClass.d.ts.map +1 -0
- package/dist/handlers/class/readonly/handleGetClass.js +159 -0
- package/dist/handlers/common/handleActivateObject.d.ts +62 -0
- package/dist/handlers/common/handleActivateObject.d.ts.map +1 -0
- package/dist/handlers/common/handleActivateObject.js +137 -0
- package/dist/handlers/common/handleCheckObject.d.ts +63 -0
- package/dist/handlers/common/handleCheckObject.d.ts.map +1 -0
- package/dist/handlers/common/handleCheckObject.js +197 -0
- package/dist/handlers/common/handleDeleteObject.d.ts +46 -0
- package/dist/handlers/common/handleDeleteObject.d.ts.map +1 -0
- package/dist/handlers/common/handleDeleteObject.js +176 -0
- package/dist/handlers/common/handleLockObject.d.ts +57 -0
- package/dist/handlers/common/handleLockObject.d.ts.map +1 -0
- package/dist/handlers/common/handleLockObject.js +195 -0
- package/dist/handlers/common/handleUnlockObject.d.ts +61 -0
- package/dist/handlers/common/handleUnlockObject.d.ts.map +1 -0
- package/dist/handlers/common/handleUnlockObject.js +178 -0
- package/dist/handlers/common/handleValidateObject.d.ts +58 -0
- package/dist/handlers/common/handleValidateObject.d.ts.map +1 -0
- package/dist/handlers/common/handleValidateObject.js +177 -0
- package/dist/handlers/data_element/handleCreateDataElement.d.ts +83 -0
- package/dist/handlers/data_element/handleCreateDataElement.d.ts.map +1 -0
- package/dist/handlers/data_element/handleCreateDataElement.js +180 -0
- package/dist/handlers/data_element/handleGetDataElement.d.ts +29 -0
- package/dist/handlers/data_element/handleGetDataElement.d.ts.map +1 -0
- package/dist/handlers/data_element/handleGetDataElement.js +173 -0
- package/dist/handlers/data_element/handleUpdateDataElement.d.ts +131 -0
- package/dist/handlers/data_element/handleUpdateDataElement.d.ts.map +1 -0
- package/dist/handlers/data_element/handleUpdateDataElement.js +258 -0
- package/dist/handlers/data_element/readonly/handleGetDataElement.d.ts +33 -0
- package/dist/handlers/data_element/readonly/handleGetDataElement.d.ts.map +1 -0
- package/dist/handlers/data_element/readonly/handleGetDataElement.js +173 -0
- package/dist/handlers/ddlx/handleCreateMetadataExtension.d.ts +41 -0
- package/dist/handlers/ddlx/handleCreateMetadataExtension.d.ts.map +1 -0
- package/dist/handlers/ddlx/handleCreateMetadataExtension.js +92 -0
- package/dist/handlers/ddlx/handleUpdateMetadataExtension.d.ts +37 -0
- package/dist/handlers/ddlx/handleUpdateMetadataExtension.d.ts.map +1 -0
- package/dist/handlers/ddlx/handleUpdateMetadataExtension.js +81 -0
- package/dist/handlers/domain/handleCreateDomain.d.ts +104 -0
- package/dist/handlers/domain/handleCreateDomain.d.ts.map +1 -0
- package/dist/handlers/domain/handleCreateDomain.js +187 -0
- package/dist/handlers/domain/handleGetDomain.d.ts +19 -0
- package/dist/handlers/domain/handleGetDomain.d.ts.map +1 -0
- package/dist/handlers/domain/handleGetDomain.js +138 -0
- package/dist/handlers/domain/handleUpdateDomain.d.ts +99 -0
- package/dist/handlers/domain/handleUpdateDomain.d.ts.map +1 -0
- package/dist/handlers/domain/handleUpdateDomain.js +204 -0
- package/dist/handlers/domain/readonly/handleGetDomain.d.ts +23 -0
- package/dist/handlers/domain/readonly/handleGetDomain.d.ts.map +1 -0
- package/dist/handlers/domain/readonly/handleGetDomain.js +138 -0
- package/dist/handlers/enhancement/handleGetEnhancementImpl.d.ts +69 -0
- package/dist/handlers/enhancement/handleGetEnhancementImpl.d.ts.map +1 -0
- package/dist/handlers/enhancement/handleGetEnhancementImpl.js +171 -0
- package/dist/handlers/enhancement/handleGetEnhancementSpot.d.ts +53 -0
- package/dist/handlers/enhancement/handleGetEnhancementSpot.d.ts.map +1 -0
- package/dist/handlers/enhancement/handleGetEnhancementSpot.js +153 -0
- package/dist/handlers/enhancement/handleGetEnhancements.d.ts +64 -0
- package/dist/handlers/enhancement/handleGetEnhancements.d.ts.map +1 -0
- package/dist/handlers/enhancement/handleGetEnhancements.js +599 -0
- package/dist/handlers/function/handleCheckFunctionModule.d.ts +59 -0
- package/dist/handlers/function/handleCheckFunctionModule.d.ts.map +1 -0
- package/dist/handlers/function/handleCheckFunctionModule.js +140 -0
- package/dist/handlers/function/handleCreateFunctionGroup.d.ts +52 -0
- package/dist/handlers/function/handleCreateFunctionGroup.d.ts.map +1 -0
- package/dist/handlers/function/handleCreateFunctionGroup.js +114 -0
- package/dist/handlers/function/handleCreateFunctionModule.d.ts +57 -0
- package/dist/handlers/function/handleCreateFunctionModule.d.ts.map +1 -0
- package/dist/handlers/function/handleCreateFunctionModule.js +137 -0
- package/dist/handlers/function/handleGetFunction.d.ts +17 -0
- package/dist/handlers/function/handleGetFunction.d.ts.map +1 -0
- package/dist/handlers/function/handleGetFunction.js +172 -0
- package/dist/handlers/function/handleGetFunctionGroup.d.ts +16 -0
- package/dist/handlers/function/handleGetFunctionGroup.d.ts.map +1 -0
- package/dist/handlers/function/handleGetFunctionGroup.js +132 -0
- package/dist/handlers/function/handleUpdateFunctionModuleSource.d.ts +54 -0
- package/dist/handlers/function/handleUpdateFunctionModuleSource.d.ts.map +1 -0
- package/dist/handlers/function/handleUpdateFunctionModuleSource.js +108 -0
- package/dist/handlers/function/handleValidateFunctionModule.d.ts +58 -0
- package/dist/handlers/function/handleValidateFunctionModule.d.ts.map +1 -0
- package/dist/handlers/function/handleValidateFunctionModule.js +132 -0
- package/dist/handlers/function/readonly/handleGetFunctionGroup.d.ts +16 -0
- package/dist/handlers/function/readonly/handleGetFunctionGroup.d.ts.map +1 -0
- package/dist/handlers/function/readonly/handleGetFunctionGroup.js +132 -0
- package/dist/handlers/include/handleGetInclude.d.ts +16 -0
- package/dist/handlers/include/handleGetInclude.d.ts.map +1 -0
- package/dist/handlers/include/handleGetInclude.js +81 -0
- package/dist/handlers/include/handleGetIncludesList.d.ts +36 -0
- package/dist/handlers/include/handleGetIncludesList.d.ts.map +1 -0
- package/dist/handlers/include/handleGetIncludesList.js +223 -0
- package/dist/handlers/interface/handleCreateInterface.d.ts +64 -0
- package/dist/handlers/interface/handleCreateInterface.d.ts.map +1 -0
- package/dist/handlers/interface/handleCreateInterface.js +175 -0
- package/dist/handlers/interface/handleGetInterface.d.ts +40 -0
- package/dist/handlers/interface/handleGetInterface.d.ts.map +1 -0
- package/dist/handlers/interface/handleGetInterface.js +134 -0
- package/dist/handlers/interface/handleUpdateInterfaceSource.d.ts +48 -0
- package/dist/handlers/interface/handleUpdateInterfaceSource.d.ts.map +1 -0
- package/dist/handlers/interface/handleUpdateInterfaceSource.js +127 -0
- package/dist/handlers/interface/readonly/handleGetInterface.d.ts +44 -0
- package/dist/handlers/interface/readonly/handleGetInterface.d.ts.map +1 -0
- package/dist/handlers/interface/readonly/handleGetInterface.js +134 -0
- package/dist/handlers/package/handleCreatePackage.d.ts +38 -0
- package/dist/handlers/package/handleCreatePackage.d.ts.map +1 -0
- package/dist/handlers/package/handleCreatePackage.js +127 -0
- package/dist/handlers/package/handleGetPackage.d.ts +16 -0
- package/dist/handlers/package/handleGetPackage.d.ts.map +1 -0
- package/dist/handlers/package/handleGetPackage.js +94 -0
- package/dist/handlers/package/readonly/handleGetPackage.d.ts +21 -0
- package/dist/handlers/package/readonly/handleGetPackage.d.ts.map +1 -0
- package/dist/handlers/package/readonly/handleGetPackage.js +94 -0
- package/dist/handlers/program/handleCreateProgram.d.ts +73 -0
- package/dist/handlers/program/handleCreateProgram.d.ts.map +1 -0
- package/dist/handlers/program/handleCreateProgram.js +220 -0
- package/dist/handlers/program/handleGetProgFullCode.d.ts +67 -0
- package/dist/handlers/program/handleGetProgFullCode.d.ts.map +1 -0
- package/dist/handlers/program/handleGetProgFullCode.js +249 -0
- package/dist/handlers/program/handleGetProgram.d.ts +16 -0
- package/dist/handlers/program/handleGetProgram.d.ts.map +1 -0
- package/dist/handlers/program/handleGetProgram.js +71 -0
- package/dist/handlers/program/handleUpdateProgramSource.d.ts +44 -0
- package/dist/handlers/program/handleUpdateProgramSource.d.ts.map +1 -0
- package/dist/handlers/program/handleUpdateProgramSource.js +121 -0
- package/dist/handlers/program/readonly/handleGetProgram.d.ts +20 -0
- package/dist/handlers/program/readonly/handleGetProgram.d.ts.map +1 -0
- package/dist/handlers/program/readonly/handleGetProgram.js +71 -0
- package/dist/handlers/search/handleGetObjectsByType.d.ts +42 -0
- package/dist/handlers/search/handleGetObjectsByType.d.ts.map +1 -0
- package/dist/handlers/search/handleGetObjectsByType.js +166 -0
- package/dist/handlers/search/handleGetObjectsList.d.ts +46 -0
- package/dist/handlers/search/handleGetObjectsList.d.ts.map +1 -0
- package/dist/handlers/search/handleGetObjectsList.js +145 -0
- package/dist/handlers/search/handleSearchObject.d.ts +28 -0
- package/dist/handlers/search/handleSearchObject.d.ts.map +1 -0
- package/dist/handlers/search/handleSearchObject.js +119 -0
- package/dist/handlers/service_definition/readonly/handleGetServiceDefinition.d.ts +17 -0
- package/dist/handlers/service_definition/readonly/handleGetServiceDefinition.d.ts.map +1 -0
- package/dist/handlers/service_definition/readonly/handleGetServiceDefinition.js +136 -0
- package/dist/handlers/structure/handleCreateStructure.d.ts +107 -0
- package/dist/handlers/structure/handleCreateStructure.d.ts.map +1 -0
- package/dist/handlers/structure/handleCreateStructure.js +184 -0
- package/dist/handlers/structure/handleGetStructure.d.ts +16 -0
- package/dist/handlers/structure/handleGetStructure.d.ts.map +1 -0
- package/dist/handlers/structure/handleGetStructure.js +139 -0
- package/dist/handlers/structure/readonly/handleGetStructure.d.ts +16 -0
- package/dist/handlers/structure/readonly/handleGetStructure.d.ts.map +1 -0
- package/dist/handlers/structure/readonly/handleGetStructure.js +139 -0
- package/dist/handlers/system/handleDescribeByList.d.ts +36 -0
- package/dist/handlers/system/handleDescribeByList.d.ts.map +1 -0
- package/dist/handlers/system/handleDescribeByList.js +121 -0
- package/dist/handlers/system/handleGetAbapAST.d.ts +26 -0
- package/dist/handlers/system/handleGetAbapAST.d.ts.map +1 -0
- package/dist/handlers/system/handleGetAbapAST.js +172 -0
- package/dist/handlers/system/handleGetAbapSemanticAnalysis.d.ts +26 -0
- package/dist/handlers/system/handleGetAbapSemanticAnalysis.d.ts.map +1 -0
- package/dist/handlers/system/handleGetAbapSemanticAnalysis.js +353 -0
- package/dist/handlers/system/handleGetAbapSystemSymbols.d.ts +26 -0
- package/dist/handlers/system/handleGetAbapSystemSymbols.d.ts.map +1 -0
- package/dist/handlers/system/handleGetAbapSystemSymbols.js +574 -0
- package/dist/handlers/system/handleGetAllTypes.d.ts +22 -0
- package/dist/handlers/system/handleGetAllTypes.d.ts.map +1 -0
- package/dist/handlers/system/handleGetAllTypes.js +102 -0
- package/dist/handlers/system/handleGetInactiveObjects.d.ts +20 -0
- package/dist/handlers/system/handleGetInactiveObjects.d.ts.map +1 -0
- package/dist/handlers/system/handleGetInactiveObjects.js +41 -0
- package/dist/handlers/system/handleGetObjectInfo.d.ts +41 -0
- package/dist/handlers/system/handleGetObjectInfo.d.ts.map +1 -0
- package/dist/handlers/system/handleGetObjectInfo.js +210 -0
- package/dist/handlers/system/handleGetObjectNodeFromCache.d.ts +40 -0
- package/dist/handlers/system/handleGetObjectNodeFromCache.d.ts.map +1 -0
- package/dist/handlers/system/handleGetObjectNodeFromCache.js +70 -0
- package/dist/handlers/system/handleGetObjectStructure.d.ts +26 -0
- package/dist/handlers/system/handleGetObjectStructure.d.ts.map +1 -0
- package/dist/handlers/system/handleGetObjectStructure.js +103 -0
- package/dist/handlers/system/handleGetSession.d.ts +33 -0
- package/dist/handlers/system/handleGetSession.d.ts.map +1 -0
- package/dist/handlers/system/handleGetSession.js +63 -0
- package/dist/handlers/system/handleGetSqlQuery.d.ts +49 -0
- package/dist/handlers/system/handleGetSqlQuery.d.ts.map +1 -0
- package/dist/handlers/system/handleGetSqlQuery.js +176 -0
- package/dist/handlers/system/handleGetTransaction.d.ts +42 -0
- package/dist/handlers/system/handleGetTransaction.d.ts.map +1 -0
- package/dist/handlers/system/handleGetTransaction.js +91 -0
- package/dist/handlers/system/handleGetTypeInfo.d.ts +69 -0
- package/dist/handlers/system/handleGetTypeInfo.d.ts.map +1 -0
- package/dist/handlers/system/handleGetTypeInfo.js +169 -0
- package/dist/handlers/system/handleGetWhereUsed.d.ts +69 -0
- package/dist/handlers/system/handleGetWhereUsed.d.ts.map +1 -0
- package/dist/handlers/system/handleGetWhereUsed.js +405 -0
- package/dist/handlers/table/handleCheckTable.d.ts +55 -0
- package/dist/handlers/table/handleCheckTable.d.ts.map +1 -0
- package/dist/handlers/table/handleCheckTable.js +138 -0
- package/dist/handlers/table/handleCreateTable.d.ts +42 -0
- package/dist/handlers/table/handleCreateTable.d.ts.map +1 -0
- package/dist/handlers/table/handleCreateTable.js +118 -0
- package/dist/handlers/table/handleGetTable.d.ts +16 -0
- package/dist/handlers/table/handleGetTable.d.ts.map +1 -0
- package/dist/handlers/table/handleGetTable.js +140 -0
- package/dist/handlers/table/handleGetTableContents.d.ts +56 -0
- package/dist/handlers/table/handleGetTableContents.d.ts.map +1 -0
- package/dist/handlers/table/handleGetTableContents.js +387 -0
- package/dist/handlers/table/handleValidateTable.d.ts +53 -0
- package/dist/handlers/table/handleValidateTable.d.ts.map +1 -0
- package/dist/handlers/table/handleValidateTable.js +125 -0
- package/dist/handlers/table/readonly/handleGetTable.d.ts +20 -0
- package/dist/handlers/table/readonly/handleGetTable.d.ts.map +1 -0
- package/dist/handlers/table/readonly/handleGetTable.js +140 -0
- package/dist/handlers/transport/handleCreateTransport.d.ts +50 -0
- package/dist/handlers/transport/handleCreateTransport.d.ts.map +1 -0
- package/dist/handlers/transport/handleCreateTransport.js +151 -0
- package/dist/handlers/transport/handleGetTransport.d.ts +44 -0
- package/dist/handlers/transport/handleGetTransport.d.ts.map +1 -0
- package/dist/handlers/transport/handleGetTransport.js +183 -0
- package/dist/handlers/view/handleCreateView.d.ts +52 -0
- package/dist/handlers/view/handleCreateView.d.ts.map +1 -0
- package/dist/handlers/view/handleCreateView.js +139 -0
- package/dist/handlers/view/handleGetView.d.ts +26 -0
- package/dist/handlers/view/handleGetView.d.ts.map +1 -0
- package/dist/handlers/view/handleGetView.js +349 -0
- package/dist/handlers/view/handleUpdateViewSource.d.ts +44 -0
- package/dist/handlers/view/handleUpdateViewSource.d.ts.map +1 -0
- package/dist/handlers/view/handleUpdateViewSource.js +136 -0
- package/dist/handlers/view/readonly/handleGetView.d.ts +26 -0
- package/dist/handlers/view/readonly/handleGetView.d.ts.map +1 -0
- package/dist/handlers/view/readonly/handleGetView.js +349 -0
- package/dist/index.d.ts +94 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2453 -0
- package/dist/lib/activationUtils.d.ts +59 -0
- package/dist/lib/activationUtils.d.ts.map +1 -0
- package/dist/lib/activationUtils.js +168 -0
- package/dist/lib/config/ArgumentsParser.d.ts +2 -0
- package/dist/lib/config/ArgumentsParser.d.ts.map +1 -1
- package/dist/lib/config/ArgumentsParser.js +11 -1
- package/dist/lib/config/ArgumentsParser.js.map +1 -1
- package/dist/lib/config/IServerConfig.d.ts +2 -0
- package/dist/lib/config/IServerConfig.d.ts.map +1 -1
- package/dist/lib/config/ServerConfigManager.d.ts.map +1 -1
- package/dist/lib/config/ServerConfigManager.js +3 -0
- package/dist/lib/config/ServerConfigManager.js.map +1 -1
- package/dist/lib/getFullCodeCache.d.ts +3 -0
- package/dist/lib/getFullCodeCache.d.ts.map +1 -0
- package/dist/lib/getFullCodeCache.js +56 -0
- package/dist/lib/toolsRegistry.d.ts +13 -0
- package/dist/lib/toolsRegistry.d.ts.map +1 -0
- package/dist/lib/toolsRegistry.js +410 -0
- package/dist/server/AuthBrokerConfig.d.ts.map +1 -1
- package/dist/server/AuthBrokerConfig.js +14 -9
- package/dist/server/AuthBrokerConfig.js.map +1 -1
- package/dist/server/BaseMcpServer.d.ts.map +1 -1
- package/dist/server/BaseMcpServer.js +6 -0
- package/dist/server/BaseMcpServer.js.map +1 -1
- package/dist/server/launcher.js +4 -4
- package/dist/server/launcher.js.map +1 -1
- package/dist/utils/lockStateManager.d.ts +64 -0
- package/dist/utils/lockStateManager.d.ts.map +1 -0
- package/dist/utils/lockStateManager.js +173 -0
- package/dist/utils/lockStateManager.js.map +1 -0
- package/docs/user-guide/AUTHENTICATION.md +7 -0
- package/docs/user-guide/CLI_OPTIONS.md +14 -0
- package/package.json +2 -1
- package/dist/handlers/service_binding/high/handleListServiceBindings.d.ts +0 -44
- package/dist/handlers/service_binding/high/handleListServiceBindings.d.ts.map +0 -1
- package/dist/handlers/service_binding/high/handleListServiceBindings.js +0 -211
- package/dist/handlers/service_binding/high/handleListServiceBindings.js.map +0 -1
- package/dist/handlers/service_binding/high/serviceBindingXmlBuilder.d.ts +0 -11
- package/dist/handlers/service_binding/high/serviceBindingXmlBuilder.d.ts.map +0 -1
- package/dist/handlers/service_binding/high/serviceBindingXmlBuilder.js +0 -27
- package/dist/handlers/service_binding/high/serviceBindingXmlBuilder.js.map +0 -1
- package/dist/handlers/system/readonly/handleRuntimeGetDumpByUri.d.ts +0 -27
- package/dist/handlers/system/readonly/handleRuntimeGetDumpByUri.d.ts.map +0 -1
- package/dist/handlers/system/readonly/handleRuntimeGetDumpByUri.js +0 -47
- package/dist/handlers/system/readonly/handleRuntimeGetDumpByUri.js.map +0 -1
- package/dist/handlers/system/readonly/runtimeDumpReadCompat.d.ts +0 -8
- package/dist/handlers/system/readonly/runtimeDumpReadCompat.d.ts.map +0 -1
- package/dist/handlers/system/readonly/runtimeDumpReadCompat.js +0 -55
- package/dist/handlers/system/readonly/runtimeDumpReadCompat.js.map +0 -1
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* CreateView Handler - CDS/Classic View Creation via ADT API
|
|
4
|
+
*
|
|
5
|
+
* Uses ViewBuilder from @mcp-abap-adt/adt-clients for all operations.
|
|
6
|
+
* Session and lock management handled internally by builder.
|
|
7
|
+
*
|
|
8
|
+
* Workflow: validate -> create -> lock -> update -> check -> unlock -> (activate)
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.TOOL_DEFINITION = void 0;
|
|
12
|
+
exports.handleCreateView = handleCreateView;
|
|
13
|
+
const utils_1 = require("../../lib/utils");
|
|
14
|
+
const transportValidation_js_1 = require("../../utils/transportValidation.js");
|
|
15
|
+
const fast_xml_parser_1 = require("fast-xml-parser");
|
|
16
|
+
const adt_clients_1 = require("@mcp-abap-adt/adt-clients");
|
|
17
|
+
exports.TOOL_DEFINITION = {
|
|
18
|
+
name: "CreateView",
|
|
19
|
+
description: "Create CDS View or Classic View in SAP using DDL syntax. Both types use the same API workflow, differing only in DDL content (CDS has @AbapCatalog annotations).",
|
|
20
|
+
inputSchema: {
|
|
21
|
+
type: "object",
|
|
22
|
+
properties: {
|
|
23
|
+
view_name: {
|
|
24
|
+
type: "string",
|
|
25
|
+
description: "View name (e.g., ZOK_R_TEST_0002, Z_I_MY_VIEW). Must follow SAP naming conventions."
|
|
26
|
+
},
|
|
27
|
+
ddl_source: {
|
|
28
|
+
type: "string",
|
|
29
|
+
description: "Complete DDL source code. CDS: include @AbapCatalog.sqlViewName and other annotations. Classic: plain 'define view' statement."
|
|
30
|
+
},
|
|
31
|
+
package_name: {
|
|
32
|
+
type: "string",
|
|
33
|
+
description: "Package name (e.g., ZOK_LAB, $TMP for local objects)"
|
|
34
|
+
},
|
|
35
|
+
transport_request: {
|
|
36
|
+
type: "string",
|
|
37
|
+
description: "Transport request number (e.g., E19K905635). Required for transportable packages."
|
|
38
|
+
},
|
|
39
|
+
description: {
|
|
40
|
+
type: "string",
|
|
41
|
+
description: "Optional description. If not provided, view_name will be used."
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
required: ["view_name", "ddl_source", "package_name"]
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Main handler for CreateView MCP tool
|
|
49
|
+
*
|
|
50
|
+
* Uses ViewBuilder from @mcp-abap-adt/adt-clients for all operations
|
|
51
|
+
* Session and lock management handled internally by builder
|
|
52
|
+
*/
|
|
53
|
+
async function handleCreateView(params) {
|
|
54
|
+
try {
|
|
55
|
+
const args = params;
|
|
56
|
+
if (!args.view_name || !args.ddl_source || !args.package_name) {
|
|
57
|
+
return (0, utils_1.return_error)(new Error("Missing required parameters: view_name, ddl_source, and package_name"));
|
|
58
|
+
}
|
|
59
|
+
// Validate transport_request: required for non-$TMP packages
|
|
60
|
+
try {
|
|
61
|
+
(0, transportValidation_js_1.validateTransportRequest)(args.package_name, args.transport_request);
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
return (0, utils_1.return_error)(error);
|
|
65
|
+
}
|
|
66
|
+
const connection = (0, utils_1.getManagedConnection)();
|
|
67
|
+
const viewName = args.view_name.toUpperCase();
|
|
68
|
+
utils_1.logger.info(`Starting view creation: ${viewName}`);
|
|
69
|
+
try {
|
|
70
|
+
// Create client
|
|
71
|
+
const client = new adt_clients_1.CrudClient(connection);
|
|
72
|
+
const shouldActivate = true; // Default to true for views
|
|
73
|
+
// Validate
|
|
74
|
+
await client.validateView(viewName);
|
|
75
|
+
// Create
|
|
76
|
+
await client.createView(viewName, args.description || viewName, args.package_name, args.transport_request);
|
|
77
|
+
// Lock
|
|
78
|
+
await client.lockView(viewName);
|
|
79
|
+
const lockHandle = client.getLockHandle();
|
|
80
|
+
// Update with DDL source
|
|
81
|
+
await client.updateView(viewName, args.ddl_source, lockHandle);
|
|
82
|
+
// Check
|
|
83
|
+
await client.checkView(viewName);
|
|
84
|
+
// Unlock
|
|
85
|
+
await client.unlockView(viewName, lockHandle);
|
|
86
|
+
// Activate
|
|
87
|
+
if (shouldActivate) {
|
|
88
|
+
await client.activateView(viewName);
|
|
89
|
+
}
|
|
90
|
+
// Parse activation warnings if activation was performed
|
|
91
|
+
let activationWarnings = [];
|
|
92
|
+
if (shouldActivate && client.getActivateResult()) {
|
|
93
|
+
const activateResponse = client.getActivateResult();
|
|
94
|
+
if (typeof activateResponse.data === 'string' && activateResponse.data.includes('<chkl:messages')) {
|
|
95
|
+
const parser = new fast_xml_parser_1.XMLParser({ ignoreAttributes: false, attributeNamePrefix: '@_' });
|
|
96
|
+
const result = parser.parse(activateResponse.data);
|
|
97
|
+
const messages = result?.['chkl:messages']?.['msg'];
|
|
98
|
+
if (messages) {
|
|
99
|
+
const msgArray = Array.isArray(messages) ? messages : [messages];
|
|
100
|
+
activationWarnings = msgArray.map((msg) => `${msg['@_type']}: ${msg['shortText']?.['txt'] || 'Unknown'}`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
utils_1.logger.info(`✅ CreateView completed successfully: ${viewName}`);
|
|
105
|
+
const result = {
|
|
106
|
+
success: true,
|
|
107
|
+
view_name: viewName,
|
|
108
|
+
package_name: args.package_name,
|
|
109
|
+
transport_request: args.transport_request || null,
|
|
110
|
+
type: 'DDLS',
|
|
111
|
+
message: `View ${viewName} created and activated successfully`,
|
|
112
|
+
uri: `/sap/bc/adt/ddic/ddl/sources/${(0, utils_1.encodeSapObjectName)(viewName).toLowerCase()}`,
|
|
113
|
+
steps_completed: ['validate', 'create', 'lock', 'update', 'check', 'unlock', 'activate'],
|
|
114
|
+
activation_warnings: activationWarnings.length > 0 ? activationWarnings : undefined
|
|
115
|
+
};
|
|
116
|
+
return (0, utils_1.return_response)({
|
|
117
|
+
data: JSON.stringify(result, null, 2),
|
|
118
|
+
status: 200,
|
|
119
|
+
statusText: 'OK',
|
|
120
|
+
headers: {},
|
|
121
|
+
config: {}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
utils_1.logger.error(`Error creating view ${viewName}:`, error);
|
|
126
|
+
// Check if view already exists
|
|
127
|
+
if (error.message?.includes('already exists') || error.response?.status === 409) {
|
|
128
|
+
return (0, utils_1.return_error)(new Error(`View ${viewName} already exists. Please delete it first or use a different name.`));
|
|
129
|
+
}
|
|
130
|
+
const errorMessage = error.response?.data
|
|
131
|
+
? (typeof error.response.data === 'string' ? error.response.data : JSON.stringify(error.response.data))
|
|
132
|
+
: error.message || String(error);
|
|
133
|
+
return (0, utils_1.return_error)(new Error(`Failed to create view ${viewName}: ${errorMessage}`));
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
return (0, utils_1.return_error)(error);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GetView Handler - ABAP Database View Retrieval via ADT API
|
|
3
|
+
*
|
|
4
|
+
* APPROACH:
|
|
5
|
+
* - Similar to GetTable pattern: GET request to retrieve view definition
|
|
6
|
+
* - View-specific XML structure with ddic:view namespace
|
|
7
|
+
* - Parse tables, fields, joins, and selection conditions
|
|
8
|
+
* - Support for both normal views and maintenance views
|
|
9
|
+
*/
|
|
10
|
+
import * as z from 'zod';
|
|
11
|
+
export declare const TOOL_DEFINITION: {
|
|
12
|
+
readonly name: "GetView";
|
|
13
|
+
readonly description: "Retrieve ABAP database view definition including tables, fields, joins, and selection conditions.";
|
|
14
|
+
readonly inputSchema: {
|
|
15
|
+
readonly view_name: z.ZodString;
|
|
16
|
+
readonly filePath: z.ZodOptional<z.ZodString>;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export declare function handleGetView(args: any): Promise<{
|
|
20
|
+
isError: boolean;
|
|
21
|
+
content: {
|
|
22
|
+
type: string;
|
|
23
|
+
text: any;
|
|
24
|
+
}[];
|
|
25
|
+
}>;
|
|
26
|
+
//# sourceMappingURL=handleGetView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleGetView.d.ts","sourceRoot":"","sources":["../../../src/handlers/view/handleGetView.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,eAAO,MAAM,eAAe;;;;;;;CAOlB,CAAC;AAsLX,wBAAsB,aAAa,CAAC,IAAI,EAAE,GAAG;;;;;;GAqI5C"}
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* GetView Handler - ABAP Database View Retrieval via ADT API
|
|
4
|
+
*
|
|
5
|
+
* APPROACH:
|
|
6
|
+
* - Similar to GetTable pattern: GET request to retrieve view definition
|
|
7
|
+
* - View-specific XML structure with ddic:view namespace
|
|
8
|
+
* - Parse tables, fields, joins, and selection conditions
|
|
9
|
+
* - Support for both normal views and maintenance views
|
|
10
|
+
*/
|
|
11
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
16
|
+
}
|
|
17
|
+
Object.defineProperty(o, k2, desc);
|
|
18
|
+
}) : (function(o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
o[k2] = m[k];
|
|
21
|
+
}));
|
|
22
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
23
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
24
|
+
}) : function(o, v) {
|
|
25
|
+
o["default"] = v;
|
|
26
|
+
});
|
|
27
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
28
|
+
var ownKeys = function(o) {
|
|
29
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
30
|
+
var ar = [];
|
|
31
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
32
|
+
return ar;
|
|
33
|
+
};
|
|
34
|
+
return ownKeys(o);
|
|
35
|
+
};
|
|
36
|
+
return function (mod) {
|
|
37
|
+
if (mod && mod.__esModule) return mod;
|
|
38
|
+
var result = {};
|
|
39
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
40
|
+
__setModuleDefault(result, mod);
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
})();
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.TOOL_DEFINITION = void 0;
|
|
46
|
+
exports.handleGetView = handleGetView;
|
|
47
|
+
const utils_1 = require("../../lib/utils");
|
|
48
|
+
const utils_2 = require("../../lib/utils");
|
|
49
|
+
const fast_xml_parser_1 = require("fast-xml-parser");
|
|
50
|
+
const writeResultToFile_1 = require("../../lib/writeResultToFile");
|
|
51
|
+
const z = __importStar(require("zod"));
|
|
52
|
+
exports.TOOL_DEFINITION = {
|
|
53
|
+
name: "GetView",
|
|
54
|
+
description: "Retrieve ABAP database view definition including tables, fields, joins, and selection conditions.",
|
|
55
|
+
inputSchema: {
|
|
56
|
+
view_name: z.string().describe("Name of the ABAP database view"),
|
|
57
|
+
filePath: z.string().optional().describe("Optional file path to write the result to")
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Parse database view XML structure
|
|
62
|
+
*/
|
|
63
|
+
function parseViewXml(xml) {
|
|
64
|
+
const parser = new fast_xml_parser_1.XMLParser({
|
|
65
|
+
ignoreAttributes: false,
|
|
66
|
+
attributeNamePrefix: '',
|
|
67
|
+
parseAttributeValue: true,
|
|
68
|
+
trimValues: true
|
|
69
|
+
});
|
|
70
|
+
const result = parser.parse(xml);
|
|
71
|
+
// DDIC Database View (VIEW/DV)
|
|
72
|
+
if (result['ddic:view']) {
|
|
73
|
+
const v = result['ddic:view'];
|
|
74
|
+
// Parse view tables
|
|
75
|
+
const tables = Array.isArray(v['ddic:tables']?.['ddic:table'])
|
|
76
|
+
? v['ddic:tables']['ddic:table']
|
|
77
|
+
: v['ddic:tables']?.['ddic:table']
|
|
78
|
+
? [v['ddic:tables']['ddic:table']]
|
|
79
|
+
: [];
|
|
80
|
+
// Parse view fields
|
|
81
|
+
const fields = Array.isArray(v['ddic:fields']?.['ddic:field'])
|
|
82
|
+
? v['ddic:fields']['ddic:field']
|
|
83
|
+
: v['ddic:fields']?.['ddic:field']
|
|
84
|
+
? [v['ddic:fields']['ddic:field']]
|
|
85
|
+
: [];
|
|
86
|
+
// Parse joins
|
|
87
|
+
const joins = Array.isArray(v['ddic:joins']?.['ddic:join'])
|
|
88
|
+
? v['ddic:joins']['ddic:join']
|
|
89
|
+
: v['ddic:joins']?.['ddic:join']
|
|
90
|
+
? [v['ddic:joins']['ddic:join']]
|
|
91
|
+
: [];
|
|
92
|
+
// Parse selection conditions
|
|
93
|
+
const conditions = Array.isArray(v['ddic:conditions']?.['ddic:condition'])
|
|
94
|
+
? v['ddic:conditions']['ddic:condition']
|
|
95
|
+
: v['ddic:conditions']?.['ddic:condition']
|
|
96
|
+
? [v['ddic:conditions']['ddic:condition']]
|
|
97
|
+
: [];
|
|
98
|
+
return {
|
|
99
|
+
name: v['adtcore:name'],
|
|
100
|
+
objectType: 'view',
|
|
101
|
+
description: v['adtcore:description'],
|
|
102
|
+
package: v['adtcore:packageRef']?.['adtcore:name'] || null,
|
|
103
|
+
viewType: v['ddic:viewType'] || 'database_view',
|
|
104
|
+
maintenanceAllowed: v['ddic:maintenanceAllowed'] === 'true',
|
|
105
|
+
tables: tables.map(t => ({
|
|
106
|
+
name: t['ddic:tableName'] || t['ddic:name'],
|
|
107
|
+
alias: t['ddic:alias'],
|
|
108
|
+
position: parseInt(t['ddic:position'] || '0', 10)
|
|
109
|
+
})),
|
|
110
|
+
fields: fields.map(f => ({
|
|
111
|
+
name: f['ddic:fieldName'] || f['ddic:name'],
|
|
112
|
+
table: f['ddic:tableName'],
|
|
113
|
+
alias: f['ddic:alias'],
|
|
114
|
+
dataType: f['ddic:dataType'],
|
|
115
|
+
length: parseInt(f['ddic:length'] || '0', 10),
|
|
116
|
+
decimals: parseInt(f['ddic:decimals'] || '0', 10),
|
|
117
|
+
key: f['ddic:keyFlag'] === 'true',
|
|
118
|
+
aggregation: f['ddic:aggregation'],
|
|
119
|
+
description: f['ddic:description']
|
|
120
|
+
})),
|
|
121
|
+
joins: joins.map(j => ({
|
|
122
|
+
leftTable: j['ddic:leftTable'],
|
|
123
|
+
rightTable: j['ddic:rightTable'],
|
|
124
|
+
joinType: j['ddic:joinType'] || 'INNER',
|
|
125
|
+
condition: j['ddic:condition']
|
|
126
|
+
})),
|
|
127
|
+
conditions: conditions.map(c => ({
|
|
128
|
+
field: c['ddic:fieldName'],
|
|
129
|
+
operator: c['ddic:operator'],
|
|
130
|
+
value: c['ddic:value'],
|
|
131
|
+
table: c['ddic:tableName']
|
|
132
|
+
})),
|
|
133
|
+
generatedSql: v['ddic:generatedSql']
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
// Fallback for other view types or unstructured XML
|
|
137
|
+
if (result['asx:abap']?.['asx:values']) {
|
|
138
|
+
// Handle ABAP serialized view data
|
|
139
|
+
const abapData = result['asx:abap']['asx:values'];
|
|
140
|
+
return {
|
|
141
|
+
objectType: 'view',
|
|
142
|
+
abap_structure: abapData,
|
|
143
|
+
raw: result
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
// Complete fallback: return raw XML structure
|
|
147
|
+
return {
|
|
148
|
+
raw: result,
|
|
149
|
+
note: 'Unrecognized view XML structure, returning raw parsed content'
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Parse view object properties XML from ADT repository information system
|
|
154
|
+
*/
|
|
155
|
+
function parseViewPropertiesXml(xml) {
|
|
156
|
+
const parser = new fast_xml_parser_1.XMLParser({
|
|
157
|
+
ignoreAttributes: false,
|
|
158
|
+
attributeNamePrefix: "@_"
|
|
159
|
+
});
|
|
160
|
+
const result = parser.parse(xml);
|
|
161
|
+
if (result['opr:objectProperties']?.['opr:object']) {
|
|
162
|
+
const obj = result['opr:objectProperties']['opr:object'];
|
|
163
|
+
const properties = result['opr:objectProperties']['opr:property'] || [];
|
|
164
|
+
return {
|
|
165
|
+
name: obj['@_name'],
|
|
166
|
+
text: obj['@_text'],
|
|
167
|
+
package: obj['@_package'],
|
|
168
|
+
type: obj['@_type'],
|
|
169
|
+
expandable: obj['@_expandable'],
|
|
170
|
+
properties: Array.isArray(properties) ? properties.map(prop => ({
|
|
171
|
+
facet: prop['@_facet'],
|
|
172
|
+
name: prop['@_name'],
|
|
173
|
+
displayName: prop['@_displayName'],
|
|
174
|
+
text: prop['@_text'],
|
|
175
|
+
hasChildrenOfSameFacet: prop['@_hasChildrenOfSameFacet']
|
|
176
|
+
})) : []
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
return {
|
|
180
|
+
raw: result,
|
|
181
|
+
note: 'Unrecognized object properties XML structure'
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Get database view contents (actual data)
|
|
186
|
+
*/
|
|
187
|
+
async function getViewContents(viewName, maxRows = 100) {
|
|
188
|
+
try {
|
|
189
|
+
// Use SQL query handler to get view data
|
|
190
|
+
const sqlQuery = `SELECT * FROM ${viewName}`;
|
|
191
|
+
const url = `${await (0, utils_2.getBaseUrl)()}/sap/bc/adt/datapreview/freestyle`;
|
|
192
|
+
const response = await (0, utils_2.makeAdtRequestWithTimeout)(url, 'POST', 'default', {
|
|
193
|
+
'Content-Type': 'text/plain; charset=utf-8'
|
|
194
|
+
}, sqlQuery);
|
|
195
|
+
// Safely handle response data to avoid circular reference issues
|
|
196
|
+
let responseData;
|
|
197
|
+
try {
|
|
198
|
+
if (typeof response.data === 'object' && response.data !== null) {
|
|
199
|
+
// Try to safely serialize the object
|
|
200
|
+
responseData = JSON.parse(JSON.stringify(response.data));
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
responseData = response.data;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
catch (serializationError) {
|
|
207
|
+
// If serialization fails, convert to string
|
|
208
|
+
responseData = String(response.data);
|
|
209
|
+
}
|
|
210
|
+
return {
|
|
211
|
+
query: sqlQuery,
|
|
212
|
+
maxRows: maxRows,
|
|
213
|
+
data: responseData,
|
|
214
|
+
dataType: typeof response.data,
|
|
215
|
+
note: 'View contents retrieved successfully'
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
catch (error) {
|
|
219
|
+
return {
|
|
220
|
+
error: error instanceof Error ? error.message : String(error),
|
|
221
|
+
note: 'Could not retrieve view data - view might not be activated or accessible'
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
async function handleGetView(args) {
|
|
226
|
+
try {
|
|
227
|
+
if (!args?.view_name) {
|
|
228
|
+
throw new utils_1.McpError(utils_1.ErrorCode.InvalidParams, 'View name is required');
|
|
229
|
+
}
|
|
230
|
+
const results = {
|
|
231
|
+
view_name: args.view_name,
|
|
232
|
+
timestamp: new Date().toISOString()
|
|
233
|
+
};
|
|
234
|
+
// Step 1: Detect view type and get definition
|
|
235
|
+
let definitionSuccess = false;
|
|
236
|
+
let viewType = 'unknown';
|
|
237
|
+
// Try CDS View first (modern views with DDL source)
|
|
238
|
+
try {
|
|
239
|
+
const cdsUrl = `${await (0, utils_2.getBaseUrl)()}/sap/bc/adt/ddic/ddl/sources/${(0, utils_2.encodeSapObjectName)(args.view_name)}`;
|
|
240
|
+
const cdsResponse = await (0, utils_2.makeAdtRequestWithTimeout)(cdsUrl, 'GET', 'default');
|
|
241
|
+
if (cdsResponse.status === 200 && typeof cdsResponse.data === 'string') {
|
|
242
|
+
viewType = 'CDS_VIEW';
|
|
243
|
+
results.definition = {
|
|
244
|
+
source: 'cds_ddl',
|
|
245
|
+
type: 'CDS View',
|
|
246
|
+
ddl_source: cdsResponse.data,
|
|
247
|
+
note: 'Modern CDS View with DDL source code'
|
|
248
|
+
};
|
|
249
|
+
definitionSuccess = true;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
catch (cdsError) {
|
|
253
|
+
// Not a CDS view or not accessible, try database view
|
|
254
|
+
}
|
|
255
|
+
// Try Database View (classic views with metadata only)
|
|
256
|
+
if (!definitionSuccess) {
|
|
257
|
+
try {
|
|
258
|
+
const objectUri = `/sap/bc/adt/vit/wb/object_type/viewdv/object_name/${args.view_name}`;
|
|
259
|
+
const encodedUri = encodeURIComponent(objectUri);
|
|
260
|
+
const propertiesUrl = `${await (0, utils_2.getBaseUrl)()}/sap/bc/adt/repository/informationsystem/objectproperties/values?uri=${encodedUri}`;
|
|
261
|
+
const propertiesResponse = await (0, utils_2.makeAdtRequestWithTimeout)(propertiesUrl, 'GET', 'default');
|
|
262
|
+
if (typeof propertiesResponse.data === 'string' && propertiesResponse.data.trim().startsWith('<?xml')) {
|
|
263
|
+
const viewProperties = parseViewPropertiesXml(propertiesResponse.data);
|
|
264
|
+
viewType = 'DATABASE_VIEW';
|
|
265
|
+
results.definition = {
|
|
266
|
+
source: 'database_view_properties',
|
|
267
|
+
type: 'Database View',
|
|
268
|
+
...viewProperties,
|
|
269
|
+
note: 'Classic database view with metadata only'
|
|
270
|
+
};
|
|
271
|
+
definitionSuccess = true;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
catch (dbViewError) {
|
|
275
|
+
results.definition = {
|
|
276
|
+
error: dbViewError instanceof Error ? dbViewError.message : String(dbViewError),
|
|
277
|
+
note: 'Could not retrieve view as CDS or Database View'
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
// Step 2: Try to get view contents (optional, may fail if view is not accessible)
|
|
282
|
+
try {
|
|
283
|
+
const maxRows = args.max_rows || 100;
|
|
284
|
+
const contentsResult = await getViewContents(args.view_name, maxRows);
|
|
285
|
+
results.contents = contentsResult;
|
|
286
|
+
}
|
|
287
|
+
catch (contentsError) {
|
|
288
|
+
results.contents = {
|
|
289
|
+
error: contentsError instanceof Error ? contentsError.message : String(contentsError),
|
|
290
|
+
note: 'Could not retrieve view contents - this is normal for some view types'
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
// Add view type to results
|
|
294
|
+
results.view_type = viewType;
|
|
295
|
+
results.detection_note = viewType === 'CDS_VIEW'
|
|
296
|
+
? 'Modern CDS View detected - has DDL source code'
|
|
297
|
+
: viewType === 'DATABASE_VIEW'
|
|
298
|
+
? 'Classic Database View detected - metadata only'
|
|
299
|
+
: 'Could not determine view type';
|
|
300
|
+
// Safely serialize results to avoid circular reference issues
|
|
301
|
+
let serializedResults;
|
|
302
|
+
try {
|
|
303
|
+
serializedResults = JSON.stringify(results, null, 2);
|
|
304
|
+
}
|
|
305
|
+
catch (jsonError) {
|
|
306
|
+
// If JSON serialization fails, create a safe version
|
|
307
|
+
const safeResults = {
|
|
308
|
+
view_name: results.view_name,
|
|
309
|
+
timestamp: results.timestamp,
|
|
310
|
+
view_type: results.view_type,
|
|
311
|
+
detection_note: results.detection_note,
|
|
312
|
+
definition: {
|
|
313
|
+
source: results.definition?.source || 'unknown',
|
|
314
|
+
type: results.definition?.type || 'unknown',
|
|
315
|
+
note: results.definition?.note || 'No additional info',
|
|
316
|
+
error: results.definition?.error || null
|
|
317
|
+
},
|
|
318
|
+
contents: {
|
|
319
|
+
error: results.contents?.error || 'Serialization failed',
|
|
320
|
+
note: 'Could not serialize view contents - possible circular reference',
|
|
321
|
+
dataType: results.contents?.dataType || 'unknown'
|
|
322
|
+
},
|
|
323
|
+
serialization_error: jsonError instanceof Error ? jsonError.message : String(jsonError)
|
|
324
|
+
};
|
|
325
|
+
serializedResults = JSON.stringify(safeResults, null, 2);
|
|
326
|
+
}
|
|
327
|
+
const finalResult = {
|
|
328
|
+
isError: false,
|
|
329
|
+
content: [{
|
|
330
|
+
type: "text",
|
|
331
|
+
text: serializedResults
|
|
332
|
+
}]
|
|
333
|
+
};
|
|
334
|
+
// Write to file if path provided
|
|
335
|
+
if (args.filePath) {
|
|
336
|
+
(0, writeResultToFile_1.writeResultToFile)(serializedResults, args.filePath);
|
|
337
|
+
}
|
|
338
|
+
return finalResult;
|
|
339
|
+
}
|
|
340
|
+
catch (error) {
|
|
341
|
+
return {
|
|
342
|
+
isError: true,
|
|
343
|
+
content: [{
|
|
344
|
+
type: "text",
|
|
345
|
+
text: `GetView failed: ${error instanceof Error ? error.message : String(error)}`
|
|
346
|
+
}]
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UpdateViewSource Handler - Update Existing CDS/Classic View DDL Source
|
|
3
|
+
*
|
|
4
|
+
* Uses ViewBuilder from @mcp-abap-adt/adt-clients for all operations.
|
|
5
|
+
* Session and lock management handled internally by builder.
|
|
6
|
+
*
|
|
7
|
+
* Workflow: validate -> lock -> update -> check -> unlock -> (activate)
|
|
8
|
+
*/
|
|
9
|
+
export declare const TOOL_DEFINITION: {
|
|
10
|
+
readonly name: "UpdateViewSource";
|
|
11
|
+
readonly description: "Update DDL source code of an existing CDS View or Classic View. Locks the view, uploads new DDL source, and unlocks. Optionally activates after update. Use this to modify existing views without re-creating metadata.";
|
|
12
|
+
readonly inputSchema: {
|
|
13
|
+
readonly type: "object";
|
|
14
|
+
readonly properties: {
|
|
15
|
+
readonly view_name: {
|
|
16
|
+
readonly type: "string";
|
|
17
|
+
readonly description: "View name (e.g., ZOK_R_TEST_0002). View must already exist.";
|
|
18
|
+
};
|
|
19
|
+
readonly ddl_source: {
|
|
20
|
+
readonly type: "string";
|
|
21
|
+
readonly description: "Complete DDL source code. CDS: include @AbapCatalog.sqlViewName and other annotations. Classic: plain 'define view' statement.";
|
|
22
|
+
};
|
|
23
|
+
readonly activate: {
|
|
24
|
+
readonly type: "boolean";
|
|
25
|
+
readonly description: "Activate view after source update. Default: false. Set to true to activate immediately, or use ActivateObject for batch activation.";
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
readonly required: readonly ["view_name", "ddl_source"];
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Main handler for UpdateViewSource MCP tool
|
|
33
|
+
*
|
|
34
|
+
* Uses ViewBuilder from @mcp-abap-adt/adt-clients for all operations
|
|
35
|
+
* Session and lock management handled internally by builder
|
|
36
|
+
*/
|
|
37
|
+
export declare function handleUpdateViewSource(params: any): Promise<{
|
|
38
|
+
isError: boolean;
|
|
39
|
+
content: {
|
|
40
|
+
type: string;
|
|
41
|
+
text: any;
|
|
42
|
+
}[];
|
|
43
|
+
}>;
|
|
44
|
+
//# sourceMappingURL=handleUpdateViewSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleUpdateViewSource.d.ts","sourceRoot":"","sources":["../../../src/handlers/view/handleUpdateViewSource.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;CAqBlB,CAAC;AASX;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAAC,MAAM,EAAE,GAAG;;;;;;GA6GvD"}
|